novar-graphql-schema

node v4.9.1
version: 1.0.0
endpointsharetweet
const graphql = require('graphql'); const GraphQLJSON = require('graphql-type-json'); const GraphQLDate = require('graphql-date'); const deepmerge = require('deepmerge'); const graphQLSchema = exports = module.exports = {}; graphQLSchema.initGraphQLSchema = function init() { this.schemas = []; this.queries = []; this.mutations = []; this.resolvers = []; this.resolverContext = {}; }; graphQLSchema.addSchema = function addSchema(schema) { this.schemas.push(schema); }; graphQLSchema.getSchemas = function getSchemas() { const schemas = this.schemas.join('\n'); return schemas; }; graphQLSchema.addQuery = function addQuery(query) { this.queries.push(query); }; graphQLSchema.addMutation = function addMutation(mutation) { this.mutations.push(mutation); }; graphQLSchema.addResolvers = function addResolvers(resolvers) { this.resolvers = deepmerge(this.resolvers, resolvers); }; graphQLSchema.addToResolverContext = function addToResolverContext(object) { this.resolverContext = deepmerge(this.resolverContext, object); };
Loading…

no comments

    sign in to comment