Comparing version
21
index.js
@@ -6,2 +6,4 @@ const { makeExecutableSchema } = require('graphql-tools') | ||
const noop = { noop: 'Boolean' } | ||
module.exports = (config) => { | ||
@@ -33,9 +35,13 @@ const { query, mutation, types = {}, scalars = {} } = config | ||
type Noop { | ||
noop: Boolean | ||
} | ||
schema { | ||
${query ? 'query: RootQuery' : ''} | ||
${mutation ? 'mutation: RootMutation' : ''} | ||
query: ${query ? 'RootQuery' : 'Noop'} | ||
mutation: ${mutation ? 'RootMutation' : 'Noop'} | ||
}` | ||
let typeSchema = '' | ||
types.RootQuery = query | ||
types.RootMutation = mutation | ||
types.RootQuery = query || noop | ||
types.RootMutation = mutation || noop | ||
for (let typeKeyIndex in Object.keys(types)) { | ||
@@ -90,8 +96,7 @@ const typeKey = Object.keys(types)[typeKeyIndex] | ||
const typeDefs = [topLevelSchema, typeSchema] | ||
const schema = makeExecutableSchema({ | ||
typeDefs, | ||
resolvers | ||
}) | ||
const schemaConfig = { typeDefs, resolvers } | ||
console.log(schemaConfig) | ||
const schema = makeExecutableSchema(schemaConfig) | ||
return { typeDefs, resolvers, schema } | ||
// build resolvers | ||
} |
{ | ||
"name": "aeros", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Low-friction GraphQL schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7686
1.9%132
2.33%