TriplyDB.js is the official programming library for interacting withTriplyDB. TriplyDB.js allows you to automate operations that would otherwise be performed in the TriplyDB GUI.
TriplyDB.js is implemented inTypeScript. TypeScript is a type-safe language that transpiles toJavaScript. This allows you to use TriplyDB.js in web browsers as well as on servers (usingNode.js). TriplyDB.js is open source and its source code is published onGitHub.
Please contactsupport@triply.cc for questions and suggestions.
Overview¶
TriplyDB.js contains several classes, each with their own methods. The documentation for every method includes at least one code example. These code examples can be run by inserting them into the following overall script.
Notice thatprocess.env.TOKEN picks up an API token that is stored in the environment variable calledTOKEN. Follow the steps onthis page to create a new API token in the TriplyDB GUI.
import App from '@triply/triplydb'const triply = App.get({ token: process.env.TOKEN })async function run() { // This is where the code examples in this reference section should be placed.}run().catch(e => { console.error(e) process.exit(1)})process.on('uncaughtException', function (e) { console.error('Uncaught exception', e) process.exit(1)})process.on('unhandledRejection', (reason, p) => { console.error('Unhandled Rejection at: Promise', p, 'reason:', reason) process.exit(1)})The following sections document the various TriplyDB.js classes. Each class comes with its own methods. Classes are related through methods that connect them. For example, calling thegetAccount method on aApp object returns anAccount object.
