Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaronhayes/hasura-sdk
Hasura Schema & Metadata Typescript SDK
https://github.com/aaronhayes/hasura-sdk
admin graphql hasura hasura-sdk metadata node query schema sdk typescript
Last synced: 3 months ago
JSON representation
Hasura Schema & Metadata Typescript SDK
- Host: GitHub
- URL: https://github.com/aaronhayes/hasura-sdk
- Owner: aaronhayes
- License: mit
- Created: 2020-07-27T12:58:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T12:34:44.000Z (almost 2 years ago)
- Last Synced: 2024-05-19T14:31:32.692Z (6 months ago)
- Topics: admin, graphql, hasura, hasura-sdk, metadata, node, query, schema, sdk, typescript
- Language: TypeScript
- Homepage: https://aaronhayes.github.io/hasura-sdk/
- Size: 862 KB
- Stars: 24
- Watchers: 3
- Forks: 2
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hasura - hasura-sdk - A node wrapper for Hasura's schema and metadata API's, written in TypeScript. (Tools and Extensions)
README
Hasura SDK
Hasura Schema and Metadata Node SDK
---
Hasura Schema/Metadata API SDK. Written in TypeScript!
- ✅ 100% in TypeScript
- 🏋️ Uses Axios under the hood## Installation
### yarn
- `yarn add @aaronhayes/hasura-sdk`
### npm
- `npm install @aaronhayes/hasura-sdk`
## Usage
```JavaScript
import Hasura from '@aaronhayes/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
- [Full documentation](https://aaronhayes.github.io/hasura-sdk/)
- [Hasura Docs](https://hasura.io/docs/1.0/graphql/manual/api-reference/schema-metadata-api/index.html#metadata-apis)## 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