hasura-om

👺 Fragment based orm request generator for Hasura with built in auto-table lookup and base fragment builder

MIT License

Downloads
59
Stars
21
Committers
6

Bot releases are visible (Hide)

hasura-om - Nested fragment fields with arguments are here + refactoring + readme

Published by mrspartak over 4 years ago

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
        }
    }
})
hasura-om - Bump info to npm README

Published by mrspartak over 4 years ago

hasura-om - Bump new realese with fixed test and all stuff from 0.0.12

Published by mrspartak over 4 years ago

hasura-om - Fixed tests

Published by mrspartak over 4 years ago

hasura-om - Aggregate, pk fragment and flat for all queries

Published by mrspartak over 4 years ago

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
  }
})
hasura-om - New way to describe a fragment

Published by mrspartak over 4 years ago

//you can use nested array to do this
[
  'id',
  [
    'logo',
    [
      'url'
    ]
  ]
]
/*
  id
  logo {
    url
  }
*/
hasura-om - Subscription support

Published by mrspartak over 4 years ago

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
})
hasura-om - More tests + refactoring + Field draft

Published by mrspartak over 4 years ago

hasura-om - New internal methods + tests

Published by mrspartak over 4 years ago

Still not documented, sorry

hasura-om - Fragments extension

Published by mrspartak over 4 years ago

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
  }
}
*/
hasura-om - Try to setup git

Published by mrspartak over 4 years ago

hasura-om - Try to extract version

Published by mrspartak over 4 years ago

hasura-om - Another try to fix workflow

Published by mrspartak over 4 years ago

hasura-om - Try to fix release to npm

Published by mrspartak over 4 years ago

Nothing to say, failing to post

hasura-om - Tests + readme + fixes

Published by mrspartak over 4 years ago

This is still draft release, but it works

hasura-om - Initial release

Published by mrspartak over 4 years ago

Just a draft to test npm publish

Package Rankings
Top 10.15% on Npmjs.org
Badges
Extracted from project README
NPM Coverage Status XO code style Awesome FOSSA Status NPM package npm bundle size npm npm FOSSA Status