Releases: mrspartak/hasura-om
Releases · mrspartak/hasura-om
Can update parameters
orm.updateParams({
jwt: 'new jwt'
})
JWT auth support
This was added to support front-end projects with a bundler. But of course, table autogen will not work
const orm = new Hasura({
graphqlUrl: process.env.GQL_ENDPOINT,
jwt: process.env.JWT_TOKEN,
});
orm.createTable({name: '_om_test'})
.createField({name: 'id', isPrimary: true})
.createField({name: 'text'})
.createField({name: 'increment'})
.createField({name: 'type'})
.generateBaseFragments();
Critical dependency
graphql
is critical, so the module subscriptions-transport-ws
will not work without it
getFirst query modifier
This query modifier allows you to return the first element of the response array. Very useful, if you select/insert/update only one row, and will get the returning object
let [error, response] = await orm.query({
user: {
where: { id: { _eq: 23 } }
}
}, { getFirst: true })
/*
response = {
...userFields
}
*/
One more try to release
I hate GhA workflow configs
Fixing release GhA workflow
1.0.1 Readme + workflow fix
Finally a release
This is the first working release.
A lot of things are to be done later. But the current version is working fine on a server and has a proper documentation
Event emitter for WS connection
So now you can track all events for debugging
const { Hasura } = require('hasura-om')
let orm = new Hasura({
graphqlUrl: '',
adminSecret: ''
})
await orm.init()
let unsub = await orm.subscribe({
_om_test: {
aggregate: {
count: {}
}
},
}, ([err, data]) => {
console.log('sub.data', err, data)
})
let tsStart = new Date().getTime()
let timediff = function () {
return `+${ ((new Date().getTime() - tsStart)/1000).toFixed(2) }s`
}
orm.$ws.on('connected', () => {
console.log(timediff(), 'orm.$ws.on.connected')
})
orm.$ws.on('connecting', () => {
console.log(timediff(), 'orm.$ws.on.connecting')
})
orm.$ws.on('reconnected', () => {
console.log(timediff(), 'orm.$ws.on.reconnected')
})
orm.$ws.on('reconnecting', () => {
console.log(timediff(), 'orm.$ws.on.reconnecting')
})
orm.$ws.on('disconnected', () => {
console.log(timediff(), 'orm.$ws.on.disconnected')
})
orm.$ws.on('error', (data) => {
console.log(timediff(), 'orm.$ws.on.error', data)
})
Just pushing a link to docs
Docs are still not fully written, but the link will not change
Bump new realese with fixed test from 0.0.15
0.0.16 Try to clear in after hook