graphql 14.3.0 → 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/error/GraphQLError.js +12 -10
- package/error/GraphQLError.js.flow +7 -1
- package/error/GraphQLError.mjs +12 -2
- package/error/formatError.js +1 -1
- package/error/formatError.mjs +1 -1
- package/error/index.js +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.js +32 -26
- package/execution/execute.js.flow +6 -3
- package/execution/execute.mjs +32 -26
- package/execution/index.js +1 -1
- package/execution/index.mjs +1 -1
- package/execution/values.js +4 -4
- package/execution/values.js.flow +4 -3
- package/execution/values.mjs +4 -4
- package/graphql.js +6 -2
- package/graphql.js.flow +2 -1
- package/graphql.mjs +3 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/jsutils/ObjMap.js +1 -1
- package/jsutils/ObjMap.mjs +1 -0
- package/jsutils/PromiseOrValue.js +1 -1
- package/jsutils/PromiseOrValue.mjs +1 -0
- package/jsutils/dedent.js +1 -1
- package/jsutils/dedent.mjs +1 -1
- package/jsutils/defineToJSON.js +1 -1
- package/jsutils/defineToJSON.mjs +1 -1
- package/jsutils/defineToStringTag.js +1 -1
- package/jsutils/defineToStringTag.mjs +1 -1
- package/jsutils/inspect.js +2 -2
- package/jsutils/inspect.js.flow +1 -1
- package/jsutils/inspect.mjs +2 -2
- package/jsutils/instanceOf.js +1 -1
- package/jsutils/instanceOf.mjs +1 -1
- package/jsutils/invariant.js +4 -2
- package/jsutils/invariant.js.flow +2 -1
- package/jsutils/invariant.mjs +4 -2
- 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 +3 -2
- package/jsutils/keyMap.js.flow +4 -4
- package/jsutils/keyMap.mjs +3 -2
- package/jsutils/keyValMap.js +3 -2
- package/jsutils/keyValMap.js.flow +4 -4
- package/jsutils/keyValMap.mjs +3 -2
- package/jsutils/mapValue.js +1 -1
- package/jsutils/mapValue.mjs +1 -1
- package/jsutils/memoize3.js +2 -2
- package/jsutils/memoize3.js.flow +1 -1
- package/jsutils/memoize3.mjs +2 -2
- package/jsutils/nodejsCustomInspectSymbol.js +1 -1
- package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
- package/jsutils/orList.js +1 -1
- package/jsutils/orList.mjs +1 -1
- 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/ast.js +1 -1
- package/language/ast.mjs +1 -0
- package/language/blockString.js +1 -1
- package/language/blockString.js.flow +1 -1
- package/language/blockString.mjs +1 -1
- package/language/directiveLocation.js +1 -1
- package/language/directiveLocation.mjs +1 -1
- package/language/index.js +1 -1
- package/language/index.mjs +1 -1
- package/language/kinds.js +1 -1
- package/language/kinds.mjs +1 -1
- package/language/lexer.js +11 -9
- package/language/lexer.js.flow +3 -1
- package/language/lexer.mjs +11 -9
- package/language/location.js +1 -1
- package/language/location.mjs +1 -1
- package/language/parser.js +2 -2
- package/language/parser.js.flow +1 -1
- package/language/parser.mjs +2 -2
- package/language/predicates.js +1 -1
- package/language/predicates.mjs +1 -1
- package/language/printer.js +1 -1
- package/language/printer.mjs +1 -1
- package/language/source.js +1 -1
- package/language/source.mjs +1 -1
- package/language/visitor.js +1 -1
- package/language/visitor.mjs +1 -1
- package/package.json +1 -1
- package/polyfills/find.js +1 -1
- package/polyfills/find.mjs +1 -1
- package/polyfills/flatMap.js +1 -1
- package/polyfills/flatMap.mjs +1 -1
- package/polyfills/isFinite.js +1 -1
- package/polyfills/isFinite.mjs +1 -1
- package/polyfills/isInteger.js +1 -1
- package/polyfills/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +1 -1
- package/polyfills/objectEntries.mjs +1 -1
- package/polyfills/objectValues.js +1 -1
- package/polyfills/objectValues.mjs +1 -1
- package/subscription/asyncIteratorReject.js +1 -1
- package/subscription/asyncIteratorReject.mjs +1 -1
- package/subscription/index.js +1 -1
- package/subscription/index.mjs +1 -1
- package/subscription/mapAsyncIterator.js +1 -1
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +1 -1
- package/subscription/subscribe.mjs +1 -1
- package/type/definition.js +8 -14
- package/type/definition.js.flow +4 -4
- package/type/definition.mjs +8 -14
- package/type/directives.js +1 -1
- package/type/directives.mjs +1 -1
- package/type/index.js +1 -1
- package/type/index.mjs +1 -1
- package/type/introspection.js +1 -1
- package/type/introspection.mjs +1 -1
- package/type/scalars.js +1 -1
- package/type/scalars.mjs +1 -1
- package/type/schema.js +3 -2
- package/type/schema.js.flow +4 -4
- package/type/schema.mjs +3 -2
- package/type/validate.js +1 -1
- package/type/validate.mjs +1 -1
- package/utilities/TypeInfo.js +92 -72
- package/utilities/TypeInfo.js.flow +18 -9
- package/utilities/TypeInfo.mjs +92 -72
- package/utilities/assertValidName.js +1 -1
- package/utilities/assertValidName.mjs +1 -1
- package/utilities/astFromValue.js +1 -1
- package/utilities/astFromValue.mjs +1 -1
- package/utilities/buildASTSchema.js +3 -1
- package/utilities/buildASTSchema.mjs +3 -1
- package/utilities/buildClientSchema.js +5 -2
- package/utilities/buildClientSchema.js.flow +3 -1
- package/utilities/buildClientSchema.mjs +5 -2
- package/utilities/coerceValue.js +1 -1
- package/utilities/coerceValue.mjs +1 -1
- package/utilities/concatAST.js +1 -1
- package/utilities/concatAST.mjs +1 -1
- package/utilities/extendSchema.js +1 -1
- package/utilities/extendSchema.mjs +1 -1
- package/utilities/findBreakingChanges.js +23 -34
- package/utilities/findBreakingChanges.js.flow +40 -34
- package/utilities/findBreakingChanges.mjs +49 -34
- 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 +23 -23
- package/utilities/getOperationRootType.js.flow +33 -30
- package/utilities/getOperationRootType.mjs +23 -23
- package/utilities/index.js +1 -1
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +4 -2
- package/utilities/introspectionFromSchema.js.flow +2 -1
- package/utilities/introspectionFromSchema.mjs +3 -2
- 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 +1 -1
- package/utilities/lexicographicSortSchema.mjs +1 -1
- package/utilities/schemaPrinter.js +1 -1
- package/utilities/schemaPrinter.mjs +1 -1
- package/utilities/separateOperations.js +1 -1
- package/utilities/separateOperations.mjs +1 -1
- package/utilities/stripIgnoredCharacters.js +7 -7
- package/utilities/stripIgnoredCharacters.js.flow +6 -6
- package/utilities/stripIgnoredCharacters.mjs +7 -7
- 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 +1 -1
- package/utilities/valueFromAST.mjs +1 -1
- package/utilities/valueFromASTUntyped.js +5 -3
- package/utilities/valueFromASTUntyped.js.flow +2 -1
- package/utilities/valueFromASTUntyped.mjs +5 -3
- package/validation/ValidationContext.js +1 -1
- package/validation/ValidationContext.mjs +1 -1
- package/validation/index.js +1 -1
- package/validation/index.mjs +1 -1
- package/validation/rules/ExecutableDefinitions.js +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.js +1 -1
- package/validation/rules/KnownArgumentNames.mjs +1 -1
- package/validation/rules/KnownDirectives.js +5 -3
- package/validation/rules/KnownDirectives.js.flow +2 -1
- package/validation/rules/KnownDirectives.mjs +5 -3
- package/validation/rules/KnownFragmentNames.js +1 -1
- package/validation/rules/KnownFragmentNames.mjs +1 -1
- package/validation/rules/KnownTypeNames.js +1 -1
- package/validation/rules/KnownTypeNames.mjs +1 -1
- 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.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.mjs +1 -1
- package/validation/rules/NoUnusedVariables.js +1 -1
- package/validation/rules/NoUnusedVariables.mjs +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.js +21 -16
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +4 -2
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +21 -16
- package/validation/rules/PossibleFragmentSpreads.js +1 -1
- package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
- package/validation/rules/PossibleTypeExtensions.js +1 -1
- package/validation/rules/PossibleTypeExtensions.mjs +1 -1
- package/validation/rules/ProvidedRequiredArguments.js +1 -1
- 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 +1 -1
- package/validation/rules/UniqueDirectiveNames.mjs +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.js +2 -1
- package/validation/rules/UniqueDirectivesPerLocation.mjs +2 -1
- package/validation/rules/UniqueEnumValueNames.js +1 -1
- package/validation/rules/UniqueEnumValueNames.mjs +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.mjs +1 -1
- 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 +1 -1
- package/validation/rules/UniqueOperationTypes.mjs +1 -1
- package/validation/rules/UniqueTypeNames.js +1 -1
- package/validation/rules/UniqueTypeNames.mjs +1 -1
- package/validation/rules/UniqueVariableNames.js +1 -1
- package/validation/rules/UniqueVariableNames.mjs +1 -1
- package/validation/rules/ValuesOfCorrectType.js +1 -1
- package/validation/rules/ValuesOfCorrectType.mjs +1 -1
- package/validation/rules/VariablesAreInputTypes.js +1 -1
- package/validation/rules/VariablesAreInputTypes.mjs +1 -1
- package/validation/rules/VariablesInAllowedPosition.js +2 -2
- package/validation/rules/VariablesInAllowedPosition.js.flow +1 -1
- package/validation/rules/VariablesInAllowedPosition.mjs +2 -2
- package/validation/specifiedRules.js +1 -1
- package/validation/specifiedRules.mjs +1 -1
- package/validation/validate.js +1 -1
- package/validation/validate.mjs +1 -1
- package/codecov.yml +0 -14
package/subscription/index.js
CHANGED
package/subscription/index.mjs
CHANGED
package/type/definition.js
CHANGED
|
@@ -564,7 +564,7 @@ function defineFieldMap(config) {
|
|
|
564
564
|
!isPlainObj(fieldMap) ? (0, _invariant.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a ") + 'function which returns such an object.') : void 0;
|
|
565
565
|
return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) {
|
|
566
566
|
!isPlainObj(fieldConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object")) : void 0;
|
|
567
|
-
!!
|
|
567
|
+
!!('isDeprecated' in fieldConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" ") + 'instead of "isDeprecated".') : void 0;
|
|
568
568
|
!(fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function') ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat((0, _inspect.default)(fieldConfig.resolve), ".")) : void 0;
|
|
569
569
|
var argsConfig = fieldConfig.args || {};
|
|
570
570
|
!isPlainObj(argsConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument ") + 'names as keys.') : void 0;
|
|
@@ -789,9 +789,7 @@ var GraphQLEnumType
|
|
|
789
789
|
=
|
|
790
790
|
/*#__PURE__*/
|
|
791
791
|
function () {
|
|
792
|
-
function GraphQLEnumType(config
|
|
793
|
-
/* <T> */
|
|
794
|
-
) {
|
|
792
|
+
function GraphQLEnumType(config) {
|
|
795
793
|
this.name = config.name;
|
|
796
794
|
this.description = config.description;
|
|
797
795
|
this.astNode = config.astNode;
|
|
@@ -816,9 +814,7 @@ function () {
|
|
|
816
814
|
return this._nameLookup[name];
|
|
817
815
|
};
|
|
818
816
|
|
|
819
|
-
_proto5.serialize = function serialize(value
|
|
820
|
-
/* T */
|
|
821
|
-
) {
|
|
817
|
+
_proto5.serialize = function serialize(value) {
|
|
822
818
|
var enumValue = this._valueLookup.get(value);
|
|
823
819
|
|
|
824
820
|
if (enumValue) {
|
|
@@ -883,22 +879,20 @@ exports.GraphQLEnumType = GraphQLEnumType;
|
|
|
883
879
|
(0, _defineToStringTag.default)(GraphQLEnumType);
|
|
884
880
|
(0, _defineToJSON.default)(GraphQLEnumType);
|
|
885
881
|
|
|
886
|
-
function defineEnumValues(type, valueMap
|
|
887
|
-
/* <T> */
|
|
888
|
-
) {
|
|
882
|
+
function defineEnumValues(type, valueMap) {
|
|
889
883
|
!isPlainObj(valueMap) ? (0, _invariant.default)(0, "".concat(type.name, " values must be an object with value names as keys.")) : void 0;
|
|
890
884
|
return (0, _objectEntries.default)(valueMap).map(function (_ref2) {
|
|
891
885
|
var valueName = _ref2[0],
|
|
892
886
|
value = _ref2[1];
|
|
893
887
|
!isPlainObj(value) ? (0, _invariant.default)(0, "".concat(type.name, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat((0, _inspect.default)(value), ".")) : void 0;
|
|
894
|
-
!!
|
|
888
|
+
!!('isDeprecated' in value) ? (0, _invariant.default)(0, "".concat(type.name, ".").concat(valueName, " should provide \"deprecationReason\" instead ") + 'of "isDeprecated".') : void 0;
|
|
895
889
|
return {
|
|
896
890
|
name: valueName,
|
|
897
891
|
description: value.description,
|
|
898
892
|
isDeprecated: Boolean(value.deprecationReason),
|
|
899
893
|
deprecationReason: value.deprecationReason,
|
|
900
894
|
astNode: value.astNode,
|
|
901
|
-
value:
|
|
895
|
+
value: 'value' in value ? value.value : valueName
|
|
902
896
|
};
|
|
903
897
|
});
|
|
904
898
|
}
|
|
@@ -979,7 +973,7 @@ function defineInputFieldMap(config) {
|
|
|
979
973
|
var fieldMap = resolveThunk(config.fields) || {};
|
|
980
974
|
!isPlainObj(fieldMap) ? (0, _invariant.default)(0, "".concat(config.name, " fields must be an object with field names as keys or a ") + 'function which returns such an object.') : void 0;
|
|
981
975
|
return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) {
|
|
982
|
-
!!
|
|
976
|
+
!!('resolve' in fieldConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but ") + 'Input Types cannot define resolvers.') : void 0;
|
|
983
977
|
return _objectSpread({}, fieldConfig, {
|
|
984
978
|
name: fieldName
|
|
985
979
|
});
|
|
@@ -988,4 +982,4 @@ function defineInputFieldMap(config) {
|
|
|
988
982
|
|
|
989
983
|
function isRequiredInputField(field) {
|
|
990
984
|
return isNonNullType(field.type) && field.defaultValue === undefined;
|
|
991
|
-
}
|
|
985
|
+
}
|
package/type/definition.js.flow
CHANGED
|
@@ -759,7 +759,7 @@ function defineFieldMap<TSource, TContext>(
|
|
|
759
759
|
`${config.name}.${fieldName} field config must be an object`,
|
|
760
760
|
);
|
|
761
761
|
invariant(
|
|
762
|
-
!
|
|
762
|
+
!('isDeprecated' in fieldConfig),
|
|
763
763
|
`${config.name}.${fieldName} should provide "deprecationReason" ` +
|
|
764
764
|
'instead of "isDeprecated".',
|
|
765
765
|
);
|
|
@@ -1253,7 +1253,7 @@ function defineEnumValues(
|
|
|
1253
1253
|
`representing an internal value but got: ${inspect(value)}.`,
|
|
1254
1254
|
);
|
|
1255
1255
|
invariant(
|
|
1256
|
-
!
|
|
1256
|
+
!('isDeprecated' in value),
|
|
1257
1257
|
`${type.name}.${valueName} should provide "deprecationReason" instead ` +
|
|
1258
1258
|
'of "isDeprecated".',
|
|
1259
1259
|
);
|
|
@@ -1263,7 +1263,7 @@ function defineEnumValues(
|
|
|
1263
1263
|
isDeprecated: Boolean(value.deprecationReason),
|
|
1264
1264
|
deprecationReason: value.deprecationReason,
|
|
1265
1265
|
astNode: value.astNode,
|
|
1266
|
-
value:
|
|
1266
|
+
value: 'value' in value ? value.value : valueName,
|
|
1267
1267
|
};
|
|
1268
1268
|
});
|
|
1269
1269
|
}
|
|
@@ -1379,7 +1379,7 @@ function defineInputFieldMap(
|
|
|
1379
1379
|
);
|
|
1380
1380
|
return mapValue(fieldMap, (fieldConfig, fieldName) => {
|
|
1381
1381
|
invariant(
|
|
1382
|
-
!
|
|
1382
|
+
!('resolve' in fieldConfig),
|
|
1383
1383
|
`${config.name}.${fieldName} field has a resolve property, but ` +
|
|
1384
1384
|
'Input Types cannot define resolvers.',
|
|
1385
1385
|
);
|
package/type/definition.mjs
CHANGED
|
@@ -469,7 +469,7 @@ function defineFieldMap(config) {
|
|
|
469
469
|
!isPlainObj(fieldMap) ? invariant(0, "".concat(config.name, " fields must be an object with field names as keys or a ") + 'function which returns such an object.') : void 0;
|
|
470
470
|
return mapValue(fieldMap, function (fieldConfig, fieldName) {
|
|
471
471
|
!isPlainObj(fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object")) : void 0;
|
|
472
|
-
!!
|
|
472
|
+
!!('isDeprecated' in fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" ") + 'instead of "isDeprecated".') : void 0;
|
|
473
473
|
!(fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function') ? invariant(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat(inspect(fieldConfig.resolve), ".")) : void 0;
|
|
474
474
|
var argsConfig = fieldConfig.args || {};
|
|
475
475
|
!isPlainObj(argsConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument ") + 'names as keys.') : void 0;
|
|
@@ -689,9 +689,7 @@ export var GraphQLEnumType
|
|
|
689
689
|
=
|
|
690
690
|
/*#__PURE__*/
|
|
691
691
|
function () {
|
|
692
|
-
function GraphQLEnumType(config
|
|
693
|
-
/* <T> */
|
|
694
|
-
) {
|
|
692
|
+
function GraphQLEnumType(config) {
|
|
695
693
|
this.name = config.name;
|
|
696
694
|
this.description = config.description;
|
|
697
695
|
this.astNode = config.astNode;
|
|
@@ -716,9 +714,7 @@ function () {
|
|
|
716
714
|
return this._nameLookup[name];
|
|
717
715
|
};
|
|
718
716
|
|
|
719
|
-
_proto5.serialize = function serialize(value
|
|
720
|
-
/* T */
|
|
721
|
-
) {
|
|
717
|
+
_proto5.serialize = function serialize(value) {
|
|
722
718
|
var enumValue = this._valueLookup.get(value);
|
|
723
719
|
|
|
724
720
|
if (enumValue) {
|
|
@@ -781,22 +777,20 @@ function () {
|
|
|
781
777
|
defineToStringTag(GraphQLEnumType);
|
|
782
778
|
defineToJSON(GraphQLEnumType);
|
|
783
779
|
|
|
784
|
-
function defineEnumValues(type, valueMap
|
|
785
|
-
/* <T> */
|
|
786
|
-
) {
|
|
780
|
+
function defineEnumValues(type, valueMap) {
|
|
787
781
|
!isPlainObj(valueMap) ? invariant(0, "".concat(type.name, " values must be an object with value names as keys.")) : void 0;
|
|
788
782
|
return objectEntries(valueMap).map(function (_ref2) {
|
|
789
783
|
var valueName = _ref2[0],
|
|
790
784
|
value = _ref2[1];
|
|
791
785
|
!isPlainObj(value) ? invariant(0, "".concat(type.name, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat(inspect(value), ".")) : void 0;
|
|
792
|
-
!!
|
|
786
|
+
!!('isDeprecated' in value) ? invariant(0, "".concat(type.name, ".").concat(valueName, " should provide \"deprecationReason\" instead ") + 'of "isDeprecated".') : void 0;
|
|
793
787
|
return {
|
|
794
788
|
name: valueName,
|
|
795
789
|
description: value.description,
|
|
796
790
|
isDeprecated: Boolean(value.deprecationReason),
|
|
797
791
|
deprecationReason: value.deprecationReason,
|
|
798
792
|
astNode: value.astNode,
|
|
799
|
-
value:
|
|
793
|
+
value: 'value' in value ? value.value : valueName
|
|
800
794
|
};
|
|
801
795
|
});
|
|
802
796
|
}
|
|
@@ -875,7 +869,7 @@ function defineInputFieldMap(config) {
|
|
|
875
869
|
var fieldMap = resolveThunk(config.fields) || {};
|
|
876
870
|
!isPlainObj(fieldMap) ? invariant(0, "".concat(config.name, " fields must be an object with field names as keys or a ") + 'function which returns such an object.') : void 0;
|
|
877
871
|
return mapValue(fieldMap, function (fieldConfig, fieldName) {
|
|
878
|
-
!!
|
|
872
|
+
!!('resolve' in fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but ") + 'Input Types cannot define resolvers.') : void 0;
|
|
879
873
|
return _objectSpread({}, fieldConfig, {
|
|
880
874
|
name: fieldName
|
|
881
875
|
});
|
|
@@ -884,4 +878,4 @@ function defineInputFieldMap(config) {
|
|
|
884
878
|
|
|
885
879
|
export function isRequiredInputField(field) {
|
|
886
880
|
return isNonNullType(field.type) && field.defaultValue === undefined;
|
|
887
|
-
}
|
|
881
|
+
}
|
package/type/directives.js
CHANGED
package/type/directives.mjs
CHANGED
package/type/index.js
CHANGED
package/type/index.mjs
CHANGED
|
@@ -32,4 +32,4 @@ introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field,
|
|
|
32
32
|
TypeKind, // Meta-field definitions.
|
|
33
33
|
SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from './introspection';
|
|
34
34
|
// Validate GraphQL schema.
|
|
35
|
-
export { validateSchema, assertValidSchema } from './validate';
|
|
35
|
+
export { validateSchema, assertValidSchema } from './validate';
|
package/type/introspection.js
CHANGED
package/type/introspection.mjs
CHANGED
package/type/scalars.js
CHANGED
package/type/scalars.mjs
CHANGED
package/type/schema.js
CHANGED
|
@@ -247,7 +247,8 @@ function () {
|
|
|
247
247
|
if (!possibleTypeMap[abstractType.name]) {
|
|
248
248
|
var possibleTypes = this.getPossibleTypes(abstractType);
|
|
249
249
|
possibleTypeMap[abstractType.name] = possibleTypes.reduce(function (map, type) {
|
|
250
|
-
|
|
250
|
+
map[type.name] = true;
|
|
251
|
+
return map;
|
|
251
252
|
}, Object.create(null));
|
|
252
253
|
}
|
|
253
254
|
|
|
@@ -382,4 +383,4 @@ function typeMapDirectiveReducer(map, directive) {
|
|
|
382
383
|
return directive.args.reduce(function (_map, arg) {
|
|
383
384
|
return typeMapReducer(_map, arg.type);
|
|
384
385
|
}, map);
|
|
385
|
-
}
|
|
386
|
+
}
|
package/type/schema.js.flow
CHANGED
|
@@ -257,10 +257,10 @@ export class GraphQLSchema {
|
|
|
257
257
|
|
|
258
258
|
if (!possibleTypeMap[abstractType.name]) {
|
|
259
259
|
const possibleTypes = this.getPossibleTypes(abstractType);
|
|
260
|
-
possibleTypeMap[abstractType.name] = possibleTypes.reduce(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
);
|
|
260
|
+
possibleTypeMap[abstractType.name] = possibleTypes.reduce((map, type) => {
|
|
261
|
+
map[type.name] = true;
|
|
262
|
+
return map;
|
|
263
|
+
}, Object.create(null));
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
return Boolean(possibleTypeMap[abstractType.name][possibleType.name]);
|
package/type/schema.mjs
CHANGED
|
@@ -233,7 +233,8 @@ function () {
|
|
|
233
233
|
if (!possibleTypeMap[abstractType.name]) {
|
|
234
234
|
var possibleTypes = this.getPossibleTypes(abstractType);
|
|
235
235
|
possibleTypeMap[abstractType.name] = possibleTypes.reduce(function (map, type) {
|
|
236
|
-
|
|
236
|
+
map[type.name] = true;
|
|
237
|
+
return map;
|
|
237
238
|
}, Object.create(null));
|
|
238
239
|
}
|
|
239
240
|
|
|
@@ -366,4 +367,4 @@ function typeMapDirectiveReducer(map, directive) {
|
|
|
366
367
|
return directive.args.reduce(function (_map, arg) {
|
|
367
368
|
return typeMapReducer(_map, arg.type);
|
|
368
369
|
}, map);
|
|
369
|
-
}
|
|
370
|
+
}
|
package/type/validate.js
CHANGED
package/type/validate.mjs
CHANGED
package/utilities/TypeInfo.js
CHANGED
|
@@ -36,7 +36,9 @@ var TypeInfo =
|
|
|
36
36
|
function () {
|
|
37
37
|
function TypeInfo(schema, // NOTE: this experimental optional second parameter is only needed in order
|
|
38
38
|
// to support non-spec-compliant codebases. You should never need to use it.
|
|
39
|
+
// It may disappear in the future.
|
|
39
40
|
getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals
|
|
41
|
+
// beginning somewhere other than documents.
|
|
40
42
|
initialType) {
|
|
41
43
|
this._schema = schema;
|
|
42
44
|
this._typeStack = [];
|
|
@@ -122,128 +124,146 @@ function () {
|
|
|
122
124
|
|
|
123
125
|
switch (node.kind) {
|
|
124
126
|
case _kinds.Kind.SELECTION_SET:
|
|
125
|
-
|
|
127
|
+
{
|
|
128
|
+
var namedType = (0, _definition.getNamedType)(this.getType());
|
|
126
129
|
|
|
127
|
-
|
|
130
|
+
this._parentTypeStack.push((0, _definition.isCompositeType)(namedType) ? namedType : undefined);
|
|
128
131
|
|
|
129
|
-
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
130
134
|
|
|
131
135
|
case _kinds.Kind.FIELD:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
{
|
|
137
|
+
var parentType = this.getParentType();
|
|
138
|
+
var fieldDef;
|
|
139
|
+
var fieldType;
|
|
135
140
|
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
if (parentType) {
|
|
142
|
+
fieldDef = this._getFieldDef(schema, parentType, node);
|
|
138
143
|
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
if (fieldDef) {
|
|
145
|
+
fieldType = fieldDef.type;
|
|
146
|
+
}
|
|
141
147
|
}
|
|
142
|
-
}
|
|
143
148
|
|
|
144
|
-
|
|
149
|
+
this._fieldDefStack.push(fieldDef);
|
|
145
150
|
|
|
146
|
-
|
|
151
|
+
this._typeStack.push((0, _definition.isOutputType)(fieldType) ? fieldType : undefined);
|
|
147
152
|
|
|
148
|
-
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
149
155
|
|
|
150
156
|
case _kinds.Kind.DIRECTIVE:
|
|
151
157
|
this._directive = schema.getDirective(node.name.value);
|
|
152
158
|
break;
|
|
153
159
|
|
|
154
160
|
case _kinds.Kind.OPERATION_DEFINITION:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
{
|
|
162
|
+
var type;
|
|
163
|
+
|
|
164
|
+
if (node.operation === 'query') {
|
|
165
|
+
type = schema.getQueryType();
|
|
166
|
+
} else if (node.operation === 'mutation') {
|
|
167
|
+
type = schema.getMutationType();
|
|
168
|
+
} else if (node.operation === 'subscription') {
|
|
169
|
+
type = schema.getSubscriptionType();
|
|
170
|
+
}
|
|
164
171
|
|
|
165
|
-
|
|
172
|
+
this._typeStack.push((0, _definition.isObjectType)(type) ? type : undefined);
|
|
166
173
|
|
|
167
|
-
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
168
176
|
|
|
169
177
|
case _kinds.Kind.INLINE_FRAGMENT:
|
|
170
178
|
case _kinds.Kind.FRAGMENT_DEFINITION:
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
{
|
|
180
|
+
var typeConditionAST = node.typeCondition;
|
|
181
|
+
var outputType = typeConditionAST ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) : (0, _definition.getNamedType)(this.getType());
|
|
173
182
|
|
|
174
|
-
|
|
183
|
+
this._typeStack.push((0, _definition.isOutputType)(outputType) ? outputType : undefined);
|
|
175
184
|
|
|
176
|
-
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
177
187
|
|
|
178
188
|
case _kinds.Kind.VARIABLE_DEFINITION:
|
|
179
|
-
|
|
189
|
+
{
|
|
190
|
+
var inputType = (0, _typeFromAST.typeFromAST)(schema, node.type);
|
|
180
191
|
|
|
181
|
-
|
|
192
|
+
this._inputTypeStack.push((0, _definition.isInputType)(inputType) ? inputType : undefined);
|
|
182
193
|
|
|
183
|
-
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
184
196
|
|
|
185
197
|
case _kinds.Kind.ARGUMENT:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
{
|
|
199
|
+
var argDef;
|
|
200
|
+
var argType;
|
|
201
|
+
var fieldOrDirective = this.getDirective() || this.getFieldDef();
|
|
202
|
+
|
|
203
|
+
if (fieldOrDirective) {
|
|
204
|
+
argDef = (0, _find.default)(fieldOrDirective.args, function (arg) {
|
|
205
|
+
return arg.name === node.name.value;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
if (argDef) {
|
|
209
|
+
argType = argDef.type;
|
|
210
|
+
}
|
|
197
211
|
}
|
|
198
|
-
}
|
|
199
212
|
|
|
200
|
-
|
|
213
|
+
this._argument = argDef;
|
|
201
214
|
|
|
202
|
-
|
|
215
|
+
this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);
|
|
203
216
|
|
|
204
|
-
|
|
217
|
+
this._inputTypeStack.push((0, _definition.isInputType)(argType) ? argType : undefined);
|
|
205
218
|
|
|
206
|
-
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
207
221
|
|
|
208
222
|
case _kinds.Kind.LIST:
|
|
209
|
-
|
|
210
|
-
|
|
223
|
+
{
|
|
224
|
+
var listType = (0, _definition.getNullableType)(this.getInputType());
|
|
225
|
+
var itemType = (0, _definition.isListType)(listType) ? listType.ofType : listType; // List positions never have a default value.
|
|
211
226
|
|
|
212
|
-
|
|
227
|
+
this._defaultValueStack.push(undefined);
|
|
213
228
|
|
|
214
|
-
|
|
229
|
+
this._inputTypeStack.push((0, _definition.isInputType)(itemType) ? itemType : undefined);
|
|
215
230
|
|
|
216
|
-
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
217
233
|
|
|
218
234
|
case _kinds.Kind.OBJECT_FIELD:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
235
|
+
{
|
|
236
|
+
var objectType = (0, _definition.getNamedType)(this.getInputType());
|
|
237
|
+
var inputFieldType;
|
|
238
|
+
var inputField;
|
|
222
239
|
|
|
223
|
-
|
|
224
|
-
|
|
240
|
+
if ((0, _definition.isInputObjectType)(objectType)) {
|
|
241
|
+
inputField = objectType.getFields()[node.name.value];
|
|
225
242
|
|
|
226
|
-
|
|
227
|
-
|
|
243
|
+
if (inputField) {
|
|
244
|
+
inputFieldType = inputField.type;
|
|
245
|
+
}
|
|
228
246
|
}
|
|
229
|
-
}
|
|
230
247
|
|
|
231
|
-
|
|
248
|
+
this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined);
|
|
232
249
|
|
|
233
|
-
|
|
250
|
+
this._inputTypeStack.push((0, _definition.isInputType)(inputFieldType) ? inputFieldType : undefined);
|
|
234
251
|
|
|
235
|
-
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
236
254
|
|
|
237
255
|
case _kinds.Kind.ENUM:
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
{
|
|
257
|
+
var enumType = (0, _definition.getNamedType)(this.getInputType());
|
|
258
|
+
var enumValue;
|
|
240
259
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
260
|
+
if ((0, _definition.isEnumType)(enumType)) {
|
|
261
|
+
enumValue = enumType.getValue(node.value);
|
|
262
|
+
}
|
|
244
263
|
|
|
245
|
-
|
|
246
|
-
|
|
264
|
+
this._enumValue = enumValue;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
247
267
|
}
|
|
248
268
|
};
|
|
249
269
|
|
|
@@ -329,4 +349,4 @@ function getFieldDef(schema, parentType, fieldNode) {
|
|
|
329
349
|
if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) {
|
|
330
350
|
return parentType.getFields()[name];
|
|
331
351
|
}
|
|
332
|
-
}
|
|
352
|
+
}
|