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
package/type/definition.js
CHANGED
|
@@ -41,6 +41,7 @@ exports.getNullableType = getNullableType;
|
|
|
41
41
|
exports.isNamedType = isNamedType;
|
|
42
42
|
exports.assertNamedType = assertNamedType;
|
|
43
43
|
exports.getNamedType = getNamedType;
|
|
44
|
+
exports.argsToArgsConfig = argsToArgsConfig;
|
|
44
45
|
exports.isRequiredArgument = isRequiredArgument;
|
|
45
46
|
exports.isRequiredInputField = isRequiredInputField;
|
|
46
47
|
exports.GraphQLInputObjectType = exports.GraphQLEnumType = exports.GraphQLUnionType = exports.GraphQLInterfaceType = exports.GraphQLObjectType = exports.GraphQLScalarType = void 0;
|
|
@@ -59,6 +60,8 @@ var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
|
59
60
|
|
|
60
61
|
var _keyMap = _interopRequireDefault(require("../jsutils/keyMap"));
|
|
61
62
|
|
|
63
|
+
var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap"));
|
|
64
|
+
|
|
62
65
|
var _mapValue = _interopRequireDefault(require("../jsutils/mapValue"));
|
|
63
66
|
|
|
64
67
|
var _kinds = require("../language/kinds");
|
|
@@ -262,8 +265,10 @@ function GraphQLList(ofType) {
|
|
|
262
265
|
|
|
263
266
|
GraphQLList.prototype.toString = function toString() {
|
|
264
267
|
return '[' + String(this.ofType) + ']';
|
|
265
|
-
};
|
|
268
|
+
}; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
269
|
+
|
|
266
270
|
|
|
271
|
+
(0, _defineToStringTag.default)(GraphQLList);
|
|
267
272
|
(0, _defineToJSON.default)(GraphQLList);
|
|
268
273
|
/**
|
|
269
274
|
* Non-Null Type Wrapper
|
|
@@ -298,8 +303,10 @@ function GraphQLNonNull(ofType) {
|
|
|
298
303
|
|
|
299
304
|
GraphQLNonNull.prototype.toString = function toString() {
|
|
300
305
|
return String(this.ofType) + '!';
|
|
301
|
-
};
|
|
306
|
+
}; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
302
307
|
|
|
308
|
+
|
|
309
|
+
(0, _defineToStringTag.default)(GraphQLNonNull);
|
|
303
310
|
(0, _defineToJSON.default)(GraphQLNonNull);
|
|
304
311
|
/**
|
|
305
312
|
* These types wrap and modify other types
|
|
@@ -373,6 +380,10 @@ function resolveThunk(thunk) {
|
|
|
373
380
|
// $FlowFixMe(>=0.90.0)
|
|
374
381
|
return typeof thunk === 'function' ? thunk() : thunk;
|
|
375
382
|
}
|
|
383
|
+
|
|
384
|
+
function undefineIfEmpty(arr) {
|
|
385
|
+
return arr && arr.length > 0 ? arr : undefined;
|
|
386
|
+
}
|
|
376
387
|
/**
|
|
377
388
|
* Scalar Type Definition
|
|
378
389
|
*
|
|
@@ -413,7 +424,7 @@ function () {
|
|
|
413
424
|
|
|
414
425
|
this.parseLiteral = config.parseLiteral || _valueFromASTUntyped.valueFromASTUntyped;
|
|
415
426
|
this.astNode = config.astNode;
|
|
416
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
427
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
417
428
|
!(typeof config.name === 'string') ? (0, _invariant.default)(0, 'Must provide name.') : void 0;
|
|
418
429
|
!(typeof config.serialize === 'function') ? (0, _invariant.default)(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar ") + 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' + 'functions are also provided.') : void 0;
|
|
419
430
|
|
|
@@ -424,6 +435,18 @@ function () {
|
|
|
424
435
|
|
|
425
436
|
var _proto = GraphQLScalarType.prototype;
|
|
426
437
|
|
|
438
|
+
_proto.toConfig = function toConfig() {
|
|
439
|
+
return {
|
|
440
|
+
name: this.name,
|
|
441
|
+
description: this.description,
|
|
442
|
+
serialize: this.serialize,
|
|
443
|
+
parseValue: this.parseValue,
|
|
444
|
+
parseLiteral: this.parseLiteral,
|
|
445
|
+
astNode: this.astNode,
|
|
446
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
|
|
427
450
|
_proto.toString = function toString() {
|
|
428
451
|
return this.name;
|
|
429
452
|
};
|
|
@@ -480,7 +503,7 @@ function () {
|
|
|
480
503
|
this.name = config.name;
|
|
481
504
|
this.description = config.description;
|
|
482
505
|
this.astNode = config.astNode;
|
|
483
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
506
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
484
507
|
this.isTypeOf = config.isTypeOf;
|
|
485
508
|
this._fields = defineFieldMap.bind(undefined, config);
|
|
486
509
|
this._interfaces = defineInterfaces.bind(undefined, config);
|
|
@@ -506,6 +529,18 @@ function () {
|
|
|
506
529
|
return this._interfaces;
|
|
507
530
|
};
|
|
508
531
|
|
|
532
|
+
_proto2.toConfig = function toConfig() {
|
|
533
|
+
return {
|
|
534
|
+
name: this.name,
|
|
535
|
+
description: this.description,
|
|
536
|
+
isTypeOf: this.isTypeOf,
|
|
537
|
+
interfaces: this.getInterfaces(),
|
|
538
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
539
|
+
astNode: this.astNode,
|
|
540
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
|
|
509
544
|
_proto2.toString = function toString() {
|
|
510
545
|
return this.name;
|
|
511
546
|
};
|
|
@@ -529,7 +564,7 @@ function defineFieldMap(config) {
|
|
|
529
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;
|
|
530
565
|
return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) {
|
|
531
566
|
!isPlainObj(fieldConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object")) : void 0;
|
|
532
|
-
!!
|
|
567
|
+
!!('isDeprecated' in fieldConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" ") + 'instead of "isDeprecated".') : void 0;
|
|
533
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;
|
|
534
569
|
var argsConfig = fieldConfig.args || {};
|
|
535
570
|
!isPlainObj(argsConfig) ? (0, _invariant.default)(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument ") + 'names as keys.') : void 0;
|
|
@@ -556,6 +591,33 @@ function isPlainObj(obj) {
|
|
|
556
591
|
return obj && _typeof(obj) === 'object' && !Array.isArray(obj);
|
|
557
592
|
}
|
|
558
593
|
|
|
594
|
+
function fieldsToFieldsConfig(fields) {
|
|
595
|
+
return (0, _mapValue.default)(fields, function (field) {
|
|
596
|
+
return {
|
|
597
|
+
type: field.type,
|
|
598
|
+
args: argsToArgsConfig(field.args),
|
|
599
|
+
resolve: field.resolve,
|
|
600
|
+
subscribe: field.subscribe,
|
|
601
|
+
deprecationReason: field.deprecationReason,
|
|
602
|
+
description: field.description,
|
|
603
|
+
astNode: field.astNode
|
|
604
|
+
};
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function argsToArgsConfig(args) {
|
|
609
|
+
return (0, _keyValMap.default)(args, function (arg) {
|
|
610
|
+
return arg.name;
|
|
611
|
+
}, function (arg) {
|
|
612
|
+
return {
|
|
613
|
+
type: arg.type,
|
|
614
|
+
defaultValue: arg.defaultValue,
|
|
615
|
+
description: arg.description,
|
|
616
|
+
astNode: arg.astNode
|
|
617
|
+
};
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
559
621
|
function isRequiredArgument(arg) {
|
|
560
622
|
return isNonNullType(arg.type) && arg.defaultValue === undefined;
|
|
561
623
|
}
|
|
@@ -585,7 +647,7 @@ function () {
|
|
|
585
647
|
this.name = config.name;
|
|
586
648
|
this.description = config.description;
|
|
587
649
|
this.astNode = config.astNode;
|
|
588
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
650
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
589
651
|
this.resolveType = config.resolveType;
|
|
590
652
|
this._fields = defineFieldMap.bind(undefined, config);
|
|
591
653
|
!(typeof config.name === 'string') ? (0, _invariant.default)(0, 'Must provide name.') : void 0;
|
|
@@ -602,6 +664,17 @@ function () {
|
|
|
602
664
|
return this._fields;
|
|
603
665
|
};
|
|
604
666
|
|
|
667
|
+
_proto3.toConfig = function toConfig() {
|
|
668
|
+
return {
|
|
669
|
+
name: this.name,
|
|
670
|
+
description: this.description,
|
|
671
|
+
resolveType: this.resolveType,
|
|
672
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
673
|
+
astNode: this.astNode,
|
|
674
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
|
|
605
678
|
_proto3.toString = function toString() {
|
|
606
679
|
return this.name;
|
|
607
680
|
};
|
|
@@ -644,7 +717,7 @@ function () {
|
|
|
644
717
|
this.name = config.name;
|
|
645
718
|
this.description = config.description;
|
|
646
719
|
this.astNode = config.astNode;
|
|
647
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
720
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
648
721
|
this.resolveType = config.resolveType;
|
|
649
722
|
this._types = defineTypes.bind(undefined, config);
|
|
650
723
|
!(typeof config.name === 'string') ? (0, _invariant.default)(0, 'Must provide name.') : void 0;
|
|
@@ -661,6 +734,17 @@ function () {
|
|
|
661
734
|
return this._types;
|
|
662
735
|
};
|
|
663
736
|
|
|
737
|
+
_proto4.toConfig = function toConfig() {
|
|
738
|
+
return {
|
|
739
|
+
name: this.name,
|
|
740
|
+
description: this.description,
|
|
741
|
+
resolveType: this.resolveType,
|
|
742
|
+
types: this.getTypes(),
|
|
743
|
+
astNode: this.astNode,
|
|
744
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
|
|
664
748
|
_proto4.toString = function toString() {
|
|
665
749
|
return this.name;
|
|
666
750
|
};
|
|
@@ -705,13 +789,11 @@ var GraphQLEnumType
|
|
|
705
789
|
=
|
|
706
790
|
/*#__PURE__*/
|
|
707
791
|
function () {
|
|
708
|
-
function GraphQLEnumType(config
|
|
709
|
-
/* <T> */
|
|
710
|
-
) {
|
|
792
|
+
function GraphQLEnumType(config) {
|
|
711
793
|
this.name = config.name;
|
|
712
794
|
this.description = config.description;
|
|
713
795
|
this.astNode = config.astNode;
|
|
714
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
796
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
715
797
|
this._values = defineEnumValues(this, config.values);
|
|
716
798
|
this._valueLookup = new Map(this._values.map(function (enumValue) {
|
|
717
799
|
return [enumValue.value, enumValue];
|
|
@@ -732,9 +814,7 @@ function () {
|
|
|
732
814
|
return this._nameLookup[name];
|
|
733
815
|
};
|
|
734
816
|
|
|
735
|
-
_proto5.serialize = function serialize(value
|
|
736
|
-
/* T */
|
|
737
|
-
) {
|
|
817
|
+
_proto5.serialize = function serialize(value) {
|
|
738
818
|
var enumValue = this._valueLookup.get(value);
|
|
739
819
|
|
|
740
820
|
if (enumValue) {
|
|
@@ -767,6 +847,26 @@ function () {
|
|
|
767
847
|
}
|
|
768
848
|
};
|
|
769
849
|
|
|
850
|
+
_proto5.toConfig = function toConfig() {
|
|
851
|
+
var values = (0, _keyValMap.default)(this.getValues(), function (value) {
|
|
852
|
+
return value.name;
|
|
853
|
+
}, function (value) {
|
|
854
|
+
return {
|
|
855
|
+
description: value.description,
|
|
856
|
+
value: value.value,
|
|
857
|
+
deprecationReason: value.deprecationReason,
|
|
858
|
+
astNode: value.astNode
|
|
859
|
+
};
|
|
860
|
+
});
|
|
861
|
+
return {
|
|
862
|
+
name: this.name,
|
|
863
|
+
description: this.description,
|
|
864
|
+
values: values,
|
|
865
|
+
astNode: this.astNode,
|
|
866
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
|
|
770
870
|
_proto5.toString = function toString() {
|
|
771
871
|
return this.name;
|
|
772
872
|
};
|
|
@@ -779,22 +879,20 @@ exports.GraphQLEnumType = GraphQLEnumType;
|
|
|
779
879
|
(0, _defineToStringTag.default)(GraphQLEnumType);
|
|
780
880
|
(0, _defineToJSON.default)(GraphQLEnumType);
|
|
781
881
|
|
|
782
|
-
function defineEnumValues(type, valueMap
|
|
783
|
-
/* <T> */
|
|
784
|
-
) {
|
|
882
|
+
function defineEnumValues(type, valueMap) {
|
|
785
883
|
!isPlainObj(valueMap) ? (0, _invariant.default)(0, "".concat(type.name, " values must be an object with value names as keys.")) : void 0;
|
|
786
884
|
return (0, _objectEntries.default)(valueMap).map(function (_ref2) {
|
|
787
885
|
var valueName = _ref2[0],
|
|
788
886
|
value = _ref2[1];
|
|
789
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;
|
|
790
|
-
!!
|
|
888
|
+
!!('isDeprecated' in value) ? (0, _invariant.default)(0, "".concat(type.name, ".").concat(valueName, " should provide \"deprecationReason\" instead ") + 'of "isDeprecated".') : void 0;
|
|
791
889
|
return {
|
|
792
890
|
name: valueName,
|
|
793
891
|
description: value.description,
|
|
794
892
|
isDeprecated: Boolean(value.deprecationReason),
|
|
795
893
|
deprecationReason: value.deprecationReason,
|
|
796
894
|
astNode: value.astNode,
|
|
797
|
-
value:
|
|
895
|
+
value: 'value' in value ? value.value : valueName
|
|
798
896
|
};
|
|
799
897
|
});
|
|
800
898
|
}
|
|
@@ -826,7 +924,7 @@ function () {
|
|
|
826
924
|
this.name = config.name;
|
|
827
925
|
this.description = config.description;
|
|
828
926
|
this.astNode = config.astNode;
|
|
829
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
927
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
830
928
|
this._fields = defineInputFieldMap.bind(undefined, config);
|
|
831
929
|
!(typeof config.name === 'string') ? (0, _invariant.default)(0, 'Must provide name.') : void 0;
|
|
832
930
|
}
|
|
@@ -841,6 +939,24 @@ function () {
|
|
|
841
939
|
return this._fields;
|
|
842
940
|
};
|
|
843
941
|
|
|
942
|
+
_proto6.toConfig = function toConfig() {
|
|
943
|
+
var fields = (0, _mapValue.default)(this.getFields(), function (field) {
|
|
944
|
+
return {
|
|
945
|
+
description: field.description,
|
|
946
|
+
type: field.type,
|
|
947
|
+
defaultValue: field.defaultValue,
|
|
948
|
+
astNode: field.astNode
|
|
949
|
+
};
|
|
950
|
+
});
|
|
951
|
+
return {
|
|
952
|
+
name: this.name,
|
|
953
|
+
description: this.description,
|
|
954
|
+
fields: fields,
|
|
955
|
+
astNode: this.astNode,
|
|
956
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
|
|
844
960
|
_proto6.toString = function toString() {
|
|
845
961
|
return this.name;
|
|
846
962
|
};
|
|
@@ -857,7 +973,7 @@ function defineInputFieldMap(config) {
|
|
|
857
973
|
var fieldMap = resolveThunk(config.fields) || {};
|
|
858
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;
|
|
859
975
|
return (0, _mapValue.default)(fieldMap, function (fieldConfig, fieldName) {
|
|
860
|
-
!!
|
|
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;
|
|
861
977
|
return _objectSpread({}, fieldConfig, {
|
|
862
978
|
name: fieldName
|
|
863
979
|
});
|
|
@@ -866,4 +982,4 @@ function defineInputFieldMap(config) {
|
|
|
866
982
|
|
|
867
983
|
function isRequiredInputField(field) {
|
|
868
984
|
return isNonNullType(field.type) && field.defaultValue === undefined;
|
|
869
|
-
}
|
|
985
|
+
}
|