@hasura/ndc-sdk-typescript
TypeScript icon, indicating that this package has built-in type declarations

7.0.0 • Public • Published

Native Data Connector SDK for TypeScript

This SDK is mostly analogous to the Rust SDK, except where necessary.

All functions of the Connector interface are analogous to their Rust counterparts.

Installing

From NPM

npm install @hasura/ndc-sdk-typescript

From this repo:

The repo does not include build artifacts, so you'll need to run the build step:

npm install https://github.com/hasura/ndc-sdk-typescript

cd node_modules/ndc-sdk-typescript

npm install

npm run build

Using this SDK

The SDK exports a start function, which takes a connector object, that is an object that implements the Connector interface defined in connector.ts

This function should be your starting point.

A connector can thus start liks so:

const connector: Connector = {
  /* implementation of the Connector interface removed for brevity */
};

start(connector);

Please refer to the NDC Spec for details on implementing the Connector interface.

Publishing a new version of the SDK to NPM

Pushing a new version tag will automatically publish the tag to NPM provided that it matches the version specified in package.json.

See .github/workflows/build_test_publish.yaml for details.

Regenerating Schema Types

The NDC spec types are generated from the NDC Spec Rust types. First, a JSON schema is derived from the Rust types into ./src/schema/schema.generated.json (see ./typegen/src/main.rs).

Then the TypeScript types are generated from that JSON Schema document into ./src/schema/schema.generated.ts.

In order to regenerate the types, run

> npm run regenerate-schema

Readme

Keywords

Package Sidebar

Install

npm i @hasura/ndc-sdk-typescript

Weekly Downloads

167

Version

7.0.0

License

Apache-2.0

Unpacked Size

301 kB

Total Files

56

Last publish

Collaborators

  • hasura