jsgql
Javascript to graphql-tag/gql
Install
yarn add jsgql@latest
Description
Converts a javascript object to a graphql-tag/gql object.
Use
const testGql = type: 'query' name: 'test' method: 'testMethod' methodArgs: last: 1 filter: barIn: 'test' foo: __variable__: 'foo' baz: __type__: 'CREATED' variables: id: 1 foo: 'bar' types: bar: 'Baz' fields: 'id' 'foo' 'id' 'bar' console// {// "kind": "Document",// ...
The string that's created by the above object and sent to graphql-tag/gql
query name($id: ID!, $foo: Baz!, $bar: String!) { testMethod(id: $id, foo: $foo, bar: $bar, last: 1, filter: { barIn: ["test"], foo: $foo, baz: CREATED }) { id foo { id bar } }}