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/error/GraphQLError.js
CHANGED
|
@@ -9,14 +9,8 @@ var _printError = require("./printError");
|
|
|
9
9
|
|
|
10
10
|
var _location = require("../language/location");
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
12
|
+
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); }
|
|
13
|
+
|
|
20
14
|
function GraphQLError( // eslint-disable-line no-redeclare
|
|
21
15
|
message, nodes, source, positions, path, originalError, extensions) {
|
|
22
16
|
// Compute list of blame nodes.
|
|
@@ -62,7 +56,15 @@ message, nodes, source, positions, path, originalError, extensions) {
|
|
|
62
56
|
}, []);
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
var _extensions = extensions
|
|
59
|
+
var _extensions = extensions;
|
|
60
|
+
|
|
61
|
+
if (_extensions == null && originalError != null) {
|
|
62
|
+
var originalExtensions = originalError.extensions;
|
|
63
|
+
|
|
64
|
+
if (originalExtensions != null && _typeof(originalExtensions) === 'object') {
|
|
65
|
+
_extensions = originalExtensions;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
66
68
|
|
|
67
69
|
Object.defineProperties(this, {
|
|
68
70
|
message: {
|
|
@@ -143,4 +145,4 @@ GraphQLError.prototype = Object.create(Error.prototype, {
|
|
|
143
145
|
return (0, _printError.printError)(this);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
});
|
|
148
|
+
});
|
|
@@ -138,7 +138,13 @@ export function GraphQLError( // eslint-disable-line no-redeclare
|
|
|
138
138
|
}, []);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
let _extensions = extensions;
|
|
142
|
+
if (_extensions == null && originalError != null) {
|
|
143
|
+
const originalExtensions = originalError.extensions;
|
|
144
|
+
if (originalExtensions != null && typeof originalExtensions === 'object') {
|
|
145
|
+
_extensions = originalExtensions;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
142
148
|
|
|
143
149
|
Object.defineProperties(this, {
|
|
144
150
|
message: {
|
package/error/GraphQLError.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
5
|
*
|
|
@@ -60,7 +62,15 @@ message, nodes, source, positions, path, originalError, extensions) {
|
|
|
60
62
|
}, []);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
var _extensions = extensions
|
|
65
|
+
var _extensions = extensions;
|
|
66
|
+
|
|
67
|
+
if (_extensions == null && originalError != null) {
|
|
68
|
+
var originalExtensions = originalError.extensions;
|
|
69
|
+
|
|
70
|
+
if (originalExtensions != null && _typeof(originalExtensions) === 'object') {
|
|
71
|
+
_extensions = originalExtensions;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
64
74
|
|
|
65
75
|
Object.defineProperties(this, {
|
|
66
76
|
message: {
|
|
@@ -140,4 +150,4 @@ GraphQLError.prototype = Object.create(Error.prototype, {
|
|
|
140
150
|
return printError(this);
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
|
-
});
|
|
153
|
+
});
|
package/error/formatError.js
CHANGED
package/error/formatError.mjs
CHANGED
package/error/index.js
CHANGED
package/error/index.mjs
CHANGED
|
@@ -10,4 +10,4 @@ export { GraphQLError } from './GraphQLError';
|
|
|
10
10
|
export { syntaxError } from './syntaxError';
|
|
11
11
|
export { locatedError } from './locatedError';
|
|
12
12
|
export { printError } from './printError';
|
|
13
|
-
export { formatError } from './formatError';
|
|
13
|
+
export { formatError } from './formatError';
|
package/error/locatedError.js
CHANGED
|
@@ -29,4 +29,4 @@ function locatedError(originalError, nodes, path) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return new _GraphQLError.GraphQLError(originalError && originalError.message, originalError && originalError.nodes || nodes, originalError && originalError.source, originalError && originalError.positions, path, originalError);
|
|
32
|
-
}
|
|
32
|
+
}
|
package/error/locatedError.mjs
CHANGED
|
@@ -21,4 +21,4 @@ export function locatedError(originalError, nodes, path) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return new GraphQLError(originalError && originalError.message, originalError && originalError.nodes || nodes, originalError && originalError.source, originalError && originalError.positions, path, originalError);
|
|
24
|
-
}
|
|
24
|
+
}
|
package/error/printError.js
CHANGED
package/error/printError.mjs
CHANGED
package/error/syntaxError.js
CHANGED
package/error/syntaxError.mjs
CHANGED
package/execution/execute.js
CHANGED
|
@@ -328,43 +328,49 @@ function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFra
|
|
|
328
328
|
|
|
329
329
|
switch (selection.kind) {
|
|
330
330
|
case _kinds.Kind.FIELD:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
{
|
|
332
|
+
if (!shouldIncludeNode(exeContext, selection)) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
334
335
|
|
|
335
|
-
|
|
336
|
+
var name = getFieldEntryKey(selection);
|
|
336
337
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
if (!fields[name]) {
|
|
339
|
+
fields[name] = [];
|
|
340
|
+
}
|
|
340
341
|
|
|
341
|
-
|
|
342
|
-
|
|
342
|
+
fields[name].push(selection);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
343
345
|
|
|
344
346
|
case _kinds.Kind.INLINE_FRAGMENT:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
{
|
|
348
|
+
if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
348
351
|
|
|
349
|
-
|
|
350
|
-
|
|
352
|
+
collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
351
355
|
|
|
352
356
|
case _kinds.Kind.FRAGMENT_SPREAD:
|
|
353
|
-
|
|
357
|
+
{
|
|
358
|
+
var fragName = selection.name.value;
|
|
354
359
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
358
363
|
|
|
359
|
-
|
|
360
|
-
|
|
364
|
+
visitedFragmentNames[fragName] = true;
|
|
365
|
+
var fragment = exeContext.fragments[fragName];
|
|
361
366
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
367
|
+
if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
365
370
|
|
|
366
|
-
|
|
367
|
-
|
|
371
|
+
collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
368
374
|
}
|
|
369
375
|
}
|
|
370
376
|
|
|
@@ -837,4 +843,4 @@ function getFieldDef(schema, parentType, fieldName) {
|
|
|
837
843
|
}
|
|
838
844
|
|
|
839
845
|
return parentType.getFields()[fieldName];
|
|
840
|
-
}
|
|
846
|
+
}
|
|
@@ -528,7 +528,7 @@ export function collectFields(
|
|
|
528
528
|
for (let i = 0; i < selectionSet.selections.length; i++) {
|
|
529
529
|
const selection = selectionSet.selections[i];
|
|
530
530
|
switch (selection.kind) {
|
|
531
|
-
case Kind.FIELD:
|
|
531
|
+
case Kind.FIELD: {
|
|
532
532
|
if (!shouldIncludeNode(exeContext, selection)) {
|
|
533
533
|
continue;
|
|
534
534
|
}
|
|
@@ -538,7 +538,8 @@ export function collectFields(
|
|
|
538
538
|
}
|
|
539
539
|
fields[name].push(selection);
|
|
540
540
|
break;
|
|
541
|
-
|
|
541
|
+
}
|
|
542
|
+
case Kind.INLINE_FRAGMENT: {
|
|
542
543
|
if (
|
|
543
544
|
!shouldIncludeNode(exeContext, selection) ||
|
|
544
545
|
!doesFragmentConditionMatch(exeContext, selection, runtimeType)
|
|
@@ -553,7 +554,8 @@ export function collectFields(
|
|
|
553
554
|
visitedFragmentNames,
|
|
554
555
|
);
|
|
555
556
|
break;
|
|
556
|
-
|
|
557
|
+
}
|
|
558
|
+
case Kind.FRAGMENT_SPREAD: {
|
|
557
559
|
const fragName = selection.name.value;
|
|
558
560
|
if (
|
|
559
561
|
visitedFragmentNames[fragName] ||
|
|
@@ -577,6 +579,7 @@ export function collectFields(
|
|
|
577
579
|
visitedFragmentNames,
|
|
578
580
|
);
|
|
579
581
|
break;
|
|
582
|
+
}
|
|
580
583
|
}
|
|
581
584
|
}
|
|
582
585
|
return fields;
|
package/execution/execute.mjs
CHANGED
|
@@ -295,43 +295,49 @@ export function collectFields(exeContext, runtimeType, selectionSet, fields, vis
|
|
|
295
295
|
|
|
296
296
|
switch (selection.kind) {
|
|
297
297
|
case Kind.FIELD:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
{
|
|
299
|
+
if (!shouldIncludeNode(exeContext, selection)) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
301
302
|
|
|
302
|
-
|
|
303
|
+
var name = getFieldEntryKey(selection);
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
if (!fields[name]) {
|
|
306
|
+
fields[name] = [];
|
|
307
|
+
}
|
|
307
308
|
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
fields[name].push(selection);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
310
312
|
|
|
311
313
|
case Kind.INLINE_FRAGMENT:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
{
|
|
315
|
+
if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
315
318
|
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
318
322
|
|
|
319
323
|
case Kind.FRAGMENT_SPREAD:
|
|
320
|
-
|
|
324
|
+
{
|
|
325
|
+
var fragName = selection.name.value;
|
|
321
326
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
325
330
|
|
|
326
|
-
|
|
327
|
-
|
|
331
|
+
visitedFragmentNames[fragName] = true;
|
|
332
|
+
var fragment = exeContext.fragments[fragName];
|
|
328
333
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
334
|
+
if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
332
337
|
|
|
333
|
-
|
|
334
|
-
|
|
338
|
+
collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
335
341
|
}
|
|
336
342
|
}
|
|
337
343
|
|
|
@@ -795,4 +801,4 @@ export function getFieldDef(schema, parentType, fieldName) {
|
|
|
795
801
|
}
|
|
796
802
|
|
|
797
803
|
return parentType.getFields()[fieldName];
|
|
798
|
-
}
|
|
804
|
+
}
|
package/execution/index.js
CHANGED
package/execution/index.mjs
CHANGED
package/execution/values.js
CHANGED
|
@@ -160,11 +160,11 @@ function getArgumentValues(def, node, variableValues) {
|
|
|
160
160
|
|
|
161
161
|
if (argumentNode && argumentNode.value.kind === _kinds.Kind.VARIABLE) {
|
|
162
162
|
var variableName = argumentNode.value.name.value;
|
|
163
|
-
hasValue = variableValues && hasOwnProperty(variableValues, variableName);
|
|
164
|
-
isNull = variableValues && variableValues[variableName] === null;
|
|
163
|
+
hasValue = variableValues != null && hasOwnProperty(variableValues, variableName);
|
|
164
|
+
isNull = variableValues != null && variableValues[variableName] === null;
|
|
165
165
|
} else {
|
|
166
166
|
hasValue = argumentNode != null;
|
|
167
|
-
isNull = argumentNode && argumentNode.value.kind === _kinds.Kind.NULL;
|
|
167
|
+
isNull = argumentNode != null && argumentNode.value.kind === _kinds.Kind.NULL;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (!hasValue && argDef.defaultValue !== undefined) {
|
|
@@ -237,4 +237,4 @@ function getDirectiveValues(directiveDef, node, variableValues) {
|
|
|
237
237
|
|
|
238
238
|
function hasOwnProperty(obj, prop) {
|
|
239
239
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
240
|
-
}
|
|
240
|
+
}
|
package/execution/values.js.flow
CHANGED
|
@@ -146,11 +146,12 @@ export function getArgumentValues(
|
|
|
146
146
|
let isNull;
|
|
147
147
|
if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
148
148
|
const variableName = argumentNode.value.name.value;
|
|
149
|
-
hasValue =
|
|
150
|
-
|
|
149
|
+
hasValue =
|
|
150
|
+
variableValues != null && hasOwnProperty(variableValues, variableName);
|
|
151
|
+
isNull = variableValues != null && variableValues[variableName] === null;
|
|
151
152
|
} else {
|
|
152
153
|
hasValue = argumentNode != null;
|
|
153
|
-
isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
|
|
154
|
+
isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
if (!hasValue && argDef.defaultValue !== undefined) {
|
package/execution/values.mjs
CHANGED
|
@@ -137,11 +137,11 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
137
137
|
|
|
138
138
|
if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
139
139
|
var variableName = argumentNode.value.name.value;
|
|
140
|
-
hasValue = variableValues && hasOwnProperty(variableValues, variableName);
|
|
141
|
-
isNull = variableValues && variableValues[variableName] === null;
|
|
140
|
+
hasValue = variableValues != null && hasOwnProperty(variableValues, variableName);
|
|
141
|
+
isNull = variableValues != null && variableValues[variableName] === null;
|
|
142
142
|
} else {
|
|
143
143
|
hasValue = argumentNode != null;
|
|
144
|
-
isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
|
|
144
|
+
isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (!hasValue && argDef.defaultValue !== undefined) {
|
|
@@ -213,4 +213,4 @@ export function getDirectiveValues(directiveDef, node, variableValues) {
|
|
|
213
213
|
|
|
214
214
|
function hasOwnProperty(obj, prop) {
|
|
215
215
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
216
|
-
}
|
|
216
|
+
}
|
package/graphql.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.graphql = graphql;
|
|
7
7
|
exports.graphqlSync = graphqlSync;
|
|
8
8
|
|
|
9
|
+
var _isPromise = _interopRequireDefault(require("./jsutils/isPromise"));
|
|
10
|
+
|
|
9
11
|
var _validate = require("./type/validate");
|
|
10
12
|
|
|
11
13
|
var _parser = require("./language/parser");
|
|
@@ -14,6 +16,8 @@ var _validate2 = require("./validation/validate");
|
|
|
14
16
|
|
|
15
17
|
var _execute = require("./execution/execute");
|
|
16
18
|
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
17
21
|
/**
|
|
18
22
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
23
|
*
|
|
@@ -45,7 +49,7 @@ function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValu
|
|
|
45
49
|
// Extract arguments from object args if provided.
|
|
46
50
|
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
|
|
47
51
|
|
|
48
|
-
if (
|
|
52
|
+
if ((0, _isPromise.default)(result)) {
|
|
49
53
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -84,4 +88,4 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
|
|
|
84
88
|
|
|
85
89
|
|
|
86
90
|
return (0, _execute.execute)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
|
|
87
|
-
}
|
|
91
|
+
}
|
package/graphql.js.flow
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import isPromise from './jsutils/isPromise';
|
|
10
11
|
import { validateSchema } from './type/validate';
|
|
11
12
|
import { parse } from './language/parser';
|
|
12
13
|
import { validate } from './validation/validate';
|
|
@@ -175,7 +176,7 @@ export function graphqlSync(
|
|
|
175
176
|
);
|
|
176
177
|
|
|
177
178
|
// Assert that the execution was synchronous.
|
|
178
|
-
if (result
|
|
179
|
+
if (isPromise(result)) {
|
|
179
180
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
180
181
|
}
|
|
181
182
|
|
package/graphql.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
+
import isPromise from './jsutils/isPromise';
|
|
9
10
|
import { validateSchema } from './type/validate';
|
|
10
11
|
import { parse } from './language/parser';
|
|
11
12
|
import { validate } from './validation/validate';
|
|
@@ -32,7 +33,7 @@ export function graphqlSync(argsOrSchema, source, rootValue, contextValue, varia
|
|
|
32
33
|
// Extract arguments from object args if provided.
|
|
33
34
|
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
|
|
34
35
|
|
|
35
|
-
if (result
|
|
36
|
+
if (isPromise(result)) {
|
|
36
37
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -71,4 +72,4 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
|
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
return execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
|
|
74
|
-
}
|
|
75
|
+
}
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -98,4 +98,4 @@ isEqualType, isTypeSubTypeOf, doTypesOverlap, // Asserts a string is a valid Gra
|
|
|
98
98
|
assertValidName, // Determine if a string is a valid GraphQL name.
|
|
99
99
|
isValidNameError, // Compares two GraphQLSchemas and detects breaking changes.
|
|
100
100
|
BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges, // Report all deprecated usage within a GraphQL document.
|
|
101
|
-
findDeprecatedUsages } from './utilities';
|
|
101
|
+
findDeprecatedUsages } from './utilities';
|
package/jsutils/ObjMap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
package/jsutils/ObjMap.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/jsutils/dedent.js
CHANGED
package/jsutils/dedent.mjs
CHANGED
package/jsutils/defineToJSON.js
CHANGED
package/jsutils/defineToJSON.mjs
CHANGED
package/jsutils/inspect.js
CHANGED
|
@@ -47,7 +47,7 @@ function formatObjectValue(value, previouslySeenValues) {
|
|
|
47
47
|
if (value) {
|
|
48
48
|
var customInspectFn = getCustomFn(value);
|
|
49
49
|
|
|
50
|
-
if (customInspectFn) {
|
|
50
|
+
if (customInspectFn !== undefined) {
|
|
51
51
|
// $FlowFixMe(>=0.90.0)
|
|
52
52
|
var customValue = customInspectFn.call(value); // check for infinite recursion
|
|
53
53
|
|
|
@@ -132,4 +132,4 @@ function getObjectTag(object) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
return tag;
|
|
135
|
-
}
|
|
135
|
+
}
|
package/jsutils/inspect.js.flow
CHANGED
|
@@ -41,7 +41,7 @@ function formatObjectValue(value, previouslySeenValues) {
|
|
|
41
41
|
if (value) {
|
|
42
42
|
const customInspectFn = getCustomFn(value);
|
|
43
43
|
|
|
44
|
-
if (customInspectFn) {
|
|
44
|
+
if (customInspectFn !== undefined) {
|
|
45
45
|
// $FlowFixMe(>=0.90.0)
|
|
46
46
|
const customValue = customInspectFn.call(value);
|
|
47
47
|
|
package/jsutils/inspect.mjs
CHANGED
|
@@ -45,7 +45,7 @@ function formatObjectValue(value, previouslySeenValues) {
|
|
|
45
45
|
if (value) {
|
|
46
46
|
var customInspectFn = getCustomFn(value);
|
|
47
47
|
|
|
48
|
-
if (customInspectFn) {
|
|
48
|
+
if (customInspectFn !== undefined) {
|
|
49
49
|
// $FlowFixMe(>=0.90.0)
|
|
50
50
|
var customValue = customInspectFn.call(value); // check for infinite recursion
|
|
51
51
|
|
|
@@ -130,4 +130,4 @@ function getObjectTag(object) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
return tag;
|
|
133
|
-
}
|
|
133
|
+
}
|
package/jsutils/instanceOf.js
CHANGED
package/jsutils/instanceOf.mjs
CHANGED
package/jsutils/invariant.js
CHANGED
|
@@ -14,8 +14,10 @@ exports.default = invariant;
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
function invariant(condition, message) {
|
|
17
|
+
var booleanCondition = Boolean(condition);
|
|
17
18
|
/* istanbul ignore else */
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
if (!booleanCondition) {
|
|
19
21
|
throw new Error(message);
|
|
20
22
|
}
|
|
21
|
-
}
|
|
23
|
+
}
|