Releases: mrspartak/hasura-om
Releases · mrspartak/hasura-om
Nested fragment fields with arguments are here + refactoring + readme
const fragment2 = new Fragment({
table: 'test',
name: 'with_nested_args',
fields: [
'id',
[
'logo',
['url'],
{
_table: 'images',
limit: 'logo_limit',
offset: 'logo_offset',
where: 'logo_where',
order_by: 'logo_order_by',
distinct_on: 'logo_distinct_on',
},
],
],
});
/*
This will generate such fragment
Fragment with_nested_args_fragment_test on test {
id
logo (limit: $logo_limit, ...) {
url
}
}
*/
await orm.query({
test: {
fragment: 'with_nested_args',
variables: {
'logo_limit': 1
}
}
})
Bump info to npm README
0.0.14 readme. Fixed checkboxes + info about what is done
Bump new realese with fixed test and all stuff from 0.0.12
0.0.13 cant assure that no rows exists for now, cause other test creates them
Fixed tests
0.0.12a cant assure that no rows exists for now, cause other test creates them
Aggregate, pk fragment and flat for all queries
So queries are select by default, but you can aggregate now
orm.query({
aggregate: {
count
}
})
//response.count
I added pk fragment, that contents only a primary keys and also flat works for mutations too now
orm.mutate({
user: {
insert: {
object: {...newUser},
fragment: 'pk'
}
}
})
//response[0].id
Global flat settings are at Hasura constructor now:
const orm = new Hasura({
...settings,
query: {
flatOne: false
}
})
New way to describe a fragment
//you can use nested array to do this
[
'id',
[
'logo',
[
'url'
]
]
]
/*
id
logo {
url
}
*/
Subscription support
Use them as easy as:
let unsub = om.subscribe({
user: {
where: {
is_live: {
_eq: true
}
}
}
}, ([err, data]) => {
//so data will come in the same format as the query
})
More tests + refactoring + Field draft
0.0.9 a lot of tests + refactoring
New internal methods + tests
Still not documented, sorry
Fragments extension
An example from Readme
let baseUserFragment = orm.table('user').fragment('base')
let basePostFragment = orm.table('post').fragment('base')
orm.table('user').createFragment('some_unique_name', [
baseUserFragment.gqlFields(),
{
key: 'posts',
values: [
basePostFragment.gqlFields(),
]
}
])
/*
This will create schema with all base user and posts fields
{
...userfields
posts {
...postsfields
}
}
*/