Skip to content

Commit 5b73e85

Browse files
committed
Merge branch 'rc'
2 parents df65b5b + 904df4b commit 5b73e85

36 files changed

+1018
-371
lines changed

.ci/publish_bintray.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
BRANCH=$1
3+
curl -u "rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/npm/terminusdb/npm-$BRANCH/auth" > .npmrc
4+
curl -XDELETE "https://api.bintray.com/packages/terminusdb/npm-$BRANCH/terminusdb:terminusdb-client" -u "rrooij:$BINTRAY_API_TOKEN"
5+
npm publish
6+
curl -T "dist/terminusdb-client.min.js" -u"rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/content/terminusdb/terminusdb/terminusdb-client/$BRANCH/$BRANCH/terminusdb-client.min.js?publish=1&override=1"
7+
curl -T "dist/terminusdb-client.min.js.map" -u"rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/content/terminusdb/terminusdb/terminusdb-client/$BRANCH/$BRANCH/terminusdb-client.min.js.map?publish=1&override=1"

.ci/publish_canary.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ci/publish_dev.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ci/publish_rc.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/workflow.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build and release on production
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
- canary
7+
- rc
8+
9+
jobs:
10+
setup-build-publish-deploy:
11+
name: Setup, Build, Publish, and Deploy
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 14
20+
- run: npm install
21+
- run: npm run build
22+
- run: bash ".ci/publish_bintray.sh" "${GITHUB_REF##*/}"
23+
env:
24+
BINTRAY_API_TOKEN: ${{ secrets.BINTRAY_API_TOKEN }}

.travis.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,13 @@ node_js:
55

66
stages:
77
- build
8-
- name: deploy_dev
9-
if: branch = dev
10-
- name: deploy_rc
11-
if: branch = rc
12-
- name: deploy_canary
13-
if: branch = canary
148

159
jobs:
1610
include:
1711
- stage: build
1812
after_script:
1913
- npm run coveralls-after
2014

21-
- stage: deploy_dev
22-
script:
23-
- npm run build
24-
- bash .ci/publish_dev.sh
25-
26-
- stage: deploy_rc
27-
script:
28-
- npm run build
29-
- bash .ci/publish_rc.sh
30-
31-
- stage: deploy_canary
32-
script:
33-
- npm run build
34-
- bash .ci/publish_canary.sh
35-
36-
3715
before_deploy:
3816
- npm run doc
3917
- npm run build

README.md

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
terminusdb-client
2-
===============
1+
# terminusdb-client
32

43
[![build status](https://api.travis-ci.com/terminusdb/terminusdb-client.svg?branch=master)](https://travis-ci.com/terminusdb/terminusdb-client)
54
[![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)
@@ -16,6 +15,7 @@ Promise based terminus client for the browser and node.js
1615
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.
1716

1817
### NPM Module
18+
1919
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
2020

2121
Installation is done using the npm install command:
@@ -43,66 +43,87 @@ Download the terminusdb-client.min.js file from the /dist directory and save it
4343
```
4444

4545
## Usage
46-
For the [full Documentation](https://terminusdb.com/docs/client_api)
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)
4750

4851
```javascript
49-
//
50-
const TerminusClient = require('@terminusdb/terminusdb-client');
51-
52-
//Create a new instance of terminusDB client
53-
const client = new TerminusClient.WOQLClient("https://127.0.0.1:6363/",{
54-
dbid:"test_db",
55-
user:"admin",
56-
key:"my_secret_key"
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",
5763
});
64+
client.db("banker");
65+
client.organization("admin");
5866

59-
//Connect to a TerminusDB server at the given URI with an API key
60-
client.connect().
61-
.then(function (response) {
62-
// handle success
63-
console.log(response);
64-
})
65-
.catch(function (error) {
66-
// handle error
67-
console.log(error);
68-
})
69-
.finally(function () {
70-
// always executed
71-
});
72-
73-
74-
//use async/await.
75-
async function getCapabilities() {
67+
async function postAccount() {
7668
try {
77-
const response = await client.connect();
78-
console.log(response);
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+
});
7984
} catch (err) {
8085
console.error(err);
8186
}
8287
}
8388

84-
```
85-
89+
app.post("/account", (req, res) => {
90+
postAccount().then((dbres) => res.send(JSON.stringify(dbres)));
91+
});
8692

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+
```
87107

88108
## Options
109+
89110
connections options.
90111

91112
To initialize `TerminusDB client` with custom options use
92113

93114
```js
94-
const TerminusClient = require('@terminusdb/terminusdb-client')
115+
const TerminusClient = require("@terminusdb/terminusdb-client");
95116

96117
const client = new TerminusClient.WOQLClient("https://127.0.0.1:6363/", {
97-
dbid:"test_db",
98-
user:"admin",
99-
key:"my_secret_key"
118+
dbid: "test_db",
119+
user: "admin",
120+
key: "my_secret_key",
100121
});
101-
102122
```
123+
103124
## API
104125

105-
The API is documented at: https://terminusdb.github.io/terminusdb-client/
126+
The API is documented at: https://terminusdb.com/docs/reference/js-client/core/#terminusdb-client-api
106127

107128
## Report Issues
108129

RELEASE_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# TerminusDB Client v4.0.0
2+
3+
## new
4+
5+
* add update_quad
6+
* add update_triple
7+
* add woql word once
8+
* add context to using
9+
* add type_of
10+
* better error reporting
11+
* add csv uploading
12+
13+
## fixes
14+
15+
* Fix group_by
16+
117
# TerminusDB Client v3.0.3
218

319
The liberation release

lib/connectionCapabilities.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ ConnectionCapabilities.prototype.updateDatabasePrefixes = function(dbrec, newps)
148148
dbrec.jsonld_context = _jsonld_context_from_prefixes(newps)
149149
}
150150

151-
152151
function _jsonld_context_from_prefixes(pps){
153152
let basic = {}
154153
for(var key in UTILS.standard_urls){
@@ -164,7 +163,7 @@ function _jsonld_context_from_prefixes(pps){
164163

165164
ConnectionCapabilities.prototype.getContextForOutboundQuery = function(woql, dbid, orgid) {
166165
let ob = {}
167-
if (woql.getContext()) {
166+
if (woql && woql.getContext()) {
168167
ob = woql.getContext()
169168
}
170169
else {

lib/connectionConfig.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ConnectionConfig.prototype.update = function(params) {
6060
const newParams = params || {}
6161
//if (typeof newParams.server != "undefined") this.setServer(newParams.server);
6262
if (typeof newParams.organization != 'undefined') this.setOrganization(newParams.organization)
63+
else if(newParams.user) this.setOrganization(newParams.user)
6364
if (typeof newParams.db != 'undefined') this.setDB(newParams.db)
6465
if (typeof newParams.remote_auth != 'undefined') this.setRemoteAuth(newParams.remote_auth)
6566
if (typeof newParams.local_auth != 'undefined') this.setLocalAuth(newParams.local_auth)
@@ -274,6 +275,7 @@ ConnectionConfig.prototype.graphURL = function(type, gid) {
274275
return this.branchBase('graph') + `/${type}/${gid}`
275276
}
276277

278+
277279
/**
278280
* Generate URL for get / set schema api endpoint
279281
*/
@@ -292,7 +294,7 @@ ConnectionConfig.prototype.csvURL = function(type, gid) {
292294
var s = this.branchBase('csv')
293295
const graphId = gid || 'main'
294296
const gType = type || 'instance'
295-
s += `/${gType}/${graphId}`
297+
//s += `/${gType}/${graphId}`
296298
return s
297299
}
298300

0 commit comments

Comments
 (0)