Skip to content

Commit fc49f7b

Browse files
Merge branch 'main' of https://github.com/terminusdb/terminusdb-client-js into fixLinting
Signed-off-by: NeelParihar <[email protected]>
2 parents c16890e + e2547de commit fc49f7b

File tree

10 files changed

+175
-71
lines changed

10 files changed

+175
-71
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/_sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@
163163
- [first_commit](api/woqlLibrary.js?id=first_commit)
164164
- [AccessControl](api/accessControl.js?id=AccessControl)
165165
- [getDefaultOrganization](api/accessControl.js?id=getDefaultOrganization)
166-
- [getJwtToken](api/accessControl.js?id=getJwtToken)
167166
- [setJwtToken](api/accessControl.js?id=setJwtToken)
167+
- [setApiToken](api/accessControl.js?id=setApiToken)
168168
- [getAPIUrl](api/accessControl.js?id=getAPIUrl)
169169
- [getAccessRoles](api/accessControl.js?id=getAccessRoles)
170170
- [createOrganization](api/accessControl.js?id=createOrganization)

docs/api/accessControl.js.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,30 @@
55

66
#### new AccessControl()
77
The AccessControl object has various methods to control the access for users.
8+
for the credential you can use the JWT token or the API token
89

910
**Example**
1011
```js
12+
//connect with the API token
13+
//(to request a token create an account in https://terminusdb.com/)
14+
const accessContol = new AccessControl("https://servername.com",
15+
{organization:"my_team_name",
16+
token:"dGVybWludXNkYjovLy9kYXRhL2tleXNfYXB........"})
17+
accessControl.getOrgUsers().then(result=>{
18+
console.log(result)
19+
})
20+
21+
//connect with the jwt token this type of connection is only for the dashboard
22+
//or for application integrate with our login workflow
1123
const accessContol = new AccessControl("https://servername.com",
1224
{organization:"my_team_name",
1325
jwt:"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd........"})
1426
accessControl.getOrgUsers().then(result=>{
1527
console.log(result)
1628
})
29+
1730
//if the jwt is expired you can change it with
18-
accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd.......")
31+
accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd.......")
1932
```
2033

2134
### getDefaultOrganization
@@ -29,25 +42,24 @@ Get a organization from parameters.
2942
| params | <code>object</code> | The parameters |
3043

3144

32-
### getJwtToken
33-
#### accessControl.getJwtToken(params) ⇒ <code>string</code>
34-
Get a API token from parameters.
45+
### setJwtToken
46+
#### accessControl.setJwtToken(jwt)
47+
Sets the Jwt token for the object
3548

36-
**Returns**: <code>string</code> - jwt api token
3749

3850
| Param | Type | Description |
3951
| --- | --- | --- |
40-
| params | <code>object</code> | The parameters |
52+
| jwt | <code>string</code> | The jwt api token to use |
4153

4254

43-
### setJwtToken
44-
#### accessControl.setJwtToken(jwt)
45-
Sets the API token for the object
55+
### setApiToken
56+
#### accessControl.setApiToken(atokenpi)
57+
Sets the API token for the object, to request a token create an account in https://terminusdb.com/
4658

4759

4860
| Param | Type | Description |
4961
| --- | --- | --- |
50-
| jwt | <code>string</code> | The jwt api token to use |
62+
| atokenpi | <code>string</code> | The API token to use to connect with TerminusX |
5163

5264

5365
### getAPIUrl

docs/createDocs.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function createFile(filePath, options, outputDir) {
7070
// eslint-disable-next-line no-console
7171
console.log(`rendering ${filePath}`);
7272
const output = jsdoc2md.renderSync(options);
73-
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), output);
73+
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), setHeadings(fileName, output));
7474
}
7575
/// /([\w-]+)(.js)/
7676
function getFileName(filePath) {
@@ -130,6 +130,51 @@ function formatDataOrder(dataProvider, orderMenu) {
130130
return tt;
131131
}
132132

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

0 commit comments

Comments
 (0)