Skip to content

Commit a27c736

Browse files
committed
add docjs
1 parent 2d72403 commit a27c736

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+7542
-1774
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ Please check [Contributing.md](Contributing.md) for more information.
141141

142142
The APACHE 2.0 License
143143

144-
Copyright (c) 2019
144+
Copyright (c) 2019

all-docs.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
{{#orphans~}}
3+
{{>docs~}}
4+
{{/orphans~}}

docs.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{>header~}}
2+
{{>body}}
3+
{{>member-index~}}
4+
{{>separator~}}
5+
{{#docsFilter @root~}}
6+
{{#each mydata}}
7+
{{this.name}}
8+
{{/each}}
9+
{{/docsFilter}}

docs/.nojekyll

Whitespace-only changes.

docs/README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# terminusdb-client
2+
3+
[![build status](https://api.travis-ci.com/terminusdb/terminusdb-client.svg?branch=master)](https://travis-ci.com/terminusdb/terminusdb-client)
4+
[![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)
5+
6+
Promise based terminus client for the browser and node.js
7+
8+
## Requirements
9+
10+
- [TerminusDB](https://github.com/terminusdb/terminusdb-server)
11+
- [NodeJS 8.1.4+](https://nodejs.org/en/)
12+
13+
## Installation
14+
15+
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.
16+
17+
### NPM Module
18+
19+
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
20+
21+
Installation is done using the npm install command:
22+
23+
Using npm:
24+
25+
```bash
26+
$ npm install --save @terminusdb/terminusdb-client
27+
```
28+
29+
### Minified Script
30+
31+
Using cdn:
32+
33+
```html
34+
<script src="https://unpkg.com/@terminusdb/terminusdb-client/dist/terminusdb-client.min.js"></script>
35+
```
36+
37+
Downloading:
38+
39+
Download the terminusdb-client.min.js file from the /dist directory and save it to your location of choice, then:
40+
41+
```html
42+
<script src="http://my.saved.location/terminusdb-client.min.js"></script>
43+
```
44+
45+
## Usage
46+
47+
This example creates a simple Express.js server that will post an account to
48+
a database with the id "banker" and the default "admin" user with password "root"
49+
For the [full Documentation](https://terminusdb.com/docs/reference/js-client)
50+
51+
```javascript
52+
const express = require("express");
53+
const app = express();
54+
const port = 3000;
55+
56+
const TerminusClient = require("@terminusdb/terminusdb-client");
57+
58+
// Connect and configure the TerminusClient
59+
const client = new TerminusClient.WOQLClient("https://127.0.0.1:6363/", {
60+
dbid: "banker",
61+
user: "admin",
62+
key: "root",
63+
});
64+
client.db("banker");
65+
client.organization("admin");
66+
67+
async function postAccount() {
68+
try {
69+
const WOQL = TerminusClient.WOQL;
70+
const query = WOQL.using("admin/banker").and(
71+
WOQL.add_triple("doc:smog", "type", "scm:BankAccount"),
72+
WOQL.add_triple("doc:smog", "owner", "smog"),
73+
WOQL.add_triple("doc:smog", "balance", 999)
74+
);
75+
await client.connect();
76+
client
77+
.query(query, "adding smog's bank account")
78+
.then((response) => {
79+
return response;
80+
})
81+
.catch((err) => {
82+
console.log("error", err);
83+
});
84+
} catch (err) {
85+
console.error(err);
86+
}
87+
}
88+
89+
app.post("/account", (req, res) => {
90+
postAccount().then((dbres) => res.send(JSON.stringify(dbres)));
91+
});
92+
93+
app.listen(port, () => {
94+
console.log(`Backend Server listening at http://localhost:${port}`);
95+
client
96+
.connect()
97+
.then(function (response) {
98+
// handle success
99+
console.log(response);
100+
})
101+
.catch(function (error) {
102+
// handle error
103+
console.log(error);
104+
});
105+
});
106+
```
107+
108+
## Options
109+
110+
connections options.
111+
112+
To initialize `TerminusDB client` with custom options use
113+
114+
```js
115+
const TerminusClient = require("@terminusdb/terminusdb-client");
116+
117+
const client = new TerminusClient.WOQLClient("https://127.0.0.1:6363/", {
118+
dbid: "test_db",
119+
user: "admin",
120+
key: "my_secret_key",
121+
});
122+
```
123+
124+
## API
125+
126+
The API is documented at: https://terminusdb.com/docs/reference/js-client/core/#terminusdb-client-api
127+
128+
## Report Issues
129+
130+
If you have encounter any issues, please report it with your os and environment setup, version that you are using and a simple reproducible case.
131+
132+
If you encounter other questions, you can ask in our community [forum](https://community.terminusdb.com/) or [Slack channel](http://bit.ly/terminusdb-slack).
133+
134+
## Contribute
135+
136+
It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.
137+
138+
Please check [Contributing.md](Contributing.md) for more information.
139+
140+
## Licence
141+
142+
The APACHE 2.0 License
143+
144+
Copyright (c) 2019

docs/api/typedef.js.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
## Typedefs
2+
3+
<dl>
4+
<dt><a href="#ResourceType">ResourceType</a> : <code>&quot;commits&quot;</code> | <code>&quot;meta&quot;</code> | <code>&quot;branch&quot;</code> | <code>&quot;ref&quot;</code> | <code>&quot;repo&quot;</code> | <code>&quot;db&quot;</code></dt>
5+
<dd></dd>
6+
<dt><a href="#GraphType">GraphType</a> : <code>&quot;inference&quot;</code> | <code>&quot;schema&quot;</code> | <code>&quot;instance&quot;</code></dt>
7+
<dd></dd>
8+
<dt><a href="#CredentialObj">CredentialObj</a> : <code>Object</code></dt>
9+
<dd></dd>
10+
<dt><a href="#ActionType">ActionType</a> : <code>&#x27;graph&#x27;</code> | <code>&#x27;db&#x27;</code> | <code>&#x27;clone&#x27;</code> | <code>&#x27;triples&#x27;</code> | <code>&#x27;woql&#x27;</code> | <code>&#x27;frame&#x27;</code> | <code>&#x27;fetch&#x27;</code> | <code>&#x27;pull&#x27;</code> | <code>&#x27;rebase&#x27;</code> | <code>&#x27;csv&#x27;</code> | <code>&#x27;branch&#x27;</code> | <code>&#x27;reset&#x27;</code> | <code>&#x27;push&#x27;</code></dt>
11+
<dd></dd>
12+
<dt><a href="#ParamsObj">ParamsObj</a> : <code>Object</code></dt>
13+
<dd></dd>
14+
<dt><a href="#RolesObj">RolesObj</a> : <code>Object</code></dt>
15+
<dd></dd>
16+
<dt><a href="#RepoType">RepoType</a> : <code>&quot;local&quot;</code> | <code>&quot;remote&quot;</code></dt>
17+
<dd></dd>
18+
<dt><a href="#DbDetails">DbDetails</a> : <code>Object</code></dt>
19+
<dd></dd>
20+
<dt><a href="#RemoteRepoDetails">RemoteRepoDetails</a> : <code>Object</code></dt>
21+
<dd><p>{remote: &quot;origin&quot;, &quot;remote_branch&quot;: &quot;main&quot;, &quot;author&quot;: &quot;admin&quot;, &quot;message&quot;: &quot;message&quot;}</p>
22+
</dd>
23+
<dt><a href="#CloneSourceDetails">CloneSourceDetails</a> : <code>Object</code></dt>
24+
<dd></dd>
25+
</dl>
26+
27+
<a name="ResourceType"></a>
28+
29+
## ResourceType : <code>&quot;commits&quot;</code> \| <code>&quot;meta&quot;</code> \| <code>&quot;branch&quot;</code> \| <code>&quot;ref&quot;</code> \| <code>&quot;repo&quot;</code> \| <code>&quot;db&quot;</code>
30+
<a name="GraphType"></a>
31+
32+
## GraphType : <code>&quot;inference&quot;</code> \| <code>&quot;schema&quot;</code> \| <code>&quot;instance&quot;</code>
33+
<a name="CredentialObj"></a>
34+
35+
## CredentialObj : <code>Object</code>
36+
**Properties**
37+
38+
| Name | Type | Description |
39+
| --- | --- | --- |
40+
| type | <code>&#x27;basic&#x27;</code> \| <code>&#x27;jwt&#x27;</code> | the authorization type of an TerminusDB connection |
41+
| user | <code>string</code> \| <code>boolean</code> | the user id | I don't need the user with the jwt token |
42+
| key | <code>string</code> | the connection key |
43+
44+
<a name="ActionType"></a>
45+
46+
## ActionType : <code>&#x27;graph&#x27;</code> \| <code>&#x27;db&#x27;</code> \| <code>&#x27;clone&#x27;</code> \| <code>&#x27;triples&#x27;</code> \| <code>&#x27;woql&#x27;</code> \| <code>&#x27;frame&#x27;</code> \| <code>&#x27;fetch&#x27;</code> \| <code>&#x27;pull&#x27;</code> \| <code>&#x27;rebase&#x27;</code> \| <code>&#x27;csv&#x27;</code> \| <code>&#x27;branch&#x27;</code> \| <code>&#x27;reset&#x27;</code> \| <code>&#x27;push&#x27;</code>
47+
<a name="ParamsObj"></a>
48+
49+
## ParamsObj : <code>Object</code>
50+
**Properties**
51+
52+
| Name | Type | Description |
53+
| --- | --- | --- |
54+
| key | <code>string</code> | api key for basic auth |
55+
| user | <code>string</code> | basic auth user id |
56+
| [organization] | <code>string</code> | set organization to this id |
57+
| [db] | <code>string</code> | set cursor to this db |
58+
| [repo] | [<code>RepoType</code>](#RepoType) \| <code>string</code> | set cursor to this repo |
59+
| [branch] | <code>string</code> | set branch to this id |
60+
| [ref] | <code>string</code> | set commit ref |
61+
| [jwt] | <code>string</code> | jwt token |
62+
| [jwt_user] | <code>string</code> | jwt user id |
63+
| [default_branch_id] | <code>string</code> | set the default branch id |
64+
65+
<a name="RolesObj"></a>
66+
67+
## RolesObj : <code>Object</code>
68+
**Properties**
69+
70+
| Name | Type | Description |
71+
| --- | --- | --- |
72+
| agent_name | <code>string</code> | the Authorization connection's type |
73+
| [database_name] | <code>string</code> | the user id | I don't need the user with the jwt token |
74+
| [organization_name] | <code>string</code> | the connection key |
75+
| [actions] | <code>array</code> | list of roles |
76+
| [invitation] | <code>string</code> | - |
77+
78+
<a name="RepoType"></a>
79+
80+
## RepoType : <code>&quot;local&quot;</code> \| <code>&quot;remote&quot;</code>
81+
<a name="DbDetails"></a>
82+
83+
## DbDetails : <code>Object</code>
84+
**Properties**
85+
86+
| Name | Type | Description |
87+
| --- | --- | --- |
88+
| [organization] | <code>string</code> | the db organization id |
89+
| id | <code>string</code> | The database identification name |
90+
| label | <code>string</code> | "Textual DB Name" |
91+
| [comment] | <code>string</code> | "Text description of DB" |
92+
| sharing | <code>string</code> | |
93+
| [icon] | <code>string</code> | The database's icon |
94+
| prefixes | <code>object</code> | {scm: "http://url.to.use/for/scm", doc: "http://url.to.use/for/doc"} |
95+
| [schema] | <code>boolean</code> | if set to true, a schema graph will be created |
96+
97+
<a name="RemoteRepoDetails"></a>
98+
99+
## RemoteRepoDetails : <code>Object</code>
100+
{remote: "origin", "remote_branch": "main", "author": "admin", "message": "message"}
101+
102+
**Properties**
103+
104+
| Name | Type | Description |
105+
| --- | --- | --- |
106+
| [remote] | <code>string</code> | remote server url |
107+
| remote_branch | <code>string</code> | remote branch name |
108+
| [author] | <code>string</code> | if it is undefined it get the current author |
109+
| [message] | <code>string</code> | the update commit message |
110+
111+
<a name="CloneSourceDetails"></a>
112+
113+
## CloneSourceDetails : <code>Object</code>
114+
**Properties**
115+
116+
| Name | Type | Description |
117+
| --- | --- | --- |
118+
| remote_url | <code>string</code> | the remote db source url |
119+
| [label] | <code>string</code> | |
120+
| [comment] | <code>string</code> | |
121+

0 commit comments

Comments
 (0)