0.0.14 • Published 8 years ago

graphql-utilities v0.0.14

Weekly downloads
486
License
MIT
Repository
github
Last release
8 years ago

graphql-utilities

npm version Build Status Coverage Status

Inspired by graph.ql, graphql-tools, and graphql-helpers.

Why?

There are various libraries out there providing utilities for GraphQL and even the reference implementation itself is adding new utilities. So why do we need another one?

None of those libraries let you build GraphQL types using the schema language. This prevents gradual adoption of the tools and makes code separation and isolation a nightmare.

With graphql-utilities it's simple. build makes it extremely simple to build a GraphQL type.

build(`
  type Query {
    ok: Boolean!
  }
`);

/* is equivalent to */

new GraphQLObjectType({
  name: 'Query',
  fields: () => ({
    ok: { type: new GraphQLNonNull(GraphQLBoolean) },
  }),
})

Installation

npm install --save graphql-utilities

Getting Started

import { build } from 'graphql-utilities';

// you can build a type
const Record = build(`
  interface Record {
    id: ID!
  }
`);

// or you can build a schema
const Schema = build(`
  schema {
    query: Query
  }

  type Query {
    ok: Boolean!
  }
`);

TODO

  • Add detailed API docs.
  • Make build configuration interchangeable with types.
  • Allow build to accept a flag to skip inferred schema.

License

MIT

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago