@apollographql/apollo-tools
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -11,4 +11,4 @@ import { GraphQLSchema, DocumentNode, GraphQLError } from "graphql"; | ||
} | ||
export declare function buildServiceDefinition(modules: GraphQLSchemaModule[]): GraphQLServiceDefinition; | ||
export declare function buildServiceDefinition(modules: (GraphQLSchemaModule | DocumentNode)[]): GraphQLServiceDefinition; | ||
export {}; | ||
//# sourceMappingURL=buildServiceDefinition.d.ts.map |
@@ -18,7 +18,7 @@ "use strict"; | ||
for (let module of modules) { | ||
if (graphql_2.isNode(module) && graphql_2.isDocumentNode(module)) { | ||
if ((0, graphql_2.isNode)(module) && (0, graphql_2.isDocumentNode)(module)) { | ||
module = { typeDefs: module }; | ||
} | ||
for (const definition of module.typeDefs.definitions) { | ||
if (graphql_1.isTypeDefinitionNode(definition)) { | ||
if ((0, graphql_1.isTypeDefinitionNode)(definition)) { | ||
const typeName = definition.name.value; | ||
@@ -32,3 +32,3 @@ if (typeDefinitionsMap[typeName]) { | ||
} | ||
else if (graphql_1.isTypeExtensionNode(definition)) { | ||
else if ((0, graphql_1.isTypeExtensionNode)(definition)) { | ||
const typeName = definition.name.value; | ||
@@ -74,3 +74,3 @@ if (typeExtensionsMap[typeName]) { | ||
const operationTypes = flattened([schemaDefinition, ...schemaExtensions] | ||
.map(node => node.operationTypes) | ||
.map((node) => node.operationTypes) | ||
.filter(predicates_1.isNotNullOrUndefined)); | ||
@@ -93,3 +93,3 @@ for (const operationType of operationTypes) { | ||
mutation: "Mutation", | ||
subscription: "Subscription" | ||
subscription: "Subscription", | ||
}; | ||
@@ -105,5 +105,5 @@ } | ||
kind: graphql_1.Kind.NAME, | ||
value: typeName | ||
} | ||
} | ||
value: typeName, | ||
}, | ||
}, | ||
]; | ||
@@ -122,15 +122,15 @@ } | ||
const directives = flattened(Object.values(directivesMap)); | ||
let schema = graphql_1.buildASTSchema({ | ||
let schema = (0, graphql_1.buildASTSchema)({ | ||
kind: graphql_1.Kind.DOCUMENT, | ||
definitions: [...typeDefinitions, ...directives] | ||
definitions: [...typeDefinitions, ...directives], | ||
}); | ||
const typeExtensions = flattened(Object.values(typeExtensionsMap)); | ||
if (typeExtensions.length > 0) { | ||
schema = graphql_1.extendSchema(schema, { | ||
schema = (0, graphql_1.extendSchema)(schema, { | ||
kind: graphql_1.Kind.DOCUMENT, | ||
definitions: typeExtensions | ||
definitions: typeExtensions, | ||
}); | ||
} | ||
for (const module of modules) { | ||
if (!module.resolvers) | ||
if ("kind" in module || !module.resolvers) | ||
continue; | ||
@@ -149,3 +149,3 @@ addResolversToSchema(schema, module.resolvers); | ||
const type = schema.getType(typeName); | ||
if (!graphql_1.isObjectType(type)) | ||
if (!(0, graphql_1.isObjectType)(type)) | ||
continue; | ||
@@ -152,0 +152,0 @@ const fieldMap = type.getFields(); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "@apollographql/apollo-tools", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"author": "Apollo GraphQL <packages@apollographql.com>", | ||
@@ -44,7 +44,7 @@ "license": "MIT", | ||
"tsconfig": "<rootDir>/tsconfig.test.json", | ||
"diagnostics": true | ||
"diagnostics": false | ||
} | ||
} | ||
}, | ||
"gitHead": "78c9c0352f99c0b09daa7ab1246fab6f7d5f4342" | ||
"gitHead": "58b96377de23b35f31264fda805d967a63a800c7" | ||
} |
@@ -17,3 +17,2 @@ import { | ||
SchemaExtensionNode, | ||
OperationTypeDefinitionNode | ||
} from "graphql"; | ||
@@ -39,3 +38,3 @@ import { isNode, isDocumentNode } from "./utilities/graphql"; | ||
export function buildServiceDefinition( | ||
modules: GraphQLSchemaModule[] | ||
modules: (GraphQLSchemaModule | DocumentNode)[] | ||
): GraphQLServiceDefinition { | ||
@@ -131,3 +130,3 @@ const errors: GraphQLError[] = []; | ||
[schemaDefinition, ...schemaExtensions] | ||
.map(node => node.operationTypes) | ||
.map((node) => node.operationTypes) | ||
.filter(isNotNullOrUndefined) | ||
@@ -158,3 +157,3 @@ ); | ||
mutation: "Mutation", | ||
subscription: "Subscription" | ||
subscription: "Subscription", | ||
}; | ||
@@ -171,5 +170,5 @@ } | ||
kind: Kind.NAME, | ||
value: typeName | ||
} | ||
} | ||
value: typeName, | ||
}, | ||
}, | ||
]; | ||
@@ -197,3 +196,3 @@ } else { | ||
kind: Kind.DOCUMENT, | ||
definitions: [...typeDefinitions, ...directives] | ||
definitions: [...typeDefinitions, ...directives], | ||
}); | ||
@@ -206,3 +205,3 @@ | ||
kind: Kind.DOCUMENT, | ||
definitions: typeExtensions | ||
definitions: typeExtensions, | ||
}); | ||
@@ -212,3 +211,3 @@ } | ||
for (const module of modules) { | ||
if (!module.resolvers) continue; | ||
if ("kind" in module || !module.resolvers) continue; | ||
@@ -215,0 +214,0 @@ addResolversToSchema(schema, module.resolvers); |
@@ -6,3 +6,3 @@ import { | ||
DocumentNode, | ||
Kind | ||
Kind, | ||
} from "graphql"; | ||
@@ -9,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
598
56946