graphql-tools-fork
Advanced tools
Comparing version 8.6.1 to 8.6.2
@@ -5,2 +5,4 @@ # Changelog | ||
### [8.6.2](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.6.1...v8.6.2) (2020-02-27) | ||
### [8.6.1](https://github.com/yaacovCR/graphql-tools-fork/compare/v8.6.0...v8.6.1) (2020-02-17) | ||
@@ -7,0 +9,0 @@ |
@@ -49,32 +49,11 @@ var __assign = (this && this.__assign) || function () { | ||
if (type instanceof graphql_1.GraphQLScalarType) { | ||
if (graphql_1.isSpecifiedScalarType(type)) { | ||
// Support -- without recommending -- overriding default scalar types | ||
Object.keys(resolverValue).forEach(function (fieldName) { | ||
if (fieldName.startsWith('__')) { | ||
type[fieldName.substring(2)] = resolverValue[fieldName]; | ||
} | ||
else { | ||
type[fieldName] = resolverValue[fieldName]; | ||
} | ||
}); | ||
} | ||
else { | ||
// Otherwise the existing schema types are not changed, just replaced. | ||
var config_1 = type.toConfig(); | ||
Object.keys(resolverValue).forEach(function (fieldName) { | ||
// Below is necessary as legacy code for scalar type specification allowed | ||
// hardcoding within the resolver an object with fields '__serialize', | ||
// '__parse', and '__parseLiteral', see examples in testMocking.ts. | ||
// Luckily, the fields on GraphQLScalarType and GraphQLScalarTypeConfig | ||
// are named the same. | ||
if (fieldName.startsWith('__')) { | ||
config_1[fieldName.substring(2)] = resolverValue[fieldName]; | ||
} | ||
else { | ||
config_1[fieldName] = resolverValue[fieldName]; | ||
} | ||
}); | ||
// healSchema called later to update all fields to new type | ||
typeMap[typeName] = new graphql_1.GraphQLScalarType(config_1); | ||
} | ||
// Support -- without recommending -- overriding default scalar types | ||
Object.keys(resolverValue).forEach(function (fieldName) { | ||
if (fieldName.startsWith('__')) { | ||
type[fieldName.substring(2)] = resolverValue[fieldName]; | ||
} | ||
else { | ||
type[fieldName] = resolverValue[fieldName]; | ||
} | ||
}); | ||
} | ||
@@ -93,3 +72,3 @@ else if (type instanceof graphql_1.GraphQLEnumType) { | ||
}); | ||
var config = type.toConfig(); | ||
var config = utils_1.typeToConfig(type); | ||
var values = type.getValues(); | ||
@@ -96,0 +75,0 @@ var newValues_1 = {}; |
@@ -21,2 +21,3 @@ var __assign = (this && this.__assign) || function () { | ||
var graphql_1 = require("graphql"); | ||
var utils_1 = require("../utils"); | ||
function extendResolversFromInterfaces(schema, resolvers) { | ||
@@ -29,3 +30,3 @@ var typeNames = Object.keys(__assign(__assign({}, schema.getTypeMap()), resolvers)); | ||
if (type instanceof graphql_1.GraphQLObjectType || | ||
(graphql_1.versionInfo.major >= 15 && type instanceof graphql_1.GraphQLInterfaceType)) { | ||
(utils_1.graphqlVersion() >= 15 && type instanceof graphql_1.GraphQLInterfaceType)) { | ||
var interfaceResolvers = type | ||
@@ -32,0 +33,0 @@ .getInterfaces() |
@@ -14,6 +14,7 @@ var __assign = (this && this.__assign) || function () { | ||
var graphql_1 = require("graphql"); | ||
var utils_1 = require("../utils"); | ||
function extractExtensionDefinitions(ast) { | ||
var extensionDefs = ast.definitions.filter(function (def) { | ||
return def.kind === graphql_1.Kind.OBJECT_TYPE_EXTENSION || | ||
def.kind === graphql_1.Kind.INTERFACE_TYPE_EXTENSION || | ||
(utils_1.graphqlVersion() >= 13 && def.kind === graphql_1.Kind.INTERFACE_TYPE_EXTENSION) || | ||
def.kind === graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION || | ||
@@ -20,0 +21,0 @@ def.kind === graphql_1.Kind.UNION_TYPE_EXTENSION || |
@@ -294,3 +294,3 @@ /* eslint-disable import/no-nodejs-modules */ | ||
function defaultSerializer(body, appendFile) { | ||
var _a = extract_files_1.extractFiles(body, undefined, function (value) { var _a; return extract_files_1.isExtractableFile(value) || ((_a = value) === null || _a === void 0 ? void 0 : _a.createReadStream); }), clone = _a.clone, files = _a.files; | ||
var _a = extract_files_1.extractFiles(body, undefined, function (value) { return extract_files_1.isExtractableFile(value) || (value === null || value === void 0 ? void 0 : value.createReadStream); }), clone = _a.clone, files = _a.files; | ||
var payload = apollo_link_http_common_1.serializeFetchParameter(clone, 'Payload'); | ||
@@ -297,0 +297,0 @@ if (!files.size) { |
@@ -160,3 +160,3 @@ var __assign = (this && this.__assign) || function () { | ||
mockResolver = function (root, args, context, info) { | ||
var updatedRoot = (root !== null && root !== void 0 ? root : {}); // TODO: should we clone instead? | ||
var updatedRoot = root !== null && root !== void 0 ? root : {}; // TODO: should we clone instead? | ||
updatedRoot[fieldName] = rootMock_1(root, args, context, info)[fieldName]; | ||
@@ -163,0 +163,0 @@ // XXX this is a bit of a hack to still use mockType, which |
@@ -6,9 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
description: 'The `Upload` scalar type represents a file upload.', | ||
parseValue: function (value) { return value; }, | ||
parseLiteral: function () { | ||
throw new Error('‘Upload’ scalar literal unsupported.'); | ||
parseValue: function (value) { | ||
if (value != null && value.promise instanceof Promise) { | ||
// graphql-upload v10 | ||
return value.promise; | ||
} | ||
else if (value instanceof Promise) { | ||
// graphql-upload v9 | ||
return value; | ||
} | ||
throw new graphql_1.GraphQLError('Upload value invalid.'); | ||
}, | ||
// serialization requires to support schema stitching | ||
serialize: function (value) { return value; }, | ||
parseLiteral: function (ast) { | ||
throw new graphql_1.GraphQLError('Upload literal unsupported.', ast); | ||
}, | ||
}); | ||
exports.GraphQLUpload = GraphQLUpload; | ||
//# sourceMappingURL=GraphQLUpload.js.map |
@@ -71,3 +71,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var targetSchema = typeof schemaOrTypeDefs === 'string' | ||
? graphql_1.buildSchema(schemaOrTypeDefs, buildSchemaOptions) | ||
? graphql_1.buildASTSchema(graphql_1.parse(schemaOrTypeDefs), buildSchemaOptions) | ||
: schemaOrTypeDefs; | ||
@@ -74,0 +74,0 @@ var remoteSchema = utils_1.cloneSchema(targetSchema); |
@@ -170,7 +170,23 @@ var __assign = (this && this.__assign) || function () { | ||
}); | ||
extensions.forEach(function (extension) { | ||
mergedSchema = graphql_1.extendSchema(mergedSchema, extension, { | ||
commentDescriptions: true, | ||
var proxyingResolvers; | ||
if (utils_1.graphqlVersion() >= 14) { | ||
extensions.forEach(function (extension) { | ||
mergedSchema = graphql_1.extendSchema(mergedSchema, extension, { | ||
commentDescriptions: true, | ||
}); | ||
}); | ||
}); | ||
} | ||
else { | ||
// extendSchema in graphql < v14 does not support subscriptions? | ||
proxyingResolvers = utils_1.getResolversFromSchema(mergedSchema); | ||
extensions.forEach(function (extension) { | ||
mergedSchema = graphql_1.extendSchema(mergedSchema, extension, { | ||
commentDescriptions: true, | ||
}); | ||
}); | ||
makeExecutableSchema_1.addResolversToSchema({ | ||
schema: mergedSchema, | ||
resolvers: proxyingResolvers, | ||
}); | ||
} | ||
makeExecutableSchema_1.addResolversToSchema({ | ||
@@ -244,5 +260,5 @@ schema: mergedSchema, | ||
name: typeName, | ||
fields: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), candidate.type.toConfig().fields)); }, {}), | ||
fields: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), utils_1.typeToConfig(candidate.type).fields)); }, {}), | ||
interfaces: candidates.reduce(function (acc, candidate) { | ||
var interfaces = candidate.type.toConfig() | ||
var interfaces = utils_1.typeToConfig(candidate.type) | ||
.interfaces; | ||
@@ -256,7 +272,6 @@ return interfaces != null ? acc.concat(interfaces) : acc; | ||
name: typeName, | ||
fields: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), candidate.type.toConfig().fields)); }, {}), | ||
interfaces: graphql_1.versionInfo.major >= 15 | ||
fields: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), utils_1.typeToConfig(candidate.type).fields)); }, {}), | ||
interfaces: utils_1.graphqlVersion() >= 15 | ||
? candidates.reduce(function (acc, candidate) { | ||
var interfaces = candidate.type.toConfig() | ||
.interfaces; | ||
var interfaces = utils_1.typeToConfig(candidate.type).interfaces; | ||
return interfaces != null ? acc.concat(interfaces) : acc; | ||
@@ -272,3 +287,3 @@ }, []) | ||
types: candidates.reduce(function (acc, candidate) { | ||
return acc.concat(candidate.type.toConfig().types); | ||
return acc.concat(utils_1.typeToConfig(candidate.type).types); | ||
}, []), | ||
@@ -280,3 +295,3 @@ }); | ||
name: typeName, | ||
values: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), candidate.type.toConfig().values)); }, {}), | ||
values: candidates.reduce(function (acc, candidate) { return (__assign(__assign({}, acc), utils_1.typeToConfig(candidate.type).values)); }, {}), | ||
}); | ||
@@ -283,0 +298,0 @@ } |
import { DefinitionNode, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLDirective } from 'graphql'; | ||
export declare type GetType = (name: string, type: 'object' | 'interface' | 'input') => GraphQLObjectType | GraphQLInputObjectType | GraphQLInterfaceType; | ||
export default function typeFromAST(node: DefinitionNode): GraphQLNamedType | GraphQLDirective | null; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function getBlockStringIndentation(lines: ReadonlyArray<string>): number; |
@@ -6,3 +6,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
var graphql_1 = require("graphql"); | ||
var stub_1 = require("../utils/stub"); | ||
var utils_1 = require("../utils"); | ||
var resolveFromParentTypename_1 = __importDefault(require("./resolveFromParentTypename")); | ||
@@ -37,6 +37,6 @@ var backcompatOptions = { commentDescriptions: true }; | ||
return node.interfaces.map(function (iface) { | ||
return stub_1.createNamedStub(iface.name.value, 'interface'); | ||
return utils_1.createNamedStub(iface.name.value, 'interface'); | ||
}); | ||
}, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
}; | ||
@@ -49,10 +49,10 @@ return new graphql_1.GraphQLObjectType(config); | ||
fields: function () { return makeFields(node.fields); }, | ||
interfaces: graphql_1.versionInfo.major >= 15 | ||
interfaces: utils_1.graphqlVersion() >= 15 | ||
? function () { | ||
return node.interfaces.map(function (iface) { | ||
return stub_1.createNamedStub(iface.name.value, 'interface'); | ||
return utils_1.createNamedStub(iface.name.value, 'interface'); | ||
}); | ||
} | ||
: undefined, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
resolveType: function (parent) { return resolveFromParentTypename_1.default(parent); }, | ||
@@ -66,3 +66,3 @@ }; | ||
values[value.name.value] = { | ||
description: graphql_1.getDescription(value, backcompatOptions), | ||
description: getDescription(value, backcompatOptions), | ||
}; | ||
@@ -73,3 +73,3 @@ }); | ||
values: values, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
}); | ||
@@ -83,3 +83,3 @@ } | ||
}, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
resolveType: function (parent) { return resolveFromParentTypename_1.default(parent); }, | ||
@@ -91,3 +91,3 @@ }); | ||
name: node.name.value, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
serialize: function () { return null; }, | ||
@@ -106,3 +106,3 @@ // Note: validation calls the parse functions to determine if a | ||
fields: function () { return makeValues(node.fields); }, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
}); | ||
@@ -122,3 +122,3 @@ } | ||
args: makeValues(node.arguments), | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
deprecationReason: deprecationReason, | ||
@@ -136,3 +136,3 @@ }; | ||
defaultValue: node.defaultValue, | ||
description: graphql_1.getDescription(node, backcompatOptions), | ||
description: getDescription(node, backcompatOptions), | ||
}; | ||
@@ -149,3 +149,3 @@ }); | ||
default: | ||
return stub_1.createNamedStub(node.name.value, type); | ||
return utils_1.createNamedStub(node.name.value, type); | ||
} | ||
@@ -167,2 +167,84 @@ } | ||
} | ||
// graphql < v13 does not export getDescription | ||
function getDescription(node, options) { | ||
if (node.description != null) { | ||
return node.description.value; | ||
} | ||
if (options.commentDescriptions) { | ||
var rawValue = getLeadingCommentBlock(node); | ||
if (rawValue !== undefined) { | ||
return dedentBlockStringValue("\n" + rawValue); | ||
} | ||
} | ||
} | ||
function getLeadingCommentBlock(node) { | ||
var loc = node.loc; | ||
if (!loc) { | ||
return; | ||
} | ||
var comments = []; | ||
var token = loc.startToken.prev; | ||
while (token != null && | ||
token.kind === graphql_1.TokenKind.COMMENT && | ||
token.next != null && | ||
token.prev != null && | ||
token.line + 1 === token.next.line && | ||
token.line !== token.prev.line) { | ||
var value = String(token.value); | ||
comments.push(value); | ||
token = token.prev; | ||
} | ||
return comments.length > 0 ? comments.reverse().join('\n') : undefined; | ||
} | ||
function dedentBlockStringValue(rawString) { | ||
// Expand a block string's raw value into independent lines. | ||
var lines = rawString.split(/\r\n|[\n\r]/g); | ||
// Remove common indentation from all lines but first. | ||
var commonIndent = getBlockStringIndentation(lines); | ||
if (commonIndent !== 0) { | ||
for (var i = 1; i < lines.length; i++) { | ||
lines[i] = lines[i].slice(commonIndent); | ||
} | ||
} | ||
// Remove leading and trailing blank lines. | ||
while (lines.length > 0 && isBlank(lines[0])) { | ||
lines.shift(); | ||
} | ||
while (lines.length > 0 && isBlank(lines[lines.length - 1])) { | ||
lines.pop(); | ||
} | ||
// Return a string of the lines joined with U+000A. | ||
return lines.join('\n'); | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
function getBlockStringIndentation(lines) { | ||
var commonIndent = null; | ||
for (var i = 1; i < lines.length; i++) { | ||
var line = lines[i]; | ||
var indent = leadingWhitespace(line); | ||
if (indent === line.length) { | ||
continue; // skip empty lines | ||
} | ||
if (commonIndent === null || indent < commonIndent) { | ||
commonIndent = indent; | ||
if (commonIndent === 0) { | ||
break; | ||
} | ||
} | ||
} | ||
return commonIndent === null ? 0 : commonIndent; | ||
} | ||
exports.getBlockStringIndentation = getBlockStringIndentation; | ||
function leadingWhitespace(str) { | ||
var i = 0; | ||
while (i < str.length && (str[i] === ' ' || str[i] === '\t')) { | ||
i++; | ||
} | ||
return i; | ||
} | ||
function isBlank(str) { | ||
return leadingWhitespace(str) === str.length; | ||
} | ||
//# sourceMappingURL=typeFromAST.js.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var graphql_1 = require("graphql"); | ||
var Interfaces_1 = require("../Interfaces"); | ||
var visitSchema_1 = require("../utils/visitSchema"); | ||
var clone_1 = require("../utils/clone"); | ||
var utils_1 = require("../utils"); | ||
function filterSchema(_a) { | ||
var _b; | ||
var schema = _a.schema, _c = _a.rootFieldFilter, rootFieldFilter = _c === void 0 ? function () { return true; } : _c, _d = _a.typeFilter, typeFilter = _d === void 0 ? function () { return true; } : _d, _e = _a.fieldFilter, fieldFilter = _e === void 0 ? function () { return true; } : _e; | ||
var filteredSchema = visitSchema_1.visitSchema(clone_1.cloneSchema(schema), (_b = {}, | ||
var filteredSchema = utils_1.visitSchema(utils_1.cloneSchema(schema), (_b = {}, | ||
_b[Interfaces_1.VisitSchemaKind.QUERY] = function (type) { | ||
@@ -45,3 +44,3 @@ return filterRootFields(type, 'Query', rootFieldFilter); | ||
function filterRootFields(type, operation, rootFieldFilter) { | ||
var config = type.toConfig(); | ||
var config = utils_1.typeToConfig(type); | ||
Object.keys(config.fields).forEach(function (fieldName) { | ||
@@ -55,3 +54,3 @@ if (!rootFieldFilter(operation, fieldName)) { | ||
function filterObjectFields(type, fieldFilter) { | ||
var config = type.toConfig(); | ||
var config = utils_1.typeToConfig(type); | ||
Object.keys(config.fields).forEach(function (fieldName) { | ||
@@ -58,0 +57,0 @@ if (!fieldFilter(type.name, fieldName)) { |
@@ -19,3 +19,3 @@ var __assign = (this && this.__assign) || function () { | ||
var Interfaces_1 = require("../Interfaces"); | ||
var visitSchema_1 = require("../utils/visitSchema"); | ||
var utils_1 = require("../utils"); | ||
var TransformObjectFields = /** @class */ (function () { | ||
@@ -30,3 +30,3 @@ function TransformObjectFields(objectFieldTransformer, fieldNodeTransformer) { | ||
var _this = this; | ||
this.transformedSchema = visitSchema_1.visitSchema(originalSchema, (_a = {}, | ||
this.transformedSchema = utils_1.visitSchema(originalSchema, (_a = {}, | ||
_a[Interfaces_1.VisitSchemaKind.OBJECT_TYPE] = function (type) { | ||
@@ -50,3 +50,3 @@ return _this.transformFields(type, _this.objectFieldTransformer); | ||
var _this = this; | ||
var typeConfig = type.toConfig(); | ||
var typeConfig = utils_1.typeToConfig(type); | ||
var fields = type.getFields(); | ||
@@ -83,3 +83,3 @@ var newFields = {}; | ||
} | ||
return new graphql_1.GraphQLObjectType(__assign(__assign({}, type.toConfig()), { fields: newFields })); | ||
return new graphql_1.GraphQLObjectType(__assign(__assign({}, utils_1.typeToConfig(type)), { fields: newFields })); | ||
}; | ||
@@ -86,0 +86,0 @@ TransformObjectFields.prototype.transformDocument = function (document, mapping, fieldNodeTransformer, fragments) { |
@@ -19,4 +19,6 @@ var __assign = (this && this.__assign) || function () { | ||
var isSpecifiedScalarType_1 = __importDefault(require("./isSpecifiedScalarType")); | ||
var toConfig_1 = require("./toConfig"); | ||
var graphqlVersion_1 = require("./graphqlVersion"); | ||
function cloneDirective(directive) { | ||
return new graphql_1.GraphQLDirective(directive.toConfig()); | ||
return new graphql_1.GraphQLDirective(toConfig_1.directiveToConfig(directive)); | ||
} | ||
@@ -26,19 +28,23 @@ exports.cloneDirective = cloneDirective; | ||
if (type instanceof graphql_1.GraphQLObjectType) { | ||
var config = type.toConfig(); | ||
return new graphql_1.GraphQLObjectType(__assign(__assign({}, config), { interfaces: config.interfaces.slice() })); | ||
var config = toConfig_1.typeToConfig(type); | ||
return new graphql_1.GraphQLObjectType(__assign(__assign({}, config), { interfaces: typeof config.interfaces === 'function' | ||
? config.interfaces | ||
: config.interfaces.slice() })); | ||
} | ||
else if (type instanceof graphql_1.GraphQLInterfaceType) { | ||
var config = type.toConfig(); | ||
var newConfig = __assign(__assign({}, config), { interfaces: graphql_1.versionInfo.major >= 15 ? config.interfaces.slice() : undefined }); | ||
var config = toConfig_1.typeToConfig(type); | ||
var newConfig = __assign(__assign({}, config), { interfaces: graphqlVersion_1.graphqlVersion() >= 15 | ||
? config.interfaces.slice() | ||
: undefined }); | ||
return new graphql_1.GraphQLInterfaceType(newConfig); | ||
} | ||
else if (type instanceof graphql_1.GraphQLUnionType) { | ||
var config = type.toConfig(); | ||
var config = toConfig_1.typeToConfig(type); | ||
return new graphql_1.GraphQLUnionType(__assign(__assign({}, config), { types: config.types.slice() })); | ||
} | ||
else if (type instanceof graphql_1.GraphQLInputObjectType) { | ||
return new graphql_1.GraphQLInputObjectType(type.toConfig()); | ||
return new graphql_1.GraphQLInputObjectType(toConfig_1.typeToConfig(type)); | ||
} | ||
else if (type instanceof graphql_1.GraphQLEnumType) { | ||
return new graphql_1.GraphQLEnumType(type.toConfig()); | ||
return new graphql_1.GraphQLEnumType(toConfig_1.typeToConfig(type)); | ||
} | ||
@@ -48,3 +54,3 @@ else if (type instanceof graphql_1.GraphQLScalarType) { | ||
? type | ||
: new graphql_1.GraphQLScalarType(type.toConfig()); | ||
: new graphql_1.GraphQLScalarType(toConfig_1.typeToConfig(type)); | ||
} | ||
@@ -69,5 +75,5 @@ throw new Error("Invalid type " + type); | ||
var subscription = schema.getSubscriptionType(); | ||
return new graphql_1.GraphQLSchema(__assign(__assign({}, schema.toConfig()), { query: query != null ? newTypeMap[query.name] : undefined, mutation: mutation != null ? newTypeMap[mutation.name] : undefined, subscription: subscription != null ? newTypeMap[subscription.name] : undefined, types: Object.keys(newTypeMap).map(function (typeName) { return newTypeMap[typeName]; }), directives: newDirectives })); | ||
return new graphql_1.GraphQLSchema(__assign(__assign({}, toConfig_1.schemaToConfig(schema)), { query: query != null ? newTypeMap[query.name] : undefined, mutation: mutation != null ? newTypeMap[mutation.name] : undefined, subscription: subscription != null ? newTypeMap[subscription.name] : undefined, types: Object.keys(newTypeMap).map(function (typeName) { return newTypeMap[typeName]; }), directives: newDirectives })); | ||
} | ||
exports.cloneSchema = cloneSchema; | ||
//# sourceMappingURL=clone.js.map |
@@ -14,6 +14,7 @@ var __assign = (this && this.__assign) || function () { | ||
var graphql_1 = require("graphql"); | ||
var toConfig_1 = require("./toConfig"); | ||
function appendFields(typeMap, typeName, fields) { | ||
var type = typeMap[typeName]; | ||
if (type != null) { | ||
var typeConfig = type.toConfig(); | ||
var typeConfig = toConfig_1.typeToConfig(type); | ||
var originalFields_1 = typeConfig.fields; | ||
@@ -40,3 +41,3 @@ var newFields_1 = {}; | ||
var type = typeMap[typeName]; | ||
var typeConfig = type.toConfig(); | ||
var typeConfig = toConfig_1.typeToConfig(type); | ||
var originalFields = typeConfig.fields; | ||
@@ -43,0 +44,0 @@ var newFields = {}; |
@@ -10,2 +10,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
var clone_1 = require("./clone"); | ||
var graphqlVersion_1 = require("./graphqlVersion"); | ||
var hasOwn = Object.prototype.hasOwnProperty; | ||
@@ -86,3 +87,3 @@ // Update any references to named schema types that disagree with the named | ||
healFields(type); | ||
if (graphql_1.versionInfo.major >= 15) { | ||
if (graphqlVersion_1.graphqlVersion() >= 15) { | ||
healInterfaces(type); | ||
@@ -171,3 +172,3 @@ } | ||
if (namedType instanceof graphql_1.GraphQLObjectType || | ||
(graphql_1.versionInfo.major >= 15 && namedType instanceof graphql_1.GraphQLInterfaceType)) { | ||
(graphqlVersion_1.graphqlVersion() >= 15 && namedType instanceof graphql_1.GraphQLInterfaceType)) { | ||
each_1.default(namedType.getInterfaces(), function (iface) { | ||
@@ -174,0 +175,0 @@ implementedInterfaces[iface.name] = true; |
@@ -15,1 +15,4 @@ export { cloneSchema, cloneDirective, cloneType } from './clone'; | ||
export { appendFields, removeFields } from './fields'; | ||
export { schemaToConfig, typeToConfig, objectTypeToConfig, interfaceTypeToConfig, unionTypeToConfig, enumTypeToConfig, scalarTypeToConfig, inputObjectTypeToConfig, directiveToConfig, } from './toConfig'; | ||
export { createNamedStub } from './stub'; | ||
export { graphqlVersion } from './graphqlVersion'; |
@@ -42,2 +42,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.removeFields = fields_1.removeFields; | ||
var toConfig_1 = require("./toConfig"); | ||
exports.schemaToConfig = toConfig_1.schemaToConfig; | ||
exports.typeToConfig = toConfig_1.typeToConfig; | ||
exports.objectTypeToConfig = toConfig_1.objectTypeToConfig; | ||
exports.interfaceTypeToConfig = toConfig_1.interfaceTypeToConfig; | ||
exports.unionTypeToConfig = toConfig_1.unionTypeToConfig; | ||
exports.enumTypeToConfig = toConfig_1.enumTypeToConfig; | ||
exports.scalarTypeToConfig = toConfig_1.scalarTypeToConfig; | ||
exports.inputObjectTypeToConfig = toConfig_1.inputObjectTypeToConfig; | ||
exports.directiveToConfig = toConfig_1.directiveToConfig; | ||
var stub_1 = require("./stub"); | ||
exports.createNamedStub = stub_1.createNamedStub; | ||
var graphqlVersion_1 = require("./graphqlVersion"); | ||
exports.graphqlVersion = graphqlVersion_1.graphqlVersion; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "graphql-tools-fork", | ||
"version": "8.6.1", | ||
"version": "8.6.2", | ||
"description": "Forked graphql-tools, still more useful tools to create and manipulate GraphQL schemas.", | ||
@@ -19,5 +19,5 @@ "main": "dist/index.js", | ||
"testonly": "mocha --reporter spec --full-trace ./dist/test/**.js --require source-map-support/register", | ||
"testonly:cover": "nyc npm run testonly", | ||
"testonly:watch": "mocha -w --reporter spec --full-trace ./dist/test/**.js --require source-map-support/register", | ||
"coverage": "istanbul cover _mocha -- --reporter dot --full-trace ./dist/test/**.js", | ||
"postcoverage": "remap-istanbul --input coverage/coverage.json --type lcovonly --output coverage/lcov.info", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"prepublishOnly": "npm run compile", | ||
@@ -57,9 +57,8 @@ "prettier": "prettier --trailing-comma all --single-quote --write src/**/*.ts", | ||
"node-fetch": "^2.6.0", | ||
"uuid": "^3.4.0" | ||
"uuid": "^7.0.1" | ||
}, | ||
"peerDependencies": { | ||
"graphql": "^14.2.0 || ^15.0.0-rc" | ||
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0-rc" | ||
}, | ||
"devDependencies": { | ||
"@types/apollo-upload-client": "^8.1.3", | ||
"@types/chai": "^4.2.9", | ||
@@ -72,12 +71,11 @@ "@types/dateformat": "^3.0.1", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.7.1", | ||
"@types/node-fetch": "^2.5.4", | ||
"@types/supertest": "^2.0.8", | ||
"@types/uuid": "^3.4.7", | ||
"@typescript-eslint/eslint-plugin": "^2.19.2", | ||
"@typescript-eslint/parser": "^2.19.2", | ||
"apollo-upload-client": "^12.1.0", | ||
"babel-eslint": "^10.0.3", | ||
"@types/node": "^13.7.6", | ||
"@types/node-fetch": "^2.5.5", | ||
"@types/uuid": "^7.0.0", | ||
"@typescript-eslint/eslint-plugin": "^2.21.0", | ||
"@typescript-eslint/parser": "^2.21.0", | ||
"babel-eslint": "^10.1.0", | ||
"body-parser": "^1.19.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.9", | ||
"dataloader": "^2.0.0", | ||
@@ -93,13 +91,12 @@ "dateformat": "^3.0.3", | ||
"graphql-type-json": "^0.3.1", | ||
"graphql-upload": "^9.0.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^7.0.1", | ||
"graphql-upload": "^10.0.0", | ||
"mocha": "^7.1.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.19.1", | ||
"remap-istanbul": "0.13.0", | ||
"rimraf": "^3.0.2", | ||
"source-map-support": "^0.5.16", | ||
"standard-version": "^7.1.0", | ||
"typescript": "3.7.5", | ||
"typescript": "^3.8.2", | ||
"zen-observable-ts": "^0.8.20" | ||
} | ||
} |
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
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
687834
35
299
8400
+ Addeduuid@7.0.3(transitive)
- Removeduuid@3.4.0(transitive)
Updateduuid@^7.0.1