graphql 15.3.0 → 15.5.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 +10 -0
- package/error/GraphQLError.js +8 -8
- package/error/GraphQLError.js.flow +2 -3
- package/error/GraphQLError.mjs +2 -2
- package/error/formatError.js +1 -1
- package/error/formatError.js.flow +0 -1
- package/error/index.js +4 -4
- package/error/index.js.flow +0 -1
- package/error/locatedError.d.ts +2 -2
- package/error/locatedError.js +10 -5
- package/error/locatedError.js.flow +10 -4
- package/error/locatedError.mjs +6 -4
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.js.flow +0 -1
- package/execution/execute.d.ts +0 -15
- package/execution/execute.js +104 -104
- package/execution/execute.js.flow +119 -133
- package/execution/execute.mjs +86 -82
- package/execution/index.js +3 -3
- package/execution/index.js.flow +0 -1
- package/execution/values.js +11 -11
- package/execution/values.js.flow +0 -1
- package/graphql.js +5 -5
- package/graphql.js.flow +0 -1
- package/index.d.ts +1 -0
- package/index.js +9 -9
- package/index.js.flow +0 -1
- package/jsutils/ObjMap.js.flow +0 -1
- package/jsutils/Path.js.flow +0 -1
- package/jsutils/PromiseOrValue.js.flow +0 -1
- package/jsutils/defineInspect.js +2 -2
- package/jsutils/defineInspect.js.flow +0 -1
- package/jsutils/devAssert.js.flow +0 -1
- package/jsutils/didYouMean.js.flow +0 -1
- package/jsutils/identityFunc.js.flow +0 -1
- package/jsutils/inspect.js +1 -2
- package/jsutils/inspect.js.flow +10 -8
- package/jsutils/inspect.mjs +1 -1
- package/jsutils/instanceOf.js +15 -9
- package/jsutils/instanceOf.js.flow +13 -7
- package/jsutils/instanceOf.mjs +13 -5
- package/jsutils/invariant.js.flow +0 -1
- package/jsutils/isAsyncIterable.js +13 -0
- package/jsutils/isAsyncIterable.js.flow +14 -0
- package/jsutils/isAsyncIterable.mjs +10 -0
- package/jsutils/isObjectLike.js.flow +0 -1
- package/jsutils/isPromise.js.flow +0 -1
- package/jsutils/keyMap.js.flow +0 -1
- package/jsutils/keyValMap.js.flow +0 -1
- package/jsutils/mapValue.js +1 -1
- package/jsutils/mapValue.js.flow +0 -1
- package/jsutils/memoize3.js +2 -5
- package/jsutils/memoize3.js.flow +2 -5
- package/jsutils/memoize3.mjs +2 -5
- package/jsutils/naturalCompare.js +69 -0
- package/jsutils/naturalCompare.js.flow +59 -0
- package/jsutils/naturalCompare.mjs +61 -0
- package/jsutils/nodejsCustomInspectSymbol.js.flow +0 -1
- package/jsutils/printPathArray.js.flow +0 -1
- package/jsutils/promiseForObject.js.flow +0 -1
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.js.flow +0 -1
- package/jsutils/safeArrayFrom.js +73 -0
- package/jsutils/safeArrayFrom.js.flow +59 -0
- package/jsutils/safeArrayFrom.mjs +66 -0
- package/jsutils/suggestionList.js +5 -1
- package/jsutils/suggestionList.js.flow +3 -2
- package/jsutils/suggestionList.mjs +3 -1
- package/jsutils/toObjMap.js +1 -1
- package/jsutils/toObjMap.js.flow +0 -1
- package/language/ast.js +1 -1
- package/language/ast.js.flow +0 -1
- package/language/blockString.d.ts +1 -1
- package/language/blockString.js +53 -32
- package/language/blockString.js.flow +51 -36
- package/language/blockString.mjs +54 -33
- package/language/directiveLocation.js.flow +0 -1
- package/language/experimentalOnlineParser/grammar.d.ts +1006 -0
- package/language/experimentalOnlineParser/grammar.js +987 -0
- package/language/experimentalOnlineParser/grammar.js.flow +1000 -0
- package/language/experimentalOnlineParser/grammar.mjs +980 -0
- package/language/experimentalOnlineParser/index.d.ts +6 -0
- package/language/experimentalOnlineParser/index.js +31 -0
- package/language/experimentalOnlineParser/index.js.flow +7 -0
- package/language/experimentalOnlineParser/index.mjs +1 -0
- package/language/experimentalOnlineParser/onlineParser.d.ts +125 -0
- package/language/experimentalOnlineParser/onlineParser.js +604 -0
- package/language/experimentalOnlineParser/onlineParser.js.flow +723 -0
- package/language/experimentalOnlineParser/onlineParser.mjs +587 -0
- package/language/index.js +12 -12
- package/language/index.js.flow +0 -1
- package/language/kinds.js.flow +0 -1
- package/language/lexer.js +242 -183
- package/language/lexer.js.flow +188 -184
- package/language/lexer.mjs +238 -179
- package/language/location.js.flow +0 -1
- package/language/parser.js +73 -68
- package/language/parser.js.flow +62 -57
- package/language/parser.mjs +64 -60
- package/language/predicates.js +1 -1
- package/language/predicates.js.flow +0 -1
- package/language/printLocation.js +1 -1
- package/language/printLocation.js.flow +0 -1
- package/language/printer.js +20 -13
- package/language/printer.js.flow +26 -25
- package/language/printer.mjs +18 -11
- package/language/source.d.ts +7 -0
- package/language/source.js +20 -3
- package/language/source.js.flow +21 -3
- package/language/source.mjs +14 -1
- package/language/tokenKind.js.flow +0 -1
- package/language/visitor.js +2 -2
- package/language/visitor.js.flow +0 -1
- package/package.json +2 -3
- package/polyfills/arrayFrom.js +2 -2
- package/polyfills/arrayFrom.js.flow +1 -2
- package/polyfills/arrayFrom.mjs +1 -1
- package/polyfills/find.js +1 -1
- package/polyfills/find.js.flow +1 -2
- package/polyfills/find.mjs +1 -1
- package/polyfills/isFinite.js +1 -1
- package/polyfills/isFinite.js.flow +1 -2
- package/polyfills/isFinite.mjs +1 -1
- package/polyfills/isInteger.js +1 -1
- package/polyfills/isInteger.js.flow +1 -2
- package/polyfills/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +1 -1
- package/polyfills/objectEntries.js.flow +1 -2
- package/polyfills/objectEntries.mjs +1 -1
- package/polyfills/objectValues.js +1 -1
- package/polyfills/objectValues.js.flow +1 -2
- package/polyfills/objectValues.mjs +1 -1
- package/polyfills/symbols.js +3 -5
- package/polyfills/symbols.js.flow +9 -6
- package/polyfills/symbols.mjs +3 -5
- package/subscription/index.js +1 -1
- package/subscription/index.js.flow +0 -1
- package/subscription/mapAsyncIterator.js +2 -2
- package/subscription/mapAsyncIterator.js.flow +8 -9
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +61 -73
- package/subscription/subscribe.js.flow +71 -85
- package/subscription/subscribe.mjs +53 -65
- package/type/definition.d.ts +16 -6
- package/type/definition.js +37 -32
- package/type/definition.js.flow +93 -63
- package/type/definition.mjs +19 -14
- package/type/directives.js +17 -16
- package/type/directives.js.flow +20 -13
- package/type/directives.mjs +6 -5
- package/type/index.js +6 -6
- package/type/index.js.flow +0 -1
- package/type/introspection.js +86 -65
- package/type/introspection.js.flow +75 -43
- package/type/introspection.mjs +79 -58
- package/type/scalars.js +9 -9
- package/type/scalars.js.flow +1 -2
- package/type/scalars.mjs +1 -1
- package/type/schema.js +13 -13
- package/type/schema.js.flow +2 -3
- package/type/schema.mjs +1 -1
- package/type/validate.js +52 -19
- package/type/validate.js.flow +54 -8
- package/type/validate.mjs +43 -9
- package/utilities/TypeInfo.js +7 -7
- package/utilities/TypeInfo.js.flow +1 -2
- package/utilities/assertValidName.js +2 -2
- package/utilities/assertValidName.js.flow +0 -1
- package/utilities/astFromValue.js +14 -16
- package/utilities/astFromValue.js.flow +6 -7
- package/utilities/astFromValue.mjs +6 -7
- package/utilities/buildASTSchema.js +17 -27
- package/utilities/buildASTSchema.js.flow +5 -21
- package/utilities/buildASTSchema.mjs +11 -21
- package/utilities/buildClientSchema.js +16 -15
- package/utilities/buildClientSchema.js.flow +28 -12
- package/utilities/buildClientSchema.mjs +5 -4
- package/utilities/coerceInputValue.js +17 -18
- package/utilities/coerceInputValue.js.flow +12 -10
- package/utilities/coerceInputValue.mjs +7 -7
- package/utilities/concatAST.js +9 -8
- package/utilities/concatAST.js.flow +8 -8
- package/utilities/concatAST.mjs +9 -6
- package/utilities/extendSchema.js +26 -19
- package/utilities/extendSchema.js.flow +19 -7
- package/utilities/extendSchema.mjs +8 -1
- package/utilities/findBreakingChanges.js +15 -11
- package/utilities/findBreakingChanges.js.flow +6 -3
- package/utilities/findBreakingChanges.mjs +5 -2
- package/utilities/findDeprecatedUsages.js +2 -2
- package/utilities/findDeprecatedUsages.js.flow +0 -1
- package/utilities/getIntrospectionQuery.d.ts +6 -0
- package/utilities/getIntrospectionQuery.js +8 -2
- package/utilities/getIntrospectionQuery.js.flow +17 -5
- package/utilities/getIntrospectionQuery.mjs +8 -2
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.js.flow +0 -1
- package/utilities/getOperationRootType.js +1 -1
- package/utilities/getOperationRootType.js.flow +0 -1
- package/utilities/index.d.ts +3 -0
- package/utilities/index.js +22 -22
- package/utilities/index.js.flow +0 -1
- package/utilities/introspectionFromSchema.js +7 -5
- package/utilities/introspectionFromSchema.js.flow +2 -1
- package/utilities/introspectionFromSchema.mjs +3 -1
- package/utilities/lexicographicSortSchema.js +13 -9
- package/utilities/lexicographicSortSchema.js.flow +21 -13
- package/utilities/lexicographicSortSchema.mjs +5 -2
- package/utilities/printSchema.js +15 -16
- package/utilities/printSchema.js.flow +23 -16
- package/utilities/printSchema.mjs +5 -6
- package/utilities/separateOperations.js +46 -42
- package/utilities/separateOperations.js.flow +46 -37
- package/utilities/separateOperations.mjs +44 -40
- package/utilities/stripIgnoredCharacters.js +6 -16
- package/utilities/stripIgnoredCharacters.js.flow +4 -13
- package/utilities/stripIgnoredCharacters.mjs +3 -10
- package/utilities/typeComparators.js +1 -1
- package/utilities/typeComparators.js.flow +0 -1
- package/utilities/typeFromAST.js +6 -6
- package/utilities/typeFromAST.js.flow +2 -3
- package/utilities/typeFromAST.mjs +2 -2
- package/utilities/typedQueryDocumentNode.d.ts +20 -0
- package/utilities/valueFromAST.js +6 -6
- package/utilities/valueFromAST.js.flow +4 -2
- package/utilities/valueFromASTUntyped.js +4 -4
- package/utilities/valueFromASTUntyped.js.flow +0 -1
- package/validation/ValidationContext.js +3 -3
- package/validation/ValidationContext.js.flow +3 -4
- package/validation/index.js +38 -38
- package/validation/index.js.flow +0 -1
- package/validation/rules/ExecutableDefinitions.js +1 -1
- package/validation/rules/ExecutableDefinitions.js.flow +0 -1
- package/validation/rules/ExecutableDefinitionsRule.js +3 -3
- package/validation/rules/ExecutableDefinitionsRule.js.flow +0 -1
- package/validation/rules/FieldsOnCorrectTypeRule.js +8 -6
- package/validation/rules/FieldsOnCorrectTypeRule.js.flow +2 -2
- package/validation/rules/FieldsOnCorrectTypeRule.mjs +2 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.js +4 -4
- package/validation/rules/FragmentsOnCompositeTypesRule.js.flow +0 -1
- package/validation/rules/KnownArgumentNamesRule.js +5 -5
- package/validation/rules/KnownArgumentNamesRule.js.flow +1 -1
- package/validation/rules/KnownDirectivesRule.js +6 -6
- package/validation/rules/KnownDirectivesRule.js.flow +4 -3
- package/validation/rules/KnownFragmentNamesRule.js +1 -1
- package/validation/rules/KnownFragmentNamesRule.js.flow +0 -1
- package/validation/rules/KnownTypeNamesRule.js +6 -6
- package/validation/rules/KnownTypeNamesRule.js.flow +1 -2
- package/validation/rules/LoneAnonymousOperationRule.js +2 -2
- package/validation/rules/LoneAnonymousOperationRule.js.flow +0 -1
- package/validation/rules/LoneSchemaDefinition.js +1 -1
- package/validation/rules/LoneSchemaDefinition.js.flow +0 -1
- package/validation/rules/LoneSchemaDefinitionRule.js +1 -1
- package/validation/rules/LoneSchemaDefinitionRule.js.flow +0 -1
- package/validation/rules/NoFragmentCyclesRule.js +1 -1
- package/validation/rules/NoFragmentCyclesRule.js.flow +1 -2
- package/validation/rules/NoUndefinedVariablesRule.js +1 -1
- package/validation/rules/NoUndefinedVariablesRule.js.flow +0 -1
- package/validation/rules/NoUnusedFragmentsRule.js +1 -1
- package/validation/rules/NoUnusedFragmentsRule.js.flow +0 -1
- package/validation/rules/NoUnusedVariablesRule.js +1 -1
- package/validation/rules/NoUnusedVariablesRule.js.flow +0 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +20 -20
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +14 -14
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +12 -12
- package/validation/rules/PossibleFragmentSpreadsRule.js +5 -5
- package/validation/rules/PossibleFragmentSpreadsRule.js.flow +5 -2
- package/validation/rules/PossibleTypeExtensions.js +1 -1
- package/validation/rules/PossibleTypeExtensions.js.flow +0 -1
- package/validation/rules/PossibleTypeExtensionsRule.js +8 -8
- package/validation/rules/PossibleTypeExtensionsRule.js.flow +6 -4
- package/validation/rules/ProvidedRequiredArgumentsRule.js +7 -7
- package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +4 -3
- package/validation/rules/ScalarLeafsRule.js +3 -3
- package/validation/rules/ScalarLeafsRule.js.flow +0 -1
- package/validation/rules/SingleFieldSubscriptionsRule.js +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.js.flow +0 -1
- package/validation/rules/UniqueArgumentNamesRule.js +1 -1
- package/validation/rules/UniqueArgumentNamesRule.js.flow +0 -1
- package/validation/rules/UniqueDirectiveNames.js +1 -1
- package/validation/rules/UniqueDirectiveNames.js.flow +0 -1
- package/validation/rules/UniqueDirectiveNamesRule.js +2 -2
- package/validation/rules/UniqueDirectiveNamesRule.js.flow +0 -1
- package/validation/rules/UniqueDirectiveNamesRule.mjs +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.js +4 -4
- package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +0 -1
- package/validation/rules/UniqueEnumValueNames.js +1 -1
- package/validation/rules/UniqueEnumValueNames.js.flow +0 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +2 -2
- package/validation/rules/UniqueEnumValueNamesRule.js.flow +7 -2
- package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +0 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -3
- package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +13 -4
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js.flow +0 -1
- package/validation/rules/UniqueInputFieldNamesRule.js +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.js.flow +0 -1
- package/validation/rules/UniqueOperationNamesRule.js +1 -1
- package/validation/rules/UniqueOperationNamesRule.js.flow +0 -1
- package/validation/rules/UniqueOperationTypes.js +1 -1
- package/validation/rules/UniqueOperationTypes.js.flow +0 -1
- package/validation/rules/UniqueOperationTypesRule.js +1 -1
- package/validation/rules/UniqueOperationTypesRule.js.flow +7 -2
- package/validation/rules/UniqueTypeNames.js +1 -1
- package/validation/rules/UniqueTypeNames.js.flow +0 -1
- package/validation/rules/UniqueTypeNamesRule.js +2 -2
- package/validation/rules/UniqueTypeNamesRule.js.flow +0 -1
- package/validation/rules/UniqueTypeNamesRule.mjs +1 -1
- package/validation/rules/UniqueVariableNamesRule.js +1 -1
- package/validation/rules/UniqueVariableNamesRule.js.flow +0 -1
- package/validation/rules/ValuesOfCorrectTypeRule.js +8 -8
- package/validation/rules/ValuesOfCorrectTypeRule.js.flow +0 -1
- package/validation/rules/VariablesAreInputTypesRule.js +4 -4
- package/validation/rules/VariablesAreInputTypesRule.js.flow +0 -1
- package/validation/rules/VariablesInAllowedPositionRule.js +6 -6
- package/validation/rules/VariablesInAllowedPositionRule.js.flow +0 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.js +47 -9
- package/validation/rules/custom/NoDeprecatedCustomRule.js.flow +56 -13
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs +43 -8
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +3 -3
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +0 -1
- package/validation/specifiedRules.js +33 -33
- package/validation/specifiedRules.js.flow +0 -1
- package/validation/validate.js +7 -7
- package/validation/validate.js.flow +4 -5
- package/version.js +3 -3
- package/version.js.flow +3 -4
- package/version.mjs +3 -3
- package/jsutils/isCollection.js +0 -47
- package/jsutils/isCollection.js.flow +0 -39
- package/jsutils/isCollection.mjs +0 -40
- package/polyfills/flatMap.js +0 -30
- package/polyfills/flatMap.js.flow +0 -28
- package/polyfills/flatMap.mjs +0 -23
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import type { ObjMap } from '../jsutils/ObjMap';
|
|
4
3
|
|
|
5
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
DocumentNode,
|
|
6
|
+
OperationDefinitionNode,
|
|
7
|
+
SelectionSetNode,
|
|
8
|
+
} from '../language/ast';
|
|
6
9
|
import { Kind } from '../language/kinds';
|
|
7
10
|
import { visit } from '../language/visitor';
|
|
8
11
|
|
|
@@ -15,36 +18,35 @@ import { visit } from '../language/visitor';
|
|
|
15
18
|
export function separateOperations(
|
|
16
19
|
documentAST: DocumentNode,
|
|
17
20
|
): ObjMap<DocumentNode> {
|
|
18
|
-
const operations = [];
|
|
21
|
+
const operations: Array<OperationDefinitionNode> = [];
|
|
19
22
|
const depGraph: DepGraph = Object.create(null);
|
|
20
|
-
let fromName;
|
|
21
23
|
|
|
22
24
|
// Populate metadata and build a dependency graph.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dependents = depGraph[fromName] = Object.create(null);
|
|
36
|
-
}
|
|
37
|
-
dependents[toName] = true;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
25
|
+
for (const definitionNode of documentAST.definitions) {
|
|
26
|
+
switch (definitionNode.kind) {
|
|
27
|
+
case Kind.OPERATION_DEFINITION:
|
|
28
|
+
operations.push(definitionNode);
|
|
29
|
+
break;
|
|
30
|
+
case Kind.FRAGMENT_DEFINITION:
|
|
31
|
+
depGraph[definitionNode.name.value] = collectDependencies(
|
|
32
|
+
definitionNode.selectionSet,
|
|
33
|
+
);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
40
37
|
|
|
41
38
|
// For each operation, produce a new synthesized AST which includes only what
|
|
42
39
|
// is necessary for completing that operation.
|
|
43
40
|
const separatedDocumentASTs = Object.create(null);
|
|
44
41
|
for (const operation of operations) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
const dependencies = new Set();
|
|
43
|
+
|
|
44
|
+
for (const fragmentName of collectDependencies(operation.selectionSet)) {
|
|
45
|
+
collectTransitiveDependencies(dependencies, depGraph, fragmentName);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Provides the empty string for anonymous operations.
|
|
49
|
+
const operationName = operation.name ? operation.name.value : '';
|
|
48
50
|
|
|
49
51
|
// The list of definition nodes to be included for this operation, sorted
|
|
50
52
|
// to retain the same order as the original document.
|
|
@@ -54,7 +56,7 @@ export function separateOperations(
|
|
|
54
56
|
(node) =>
|
|
55
57
|
node === operation ||
|
|
56
58
|
(node.kind === Kind.FRAGMENT_DEFINITION &&
|
|
57
|
-
dependencies
|
|
59
|
+
dependencies.has(node.name.value)),
|
|
58
60
|
),
|
|
59
61
|
};
|
|
60
62
|
}
|
|
@@ -62,27 +64,34 @@ export function separateOperations(
|
|
|
62
64
|
return separatedDocumentASTs;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
type DepGraph = ObjMap<
|
|
66
|
-
|
|
67
|
-
// Provides the empty string for anonymous operations.
|
|
68
|
-
function opName(operation: OperationDefinitionNode): string {
|
|
69
|
-
return operation.name ? operation.name.value : '';
|
|
70
|
-
}
|
|
67
|
+
type DepGraph = ObjMap<Array<string>>;
|
|
71
68
|
|
|
72
69
|
// From a dependency graph, collects a list of transitive dependencies by
|
|
73
70
|
// recursing through a dependency graph.
|
|
74
71
|
function collectTransitiveDependencies(
|
|
75
|
-
collected:
|
|
72
|
+
collected: Set<string>,
|
|
76
73
|
depGraph: DepGraph,
|
|
77
74
|
fromName: string,
|
|
78
75
|
): void {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
if (!collected.has(fromName)) {
|
|
77
|
+
collected.add(fromName);
|
|
78
|
+
|
|
79
|
+
const immediateDeps = depGraph[fromName];
|
|
80
|
+
if (immediateDeps !== undefined) {
|
|
81
|
+
for (const toName of immediateDeps) {
|
|
84
82
|
collectTransitiveDependencies(collected, depGraph, toName);
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
}
|
|
87
|
+
|
|
88
|
+
function collectDependencies(selectionSet: SelectionSetNode): Array<string> {
|
|
89
|
+
const dependencies = [];
|
|
90
|
+
|
|
91
|
+
visit(selectionSet, {
|
|
92
|
+
FragmentSpread(node) {
|
|
93
|
+
dependencies.push(node.name.value);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
return dependencies;
|
|
97
|
+
}
|
|
@@ -9,72 +9,76 @@ import { visit } from "../language/visitor.mjs";
|
|
|
9
9
|
|
|
10
10
|
export function separateOperations(documentAST) {
|
|
11
11
|
var operations = [];
|
|
12
|
-
var depGraph = Object.create(null);
|
|
13
|
-
var fromName; // Populate metadata and build a dependency graph.
|
|
14
|
-
|
|
15
|
-
visit(documentAST, {
|
|
16
|
-
OperationDefinition: function OperationDefinition(node) {
|
|
17
|
-
fromName = opName(node);
|
|
18
|
-
operations.push(node);
|
|
19
|
-
},
|
|
20
|
-
FragmentDefinition: function FragmentDefinition(node) {
|
|
21
|
-
fromName = node.name.value;
|
|
22
|
-
},
|
|
23
|
-
FragmentSpread: function FragmentSpread(node) {
|
|
24
|
-
var toName = node.name.value;
|
|
25
|
-
var dependents = depGraph[fromName];
|
|
12
|
+
var depGraph = Object.create(null); // Populate metadata and build a dependency graph.
|
|
26
13
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
14
|
+
for (var _i2 = 0, _documentAST$definiti2 = documentAST.definitions; _i2 < _documentAST$definiti2.length; _i2++) {
|
|
15
|
+
var definitionNode = _documentAST$definiti2[_i2];
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
switch (definitionNode.kind) {
|
|
18
|
+
case Kind.OPERATION_DEFINITION:
|
|
19
|
+
operations.push(definitionNode);
|
|
20
|
+
break;
|
|
21
|
+
|
|
22
|
+
case Kind.FRAGMENT_DEFINITION:
|
|
23
|
+
depGraph[definitionNode.name.value] = collectDependencies(definitionNode.selectionSet);
|
|
24
|
+
break;
|
|
32
25
|
}
|
|
33
|
-
}
|
|
26
|
+
} // For each operation, produce a new synthesized AST which includes only what
|
|
34
27
|
// is necessary for completing that operation.
|
|
35
28
|
|
|
29
|
+
|
|
36
30
|
var separatedDocumentASTs = Object.create(null);
|
|
37
31
|
|
|
38
|
-
var _loop = function _loop(
|
|
39
|
-
var operation = operations[
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
var _loop = function _loop(_i4) {
|
|
33
|
+
var operation = operations[_i4];
|
|
34
|
+
var dependencies = new Set();
|
|
35
|
+
|
|
36
|
+
for (var _i6 = 0, _collectDependencies2 = collectDependencies(operation.selectionSet); _i6 < _collectDependencies2.length; _i6++) {
|
|
37
|
+
var fragmentName = _collectDependencies2[_i6];
|
|
38
|
+
collectTransitiveDependencies(dependencies, depGraph, fragmentName);
|
|
39
|
+
} // Provides the empty string for anonymous operations.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted
|
|
43
43
|
// to retain the same order as the original document.
|
|
44
44
|
|
|
45
45
|
separatedDocumentASTs[operationName] = {
|
|
46
46
|
kind: Kind.DOCUMENT,
|
|
47
47
|
definitions: documentAST.definitions.filter(function (node) {
|
|
48
|
-
return node === operation || node.kind === Kind.FRAGMENT_DEFINITION && dependencies
|
|
48
|
+
return node === operation || node.kind === Kind.FRAGMENT_DEFINITION && dependencies.has(node.name.value);
|
|
49
49
|
})
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
for (var
|
|
54
|
-
_loop(
|
|
53
|
+
for (var _i4 = 0; _i4 < operations.length; _i4++) {
|
|
54
|
+
_loop(_i4);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return separatedDocumentASTs;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
function opName(operation) {
|
|
62
|
-
return operation.name ? operation.name.value : '';
|
|
63
|
-
} // From a dependency graph, collects a list of transitive dependencies by
|
|
60
|
+
// From a dependency graph, collects a list of transitive dependencies by
|
|
64
61
|
// recursing through a dependency graph.
|
|
65
|
-
|
|
66
|
-
|
|
67
62
|
function collectTransitiveDependencies(collected, depGraph, fromName) {
|
|
68
|
-
|
|
63
|
+
if (!collected.has(fromName)) {
|
|
64
|
+
collected.add(fromName);
|
|
65
|
+
var immediateDeps = depGraph[fromName];
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (!collected[toName]) {
|
|
75
|
-
collected[toName] = true;
|
|
67
|
+
if (immediateDeps !== undefined) {
|
|
68
|
+
for (var _i8 = 0; _i8 < immediateDeps.length; _i8++) {
|
|
69
|
+
var toName = immediateDeps[_i8];
|
|
76
70
|
collectTransitiveDependencies(collected, depGraph, toName);
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
}
|
|
80
74
|
}
|
|
75
|
+
|
|
76
|
+
function collectDependencies(selectionSet) {
|
|
77
|
+
var dependencies = [];
|
|
78
|
+
visit(selectionSet, {
|
|
79
|
+
FragmentSpread: function FragmentSpread(node) {
|
|
80
|
+
dependencies.push(node.name.value);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return dependencies;
|
|
84
|
+
}
|
|
@@ -5,17 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.stripIgnoredCharacters = stripIgnoredCharacters;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _source = require("../language/source.js");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _tokenKind = require("../language/tokenKind.js");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _lexer = require("../language/lexer.js");
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _blockString = require("../language/blockString");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
var _blockString = require("../language/blockString.js");
|
|
19
15
|
|
|
20
16
|
/**
|
|
21
17
|
* Strips characters that are not significant to the validity or execution
|
|
@@ -70,12 +66,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
70
66
|
* """Type description""" type Foo{"""Field description""" bar:String}
|
|
71
67
|
*/
|
|
72
68
|
function stripIgnoredCharacters(source) {
|
|
73
|
-
var sourceObj =
|
|
74
|
-
|
|
75
|
-
if (!(sourceObj instanceof _source.Source)) {
|
|
76
|
-
throw new TypeError("Must provide string or Source. Received: ".concat((0, _inspect.default)(sourceObj), "."));
|
|
77
|
-
}
|
|
78
|
-
|
|
69
|
+
var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source);
|
|
79
70
|
var body = sourceObj.body;
|
|
80
71
|
var lexer = new _lexer.Lexer(sourceObj);
|
|
81
72
|
var strippedBody = '';
|
|
@@ -116,9 +107,8 @@ function dedentBlockString(blockStr) {
|
|
|
116
107
|
// skip leading and trailing triple quotations
|
|
117
108
|
var rawStr = blockStr.slice(3, -3);
|
|
118
109
|
var body = (0, _blockString.dedentBlockStringValue)(rawStr);
|
|
119
|
-
var lines = body.split(/\r\n|[\n\r]/g);
|
|
120
110
|
|
|
121
|
-
if ((0, _blockString.getBlockStringIndentation)(
|
|
111
|
+
if ((0, _blockString.getBlockStringIndentation)(body) > 0) {
|
|
122
112
|
body = '\n' + body;
|
|
123
113
|
}
|
|
124
114
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
|
-
import inspect from '../jsutils/inspect';
|
|
4
|
-
|
|
5
|
-
import { Source } from '../language/source';
|
|
2
|
+
import { Source, isSource } from '../language/source';
|
|
6
3
|
import { TokenKind } from '../language/tokenKind';
|
|
7
4
|
import { Lexer, isPunctuatorTokenKind } from '../language/lexer';
|
|
8
5
|
import {
|
|
@@ -63,12 +60,7 @@ import {
|
|
|
63
60
|
* """Type description""" type Foo{"""Field description""" bar:String}
|
|
64
61
|
*/
|
|
65
62
|
export function stripIgnoredCharacters(source: string | Source): string {
|
|
66
|
-
const sourceObj =
|
|
67
|
-
if (!(sourceObj instanceof Source)) {
|
|
68
|
-
throw new TypeError(
|
|
69
|
-
`Must provide string or Source. Received: ${inspect(sourceObj)}.`,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
63
|
+
const sourceObj = isSource(source) ? source : new Source(source);
|
|
72
64
|
|
|
73
65
|
const body = sourceObj.body;
|
|
74
66
|
const lexer = new Lexer(sourceObj);
|
|
@@ -104,13 +96,12 @@ export function stripIgnoredCharacters(source: string | Source): string {
|
|
|
104
96
|
return strippedBody;
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
function dedentBlockString(blockStr) {
|
|
99
|
+
function dedentBlockString(blockStr: string): string {
|
|
108
100
|
// skip leading and trailing triple quotations
|
|
109
101
|
const rawStr = blockStr.slice(3, -3);
|
|
110
102
|
let body = dedentBlockStringValue(rawStr);
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
if (getBlockStringIndentation(lines) > 0) {
|
|
104
|
+
if (getBlockStringIndentation(body) > 0) {
|
|
114
105
|
body = '\n' + body;
|
|
115
106
|
}
|
|
116
107
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Source } from "../language/source.mjs";
|
|
1
|
+
import { Source, isSource } from "../language/source.mjs";
|
|
3
2
|
import { TokenKind } from "../language/tokenKind.mjs";
|
|
4
3
|
import { Lexer, isPunctuatorTokenKind } from "../language/lexer.mjs";
|
|
5
4
|
import { dedentBlockStringValue, getBlockStringIndentation } from "../language/blockString.mjs";
|
|
@@ -57,12 +56,7 @@ import { dedentBlockStringValue, getBlockStringIndentation } from "../language/b
|
|
|
57
56
|
*/
|
|
58
57
|
|
|
59
58
|
export function stripIgnoredCharacters(source) {
|
|
60
|
-
var sourceObj =
|
|
61
|
-
|
|
62
|
-
if (!(sourceObj instanceof Source)) {
|
|
63
|
-
throw new TypeError("Must provide string or Source. Received: ".concat(inspect(sourceObj), "."));
|
|
64
|
-
}
|
|
65
|
-
|
|
59
|
+
var sourceObj = isSource(source) ? source : new Source(source);
|
|
66
60
|
var body = sourceObj.body;
|
|
67
61
|
var lexer = new Lexer(sourceObj);
|
|
68
62
|
var strippedBody = '';
|
|
@@ -103,9 +97,8 @@ function dedentBlockString(blockStr) {
|
|
|
103
97
|
// skip leading and trailing triple quotations
|
|
104
98
|
var rawStr = blockStr.slice(3, -3);
|
|
105
99
|
var body = dedentBlockStringValue(rawStr);
|
|
106
|
-
var lines = body.split(/\r\n|[\n\r]/g);
|
|
107
100
|
|
|
108
|
-
if (getBlockStringIndentation(
|
|
101
|
+
if (getBlockStringIndentation(body) > 0) {
|
|
109
102
|
body = '\n' + body;
|
|
110
103
|
}
|
|
111
104
|
|
|
@@ -7,7 +7,7 @@ exports.isEqualType = isEqualType;
|
|
|
7
7
|
exports.isTypeSubTypeOf = isTypeSubTypeOf;
|
|
8
8
|
exports.doTypesOverlap = doTypesOverlap;
|
|
9
9
|
|
|
10
|
-
var _definition = require("../type/definition");
|
|
10
|
+
var _definition = require("../type/definition.js");
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Provided two types, return true if the types are equal (invariant).
|
package/utilities/typeFromAST.js
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.typeFromAST = typeFromAST;
|
|
7
7
|
|
|
8
|
-
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
8
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect.js"));
|
|
9
9
|
|
|
10
|
-
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
10
|
+
var _invariant = _interopRequireDefault(require("../jsutils/invariant.js"));
|
|
11
11
|
|
|
12
|
-
var _kinds = require("../language/kinds");
|
|
12
|
+
var _kinds = require("../language/kinds.js");
|
|
13
13
|
|
|
14
|
-
var _definition = require("../type/definition");
|
|
14
|
+
var _definition = require("../type/definition.js");
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -21,12 +21,12 @@ function typeFromAST(schema, typeNode) {
|
|
|
21
21
|
|
|
22
22
|
if (typeNode.kind === _kinds.Kind.LIST_TYPE) {
|
|
23
23
|
innerType = typeFromAST(schema, typeNode.type);
|
|
24
|
-
return innerType &&
|
|
24
|
+
return innerType && new _definition.GraphQLList(innerType);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (typeNode.kind === _kinds.Kind.NON_NULL_TYPE) {
|
|
28
28
|
innerType = typeFromAST(schema, typeNode.type);
|
|
29
|
-
return innerType &&
|
|
29
|
+
return innerType && new _definition.GraphQLNonNull(innerType);
|
|
30
30
|
} // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
31
31
|
|
|
32
32
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import inspect from '../jsutils/inspect';
|
|
4
3
|
import invariant from '../jsutils/invariant';
|
|
5
4
|
|
|
@@ -40,11 +39,11 @@ export function typeFromAST(schema, typeNode) {
|
|
|
40
39
|
let innerType;
|
|
41
40
|
if (typeNode.kind === Kind.LIST_TYPE) {
|
|
42
41
|
innerType = typeFromAST(schema, typeNode.type);
|
|
43
|
-
return innerType && GraphQLList(innerType);
|
|
42
|
+
return innerType && new GraphQLList(innerType);
|
|
44
43
|
}
|
|
45
44
|
if (typeNode.kind === Kind.NON_NULL_TYPE) {
|
|
46
45
|
innerType = typeFromAST(schema, typeNode.type);
|
|
47
|
-
return innerType && GraphQLNonNull(innerType);
|
|
46
|
+
return innerType && new GraphQLNonNull(innerType);
|
|
48
47
|
}
|
|
49
48
|
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
50
49
|
if (typeNode.kind === Kind.NAMED_TYPE) {
|
|
@@ -18,12 +18,12 @@ export function typeFromAST(schema, typeNode) {
|
|
|
18
18
|
|
|
19
19
|
if (typeNode.kind === Kind.LIST_TYPE) {
|
|
20
20
|
innerType = typeFromAST(schema, typeNode.type);
|
|
21
|
-
return innerType && GraphQLList(innerType);
|
|
21
|
+
return innerType && new GraphQLList(innerType);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (typeNode.kind === Kind.NON_NULL_TYPE) {
|
|
25
25
|
innerType = typeFromAST(schema, typeNode.type);
|
|
26
|
-
return innerType && GraphQLNonNull(innerType);
|
|
26
|
+
return innerType && new GraphQLNonNull(innerType);
|
|
27
27
|
} // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
28
28
|
|
|
29
29
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DocumentNode, ExecutableDefinitionNode } from '../language/ast';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper type that contains DocumentNode and types that can be deduced from it.
|
|
5
|
+
*/
|
|
6
|
+
export interface TypedQueryDocumentNode<
|
|
7
|
+
TResponseData = Record<string, any>,
|
|
8
|
+
TRequestVariables = Record<string, any>
|
|
9
|
+
> extends DocumentNode {
|
|
10
|
+
readonly definitions: ReadonlyArray<ExecutableDefinitionNode>;
|
|
11
|
+
// FIXME: remove once TS implements proper way to enforce nominal typing
|
|
12
|
+
/**
|
|
13
|
+
* This type is used to ensure that the variables you pass in to the query are assignable to Variables
|
|
14
|
+
* and that the Result is assignable to whatever you pass your result to. The method is never actually
|
|
15
|
+
* implemented, but the type is valid because we list it as optional
|
|
16
|
+
*/
|
|
17
|
+
__ensureTypesOfVariablesAndResultMatching?: (
|
|
18
|
+
variables: TRequestVariables,
|
|
19
|
+
) => TResponseData;
|
|
20
|
+
}
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.valueFromAST = valueFromAST;
|
|
7
7
|
|
|
8
|
-
var _objectValues3 = _interopRequireDefault(require("../polyfills/objectValues"));
|
|
8
|
+
var _objectValues3 = _interopRequireDefault(require("../polyfills/objectValues.js"));
|
|
9
9
|
|
|
10
|
-
var _keyMap = _interopRequireDefault(require("../jsutils/keyMap"));
|
|
10
|
+
var _keyMap = _interopRequireDefault(require("../jsutils/keyMap.js"));
|
|
11
11
|
|
|
12
|
-
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
12
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect.js"));
|
|
13
13
|
|
|
14
|
-
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
14
|
+
var _invariant = _interopRequireDefault(require("../jsutils/invariant.js"));
|
|
15
15
|
|
|
16
|
-
var _kinds = require("../language/kinds");
|
|
16
|
+
var _kinds = require("../language/kinds.js");
|
|
17
17
|
|
|
18
|
-
var _definition = require("../type/definition");
|
|
18
|
+
var _definition = require("../type/definition.js");
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import objectValues from '../polyfills/objectValues';
|
|
4
3
|
|
|
5
4
|
import type { ObjMap } from '../jsutils/ObjMap';
|
|
@@ -154,7 +153,10 @@ export function valueFromAST(
|
|
|
154
153
|
|
|
155
154
|
// Returns true if the provided valueNode is a variable which is not defined
|
|
156
155
|
// in the set of variables.
|
|
157
|
-
function isMissingVariable(
|
|
156
|
+
function isMissingVariable(
|
|
157
|
+
valueNode: ValueNode,
|
|
158
|
+
variables: ?ObjMap<mixed>,
|
|
159
|
+
): boolean {
|
|
158
160
|
return (
|
|
159
161
|
valueNode.kind === Kind.VARIABLE &&
|
|
160
162
|
(variables == null || variables[valueNode.name.value] === undefined)
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.valueFromASTUntyped = valueFromASTUntyped;
|
|
7
7
|
|
|
8
|
-
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
8
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect.js"));
|
|
9
9
|
|
|
10
|
-
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
10
|
+
var _invariant = _interopRequireDefault(require("../jsutils/invariant.js"));
|
|
11
11
|
|
|
12
|
-
var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap"));
|
|
12
|
+
var _keyValMap = _interopRequireDefault(require("../jsutils/keyValMap.js"));
|
|
13
13
|
|
|
14
|
-
var _kinds = require("../language/kinds");
|
|
14
|
+
var _kinds = require("../language/kinds.js");
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ValidationContext = exports.SDLValidationContext = exports.ASTValidationContext = void 0;
|
|
7
7
|
|
|
8
|
-
var _kinds = require("../language/kinds");
|
|
8
|
+
var _kinds = require("../language/kinds.js");
|
|
9
9
|
|
|
10
|
-
var _visitor = require("../language/visitor");
|
|
10
|
+
var _visitor = require("../language/visitor.js");
|
|
11
11
|
|
|
12
|
-
var _TypeInfo = require("../utilities/TypeInfo");
|
|
12
|
+
var _TypeInfo = require("../utilities/TypeInfo.js");
|
|
13
13
|
|
|
14
14
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
15
15
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import type { ObjMap } from '../jsutils/ObjMap';
|
|
4
3
|
|
|
5
4
|
import type { GraphQLError } from '../error/GraphQLError';
|
|
@@ -52,7 +51,7 @@ export class ASTValidationContext {
|
|
|
52
51
|
$ReadOnlyArray<FragmentDefinitionNode>,
|
|
53
52
|
>;
|
|
54
53
|
|
|
55
|
-
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void)
|
|
54
|
+
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void) {
|
|
56
55
|
this._ast = ast;
|
|
57
56
|
this._fragments = undefined;
|
|
58
57
|
this._fragmentSpreads = new Map();
|
|
@@ -143,7 +142,7 @@ export class SDLValidationContext extends ASTValidationContext {
|
|
|
143
142
|
ast: DocumentNode,
|
|
144
143
|
schema: ?GraphQLSchema,
|
|
145
144
|
onError: (err: GraphQLError) => void,
|
|
146
|
-
)
|
|
145
|
+
) {
|
|
147
146
|
super(ast, onError);
|
|
148
147
|
this._schema = schema;
|
|
149
148
|
}
|
|
@@ -169,7 +168,7 @@ export class ValidationContext extends ASTValidationContext {
|
|
|
169
168
|
ast: DocumentNode,
|
|
170
169
|
typeInfo: TypeInfo,
|
|
171
170
|
onError: (err: GraphQLError) => void,
|
|
172
|
-
)
|
|
171
|
+
) {
|
|
173
172
|
super(ast, onError);
|
|
174
173
|
this._schema = schema;
|
|
175
174
|
this._typeInfo = typeInfo;
|