@cpmech/lang-query-graph
TypeScript icon, indicating that this package has built-in type declarations

2.36.1 • Public • Published

Language Query Graph - GraphQL tools

lang-query-graph (LQG <-> GQL) implements code for helping with GraphQL.

Installation

npm install @cpmech/lang-query-graph

Example

import gql from 'graphql-tag';
import { DocumentNode } from 'graphql';
import { matchGQL } from '@cpmech/lang-query-graph';

interface MyType {
  name: string;
  email: string;
  address: string;
}

const myType: MyType = {
  name: 'my name',
  email: 'my@email.com',
  address: 'testing place where we test things',
};

const ast: DocumentNode = gql`
  type MyType {
    name: String!
    email: String!
    address: String!
  }

  fragment MyTypeFrag on MyType {
    name
    email
    address
  }
`;

// should not throw an error:
matchGQL(myType, ast, 'MyType', 'MyTypeFrag');

Readme

Keywords

Package Sidebar

Install

npm i @cpmech/lang-query-graph

Weekly Downloads

27

Version

2.36.1

License

MIT

Unpacked Size

14.7 kB

Total Files

10

Last publish

Collaborators

  • dorival