graphql 14.1.1 → 14.3.1
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/LICENSE +1 -1
- package/README.md +1 -1
- package/error/GraphQLError.js +12 -10
- package/error/GraphQLError.js.flow +11 -6
- package/error/GraphQLError.mjs +20 -3
- package/error/formatError.js +2 -2
- package/error/formatError.js.flow +3 -3
- package/error/formatError.mjs +2 -2
- package/error/index.js +1 -1
- package/error/index.js.flow +5 -2
- package/error/index.mjs +2 -2
- package/error/locatedError.js +2 -2
- package/error/locatedError.js.flow +2 -2
- package/error/locatedError.mjs +2 -2
- package/error/printError.js +2 -2
- package/error/printError.js.flow +4 -5
- package/error/printError.mjs +2 -2
- package/error/syntaxError.js +2 -2
- package/error/syntaxError.js.flow +2 -2
- package/error/syntaxError.mjs +2 -2
- package/execution/execute.js +52 -37
- package/execution/execute.js.flow +66 -51
- package/execution/execute.mjs +50 -38
- package/execution/index.js +7 -1
- package/execution/index.js.flow +9 -4
- package/execution/index.mjs +3 -3
- package/execution/values.js +11 -11
- package/execution/values.js.flow +23 -19
- package/execution/values.mjs +11 -11
- package/graphql.js +13 -9
- package/graphql.js.flow +28 -10
- package/graphql.mjs +10 -9
- package/index.js +83 -53
- package/index.js.flow +60 -47
- package/index.mjs +26 -23
- package/jsutils/ObjMap.js +1 -1
- package/jsutils/ObjMap.js.flow +1 -1
- package/jsutils/ObjMap.mjs +1 -0
- package/jsutils/PromiseOrValue.js +1 -0
- package/jsutils/{MaybePromise.js.flow → PromiseOrValue.js.flow} +2 -2
- package/jsutils/PromiseOrValue.mjs +1 -0
- package/jsutils/dedent.js +2 -2
- package/jsutils/dedent.js.flow +1 -1
- package/jsutils/dedent.mjs +2 -2
- package/jsutils/defineToJSON.js +2 -2
- package/jsutils/defineToJSON.js.flow +1 -1
- package/jsutils/defineToJSON.mjs +2 -2
- package/jsutils/defineToStringTag.js +2 -2
- package/jsutils/defineToStringTag.js.flow +1 -1
- package/jsutils/defineToStringTag.mjs +2 -2
- package/jsutils/inspect.js +94 -19
- package/jsutils/inspect.js.flow +98 -20
- package/jsutils/inspect.mjs +94 -20
- package/jsutils/instanceOf.js +2 -2
- package/jsutils/instanceOf.js.flow +1 -1
- package/jsutils/instanceOf.mjs +2 -2
- package/jsutils/invariant.js +5 -3
- package/jsutils/invariant.js.flow +3 -2
- package/jsutils/invariant.mjs +5 -3
- package/jsutils/isInvalid.js +2 -2
- package/jsutils/isInvalid.js.flow +1 -1
- package/jsutils/isInvalid.mjs +2 -2
- package/jsutils/isNullish.js +2 -2
- package/jsutils/isNullish.js.flow +1 -1
- package/jsutils/isNullish.mjs +2 -2
- package/jsutils/isPromise.js +2 -2
- package/jsutils/isPromise.js.flow +1 -1
- package/jsutils/isPromise.mjs +2 -2
- package/jsutils/keyMap.js +4 -3
- package/jsutils/keyMap.js.flow +6 -6
- package/jsutils/keyMap.mjs +4 -3
- package/jsutils/keyValMap.js +4 -3
- package/jsutils/keyValMap.js.flow +6 -6
- package/jsutils/keyValMap.mjs +4 -3
- package/jsutils/mapValue.js +2 -2
- package/jsutils/mapValue.js.flow +2 -2
- package/jsutils/mapValue.mjs +2 -2
- package/jsutils/memoize3.js +3 -3
- package/jsutils/memoize3.js.flow +2 -2
- package/jsutils/memoize3.mjs +3 -3
- package/jsutils/nodejsCustomInspectSymbol.js +2 -2
- package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
- package/jsutils/nodejsCustomInspectSymbol.mjs +2 -2
- package/jsutils/orList.js +2 -2
- package/jsutils/orList.js.flow +1 -1
- package/jsutils/orList.mjs +2 -2
- package/jsutils/promiseForObject.js +2 -2
- package/jsutils/promiseForObject.js.flow +2 -2
- package/jsutils/promiseForObject.mjs +2 -2
- package/jsutils/promiseReduce.js +2 -2
- package/jsutils/promiseReduce.js.flow +5 -5
- package/jsutils/promiseReduce.mjs +2 -2
- package/jsutils/quotedOrList.js +2 -2
- package/jsutils/quotedOrList.js.flow +1 -1
- package/jsutils/quotedOrList.mjs +2 -2
- package/jsutils/suggestionList.js +2 -2
- package/jsutils/suggestionList.js.flow +1 -1
- package/jsutils/suggestionList.mjs +2 -2
- package/language/ast.js +1 -1
- package/language/ast.js.flow +3 -3
- package/language/ast.mjs +1 -0
- package/language/blockString.js +114 -0
- package/language/blockString.js.flow +102 -0
- package/language/blockString.mjs +104 -0
- package/language/directiveLocation.js +2 -2
- package/language/directiveLocation.js.flow +1 -1
- package/language/directiveLocation.mjs +2 -2
- package/language/index.js +9 -9
- package/language/index.js.flow +10 -5
- package/language/index.mjs +3 -3
- package/language/kinds.js +2 -2
- package/language/kinds.js.flow +1 -1
- package/language/kinds.mjs +2 -2
- package/language/lexer.js +52 -44
- package/language/lexer.js.flow +65 -54
- package/language/lexer.mjs +49 -43
- package/language/location.js +2 -2
- package/language/location.js.flow +2 -2
- package/language/location.mjs +2 -2
- package/language/parser.js +75 -67
- package/language/parser.js.flow +138 -127
- package/language/parser.mjs +76 -68
- package/language/predicates.js +2 -2
- package/language/predicates.js.flow +2 -2
- package/language/predicates.mjs +2 -2
- package/language/printer.js +6 -14
- package/language/printer.js.flow +8 -17
- package/language/printer.mjs +5 -14
- package/language/source.js +2 -2
- package/language/source.js.flow +1 -1
- package/language/source.mjs +2 -2
- package/language/visitor.js +4 -6
- package/language/visitor.js.flow +3 -3
- package/language/visitor.mjs +4 -6
- package/package.json +1 -1
- package/polyfills/find.js +2 -2
- package/polyfills/find.js.flow +1 -1
- package/polyfills/find.mjs +2 -2
- package/polyfills/flatMap.js +38 -0
- package/polyfills/flatMap.js.flow +34 -0
- package/polyfills/flatMap.mjs +30 -0
- package/polyfills/isFinite.js +2 -2
- package/polyfills/isFinite.js.flow +1 -1
- package/polyfills/isFinite.mjs +2 -2
- package/polyfills/isInteger.js +2 -2
- package/polyfills/isInteger.js.flow +1 -1
- package/polyfills/isInteger.mjs +2 -2
- package/polyfills/objectEntries.js +2 -2
- package/polyfills/objectEntries.js.flow +2 -2
- package/polyfills/objectEntries.mjs +2 -2
- package/polyfills/objectValues.js +2 -2
- package/polyfills/objectValues.js.flow +2 -2
- package/polyfills/objectValues.mjs +2 -2
- package/subscription/asyncIteratorReject.js +1 -1
- package/subscription/asyncIteratorReject.js.flow +1 -1
- package/subscription/asyncIteratorReject.mjs +2 -2
- package/subscription/index.js +1 -1
- package/subscription/index.js.flow +1 -1
- package/subscription/index.mjs +2 -2
- package/subscription/mapAsyncIterator.js +1 -1
- package/subscription/mapAsyncIterator.js.flow +5 -5
- package/subscription/mapAsyncIterator.mjs +2 -2
- package/subscription/subscribe.js +2 -2
- package/subscription/subscribe.js.flow +6 -6
- package/subscription/subscribe.mjs +2 -2
- package/type/definition.js +138 -22
- package/type/definition.js.flow +184 -36
- package/type/definition.mjs +136 -23
- package/type/directives.js +14 -3
- package/type/directives.js.flow +24 -11
- package/type/directives.mjs +16 -5
- package/type/index.js +7 -7
- package/type/index.js.flow +8 -4
- package/type/index.mjs +10 -6
- package/type/introspection.js +14 -9
- package/type/introspection.js.flow +12 -18
- package/type/introspection.mjs +14 -9
- package/type/scalars.js +5 -4
- package/type/scalars.js.flow +4 -10
- package/type/scalars.mjs +7 -6
- package/type/schema.js +55 -3
- package/type/schema.js.flow +73 -17
- package/type/schema.mjs +56 -4
- package/type/validate.js +19 -47
- package/type/validate.js.flow +17 -29
- package/type/validate.mjs +18 -47
- package/utilities/TypeInfo.js +93 -73
- package/utilities/TypeInfo.js.flow +30 -23
- package/utilities/TypeInfo.mjs +93 -73
- package/utilities/assertValidName.js +2 -2
- package/utilities/assertValidName.js.flow +2 -2
- package/utilities/assertValidName.mjs +2 -2
- package/utilities/astFromValue.js +5 -4
- package/utilities/astFromValue.js.flow +8 -7
- package/utilities/astFromValue.mjs +7 -6
- package/utilities/buildASTSchema.js +63 -62
- package/utilities/buildASTSchema.js.flow +92 -108
- package/utilities/buildASTSchema.mjs +61 -62
- package/utilities/buildClientSchema.js +38 -45
- package/utilities/buildClientSchema.js.flow +66 -79
- package/utilities/buildClientSchema.mjs +37 -44
- package/utilities/coerceValue.js +6 -7
- package/utilities/coerceValue.js.flow +5 -4
- package/utilities/coerceValue.mjs +7 -8
- package/utilities/concatAST.js +9 -13
- package/utilities/concatAST.js.flow +4 -10
- package/utilities/concatAST.mjs +6 -13
- package/utilities/extendSchema.js +219 -511
- package/utilities/extendSchema.js.flow +195 -304
- package/utilities/extendSchema.mjs +218 -512
- package/utilities/findBreakingChanges.js +54 -95
- package/utilities/findBreakingChanges.js.flow +49 -47
- package/utilities/findBreakingChanges.mjs +80 -95
- package/utilities/findDeprecatedUsages.js +4 -4
- package/utilities/findDeprecatedUsages.js.flow +5 -5
- package/utilities/findDeprecatedUsages.mjs +4 -4
- package/utilities/getOperationAST.js +2 -2
- package/utilities/getOperationAST.js.flow +5 -2
- package/utilities/getOperationAST.mjs +2 -2
- package/utilities/getOperationRootType.js +24 -24
- package/utilities/getOperationRootType.js.flow +40 -35
- package/utilities/getOperationRootType.mjs +24 -24
- package/utilities/index.js +9 -1
- package/utilities/index.js.flow +13 -6
- package/utilities/index.mjs +13 -8
- package/utilities/introspectionFromSchema.js +6 -4
- package/utilities/introspectionFromSchema.js.flow +8 -7
- package/utilities/introspectionFromSchema.mjs +6 -5
- package/utilities/introspectionQuery.js +2 -2
- package/utilities/introspectionQuery.js.flow +2 -2
- package/utilities/introspectionQuery.mjs +2 -2
- package/utilities/isValidJSValue.js +4 -2
- package/utilities/isValidJSValue.js.flow +3 -2
- package/utilities/isValidJSValue.mjs +4 -2
- package/utilities/isValidLiteralValue.js +2 -2
- package/utilities/isValidLiteralValue.js.flow +4 -4
- package/utilities/isValidLiteralValue.mjs +2 -2
- package/utilities/lexicographicSortSchema.js +84 -123
- package/utilities/lexicographicSortSchema.js.flow +68 -96
- package/utilities/lexicographicSortSchema.mjs +84 -123
- package/utilities/schemaPrinter.js +47 -73
- package/utilities/schemaPrinter.js.flow +69 -120
- package/utilities/schemaPrinter.mjs +45 -72
- package/utilities/separateOperations.js +8 -12
- package/utilities/separateOperations.js.flow +6 -3
- package/utilities/separateOperations.mjs +8 -12
- package/utilities/stripIgnoredCharacters.js +140 -0
- package/utilities/stripIgnoredCharacters.js.flow +129 -0
- package/utilities/stripIgnoredCharacters.mjs +127 -0
- package/utilities/typeComparators.js +2 -2
- package/utilities/typeComparators.js.flow +4 -3
- package/utilities/typeComparators.mjs +2 -2
- package/utilities/typeFromAST.js +9 -4
- package/utilities/typeFromAST.js.flow +15 -9
- package/utilities/typeFromAST.mjs +6 -4
- package/utilities/valueFromAST.js +7 -4
- package/utilities/valueFromAST.js.flow +7 -5
- package/utilities/valueFromAST.mjs +6 -4
- package/utilities/valueFromASTUntyped.js +11 -6
- package/utilities/valueFromASTUntyped.js.flow +9 -5
- package/utilities/valueFromASTUntyped.mjs +10 -6
- package/validation/ValidationContext.js +1 -1
- package/validation/ValidationContext.js.flow +19 -20
- package/validation/ValidationContext.mjs +2 -2
- package/validation/index.js +1 -1
- package/validation/index.js.flow +2 -1
- package/validation/index.mjs +3 -2
- package/validation/rules/ExecutableDefinitions.js +3 -3
- package/validation/rules/ExecutableDefinitions.js.flow +4 -4
- package/validation/rules/ExecutableDefinitions.mjs +3 -3
- package/validation/rules/FieldsOnCorrectType.js +3 -3
- package/validation/rules/FieldsOnCorrectType.js.flow +7 -7
- package/validation/rules/FieldsOnCorrectType.mjs +3 -3
- package/validation/rules/FragmentsOnCompositeTypes.js +4 -4
- package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -5
- package/validation/rules/FragmentsOnCompositeTypes.mjs +4 -4
- package/validation/rules/KnownArgumentNames.js +1 -1
- package/validation/rules/KnownArgumentNames.js.flow +5 -5
- package/validation/rules/KnownArgumentNames.mjs +2 -2
- package/validation/rules/KnownDirectives.js +8 -6
- package/validation/rules/KnownDirectives.js.flow +11 -9
- package/validation/rules/KnownDirectives.mjs +8 -6
- package/validation/rules/KnownFragmentNames.js +3 -3
- package/validation/rules/KnownFragmentNames.js.flow +4 -4
- package/validation/rules/KnownFragmentNames.mjs +3 -3
- package/validation/rules/KnownTypeNames.js +2 -2
- package/validation/rules/KnownTypeNames.js.flow +6 -6
- package/validation/rules/KnownTypeNames.mjs +2 -2
- package/validation/rules/LoneAnonymousOperation.js +3 -3
- package/validation/rules/LoneAnonymousOperation.js.flow +4 -4
- package/validation/rules/LoneAnonymousOperation.mjs +3 -3
- package/validation/rules/LoneSchemaDefinition.js +2 -2
- package/validation/rules/LoneSchemaDefinition.js.flow +3 -3
- package/validation/rules/LoneSchemaDefinition.mjs +2 -2
- package/validation/rules/NoFragmentCycles.js +2 -2
- package/validation/rules/NoFragmentCycles.js.flow +4 -4
- package/validation/rules/NoFragmentCycles.mjs +2 -2
- package/validation/rules/NoUndefinedVariables.js +2 -2
- package/validation/rules/NoUndefinedVariables.js.flow +3 -3
- package/validation/rules/NoUndefinedVariables.mjs +2 -2
- package/validation/rules/NoUnusedFragments.js +7 -7
- package/validation/rules/NoUnusedFragments.js.flow +4 -4
- package/validation/rules/NoUnusedFragments.mjs +7 -7
- package/validation/rules/NoUnusedVariables.js +5 -5
- package/validation/rules/NoUnusedVariables.js.flow +6 -5
- package/validation/rules/NoUnusedVariables.mjs +5 -5
- package/validation/rules/OverlappingFieldsCanBeMerged.js +26 -23
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -17
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +26 -23
- package/validation/rules/PossibleFragmentSpreads.js +4 -4
- package/validation/rules/PossibleFragmentSpreads.js.flow +5 -5
- package/validation/rules/PossibleFragmentSpreads.mjs +4 -4
- package/validation/rules/PossibleTypeExtensions.js +3 -3
- package/validation/rules/PossibleTypeExtensions.js.flow +5 -5
- package/validation/rules/PossibleTypeExtensions.mjs +4 -4
- package/validation/rules/ProvidedRequiredArguments.js +6 -8
- package/validation/rules/ProvidedRequiredArguments.js.flow +8 -8
- package/validation/rules/ProvidedRequiredArguments.mjs +7 -9
- package/validation/rules/ScalarLeafs.js +4 -4
- package/validation/rules/ScalarLeafs.js.flow +6 -6
- package/validation/rules/ScalarLeafs.mjs +4 -4
- package/validation/rules/SingleFieldSubscriptions.js +2 -2
- package/validation/rules/SingleFieldSubscriptions.js.flow +4 -4
- package/validation/rules/SingleFieldSubscriptions.mjs +2 -2
- package/validation/rules/UniqueArgumentNames.js +2 -2
- package/validation/rules/UniqueArgumentNames.js.flow +3 -3
- package/validation/rules/UniqueArgumentNames.mjs +2 -2
- package/validation/rules/UniqueDirectiveNames.js +2 -2
- package/validation/rules/UniqueDirectiveNames.js.flow +3 -3
- package/validation/rules/UniqueDirectiveNames.mjs +2 -2
- package/validation/rules/UniqueDirectivesPerLocation.js +3 -2
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +4 -4
- package/validation/rules/UniqueDirectivesPerLocation.mjs +3 -2
- package/validation/rules/UniqueEnumValueNames.js +4 -8
- package/validation/rules/UniqueEnumValueNames.js.flow +6 -8
- package/validation/rules/UniqueEnumValueNames.mjs +4 -8
- package/validation/rules/UniqueFieldDefinitionNames.js +4 -8
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +6 -8
- package/validation/rules/UniqueFieldDefinitionNames.mjs +4 -8
- package/validation/rules/UniqueFragmentNames.js +2 -2
- package/validation/rules/UniqueFragmentNames.js.flow +3 -3
- package/validation/rules/UniqueFragmentNames.mjs +2 -2
- package/validation/rules/UniqueInputFieldNames.js +2 -4
- package/validation/rules/UniqueInputFieldNames.js.flow +3 -4
- package/validation/rules/UniqueInputFieldNames.mjs +2 -4
- package/validation/rules/UniqueOperationNames.js +2 -2
- package/validation/rules/UniqueOperationNames.js.flow +3 -3
- package/validation/rules/UniqueOperationNames.mjs +2 -2
- package/validation/rules/UniqueOperationTypes.js +2 -2
- package/validation/rules/UniqueOperationTypes.js.flow +3 -3
- package/validation/rules/UniqueOperationTypes.mjs +2 -2
- package/validation/rules/UniqueTypeNames.js +2 -2
- package/validation/rules/UniqueTypeNames.js.flow +4 -4
- package/validation/rules/UniqueTypeNames.mjs +2 -2
- package/validation/rules/UniqueVariableNames.js +2 -2
- package/validation/rules/UniqueVariableNames.js.flow +4 -4
- package/validation/rules/UniqueVariableNames.mjs +2 -2
- package/validation/rules/ValuesOfCorrectType.js +2 -2
- package/validation/rules/ValuesOfCorrectType.js.flow +5 -5
- package/validation/rules/ValuesOfCorrectType.mjs +2 -2
- package/validation/rules/VariablesAreInputTypes.js +3 -3
- package/validation/rules/VariablesAreInputTypes.js.flow +5 -5
- package/validation/rules/VariablesAreInputTypes.mjs +3 -3
- package/validation/rules/VariablesInAllowedPosition.js +3 -3
- package/validation/rules/VariablesInAllowedPosition.js.flow +7 -8
- package/validation/rules/VariablesInAllowedPosition.mjs +3 -3
- package/validation/specifiedRules.js +2 -2
- package/validation/specifiedRules.js.flow +13 -6
- package/validation/specifiedRules.mjs +7 -7
- package/validation/validate.js +2 -2
- package/validation/validate.js.flow +10 -6
- package/validation/validate.mjs +2 -2
- package/jsutils/MaybePromise.js +0 -1
- package/jsutils/MaybePromise.mjs +0 -0
- package/language/blockStringValue.js +0 -73
- package/language/blockStringValue.js.flow +0 -64
- package/language/blockStringValue.mjs +0 -66
|
@@ -5,26 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findBreakingChanges = findBreakingChanges;
|
|
7
7
|
exports.findDangerousChanges = findDangerousChanges;
|
|
8
|
-
exports.findRemovedTypes = findRemovedTypes;
|
|
9
|
-
exports.findTypesThatChangedKind = findTypesThatChangedKind;
|
|
10
|
-
exports.findArgChanges = findArgChanges;
|
|
11
|
-
exports.findFieldsThatChangedTypeOnObjectOrInterfaceTypes = findFieldsThatChangedTypeOnObjectOrInterfaceTypes;
|
|
12
|
-
exports.findFieldsThatChangedTypeOnInputObjectTypes = findFieldsThatChangedTypeOnInputObjectTypes;
|
|
13
|
-
exports.findTypesRemovedFromUnions = findTypesRemovedFromUnions;
|
|
14
|
-
exports.findTypesAddedToUnions = findTypesAddedToUnions;
|
|
15
|
-
exports.findValuesRemovedFromEnums = findValuesRemovedFromEnums;
|
|
16
|
-
exports.findValuesAddedToEnums = findValuesAddedToEnums;
|
|
17
|
-
exports.findInterfacesRemovedFromObjectTypes = findInterfacesRemovedFromObjectTypes;
|
|
18
|
-
exports.findInterfacesAddedToObjectTypes = findInterfacesAddedToObjectTypes;
|
|
19
|
-
exports.findRemovedDirectives = findRemovedDirectives;
|
|
20
|
-
exports.findRemovedDirectiveArgs = findRemovedDirectiveArgs;
|
|
21
|
-
exports.findAddedNonNullDirectiveArgs = findAddedNonNullDirectiveArgs;
|
|
22
|
-
exports.findRemovedLocationsForDirective = findRemovedLocationsForDirective;
|
|
23
|
-
exports.findRemovedDirectiveLocations = findRemovedDirectiveLocations;
|
|
24
8
|
exports.DangerousChangeType = exports.BreakingChangeType = void 0;
|
|
25
9
|
|
|
26
10
|
var _find = _interopRequireDefault(require("../polyfills/find"));
|
|
27
11
|
|
|
12
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
13
|
+
|
|
28
14
|
var _definition = require("../type/definition");
|
|
29
15
|
|
|
30
16
|
var _keyMap = _interopRequireDefault(require("../jsutils/keyMap"));
|
|
@@ -32,7 +18,7 @@ var _keyMap = _interopRequireDefault(require("../jsutils/keyMap"));
|
|
|
32
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
19
|
|
|
34
20
|
/**
|
|
35
|
-
* Copyright (c)
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
22
|
*
|
|
37
23
|
* This source code is licensed under the MIT license found in the
|
|
38
24
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -94,10 +80,8 @@ function findRemovedTypes(oldSchema, newSchema) {
|
|
|
94
80
|
var newTypeMap = newSchema.getTypeMap();
|
|
95
81
|
var breakingChanges = [];
|
|
96
82
|
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
for (var _i = 0; _i < _arr.length; _i++) {
|
|
100
|
-
var typeName = _arr[_i];
|
|
83
|
+
for (var _i = 0, _Object$keys = Object.keys(oldTypeMap); _i < _Object$keys.length; _i++) {
|
|
84
|
+
var typeName = _Object$keys[_i];
|
|
101
85
|
|
|
102
86
|
if (!newTypeMap[typeName]) {
|
|
103
87
|
breakingChanges.push({
|
|
@@ -120,10 +104,8 @@ function findTypesThatChangedKind(oldSchema, newSchema) {
|
|
|
120
104
|
var newTypeMap = newSchema.getTypeMap();
|
|
121
105
|
var breakingChanges = [];
|
|
122
106
|
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
|
|
126
|
-
var typeName = _arr2[_i2];
|
|
107
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(oldTypeMap); _i2 < _Object$keys2.length; _i2++) {
|
|
108
|
+
var typeName = _Object$keys2[_i2];
|
|
127
109
|
|
|
128
110
|
if (!newTypeMap[typeName]) {
|
|
129
111
|
continue;
|
|
@@ -156,10 +138,8 @@ function findArgChanges(oldSchema, newSchema) {
|
|
|
156
138
|
var breakingChanges = [];
|
|
157
139
|
var dangerousChanges = [];
|
|
158
140
|
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
|
|
162
|
-
var typeName = _arr3[_i3];
|
|
141
|
+
for (var _i3 = 0, _Object$keys3 = Object.keys(oldTypeMap); _i3 < _Object$keys3.length; _i3++) {
|
|
142
|
+
var typeName = _Object$keys3[_i3];
|
|
163
143
|
var oldType = oldTypeMap[typeName];
|
|
164
144
|
var newType = newTypeMap[typeName];
|
|
165
145
|
|
|
@@ -170,10 +150,8 @@ function findArgChanges(oldSchema, newSchema) {
|
|
|
170
150
|
var oldTypeFields = oldType.getFields();
|
|
171
151
|
var newTypeFields = newType.getFields();
|
|
172
152
|
|
|
173
|
-
var
|
|
174
|
-
|
|
175
|
-
for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
|
|
176
|
-
var fieldName = _arr4[_i4];
|
|
153
|
+
for (var _i4 = 0, _Object$keys4 = Object.keys(oldTypeFields); _i4 < _Object$keys4.length; _i4++) {
|
|
154
|
+
var fieldName = _Object$keys4[_i4];
|
|
177
155
|
|
|
178
156
|
if (!newTypeFields[fieldName]) {
|
|
179
157
|
continue;
|
|
@@ -310,9 +288,12 @@ function typeKindName(type) {
|
|
|
310
288
|
|
|
311
289
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
312
290
|
return 'an Input type';
|
|
313
|
-
}
|
|
291
|
+
} // Not reachable. All possible named types have been considered.
|
|
292
|
+
|
|
293
|
+
/* istanbul ignore next */
|
|
314
294
|
|
|
315
|
-
|
|
295
|
+
|
|
296
|
+
throw new TypeError("Unexpected type: ".concat((0, _inspect.default)(type), "."));
|
|
316
297
|
}
|
|
317
298
|
|
|
318
299
|
function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema) {
|
|
@@ -320,10 +301,8 @@ function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema)
|
|
|
320
301
|
var newTypeMap = newSchema.getTypeMap();
|
|
321
302
|
var breakingChanges = [];
|
|
322
303
|
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
|
|
326
|
-
var typeName = _arr5[_i5];
|
|
304
|
+
for (var _i5 = 0, _Object$keys5 = Object.keys(oldTypeMap); _i5 < _Object$keys5.length; _i5++) {
|
|
305
|
+
var typeName = _Object$keys5[_i5];
|
|
327
306
|
var oldType = oldTypeMap[typeName];
|
|
328
307
|
var newType = newTypeMap[typeName];
|
|
329
308
|
|
|
@@ -334,10 +313,8 @@ function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema)
|
|
|
334
313
|
var oldTypeFieldsDef = oldType.getFields();
|
|
335
314
|
var newTypeFieldsDef = newType.getFields();
|
|
336
315
|
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
|
|
340
|
-
var fieldName = _arr6[_i6];
|
|
316
|
+
for (var _i6 = 0, _Object$keys6 = Object.keys(oldTypeFieldsDef); _i6 < _Object$keys6.length; _i6++) {
|
|
317
|
+
var fieldName = _Object$keys6[_i6];
|
|
341
318
|
|
|
342
319
|
// Check if the field is missing on the type in the new schema.
|
|
343
320
|
if (!(fieldName in newTypeFieldsDef)) {
|
|
@@ -371,10 +348,8 @@ function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema) {
|
|
|
371
348
|
var breakingChanges = [];
|
|
372
349
|
var dangerousChanges = [];
|
|
373
350
|
|
|
374
|
-
var
|
|
375
|
-
|
|
376
|
-
for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
|
|
377
|
-
var typeName = _arr7[_i7];
|
|
351
|
+
for (var _i7 = 0, _Object$keys7 = Object.keys(oldTypeMap); _i7 < _Object$keys7.length; _i7++) {
|
|
352
|
+
var typeName = _Object$keys7[_i7];
|
|
378
353
|
var oldType = oldTypeMap[typeName];
|
|
379
354
|
var newType = newTypeMap[typeName];
|
|
380
355
|
|
|
@@ -385,10 +360,8 @@ function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema) {
|
|
|
385
360
|
var oldTypeFieldsDef = oldType.getFields();
|
|
386
361
|
var newTypeFieldsDef = newType.getFields();
|
|
387
362
|
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
for (var _i8 = 0; _i8 < _arr8.length; _i8++) {
|
|
391
|
-
var fieldName = _arr8[_i8];
|
|
363
|
+
for (var _i8 = 0, _Object$keys8 = Object.keys(oldTypeFieldsDef); _i8 < _Object$keys8.length; _i8++) {
|
|
364
|
+
var fieldName = _Object$keys8[_i8];
|
|
392
365
|
|
|
393
366
|
// Check if the field is missing on the type in the new schema.
|
|
394
367
|
if (!(fieldName in newTypeFieldsDef)) {
|
|
@@ -413,10 +386,8 @@ function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema) {
|
|
|
413
386
|
} // Check if a field was added to the input object type
|
|
414
387
|
|
|
415
388
|
|
|
416
|
-
var
|
|
417
|
-
|
|
418
|
-
for (var _i9 = 0; _i9 < _arr9.length; _i9++) {
|
|
419
|
-
var _fieldName = _arr9[_i9];
|
|
389
|
+
for (var _i9 = 0, _Object$keys9 = Object.keys(newTypeFieldsDef); _i9 < _Object$keys9.length; _i9++) {
|
|
390
|
+
var _fieldName = _Object$keys9[_i9];
|
|
420
391
|
|
|
421
392
|
if (!(_fieldName in oldTypeFieldsDef)) {
|
|
422
393
|
if ((0, _definition.isRequiredInputField)(newTypeFieldsDef[_fieldName])) {
|
|
@@ -441,40 +412,40 @@ function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema) {
|
|
|
441
412
|
}
|
|
442
413
|
|
|
443
414
|
function isChangeSafeForObjectOrInterfaceField(oldType, newType) {
|
|
444
|
-
if ((0, _definition.
|
|
445
|
-
return (// if they're both named types, see if their names are equivalent
|
|
446
|
-
(0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe
|
|
447
|
-
(0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
|
|
448
|
-
);
|
|
449
|
-
} else if ((0, _definition.isListType)(oldType)) {
|
|
415
|
+
if ((0, _definition.isListType)(oldType)) {
|
|
450
416
|
return (// if they're both lists, make sure the underlying types are compatible
|
|
451
417
|
(0, _definition.isListType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) || // moving from nullable to non-null of the same underlying type is safe
|
|
452
418
|
(0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
|
|
453
419
|
);
|
|
454
|
-
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if ((0, _definition.isNonNullType)(oldType)) {
|
|
455
423
|
// if they're both non-null, make sure the underlying types are compatible
|
|
456
424
|
return (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType);
|
|
457
425
|
}
|
|
458
426
|
|
|
459
|
-
return
|
|
427
|
+
return (// if they're both named types, see if their names are equivalent
|
|
428
|
+
(0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe
|
|
429
|
+
(0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
|
|
430
|
+
);
|
|
460
431
|
}
|
|
461
432
|
|
|
462
433
|
function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) {
|
|
463
|
-
if ((0, _definition.
|
|
464
|
-
// if they're both named types, see if their names are equivalent
|
|
465
|
-
return (0, _definition.isNamedType)(newType) && oldType.name === newType.name;
|
|
466
|
-
} else if ((0, _definition.isListType)(oldType)) {
|
|
434
|
+
if ((0, _definition.isListType)(oldType)) {
|
|
467
435
|
// if they're both lists, make sure the underlying types are compatible
|
|
468
436
|
return (0, _definition.isListType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType);
|
|
469
|
-
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if ((0, _definition.isNonNullType)(oldType)) {
|
|
470
440
|
return (// if they're both non-null, make sure the underlying types are
|
|
471
441
|
// compatible
|
|
472
442
|
(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) || // moving from non-null to nullable of the same underlying type is safe
|
|
473
443
|
!(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)
|
|
474
444
|
);
|
|
475
|
-
}
|
|
445
|
+
} // if they're both named types, see if their names are equivalent
|
|
446
|
+
|
|
476
447
|
|
|
477
|
-
return
|
|
448
|
+
return (0, _definition.isNamedType)(newType) && oldType.name === newType.name;
|
|
478
449
|
}
|
|
479
450
|
/**
|
|
480
451
|
* Given two schemas, returns an Array containing descriptions of any breaking
|
|
@@ -487,10 +458,8 @@ function findTypesRemovedFromUnions(oldSchema, newSchema) {
|
|
|
487
458
|
var newTypeMap = newSchema.getTypeMap();
|
|
488
459
|
var typesRemovedFromUnion = [];
|
|
489
460
|
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
|
|
493
|
-
var typeName = _arr10[_i10];
|
|
461
|
+
for (var _i10 = 0, _Object$keys10 = Object.keys(oldTypeMap); _i10 < _Object$keys10.length; _i10++) {
|
|
462
|
+
var typeName = _Object$keys10[_i10];
|
|
494
463
|
var oldType = oldTypeMap[typeName];
|
|
495
464
|
var newType = newTypeMap[typeName];
|
|
496
465
|
|
|
@@ -567,10 +536,8 @@ function findTypesAddedToUnions(oldSchema, newSchema) {
|
|
|
567
536
|
var newTypeMap = newSchema.getTypeMap();
|
|
568
537
|
var typesAddedToUnion = [];
|
|
569
538
|
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
|
|
573
|
-
var typeName = _arr11[_i11];
|
|
539
|
+
for (var _i11 = 0, _Object$keys11 = Object.keys(newTypeMap); _i11 < _Object$keys11.length; _i11++) {
|
|
540
|
+
var typeName = _Object$keys11[_i11];
|
|
574
541
|
var oldType = oldTypeMap[typeName];
|
|
575
542
|
var newType = newTypeMap[typeName];
|
|
576
543
|
|
|
@@ -647,10 +614,8 @@ function findValuesRemovedFromEnums(oldSchema, newSchema) {
|
|
|
647
614
|
var newTypeMap = newSchema.getTypeMap();
|
|
648
615
|
var valuesRemovedFromEnums = [];
|
|
649
616
|
|
|
650
|
-
var
|
|
651
|
-
|
|
652
|
-
for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
|
|
653
|
-
var typeName = _arr12[_i12];
|
|
617
|
+
for (var _i12 = 0, _Object$keys12 = Object.keys(oldTypeMap); _i12 < _Object$keys12.length; _i12++) {
|
|
618
|
+
var typeName = _Object$keys12[_i12];
|
|
654
619
|
var oldType = oldTypeMap[typeName];
|
|
655
620
|
var newType = newTypeMap[typeName];
|
|
656
621
|
|
|
@@ -727,10 +692,8 @@ function findValuesAddedToEnums(oldSchema, newSchema) {
|
|
|
727
692
|
var newTypeMap = newSchema.getTypeMap();
|
|
728
693
|
var valuesAddedToEnums = [];
|
|
729
694
|
|
|
730
|
-
var
|
|
731
|
-
|
|
732
|
-
for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
|
|
733
|
-
var typeName = _arr13[_i13];
|
|
695
|
+
for (var _i13 = 0, _Object$keys13 = Object.keys(oldTypeMap); _i13 < _Object$keys13.length; _i13++) {
|
|
696
|
+
var typeName = _Object$keys13[_i13];
|
|
734
697
|
var oldType = oldTypeMap[typeName];
|
|
735
698
|
var newType = newTypeMap[typeName];
|
|
736
699
|
|
|
@@ -802,10 +765,8 @@ function findInterfacesRemovedFromObjectTypes(oldSchema, newSchema) {
|
|
|
802
765
|
var newTypeMap = newSchema.getTypeMap();
|
|
803
766
|
var breakingChanges = [];
|
|
804
767
|
|
|
805
|
-
var
|
|
806
|
-
|
|
807
|
-
for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
|
|
808
|
-
var typeName = _arr14[_i14];
|
|
768
|
+
for (var _i14 = 0, _Object$keys14 = Object.keys(oldTypeMap); _i14 < _Object$keys14.length; _i14++) {
|
|
769
|
+
var typeName = _Object$keys14[_i14];
|
|
809
770
|
var oldType = oldTypeMap[typeName];
|
|
810
771
|
var newType = newTypeMap[typeName];
|
|
811
772
|
|
|
@@ -860,10 +821,8 @@ function findInterfacesAddedToObjectTypes(oldSchema, newSchema) {
|
|
|
860
821
|
var newTypeMap = newSchema.getTypeMap();
|
|
861
822
|
var interfacesAddedToObjectTypes = [];
|
|
862
823
|
|
|
863
|
-
var
|
|
864
|
-
|
|
865
|
-
for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
|
|
866
|
-
var typeName = _arr15[_i15];
|
|
824
|
+
for (var _i15 = 0, _Object$keys15 = Object.keys(newTypeMap); _i15 < _Object$keys15.length; _i15++) {
|
|
825
|
+
var typeName = _Object$keys15[_i15];
|
|
867
826
|
var oldType = oldTypeMap[typeName];
|
|
868
827
|
var newType = newTypeMap[typeName];
|
|
869
828
|
|
|
@@ -1244,4 +1203,4 @@ function getArgumentMapForDirective(directive) {
|
|
|
1244
1203
|
return (0, _keyMap.default)(directive.args, function (arg) {
|
|
1245
1204
|
return arg.name;
|
|
1246
1205
|
});
|
|
1247
|
-
}
|
|
1206
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import find from '../polyfills/find';
|
|
11
|
+
import inspect from '../jsutils/inspect';
|
|
11
12
|
import {
|
|
13
|
+
type GraphQLNamedType,
|
|
14
|
+
type GraphQLFieldMap,
|
|
15
|
+
type GraphQLType,
|
|
16
|
+
type GraphQLArgument,
|
|
12
17
|
isScalarType,
|
|
13
18
|
isObjectType,
|
|
14
19
|
isInterfaceType,
|
|
@@ -21,20 +26,12 @@ import {
|
|
|
21
26
|
isRequiredArgument,
|
|
22
27
|
isRequiredInputField,
|
|
23
28
|
} from '../type/definition';
|
|
24
|
-
|
|
25
|
-
import type
|
|
26
|
-
GraphQLNamedType,
|
|
27
|
-
GraphQLFieldMap,
|
|
28
|
-
GraphQLType,
|
|
29
|
-
GraphQLArgument,
|
|
30
|
-
} from '../type/definition';
|
|
31
|
-
|
|
32
|
-
import type { GraphQLDirective } from '../type/directives';
|
|
33
|
-
import type { GraphQLSchema } from '../type/schema';
|
|
29
|
+
import { type GraphQLDirective } from '../type/directives';
|
|
30
|
+
import { type GraphQLSchema } from '../type/schema';
|
|
34
31
|
import keyMap from '../jsutils/keyMap';
|
|
35
32
|
|
|
36
|
-
import type
|
|
37
|
-
import type
|
|
33
|
+
import { type ObjMap } from '../jsutils/ObjMap';
|
|
34
|
+
import { type DirectiveLocationEnum } from '../language/directiveLocation';
|
|
38
35
|
|
|
39
36
|
export const BreakingChangeType = {
|
|
40
37
|
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND',
|
|
@@ -120,7 +117,7 @@ export function findDangerousChanges(
|
|
|
120
117
|
* Given two schemas, returns an Array containing descriptions of any breaking
|
|
121
118
|
* changes in the newSchema related to removing an entire type.
|
|
122
119
|
*/
|
|
123
|
-
|
|
120
|
+
function findRemovedTypes(
|
|
124
121
|
oldSchema: GraphQLSchema,
|
|
125
122
|
newSchema: GraphQLSchema,
|
|
126
123
|
): Array<BreakingChange> {
|
|
@@ -143,7 +140,7 @@ export function findRemovedTypes(
|
|
|
143
140
|
* Given two schemas, returns an Array containing descriptions of any breaking
|
|
144
141
|
* changes in the newSchema related to changing the type of a type.
|
|
145
142
|
*/
|
|
146
|
-
|
|
143
|
+
function findTypesThatChangedKind(
|
|
147
144
|
oldSchema: GraphQLSchema,
|
|
148
145
|
newSchema: GraphQLSchema,
|
|
149
146
|
): Array<BreakingChange> {
|
|
@@ -175,7 +172,7 @@ export function findTypesThatChangedKind(
|
|
|
175
172
|
* (such as removal or change of type of an argument, or a change in an
|
|
176
173
|
* argument's default value).
|
|
177
174
|
*/
|
|
178
|
-
|
|
175
|
+
function findArgChanges(
|
|
179
176
|
oldSchema: GraphQLSchema,
|
|
180
177
|
newSchema: GraphQLSchema,
|
|
181
178
|
): {
|
|
@@ -296,10 +293,13 @@ function typeKindName(type: GraphQLNamedType): string {
|
|
|
296
293
|
if (isInputObjectType(type)) {
|
|
297
294
|
return 'an Input type';
|
|
298
295
|
}
|
|
299
|
-
|
|
296
|
+
|
|
297
|
+
// Not reachable. All possible named types have been considered.
|
|
298
|
+
/* istanbul ignore next */
|
|
299
|
+
throw new TypeError(`Unexpected type: ${inspect((type: empty))}.`);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(
|
|
303
303
|
oldSchema: GraphQLSchema,
|
|
304
304
|
newSchema: GraphQLSchema,
|
|
305
305
|
): Array<BreakingChange> {
|
|
@@ -354,7 +354,7 @@ export function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(
|
|
|
354
354
|
return breakingChanges;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
|
|
357
|
+
function findFieldsThatChangedTypeOnInputObjectTypes(
|
|
358
358
|
oldSchema: GraphQLSchema,
|
|
359
359
|
newSchema: GraphQLSchema,
|
|
360
360
|
): {
|
|
@@ -437,15 +437,7 @@ function isChangeSafeForObjectOrInterfaceField(
|
|
|
437
437
|
oldType: GraphQLType,
|
|
438
438
|
newType: GraphQLType,
|
|
439
439
|
): boolean {
|
|
440
|
-
if (
|
|
441
|
-
return (
|
|
442
|
-
// if they're both named types, see if their names are equivalent
|
|
443
|
-
(isNamedType(newType) && oldType.name === newType.name) ||
|
|
444
|
-
// moving from nullable to non-null of the same underlying type is safe
|
|
445
|
-
(isNonNullType(newType) &&
|
|
446
|
-
isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))
|
|
447
|
-
);
|
|
448
|
-
} else if (isListType(oldType)) {
|
|
440
|
+
if (isListType(oldType)) {
|
|
449
441
|
return (
|
|
450
442
|
// if they're both lists, make sure the underlying types are compatible
|
|
451
443
|
(isListType(newType) &&
|
|
@@ -457,30 +449,38 @@ function isChangeSafeForObjectOrInterfaceField(
|
|
|
457
449
|
(isNonNullType(newType) &&
|
|
458
450
|
isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))
|
|
459
451
|
);
|
|
460
|
-
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (isNonNullType(oldType)) {
|
|
461
455
|
// if they're both non-null, make sure the underlying types are compatible
|
|
462
456
|
return (
|
|
463
457
|
isNonNullType(newType) &&
|
|
464
458
|
isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)
|
|
465
459
|
);
|
|
466
460
|
}
|
|
467
|
-
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
// if they're both named types, see if their names are equivalent
|
|
464
|
+
(isNamedType(newType) && oldType.name === newType.name) ||
|
|
465
|
+
// moving from nullable to non-null of the same underlying type is safe
|
|
466
|
+
(isNonNullType(newType) &&
|
|
467
|
+
isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))
|
|
468
|
+
);
|
|
468
469
|
}
|
|
469
470
|
|
|
470
471
|
function isChangeSafeForInputObjectFieldOrFieldArg(
|
|
471
472
|
oldType: GraphQLType,
|
|
472
473
|
newType: GraphQLType,
|
|
473
474
|
): boolean {
|
|
474
|
-
if (
|
|
475
|
-
// if they're both named types, see if their names are equivalent
|
|
476
|
-
return isNamedType(newType) && oldType.name === newType.name;
|
|
477
|
-
} else if (isListType(oldType)) {
|
|
475
|
+
if (isListType(oldType)) {
|
|
478
476
|
// if they're both lists, make sure the underlying types are compatible
|
|
479
477
|
return (
|
|
480
478
|
isListType(newType) &&
|
|
481
479
|
isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)
|
|
482
480
|
);
|
|
483
|
-
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (isNonNullType(oldType)) {
|
|
484
484
|
return (
|
|
485
485
|
// if they're both non-null, make sure the underlying types are
|
|
486
486
|
// compatible
|
|
@@ -494,14 +494,16 @@ function isChangeSafeForInputObjectFieldOrFieldArg(
|
|
|
494
494
|
isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))
|
|
495
495
|
);
|
|
496
496
|
}
|
|
497
|
-
|
|
497
|
+
|
|
498
|
+
// if they're both named types, see if their names are equivalent
|
|
499
|
+
return isNamedType(newType) && oldType.name === newType.name;
|
|
498
500
|
}
|
|
499
501
|
|
|
500
502
|
/**
|
|
501
503
|
* Given two schemas, returns an Array containing descriptions of any breaking
|
|
502
504
|
* changes in the newSchema related to removing types from a union type.
|
|
503
505
|
*/
|
|
504
|
-
|
|
506
|
+
function findTypesRemovedFromUnions(
|
|
505
507
|
oldSchema: GraphQLSchema,
|
|
506
508
|
newSchema: GraphQLSchema,
|
|
507
509
|
): Array<BreakingChange> {
|
|
@@ -535,7 +537,7 @@ export function findTypesRemovedFromUnions(
|
|
|
535
537
|
* Given two schemas, returns an Array containing descriptions of any dangerous
|
|
536
538
|
* changes in the newSchema related to adding types to a union type.
|
|
537
539
|
*/
|
|
538
|
-
|
|
540
|
+
function findTypesAddedToUnions(
|
|
539
541
|
oldSchema: GraphQLSchema,
|
|
540
542
|
newSchema: GraphQLSchema,
|
|
541
543
|
): Array<DangerousChange> {
|
|
@@ -568,7 +570,7 @@ export function findTypesAddedToUnions(
|
|
|
568
570
|
* Given two schemas, returns an Array containing descriptions of any breaking
|
|
569
571
|
* changes in the newSchema related to removing values from an enum type.
|
|
570
572
|
*/
|
|
571
|
-
|
|
573
|
+
function findValuesRemovedFromEnums(
|
|
572
574
|
oldSchema: GraphQLSchema,
|
|
573
575
|
newSchema: GraphQLSchema,
|
|
574
576
|
): Array<BreakingChange> {
|
|
@@ -602,7 +604,7 @@ export function findValuesRemovedFromEnums(
|
|
|
602
604
|
* Given two schemas, returns an Array containing descriptions of any dangerous
|
|
603
605
|
* changes in the newSchema related to adding values to an enum type.
|
|
604
606
|
*/
|
|
605
|
-
|
|
607
|
+
function findValuesAddedToEnums(
|
|
606
608
|
oldSchema: GraphQLSchema,
|
|
607
609
|
newSchema: GraphQLSchema,
|
|
608
610
|
): Array<DangerousChange> {
|
|
@@ -633,7 +635,7 @@ export function findValuesAddedToEnums(
|
|
|
633
635
|
return valuesAddedToEnums;
|
|
634
636
|
}
|
|
635
637
|
|
|
636
|
-
|
|
638
|
+
function findInterfacesRemovedFromObjectTypes(
|
|
637
639
|
oldSchema: GraphQLSchema,
|
|
638
640
|
newSchema: GraphQLSchema,
|
|
639
641
|
): Array<BreakingChange> {
|
|
@@ -664,7 +666,7 @@ export function findInterfacesRemovedFromObjectTypes(
|
|
|
664
666
|
return breakingChanges;
|
|
665
667
|
}
|
|
666
668
|
|
|
667
|
-
|
|
669
|
+
function findInterfacesAddedToObjectTypes(
|
|
668
670
|
oldSchema: GraphQLSchema,
|
|
669
671
|
newSchema: GraphQLSchema,
|
|
670
672
|
): Array<DangerousChange> {
|
|
@@ -695,7 +697,7 @@ export function findInterfacesAddedToObjectTypes(
|
|
|
695
697
|
return interfacesAddedToObjectTypes;
|
|
696
698
|
}
|
|
697
699
|
|
|
698
|
-
|
|
700
|
+
function findRemovedDirectives(
|
|
699
701
|
oldSchema: GraphQLSchema,
|
|
700
702
|
newSchema: GraphQLSchema,
|
|
701
703
|
): Array<BreakingChange> {
|
|
@@ -730,7 +732,7 @@ function findRemovedArgsForDirective(
|
|
|
730
732
|
return removedArgs;
|
|
731
733
|
}
|
|
732
734
|
|
|
733
|
-
|
|
735
|
+
function findRemovedDirectiveArgs(
|
|
734
736
|
oldSchema: GraphQLSchema,
|
|
735
737
|
newSchema: GraphQLSchema,
|
|
736
738
|
): Array<BreakingChange> {
|
|
@@ -770,7 +772,7 @@ function findAddedArgsForDirective(
|
|
|
770
772
|
return addedArgs;
|
|
771
773
|
}
|
|
772
774
|
|
|
773
|
-
|
|
775
|
+
function findAddedNonNullDirectiveArgs(
|
|
774
776
|
oldSchema: GraphQLSchema,
|
|
775
777
|
newSchema: GraphQLSchema,
|
|
776
778
|
): Array<BreakingChange> {
|
|
@@ -798,7 +800,7 @@ export function findAddedNonNullDirectiveArgs(
|
|
|
798
800
|
return addedNonNullableArgs;
|
|
799
801
|
}
|
|
800
802
|
|
|
801
|
-
|
|
803
|
+
function findRemovedLocationsForDirective(
|
|
802
804
|
oldDirective: GraphQLDirective,
|
|
803
805
|
newDirective: GraphQLDirective,
|
|
804
806
|
): Array<DirectiveLocationEnum> {
|
|
@@ -814,7 +816,7 @@ export function findRemovedLocationsForDirective(
|
|
|
814
816
|
return removedLocations;
|
|
815
817
|
}
|
|
816
818
|
|
|
817
|
-
|
|
819
|
+
function findRemovedDirectiveLocations(
|
|
818
820
|
oldSchema: GraphQLSchema,
|
|
819
821
|
newSchema: GraphQLSchema,
|
|
820
822
|
): Array<BreakingChange> {
|