graphql-tools-fork
Advanced tools
Comparing version 8.5.5 to 8.6.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [8.6.0](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.5.5...v8.6.0) (2020-02-17) | ||
### Features | ||
* **graphql:** initial v15 support. ([4034560](https://github.com/yaacovCR/graphql-tools-fork/commit/4034560a29c7097843fe173806f74d63790e6e2b)) | ||
* **graphql:** interfaces implementing interfaces ([b0241b7](https://github.com/yaacovCR/graphql-tools-fork/commit/b0241b7f42d942905e40897dcf0478a0d11b182c)) | ||
### Bug Fixes | ||
* **ci:** fix types ([459ddfe](https://github.com/yaacovCR/graphql-tools-fork/commit/459ddfec92d335aa84467cc5f66d815fab093c91)) | ||
* **typo:** caused by prettier? ([11351e2](https://github.com/yaacovCR/graphql-tools-fork/commit/11351e2141599e621b4babe2998273f5e4b0c656)) | ||
### [8.5.5](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.5.4...v8.5.5) (2020-02-16) | ||
@@ -7,0 +21,0 @@ |
@@ -6,3 +6,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
var graphql_1 = require("graphql"); | ||
var extractExtensionDefinitions_1 = __importDefault(require("./extractExtensionDefinitions")); | ||
var extensionDefinitions_1 = require("./extensionDefinitions"); | ||
var concatenateTypeDefs_1 = __importDefault(require("./concatenateTypeDefs")); | ||
@@ -27,8 +27,7 @@ var SchemaError_1 = __importDefault(require("./SchemaError")); | ||
} | ||
var typesAst = extensionDefinitions_1.filterExtensionDefinitions(astDocument); | ||
var backcompatOptions = { commentDescriptions: true }; | ||
// TODO fix types https://github.com/apollographql/graphql-tools/issues/542 | ||
var schema = graphql_1.buildASTSchema(astDocument, backcompatOptions); | ||
var extensionsAst = extractExtensionDefinitions_1.default(astDocument); | ||
var schema = graphql_1.buildASTSchema(typesAst, backcompatOptions); | ||
var extensionsAst = extensionDefinitions_1.extractExtensionDefinitions(astDocument); | ||
if (extensionsAst.definitions.length > 0) { | ||
// TODO fix types https://github.com/apollographql/graphql-tools/issues/542 | ||
schema = graphql_1.extendSchema(schema, extensionsAst, backcompatOptions); | ||
@@ -35,0 +34,0 @@ } |
@@ -27,3 +27,4 @@ var __assign = (this && this.__assign) || function () { | ||
var type = schema.getType(typeName); | ||
if (type instanceof graphql_1.GraphQLObjectType) { | ||
if (type instanceof graphql_1.GraphQLObjectType || | ||
(graphql_1.versionInfo.major >= 15 && type instanceof graphql_1.GraphQLInterfaceType)) { | ||
var interfaceResolvers = type | ||
@@ -30,0 +31,0 @@ .getInterfaces() |
@@ -12,3 +12,3 @@ export { default as addResolversToSchema } from './addResolversToSchema'; | ||
export { default as extendResolversFromInterfaces } from './extendResolversFromInterfaces'; | ||
export { default as extractExtensionDefinitions } from './extractExtensionDefinitions'; | ||
export { extractExtensionDefinitions, filterExtensionDefinitions, } from './extensionDefinitions'; | ||
export { default as SchemaError } from './SchemaError'; | ||
@@ -15,0 +15,0 @@ export { default as addResolveFunctionsToSchema } from './addResolversToSchema'; |
@@ -24,4 +24,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extendResolversFromInterfaces = extendResolversFromInterfaces_1.default; | ||
var extractExtensionDefinitions_1 = require("./extractExtensionDefinitions"); | ||
exports.extractExtensionDefinitions = extractExtensionDefinitions_1.default; | ||
var extensionDefinitions_1 = require("./extensionDefinitions"); | ||
exports.extractExtensionDefinitions = extensionDefinitions_1.extractExtensionDefinitions; | ||
exports.filterExtensionDefinitions = extensionDefinitions_1.filterExtensionDefinitions; | ||
var SchemaError_1 = require("./SchemaError"); | ||
@@ -28,0 +29,0 @@ exports.SchemaError = SchemaError_1.default; |
@@ -73,3 +73,2 @@ var __assign = (this && this.__assign) || function () { | ||
var fieldType = graphql_1.getNullableType(type); | ||
var namedFieldType = graphql_1.getNamedType(fieldType); | ||
if (fieldName && root && typeof root[fieldName] !== 'undefined') { | ||
@@ -89,2 +88,3 @@ var result = void 0; | ||
// This allows overriding defaults while writing very little code. | ||
var namedFieldType = graphql_1.getNamedType(fieldType); | ||
if (mockFunctionMap.has(namedFieldType.name)) { | ||
@@ -91,0 +91,0 @@ var mock = mockFunctionMap.get(namedFieldType.name); |
@@ -9,3 +9,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
var linkToFetcher_1 = __importDefault(require("./linkToFetcher")); | ||
var parsedIntrospectionQuery = graphql_1.parse(graphql_1.introspectionQuery); | ||
var parsedIntrospectionQuery = graphql_1.parse(graphql_1.getIntrospectionQuery()); | ||
function introspectSchema(linkOrFetcher, linkContext) { | ||
@@ -12,0 +12,0 @@ var fetcher = linkOrFetcher instanceof apollo_link_1.ApolloLink |
import { ApolloLink } from 'apollo-link'; | ||
import { GraphQLFieldResolver, GraphQLSchema, GraphQLResolveInfo, BuildSchemaOptions } from 'graphql'; | ||
import { Options as PrintSchemaOptions } from 'graphql/utilities/schemaPrinter'; | ||
import { Fetcher } from '../Interfaces'; | ||
@@ -12,4 +11,3 @@ export declare type ResolverFn = (rootValue?: any, args?: any, context?: any, info?: GraphQLResolveInfo) => AsyncIterator<any>; | ||
buildSchemaOptions?: BuildSchemaOptions; | ||
printSchemaOptions?: PrintSchemaOptions; | ||
}): GraphQLSchema; | ||
export declare function createResolver(fetcher: Fetcher): GraphQLFieldResolver<any, any>; |
@@ -252,6 +252,14 @@ var __assign = (this && this.__assign) || function () { | ||
else if (initialCandidateType instanceof graphql_1.GraphQLInterfaceType) { | ||
return new graphql_1.GraphQLInterfaceType({ | ||
var config = { | ||
name: typeName, | ||
fields: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), candidate.type.toConfig().fields)); }, {}), | ||
}); | ||
interfaces: graphql_1.versionInfo.major >= 15 | ||
? candidates.reduce(function (acc, candidate) { | ||
var interfaces = candidate.type.toConfig() | ||
.interfaces; | ||
return interfaces != null ? acc.concat(interfaces) : acc; | ||
}, []) | ||
: undefined, | ||
}; | ||
return new graphql_1.GraphQLInterfaceType(config); | ||
} | ||
@@ -258,0 +266,0 @@ else if (initialCandidateType instanceof graphql_1.GraphQLUnionType) { |
@@ -31,3 +31,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
function makeObjectType(node) { | ||
return new graphql_1.GraphQLObjectType({ | ||
var config = { | ||
name: node.name.value, | ||
@@ -41,11 +41,20 @@ fields: function () { return makeFields(node.fields); }, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
}); | ||
}; | ||
return new graphql_1.GraphQLObjectType(config); | ||
} | ||
function makeInterfaceType(node) { | ||
return new graphql_1.GraphQLInterfaceType({ | ||
var config = { | ||
name: node.name.value, | ||
fields: function () { return makeFields(node.fields); }, | ||
interfaces: graphql_1.versionInfo.major >= 15 | ||
? function () { | ||
return node.interfaces.map(function (iface) { | ||
return stub_1.createNamedStub(iface.name.value, 'interface'); | ||
}); | ||
} | ||
: undefined, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
resolveType: function (parent) { return resolveFromParentTypename_1.default(parent); }, | ||
}); | ||
}; | ||
return new graphql_1.GraphQLInterfaceType(config); | ||
} | ||
@@ -52,0 +61,0 @@ function makeEnumType(node) { |
@@ -29,3 +29,5 @@ var __assign = (this && this.__assign) || function () { | ||
else if (type instanceof graphql_1.GraphQLInterfaceType) { | ||
return new graphql_1.GraphQLInterfaceType(type.toConfig()); | ||
var config = type.toConfig(); | ||
var newConfig = __assign(__assign({}, config), { interfaces: graphql_1.versionInfo.major >= 15 ? config.interfaces.slice() : undefined }); | ||
return new graphql_1.GraphQLInterfaceType(newConfig); | ||
} | ||
@@ -32,0 +34,0 @@ else if (type instanceof graphql_1.GraphQLUnionType) { |
@@ -85,2 +85,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
healFields(type); | ||
if (graphql_1.versionInfo.major >= 15) { | ||
healInterfaces(type); | ||
} | ||
return; | ||
@@ -166,3 +169,4 @@ } | ||
each_1.default(typeMap, function (namedType) { | ||
if (namedType instanceof graphql_1.GraphQLObjectType) { | ||
if (namedType instanceof graphql_1.GraphQLObjectType || | ||
(graphql_1.versionInfo.major >= 15 && namedType instanceof graphql_1.GraphQLInterfaceType)) { | ||
each_1.default(namedType.getInterfaces(), function (iface) { | ||
@@ -169,0 +173,0 @@ implementedInterfaces[iface.name] = true; |
{ | ||
"name": "graphql-tools-fork", | ||
"version": "8.5.5", | ||
"version": "8.6.0", | ||
"description": "Forked graphql-tools, still more useful tools to create and manipulate GraphQL schemas.", | ||
@@ -23,5 +23,5 @@ "main": "dist/index.js", | ||
"prepublishOnly": "npm run compile", | ||
"prerelease": "npm test", | ||
"prettier": "prettier --trailing-comma all --single-quote --write src/**/*.ts", | ||
"prettier:check": "prettier --trailing-comma all --single-quote --check src/**/*.ts", | ||
"prerelease": "npm test", | ||
"release": "npm run releaseonly", | ||
@@ -60,3 +60,3 @@ "releaseonly": "standard-version" | ||
"peerDependencies": { | ||
"graphql": "^14.2.0" | ||
"graphql": "^14.2.0 || ^15.0.0-rc" | ||
}, | ||
@@ -89,3 +89,3 @@ "devDependencies": { | ||
"express-graphql": "^0.9.0", | ||
"graphql": "^14.5.8", | ||
"graphql": "^14.6.0", | ||
"graphql-subscriptions": "^1.1.0", | ||
@@ -92,0 +92,0 @@ "graphql-type-json": "^0.3.1", |
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
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
663893
8040