You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository is for the JavaScript client library for TerminusDB and
TerminusCMS.
TerminusDB is an open-source graph database
and document store. It allows you to link JSON documents in a powerful knowledge
graph all through a simple document API.
TerminusCMS is a headless content management system for complex enviroments. Try it out for yourself, it's free to get started with generous limits. Clone a demo project to play around. Sign up.
Requirements
Node.js version 10+ if using the TerminusDB client library as a Node.js package
Installation
The TerminusDB JavaScript client library can be used either as a Node.js package
or as a script that runs in the browser.
NPM Package
π If you don't already have Node.js installed, install it first.
To install the terminusdb-client package as a dependency in an existing
package, run:
constTerminusClient=require("@terminusdb/terminusdb-client");// Connect and configure the TerminusClientconstclient=newTerminusClient.WOQLClient('SERVER_CLOUD_URL/mycloudTeam',{user:"myemail@something.com",organization:'mycloudTeam'})client.setApiKey(MY_ACCESS_TOKEN)constbankerSchema=[{"@type":"Class","@id":"BankAccount","@key":{"@type":"Hash","@fields":["account_id"]},"account_id":"xsd:string","owner":"Person","balance":"xsd:decimal"},{"@type":"Class","@id":"Person","@key":{"@type":"Lexical","@fields":["name"]},"name":"xsd:string"}]asyncfunctioncreateDataProduct(){try{awaitclient.createDatabase("banker",{label: "Banker Account",comment: "Testing",schema: true})//add the schema documentsawaitclient.addDocument(bankerSchema,{"graph_type":"schema"},null,"add new schema")constaccountObj={"@type":"BankAccount","account_id":"DBZDFGET23456","owner":{"@type":"Person","name":"Tom"},"balance":1000}//add a document instanceawaitclient.addDocument(accountObj)client.getDocument({"as_list":true,id:'Person/Tom'})}catch(err){console.error(err.message)}}
Options
connections options.
To initialize TerminusDB client with custom options use
If you encounter any issues, please report it with your os and environment setup, the version that you are using, and a simple reproducible case.
If you encounter other questions, you can ask them on our Discord Server.
Contribute
π This project uses Husky which automatically runs lint, tests, and other scripts when you try to commit any changes to the repository. This helps us to improve each commit done to the repo and is automatically installed and configured when you do npm install
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.