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.mjs
CHANGED
|
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Copyright (c)
|
|
8
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -19,6 +19,7 @@ import instanceOf from '../jsutils/instanceOf';
|
|
|
19
19
|
import inspect from '../jsutils/inspect';
|
|
20
20
|
import invariant from '../jsutils/invariant';
|
|
21
21
|
import keyMap from '../jsutils/keyMap';
|
|
22
|
+
import keyValMap from '../jsutils/keyValMap';
|
|
22
23
|
import mapValue from '../jsutils/mapValue';
|
|
23
24
|
import { Kind } from '../language/kinds';
|
|
24
25
|
import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped';
|
|
@@ -182,8 +183,10 @@ export function GraphQLList(ofType) {
|
|
|
182
183
|
|
|
183
184
|
GraphQLList.prototype.toString = function toString() {
|
|
184
185
|
return '[' + String(this.ofType) + ']';
|
|
185
|
-
};
|
|
186
|
+
}; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
186
187
|
|
|
188
|
+
|
|
189
|
+
defineToStringTag(GraphQLList);
|
|
187
190
|
defineToJSON(GraphQLList);
|
|
188
191
|
/**
|
|
189
192
|
* Non-Null Type Wrapper
|
|
@@ -217,8 +220,10 @@ export function GraphQLNonNull(ofType) {
|
|
|
217
220
|
|
|
218
221
|
GraphQLNonNull.prototype.toString = function toString() {
|
|
219
222
|
return String(this.ofType) + '!';
|
|
220
|
-
};
|
|
223
|
+
}; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
224
|
+
|
|
221
225
|
|
|
226
|
+
defineToStringTag(GraphQLNonNull);
|
|
222
227
|
defineToJSON(GraphQLNonNull);
|
|
223
228
|
/**
|
|
224
229
|
* These types wrap and modify other types
|
|
@@ -284,6 +289,10 @@ function resolveThunk(thunk) {
|
|
|
284
289
|
// $FlowFixMe(>=0.90.0)
|
|
285
290
|
return typeof thunk === 'function' ? thunk() : thunk;
|
|
286
291
|
}
|
|
292
|
+
|
|
293
|
+
function undefineIfEmpty(arr) {
|
|
294
|
+
return arr && arr.length > 0 ? arr : undefined;
|
|
295
|
+
}
|
|
287
296
|
/**
|
|
288
297
|
* Scalar Type Definition
|
|
289
298
|
*
|
|
@@ -324,7 +333,7 @@ function () {
|
|
|
324
333
|
|
|
325
334
|
this.parseLiteral = config.parseLiteral || valueFromASTUntyped;
|
|
326
335
|
this.astNode = config.astNode;
|
|
327
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
336
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
328
337
|
!(typeof config.name === 'string') ? invariant(0, 'Must provide name.') : void 0;
|
|
329
338
|
!(typeof config.serialize === 'function') ? invariant(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;
|
|
330
339
|
|
|
@@ -335,6 +344,18 @@ function () {
|
|
|
335
344
|
|
|
336
345
|
var _proto = GraphQLScalarType.prototype;
|
|
337
346
|
|
|
347
|
+
_proto.toConfig = function toConfig() {
|
|
348
|
+
return {
|
|
349
|
+
name: this.name,
|
|
350
|
+
description: this.description,
|
|
351
|
+
serialize: this.serialize,
|
|
352
|
+
parseValue: this.parseValue,
|
|
353
|
+
parseLiteral: this.parseLiteral,
|
|
354
|
+
astNode: this.astNode,
|
|
355
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
|
|
338
359
|
_proto.toString = function toString() {
|
|
339
360
|
return this.name;
|
|
340
361
|
};
|
|
@@ -389,7 +410,7 @@ function () {
|
|
|
389
410
|
this.name = config.name;
|
|
390
411
|
this.description = config.description;
|
|
391
412
|
this.astNode = config.astNode;
|
|
392
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
413
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
393
414
|
this.isTypeOf = config.isTypeOf;
|
|
394
415
|
this._fields = defineFieldMap.bind(undefined, config);
|
|
395
416
|
this._interfaces = defineInterfaces.bind(undefined, config);
|
|
@@ -415,6 +436,18 @@ function () {
|
|
|
415
436
|
return this._interfaces;
|
|
416
437
|
};
|
|
417
438
|
|
|
439
|
+
_proto2.toConfig = function toConfig() {
|
|
440
|
+
return {
|
|
441
|
+
name: this.name,
|
|
442
|
+
description: this.description,
|
|
443
|
+
isTypeOf: this.isTypeOf,
|
|
444
|
+
interfaces: this.getInterfaces(),
|
|
445
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
446
|
+
astNode: this.astNode,
|
|
447
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
|
|
418
451
|
_proto2.toString = function toString() {
|
|
419
452
|
return this.name;
|
|
420
453
|
};
|
|
@@ -436,7 +469,7 @@ function defineFieldMap(config) {
|
|
|
436
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;
|
|
437
470
|
return mapValue(fieldMap, function (fieldConfig, fieldName) {
|
|
438
471
|
!isPlainObj(fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object")) : void 0;
|
|
439
|
-
!!
|
|
472
|
+
!!('isDeprecated' in fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" ") + 'instead of "isDeprecated".') : void 0;
|
|
440
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;
|
|
441
474
|
var argsConfig = fieldConfig.args || {};
|
|
442
475
|
!isPlainObj(argsConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument ") + 'names as keys.') : void 0;
|
|
@@ -463,6 +496,32 @@ function isPlainObj(obj) {
|
|
|
463
496
|
return obj && _typeof(obj) === 'object' && !Array.isArray(obj);
|
|
464
497
|
}
|
|
465
498
|
|
|
499
|
+
function fieldsToFieldsConfig(fields) {
|
|
500
|
+
return mapValue(fields, function (field) {
|
|
501
|
+
return {
|
|
502
|
+
type: field.type,
|
|
503
|
+
args: argsToArgsConfig(field.args),
|
|
504
|
+
resolve: field.resolve,
|
|
505
|
+
subscribe: field.subscribe,
|
|
506
|
+
deprecationReason: field.deprecationReason,
|
|
507
|
+
description: field.description,
|
|
508
|
+
astNode: field.astNode
|
|
509
|
+
};
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export function argsToArgsConfig(args) {
|
|
514
|
+
return keyValMap(args, function (arg) {
|
|
515
|
+
return arg.name;
|
|
516
|
+
}, function (arg) {
|
|
517
|
+
return {
|
|
518
|
+
type: arg.type,
|
|
519
|
+
defaultValue: arg.defaultValue,
|
|
520
|
+
description: arg.description,
|
|
521
|
+
astNode: arg.astNode
|
|
522
|
+
};
|
|
523
|
+
});
|
|
524
|
+
}
|
|
466
525
|
export function isRequiredArgument(arg) {
|
|
467
526
|
return isNonNullType(arg.type) && arg.defaultValue === undefined;
|
|
468
527
|
}
|
|
@@ -492,7 +551,7 @@ function () {
|
|
|
492
551
|
this.name = config.name;
|
|
493
552
|
this.description = config.description;
|
|
494
553
|
this.astNode = config.astNode;
|
|
495
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
554
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
496
555
|
this.resolveType = config.resolveType;
|
|
497
556
|
this._fields = defineFieldMap.bind(undefined, config);
|
|
498
557
|
!(typeof config.name === 'string') ? invariant(0, 'Must provide name.') : void 0;
|
|
@@ -509,6 +568,17 @@ function () {
|
|
|
509
568
|
return this._fields;
|
|
510
569
|
};
|
|
511
570
|
|
|
571
|
+
_proto3.toConfig = function toConfig() {
|
|
572
|
+
return {
|
|
573
|
+
name: this.name,
|
|
574
|
+
description: this.description,
|
|
575
|
+
resolveType: this.resolveType,
|
|
576
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
577
|
+
astNode: this.astNode,
|
|
578
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
|
|
512
582
|
_proto3.toString = function toString() {
|
|
513
583
|
return this.name;
|
|
514
584
|
};
|
|
@@ -549,7 +619,7 @@ function () {
|
|
|
549
619
|
this.name = config.name;
|
|
550
620
|
this.description = config.description;
|
|
551
621
|
this.astNode = config.astNode;
|
|
552
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
622
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
553
623
|
this.resolveType = config.resolveType;
|
|
554
624
|
this._types = defineTypes.bind(undefined, config);
|
|
555
625
|
!(typeof config.name === 'string') ? invariant(0, 'Must provide name.') : void 0;
|
|
@@ -566,6 +636,17 @@ function () {
|
|
|
566
636
|
return this._types;
|
|
567
637
|
};
|
|
568
638
|
|
|
639
|
+
_proto4.toConfig = function toConfig() {
|
|
640
|
+
return {
|
|
641
|
+
name: this.name,
|
|
642
|
+
description: this.description,
|
|
643
|
+
resolveType: this.resolveType,
|
|
644
|
+
types: this.getTypes(),
|
|
645
|
+
astNode: this.astNode,
|
|
646
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
|
|
569
650
|
_proto4.toString = function toString() {
|
|
570
651
|
return this.name;
|
|
571
652
|
};
|
|
@@ -608,13 +689,11 @@ export var GraphQLEnumType
|
|
|
608
689
|
=
|
|
609
690
|
/*#__PURE__*/
|
|
610
691
|
function () {
|
|
611
|
-
function GraphQLEnumType(config
|
|
612
|
-
/* <T> */
|
|
613
|
-
) {
|
|
692
|
+
function GraphQLEnumType(config) {
|
|
614
693
|
this.name = config.name;
|
|
615
694
|
this.description = config.description;
|
|
616
695
|
this.astNode = config.astNode;
|
|
617
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
696
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
618
697
|
this._values = defineEnumValues(this, config.values);
|
|
619
698
|
this._valueLookup = new Map(this._values.map(function (enumValue) {
|
|
620
699
|
return [enumValue.value, enumValue];
|
|
@@ -635,9 +714,7 @@ function () {
|
|
|
635
714
|
return this._nameLookup[name];
|
|
636
715
|
};
|
|
637
716
|
|
|
638
|
-
_proto5.serialize = function serialize(value
|
|
639
|
-
/* T */
|
|
640
|
-
) {
|
|
717
|
+
_proto5.serialize = function serialize(value) {
|
|
641
718
|
var enumValue = this._valueLookup.get(value);
|
|
642
719
|
|
|
643
720
|
if (enumValue) {
|
|
@@ -670,6 +747,26 @@ function () {
|
|
|
670
747
|
}
|
|
671
748
|
};
|
|
672
749
|
|
|
750
|
+
_proto5.toConfig = function toConfig() {
|
|
751
|
+
var values = keyValMap(this.getValues(), function (value) {
|
|
752
|
+
return value.name;
|
|
753
|
+
}, function (value) {
|
|
754
|
+
return {
|
|
755
|
+
description: value.description,
|
|
756
|
+
value: value.value,
|
|
757
|
+
deprecationReason: value.deprecationReason,
|
|
758
|
+
astNode: value.astNode
|
|
759
|
+
};
|
|
760
|
+
});
|
|
761
|
+
return {
|
|
762
|
+
name: this.name,
|
|
763
|
+
description: this.description,
|
|
764
|
+
values: values,
|
|
765
|
+
astNode: this.astNode,
|
|
766
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
|
|
673
770
|
_proto5.toString = function toString() {
|
|
674
771
|
return this.name;
|
|
675
772
|
};
|
|
@@ -680,22 +777,20 @@ function () {
|
|
|
680
777
|
defineToStringTag(GraphQLEnumType);
|
|
681
778
|
defineToJSON(GraphQLEnumType);
|
|
682
779
|
|
|
683
|
-
function defineEnumValues(type, valueMap
|
|
684
|
-
/* <T> */
|
|
685
|
-
) {
|
|
780
|
+
function defineEnumValues(type, valueMap) {
|
|
686
781
|
!isPlainObj(valueMap) ? invariant(0, "".concat(type.name, " values must be an object with value names as keys.")) : void 0;
|
|
687
782
|
return objectEntries(valueMap).map(function (_ref2) {
|
|
688
783
|
var valueName = _ref2[0],
|
|
689
784
|
value = _ref2[1];
|
|
690
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;
|
|
691
|
-
!!
|
|
786
|
+
!!('isDeprecated' in value) ? invariant(0, "".concat(type.name, ".").concat(valueName, " should provide \"deprecationReason\" instead ") + 'of "isDeprecated".') : void 0;
|
|
692
787
|
return {
|
|
693
788
|
name: valueName,
|
|
694
789
|
description: value.description,
|
|
695
790
|
isDeprecated: Boolean(value.deprecationReason),
|
|
696
791
|
deprecationReason: value.deprecationReason,
|
|
697
792
|
astNode: value.astNode,
|
|
698
|
-
value:
|
|
793
|
+
value: 'value' in value ? value.value : valueName
|
|
699
794
|
};
|
|
700
795
|
});
|
|
701
796
|
}
|
|
@@ -727,7 +822,7 @@ function () {
|
|
|
727
822
|
this.name = config.name;
|
|
728
823
|
this.description = config.description;
|
|
729
824
|
this.astNode = config.astNode;
|
|
730
|
-
this.extensionASTNodes = config.extensionASTNodes;
|
|
825
|
+
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
731
826
|
this._fields = defineInputFieldMap.bind(undefined, config);
|
|
732
827
|
!(typeof config.name === 'string') ? invariant(0, 'Must provide name.') : void 0;
|
|
733
828
|
}
|
|
@@ -742,6 +837,24 @@ function () {
|
|
|
742
837
|
return this._fields;
|
|
743
838
|
};
|
|
744
839
|
|
|
840
|
+
_proto6.toConfig = function toConfig() {
|
|
841
|
+
var fields = mapValue(this.getFields(), function (field) {
|
|
842
|
+
return {
|
|
843
|
+
description: field.description,
|
|
844
|
+
type: field.type,
|
|
845
|
+
defaultValue: field.defaultValue,
|
|
846
|
+
astNode: field.astNode
|
|
847
|
+
};
|
|
848
|
+
});
|
|
849
|
+
return {
|
|
850
|
+
name: this.name,
|
|
851
|
+
description: this.description,
|
|
852
|
+
fields: fields,
|
|
853
|
+
astNode: this.astNode,
|
|
854
|
+
extensionASTNodes: this.extensionASTNodes || []
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
|
|
745
858
|
_proto6.toString = function toString() {
|
|
746
859
|
return this.name;
|
|
747
860
|
};
|
|
@@ -756,7 +869,7 @@ function defineInputFieldMap(config) {
|
|
|
756
869
|
var fieldMap = resolveThunk(config.fields) || {};
|
|
757
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;
|
|
758
871
|
return mapValue(fieldMap, function (fieldConfig, fieldName) {
|
|
759
|
-
!!
|
|
872
|
+
!!('resolve' in fieldConfig) ? invariant(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but ") + 'Input Types cannot define resolvers.') : void 0;
|
|
760
873
|
return _objectSpread({}, fieldConfig, {
|
|
761
874
|
name: fieldName
|
|
762
875
|
});
|
|
@@ -765,4 +878,4 @@ function defineInputFieldMap(config) {
|
|
|
765
878
|
|
|
766
879
|
export function isRequiredInputField(field) {
|
|
767
880
|
return isNonNullType(field.type) && field.defaultValue === undefined;
|
|
768
|
-
}
|
|
881
|
+
}
|
package/type/directives.js
CHANGED
|
@@ -76,6 +76,16 @@ function () {
|
|
|
76
76
|
return '@' + this.name;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
_proto.toConfig = function toConfig() {
|
|
80
|
+
return {
|
|
81
|
+
name: this.name,
|
|
82
|
+
description: this.description,
|
|
83
|
+
locations: this.locations,
|
|
84
|
+
args: (0, _definition.argsToArgsConfig)(this.args),
|
|
85
|
+
astNode: this.astNode
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
79
89
|
return GraphQLDirective;
|
|
80
90
|
}(); // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
81
91
|
|
|
@@ -146,7 +156,8 @@ var specifiedDirectives = [GraphQLIncludeDirective, GraphQLSkipDirective, GraphQ
|
|
|
146
156
|
exports.specifiedDirectives = specifiedDirectives;
|
|
147
157
|
|
|
148
158
|
function isSpecifiedDirective(directive) {
|
|
149
|
-
return specifiedDirectives.some(function (
|
|
150
|
-
|
|
159
|
+
return isDirective(directive) && specifiedDirectives.some(function (_ref2) {
|
|
160
|
+
var name = _ref2.name;
|
|
161
|
+
return name === directive.name;
|
|
151
162
|
});
|
|
152
|
-
}
|
|
163
|
+
}
|
package/type/directives.js.flow
CHANGED
|
@@ -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,18 +8,19 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import objectEntries from '../polyfills/objectEntries';
|
|
11
|
-
import
|
|
12
|
-
GraphQLFieldConfigArgumentMap,
|
|
13
|
-
GraphQLArgument,
|
|
11
|
+
import {
|
|
12
|
+
type GraphQLFieldConfigArgumentMap,
|
|
13
|
+
type GraphQLArgument,
|
|
14
|
+
argsToArgsConfig,
|
|
15
|
+
GraphQLNonNull,
|
|
14
16
|
} from './definition';
|
|
15
|
-
import { GraphQLNonNull } from './definition';
|
|
16
17
|
import { GraphQLString, GraphQLBoolean } from './scalars';
|
|
17
18
|
import defineToStringTag from '../jsutils/defineToStringTag';
|
|
18
19
|
import defineToJSON from '../jsutils/defineToJSON';
|
|
19
20
|
import instanceOf from '../jsutils/instanceOf';
|
|
20
21
|
import invariant from '../jsutils/invariant';
|
|
21
22
|
import inspect from '../jsutils/inspect';
|
|
22
|
-
import type
|
|
23
|
+
import { type DirectiveDefinitionNode } from '../language/ast';
|
|
23
24
|
import {
|
|
24
25
|
DirectiveLocation,
|
|
25
26
|
type DirectiveLocationEnum,
|
|
@@ -84,6 +85,19 @@ export class GraphQLDirective {
|
|
|
84
85
|
toString(): string {
|
|
85
86
|
return '@' + this.name;
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
toConfig(): {|
|
|
90
|
+
...GraphQLDirectiveConfig,
|
|
91
|
+
args: GraphQLFieldConfigArgumentMap,
|
|
92
|
+
|} {
|
|
93
|
+
return {
|
|
94
|
+
name: this.name,
|
|
95
|
+
description: this.description,
|
|
96
|
+
locations: this.locations,
|
|
97
|
+
args: argsToArgsConfig(this.args),
|
|
98
|
+
astNode: this.astNode,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
87
101
|
}
|
|
88
102
|
|
|
89
103
|
// Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
@@ -173,10 +187,9 @@ export const specifiedDirectives: $ReadOnlyArray<*> = [
|
|
|
173
187
|
GraphQLDeprecatedDirective,
|
|
174
188
|
];
|
|
175
189
|
|
|
176
|
-
export function isSpecifiedDirective(
|
|
177
|
-
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
specifiedDirective => specifiedDirective.name === directive.name,
|
|
190
|
+
export function isSpecifiedDirective(directive: mixed): boolean %checks {
|
|
191
|
+
return (
|
|
192
|
+
isDirective(directive) &&
|
|
193
|
+
specifiedDirectives.some(({ name }) => name === directive.name)
|
|
181
194
|
);
|
|
182
195
|
}
|
package/type/directives.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -9,7 +9,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
import objectEntries from '../polyfills/objectEntries';
|
|
12
|
-
import { GraphQLNonNull } from './definition';
|
|
12
|
+
import { argsToArgsConfig, GraphQLNonNull } from './definition';
|
|
13
13
|
import { GraphQLString, GraphQLBoolean } from './scalars';
|
|
14
14
|
import defineToStringTag from '../jsutils/defineToStringTag';
|
|
15
15
|
import defineToJSON from '../jsutils/defineToJSON';
|
|
@@ -65,6 +65,16 @@ function () {
|
|
|
65
65
|
return '@' + this.name;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
_proto.toConfig = function toConfig() {
|
|
69
|
+
return {
|
|
70
|
+
name: this.name,
|
|
71
|
+
description: this.description,
|
|
72
|
+
locations: this.locations,
|
|
73
|
+
args: argsToArgsConfig(this.args),
|
|
74
|
+
astNode: this.astNode
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
68
78
|
return GraphQLDirective;
|
|
69
79
|
}(); // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
|
|
70
80
|
|
|
@@ -127,7 +137,8 @@ export var GraphQLDeprecatedDirective = new GraphQLDirective({
|
|
|
127
137
|
|
|
128
138
|
export var specifiedDirectives = [GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective];
|
|
129
139
|
export function isSpecifiedDirective(directive) {
|
|
130
|
-
return specifiedDirectives.some(function (
|
|
131
|
-
|
|
140
|
+
return isDirective(directive) && specifiedDirectives.some(function (_ref2) {
|
|
141
|
+
var name = _ref2.name;
|
|
142
|
+
return name === directive.name;
|
|
132
143
|
});
|
|
133
|
-
}
|
|
144
|
+
}
|
package/type/index.js
CHANGED
|
@@ -393,12 +393,6 @@ Object.defineProperty(exports, "GraphQLID", {
|
|
|
393
393
|
return _scalars.GraphQLID;
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
|
-
Object.defineProperty(exports, "TypeKind", {
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function get() {
|
|
399
|
-
return _introspection.TypeKind;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
396
|
Object.defineProperty(exports, "isIntrospectionType", {
|
|
403
397
|
enumerable: true,
|
|
404
398
|
get: function get() {
|
|
@@ -459,6 +453,12 @@ Object.defineProperty(exports, "__TypeKind", {
|
|
|
459
453
|
return _introspection.__TypeKind;
|
|
460
454
|
}
|
|
461
455
|
});
|
|
456
|
+
Object.defineProperty(exports, "TypeKind", {
|
|
457
|
+
enumerable: true,
|
|
458
|
+
get: function get() {
|
|
459
|
+
return _introspection.TypeKind;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
462
|
Object.defineProperty(exports, "SchemaMetaFieldDef", {
|
|
463
463
|
enumerable: true,
|
|
464
464
|
get: function get() {
|
|
@@ -500,4 +500,4 @@ var _scalars = require("./scalars");
|
|
|
500
500
|
|
|
501
501
|
var _introspection = require("./introspection");
|
|
502
502
|
|
|
503
|
-
var _validate = require("./validate");
|
|
503
|
+
var _validate = require("./validate");
|
package/type/index.js.flow
CHANGED
|
@@ -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.
|
|
@@ -93,7 +93,9 @@ export type { GraphQLDirectiveConfig } from './directives';
|
|
|
93
93
|
|
|
94
94
|
// Common built-in scalar instances.
|
|
95
95
|
export {
|
|
96
|
+
// Predicate
|
|
96
97
|
isSpecifiedScalarType,
|
|
98
|
+
// Standard GraphQL Scalars
|
|
97
99
|
specifiedScalarTypes,
|
|
98
100
|
GraphQLInt,
|
|
99
101
|
GraphQLFloat,
|
|
@@ -103,10 +105,9 @@ export {
|
|
|
103
105
|
} from './scalars';
|
|
104
106
|
|
|
105
107
|
export {
|
|
106
|
-
//
|
|
107
|
-
TypeKind,
|
|
108
|
-
// GraphQL Types for introspection.
|
|
108
|
+
// Predicate
|
|
109
109
|
isIntrospectionType,
|
|
110
|
+
// GraphQL Types for introspection.
|
|
110
111
|
introspectionTypes,
|
|
111
112
|
__Schema,
|
|
112
113
|
__Directive,
|
|
@@ -116,6 +117,8 @@ export {
|
|
|
116
117
|
__InputValue,
|
|
117
118
|
__EnumValue,
|
|
118
119
|
__TypeKind,
|
|
120
|
+
// "Enum" of Type Kinds
|
|
121
|
+
TypeKind,
|
|
119
122
|
// Meta-field definitions.
|
|
120
123
|
SchemaMetaFieldDef,
|
|
121
124
|
TypeMetaFieldDef,
|
|
@@ -163,4 +166,5 @@ export type {
|
|
|
163
166
|
GraphQLScalarLiteralParser,
|
|
164
167
|
} from './definition';
|
|
165
168
|
|
|
169
|
+
// Validate GraphQL schema.
|
|
166
170
|
export { validateSchema, assertValidSchema } from './validate';
|
package/type/index.mjs
CHANGED
|
@@ -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.
|
|
@@ -23,9 +23,13 @@ GraphQLDirective, // Built-in Directives defined by the Spec
|
|
|
23
23
|
isSpecifiedDirective, specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, // Constant Deprecation Reason
|
|
24
24
|
DEFAULT_DEPRECATION_REASON } from './directives';
|
|
25
25
|
// Common built-in scalar instances.
|
|
26
|
-
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
export { // Predicate
|
|
27
|
+
isSpecifiedScalarType, // Standard GraphQL Scalars
|
|
28
|
+
specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from './scalars';
|
|
29
|
+
export { // Predicate
|
|
30
|
+
isIntrospectionType, // GraphQL Types for introspection.
|
|
31
|
+
introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // "Enum" of Type Kinds
|
|
32
|
+
TypeKind, // Meta-field definitions.
|
|
30
33
|
SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from './introspection';
|
|
31
|
-
|
|
34
|
+
// Validate GraphQL schema.
|
|
35
|
+
export { validateSchema, assertValidSchema } from './validate';
|
package/type/introspection.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.introspectionTypes = exports.TypeNameMetaFieldDef = exports.TypeMetaFiel
|
|
|
8
8
|
|
|
9
9
|
var _objectValues = _interopRequireDefault(require("../polyfills/objectValues"));
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
12
12
|
|
|
13
13
|
var _astFromValue = require("../utilities/astFromValue");
|
|
14
14
|
|
|
@@ -23,7 +23,7 @@ var _directiveLocation = require("../language/directiveLocation");
|
|
|
23
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Copyright (c)
|
|
26
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
27
27
|
*
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -220,9 +220,12 @@ var __Type = new _definition.GraphQLObjectType({
|
|
|
220
220
|
return TypeKind.LIST;
|
|
221
221
|
} else if ((0, _definition.isNonNullType)(type)) {
|
|
222
222
|
return TypeKind.NON_NULL;
|
|
223
|
-
}
|
|
223
|
+
} // Not reachable. All possible types have been considered.
|
|
224
|
+
|
|
225
|
+
/* istanbul ignore next */
|
|
226
|
+
|
|
224
227
|
|
|
225
|
-
throw new Error(
|
|
228
|
+
throw new Error("Unexpected type: \"".concat((0, _inspect.default)(type), "\"."));
|
|
226
229
|
}
|
|
227
230
|
},
|
|
228
231
|
name: {
|
|
@@ -399,7 +402,8 @@ var __InputValue = new _definition.GraphQLObjectType({
|
|
|
399
402
|
type: _scalars.GraphQLString,
|
|
400
403
|
description: 'A GraphQL-formatted string representing the default value for this ' + 'input value.',
|
|
401
404
|
resolve: function resolve(inputVal) {
|
|
402
|
-
|
|
405
|
+
var valueAST = (0, _astFromValue.astFromValue)(inputVal.defaultValue, inputVal.type);
|
|
406
|
+
return valueAST ? (0, _printer.print)(valueAST) : null;
|
|
403
407
|
}
|
|
404
408
|
}
|
|
405
409
|
};
|
|
@@ -540,7 +544,8 @@ var introspectionTypes = [__Schema, __Directive, __DirectiveLocation, __Type, __
|
|
|
540
544
|
exports.introspectionTypes = introspectionTypes;
|
|
541
545
|
|
|
542
546
|
function isIntrospectionType(type) {
|
|
543
|
-
return (0, _definition.isNamedType)(type) &&
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
+
return (0, _definition.isNamedType)(type) && introspectionTypes.some(function (_ref8) {
|
|
548
|
+
var name = _ref8.name;
|
|
549
|
+
return type.name === name;
|
|
550
|
+
});
|
|
551
|
+
}
|