Coder Social home page Coder Social logo

sean-11x / hasura-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aaronhayes/hasura-sdk

0.0 0.0 0.0 163 KB

Hasura Schema & Metadata Typescript SDK

Home Page: https://aaronhayes.github.io/hasura-sdk/

License: MIT License

TypeScript 100.00%

hasura-sdk's Introduction

Hasura SDK

Hasura Schema and Metadata Node SDK

npm version license: MIT code style: prettier


Hasura Schema/Metadata API SDK. Written in TypeScript!

  • โœ… 100% in TypeScript
  • ๐Ÿ‹๏ธ Uses Axios under the hood

Installation

yarn

  • yarn add @sean-11x/hasura-sdk

npm

  • npm install @sean-11x/hasura-sdk

Usage

import Hasura from '@sean-11x/hasura-sdk`;

// Note: just the base url - don't add /v1/graphql!
const HASURA_GRAPHQL_ENDPOINT = 'http://localhost:8080';

// Hint: use process.env.HASURA_GRAPHQL_ADMIN_SECRET
const HASURA_GRAPHQL_ADMIN_SECRET = 'yousecret';

const hasura = new Hasura({
    endpoint: HASURA_GRAPHQL_ENDPOINT,
    adminSecret: HASURA_GRAPHQL_ADMIN_SECRET
});

// Using Async/Await Functions
try {
    const resp = await hasura.createCronTrigger({
        name: 'newcronjob',
        schedule: '* * * * *', // every minute
        webhook: '{{EVENT_BASE_URL}}/cron',
        payload: {
            hello: "world"
        },
        comment: 'test cron job every minute'
    });
} catch (error) {
    // handle error
}

// Using Promises
hasura.createCronTrigger({
    name: 'newcronjob',
    schedule: '* * * * *',
    webhook: '{{EVENT_BASE_URL}}/cron',
    payload: {
        hello: "world"
    },
    comment: 'test cron job every minute'
}).then(data => {
    // axios response
}).catch(error => {
    // handle error
});

Schema/Metadata API References

Supported APIs

We currently only support a small range of Hasura APIs. Be assured we working on adding more - if you need something be sure to create an issue!

API Support
Run SQL Yes
Tables/Views Yes
Custom SQL Functions No
Relationships No
Computed Fields No
Permissions No
Event Triggers Yes
Scheduled Triggers Yes
Remote Schemas No
Query Collections No
Custom Types No
Actions No
Manage Metadata No

Give us a star!

Every star helps build a little more

hasura-sdk's People

Contributors

aaronhayes avatar dependabot-preview[bot] avatar sean-11x avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.