Skip to content

converts graphql query template strings to json objects

License

Notifications You must be signed in to change notification settings

magic-libraries/gql

Repository files navigation

@magic-libraries/gql

graphql client library for @magic

html-docs

NPM version Linux Build Status Windows Build Status Coverage Status Greenkeeper badge Known Vulnerabilities

installation

npm install --save-exact @magic-libraries/gql

usage

in a page/component, just use the lib.gql function'),

const query = lib.gql(`query getHuman($id: Int) {
  human(id: $id) {
    name
    height
  }
}`)

const result = query(1)

// returns valid json with the following structure:
{
  query: `query getHuman($id: Int = 3) {
    human(id: $id) {
      name
      height
    }
  }`,
  variables: '1',
  operationName: 'getHuman'
}

caveat

this library will throw an error if invalid values get passed in.

0.0.1

first release

0.0.2

require node 13.5.0

0.0.3

bump required node version

0.0.4

bump required node version to 14.15.4

0.0.5

update dependencies

0.0.6 - unreleased

...

About

converts graphql query template strings to json objects

Resources

License

Stars

Watchers

Forks

Packages

No packages published