graphql 14.4.2 → 14.5.3
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/README.md +5 -10
- package/error/GraphQLError.d.ts +87 -0
- package/error/GraphQLError.js +7 -45
- package/error/GraphQLError.js.flow +1 -0
- package/error/GraphQLError.mjs +7 -45
- package/error/formatError.d.ts +39 -0
- package/error/formatError.js +5 -2
- package/error/formatError.js.flow +27 -3
- package/error/formatError.mjs +5 -2
- package/error/index.d.ts +4 -0
- package/error/locatedError.d.ts +13 -0
- package/error/locatedError.js.flow +2 -1
- package/error/locatedError.mjs +1 -1
- package/error/syntaxError.d.ts +12 -0
- package/error/syntaxError.js.flow +1 -0
- package/execution/execute.d.ts +190 -0
- package/execution/execute.js +55 -89
- package/execution/execute.js.flow +95 -133
- package/execution/execute.mjs +75 -80
- package/execution/index.d.ts +11 -0
- package/execution/index.js +8 -6
- package/execution/index.js.flow +3 -6
- package/execution/index.mjs +2 -1
- package/execution/values.d.ts +68 -0
- package/execution/values.js +119 -128
- package/execution/values.js.flow +150 -127
- package/execution/values.mjs +117 -125
- package/graphql.d.ts +88 -0
- package/graphql.js +5 -5
- package/graphql.js.flow +9 -5
- package/graphql.mjs +41 -1
- package/index.d.ts +446 -0
- package/index.js +6 -0
- package/index.js.flow +3 -1
- package/index.mjs +2 -1
- package/jsutils/ObjMap.js.flow +6 -0
- package/jsutils/Path.d.ts +14 -0
- package/jsutils/Path.js +33 -0
- package/jsutils/Path.js.flow +26 -0
- package/jsutils/Path.mjs +24 -0
- package/jsutils/PromiseOrValue.d.ts +1 -0
- package/jsutils/dedent.js +6 -24
- package/jsutils/dedent.mjs +6 -24
- package/jsutils/defineToStringTag.js.flow +1 -1
- package/jsutils/devAssert.js +14 -0
- package/jsutils/devAssert.js.flow +8 -0
- package/jsutils/devAssert.mjs +7 -0
- package/jsutils/inspect.js +1 -1
- package/jsutils/inspect.js.flow +1 -1
- package/jsutils/inspect.mjs +1 -1
- package/jsutils/invariant.js +1 -2
- package/jsutils/invariant.js.flow +2 -3
- package/jsutils/invariant.mjs +1 -2
- package/jsutils/mapValue.js +6 -24
- package/jsutils/mapValue.js.flow +2 -1
- package/jsutils/mapValue.mjs +6 -24
- package/jsutils/printPathArray.js +15 -0
- package/jsutils/printPathArray.js.flow +14 -0
- package/jsutils/printPathArray.mjs +8 -0
- package/jsutils/suggestionList.js +14 -34
- package/jsutils/suggestionList.js.flow +4 -6
- package/jsutils/suggestionList.mjs +14 -34
- package/jsutils/toObjMap.js +28 -0
- package/jsutils/toObjMap.js.flow +26 -0
- package/jsutils/toObjMap.mjs +18 -0
- package/language/ast.d.ts +573 -0
- package/language/blockString.d.ts +21 -0
- package/language/directiveLocation.d.ts +35 -0
- package/language/index.d.ts +96 -0
- package/language/kinds.d.ts +77 -0
- package/language/lexer.d.ts +60 -0
- package/language/lexer.js +2 -12
- package/language/lexer.js.flow +6 -12
- package/language/lexer.mjs +1 -9
- package/language/location.d.ts +15 -0
- package/language/parser.d.ts +89 -0
- package/language/parser.js +1329 -1302
- package/language/parser.js.flow +1289 -1298
- package/language/parser.mjs +1326 -1297
- package/language/predicates.d.ts +36 -0
- package/language/predicates.js.flow +1 -1
- package/language/printLocation.d.ts +16 -0
- package/language/printLocation.js.flow +1 -1
- package/language/printer.d.ts +7 -0
- package/language/printer.js.flow +1 -1
- package/language/source.d.ts +19 -0
- package/language/source.js +3 -3
- package/language/source.js.flow +3 -3
- package/language/source.mjs +3 -3
- package/language/tokenKind.d.ts +35 -0
- package/language/visitor.d.ts +264 -0
- package/language/visitor.js +2 -2
- package/language/visitor.js.flow +3 -1
- package/language/visitor.mjs +2 -2
- package/package.json +1 -1
- package/polyfills/find.js +2 -2
- package/polyfills/find.js.flow +1 -2
- package/polyfills/find.mjs +2 -2
- package/polyfills/flatMap.js +3 -3
- package/polyfills/flatMap.js.flow +2 -3
- package/polyfills/flatMap.mjs +3 -3
- package/subscription/asyncIteratorReject.d.ts +6 -0
- package/subscription/index.d.ts +5 -0
- package/subscription/mapAsyncIterator.d.ts +9 -0
- package/subscription/mapAsyncIterator.js.flow +1 -0
- package/subscription/subscribe.d.ts +86 -0
- package/subscription/subscribe.js +29 -10
- package/subscription/subscribe.js.flow +45 -24
- package/subscription/subscribe.mjs +27 -9
- package/tsutils/Maybe.d.ts +4 -0
- package/type/definition.d.ts +805 -0
- package/type/definition.js +154 -70
- package/type/definition.js.flow +217 -160
- package/type/definition.mjs +149 -66
- package/type/directives.d.ts +72 -0
- package/type/directives.js +20 -12
- package/type/directives.js.flow +34 -19
- package/type/directives.mjs +17 -10
- package/type/index.d.ts +155 -0
- package/type/index.js.flow +2 -2
- package/type/introspection.d.ts +40 -0
- package/type/introspection.js +24 -10
- package/type/introspection.js.flow +29 -8
- package/type/introspection.mjs +23 -10
- package/type/scalars.d.ts +11 -0
- package/type/scalars.js +2 -2
- package/type/scalars.js.flow +4 -1
- package/type/scalars.mjs +2 -2
- package/type/schema.d.ts +108 -0
- package/type/schema.js +74 -151
- package/type/schema.js.flow +75 -73
- package/type/schema.mjs +75 -149
- package/type/validate.d.ts +19 -0
- package/type/validate.js +227 -486
- package/type/validate.js.flow +13 -8
- package/type/validate.mjs +218 -477
- package/utilities/TypeInfo.d.ts +49 -0
- package/utilities/TypeInfo.js.flow +9 -6
- package/utilities/assertValidName.d.ts +15 -0
- package/utilities/assertValidName.js +3 -3
- package/utilities/assertValidName.js.flow +3 -2
- package/utilities/assertValidName.mjs +2 -2
- package/utilities/astFromValue.d.ts +25 -0
- package/utilities/astFromValue.js +22 -38
- package/utilities/astFromValue.js.flow +7 -4
- package/utilities/astFromValue.mjs +19 -36
- package/utilities/buildASTSchema.d.ts +114 -0
- package/utilities/buildASTSchema.js +37 -68
- package/utilities/buildASTSchema.js.flow +32 -30
- package/utilities/buildASTSchema.mjs +32 -64
- package/utilities/buildClientSchema.d.ts +21 -0
- package/utilities/buildClientSchema.js +23 -15
- package/utilities/buildClientSchema.js.flow +17 -16
- package/utilities/buildClientSchema.mjs +20 -12
- package/utilities/coerceInputValue.d.ts +17 -0
- package/utilities/coerceInputValue.js +161 -0
- package/utilities/coerceInputValue.js.flow +214 -0
- package/utilities/coerceInputValue.mjs +142 -0
- package/utilities/coerceValue.d.ts +23 -0
- package/utilities/coerceValue.js +21 -199
- package/utilities/coerceValue.js.flow +31 -223
- package/utilities/coerceValue.mjs +20 -195
- package/utilities/concatAST.d.ts +8 -0
- package/utilities/concatAST.js.flow +1 -0
- package/utilities/extendSchema.d.ts +45 -0
- package/utilities/extendSchema.js +64 -131
- package/utilities/extendSchema.js.flow +27 -24
- package/utilities/extendSchema.mjs +61 -129
- package/utilities/findBreakingChanges.d.ts +64 -0
- package/utilities/findBreakingChanges.js +194 -619
- package/utilities/findBreakingChanges.js.flow +8 -5
- package/utilities/findBreakingChanges.mjs +194 -619
- package/utilities/findDeprecatedUsages.d.ts +13 -0
- package/utilities/findDeprecatedUsages.js.flow +4 -1
- package/utilities/getOperationAST.d.ts +12 -0
- package/utilities/getOperationAST.js +13 -31
- package/utilities/getOperationAST.mjs +13 -31
- package/utilities/getOperationRootType.d.ts +14 -0
- package/utilities/getOperationRootType.js.flow +2 -0
- package/utilities/index.d.ts +127 -0
- package/utilities/index.js +8 -0
- package/utilities/index.js.flow +4 -1
- package/utilities/index.mjs +3 -1
- package/utilities/introspectionFromSchema.d.ts +16 -0
- package/utilities/introspectionFromSchema.js +5 -3
- package/utilities/introspectionFromSchema.js.flow +4 -2
- package/utilities/introspectionFromSchema.mjs +4 -2
- package/utilities/introspectionQuery.d.ts +177 -0
- package/utilities/isValidJSValue.d.ts +8 -0
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.js.flow +3 -2
- package/utilities/isValidJSValue.mjs +2 -2
- package/utilities/isValidLiteralValue.d.ts +15 -0
- package/utilities/isValidLiteralValue.js +4 -4
- package/utilities/isValidLiteralValue.js.flow +8 -4
- package/utilities/isValidLiteralValue.mjs +2 -2
- package/utilities/lexicographicSortSchema.d.ts +6 -0
- package/utilities/lexicographicSortSchema.js +11 -8
- package/utilities/lexicographicSortSchema.js.flow +5 -3
- package/utilities/lexicographicSortSchema.mjs +9 -7
- package/utilities/schemaPrinter.d.ts +30 -0
- package/utilities/schemaPrinter.js +15 -32
- package/utilities/schemaPrinter.js.flow +14 -10
- package/utilities/schemaPrinter.mjs +14 -32
- package/utilities/separateOperations.d.ts +11 -0
- package/utilities/separateOperations.js +6 -6
- package/utilities/separateOperations.js.flow +2 -1
- package/utilities/separateOperations.mjs +6 -6
- package/utilities/stripIgnoredCharacters.d.ts +55 -0
- package/utilities/stripIgnoredCharacters.js.flow +1 -0
- package/utilities/typeComparators.d.ts +32 -0
- package/utilities/typeComparators.js.flow +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.d.ts +29 -0
- package/utilities/typeFromAST.js +5 -3
- package/utilities/typeFromAST.js.flow +5 -3
- package/utilities/typeFromAST.mjs +14 -3
- package/utilities/valueFromAST.d.ts +29 -0
- package/utilities/valueFromAST.js +40 -74
- package/utilities/valueFromAST.js.flow +7 -4
- package/utilities/valueFromAST.mjs +39 -74
- package/utilities/valueFromASTUntyped.d.ts +23 -0
- package/utilities/valueFromASTUntyped.js +4 -3
- package/utilities/valueFromASTUntyped.js.flow +3 -2
- package/utilities/valueFromASTUntyped.mjs +3 -3
- package/validation/ValidationContext.d.ts +96 -0
- package/validation/ValidationContext.js +38 -86
- package/validation/ValidationContext.js.flow +22 -7
- package/validation/ValidationContext.mjs +37 -85
- package/validation/index.d.ts +126 -0
- package/validation/rules/ExecutableDefinitions.d.ts +14 -0
- package/validation/rules/ExecutableDefinitions.js +4 -23
- package/validation/rules/ExecutableDefinitions.js.flow +4 -2
- package/validation/rules/ExecutableDefinitions.mjs +4 -23
- package/validation/rules/FieldsOnCorrectType.d.ts +17 -0
- package/validation/rules/FieldsOnCorrectType.js +21 -57
- package/validation/rules/FieldsOnCorrectType.js.flow +7 -3
- package/validation/rules/FieldsOnCorrectType.mjs +21 -57
- package/validation/rules/FragmentsOnCompositeTypes.d.ts +20 -0
- package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -1
- package/validation/rules/KnownArgumentNames.d.ts +28 -0
- package/validation/rules/KnownArgumentNames.js +26 -79
- package/validation/rules/KnownArgumentNames.js.flow +10 -6
- package/validation/rules/KnownArgumentNames.mjs +22 -75
- package/validation/rules/KnownDirectives.d.ts +19 -0
- package/validation/rules/KnownDirectives.js +12 -48
- package/validation/rules/KnownDirectives.js.flow +8 -5
- package/validation/rules/KnownDirectives.mjs +12 -48
- package/validation/rules/KnownFragmentNames.d.ts +12 -0
- package/validation/rules/KnownFragmentNames.js.flow +2 -1
- package/validation/rules/KnownTypeNames.d.ts +15 -0
- package/validation/rules/KnownTypeNames.js +6 -24
- package/validation/rules/KnownTypeNames.js.flow +10 -6
- package/validation/rules/KnownTypeNames.mjs +6 -24
- package/validation/rules/LoneAnonymousOperation.d.ts +14 -0
- package/validation/rules/LoneAnonymousOperation.js.flow +3 -1
- package/validation/rules/LoneSchemaDefinition.d.ts +13 -0
- package/validation/rules/LoneSchemaDefinition.js.flow +2 -1
- package/validation/rules/NoFragmentCycles.d.ts +9 -0
- package/validation/rules/NoFragmentCycles.js +17 -35
- package/validation/rules/NoFragmentCycles.js.flow +4 -2
- package/validation/rules/NoFragmentCycles.mjs +17 -35
- package/validation/rules/NoUndefinedVariables.d.ts +16 -0
- package/validation/rules/NoUndefinedVariables.js +6 -24
- package/validation/rules/NoUndefinedVariables.js.flow +2 -1
- package/validation/rules/NoUndefinedVariables.mjs +6 -24
- package/validation/rules/NoUnusedFragments.d.ts +12 -0
- package/validation/rules/NoUnusedFragments.js +7 -25
- package/validation/rules/NoUnusedFragments.js.flow +2 -1
- package/validation/rules/NoUnusedFragments.mjs +7 -25
- package/validation/rules/NoUnusedVariables.d.ts +16 -0
- package/validation/rules/NoUnusedVariables.js +6 -24
- package/validation/rules/NoUnusedVariables.js.flow +2 -1
- package/validation/rules/NoUnusedVariables.mjs +6 -24
- package/validation/rules/OverlappingFieldsCanBeMerged.d.ts +24 -0
- package/validation/rules/OverlappingFieldsCanBeMerged.js +27 -46
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -8
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +25 -44
- package/validation/rules/PossibleFragmentSpreads.d.ts +22 -0
- package/validation/rules/PossibleFragmentSpreads.js +2 -2
- package/validation/rules/PossibleFragmentSpreads.js.flow +8 -3
- package/validation/rules/PossibleFragmentSpreads.mjs +2 -2
- package/validation/rules/PossibleTypeExtensions.d.ts +21 -0
- package/validation/rules/PossibleTypeExtensions.js +4 -22
- package/validation/rules/PossibleTypeExtensions.js.flow +6 -2
- package/validation/rules/PossibleTypeExtensions.mjs +4 -22
- package/validation/rules/ProvidedRequiredArguments.d.ts +29 -0
- package/validation/rules/ProvidedRequiredArguments.js +27 -79
- package/validation/rules/ProvidedRequiredArguments.js.flow +12 -8
- package/validation/rules/ProvidedRequiredArguments.mjs +25 -77
- package/validation/rules/ScalarLeafs.d.ts +20 -0
- package/validation/rules/ScalarLeafs.js.flow +6 -2
- package/validation/rules/SingleFieldSubscriptions.d.ts +14 -0
- package/validation/rules/SingleFieldSubscriptions.js.flow +4 -2
- package/validation/rules/UniqueArgumentNames.d.ts +12 -0
- package/validation/rules/UniqueArgumentNames.js.flow +2 -1
- package/validation/rules/UniqueDirectiveNames.d.ts +13 -0
- package/validation/rules/UniqueDirectiveNames.js.flow +2 -1
- package/validation/rules/UniqueDirectivesPerLocation.d.ts +14 -0
- package/validation/rules/UniqueDirectivesPerLocation.js +15 -69
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +7 -4
- package/validation/rules/UniqueDirectivesPerLocation.mjs +15 -69
- package/validation/rules/UniqueEnumValueNames.d.ts +19 -0
- package/validation/rules/UniqueEnumValueNames.js +10 -28
- package/validation/rules/UniqueEnumValueNames.js.flow +2 -1
- package/validation/rules/UniqueEnumValueNames.mjs +10 -28
- package/validation/rules/UniqueFieldDefinitionNames.d.ts +21 -0
- package/validation/rules/UniqueFieldDefinitionNames.js +9 -27
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +2 -1
- package/validation/rules/UniqueFieldDefinitionNames.mjs +9 -27
- package/validation/rules/UniqueFragmentNames.d.ts +11 -0
- package/validation/rules/UniqueFragmentNames.js.flow +2 -1
- package/validation/rules/UniqueInputFieldNames.d.ts +14 -0
- package/validation/rules/UniqueInputFieldNames.js.flow +2 -1
- package/validation/rules/UniqueOperationNames.d.ts +11 -0
- package/validation/rules/UniqueOperationNames.js.flow +2 -1
- package/validation/rules/UniqueOperationTypes.d.ts +13 -0
- package/validation/rules/UniqueOperationTypes.js +11 -30
- package/validation/rules/UniqueOperationTypes.js.flow +2 -1
- package/validation/rules/UniqueOperationTypes.mjs +10 -29
- package/validation/rules/UniqueTypeNames.d.ts +13 -0
- package/validation/rules/UniqueTypeNames.js.flow +3 -1
- package/validation/rules/UniqueVariableNames.d.ts +11 -0
- package/validation/rules/UniqueVariableNames.js.flow +4 -2
- package/validation/rules/ValuesOfCorrectType.d.ts +34 -0
- package/validation/rules/ValuesOfCorrectType.js +16 -34
- package/validation/rules/ValuesOfCorrectType.js.flow +11 -6
- package/validation/rules/ValuesOfCorrectType.mjs +12 -30
- package/validation/rules/VariablesAreInputTypes.d.ts +15 -0
- package/validation/rules/VariablesAreInputTypes.js.flow +6 -2
- package/validation/rules/VariablesInAllowedPosition.d.ts +15 -0
- package/validation/rules/VariablesInAllowedPosition.js +22 -40
- package/validation/rules/VariablesInAllowedPosition.js.flow +8 -3
- package/validation/rules/VariablesInAllowedPosition.mjs +18 -36
- package/validation/specifiedRules.d.ts +98 -0
- package/validation/validate.d.ts +56 -0
- package/validation/validate.js +35 -7
- package/validation/validate.js.flow +51 -9
- package/validation/validate.mjs +30 -7
- package/version.d.ts +14 -0
- package/version.js +3 -3
- package/version.js.flow +3 -3
- package/version.mjs +3 -3
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import Maybe from '../tsutils/Maybe';
|
|
2
|
+
import { GraphQLError } from '../error';
|
|
3
|
+
import { ASTVisitor } from '../language/visitor';
|
|
4
|
+
import {
|
|
5
|
+
DocumentNode,
|
|
6
|
+
OperationDefinitionNode,
|
|
7
|
+
VariableNode,
|
|
8
|
+
SelectionSetNode,
|
|
9
|
+
FragmentSpreadNode,
|
|
10
|
+
FragmentDefinitionNode,
|
|
11
|
+
} from '../language/ast';
|
|
12
|
+
import { GraphQLSchema } from '../type/schema';
|
|
13
|
+
import { GraphQLDirective } from '../type/directives';
|
|
14
|
+
import {
|
|
15
|
+
GraphQLInputType,
|
|
16
|
+
GraphQLOutputType,
|
|
17
|
+
GraphQLCompositeType,
|
|
18
|
+
GraphQLField,
|
|
19
|
+
GraphQLArgument,
|
|
20
|
+
} from '../type/definition';
|
|
21
|
+
import { TypeInfo } from '../utilities/TypeInfo';
|
|
22
|
+
|
|
23
|
+
type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
|
|
24
|
+
type VariableUsage = {
|
|
25
|
+
readonly node: VariableNode;
|
|
26
|
+
readonly type: Maybe<GraphQLInputType>;
|
|
27
|
+
readonly defaultValue: Maybe<any>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An instance of this class is passed as the "this" context to all validators,
|
|
32
|
+
* allowing access to commonly useful contextual information from within a
|
|
33
|
+
* validation rule.
|
|
34
|
+
*/
|
|
35
|
+
export class ASTValidationContext {
|
|
36
|
+
constructor(ast: DocumentNode);
|
|
37
|
+
|
|
38
|
+
reportError(error: GraphQLError): undefined;
|
|
39
|
+
|
|
40
|
+
getErrors(): ReadonlyArray<GraphQLError>;
|
|
41
|
+
|
|
42
|
+
getDocument(): DocumentNode;
|
|
43
|
+
|
|
44
|
+
getFragment(name: string): Maybe<FragmentDefinitionNode>;
|
|
45
|
+
|
|
46
|
+
getFragmentSpreads(node: SelectionSetNode): ReadonlyArray<FragmentSpreadNode>;
|
|
47
|
+
|
|
48
|
+
getRecursivelyReferencedFragments(
|
|
49
|
+
operation: OperationDefinitionNode,
|
|
50
|
+
): ReadonlyArray<FragmentDefinitionNode>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class SDLValidationContext extends ASTValidationContext {
|
|
54
|
+
constructor(
|
|
55
|
+
ast: DocumentNode,
|
|
56
|
+
schema: Maybe<GraphQLSchema>,
|
|
57
|
+
onError?: (err: GraphQLError) => void,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
getSchema(): Maybe<GraphQLSchema>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type SDLValidationRule = (context: SDLValidationContext) => ASTVisitor;
|
|
64
|
+
|
|
65
|
+
export class ValidationContext extends ASTValidationContext {
|
|
66
|
+
constructor(
|
|
67
|
+
schema: GraphQLSchema,
|
|
68
|
+
ast: DocumentNode,
|
|
69
|
+
typeInfo: TypeInfo,
|
|
70
|
+
onError?: (err: GraphQLError) => void,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
getSchema(): GraphQLSchema;
|
|
74
|
+
|
|
75
|
+
getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray<VariableUsage>;
|
|
76
|
+
|
|
77
|
+
getRecursivelyReferencedFragments(
|
|
78
|
+
operation: OperationDefinitionNode,
|
|
79
|
+
): ReadonlyArray<FragmentDefinitionNode>;
|
|
80
|
+
|
|
81
|
+
getType(): Maybe<GraphQLOutputType>;
|
|
82
|
+
|
|
83
|
+
getParentType(): Maybe<GraphQLCompositeType>;
|
|
84
|
+
|
|
85
|
+
getInputType(): Maybe<GraphQLInputType>;
|
|
86
|
+
|
|
87
|
+
getParentInputType(): Maybe<GraphQLInputType>;
|
|
88
|
+
|
|
89
|
+
getFieldDef(): Maybe<GraphQLField<any, any>>;
|
|
90
|
+
|
|
91
|
+
getDirective(): Maybe<GraphQLDirective>;
|
|
92
|
+
|
|
93
|
+
getArgument(): Maybe<GraphQLArgument>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type ValidationRule = (context: ValidationContext) => ASTVisitor;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ValidationContext = exports.SDLValidationContext = exports.ASTValidationContext = void 0;
|
|
7
7
|
|
|
8
|
-
var _visitor = require("../language/visitor");
|
|
9
|
-
|
|
10
8
|
var _kinds = require("../language/kinds");
|
|
11
9
|
|
|
10
|
+
var _visitor = require("../language/visitor");
|
|
11
|
+
|
|
12
12
|
var _TypeInfo = require("../utilities/TypeInfo");
|
|
13
13
|
|
|
14
14
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
@@ -21,19 +21,25 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea
|
|
|
21
21
|
var ASTValidationContext =
|
|
22
22
|
/*#__PURE__*/
|
|
23
23
|
function () {
|
|
24
|
-
function ASTValidationContext(ast) {
|
|
24
|
+
function ASTValidationContext(ast, onError) {
|
|
25
25
|
this._ast = ast;
|
|
26
26
|
this._errors = [];
|
|
27
27
|
this._fragments = undefined;
|
|
28
28
|
this._fragmentSpreads = new Map();
|
|
29
29
|
this._recursivelyReferencedFragments = new Map();
|
|
30
|
+
this._onError = onError;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
var _proto = ASTValidationContext.prototype;
|
|
33
34
|
|
|
34
35
|
_proto.reportError = function reportError(error) {
|
|
35
36
|
this._errors.push(error);
|
|
36
|
-
|
|
37
|
+
|
|
38
|
+
if (this._onError) {
|
|
39
|
+
this._onError(error);
|
|
40
|
+
}
|
|
41
|
+
} // @deprecated: use onError callback instead - will be removed in v15.
|
|
42
|
+
;
|
|
37
43
|
|
|
38
44
|
_proto.getErrors = function getErrors() {
|
|
39
45
|
return this._errors;
|
|
@@ -68,32 +74,14 @@ function () {
|
|
|
68
74
|
|
|
69
75
|
while (setsToVisit.length !== 0) {
|
|
70
76
|
var set = setsToVisit.pop();
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) {
|
|
80
|
-
spreads.push(selection);
|
|
81
|
-
} else if (selection.selectionSet) {
|
|
82
|
-
setsToVisit.push(selection.selectionSet);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (err) {
|
|
86
|
-
_didIteratorError = true;
|
|
87
|
-
_iteratorError = err;
|
|
88
|
-
} finally {
|
|
89
|
-
try {
|
|
90
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
91
|
-
_iterator.return();
|
|
92
|
-
}
|
|
93
|
-
} finally {
|
|
94
|
-
if (_didIteratorError) {
|
|
95
|
-
throw _iteratorError;
|
|
96
|
-
}
|
|
77
|
+
|
|
78
|
+
for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) {
|
|
79
|
+
var selection = _set$selections2[_i2];
|
|
80
|
+
|
|
81
|
+
if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) {
|
|
82
|
+
spreads.push(selection);
|
|
83
|
+
} else if (selection.selectionSet) {
|
|
84
|
+
setsToVisit.push(selection.selectionSet);
|
|
97
85
|
}
|
|
98
86
|
}
|
|
99
87
|
}
|
|
@@ -114,36 +102,18 @@ function () {
|
|
|
114
102
|
|
|
115
103
|
while (nodesToVisit.length !== 0) {
|
|
116
104
|
var node = nodesToVisit.pop();
|
|
117
|
-
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (fragment) {
|
|
131
|
-
fragments.push(fragment);
|
|
132
|
-
nodesToVisit.push(fragment.selectionSet);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
} catch (err) {
|
|
137
|
-
_didIteratorError2 = true;
|
|
138
|
-
_iteratorError2 = err;
|
|
139
|
-
} finally {
|
|
140
|
-
try {
|
|
141
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
142
|
-
_iterator2.return();
|
|
143
|
-
}
|
|
144
|
-
} finally {
|
|
145
|
-
if (_didIteratorError2) {
|
|
146
|
-
throw _iteratorError2;
|
|
105
|
+
|
|
106
|
+
for (var _i4 = 0, _this$getFragmentSpre2 = this.getFragmentSpreads(node); _i4 < _this$getFragmentSpre2.length; _i4++) {
|
|
107
|
+
var spread = _this$getFragmentSpre2[_i4];
|
|
108
|
+
var fragName = spread.name.value;
|
|
109
|
+
|
|
110
|
+
if (collectedNames[fragName] !== true) {
|
|
111
|
+
collectedNames[fragName] = true;
|
|
112
|
+
var fragment = this.getFragment(fragName);
|
|
113
|
+
|
|
114
|
+
if (fragment) {
|
|
115
|
+
fragments.push(fragment);
|
|
116
|
+
nodesToVisit.push(fragment.selectionSet);
|
|
147
117
|
}
|
|
148
118
|
}
|
|
149
119
|
}
|
|
@@ -165,10 +135,10 @@ var SDLValidationContext =
|
|
|
165
135
|
function (_ASTValidationContext) {
|
|
166
136
|
_inheritsLoose(SDLValidationContext, _ASTValidationContext);
|
|
167
137
|
|
|
168
|
-
function SDLValidationContext(ast, schema) {
|
|
138
|
+
function SDLValidationContext(ast, schema, onError) {
|
|
169
139
|
var _this;
|
|
170
140
|
|
|
171
|
-
_this = _ASTValidationContext.call(this, ast) || this;
|
|
141
|
+
_this = _ASTValidationContext.call(this, ast, onError) || this;
|
|
172
142
|
_this._schema = schema;
|
|
173
143
|
return _this;
|
|
174
144
|
}
|
|
@@ -189,10 +159,10 @@ var ValidationContext =
|
|
|
189
159
|
function (_ASTValidationContext2) {
|
|
190
160
|
_inheritsLoose(ValidationContext, _ASTValidationContext2);
|
|
191
161
|
|
|
192
|
-
function ValidationContext(schema, ast, typeInfo) {
|
|
162
|
+
function ValidationContext(schema, ast, typeInfo, onError) {
|
|
193
163
|
var _this2;
|
|
194
164
|
|
|
195
|
-
_this2 = _ASTValidationContext2.call(this, ast) || this;
|
|
165
|
+
_this2 = _ASTValidationContext2.call(this, ast, onError) || this;
|
|
196
166
|
_this2._schema = schema;
|
|
197
167
|
_this2._typeInfo = typeInfo;
|
|
198
168
|
_this2._variableUsages = new Map();
|
|
@@ -237,28 +207,10 @@ function (_ASTValidationContext2) {
|
|
|
237
207
|
|
|
238
208
|
if (!usages) {
|
|
239
209
|
usages = this.getVariableUsages(operation);
|
|
240
|
-
|
|
241
|
-
var
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
try {
|
|
245
|
-
for (var _iterator3 = this.getRecursivelyReferencedFragments(operation)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
246
|
-
var frag = _step3.value;
|
|
247
|
-
usages = usages.concat(this.getVariableUsages(frag));
|
|
248
|
-
}
|
|
249
|
-
} catch (err) {
|
|
250
|
-
_didIteratorError3 = true;
|
|
251
|
-
_iteratorError3 = err;
|
|
252
|
-
} finally {
|
|
253
|
-
try {
|
|
254
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
255
|
-
_iterator3.return();
|
|
256
|
-
}
|
|
257
|
-
} finally {
|
|
258
|
-
if (_didIteratorError3) {
|
|
259
|
-
throw _iteratorError3;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
210
|
+
|
|
211
|
+
for (var _i6 = 0, _this$getRecursivelyR2 = this.getRecursivelyReferencedFragments(operation); _i6 < _this$getRecursivelyR2.length; _i6++) {
|
|
212
|
+
var frag = _this$getRecursivelyR2[_i6];
|
|
213
|
+
usages = usages.concat(this.getVariableUsages(frag));
|
|
262
214
|
}
|
|
263
215
|
|
|
264
216
|
this._recursiveVariableUsages.set(operation, usages);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
3
|
import { type ObjMap } from '../jsutils/ObjMap';
|
|
4
|
+
|
|
4
5
|
import { type GraphQLError } from '../error/GraphQLError';
|
|
5
|
-
|
|
6
|
+
|
|
6
7
|
import { Kind } from '../language/kinds';
|
|
8
|
+
import { type ASTVisitor, visit, visitWithTypeInfo } from '../language/visitor';
|
|
7
9
|
import {
|
|
8
10
|
type DocumentNode,
|
|
9
11
|
type OperationDefinitionNode,
|
|
@@ -12,7 +14,9 @@ import {
|
|
|
12
14
|
type FragmentSpreadNode,
|
|
13
15
|
type FragmentDefinitionNode,
|
|
14
16
|
} from '../language/ast';
|
|
17
|
+
|
|
15
18
|
import { type GraphQLSchema } from '../type/schema';
|
|
19
|
+
import { type GraphQLDirective } from '../type/directives';
|
|
16
20
|
import {
|
|
17
21
|
type GraphQLInputType,
|
|
18
22
|
type GraphQLOutputType,
|
|
@@ -20,7 +24,7 @@ import {
|
|
|
20
24
|
type GraphQLField,
|
|
21
25
|
type GraphQLArgument,
|
|
22
26
|
} from '../type/definition';
|
|
23
|
-
|
|
27
|
+
|
|
24
28
|
import { TypeInfo } from '../utilities/TypeInfo';
|
|
25
29
|
|
|
26
30
|
type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
|
|
@@ -37,6 +41,7 @@ type VariableUsage = {|
|
|
|
37
41
|
*/
|
|
38
42
|
export class ASTValidationContext {
|
|
39
43
|
_ast: DocumentNode;
|
|
44
|
+
_onError: ?(err: GraphQLError) => void;
|
|
40
45
|
_errors: Array<GraphQLError>;
|
|
41
46
|
_fragments: ?ObjMap<FragmentDefinitionNode>;
|
|
42
47
|
_fragmentSpreads: Map<SelectionSetNode, $ReadOnlyArray<FragmentSpreadNode>>;
|
|
@@ -45,18 +50,23 @@ export class ASTValidationContext {
|
|
|
45
50
|
$ReadOnlyArray<FragmentDefinitionNode>,
|
|
46
51
|
>;
|
|
47
52
|
|
|
48
|
-
constructor(ast: DocumentNode): void {
|
|
53
|
+
constructor(ast: DocumentNode, onError?: (err: GraphQLError) => void): void {
|
|
49
54
|
this._ast = ast;
|
|
50
55
|
this._errors = [];
|
|
51
56
|
this._fragments = undefined;
|
|
52
57
|
this._fragmentSpreads = new Map();
|
|
53
58
|
this._recursivelyReferencedFragments = new Map();
|
|
59
|
+
this._onError = onError;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
reportError(error: GraphQLError): void {
|
|
57
63
|
this._errors.push(error);
|
|
64
|
+
if (this._onError) {
|
|
65
|
+
this._onError(error);
|
|
66
|
+
}
|
|
58
67
|
}
|
|
59
68
|
|
|
69
|
+
// @deprecated: use onError callback instead - will be removed in v15.
|
|
60
70
|
getErrors(): $ReadOnlyArray<GraphQLError> {
|
|
61
71
|
return this._errors;
|
|
62
72
|
}
|
|
@@ -136,8 +146,12 @@ export type ASTValidationRule = ASTValidationContext => ASTVisitor;
|
|
|
136
146
|
export class SDLValidationContext extends ASTValidationContext {
|
|
137
147
|
_schema: ?GraphQLSchema;
|
|
138
148
|
|
|
139
|
-
constructor(
|
|
140
|
-
|
|
149
|
+
constructor(
|
|
150
|
+
ast: DocumentNode,
|
|
151
|
+
schema: ?GraphQLSchema,
|
|
152
|
+
onError: (err: GraphQLError) => void,
|
|
153
|
+
): void {
|
|
154
|
+
super(ast, onError);
|
|
141
155
|
this._schema = schema;
|
|
142
156
|
}
|
|
143
157
|
|
|
@@ -161,8 +175,9 @@ export class ValidationContext extends ASTValidationContext {
|
|
|
161
175
|
schema: GraphQLSchema,
|
|
162
176
|
ast: DocumentNode,
|
|
163
177
|
typeInfo: TypeInfo,
|
|
178
|
+
onError?: (err: GraphQLError) => void,
|
|
164
179
|
): void {
|
|
165
|
-
super(ast);
|
|
180
|
+
super(ast, onError);
|
|
166
181
|
this._schema = schema;
|
|
167
182
|
this._typeInfo = typeInfo;
|
|
168
183
|
this._variableUsages = new Map();
|
|
@@ -227,7 +242,7 @@ export class ValidationContext extends ASTValidationContext {
|
|
|
227
242
|
return this._typeInfo.getParentInputType();
|
|
228
243
|
}
|
|
229
244
|
|
|
230
|
-
getFieldDef(): ?GraphQLField
|
|
245
|
+
getFieldDef(): ?GraphQLField<mixed, mixed> {
|
|
231
246
|
return this._typeInfo.getFieldDef();
|
|
232
247
|
}
|
|
233
248
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
2
2
|
|
|
3
|
-
import { visit, visitWithTypeInfo } from '../language/visitor';
|
|
4
3
|
import { Kind } from '../language/kinds';
|
|
4
|
+
import { visit, visitWithTypeInfo } from '../language/visitor';
|
|
5
5
|
import { TypeInfo } from '../utilities/TypeInfo';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -12,19 +12,25 @@ import { TypeInfo } from '../utilities/TypeInfo';
|
|
|
12
12
|
export var ASTValidationContext =
|
|
13
13
|
/*#__PURE__*/
|
|
14
14
|
function () {
|
|
15
|
-
function ASTValidationContext(ast) {
|
|
15
|
+
function ASTValidationContext(ast, onError) {
|
|
16
16
|
this._ast = ast;
|
|
17
17
|
this._errors = [];
|
|
18
18
|
this._fragments = undefined;
|
|
19
19
|
this._fragmentSpreads = new Map();
|
|
20
20
|
this._recursivelyReferencedFragments = new Map();
|
|
21
|
+
this._onError = onError;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
var _proto = ASTValidationContext.prototype;
|
|
24
25
|
|
|
25
26
|
_proto.reportError = function reportError(error) {
|
|
26
27
|
this._errors.push(error);
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
if (this._onError) {
|
|
30
|
+
this._onError(error);
|
|
31
|
+
}
|
|
32
|
+
} // @deprecated: use onError callback instead - will be removed in v15.
|
|
33
|
+
;
|
|
28
34
|
|
|
29
35
|
_proto.getErrors = function getErrors() {
|
|
30
36
|
return this._errors;
|
|
@@ -59,32 +65,14 @@ function () {
|
|
|
59
65
|
|
|
60
66
|
while (setsToVisit.length !== 0) {
|
|
61
67
|
var set = setsToVisit.pop();
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
71
|
-
spreads.push(selection);
|
|
72
|
-
} else if (selection.selectionSet) {
|
|
73
|
-
setsToVisit.push(selection.selectionSet);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch (err) {
|
|
77
|
-
_didIteratorError = true;
|
|
78
|
-
_iteratorError = err;
|
|
79
|
-
} finally {
|
|
80
|
-
try {
|
|
81
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
82
|
-
_iterator.return();
|
|
83
|
-
}
|
|
84
|
-
} finally {
|
|
85
|
-
if (_didIteratorError) {
|
|
86
|
-
throw _iteratorError;
|
|
87
|
-
}
|
|
68
|
+
|
|
69
|
+
for (var _i2 = 0, _set$selections2 = set.selections; _i2 < _set$selections2.length; _i2++) {
|
|
70
|
+
var selection = _set$selections2[_i2];
|
|
71
|
+
|
|
72
|
+
if (selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
73
|
+
spreads.push(selection);
|
|
74
|
+
} else if (selection.selectionSet) {
|
|
75
|
+
setsToVisit.push(selection.selectionSet);
|
|
88
76
|
}
|
|
89
77
|
}
|
|
90
78
|
}
|
|
@@ -105,36 +93,18 @@ function () {
|
|
|
105
93
|
|
|
106
94
|
while (nodesToVisit.length !== 0) {
|
|
107
95
|
var node = nodesToVisit.pop();
|
|
108
|
-
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (fragment) {
|
|
122
|
-
fragments.push(fragment);
|
|
123
|
-
nodesToVisit.push(fragment.selectionSet);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch (err) {
|
|
128
|
-
_didIteratorError2 = true;
|
|
129
|
-
_iteratorError2 = err;
|
|
130
|
-
} finally {
|
|
131
|
-
try {
|
|
132
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
133
|
-
_iterator2.return();
|
|
134
|
-
}
|
|
135
|
-
} finally {
|
|
136
|
-
if (_didIteratorError2) {
|
|
137
|
-
throw _iteratorError2;
|
|
96
|
+
|
|
97
|
+
for (var _i4 = 0, _this$getFragmentSpre2 = this.getFragmentSpreads(node); _i4 < _this$getFragmentSpre2.length; _i4++) {
|
|
98
|
+
var spread = _this$getFragmentSpre2[_i4];
|
|
99
|
+
var fragName = spread.name.value;
|
|
100
|
+
|
|
101
|
+
if (collectedNames[fragName] !== true) {
|
|
102
|
+
collectedNames[fragName] = true;
|
|
103
|
+
var fragment = this.getFragment(fragName);
|
|
104
|
+
|
|
105
|
+
if (fragment) {
|
|
106
|
+
fragments.push(fragment);
|
|
107
|
+
nodesToVisit.push(fragment.selectionSet);
|
|
138
108
|
}
|
|
139
109
|
}
|
|
140
110
|
}
|
|
@@ -153,10 +123,10 @@ export var SDLValidationContext =
|
|
|
153
123
|
function (_ASTValidationContext) {
|
|
154
124
|
_inheritsLoose(SDLValidationContext, _ASTValidationContext);
|
|
155
125
|
|
|
156
|
-
function SDLValidationContext(ast, schema) {
|
|
126
|
+
function SDLValidationContext(ast, schema, onError) {
|
|
157
127
|
var _this;
|
|
158
128
|
|
|
159
|
-
_this = _ASTValidationContext.call(this, ast) || this;
|
|
129
|
+
_this = _ASTValidationContext.call(this, ast, onError) || this;
|
|
160
130
|
_this._schema = schema;
|
|
161
131
|
return _this;
|
|
162
132
|
}
|
|
@@ -174,10 +144,10 @@ export var ValidationContext =
|
|
|
174
144
|
function (_ASTValidationContext2) {
|
|
175
145
|
_inheritsLoose(ValidationContext, _ASTValidationContext2);
|
|
176
146
|
|
|
177
|
-
function ValidationContext(schema, ast, typeInfo) {
|
|
147
|
+
function ValidationContext(schema, ast, typeInfo, onError) {
|
|
178
148
|
var _this2;
|
|
179
149
|
|
|
180
|
-
_this2 = _ASTValidationContext2.call(this, ast) || this;
|
|
150
|
+
_this2 = _ASTValidationContext2.call(this, ast, onError) || this;
|
|
181
151
|
_this2._schema = schema;
|
|
182
152
|
_this2._typeInfo = typeInfo;
|
|
183
153
|
_this2._variableUsages = new Map();
|
|
@@ -222,28 +192,10 @@ function (_ASTValidationContext2) {
|
|
|
222
192
|
|
|
223
193
|
if (!usages) {
|
|
224
194
|
usages = this.getVariableUsages(operation);
|
|
225
|
-
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
try {
|
|
230
|
-
for (var _iterator3 = this.getRecursivelyReferencedFragments(operation)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
231
|
-
var frag = _step3.value;
|
|
232
|
-
usages = usages.concat(this.getVariableUsages(frag));
|
|
233
|
-
}
|
|
234
|
-
} catch (err) {
|
|
235
|
-
_didIteratorError3 = true;
|
|
236
|
-
_iteratorError3 = err;
|
|
237
|
-
} finally {
|
|
238
|
-
try {
|
|
239
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
240
|
-
_iterator3.return();
|
|
241
|
-
}
|
|
242
|
-
} finally {
|
|
243
|
-
if (_didIteratorError3) {
|
|
244
|
-
throw _iteratorError3;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
195
|
+
|
|
196
|
+
for (var _i6 = 0, _this$getRecursivelyR2 = this.getRecursivelyReferencedFragments(operation); _i6 < _this$getRecursivelyR2.length; _i6++) {
|
|
197
|
+
var frag = _this$getRecursivelyR2[_i6];
|
|
198
|
+
usages = usages.concat(this.getVariableUsages(frag));
|
|
247
199
|
}
|
|
248
200
|
|
|
249
201
|
this._recursiveVariableUsages.set(operation, usages);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export { validate } from './validate';
|
|
2
|
+
|
|
3
|
+
export { ValidationContext, ValidationRule } from './ValidationContext';
|
|
4
|
+
|
|
5
|
+
export { specifiedRules } from './specifiedRules';
|
|
6
|
+
|
|
7
|
+
// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types"
|
|
8
|
+
export {
|
|
9
|
+
FieldsOnCorrectType as FieldsOnCorrectTypeRule,
|
|
10
|
+
} from './rules/FieldsOnCorrectType';
|
|
11
|
+
|
|
12
|
+
// Spec Section: "Fragments on Composite Types"
|
|
13
|
+
export {
|
|
14
|
+
FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule,
|
|
15
|
+
} from './rules/FragmentsOnCompositeTypes';
|
|
16
|
+
|
|
17
|
+
// Spec Section: "Argument Names"
|
|
18
|
+
export {
|
|
19
|
+
KnownArgumentNames as KnownArgumentNamesRule,
|
|
20
|
+
} from './rules/KnownArgumentNames';
|
|
21
|
+
|
|
22
|
+
// Spec Section: "Directives Are Defined"
|
|
23
|
+
export {
|
|
24
|
+
KnownDirectives as KnownDirectivesRule,
|
|
25
|
+
} from './rules/KnownDirectives';
|
|
26
|
+
|
|
27
|
+
// Spec Section: "Fragment spread target defined"
|
|
28
|
+
export {
|
|
29
|
+
KnownFragmentNames as KnownFragmentNamesRule,
|
|
30
|
+
} from './rules/KnownFragmentNames';
|
|
31
|
+
|
|
32
|
+
// Spec Section: "Fragment Spread Type Existence"
|
|
33
|
+
export { KnownTypeNames as KnownTypeNamesRule } from './rules/KnownTypeNames';
|
|
34
|
+
|
|
35
|
+
// Spec Section: "Lone Anonymous Operation"
|
|
36
|
+
export {
|
|
37
|
+
LoneAnonymousOperation as LoneAnonymousOperationRule,
|
|
38
|
+
} from './rules/LoneAnonymousOperation';
|
|
39
|
+
|
|
40
|
+
// Spec Section: "Fragments must not form cycles"
|
|
41
|
+
export {
|
|
42
|
+
NoFragmentCycles as NoFragmentCyclesRule,
|
|
43
|
+
} from './rules/NoFragmentCycles';
|
|
44
|
+
|
|
45
|
+
// Spec Section: "All Variable Used Defined"
|
|
46
|
+
export {
|
|
47
|
+
NoUndefinedVariables as NoUndefinedVariablesRule,
|
|
48
|
+
} from './rules/NoUndefinedVariables';
|
|
49
|
+
|
|
50
|
+
// Spec Section: "Fragments must be used"
|
|
51
|
+
export {
|
|
52
|
+
NoUnusedFragments as NoUnusedFragmentsRule,
|
|
53
|
+
} from './rules/NoUnusedFragments';
|
|
54
|
+
|
|
55
|
+
// Spec Section: "All Variables Used"
|
|
56
|
+
export {
|
|
57
|
+
NoUnusedVariables as NoUnusedVariablesRule,
|
|
58
|
+
} from './rules/NoUnusedVariables';
|
|
59
|
+
|
|
60
|
+
// Spec Section: "Field Selection Merging"
|
|
61
|
+
export {
|
|
62
|
+
OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule,
|
|
63
|
+
} from './rules/OverlappingFieldsCanBeMerged';
|
|
64
|
+
|
|
65
|
+
// Spec Section: "Fragment spread is possible"
|
|
66
|
+
export {
|
|
67
|
+
PossibleFragmentSpreads as PossibleFragmentSpreadsRule,
|
|
68
|
+
} from './rules/PossibleFragmentSpreads';
|
|
69
|
+
|
|
70
|
+
// Spec Section: "Argument Optionality"
|
|
71
|
+
export {
|
|
72
|
+
ProvidedRequiredArguments as ProvidedRequiredArgumentsRule,
|
|
73
|
+
} from './rules/ProvidedRequiredArguments';
|
|
74
|
+
|
|
75
|
+
// Spec Section: "Leaf Field Selections"
|
|
76
|
+
export { ScalarLeafs as ScalarLeafsRule } from './rules/ScalarLeafs';
|
|
77
|
+
|
|
78
|
+
// Spec Section: "Subscriptions with Single Root Field"
|
|
79
|
+
export {
|
|
80
|
+
SingleFieldSubscriptions as SingleFieldSubscriptionsRule,
|
|
81
|
+
} from './rules/SingleFieldSubscriptions';
|
|
82
|
+
|
|
83
|
+
// Spec Section: "Argument Uniqueness"
|
|
84
|
+
export {
|
|
85
|
+
UniqueArgumentNames as UniqueArgumentNamesRule,
|
|
86
|
+
} from './rules/UniqueArgumentNames';
|
|
87
|
+
|
|
88
|
+
// Spec Section: "Directives Are Unique Per Location"
|
|
89
|
+
export {
|
|
90
|
+
UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule,
|
|
91
|
+
} from './rules/UniqueDirectivesPerLocation';
|
|
92
|
+
|
|
93
|
+
// Spec Section: "Fragment Name Uniqueness"
|
|
94
|
+
export {
|
|
95
|
+
UniqueFragmentNames as UniqueFragmentNamesRule,
|
|
96
|
+
} from './rules/UniqueFragmentNames';
|
|
97
|
+
|
|
98
|
+
// Spec Section: "Input Object Field Uniqueness"
|
|
99
|
+
export {
|
|
100
|
+
UniqueInputFieldNames as UniqueInputFieldNamesRule,
|
|
101
|
+
} from './rules/UniqueInputFieldNames';
|
|
102
|
+
|
|
103
|
+
// Spec Section: "Operation Name Uniqueness"
|
|
104
|
+
export {
|
|
105
|
+
UniqueOperationNames as UniqueOperationNamesRule,
|
|
106
|
+
} from './rules/UniqueOperationNames';
|
|
107
|
+
|
|
108
|
+
// Spec Section: "Variable Uniqueness"
|
|
109
|
+
export {
|
|
110
|
+
UniqueVariableNames as UniqueVariableNamesRule,
|
|
111
|
+
} from './rules/UniqueVariableNames';
|
|
112
|
+
|
|
113
|
+
// Spec Section: "Values Type Correctness"
|
|
114
|
+
export {
|
|
115
|
+
ValuesOfCorrectType as ValuesOfCorrectTypeRule,
|
|
116
|
+
} from './rules/ValuesOfCorrectType';
|
|
117
|
+
|
|
118
|
+
// Spec Section: "Variables are Input Types"
|
|
119
|
+
export {
|
|
120
|
+
VariablesAreInputTypes as VariablesAreInputTypesRule,
|
|
121
|
+
} from './rules/VariablesAreInputTypes';
|
|
122
|
+
|
|
123
|
+
// Spec Section: "All Variable Usages Are Allowed"
|
|
124
|
+
export {
|
|
125
|
+
VariablesInAllowedPosition as VariablesInAllowedPositionRule,
|
|
126
|
+
} from './rules/VariablesInAllowedPosition';
|