Skip to content

Releases: mrspartak/hasura-om

Nested fragment fields with arguments are here + refactoring + readme

25 May 08:14
Compare
Choose a tag to compare
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

22 May 19:47
Compare
Choose a tag to compare
Pre-release
0.0.14

readme. Fixed checkboxes + info about what is done

Bump new realese with fixed test and all stuff from 0.0.12

22 May 15:01
Compare
Choose a tag to compare
0.0.13

cant assure that no rows exists for now, cause other test creates them

Fixed tests

22 May 14:59
Compare
Choose a tag to compare
Fixed tests Pre-release
Pre-release
0.0.12a

cant assure that no rows exists for now, cause other test creates them

Aggregate, pk fragment and flat for all queries

22 May 14:53
Compare
Choose a tag to compare

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

20 May 15:09
Compare
Choose a tag to compare
Pre-release
//you can use nested array to do this
[
  'id',
  [
    'logo',
    [
      'url'
    ]
  ]
]
/*
  id
  logo {
    url
  }
*/

Subscription support

18 May 21:10
Compare
Choose a tag to compare
Subscription support Pre-release
Pre-release

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

18 May 11:43
Compare
Choose a tag to compare
Pre-release
0.0.9

a lot of tests + refactoring

New internal methods + tests

18 May 06:33
Compare
Choose a tag to compare
Pre-release

Still not documented, sorry

Fragments extension

17 May 21:35
Compare
Choose a tag to compare
Fragments extension Pre-release
Pre-release

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
  }
}
*/