Skip to content

Commit c903c96

Browse files
committed
Merge branch 'main' into getDatabases
2 parents fed7fe3 + e2547de commit c903c96

File tree

8 files changed

+199
-64
lines changed

8 files changed

+199
-64
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[![npm version](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
1212
[![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)
1313

14-
> This repository is for the JavaScript client for TerminusDB and TerminusX. The
15-
> JavaScript client runs in the browser and on Node.js.
14+
> This repository is for the JavaScript client library for TerminusDB and
15+
> TerminusX.
1616
1717
[**TerminusDB**][terminusdb] is an [open-source][terminusdb-repo] graph database
1818
and document store. It allows you to link JSON documents in a powerful knowledge
@@ -30,40 +30,41 @@ TerminusX is in public beta and you can [sign up now][dashboard].
3030

3131
## Requirements
3232

33-
- [NodeJS 10+](https://nodejs.org/en/)
33+
- Node.js version 10+ if using the TerminusDB client library as a Node.js package
3434

3535
## Installation
3636

37-
TerminusDB Client can be used as either a Node.js module available through the npm registry, or directly included in web-sites by including the script tag below.
37+
The TerminusDB JavaScript client library can be used either as a Node.js package
38+
or as a script that runs in the browser.
3839

39-
### NPM Module
40+
### NPM Package
4041

41-
Before installing, download and install Node.js.<br>
42-
NodeJS version 10.X or higher is required. NodeJS version 14.X is recommended.
42+
> :memo: If you don't already have Node.js installed, [install it][node-install] first.
4343
44-
Installation is done using the npm install command:
44+
[node-install]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
4545

46-
Using npm:
46+
To install the `terminusdb-client` package as a dependency in an existing
47+
package, run:
4748

48-
```bash
49+
```sh
4950
$ npm install --save @terminusdb/terminusdb-client
5051
```
5152

52-
### Minified Script
53+
This command update your `package.json`.
5354

54-
Using cdn:
55+
### Script
56+
57+
To use the `terminusdb-client` script on a webpage sourced from a CDN, add this
58+
to your HTML:
5559

5660
```html
5761
<script src="https://unpkg.com/@terminusdb/terminusdb-client/dist/terminusdb-client.min.js"></script>
5862
```
5963

60-
Downloading:
61-
62-
Download the terminusdb-client.min.js file from the /dist directory and save it to your location of choice, then:
64+
Alternatively, you can download the latest [`terminusdb-client.min.js`][js], add
65+
it to your sources, and use that in the `<script>` instead.
6366

64-
```html
65-
<script src="http://my.saved.location/terminusdb-client.min.js"></script>
66-
```
67+
[js]: https://unpkg.com/@terminusdb/terminusdb-client/dist/terminusdb-client.min.js
6768

6869
## Usage
6970

RELEASE_NOTES.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# TerminusDB Client v10.0.5
2+
3+
## New 🚀
4+
5+
* Add new [getDatabases](https://terminusdb.github.io/terminusdb-client-js/#/api/woqlClient.js?id=getdatabases) method [#121](/../../pull/121)
6+
* Add track version id [#116](/../../pull/116)
7+
8+
## Fixes 🛠
9+
10+
* Fixed tests [#123](/../../pull/123)
11+
* Modified AccessControl documentations, added api token [#124](/../../pull/124)
12+
* UPDATED packages [#126](/../../pull/126)
13+
14+
## Deprecated ☠️
15+
16+
* Deprecated connect function [#114](/../../pull/114)
17+
18+
---
19+
120
# TerminusDB Client v10.0.4
221

322
## New 🚀

docs/README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[![npm version](https://img.shields.io/npm/v/@terminusdb/terminusdb-client?logo=npm)](https://www.npmjs.com/package/@terminusdb/terminusdb-client)
1212
[![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)
1313

14-
> This repository is for the JavaScript client for TerminusDB and TerminusX. The
15-
> JavaScript client runs in the browser and on Node.js.
14+
> This repository is for the JavaScript client library for TerminusDB and
15+
> TerminusX.
1616
1717
[**TerminusDB**][terminusdb] is an [open-source][terminusdb-repo] graph database
1818
and document store. It allows you to link JSON documents in a powerful knowledge
@@ -30,40 +30,41 @@ TerminusX is in public beta and you can [sign up now][dashboard].
3030

3131
## Requirements
3232

33-
- [NodeJS 10+](https://nodejs.org/en/)
33+
- Node.js version 10+ if using the TerminusDB client library as a Node.js package
3434

3535
## Installation
3636

37-
TerminusDB Client can be used as either a Node.js module available through the npm registry, or directly included in web-sites by including the script tag below.
37+
The TerminusDB JavaScript client library can be used either as a Node.js package
38+
or as a script that runs in the browser.
3839

39-
### NPM Module
40+
### NPM Package
4041

41-
Before installing, download and install Node.js.<br>
42-
NodeJS version 10.X or higher is required. NodeJS version 14.X is recommended.
42+
> :memo: If you don't already have Node.js installed, [install it][node-install] first.
4343
44-
Installation is done using the npm install command:
44+
[node-install]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
4545

46-
Using npm:
46+
To install the `terminusdb-client` package as a dependency in an existing
47+
package, run:
4748

48-
```bash
49+
```sh
4950
$ npm install --save @terminusdb/terminusdb-client
5051
```
5152

52-
### Minified Script
53+
This command update your `package.json`.
5354

54-
Using cdn:
55+
### Script
56+
57+
To use the `terminusdb-client` script on a webpage sourced from a CDN, add this
58+
to your HTML:
5559

5660
```html
5761
<script src="https://unpkg.com/@terminusdb/terminusdb-client/dist/terminusdb-client.min.js"></script>
5862
```
5963

60-
Downloading:
61-
62-
Download the terminusdb-client.min.js file from the /dist directory and save it to your location of choice, then:
64+
Alternatively, you can download the latest [`terminusdb-client.min.js`][js], add
65+
it to your sources, and use that in the `<script>` instead.
6366

64-
```html
65-
<script src="http://my.saved.location/terminusdb-client.min.js"></script>
66-
```
67+
[js]: https://unpkg.com/@terminusdb/terminusdb-client/dist/terminusdb-client.min.js
6768

6869
## Usage
6970

docs/api/woqlClient.js.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ client.updateTriples("schema", "alt", turtle_string, "dumping triples to graph a
138138
```
139139

140140
### Query
141-
#### woqlClient.query(woql, [commitMsg], [allWitnesses]) ⇒ <code>Promise</code>
141+
#### woqlClient.query(woql, [commitMsg], [allWitnesses], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
142142
Executes a WOQL query on the specified database and returns the results
143143

144144
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -148,6 +148,8 @@ Executes a WOQL query on the specified database and returns the results
148148
| woql | <code>WOQLQuery</code> | an instance of the WOQLQuery class |
149149
| [commitMsg] | <code>string</code> | a message describing the reason for the change that will be written into the commit log (only relevant if the query contains an update) |
150150
| [allWitnesses] | <code>boolean</code> | |
151+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking |
152+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion |
151153

152154
**Example**
153155
```js
@@ -625,6 +627,7 @@ Common request dispatch function
625627
| action | <code>string</code> | the action name |
626628
| apiUrl | <code>string</code> | the server call endpoint |
627629
| [payload] | <code>object</code> | the post body |
630+
| [getDataVersion] | <code>boolean</code> | If true return response with data version |
628631
629632
630633
### generateCommitInfo
@@ -670,7 +673,7 @@ update the database details
670673
671674
672675
### addDocument
673-
#### woqlClient.addDocument(json, [params], [dbId], [string]) ⇒ <code>Promise</code>
676+
#### woqlClient.addDocument(json, [params], [dbId], [string], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
674677
to add a new document or a list of new documents into the instance or the schema graph.
675678
676679
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -681,6 +684,8 @@ to add a new document or a list of new documents into the instance or the schema
681684
| [params] | <code>typedef.DocParamsPost</code> | the post parameters |
682685
| [dbId] | <code>string</code> | the dbid |
683686
| [string] | <code>message</code> | the insert commit message |
687+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking. |
688+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion. |
684689
685690
**Example**
686691
```js
@@ -701,7 +706,7 @@ client.addDocument(json,{"graph_type":"schema"},"mydb","add new schema")
701706
```
702707
703708
### queryDocument
704-
#### woqlClient.queryDocument(query, [params], [dbId], [branch]) ⇒ <code>Promise</code>
709+
#### woqlClient.queryDocument(query, [params], [dbId], [branch], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
705710
Retrieves all documents that match a given document template
706711
707712
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -712,6 +717,8 @@ Retrieves all documents that match a given document template
712717
| [params] | <code>typedef.DocParamsGet</code> | the get parameters |
713718
| [dbId] | <code>string</code> | the database id |
714719
| [branch] | <code>string</code> | the database branch |
720+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking. |
721+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion. |
715722
716723
**Example**
717724
```js
@@ -723,14 +730,16 @@ client.queryDocument(query,{"as_list":true})
723730
```
724731
725732
### getDocument
726-
#### woqlClient.getDocument([params], [dbId], [branch]) ⇒ <code>Promise</code>
733+
#### woqlClient.getDocument([params], [dbId], [branch], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
727734
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
728735
729736
| Param | Type | Description |
730737
| --- | --- | --- |
731738
| [params] | <code>typedef.DocParamsGet</code> | the get parameters |
732739
| [dbId] | <code>string</code> | the database id |
733740
| [branch] | <code>string</code> | the database branch |
741+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking. |
742+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion. |
734743
735744
**Example**
736745
```js
@@ -742,7 +751,7 @@ client.getDocument({"graph_type":"schema","as_list":true,"id":"Country"})
742751
```
743752
744753
### updateDocument
745-
#### woqlClient.updateDocument(json, [params], [dbId], [message]) ⇒ <code>Promise</code>
754+
#### woqlClient.updateDocument(json, [params], [dbId], [message], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
746755
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
747756
748757
| Param | Type | Description |
@@ -751,10 +760,12 @@ client.getDocument({"graph_type":"schema","as_list":true,"id":"Country"})
751760
| [params] | <code>typedef.DocParamsPut</code> | the Put parameters |
752761
| [dbId] | <code>\*</code> | the database id |
753762
| [message] | <code>\*</code> | the update commit message |
763+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking. |
764+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion. |
754765
755766
756767
### deleteDocument
757-
#### woqlClient.deleteDocument([params], [dbId], [message]) ⇒ <code>Promise</code>
768+
#### woqlClient.deleteDocument([params], [dbId], [message], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
758769
to delete the document
759770
760771
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -764,6 +775,8 @@ to delete the document
764775
| [params] | <code>typedef.DocParamsDelete</code> | |
765776
| [dbId] | <code>string</code> | the database id |
766777
| [message] | <code>string</code> | the delete message |
778+
| [lastDataVersion] | <code>string</code> | If passed it will be used for data version tracking |
779+
| [getDataVersion] | <code>string</code> | If true it the function will return object having result and dataVersion |
767780
768781
**Example**
769782
```js

docs/createDocs.js

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function createFile(filePath, options, outputDir) {
6565
//const template = `{{#class name="${className}"}}{{>docs}}{{/class}}`
6666
console.log(`rendering ${filePath}`)
6767
const output = jsdoc2md.renderSync(options)
68-
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), output)
68+
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), setHeadings(fileName, output))
6969
}
7070
////([\w-]+)(.js)/
7171
function getFileName(filePath) {
@@ -128,6 +128,52 @@ function formatDataOrder(dataProvider, orderMenu) {
128128
return tt
129129
}
130130

131+
function setHeadings(sFileNm, sMD) {
132+
133+
/**
134+
* Adjust MD heading levels to create a clean
135+
* table of contents in GitBook. This method
136+
* replaces the docsify _sidebar.md file.
137+
*
138+
* Notes:
139+
*
140+
* 1. This is a quick-fix for basic compliance with the GitBook framework.
141+
* 2. Expression "~~" renders text as strikethrough for highlighting deprecations.
142+
* 3. Inconsistent use of constants requires a fix.
143+
*/
144+
145+
const cHdrLv = "##### ";
146+
const cWOQL = "WOQL.";
147+
const cWOQLClient = "woqlClient.";
148+
const cWOQLLib = "woqlLibrary.";
149+
const cAccessCtrl = "accessControl.";
150+
151+
// No action for sidebar (code to create sidebar can be deprecated.)
152+
153+
if (sFileNm.match("sidebar"))
154+
return sMD;
155+
156+
// Simplified pattern for type definitions.
157+
158+
if (sFileNm.match("typedef.js"))
159+
return sMD.
160+
replace(/## /g, "# ").
161+
replace(/### /g, cHdrLv);
162+
163+
// All other patterns.
164+
165+
return sMD.
166+
replace(/##/g, "#").
167+
replace(/## ~~WOQL\./g, `${cHdrLv}~~${cWOQL}`).
168+
replace(/## ~~woqlClient\./g, `${cHdrLv}~~${cWOQLClient}`).
169+
replace(/## ~~woqlLibrary\./g, `${cHdrLv}~~${cWOQLLib}`).
170+
replace(/## ~~accessControl\./g, `${cHdrLv}~~${cAccessCtrl}`).
171+
replace(/## WOQL\./g, `${cHdrLv}${cWOQL}`).
172+
replace(/## woqlClient\./g, `${cHdrLv}${cWOQLClient}`).
173+
replace(/## woqlLibrary\./g, `${cHdrLv}${cWOQLLib}`).
174+
replace(/## accessControl\./g, `${cHdrLv}${cAccessCtrl}`);
175+
}
176+
131177
/*
132178
{
133179
"id": "WOQLClient",

0 commit comments

Comments
 (0)