Skip to content

Commit faffc59

Browse files
Kitty JoseKitty Jose
authored andcommitted
2 parents 966b44e + c136cff commit faffc59

File tree

6 files changed

+62
-23
lines changed

6 files changed

+62
-23
lines changed

RELEASE_NOTES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# TerminusDB Client v10.0.12
2+
3+
## New 🚀
4+
5+
* Add the ability to add additional diff options to the diff endpoint
6+
7+
# TerminusDB Client v10.0.11
8+
9+
## New 🚀
10+
11+
* Generating type definitions for typescript by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/185
12+
* Added create query parameter for update document by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/189
13+
14+
## Fixes 🛠
15+
16+
* Fixed woql start by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/184
17+
* Fixed bug in WOQL.doc not encoding lists by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/191
18+
* Fixed woql docs by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/194
19+
20+
## Deprecated ☠️
21+
22+
* Deprecated query document by @Neelterminusdb in https://github.com/terminusdb/terminusdb-client-js/pull/187
23+
24+
<br/><br/>
25+
126
# TerminusDB Client v10.0.10
227

328
## New 🚀
@@ -9,19 +34,23 @@
934
* Fix the way of sending tokens to the cloud api by @GavinMendelGleason in https://github.com/terminusdb/terminusdb-client-js/pull/182
1035
* Upgrade async library to prevent prototype pollution
1136

37+
---
1238

1339
# TerminusDB Client v10.0.9
1440

1541
## New 🚀
1642

1743
* Add diff endpoint by @GavinMendelGleason in https://github.com/terminusdb/terminusdb-client-js/pull/178
1844

45+
---
46+
1947
# TerminusDB Client v10.0.8
2048

2149
## New 🚀
2250

2351
* Add gzip compression by @rrooij in https://github.com/terminusdb/terminusdb-client-js/pull/167
2452

53+
---
2554

2655
# TerminusDB Client v10.0.7
2756

docs/api/woql.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Logical conjunction of the contained queries - all queries must match or the ent
7676
//a start_station Start, and that start_station is labeled Start_Label
7777
let [Journey, Start, Start_Label] = vars("Journey", "Start", "Start_Label")
7878
WOQL.and(
79-
WOQL.triple(Journey, "type", "scm:Journey"),
79+
WOQL.triple(Journey, "rdf:type", "@schema:Journey"),
8080
WOQL.triple(Journey, "start_station", Start),
8181
WOQL.triple(Start, "label", Start_Label))
8282
```
@@ -195,7 +195,7 @@ Specifies the graph resource to write the contained query into
195195
**Example**
196196
```javascript
197197
//Subq is an argument or a chained query
198-
using("admin/minecraft").into("instance/main").add_triple("a", "type", "scm:X")
198+
using("admin/minecraft").into("instance/main").add_triple("a", "rdf:type", "@schema:X")
199199
//writes a single tripe (doc:a, rdf:type, scm:X) into the main instance graph
200200
```
201201

@@ -453,8 +453,8 @@ Deletes a single triple from the graph [Subject, Predicate, Object, Graph]
453453

454454
**Example**
455455
```javascript
456-
remove the class Person from the schema/main graph
457-
WOQL.delete_quad("Person", "type", "owl:Class", "schema/main")
456+
remove the class Person from the schema graph
457+
WOQL.delete_quad("Person", "rdf:type", "sys:Class", "schema")
458458
```
459459

460460
## add_triple
@@ -1051,7 +1051,7 @@ Creates a count of the results of the query
10511051
**Example**
10521052
```javascript
10531053
let [count, Person] = vars("count", "Person")
1054-
WOQL.count(count).triple(Person, "type", "scm:Person")
1054+
WOQL.count(count).triple(Person, "rdf:type", "@schema:Person")
10551055
```
10561056

10571057
## typecast
@@ -1261,7 +1261,7 @@ optionally into the specified graph
12611261
**Example**
12621262
```javascript
12631263
insert("mydoc", "MyType")
1264-
//equivalent to add_triple("mydoc", "type", "MyType")
1264+
//equivalent to add_triple("mydoc", "rdf:type", "@schema:MyType")
12651265
```
12661266

12671267
## graph

docs/api/woqlclient.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ async funtion callGetUserOrganizations(){
11231123
```
11241124
11251125
## getDiff
1126-
##### woqlClient.getDiff(before, after) ⇒ <code>Promise</code>
1126+
##### woqlClient.getDiff(before, after, options) ⇒ <code>Promise</code>
11271127
Get the patch of difference between two documents.
11281128
11291129
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -1132,6 +1132,7 @@ Get the patch of difference between two documents.
11321132
| --- | --- | --- |
11331133
| before | <code>object</code> | The current state of JSON document |
11341134
| after | <code>object</code> | The updated state of JSON document |
1135+
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
11351136
11361137
**Example**
11371138
```javascript
@@ -1142,7 +1143,7 @@ const diff = await client.getDiff(
11421143
```
11431144
11441145
## getVersionObjectDiff
1145-
##### woqlClient.getVersionObjectDiff(id, beforeVersion, after) ⇒ <code>Promise</code>
1146+
##### woqlClient.getVersionObjectDiff(id, beforeVersion, after, options) ⇒ <code>Promise</code>
11461147
Get the patch of difference between two documents.
11471148
11481149
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -1152,6 +1153,7 @@ Get the patch of difference between two documents.
11521153
| id | <code>string</code> | The object id to be diffed |
11531154
| beforeVersion | <code>string</code> | The version from which to compare the object |
11541155
| after | <code>object</code> | The updated state of JSON document |
1156+
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
11551157
11561158
**Example**
11571159
```javascript
@@ -1163,7 +1165,7 @@ const diff = await client.getVersionObjectDiff(
11631165
```
11641166
11651167
## getVersionDiff
1166-
##### woqlClient.getVersionDiff(id, beforeVersion, afterVersion) ⇒ <code>Promise</code>
1168+
##### woqlClient.getVersionDiff(id, beforeVersion, afterVersion, options) ⇒ <code>Promise</code>
11671169
Get the patch of difference between two documents.
11681170
11691171
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -1173,6 +1175,7 @@ Get the patch of difference between two documents.
11731175
| id | <code>string</code> | The object id to be diffed |
11741176
| beforeVersion | <code>string</code> | The version from which to compare the object |
11751177
| afterVersion | <code>string</code> | The version to which to compare the object |
1178+
| options | <code>object</code> | [{}] - Options to send to the diff endpoint |
11761179
11771180
**Example**
11781181
```javascript

lib/woql.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ WOQL.distinct = function (...varNames) {
8383
* //a start_station Start, and that start_station is labeled Start_Label
8484
* let [Journey, Start, Start_Label] = vars("Journey", "Start", "Start_Label")
8585
* WOQL.and(
86-
* WOQL.triple(Journey, "type", "scm:Journey"),
86+
* WOQL.triple(Journey, "rdf:type", "@schema:Journey"),
8787
* WOQL.triple(Journey, "start_station", Start),
8888
* WOQL.triple(Start, "label", Start_Label))
8989
*
@@ -191,7 +191,7 @@ WOQL.from = function (graphRef, query) {
191191
* @returns {WOQLQuery} A WOQLQuery which will be written into the graph in question
192192
* @example
193193
* //Subq is an argument or a chained query
194-
* using("admin/minecraft").into("instance/main").add_triple("a", "type", "scm:X")
194+
* using("admin/minecraft").into("instance/main").add_triple("a", "rdf:type", "@schema:X")
195195
* //writes a single tripe (doc:a, rdf:type, scm:X) into the main instance graph
196196
*
197197
*/
@@ -424,8 +424,8 @@ WOQL.delete_triple = function (subject, predicate, object) {
424424
* @param {string} object - The IRI of a node or a variable, or a literal
425425
* @param {typedef.GraphRef} graphRef - A valid graph resource identifier string
426426
* @returns {WOQLQuery} - A WOQLQuery which contains the Delete Quad Statement
427-
* @example remove the class Person from the schema/main graph
428-
* WOQL.delete_quad("Person", "type", "owl:Class", "schema/main")
427+
* @example remove the class Person from the schema graph
428+
* WOQL.delete_quad("Person", "rdf:type", "sys:Class", "schema")
429429
*/
430430
WOQL.delete_quad = function (subject, predicate, object, graphRef) {
431431
return new WOQLQuery().delete_quad(subject, predicate, object, graphRef);
@@ -975,7 +975,7 @@ WOQL.immediately = function (subquery) {
975975
* @returns {WOQLQuery} A WOQLQuery object containing the count sub Query
976976
* @example
977977
* let [count, Person] = vars("count", "Person")
978-
* WOQL.count(count).triple(Person, "type", "scm:Person")
978+
* WOQL.count(count).triple(Person, "rdf:type", "@schema:Person")
979979
*/
980980
WOQL.count = function (countVarName, subquery) {
981981
return new WOQLQuery().count(countVarName, subquery);
@@ -1186,7 +1186,7 @@ WOQL.node = function (nodeid, chainType) {
11861186
* @returns {WOQLQuery} A WOQLQuery which contains the insert expression
11871187
* @example
11881188
* insert("mydoc", "MyType")
1189-
* //equivalent to add_triple("mydoc", "type", "MyType")
1189+
* //equivalent to add_triple("mydoc", "rdf:type", "@schema:MyType")
11901190
*/
11911191
WOQL.insert = function (classId, classType, graphRef) {
11921192
return new WOQLQuery().insert(classId, classType, graphRef);

lib/woqlClient.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,23 +1468,25 @@ WOQLClient.prototype.userOrganizations = function (orgList) {
14681468
* Get the patch of difference between two documents.
14691469
* @param {object} before - The current state of JSON document
14701470
* @param {object} after - The updated state of JSON document
1471+
* @param {object} options [{}] - Options to send to the diff endpoint
14711472
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
14721473
* @example
14731474
* const diff = await client.getDiff(
14741475
* { "@id": "Person/Jane", "@type": "Person", name: "Jane" },
14751476
* { "@id": "Person/Jane", "@type": "Person", name: "Janine" }
14761477
* );
14771478
*/
1478-
WOQLClient.prototype.getDiff = function (before, after) {
1479+
WOQLClient.prototype.getDiff = function (before, after, options) {
14791480
if (typeof before !== 'object' || typeof after !== 'object') {
14801481
const errmsg = '"before" or "after" parameter error - you must specify a valid before or after json document';
14811482

14821483
return Promise.reject(
14831484
new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),
14841485
);
14851486
}
1487+
const opt = (typeof options === 'undefined') ? {} : options;
1488+
const payload = { before, after, ...opt };
14861489

1487-
const payload = { before, after };
14881490
return this.dispatch(
14891491
CONST.POST,
14901492
`${this.connectionConfig.apiURL()}diff`,
@@ -1497,6 +1499,7 @@ WOQLClient.prototype.getDiff = function (before, after) {
14971499
* @param {string} id - The object id to be diffed
14981500
* @param {string} beforeVersion - The version from which to compare the object
14991501
* @param {object} after - The updated state of JSON document
1502+
* @param {object} options [{}] - Options to send to the diff endpoint
15001503
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
15011504
* @example
15021505
* const diff = await client.getVersionObjectDiff(
@@ -1505,16 +1508,18 @@ WOQLClient.prototype.getDiff = function (before, after) {
15051508
* { "@id": "Person/Jane", "@type": "Person", name: "Janine" }
15061509
* );
15071510
*/
1508-
WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after) {
1511+
WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after, options) {
15091512
if (typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof after !== 'object') {
15101513
const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version';
15111514

15121515
return Promise.reject(
15131516
new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),
15141517
);
15151518
}
1516-
1517-
const payload = { document_id: id, before_data_version: beforeVersion, after };
1519+
const opt = (typeof options === 'undefined') ? {} : options;
1520+
const payload = {
1521+
document_id: id, before_data_version: beforeVersion, after, ...opt,
1522+
};
15181523
return this.dispatch(
15191524
CONST.POST,
15201525
this.connectionConfig.diffURL(),
@@ -1527,6 +1532,7 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
15271532
* @param {string} id - The object id to be diffed
15281533
* @param {string} beforeVersion - The version from which to compare the object
15291534
* @param {string} afterVersion - The version to which to compare the object
1535+
* @param {object} options [{}] - Options to send to the diff endpoint
15301536
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
15311537
* @example
15321538
* const diff = await client.getVersionDiff(
@@ -1535,19 +1541,20 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
15351541
* "branch:73rqpooz65kbsheuno5dsayh71x7wf4"
15361542
* );
15371543
*/
1538-
WOQLClient.prototype.getVersionDiff = function (id, beforeVersion, afterVersion) {
1544+
WOQLClient.prototype.getVersionDiff = function (id, beforeVersion, afterVersion, options) {
15391545
if (typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof afterVersion !== 'string') {
15401546
const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version';
15411547

15421548
return Promise.reject(
15431549
new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),
15441550
);
15451551
}
1546-
1552+
const opt = (typeof options === 'undefined') ? {} : options;
15471553
const payload = {
15481554
document_id: id,
15491555
before_data_version: beforeVersion,
15501556
after_data_version: afterVersion,
1557+
...opt,
15511558
};
15521559
return this.dispatch(
15531560
CONST.POST,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@terminusdb/terminusdb-client",
3-
"version": "10.0.10",
3+
"version": "10.0.12",
44
"description": "TerminusDB client library",
55
"main": "index.js",
66
"types": "./dist/typescript/index.d.ts",

0 commit comments

Comments
 (0)