Skip to content

Commit dee1a29

Browse files
committed
Merge branch 'depricConnect' of https://github.com/terminusdb/terminusdb-client-js into depricConnect
2 parents 528b40d + 4544a2b commit dee1a29

File tree

7 files changed

+192
-46
lines changed

7 files changed

+192
-46
lines changed

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
TerminusDB Client Javascript
2-
==========================
1+
[![TerminusDB JavaScript Client](https://assets.terminusdb.com/readmes/terminusdb-client-js/header.gif)][terminusdb-client-js-docs]
32

4-
[![Discord online](https://img.shields.io/discord/689805612053168129?color=7289da&logo=Discord&label=Discord%20chat)](https://discord.gg/yTJKAma)
5-
[![Discourse topics](https://img.shields.io/discourse/topics?color=yellow&logo=Discourse&server=https%3A%2F%2Fdiscuss.terminusdb.com%2F)](https://discuss.terminusdb.com/)
6-
[![Follow on Twitter](https://img.shields.io/twitter/follow/terminusdb?color=skyblue&label=Follow%20on%20Twitter&logo=twitter&style=flat)](https://twitter.com/TerminusDB)
3+
[terminusdb-client-js-docs]: https://terminusdb.github.io/terminusdb-client-js/
74

8-
**Development status ⚙️**
5+
---
96

10-
[![build status](https://api.travis-ci.com/terminusdb/terminusdb-client.svg?branch=main)](https://travis-ci.com/terminusdb/terminusdb-client)
11-
[![Coverage Status](https://coveralls.io/repos/github/terminusdb/terminusdb-client/badge.svg?branch=master)](https://coveralls.io/repos/github/terminusdb/terminusdb-client/badge.svg?branch=master)
7+
[![Discord](https://img.shields.io/discord/689805612053168129?label=Discord&logo=Discord&style=plastic)](https://discord.gg/yTJKAma)
8+
[![Discourse](https://img.shields.io/discourse/topics?color=yellow&logo=Discourse&server=https%3A%2F%2Fdiscuss.terminusdb.com%2F&style=plastic)](https://discuss.terminusdb.com/)
9+
[![Twitter](https://img.shields.io/twitter/follow/terminusdb?color=skyblue&label=Follow%20on%20Twitter&logo=twitter&style=flat)](https://twitter.com/TerminusDB)
1210

13-
**NPM Package status 📦**
11+
[![npm version](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
12+
[![npm downloads](https://img.shields.io/npm/dw/@terminusdb/terminusdb-client?color=red&label=npm%20package&logo=npm&style=flat)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
1413

15-
[![npm version shields.io](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
16-
[![PyPI download month](https://img.shields.io/npm/dw/@terminusdb/terminusdb-client?color=red&label=npm%20package&logo=npm&style=flat)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
14+
> This repository is for the JavaScript client for TerminusDB and TerminusX. The
15+
> JavaScript client runs in the browser and on Node.js.
1716
18-
Promise based terminus client for the browser and node.js
17+
[**TerminusDB**][terminusdb] is an [open-source][terminusdb-repo] graph database
18+
and document store. It allows you to link JSON documents in a powerful knowledge
19+
graph all through a simple document API.
20+
21+
[terminusdb]: https://terminusdb.com/
22+
[terminusdb-docs]: https://terminusdb.com/docs/
23+
[terminusdb-repo]: https://github.com/terminusdb/terminusdb
24+
25+
**TerminusX** is a self-service data platform that allows you to build, deploy,
26+
execute, monitor, and share versioned data products. It is built on TerminusDB.
27+
TerminusX is in public beta and you can [sign up now][dashboard].
28+
29+
[dashboard]: https://dashboard.terminusdb.com/
1930

2031
## Requirements
2132

@@ -59,7 +70,7 @@ Download the terminusdb-client.min.js file from the /dist directory and save it
5970
This example creates a simple dataProduct, starting to create a database model the schema
6071
and insert a simple document
6172

62-
For the [full Documentation](https://terminusdb.github.io/terminusdb-client-js/)
73+
For the [full Documentation][terminusdb-client-js-docs]
6374

6475
```javascript
6576
const TerminusClient = require("@terminusdb/terminusdb-client");
@@ -99,7 +110,7 @@ const bankerSchema = [
99110

100111
async function createDataProduct(){
101112
try{
102-
await client.connect()
113+
103114
await client.createDatabase("banker", {label: "Banker Account",
104115
comment: "Testing", schema: true})
105116
//add the schema documents
@@ -144,7 +155,7 @@ const client = new TerminusClient.WOQLClient("http://127.0.0.1:6363/", {
144155

145156
## API
146157

147-
The API of the most recent release is documented at: <https://terminusdb.com/docs/v10.0/#/reference/reference-api>
158+
The TerminusDB API can be found at the [TerminusDB Documentation][terminusdb-docs].
148159

149160
## Report Issues
150161

RELEASE_NOTES.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
# TerminusDB Client v10.0.4
2+
3+
## New 🚀
4+
5+
* Added AccessControl class
6+
* Added diff and patch functions in WOQL.client
7+
8+
## Fixes 🛠
9+
10+
* Fixed create new branch documentation [#105](/../../issues/105)
11+
12+
---
13+
114
# TerminusDB Client v10.0.3
215

3-
## new 🚀
16+
## New 🚀
417

518
* Added support for new API authentication with TerminusX
619

docs/README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
TerminusDB Client Javascript
2-
==========================
1+
[![TerminusDB JavaScript Client](https://assets.terminusdb.com/readmes/terminusdb-client-js/header.gif)][terminusdb-client-js-docs]
32

4-
[![Discord online](https://img.shields.io/discord/689805612053168129?color=7289da&logo=Discord&label=Discord%20chat)](https://discord.gg/yTJKAma)
5-
[![Discourse topics](https://img.shields.io/discourse/topics?color=yellow&logo=Discourse&server=https%3A%2F%2Fdiscuss.terminusdb.com%2F)](https://discuss.terminusdb.com/)
6-
[![Follow on Twitter](https://img.shields.io/twitter/follow/terminusdb?color=skyblue&label=Follow%20on%20Twitter&logo=twitter&style=flat)](https://twitter.com/TerminusDB)
3+
[terminusdb-client-js-docs]: https://terminusdb.github.io/terminusdb-client-js/
74

8-
**Development status ⚙️**
5+
---
96

10-
[![build status](https://api.travis-ci.com/terminusdb/terminusdb-client.svg?branch=main)](https://travis-ci.com/terminusdb/terminusdb-client)
11-
[![Coverage Status](https://coveralls.io/repos/github/terminusdb/terminusdb-client/badge.svg?branch=master)](https://coveralls.io/repos/github/terminusdb/terminusdb-client/badge.svg?branch=master)
7+
[![Discord](https://img.shields.io/discord/689805612053168129?label=Discord&logo=Discord&style=plastic)](https://discord.gg/yTJKAma)
8+
[![Discourse](https://img.shields.io/discourse/topics?color=yellow&logo=Discourse&server=https%3A%2F%2Fdiscuss.terminusdb.com%2F&style=plastic)](https://discuss.terminusdb.com/)
9+
[![Twitter](https://img.shields.io/twitter/follow/terminusdb?color=skyblue&label=Follow%20on%20Twitter&logo=twitter&style=flat)](https://twitter.com/TerminusDB)
1210

13-
**NPM Package status 📦**
11+
[![npm version](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
12+
[![npm downloads](https://img.shields.io/npm/dw/@terminusdb/terminusdb-client?color=red&label=npm%20package&logo=npm&style=flat)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
1413

15-
[![npm version shields.io](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
16-
[![PyPI download month](https://img.shields.io/npm/dw/@terminusdb/terminusdb-client?color=red&label=npm%20package&logo=npm&style=flat)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
14+
> This repository is for the JavaScript client for TerminusDB and TerminusX. The
15+
> JavaScript client runs in the browser and on Node.js.
1716
18-
Promise based terminus client for the browser and node.js
17+
[**TerminusDB**][terminusdb] is an [open-source][terminusdb-repo] graph database
18+
and document store. It allows you to link JSON documents in a powerful knowledge
19+
graph all through a simple document API.
20+
21+
[terminusdb]: https://terminusdb.com/
22+
[terminusdb-docs]: https://terminusdb.com/docs/
23+
[terminusdb-repo]: https://github.com/terminusdb/terminusdb
24+
25+
**TerminusX** is a self-service data platform that allows you to build, deploy,
26+
execute, monitor, and share versioned data products. It is built on TerminusDB.
27+
TerminusX is in public beta and you can [sign up now][dashboard].
28+
29+
[dashboard]: https://dashboard.terminusdb.com/
1930

2031
## Requirements
2132

@@ -59,7 +70,7 @@ Download the terminusdb-client.min.js file from the /dist directory and save it
5970
This example creates a simple dataProduct, starting to create a database model the schema
6071
and insert a simple document
6172

62-
For the [full Documentation](https://terminusdb.github.io/terminusdb-client-js/)
73+
For the [full Documentation][terminusdb-client-js-docs]
6374

6475
```javascript
6576
const TerminusClient = require("@terminusdb/terminusdb-client");
@@ -99,7 +110,7 @@ const bankerSchema = [
99110

100111
async function createDataProduct(){
101112
try{
102-
await client.connect()
113+
103114
await client.createDatabase("banker", {label: "Banker Account",
104115
comment: "Testing", schema: true})
105116
//add the schema documents
@@ -144,7 +155,7 @@ const client = new TerminusClient.WOQLClient("http://127.0.0.1:6363/", {
144155

145156
## API
146157

147-
The API of the most recent release is documented at: <https://terminusdb.com/docs/v10.0/#/reference/reference-api>
158+
The TerminusDB API can be found at the [TerminusDB Documentation][terminusdb-docs].
148159

149160
## Report Issues
150161

docs/_sidebar.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!-- docs/_sidebar.md -->
22
- [WOQLClient](api/woqlClient.js?id=WOQLClient)
33
- [TerminusDB Client API](api/woqlClient.js?id=terminusdb-client-api)
4-
- [Connect](api/woqlClient.js?id=connect)
54
- [Create Database](api/woqlClient.js?id=create-database)
65
- [Delete Database](api/woqlClient.js?id=delete-database)
76
- [Get Triples](api/woqlClient.js?id=get-triples)
@@ -59,6 +58,8 @@
5958
- [getEnums](api/woqlClient.js?id=getEnums)
6059
- [getClassDocuments](api/woqlClient.js?id=getClassDocuments)
6160
- [getBranches](api/woqlClient.js?id=getBranches)
61+
- [getDiff](api/woqlClient.js?id=getDiff)
62+
- [patch](api/woqlClient.js?id=patch)
6263
- [WOQL](api/woql.js?id=WOQL)
6364
- [eval](api/woql.js?id=eval)
6465
- [using](api/woql.js?id=using)

docs/api/woqlClient.js.md

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ For situations where you want to communicate with a TerminusDB server API, the W
2020
//to connect with your local terminusDB
2121
const client = new TerminusClient.WOQLClient(SERVER_URL,{user:"admin",key:"myKey"})
2222
async function getSchema() {
23-
await client.connect()
2423
client.db("test")
2524
client.checkout("dev")
2625
const schema = await client.getSchema()
@@ -34,7 +33,6 @@ const client = new TerminusClient.WOQLClient('SERVER_CLOUD_URL/mycloudTeam',
3433

3534
client.setApiKey(MY_ACCESS_TOKEN)
3635
async function getSchema() {
37-
await client.connect()
3836
client.db("test")
3937
client.checkout("dev")
4038
const schema = await client.getSchema()
@@ -44,7 +42,9 @@ async function getSchema() {
4442
### TerminusDB Client API
4543

4644
### Connect
47-
#### woqlClient.connect([params]) ⇒ <code>Promise</code>
45+
#### ~~woqlClient.connect([params]) ⇒ <code>Promise</code>~~
46+
***Deprecated***
47+
4848
Connect to a Terminus server at the given URI with an API key
4949
Stores the system:ServerCapability document returned
5050
in the connection register which stores, the url, key, capabilities,
@@ -165,15 +165,15 @@ client.clonedb({remote_url: "https://my.terminusdb.com/myorg/mydb", label "Clone
165165
```
166166

167167
### Branch
168-
#### woqlClient.branch(newBranchId, [sourceFree]) ⇒ <code>Promise</code>
168+
#### woqlClient.branch(newBranchId, [isEmpty]) ⇒ <code>Promise</code>
169169
Creates a new branch with a TerminusDB database, starting from the current context of the client (branch / ref)
170170

171171
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
172172

173173
| Param | Type | Description |
174174
| --- | --- | --- |
175175
| newBranchId | <code>string</code> | local identifier of the new branch the ID of the new branch to be created |
176-
| [sourceFree] | <code>boolean</code> | if the query contains any updates, it should include a textual message describing the reason for the update |
176+
| [isEmpty] | <code>boolean</code> | if isEmpty is true it will create a empty branch. |
177177

178178
**Example**
179179
```js
@@ -328,7 +328,7 @@ user has fields: [id, name, notes, author]
328328
329329
### databases
330330
#### woqlClient.databases([dbList]) ⇒ <code>array</code>
331-
Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server. Note that this requires the client to call connect() first.
331+
Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server.
332332
333333
**Returns**: <code>array</code> - the user databases list
334334
@@ -343,7 +343,7 @@ const my_dbs = client.databases()
343343
344344
### userOrganizations
345345
#### woqlClient.userOrganizations([orgList]) ⇒ <code>array</code>
346-
Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server. Note that this requires the client to call connect() first.
346+
Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server.
347347
348348
**Returns**: <code>array</code> - the user databases list
349349
@@ -850,3 +850,43 @@ get the database collections list
850850
```js
851851
client.getBranches()
852852
```
853+
854+
### getDiff
855+
#### woqlClient.getDiff(before, after) ⇒ <code>Promise</code>
856+
Get the patch of difference between two documents.
857+
858+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
859+
860+
| Param | Type | Description |
861+
| --- | --- | --- |
862+
| before | <code>object</code> | The current state of JSON document |
863+
| after | <code>object</code> | The updated state of JSON document |
864+
865+
**Example**
866+
```js
867+
const diff = await client.getDiff(
868+
{ "@id": "Person/Jane", "@type": "Person", name: "Jane" },
869+
{ "@id": "Person/Jane", "@type": "Person", name: "Janine" }
870+
);
871+
```
872+
873+
### patch
874+
#### woqlClient.patch(before, patch) ⇒ <code>Promise</code>
875+
Patch the difference between two documents.
876+
877+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
878+
879+
| Param | Type | Description |
880+
| --- | --- | --- |
881+
| before | <code>object</code> | The current state of JSON document |
882+
| patch | <code>object</code> | The patch object |
883+
884+
**Example**
885+
```js
886+
let diffPatch = await client.getDiff(
887+
{ "@id": "Person/Jane", "@type": "Person", name: "Jane" },
888+
{ "@id": "Person/Jane", "@type": "Person", name: "Janine" }
889+
);
890+
891+
let patch = await client.patch( { "@id": "Person/Jane", "@type": "Person", name: "Jane" }, diffPatch);
892+
```

lib/const.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ module.exports = Object.freeze({
4949
ACTION: 'action',
5050
INFO: 'info',
5151
OPTIMIZE_SYSTEM: 'optimize_system',
52+
GET_DIFF: 'getDiff',
53+
PATCH: 'patch',
5254
})

0 commit comments

Comments
 (0)