graphql-schema-tools
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

graphql-schema-tools

NPM version Build Status Coverage Status Standard Version

Functions & Utilitize for creating and stiching graphql schema.

What does it include:

1. Basic functionality to compose typeDefs + resolvers into a schema.
2. Support for `subscriptions` as well (subscribe function)
3. Support for arrays of objects parts:
    - if the same type found, it will be properly merged.
4. Support for decomposing schema back to it's original parts 
   (typeDefs, resolvers, subscriptions)

API

  • Functions Used to combine array of parts into 1 valid part:

    function concatTypeDefs(typeDefs: string[]): string;
    function concatResolvers(resolvers: IResolvers[]): IResolvers;
    function concatSubscriptions(subscriptions: ISubscriptions[]): ISubscriptions;
  • Functions Used to compose & decompose Schema:

    NOTE: makeExecutableSchema is alias of composeSchema.

    function composeSchema(options: IExecutableSchemaParts): GraphQLSchema;
    function makeExecutableSchema(options: IExecutableSchemaParts): GraphQLSchema;
    function decomposeSchema(schema: GraphQLSchema): IExecutableSchemaParts;
  • Functions Used to handle with subscribe function across schema:

    function addSubscriptionChannelsToSchema(schema: GraphQLSchema, subscriptionFunctions: ISubscriptions): void;
    function getScehmaSubscriptions(schema: GraphQLSchema): ISubscriptions;
  • Functions Used to handle with resolve function across schema:

    function addResolveFunctionsToSchema(schema: GraphQLSchema, resolveFunctions: IResolvers): void;
    function getScehmaResolvers(schema: GraphQLSchema): IResolvers;

Examples

Until i'll find more time to write some examples, you can refer to tests as simple examples.

Contribution

Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!

Dependencies (1)

Dev Dependencies (15)

Package Sidebar

Install

npm i graphql-schema-tools

Weekly Downloads

0

Version

0.0.6

License

MIT

Last publish

Collaborators

  • hagai.co