graphql 14.0.2 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/error/GraphQLError.js +1 -1
- package/error/GraphQLError.js.flow +3 -3
- package/error/GraphQLError.mjs +1 -1
- package/error/formatError.js +1 -1
- package/error/formatError.mjs +1 -1
- package/error/index.mjs +1 -1
- package/error/locatedError.js +1 -1
- package/error/locatedError.mjs +1 -1
- package/error/printError.js +1 -1
- package/error/printError.mjs +1 -1
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.mjs +1 -1
- package/execution/execute.mjs +1 -1
- package/execution/index.mjs +1 -1
- package/execution/values.js +3 -3
- package/execution/values.js.flow +1 -1
- package/execution/values.mjs +2 -2
- package/graphql.js +1 -1
- package/graphql.mjs +1 -1
- package/index.js +12 -0
- package/index.js.flow +2 -0
- package/index.mjs +2 -2
- package/jsutils/dedent.js +1 -1
- package/jsutils/dedent.mjs +1 -1
- package/jsutils/defineToJSON.js +17 -6
- package/jsutils/defineToJSON.js.flow +14 -5
- package/jsutils/defineToJSON.mjs +14 -6
- package/jsutils/defineToStringTag.js +5 -5
- package/jsutils/defineToStringTag.js.flow +3 -3
- package/jsutils/defineToStringTag.mjs +4 -4
- package/jsutils/inspect.js +22 -11
- package/jsutils/inspect.js.flow +22 -2
- package/jsutils/inspect.mjs +21 -4
- package/jsutils/instanceOf.js +1 -1
- package/jsutils/instanceOf.mjs +1 -1
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.mjs +1 -1
- package/jsutils/isInvalid.js +1 -1
- package/jsutils/isInvalid.mjs +1 -1
- package/jsutils/isNullish.js +1 -1
- package/jsutils/isNullish.mjs +1 -1
- package/jsutils/isPromise.js +1 -1
- package/jsutils/isPromise.mjs +1 -1
- package/jsutils/keyMap.js +1 -1
- package/jsutils/keyMap.mjs +1 -1
- package/jsutils/keyValMap.js +1 -1
- package/jsutils/keyValMap.mjs +1 -1
- package/jsutils/mapValue.js +54 -0
- package/jsutils/mapValue.js.flow +27 -0
- package/jsutils/mapValue.mjs +44 -0
- package/jsutils/memoize3.js +1 -1
- package/jsutils/memoize3.mjs +1 -1
- package/jsutils/nodejsCustomInspectSymbol.js +18 -0
- package/jsutils/nodejsCustomInspectSymbol.js.flow +15 -0
- package/jsutils/nodejsCustomInspectSymbol.mjs +10 -0
- package/jsutils/orList.js +17 -4
- package/jsutils/orList.js.flow +13 -7
- package/jsutils/orList.mjs +14 -4
- package/jsutils/promiseForObject.js +1 -1
- package/jsutils/promiseForObject.mjs +1 -1
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/quotedOrList.js +1 -1
- package/jsutils/quotedOrList.mjs +1 -1
- package/jsutils/suggestionList.js +1 -1
- package/jsutils/suggestionList.mjs +1 -1
- package/language/blockStringValue.js +1 -1
- package/language/blockStringValue.mjs +1 -1
- package/language/directiveLocation.js +1 -1
- package/language/directiveLocation.mjs +1 -1
- package/language/index.mjs +1 -1
- package/language/kinds.js +1 -1
- package/language/kinds.mjs +1 -1
- package/language/lexer.js +28 -12
- package/language/lexer.js.flow +33 -19
- package/language/lexer.mjs +27 -12
- package/language/location.js +1 -1
- package/language/location.mjs +1 -1
- package/language/parser.js +31 -38
- package/language/parser.js.flow +32 -48
- package/language/parser.mjs +30 -38
- package/language/predicates.js +1 -1
- package/language/predicates.mjs +1 -1
- package/language/printer.js +13 -7
- package/language/printer.js.flow +19 -9
- package/language/printer.mjs +13 -7
- package/language/source.js +8 -7
- package/language/source.mjs +1 -9
- package/language/visitor.js +6 -5
- package/language/visitor.js.flow +2 -4
- package/language/visitor.mjs +6 -5
- package/package.json +5 -2
- package/polyfills/find.js +31 -0
- package/polyfills/find.js.flow +29 -0
- package/polyfills/find.mjs +23 -0
- package/{jsutils → polyfills}/isFinite.js +1 -1
- package/{jsutils → polyfills}/isFinite.js.flow +0 -0
- package/{jsutils → polyfills}/isFinite.mjs +1 -1
- package/{jsutils → polyfills}/isInteger.js +1 -1
- package/{jsutils → polyfills}/isInteger.js.flow +0 -0
- package/{jsutils → polyfills}/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +26 -0
- package/polyfills/objectEntries.js.flow +19 -0
- package/polyfills/objectEntries.mjs +18 -0
- package/{jsutils → polyfills}/objectValues.js +1 -1
- package/{jsutils → polyfills}/objectValues.js.flow +1 -1
- package/{jsutils → polyfills}/objectValues.mjs +1 -1
- package/subscription/asyncIteratorReject.mjs +1 -1
- package/subscription/index.mjs +1 -1
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +1 -1
- package/subscription/subscribe.mjs +1 -1
- package/type/definition.js +31 -130
- package/type/definition.js.flow +35 -47
- package/type/definition.mjs +30 -131
- package/type/directives.js +25 -29
- package/type/directives.js.flow +24 -20
- package/type/directives.mjs +22 -30
- package/type/index.js +12 -0
- package/type/index.js.flow +4 -0
- package/type/index.mjs +5 -3
- package/type/introspection.js +3 -3
- package/type/introspection.js.flow +1 -1
- package/type/introspection.mjs +2 -2
- package/type/scalars.js +45 -34
- package/type/scalars.js.flow +40 -26
- package/type/scalars.mjs +44 -26
- package/type/schema.js +82 -87
- package/type/schema.js.flow +17 -9
- package/type/schema.mjs +79 -86
- package/type/validate.js +168 -175
- package/type/validate.js.flow +8 -49
- package/type/validate.mjs +159 -175
- package/utilities/TypeInfo.js +10 -23
- package/utilities/TypeInfo.js.flow +1 -1
- package/utilities/TypeInfo.mjs +2 -24
- package/utilities/assertValidName.js +1 -1
- package/utilities/assertValidName.mjs +1 -1
- package/utilities/astFromValue.js +2 -2
- package/utilities/astFromValue.js.flow +1 -1
- package/utilities/astFromValue.mjs +2 -2
- package/utilities/buildASTSchema.js +53 -53
- package/utilities/buildASTSchema.js.flow +14 -30
- package/utilities/buildASTSchema.mjs +45 -55
- package/utilities/buildClientSchema.js +3 -3
- package/utilities/buildClientSchema.js.flow +6 -2
- package/utilities/buildClientSchema.mjs +3 -3
- package/utilities/coerceValue.js +38 -19
- package/utilities/coerceValue.js.flow +41 -47
- package/utilities/coerceValue.mjs +38 -20
- package/utilities/concatAST.js +1 -1
- package/utilities/concatAST.mjs +1 -1
- package/utilities/extendSchema.js +228 -312
- package/utilities/extendSchema.js.flow +27 -152
- package/utilities/extendSchema.mjs +229 -312
- package/utilities/findBreakingChanges.js +7 -5
- package/utilities/findBreakingChanges.js.flow +3 -2
- package/utilities/findBreakingChanges.mjs +6 -5
- package/utilities/findDeprecatedUsages.js +1 -1
- package/utilities/findDeprecatedUsages.mjs +1 -1
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.mjs +1 -1
- package/utilities/getOperationRootType.js +1 -1
- package/utilities/getOperationRootType.mjs +1 -1
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +1 -1
- package/utilities/introspectionFromSchema.mjs +1 -1
- package/utilities/introspectionQuery.js +1 -1
- package/utilities/introspectionQuery.mjs +1 -1
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.mjs +1 -1
- package/utilities/isValidLiteralValue.js +1 -1
- package/utilities/isValidLiteralValue.mjs +1 -1
- package/utilities/lexicographicSortSchema.js +2 -2
- package/utilities/lexicographicSortSchema.js.flow +1 -1
- package/utilities/lexicographicSortSchema.mjs +2 -2
- package/utilities/schemaPrinter.js +3 -3
- package/utilities/schemaPrinter.js.flow +1 -1
- package/utilities/schemaPrinter.mjs +2 -2
- package/utilities/separateOperations.js +1 -1
- package/utilities/separateOperations.mjs +1 -1
- package/utilities/typeComparators.js +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.js +1 -1
- package/utilities/typeFromAST.mjs +1 -1
- package/utilities/valueFromAST.js +3 -3
- package/utilities/valueFromAST.js.flow +1 -1
- package/utilities/valueFromAST.mjs +2 -2
- package/utilities/valueFromASTUntyped.js +1 -1
- package/utilities/valueFromASTUntyped.mjs +1 -1
- package/validation/ValidationContext.js +57 -82
- package/validation/ValidationContext.js.flow +52 -49
- package/validation/ValidationContext.mjs +52 -77
- package/validation/index.mjs +1 -1
- package/validation/rules/ExecutableDefinitions.js +1 -1
- package/validation/rules/ExecutableDefinitions.js.flow +1 -1
- package/validation/rules/ExecutableDefinitions.mjs +1 -1
- package/validation/rules/FieldsOnCorrectType.js +1 -1
- package/validation/rules/FieldsOnCorrectType.mjs +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.mjs +1 -1
- package/validation/rules/KnownArgumentNames.mjs +1 -1
- package/validation/rules/KnownDirectives.js +1 -1
- package/validation/rules/KnownDirectives.mjs +1 -1
- package/validation/rules/KnownFragmentNames.js +1 -1
- package/validation/rules/KnownFragmentNames.mjs +1 -1
- package/validation/rules/KnownTypeNames.js +59 -21
- package/validation/rules/KnownTypeNames.js.flow +54 -20
- package/validation/rules/KnownTypeNames.mjs +56 -21
- package/validation/rules/LoneAnonymousOperation.js +1 -1
- package/validation/rules/LoneAnonymousOperation.mjs +1 -1
- package/validation/rules/LoneSchemaDefinition.js +1 -1
- package/validation/rules/LoneSchemaDefinition.mjs +1 -1
- package/validation/rules/NoFragmentCycles.js +1 -1
- package/validation/rules/NoFragmentCycles.js.flow +2 -2
- package/validation/rules/NoFragmentCycles.mjs +1 -1
- package/validation/rules/NoUndefinedVariables.js +1 -1
- package/validation/rules/NoUndefinedVariables.mjs +1 -1
- package/validation/rules/NoUnusedFragments.js +1 -1
- package/validation/rules/NoUnusedFragments.js.flow +2 -2
- package/validation/rules/NoUnusedFragments.mjs +1 -1
- package/validation/rules/NoUnusedVariables.js +1 -1
- package/validation/rules/NoUnusedVariables.mjs +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.js +56 -32
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +3 -3
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +47 -32
- package/validation/rules/PossibleFragmentSpreads.js +1 -1
- package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
- package/validation/rules/PossibleTypeExtensions.js +158 -0
- package/validation/rules/PossibleTypeExtensions.js.flow +160 -0
- package/validation/rules/PossibleTypeExtensions.mjs +146 -0
- package/validation/rules/ProvidedRequiredArguments.mjs +1 -1
- package/validation/rules/ScalarLeafs.js +1 -1
- package/validation/rules/ScalarLeafs.mjs +1 -1
- package/validation/rules/SingleFieldSubscriptions.js +1 -1
- package/validation/rules/SingleFieldSubscriptions.mjs +1 -1
- package/validation/rules/UniqueArgumentNames.js +1 -1
- package/validation/rules/UniqueArgumentNames.mjs +1 -1
- package/validation/rules/UniqueDirectiveNames.js +55 -0
- package/validation/rules/UniqueDirectiveNames.js.flow +64 -0
- package/validation/rules/UniqueDirectiveNames.mjs +43 -0
- package/validation/rules/UniqueDirectivesPerLocation.js +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.mjs +1 -1
- package/validation/rules/UniqueEnumValueNames.js +94 -0
- package/validation/rules/UniqueEnumValueNames.js.flow +87 -0
- package/validation/rules/UniqueEnumValueNames.mjs +81 -0
- package/validation/rules/UniqueFieldDefinitionNames.js +105 -0
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +101 -0
- package/validation/rules/UniqueFieldDefinitionNames.mjs +92 -0
- package/validation/rules/UniqueFragmentNames.js +1 -1
- package/validation/rules/UniqueFragmentNames.mjs +1 -1
- package/validation/rules/UniqueInputFieldNames.js +1 -1
- package/validation/rules/UniqueInputFieldNames.mjs +1 -1
- package/validation/rules/UniqueOperationNames.js +1 -1
- package/validation/rules/UniqueOperationNames.mjs +1 -1
- package/validation/rules/UniqueOperationTypes.js +85 -0
- package/validation/rules/UniqueOperationTypes.js.flow +76 -0
- package/validation/rules/UniqueOperationTypes.mjs +73 -0
- package/validation/rules/UniqueTypeNames.js +62 -0
- package/validation/rules/UniqueTypeNames.js.flow +67 -0
- package/validation/rules/UniqueTypeNames.mjs +50 -0
- package/validation/rules/UniqueVariableNames.js +1 -1
- package/validation/rules/UniqueVariableNames.mjs +1 -1
- package/validation/rules/ValuesOfCorrectType.js +29 -13
- package/validation/rules/ValuesOfCorrectType.js.flow +4 -5
- package/validation/rules/ValuesOfCorrectType.mjs +28 -13
- package/validation/rules/VariablesAreInputTypes.js +1 -1
- package/validation/rules/VariablesAreInputTypes.mjs +1 -1
- package/validation/rules/VariablesInAllowedPosition.js +4 -4
- package/validation/rules/VariablesInAllowedPosition.mjs +4 -4
- package/validation/specifiedRules.js +14 -2
- package/validation/specifiedRules.js.flow +13 -0
- package/validation/specifiedRules.mjs +8 -2
- package/validation/validate.js +1 -1
- package/validation/validate.mjs +1 -1
- package/jsutils/find.js +0 -22
- package/jsutils/find.js.flow +0 -19
- package/jsutils/find.mjs +0 -15
|
@@ -5,20 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.extendSchema = extendSchema;
|
|
7
7
|
|
|
8
|
+
var _objectValues = _interopRequireDefault(require("../polyfills/objectValues"));
|
|
9
|
+
|
|
8
10
|
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _mapValue = _interopRequireDefault(require("../jsutils/mapValue"));
|
|
11
13
|
|
|
12
14
|
var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap"));
|
|
13
15
|
|
|
14
|
-
var _objectValues = _interopRequireDefault(require("../jsutils/objectValues"));
|
|
15
|
-
|
|
16
16
|
var _buildASTSchema = require("./buildASTSchema");
|
|
17
17
|
|
|
18
18
|
var _validate = require("../validation/validate");
|
|
19
19
|
|
|
20
|
-
var _GraphQLError = require("../error/GraphQLError");
|
|
21
|
-
|
|
22
20
|
var _schema = require("../type/schema");
|
|
23
21
|
|
|
24
22
|
var _introspection = require("../type/introspection");
|
|
@@ -58,7 +56,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
58
56
|
*
|
|
59
57
|
*/
|
|
60
58
|
function extendSchema(schema, documentAST, options) {
|
|
61
|
-
|
|
59
|
+
(0, _schema.assertSchema)(schema);
|
|
62
60
|
!(documentAST && documentAST.kind === _kinds.Kind.DOCUMENT) ? (0, _invariant.default)(0, 'Must provide valid Document AST') : void 0;
|
|
63
61
|
|
|
64
62
|
if (!options || !(options.assumeValid || options.assumeValidSDL)) {
|
|
@@ -74,64 +72,54 @@ function extendSchema(schema, documentAST, options) {
|
|
|
74
72
|
var schemaDef; // Schema extensions are collected which may add additional operation types.
|
|
75
73
|
|
|
76
74
|
var schemaExtensions = [];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
var _iteratorNormalCompletion = true;
|
|
76
|
+
var _didIteratorError = false;
|
|
77
|
+
var _iteratorError = undefined;
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
for (var _iterator = documentAST.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
81
|
+
var def = _step.value;
|
|
82
|
+
|
|
83
|
+
if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) {
|
|
84
|
+
schemaDef = def;
|
|
85
|
+
} else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) {
|
|
86
|
+
schemaExtensions.push(def);
|
|
87
|
+
} else if ((0, _predicates.isTypeDefinitionNode)(def)) {
|
|
88
|
+
var typeName = def.name.value;
|
|
89
|
+
typeDefinitionMap[typeName] = def;
|
|
90
|
+
} else if ((0, _predicates.isTypeExtensionNode)(def)) {
|
|
91
|
+
var extendedTypeName = def.name.value;
|
|
92
|
+
var existingTypeExtensions = typeExtensionsMap[extendedTypeName];
|
|
93
|
+
typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def];
|
|
94
|
+
} else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
|
|
95
|
+
directiveDefinitions.push(def);
|
|
92
96
|
}
|
|
97
|
+
} // If this document contains no new types, extensions, or directives then
|
|
98
|
+
// return the same unmodified GraphQLSchema instance.
|
|
93
99
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!existingType) {
|
|
102
|
-
throw new _GraphQLError.GraphQLError("Cannot extend type \"".concat(extendedTypeName, "\" because it does not ") + 'exist in the existing schema.', [def]);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
_didIteratorError = true;
|
|
102
|
+
_iteratorError = err;
|
|
103
|
+
} finally {
|
|
104
|
+
try {
|
|
105
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
106
|
+
_iterator.return();
|
|
103
107
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def];
|
|
108
|
-
} else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
|
|
109
|
-
var directiveName = def.name.value;
|
|
110
|
-
var existingDirective = schema.getDirective(directiveName);
|
|
111
|
-
|
|
112
|
-
if (existingDirective) {
|
|
113
|
-
throw new _GraphQLError.GraphQLError("Directive \"".concat(directiveName, "\" already exists in the schema. It ") + 'cannot be redefined.', [def]);
|
|
108
|
+
} finally {
|
|
109
|
+
if (_didIteratorError) {
|
|
110
|
+
throw _iteratorError;
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
directiveDefinitions.push(def);
|
|
117
112
|
}
|
|
118
|
-
}
|
|
119
|
-
// return the same unmodified GraphQLSchema instance.
|
|
120
|
-
|
|
113
|
+
}
|
|
121
114
|
|
|
122
115
|
if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0 && schemaExtensions.length === 0 && !schemaDef) {
|
|
123
116
|
return schema;
|
|
124
117
|
}
|
|
125
118
|
|
|
126
|
-
var astBuilder = new _buildASTSchema.ASTDefinitionBuilder(typeDefinitionMap, options, function (
|
|
127
|
-
var typeName = typeRef.name.value;
|
|
119
|
+
var astBuilder = new _buildASTSchema.ASTDefinitionBuilder(typeDefinitionMap, options, function (typeName) {
|
|
128
120
|
var existingType = schema.getType(typeName);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return extendNamedType(existingType);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
throw new _GraphQLError.GraphQLError("Unknown type: \"".concat(typeName, "\". Ensure that this type exists ") + 'either in the original schema, or is added in a type definition.', [typeRef]);
|
|
121
|
+
!existingType ? (0, _invariant.default)(0, "Unknown type: \"".concat(typeName, "\".")) : void 0;
|
|
122
|
+
return extendNamedType(existingType);
|
|
135
123
|
});
|
|
136
124
|
var extendTypeCache = Object.create(null); // Get the extended root operation types.
|
|
137
125
|
|
|
@@ -142,36 +130,31 @@ function extendSchema(schema, documentAST, options) {
|
|
|
142
130
|
};
|
|
143
131
|
|
|
144
132
|
if (schemaDef) {
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var
|
|
133
|
+
var _iteratorNormalCompletion2 = true;
|
|
134
|
+
var _didIteratorError2 = false;
|
|
135
|
+
var _iteratorError2 = undefined;
|
|
148
136
|
|
|
149
137
|
try {
|
|
150
|
-
for (var
|
|
151
|
-
var _ref2 =
|
|
152
|
-
var operation = _ref2.operation
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (operationTypes[operation]) {
|
|
156
|
-
throw new Error("Must provide only one ".concat(operation, " type in schema."));
|
|
157
|
-
} // Note: While this could make early assertions to get the correctly
|
|
138
|
+
for (var _iterator2 = schemaDef.operationTypes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
139
|
+
var _ref2 = _step2.value;
|
|
140
|
+
var operation = _ref2.operation;
|
|
141
|
+
var type = _ref2.type;
|
|
142
|
+
// Note: While this could make early assertions to get the correctly
|
|
158
143
|
// typed values, that would throw immediately while type system
|
|
159
144
|
// validation with validateSchema() will produce more actionable results.
|
|
160
|
-
|
|
161
|
-
|
|
162
145
|
operationTypes[operation] = astBuilder.buildType(type);
|
|
163
146
|
}
|
|
164
147
|
} catch (err) {
|
|
165
|
-
|
|
166
|
-
|
|
148
|
+
_didIteratorError2 = true;
|
|
149
|
+
_iteratorError2 = err;
|
|
167
150
|
} finally {
|
|
168
151
|
try {
|
|
169
|
-
if (!
|
|
170
|
-
|
|
152
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
153
|
+
_iterator2.return();
|
|
171
154
|
}
|
|
172
155
|
} finally {
|
|
173
|
-
if (
|
|
174
|
-
throw
|
|
156
|
+
if (_didIteratorError2) {
|
|
157
|
+
throw _iteratorError2;
|
|
175
158
|
}
|
|
176
159
|
}
|
|
177
160
|
}
|
|
@@ -182,36 +165,31 @@ function extendSchema(schema, documentAST, options) {
|
|
|
182
165
|
var schemaExtension = schemaExtensions[_i];
|
|
183
166
|
|
|
184
167
|
if (schemaExtension.operationTypes) {
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
-
var
|
|
168
|
+
var _iteratorNormalCompletion14 = true;
|
|
169
|
+
var _didIteratorError14 = false;
|
|
170
|
+
var _iteratorError14 = undefined;
|
|
188
171
|
|
|
189
172
|
try {
|
|
190
|
-
for (var
|
|
191
|
-
var _ref4 =
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (operationTypes[operation]) {
|
|
196
|
-
throw new Error("Must provide only one ".concat(operation, " type in schema."));
|
|
197
|
-
} // Note: While this could make early assertions to get the correctly
|
|
173
|
+
for (var _iterator14 = schemaExtension.operationTypes[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
174
|
+
var _ref4 = _step14.value;
|
|
175
|
+
var _operation = _ref4.operation;
|
|
176
|
+
var _type = _ref4.type;
|
|
177
|
+
// Note: While this could make early assertions to get the correctly
|
|
198
178
|
// typed values, that would throw immediately while type system
|
|
199
179
|
// validation with validateSchema() will produce more actionable results.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
operationTypes[operation] = astBuilder.buildType(type);
|
|
180
|
+
operationTypes[_operation] = astBuilder.buildType(_type);
|
|
203
181
|
}
|
|
204
182
|
} catch (err) {
|
|
205
|
-
|
|
206
|
-
|
|
183
|
+
_didIteratorError14 = true;
|
|
184
|
+
_iteratorError14 = err;
|
|
207
185
|
} finally {
|
|
208
186
|
try {
|
|
209
|
-
if (!
|
|
210
|
-
|
|
187
|
+
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
188
|
+
_iterator14.return();
|
|
211
189
|
}
|
|
212
190
|
} finally {
|
|
213
|
-
if (
|
|
214
|
-
throw
|
|
191
|
+
if (_didIteratorError14) {
|
|
192
|
+
throw _iteratorError14;
|
|
215
193
|
}
|
|
216
194
|
}
|
|
217
195
|
}
|
|
@@ -219,9 +197,9 @@ function extendSchema(schema, documentAST, options) {
|
|
|
219
197
|
}
|
|
220
198
|
|
|
221
199
|
var schemaExtensionASTNodes = schemaExtensions ? schema.extensionASTNodes ? schema.extensionASTNodes.concat(schemaExtensions) : schemaExtensions : schema.extensionASTNodes;
|
|
222
|
-
var types = (0, _objectValues.default)(schema.getTypeMap()).map(function (type) {
|
|
200
|
+
var types = [].concat((0, _objectValues.default)(schema.getTypeMap()).map(function (type) {
|
|
223
201
|
return extendNamedType(type);
|
|
224
|
-
})
|
|
202
|
+
}), (0, _objectValues.default)(typeDefinitionMap).map(function (type) {
|
|
225
203
|
return astBuilder.buildType(type);
|
|
226
204
|
})); // Support both original legacy names and extended legacy names.
|
|
227
205
|
|
|
@@ -301,74 +279,60 @@ function extendSchema(schema, documentAST, options) {
|
|
|
301
279
|
}
|
|
302
280
|
|
|
303
281
|
function extendInputFieldMap(type) {
|
|
304
|
-
var newFieldMap =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
var _fieldName = _arr[_i2];
|
|
311
|
-
var _field = oldFieldMap[_fieldName];
|
|
312
|
-
newFieldMap[_fieldName] = {
|
|
313
|
-
description: _field.description,
|
|
314
|
-
type: extendType(_field.type),
|
|
315
|
-
defaultValue: _field.defaultValue,
|
|
316
|
-
astNode: _field.astNode
|
|
282
|
+
var newFieldMap = (0, _mapValue.default)(type.getFields(), function (field) {
|
|
283
|
+
return {
|
|
284
|
+
description: field.description,
|
|
285
|
+
type: extendType(field.type),
|
|
286
|
+
defaultValue: field.defaultValue,
|
|
287
|
+
astNode: field.astNode
|
|
317
288
|
};
|
|
318
|
-
} // If there are any extensions to the fields, apply those here.
|
|
319
|
-
|
|
289
|
+
}); // If there are any extensions to the fields, apply those here.
|
|
320
290
|
|
|
321
291
|
var extensions = typeExtensionsMap[type.name];
|
|
322
292
|
|
|
323
293
|
if (extensions) {
|
|
324
|
-
var
|
|
325
|
-
var
|
|
326
|
-
var
|
|
294
|
+
var _iteratorNormalCompletion3 = true;
|
|
295
|
+
var _didIteratorError3 = false;
|
|
296
|
+
var _iteratorError3 = undefined;
|
|
327
297
|
|
|
328
298
|
try {
|
|
329
|
-
for (var
|
|
330
|
-
var extension =
|
|
331
|
-
var
|
|
332
|
-
var
|
|
333
|
-
var
|
|
299
|
+
for (var _iterator3 = extensions[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
300
|
+
var extension = _step3.value;
|
|
301
|
+
var _iteratorNormalCompletion4 = true;
|
|
302
|
+
var _didIteratorError4 = false;
|
|
303
|
+
var _iteratorError4 = undefined;
|
|
334
304
|
|
|
335
305
|
try {
|
|
336
|
-
for (var
|
|
337
|
-
var field =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (oldFieldMap[fieldName]) {
|
|
341
|
-
throw new _GraphQLError.GraphQLError("Field \"".concat(type.name, ".").concat(fieldName, "\" already exists in the ") + 'schema. It cannot also be defined in this type extension.', [field]);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
newFieldMap[fieldName] = astBuilder.buildInputField(field);
|
|
306
|
+
for (var _iterator4 = extension.fields[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
307
|
+
var field = _step4.value;
|
|
308
|
+
newFieldMap[field.name.value] = astBuilder.buildInputField(field);
|
|
345
309
|
}
|
|
346
310
|
} catch (err) {
|
|
347
|
-
|
|
348
|
-
|
|
311
|
+
_didIteratorError4 = true;
|
|
312
|
+
_iteratorError4 = err;
|
|
349
313
|
} finally {
|
|
350
314
|
try {
|
|
351
|
-
if (!
|
|
352
|
-
|
|
315
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
316
|
+
_iterator4.return();
|
|
353
317
|
}
|
|
354
318
|
} finally {
|
|
355
|
-
if (
|
|
356
|
-
throw
|
|
319
|
+
if (_didIteratorError4) {
|
|
320
|
+
throw _iteratorError4;
|
|
357
321
|
}
|
|
358
322
|
}
|
|
359
323
|
}
|
|
360
324
|
}
|
|
361
325
|
} catch (err) {
|
|
362
|
-
|
|
363
|
-
|
|
326
|
+
_didIteratorError3 = true;
|
|
327
|
+
_iteratorError3 = err;
|
|
364
328
|
} finally {
|
|
365
329
|
try {
|
|
366
|
-
if (!
|
|
367
|
-
|
|
330
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
331
|
+
_iterator3.return();
|
|
368
332
|
}
|
|
369
333
|
} finally {
|
|
370
|
-
if (
|
|
371
|
-
throw
|
|
334
|
+
if (_didIteratorError3) {
|
|
335
|
+
throw _iteratorError3;
|
|
372
336
|
}
|
|
373
337
|
}
|
|
374
338
|
}
|
|
@@ -391,76 +355,81 @@ function extendSchema(schema, documentAST, options) {
|
|
|
391
355
|
|
|
392
356
|
function extendValueMap(type) {
|
|
393
357
|
var newValueMap = Object.create(null);
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
358
|
+
var _iteratorNormalCompletion5 = true;
|
|
359
|
+
var _didIteratorError5 = false;
|
|
360
|
+
var _iteratorError5 = undefined;
|
|
397
361
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
astNode: _value.astNode
|
|
409
|
-
};
|
|
410
|
-
} // If there are any extensions to the values, apply those here.
|
|
362
|
+
try {
|
|
363
|
+
for (var _iterator5 = type.getValues()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
364
|
+
var _value = _step5.value;
|
|
365
|
+
newValueMap[_value.name] = {
|
|
366
|
+
description: _value.description,
|
|
367
|
+
value: _value.value,
|
|
368
|
+
deprecationReason: _value.deprecationReason,
|
|
369
|
+
astNode: _value.astNode
|
|
370
|
+
};
|
|
371
|
+
} // If there are any extensions to the values, apply those here.
|
|
411
372
|
|
|
373
|
+
} catch (err) {
|
|
374
|
+
_didIteratorError5 = true;
|
|
375
|
+
_iteratorError5 = err;
|
|
376
|
+
} finally {
|
|
377
|
+
try {
|
|
378
|
+
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
379
|
+
_iterator5.return();
|
|
380
|
+
}
|
|
381
|
+
} finally {
|
|
382
|
+
if (_didIteratorError5) {
|
|
383
|
+
throw _iteratorError5;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
412
387
|
|
|
413
388
|
var extensions = typeExtensionsMap[type.name];
|
|
414
389
|
|
|
415
390
|
if (extensions) {
|
|
416
|
-
var
|
|
417
|
-
var
|
|
418
|
-
var
|
|
391
|
+
var _iteratorNormalCompletion6 = true;
|
|
392
|
+
var _didIteratorError6 = false;
|
|
393
|
+
var _iteratorError6 = undefined;
|
|
419
394
|
|
|
420
395
|
try {
|
|
421
|
-
for (var
|
|
422
|
-
var extension =
|
|
423
|
-
var
|
|
424
|
-
var
|
|
425
|
-
var
|
|
396
|
+
for (var _iterator6 = extensions[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
397
|
+
var extension = _step6.value;
|
|
398
|
+
var _iteratorNormalCompletion7 = true;
|
|
399
|
+
var _didIteratorError7 = false;
|
|
400
|
+
var _iteratorError7 = undefined;
|
|
426
401
|
|
|
427
402
|
try {
|
|
428
|
-
for (var
|
|
429
|
-
var value =
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (oldValueMap[valueName]) {
|
|
433
|
-
throw new _GraphQLError.GraphQLError("Enum value \"".concat(type.name, ".").concat(valueName, "\" already exists in the ") + 'schema. It cannot also be defined in this type extension.', [value]);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
newValueMap[valueName] = astBuilder.buildEnumValue(value);
|
|
403
|
+
for (var _iterator7 = extension.values[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
|
404
|
+
var value = _step7.value;
|
|
405
|
+
newValueMap[value.name.value] = astBuilder.buildEnumValue(value);
|
|
437
406
|
}
|
|
438
407
|
} catch (err) {
|
|
439
|
-
|
|
440
|
-
|
|
408
|
+
_didIteratorError7 = true;
|
|
409
|
+
_iteratorError7 = err;
|
|
441
410
|
} finally {
|
|
442
411
|
try {
|
|
443
|
-
if (!
|
|
444
|
-
|
|
412
|
+
if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
|
|
413
|
+
_iterator7.return();
|
|
445
414
|
}
|
|
446
415
|
} finally {
|
|
447
|
-
if (
|
|
448
|
-
throw
|
|
416
|
+
if (_didIteratorError7) {
|
|
417
|
+
throw _iteratorError7;
|
|
449
418
|
}
|
|
450
419
|
}
|
|
451
420
|
}
|
|
452
421
|
}
|
|
453
422
|
} catch (err) {
|
|
454
|
-
|
|
455
|
-
|
|
423
|
+
_didIteratorError6 = true;
|
|
424
|
+
_iteratorError6 = err;
|
|
456
425
|
} finally {
|
|
457
426
|
try {
|
|
458
|
-
if (!
|
|
459
|
-
|
|
427
|
+
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
428
|
+
_iterator6.return();
|
|
460
429
|
}
|
|
461
430
|
} finally {
|
|
462
|
-
if (
|
|
463
|
-
throw
|
|
431
|
+
if (_didIteratorError6) {
|
|
432
|
+
throw _iteratorError6;
|
|
464
433
|
}
|
|
465
434
|
}
|
|
466
435
|
}
|
|
@@ -549,65 +518,6 @@ function extendSchema(schema, documentAST, options) {
|
|
|
549
518
|
|
|
550
519
|
var extensions = typeExtensionsMap[type.name];
|
|
551
520
|
|
|
552
|
-
if (extensions) {
|
|
553
|
-
var _iteratorNormalCompletion6 = true;
|
|
554
|
-
var _didIteratorError6 = false;
|
|
555
|
-
var _iteratorError6 = undefined;
|
|
556
|
-
|
|
557
|
-
try {
|
|
558
|
-
for (var _iterator6 = extensions[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
559
|
-
var extension = _step6.value;
|
|
560
|
-
var _iteratorNormalCompletion7 = true;
|
|
561
|
-
var _didIteratorError7 = false;
|
|
562
|
-
var _iteratorError7 = undefined;
|
|
563
|
-
|
|
564
|
-
try {
|
|
565
|
-
for (var _iterator7 = extension.types[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
|
566
|
-
var namedType = _step7.value;
|
|
567
|
-
// Note: While this could make early assertions to get the correctly
|
|
568
|
-
// typed values, that would throw immediately while type system
|
|
569
|
-
// validation with validateSchema() will produce more actionable results.
|
|
570
|
-
possibleTypes.push(astBuilder.buildType(namedType));
|
|
571
|
-
}
|
|
572
|
-
} catch (err) {
|
|
573
|
-
_didIteratorError7 = true;
|
|
574
|
-
_iteratorError7 = err;
|
|
575
|
-
} finally {
|
|
576
|
-
try {
|
|
577
|
-
if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
|
|
578
|
-
_iterator7.return();
|
|
579
|
-
}
|
|
580
|
-
} finally {
|
|
581
|
-
if (_didIteratorError7) {
|
|
582
|
-
throw _iteratorError7;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
} catch (err) {
|
|
588
|
-
_didIteratorError6 = true;
|
|
589
|
-
_iteratorError6 = err;
|
|
590
|
-
} finally {
|
|
591
|
-
try {
|
|
592
|
-
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
593
|
-
_iterator6.return();
|
|
594
|
-
}
|
|
595
|
-
} finally {
|
|
596
|
-
if (_didIteratorError6) {
|
|
597
|
-
throw _iteratorError6;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
return possibleTypes;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
function extendImplementedInterfaces(type) {
|
|
607
|
-
var interfaces = type.getInterfaces().map(extendNamedType); // If there are any extensions to the interfaces, apply those here.
|
|
608
|
-
|
|
609
|
-
var extensions = typeExtensionsMap[type.name];
|
|
610
|
-
|
|
611
521
|
if (extensions) {
|
|
612
522
|
var _iteratorNormalCompletion8 = true;
|
|
613
523
|
var _didIteratorError8 = false;
|
|
@@ -621,12 +531,12 @@ function extendSchema(schema, documentAST, options) {
|
|
|
621
531
|
var _iteratorError9 = undefined;
|
|
622
532
|
|
|
623
533
|
try {
|
|
624
|
-
for (var _iterator9 = extension.
|
|
534
|
+
for (var _iterator9 = extension.types[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
|
625
535
|
var namedType = _step9.value;
|
|
626
536
|
// Note: While this could make early assertions to get the correctly
|
|
627
537
|
// typed values, that would throw immediately while type system
|
|
628
538
|
// validation with validateSchema() will produce more actionable results.
|
|
629
|
-
|
|
539
|
+
possibleTypes.push(astBuilder.buildType(namedType));
|
|
630
540
|
}
|
|
631
541
|
} catch (err) {
|
|
632
542
|
_didIteratorError9 = true;
|
|
@@ -659,28 +569,11 @@ function extendSchema(schema, documentAST, options) {
|
|
|
659
569
|
}
|
|
660
570
|
}
|
|
661
571
|
|
|
662
|
-
return
|
|
572
|
+
return possibleTypes;
|
|
663
573
|
}
|
|
664
574
|
|
|
665
|
-
function
|
|
666
|
-
var
|
|
667
|
-
var oldFieldMap = type.getFields();
|
|
668
|
-
|
|
669
|
-
var _arr3 = Object.keys(oldFieldMap);
|
|
670
|
-
|
|
671
|
-
for (var _i4 = 0; _i4 < _arr3.length; _i4++) {
|
|
672
|
-
var _fieldName2 = _arr3[_i4];
|
|
673
|
-
var _field2 = oldFieldMap[_fieldName2];
|
|
674
|
-
newFieldMap[_fieldName2] = {
|
|
675
|
-
description: _field2.description,
|
|
676
|
-
deprecationReason: _field2.deprecationReason,
|
|
677
|
-
type: extendType(_field2.type),
|
|
678
|
-
args: extendArgs(_field2.args),
|
|
679
|
-
astNode: _field2.astNode,
|
|
680
|
-
resolve: _field2.resolve
|
|
681
|
-
};
|
|
682
|
-
} // If there are any extensions to the fields, apply those here.
|
|
683
|
-
|
|
575
|
+
function extendImplementedInterfaces(type) {
|
|
576
|
+
var interfaces = type.getInterfaces().map(extendNamedType); // If there are any extensions to the interfaces, apply those here.
|
|
684
577
|
|
|
685
578
|
var extensions = typeExtensionsMap[type.name];
|
|
686
579
|
|
|
@@ -697,15 +590,12 @@ function extendSchema(schema, documentAST, options) {
|
|
|
697
590
|
var _iteratorError11 = undefined;
|
|
698
591
|
|
|
699
592
|
try {
|
|
700
|
-
for (var _iterator11 = extension.
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
newFieldMap[fieldName] = astBuilder.buildField(field);
|
|
593
|
+
for (var _iterator11 = extension.interfaces[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
|
594
|
+
var namedType = _step11.value;
|
|
595
|
+
// Note: While this could make early assertions to get the correctly
|
|
596
|
+
// typed values, that would throw immediately while type system
|
|
597
|
+
// validation with validateSchema() will produce more actionable results.
|
|
598
|
+
interfaces.push(astBuilder.buildType(namedType));
|
|
709
599
|
}
|
|
710
600
|
} catch (err) {
|
|
711
601
|
_didIteratorError11 = true;
|
|
@@ -738,6 +628,71 @@ function extendSchema(schema, documentAST, options) {
|
|
|
738
628
|
}
|
|
739
629
|
}
|
|
740
630
|
|
|
631
|
+
return interfaces;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function extendFieldMap(type) {
|
|
635
|
+
var newFieldMap = (0, _mapValue.default)(type.getFields(), function (field) {
|
|
636
|
+
return {
|
|
637
|
+
description: field.description,
|
|
638
|
+
deprecationReason: field.deprecationReason,
|
|
639
|
+
type: extendType(field.type),
|
|
640
|
+
args: extendArgs(field.args),
|
|
641
|
+
astNode: field.astNode,
|
|
642
|
+
resolve: field.resolve
|
|
643
|
+
};
|
|
644
|
+
}); // If there are any extensions to the fields, apply those here.
|
|
645
|
+
|
|
646
|
+
var extensions = typeExtensionsMap[type.name];
|
|
647
|
+
|
|
648
|
+
if (extensions) {
|
|
649
|
+
var _iteratorNormalCompletion12 = true;
|
|
650
|
+
var _didIteratorError12 = false;
|
|
651
|
+
var _iteratorError12 = undefined;
|
|
652
|
+
|
|
653
|
+
try {
|
|
654
|
+
for (var _iterator12 = extensions[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
|
655
|
+
var extension = _step12.value;
|
|
656
|
+
var _iteratorNormalCompletion13 = true;
|
|
657
|
+
var _didIteratorError13 = false;
|
|
658
|
+
var _iteratorError13 = undefined;
|
|
659
|
+
|
|
660
|
+
try {
|
|
661
|
+
for (var _iterator13 = extension.fields[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
|
|
662
|
+
var field = _step13.value;
|
|
663
|
+
newFieldMap[field.name.value] = astBuilder.buildField(field);
|
|
664
|
+
}
|
|
665
|
+
} catch (err) {
|
|
666
|
+
_didIteratorError13 = true;
|
|
667
|
+
_iteratorError13 = err;
|
|
668
|
+
} finally {
|
|
669
|
+
try {
|
|
670
|
+
if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
|
|
671
|
+
_iterator13.return();
|
|
672
|
+
}
|
|
673
|
+
} finally {
|
|
674
|
+
if (_didIteratorError13) {
|
|
675
|
+
throw _iteratorError13;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
} catch (err) {
|
|
681
|
+
_didIteratorError12 = true;
|
|
682
|
+
_iteratorError12 = err;
|
|
683
|
+
} finally {
|
|
684
|
+
try {
|
|
685
|
+
if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
|
|
686
|
+
_iterator12.return();
|
|
687
|
+
}
|
|
688
|
+
} finally {
|
|
689
|
+
if (_didIteratorError12) {
|
|
690
|
+
throw _iteratorError12;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
741
696
|
return newFieldMap;
|
|
742
697
|
}
|
|
743
698
|
|
|
@@ -752,43 +707,4 @@ function extendSchema(schema, documentAST, options) {
|
|
|
752
707
|
|
|
753
708
|
return extendNamedType(typeDef);
|
|
754
709
|
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function checkExtensionNode(type, node) {
|
|
758
|
-
switch (node.kind) {
|
|
759
|
-
case _kinds.Kind.OBJECT_TYPE_EXTENSION:
|
|
760
|
-
if (!(0, _definition.isObjectType)(type)) {
|
|
761
|
-
throw new _GraphQLError.GraphQLError("Cannot extend non-object type \"".concat(type.name, "\"."), [node]);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
break;
|
|
765
|
-
|
|
766
|
-
case _kinds.Kind.INTERFACE_TYPE_EXTENSION:
|
|
767
|
-
if (!(0, _definition.isInterfaceType)(type)) {
|
|
768
|
-
throw new _GraphQLError.GraphQLError("Cannot extend non-interface type \"".concat(type.name, "\"."), [node]);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
break;
|
|
772
|
-
|
|
773
|
-
case _kinds.Kind.ENUM_TYPE_EXTENSION:
|
|
774
|
-
if (!(0, _definition.isEnumType)(type)) {
|
|
775
|
-
throw new _GraphQLError.GraphQLError("Cannot extend non-enum type \"".concat(type.name, "\"."), [node]);
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
break;
|
|
779
|
-
|
|
780
|
-
case _kinds.Kind.UNION_TYPE_EXTENSION:
|
|
781
|
-
if (!(0, _definition.isUnionType)(type)) {
|
|
782
|
-
throw new _GraphQLError.GraphQLError("Cannot extend non-union type \"".concat(type.name, "\"."), [node]);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
break;
|
|
786
|
-
|
|
787
|
-
case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION:
|
|
788
|
-
if (!(0, _definition.isInputObjectType)(type)) {
|
|
789
|
-
throw new _GraphQLError.GraphQLError("Cannot extend non-input object type \"".concat(type.name, "\"."), [node]);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
710
|
}
|