JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q9529F
  • License MIT

Utilities to deal with Hasura's API

Package Exports

  • hasura-sdk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hasura-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hasura SDK

const sdk = require('hasura-sdk');

sdk.init({
    endpoint: 'http://localhost:8080',
    adminSecret: 'your-secret',
});

/**
 * BASIC CALLS
 */

// Run plain SQL:
await sdk.query('SELECT NOW()');

// Run SQL with variable substitution:
await sdk.query({
    sql: 'SELECT * FROM table_name WHERE field_name = $value',
    binds: {
        value: 'foo',
    },
});

// Call any API method:
await sdk.call({
    type: 'xxx',
    args: { ... },
});


/**
 * CUSTOM CALLS
 * (full list in `lib/api.js`)
 */

// Track a table
await sdk.trackTable({
    schema: 'public',
    name: 'my_table',
});