0.6.3 • Published 6 months ago

@relationalai/rai-sdk-javascript v0.6.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

The RelationalAI Software Development Kit for JavaScript

The RelationalAI (RAI) SDK for JavaScript enables developers to access the RAI REST APIs from JavaScript. The SDK provides first class TypeScript support.

Getting started

Requirements

  • Node.js 14+

Installing the SDK

Install

$ npm install @relationalai/rai-sdk-javascript

Create a configuration file

In order to run the examples and, you will need to create an SDK config file. The default location for the file is $HOME/.rai/config and the file should include the following:

[default]
host = azure.relationalai.com
client_id = <your client_id>
client_secret = <your client secret>

# the following are all optional, with default values shown
# port = 443
# scheme = https
# client_credentials_url = https://login.relationalai.com/oauth/token

Client credentials can be created using the RAI console at https://console.relationalai.com/login

You can copy config.spec from the root of this repo and modify as needed.

Usage

The package provides readConfig helper that reads the configuration file

import { Client, readConfig } from '@relationalai/rai-sdk-javascript';

const config = await readConfig();
const client = new Client(config);

const result = await client.listEngines();

or you can build the config object

import { Client, ClientCredentials } from '@relationalai/rai-sdk-javascript';

const credentials = new ClientCredentials(
  'your client_id',
  'your client_secret',
  'https://login.relationalai.com/oauth/token',
);
const config = {
  credentials,
  host: 'azure.relationalai.com',
  scheme: 'https',
  port: '443',
};
const client = new Client(config);

const result = await client.listEngines();

Examples

Each of the example files in the ./examples folder is standalone and can be run from the command line, eg:

$ npm run example -- ./examples/listEngines.ts
$ npm run example -- ./examples/runQuery.ts -d dbName -e engineName -c "def output = 1 + 2"

Data Types

ResultTable maps Rel data types to their corresponding JavaScript equivalents. Full mapping:

Rel Data TypeJS Data Type
Int8, Int16, Int32number
Int64, Int128bigint
UInt8, UInt16, UInt32number
UInt64, UInt128bigint
Float16, Float32, Float64number
Rational8, Rational16, Rational32{ numerator: number; denominator: number; }
Rational64, Rational128{ numerator: bigint; denominator: bigint; }
FixedDecimal all bit sizes(16, 32, 64, 128)decimal.js
Charstring
Stringstring
DateTime, DateDate
Year, Month, Week, Daybigint
Hour, Minute, Second, Millisecond, Microsecond, Nanosecondbigint
Boolboolean
FilePosbigint
Missingnull
AutoNumberbigint
UUIDstring
SHA1string

Support

You can reach the RAI developer support team at support@relational.ai

Contributing

We value feedback and contributions from our developer community. Feel free to submit an issue or a PR here.

License

The RelationalAI Software Development Kit for JavaScript is licensed under the Apache License 2.0. See: https://github.com/RelationalAI/rai-sdk-javascript/blob/master/LICENSE

0.7.1-alpha

8 months ago

0.7.5-alpha

6 months ago

0.7.7-alpha

6 months ago

0.7.0-alpha25

9 months ago

0.7.0-alpha26

9 months ago

0.7.4-alpha

6 months ago

0.7.6-alpha

6 months ago

0.7.3-alpha

7 months ago

0.7.2-alpha

8 months ago

0.7.0-alpha21

12 months ago

0.7.0-alpha23

12 months ago

0.7.0-alpha22

12 months ago

0.7.0-alpha24

11 months ago

0.7.0

12 months ago

0.7.0-alpha20

1 year ago

0.7.0-alpha19

1 year ago

0.7.0-alpha16

1 year ago

0.7.0-alpha15

1 year ago

0.7.0-alpha18

1 year ago

0.7.0-alpha17

1 year ago

0.7.0-alpha12

2 years ago

0.7.0-alpha11

2 years ago

0.7.0-alpha14

2 years ago

0.7.0-alpha13

2 years ago

0.7.0-alpha8

2 years ago

0.7.0-alpha9

2 years ago

0.7.0-alpha10

2 years ago

0.7.0-alpha4

2 years ago

0.7.0-alpha5

2 years ago

0.7.0-alpha6

2 years ago

0.7.0-alpha7

2 years ago

0.7.0-alpha2

2 years ago

0.7.0-alpha3

2 years ago

0.7.0-alpha

2 years ago

0.6.3-alpha

2 years ago

0.6.2-alpha

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.0

2 years ago

0.5.10

2 years ago

0.5.11

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.10-alpha

2 years ago

0.5.9

2 years ago

0.6.0-alpha

2 years ago

0.5.9-alpha

2 years ago

0.6.0-alpha2

2 years ago

0.6.0-alpha4

2 years ago

0.6.0-alpha3

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.4.0-alpha.2

2 years ago

0.5.0-alpha

2 years ago

0.5.1-alpha

2 years ago

0.3.0

2 years ago

0.5.2-alpha

2 years ago

0.2.0

2 years ago

0.2.0-rc.1

2 years ago

0.5.4

2 years ago

0.3.0-alpha.2

2 years ago

0.5.3

2 years ago

0.4.0-alpha

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0-alpha

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago