graphql 15.1.0 → 15.4.0
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 -12
- package/error/GraphQLError.js +5 -5
- package/error/GraphQLError.js.flow +5 -5
- package/error/GraphQLError.mjs +1 -1
- package/error/formatError.js +1 -1
- package/error/formatError.js.flow +2 -3
- 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 +11 -5
- package/error/locatedError.mjs +6 -4
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.js.flow +1 -2
- package/execution/execute.d.ts +24 -16
- package/execution/execute.js +123 -105
- package/execution/execute.js.flow +169 -153
- package/execution/execute.mjs +101 -82
- package/execution/index.d.ts +2 -0
- package/execution/index.js +9 -3
- package/execution/index.js.flow +12 -3
- package/execution/index.mjs +1 -1
- package/execution/values.js +11 -11
- package/execution/values.js.flow +10 -14
- package/graphql.js +5 -5
- package/graphql.js.flow +9 -9
- package/index.d.ts +19 -1
- package/index.js +27 -9
- package/index.js.flow +10 -3
- package/index.mjs +4 -3
- package/jsutils/ObjMap.js.flow +0 -1
- package/jsutils/Path.d.ts +6 -1
- package/jsutils/Path.js +3 -2
- package/jsutils/Path.js.flow +3 -2
- package/jsutils/Path.mjs +3 -2
- 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.flow +2 -3
- package/jsutils/invariant.js.flow +0 -1
- package/jsutils/isAsyncIterable.js +19 -0
- package/jsutils/isAsyncIterable.js.flow +18 -0
- package/jsutils/isAsyncIterable.mjs +16 -0
- package/jsutils/isCollection.js +1 -1
- package/jsutils/isCollection.js.flow +0 -1
- package/jsutils/isObjectLike.js.flow +0 -1
- package/jsutils/isPromise.js.flow +0 -1
- package/jsutils/keyMap.js.flow +1 -2
- package/jsutils/keyValMap.js.flow +1 -2
- package/jsutils/mapValue.js +1 -1
- package/jsutils/mapValue.js.flow +1 -2
- package/jsutils/memoize3.js +2 -5
- package/jsutils/memoize3.js.flow +2 -5
- package/jsutils/memoize3.mjs +2 -5
- package/jsutils/nodejsCustomInspectSymbol.js.flow +0 -1
- package/jsutils/printPathArray.js.flow +0 -1
- package/jsutils/promiseForObject.js.flow +1 -2
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.js.flow +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/suggestionList.js.flow +1 -2
- package/jsutils/toObjMap.js +1 -1
- package/jsutils/toObjMap.js.flow +5 -6
- package/language/ast.js +1 -1
- package/language/ast.js.flow +2 -3
- package/language/blockString.d.ts +1 -1
- package/language/blockString.js +53 -32
- package/language/blockString.js.flow +49 -34
- 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 +191 -186
- package/language/lexer.mjs +239 -180
- package/language/location.js.flow +1 -2
- package/language/parser.js +73 -68
- package/language/parser.js.flow +112 -106
- package/language/parser.mjs +66 -62
- package/language/predicates.js +1 -1
- package/language/predicates.js.flow +1 -2
- package/language/printLocation.js +1 -1
- package/language/printLocation.js.flow +4 -4
- package/language/printer.js +20 -13
- package/language/printer.js.flow +27 -25
- package/language/printer.mjs +18 -11
- package/language/source.d.ts +12 -6
- package/language/source.js +25 -9
- package/language/source.js.flow +25 -8
- package/language/source.mjs +19 -7
- package/language/tokenKind.js.flow +0 -1
- package/language/visitor.d.ts +3 -3
- package/language/visitor.js +5 -5
- package/language/visitor.js.flow +5 -5
- package/language/visitor.mjs +3 -3
- package/package.json +1 -1
- 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 +2 -3
- package/polyfills/objectEntries.mjs +1 -1
- package/polyfills/objectValues.js +1 -1
- package/polyfills/objectValues.js.flow +2 -3
- 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 +9 -10
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +61 -73
- package/subscription/subscribe.js.flow +74 -88
- package/subscription/subscribe.mjs +53 -65
- package/type/definition.d.ts +181 -31
- package/type/definition.js +37 -32
- package/type/definition.js.flow +66 -51
- package/type/definition.mjs +20 -18
- package/type/directives.d.ts +17 -3
- package/type/directives.js +17 -16
- package/type/directives.js.flow +20 -21
- package/type/directives.mjs +6 -5
- package/type/index.d.ts +12 -0
- package/type/index.js +6 -6
- package/type/index.js.flow +0 -1
- package/type/introspection.js +86 -68
- package/type/introspection.js.flow +85 -54
- package/type/introspection.mjs +79 -61
- package/type/scalars.js +9 -9
- package/type/scalars.js.flow +3 -3
- package/type/scalars.mjs +1 -1
- package/type/schema.d.ts +17 -4
- package/type/schema.js +13 -13
- package/type/schema.js.flow +18 -16
- package/type/schema.mjs +1 -1
- package/type/validate.js +52 -19
- package/type/validate.js.flow +67 -18
- package/type/validate.mjs +44 -10
- package/utilities/TypeInfo.js +7 -7
- package/utilities/TypeInfo.js.flow +16 -18
- package/utilities/TypeInfo.mjs +1 -1
- package/utilities/assertValidName.js +2 -2
- package/utilities/assertValidName.js.flow +0 -1
- package/utilities/astFromValue.js +10 -10
- package/utilities/astFromValue.js.flow +2 -3
- package/utilities/buildASTSchema.js +17 -27
- package/utilities/buildASTSchema.js.flow +11 -28
- package/utilities/buildASTSchema.mjs +11 -21
- package/utilities/buildClientSchema.js +14 -14
- package/utilities/buildClientSchema.js.flow +41 -29
- package/utilities/buildClientSchema.mjs +5 -5
- package/utilities/coerceInputValue.js +14 -14
- package/utilities/coerceInputValue.js.flow +7 -6
- package/utilities/coerceInputValue.mjs +2 -2
- package/utilities/concatAST.js +9 -8
- package/utilities/concatAST.js.flow +9 -9
- package/utilities/concatAST.mjs +9 -6
- package/utilities/extendSchema.js +26 -19
- package/utilities/extendSchema.js.flow +58 -45
- package/utilities/extendSchema.mjs +9 -2
- package/utilities/findBreakingChanges.js +9 -9
- package/utilities/findBreakingChanges.js.flow +12 -11
- package/utilities/findDeprecatedUsages.d.ts +9 -1
- package/utilities/findDeprecatedUsages.js +11 -27
- package/utilities/findDeprecatedUsages.js.flow +15 -44
- package/utilities/findDeprecatedUsages.mjs +11 -25
- package/utilities/getIntrospectionQuery.js.flow +2 -3
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.js.flow +1 -5
- package/utilities/getOperationAST.mjs +1 -1
- package/utilities/getOperationRootType.js +1 -1
- package/utilities/getOperationRootType.js.flow +5 -6
- package/utilities/index.d.ts +4 -1
- package/utilities/index.js +22 -22
- package/utilities/index.js.flow +1 -2
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +6 -8
- package/utilities/introspectionFromSchema.js.flow +10 -10
- package/utilities/introspectionFromSchema.mjs +3 -4
- package/utilities/lexicographicSortSchema.js +10 -8
- package/utilities/lexicographicSortSchema.js.flow +19 -12
- package/utilities/lexicographicSortSchema.mjs +3 -1
- package/utilities/printSchema.js +15 -16
- package/utilities/printSchema.js.flow +34 -25
- package/utilities/printSchema.mjs +6 -7
- package/utilities/separateOperations.js +2 -2
- package/utilities/separateOperations.js.flow +2 -6
- package/utilities/separateOperations.mjs +1 -1
- 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 +2 -4
- package/utilities/typeFromAST.js +6 -6
- package/utilities/typeFromAST.js.flow +11 -14
- package/utilities/typeFromAST.mjs +2 -2
- package/utilities/typedQueryDocumentNode.d.ts +20 -0
- package/utilities/valueFromAST.js +6 -6
- package/utilities/valueFromAST.js.flow +7 -5
- package/utilities/valueFromASTUntyped.js +4 -4
- package/utilities/valueFromASTUntyped.js.flow +2 -3
- package/validation/ValidationContext.d.ts +3 -0
- package/validation/ValidationContext.js +7 -3
- package/validation/ValidationContext.js.flow +28 -22
- package/validation/ValidationContext.mjs +4 -0
- package/validation/index.d.ts +4 -0
- package/validation/index.js +52 -36
- package/validation/index.js.flow +4 -1
- package/validation/index.mjs +4 -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 +2 -3
- package/validation/rules/FieldsOnCorrectTypeRule.js +5 -5
- package/validation/rules/FieldsOnCorrectTypeRule.js.flow +9 -8
- package/validation/rules/FragmentsOnCompositeTypesRule.js +4 -4
- package/validation/rules/FragmentsOnCompositeTypesRule.js.flow +2 -3
- package/validation/rules/KnownArgumentNamesRule.js +5 -5
- package/validation/rules/KnownArgumentNamesRule.js.flow +5 -5
- package/validation/rules/KnownDirectivesRule.js +6 -6
- package/validation/rules/KnownDirectivesRule.js.flow +10 -11
- package/validation/rules/KnownFragmentNamesRule.js +1 -1
- package/validation/rules/KnownFragmentNamesRule.js.flow +3 -3
- package/validation/rules/KnownTypeNamesRule.js +12 -10
- package/validation/rules/KnownTypeNamesRule.js.flow +14 -11
- package/validation/rules/KnownTypeNamesRule.mjs +6 -5
- package/validation/rules/LoneAnonymousOperationRule.js +2 -2
- package/validation/rules/LoneAnonymousOperationRule.js.flow +2 -3
- 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 +2 -3
- package/validation/rules/NoFragmentCyclesRule.js +1 -1
- package/validation/rules/NoFragmentCyclesRule.js.flow +4 -5
- package/validation/rules/NoUndefinedVariablesRule.js +1 -1
- package/validation/rules/NoUndefinedVariablesRule.js.flow +3 -3
- package/validation/rules/NoUnusedFragmentsRule.js +1 -1
- package/validation/rules/NoUnusedFragmentsRule.js.flow +3 -3
- package/validation/rules/NoUnusedVariablesRule.js +1 -1
- package/validation/rules/NoUnusedVariablesRule.js.flow +3 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +20 -20
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +29 -27
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +12 -12
- package/validation/rules/PossibleFragmentSpreadsRule.js +5 -5
- package/validation/rules/PossibleFragmentSpreadsRule.js.flow +7 -4
- 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 +8 -6
- package/validation/rules/ProvidedRequiredArgumentsRule.js +7 -7
- package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +7 -6
- package/validation/rules/ScalarLeafsRule.js +3 -3
- package/validation/rules/ScalarLeafsRule.js.flow +3 -4
- package/validation/rules/SingleFieldSubscriptionsRule.js +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.js.flow +3 -4
- package/validation/rules/UniqueArgumentNamesRule.js +1 -1
- package/validation/rules/UniqueArgumentNamesRule.js.flow +2 -3
- package/validation/rules/UniqueDirectiveNames.js +1 -1
- package/validation/rules/UniqueDirectiveNames.js.flow +0 -1
- package/validation/rules/UniqueDirectiveNamesRule.js +1 -1
- package/validation/rules/UniqueDirectiveNamesRule.js.flow +2 -3
- package/validation/rules/UniqueDirectivesPerLocationRule.js +4 -4
- package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +4 -5
- 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 +11 -4
- 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 +17 -6
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js.flow +3 -3
- package/validation/rules/UniqueInputFieldNamesRule.js +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.js.flow +3 -3
- package/validation/rules/UniqueOperationNamesRule.js +1 -1
- package/validation/rules/UniqueOperationNamesRule.js.flow +3 -3
- 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 +10 -4
- package/validation/rules/UniqueTypeNames.js +1 -1
- package/validation/rules/UniqueTypeNames.js.flow +0 -1
- package/validation/rules/UniqueTypeNamesRule.js +1 -1
- package/validation/rules/UniqueTypeNamesRule.js.flow +3 -4
- package/validation/rules/UniqueVariableNamesRule.js +1 -1
- package/validation/rules/UniqueVariableNamesRule.js.flow +3 -4
- package/validation/rules/ValuesOfCorrectTypeRule.js +8 -8
- package/validation/rules/ValuesOfCorrectTypeRule.js.flow +3 -4
- package/validation/rules/VariablesAreInputTypesRule.js +4 -4
- package/validation/rules/VariablesAreInputTypesRule.js.flow +3 -4
- package/validation/rules/VariablesInAllowedPositionRule.js +6 -6
- package/validation/rules/VariablesInAllowedPositionRule.js.flow +6 -6
- package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +14 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.js +79 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.js.flow +94 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs +68 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +16 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +34 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +38 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +25 -0
- 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 -9
- package/version.js +2 -2
- package/version.js.flow +2 -3
- package/version.mjs +2 -2
- package/polyfills/flatMap.js +0 -30
- package/polyfills/flatMap.js.flow +0 -28
- package/polyfills/flatMap.mjs +0 -23
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type FragmentSpreadNode,
|
|
15
|
-
type FragmentDefinitionNode,
|
|
2
|
+
import type { ObjMap } from '../jsutils/ObjMap';
|
|
3
|
+
|
|
4
|
+
import type { GraphQLError } from '../error/GraphQLError';
|
|
5
|
+
|
|
6
|
+
import type { ASTVisitor } from '../language/visitor';
|
|
7
|
+
import type {
|
|
8
|
+
DocumentNode,
|
|
9
|
+
OperationDefinitionNode,
|
|
10
|
+
VariableNode,
|
|
11
|
+
SelectionSetNode,
|
|
12
|
+
FragmentSpreadNode,
|
|
13
|
+
FragmentDefinitionNode,
|
|
16
14
|
} from '../language/ast';
|
|
17
15
|
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
import { Kind } from '../language/kinds';
|
|
17
|
+
import { visit } from '../language/visitor';
|
|
18
|
+
|
|
19
|
+
import type { GraphQLSchema } from '../type/schema';
|
|
20
|
+
import type { GraphQLDirective } from '../type/directives';
|
|
21
|
+
import type {
|
|
22
|
+
GraphQLInputType,
|
|
23
|
+
GraphQLOutputType,
|
|
24
|
+
GraphQLCompositeType,
|
|
25
|
+
GraphQLField,
|
|
26
|
+
GraphQLArgument,
|
|
27
|
+
GraphQLEnumValue,
|
|
26
28
|
} from '../type/definition';
|
|
27
29
|
|
|
28
30
|
import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo';
|
|
@@ -243,6 +245,10 @@ export class ValidationContext extends ASTValidationContext {
|
|
|
243
245
|
getArgument(): ?GraphQLArgument {
|
|
244
246
|
return this._typeInfo.getArgument();
|
|
245
247
|
}
|
|
248
|
+
|
|
249
|
+
getEnumValue(): ?GraphQLEnumValue {
|
|
250
|
+
return this._typeInfo.getEnumValue();
|
|
251
|
+
}
|
|
246
252
|
}
|
|
247
253
|
|
|
248
254
|
export type ValidationRule = (ValidationContext) => ASTVisitor;
|
|
@@ -216,5 +216,9 @@ export var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) {
|
|
|
216
216
|
return this._typeInfo.getArgument();
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
_proto3.getEnumValue = function getEnumValue() {
|
|
220
|
+
return this._typeInfo.getEnumValue();
|
|
221
|
+
};
|
|
222
|
+
|
|
219
223
|
return ValidationContext;
|
|
220
224
|
}(ASTValidationContext);
|
package/validation/index.d.ts
CHANGED
|
@@ -90,3 +90,7 @@ export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule';
|
|
|
90
90
|
export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule';
|
|
91
91
|
export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule';
|
|
92
92
|
export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule';
|
|
93
|
+
|
|
94
|
+
// Optional rules not defined by the GraphQL Specification
|
|
95
|
+
export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule';
|
|
96
|
+
export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule';
|
package/validation/index.js
CHANGED
|
@@ -219,75 +219,91 @@ Object.defineProperty(exports, "PossibleTypeExtensionsRule", {
|
|
|
219
219
|
return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule;
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
|
+
Object.defineProperty(exports, "NoDeprecatedCustomRule", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function get() {
|
|
225
|
+
return _NoDeprecatedCustomRule.NoDeprecatedCustomRule;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
Object.defineProperty(exports, "NoSchemaIntrospectionCustomRule", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function get() {
|
|
231
|
+
return _NoSchemaIntrospectionCustomRule.NoSchemaIntrospectionCustomRule;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
var _validate = require("./validate.js");
|
|
236
|
+
|
|
237
|
+
var _ValidationContext = require("./ValidationContext.js");
|
|
222
238
|
|
|
223
|
-
var
|
|
239
|
+
var _specifiedRules = require("./specifiedRules.js");
|
|
224
240
|
|
|
225
|
-
var
|
|
241
|
+
var _ExecutableDefinitionsRule = require("./rules/ExecutableDefinitionsRule.js");
|
|
226
242
|
|
|
227
|
-
var
|
|
243
|
+
var _FieldsOnCorrectTypeRule = require("./rules/FieldsOnCorrectTypeRule.js");
|
|
228
244
|
|
|
229
|
-
var
|
|
245
|
+
var _FragmentsOnCompositeTypesRule = require("./rules/FragmentsOnCompositeTypesRule.js");
|
|
230
246
|
|
|
231
|
-
var
|
|
247
|
+
var _KnownArgumentNamesRule = require("./rules/KnownArgumentNamesRule.js");
|
|
232
248
|
|
|
233
|
-
var
|
|
249
|
+
var _KnownDirectivesRule = require("./rules/KnownDirectivesRule.js");
|
|
234
250
|
|
|
235
|
-
var
|
|
251
|
+
var _KnownFragmentNamesRule = require("./rules/KnownFragmentNamesRule.js");
|
|
236
252
|
|
|
237
|
-
var
|
|
253
|
+
var _KnownTypeNamesRule = require("./rules/KnownTypeNamesRule.js");
|
|
238
254
|
|
|
239
|
-
var
|
|
255
|
+
var _LoneAnonymousOperationRule = require("./rules/LoneAnonymousOperationRule.js");
|
|
240
256
|
|
|
241
|
-
var
|
|
257
|
+
var _NoFragmentCyclesRule = require("./rules/NoFragmentCyclesRule.js");
|
|
242
258
|
|
|
243
|
-
var
|
|
259
|
+
var _NoUndefinedVariablesRule = require("./rules/NoUndefinedVariablesRule.js");
|
|
244
260
|
|
|
245
|
-
var
|
|
261
|
+
var _NoUnusedFragmentsRule = require("./rules/NoUnusedFragmentsRule.js");
|
|
246
262
|
|
|
247
|
-
var
|
|
263
|
+
var _NoUnusedVariablesRule = require("./rules/NoUnusedVariablesRule.js");
|
|
248
264
|
|
|
249
|
-
var
|
|
265
|
+
var _OverlappingFieldsCanBeMergedRule = require("./rules/OverlappingFieldsCanBeMergedRule.js");
|
|
250
266
|
|
|
251
|
-
var
|
|
267
|
+
var _PossibleFragmentSpreadsRule = require("./rules/PossibleFragmentSpreadsRule.js");
|
|
252
268
|
|
|
253
|
-
var
|
|
269
|
+
var _ProvidedRequiredArgumentsRule = require("./rules/ProvidedRequiredArgumentsRule.js");
|
|
254
270
|
|
|
255
|
-
var
|
|
271
|
+
var _ScalarLeafsRule = require("./rules/ScalarLeafsRule.js");
|
|
256
272
|
|
|
257
|
-
var
|
|
273
|
+
var _SingleFieldSubscriptionsRule = require("./rules/SingleFieldSubscriptionsRule.js");
|
|
258
274
|
|
|
259
|
-
var
|
|
275
|
+
var _UniqueArgumentNamesRule = require("./rules/UniqueArgumentNamesRule.js");
|
|
260
276
|
|
|
261
|
-
var
|
|
277
|
+
var _UniqueDirectivesPerLocationRule = require("./rules/UniqueDirectivesPerLocationRule.js");
|
|
262
278
|
|
|
263
|
-
var
|
|
279
|
+
var _UniqueFragmentNamesRule = require("./rules/UniqueFragmentNamesRule.js");
|
|
264
280
|
|
|
265
|
-
var
|
|
281
|
+
var _UniqueInputFieldNamesRule = require("./rules/UniqueInputFieldNamesRule.js");
|
|
266
282
|
|
|
267
|
-
var
|
|
283
|
+
var _UniqueOperationNamesRule = require("./rules/UniqueOperationNamesRule.js");
|
|
268
284
|
|
|
269
|
-
var
|
|
285
|
+
var _UniqueVariableNamesRule = require("./rules/UniqueVariableNamesRule.js");
|
|
270
286
|
|
|
271
|
-
var
|
|
287
|
+
var _ValuesOfCorrectTypeRule = require("./rules/ValuesOfCorrectTypeRule.js");
|
|
272
288
|
|
|
273
|
-
var
|
|
289
|
+
var _VariablesAreInputTypesRule = require("./rules/VariablesAreInputTypesRule.js");
|
|
274
290
|
|
|
275
|
-
var
|
|
291
|
+
var _VariablesInAllowedPositionRule = require("./rules/VariablesInAllowedPositionRule.js");
|
|
276
292
|
|
|
277
|
-
var
|
|
293
|
+
var _LoneSchemaDefinitionRule = require("./rules/LoneSchemaDefinitionRule.js");
|
|
278
294
|
|
|
279
|
-
var
|
|
295
|
+
var _UniqueOperationTypesRule = require("./rules/UniqueOperationTypesRule.js");
|
|
280
296
|
|
|
281
|
-
var
|
|
297
|
+
var _UniqueTypeNamesRule = require("./rules/UniqueTypeNamesRule.js");
|
|
282
298
|
|
|
283
|
-
var
|
|
299
|
+
var _UniqueEnumValueNamesRule = require("./rules/UniqueEnumValueNamesRule.js");
|
|
284
300
|
|
|
285
|
-
var
|
|
301
|
+
var _UniqueFieldDefinitionNamesRule = require("./rules/UniqueFieldDefinitionNamesRule.js");
|
|
286
302
|
|
|
287
|
-
var
|
|
303
|
+
var _UniqueDirectiveNamesRule = require("./rules/UniqueDirectiveNamesRule.js");
|
|
288
304
|
|
|
289
|
-
var
|
|
305
|
+
var _PossibleTypeExtensionsRule = require("./rules/PossibleTypeExtensionsRule.js");
|
|
290
306
|
|
|
291
|
-
var
|
|
307
|
+
var _NoDeprecatedCustomRule = require("./rules/custom/NoDeprecatedCustomRule.js");
|
|
292
308
|
|
|
293
|
-
var
|
|
309
|
+
var _NoSchemaIntrospectionCustomRule = require("./rules/custom/NoSchemaIntrospectionCustomRule.js");
|
package/validation/index.js.flow
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
export { validate } from './validate';
|
|
4
3
|
|
|
5
4
|
export { ValidationContext } from './ValidationContext';
|
|
@@ -94,3 +93,7 @@ export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule';
|
|
|
94
93
|
export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule';
|
|
95
94
|
export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule';
|
|
96
95
|
export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule';
|
|
96
|
+
|
|
97
|
+
// Optional rules not defined by the GraphQL Specification
|
|
98
|
+
export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule';
|
|
99
|
+
export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule';
|
package/validation/index.mjs
CHANGED
|
@@ -61,4 +61,7 @@ export { UniqueTypeNamesRule } from "./rules/UniqueTypeNamesRule.mjs";
|
|
|
61
61
|
export { UniqueEnumValueNamesRule } from "./rules/UniqueEnumValueNamesRule.mjs";
|
|
62
62
|
export { UniqueFieldDefinitionNamesRule } from "./rules/UniqueFieldDefinitionNamesRule.mjs";
|
|
63
63
|
export { UniqueDirectiveNamesRule } from "./rules/UniqueDirectiveNamesRule.mjs";
|
|
64
|
-
export { PossibleTypeExtensionsRule } from "./rules/PossibleTypeExtensionsRule.mjs";
|
|
64
|
+
export { PossibleTypeExtensionsRule } from "./rules/PossibleTypeExtensionsRule.mjs"; // Optional rules not defined by the GraphQL Specification
|
|
65
|
+
|
|
66
|
+
export { NoDeprecatedCustomRule } from "./rules/custom/NoDeprecatedCustomRule.mjs";
|
|
67
|
+
export { NoSchemaIntrospectionCustomRule } from "./rules/custom/NoSchemaIntrospectionCustomRule.mjs";
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule;
|
|
7
7
|
|
|
8
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
8
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
9
9
|
|
|
10
|
-
var _kinds = require("../../language/kinds");
|
|
10
|
+
var _kinds = require("../../language/kinds.js");
|
|
11
11
|
|
|
12
|
-
var _predicates = require("../../language/predicates");
|
|
12
|
+
var _predicates = require("../../language/predicates.js");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Executable definitions
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
3
|
|
|
4
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
5
5
|
import { Kind } from '../../language/kinds';
|
|
6
|
-
import { type ASTVisitor } from '../../language/visitor';
|
|
7
6
|
import { isExecutableDefinitionNode } from '../../language/predicates';
|
|
8
7
|
|
|
9
|
-
import {
|
|
8
|
+
import type { ASTValidationContext } from '../ValidationContext';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Executable definitions
|
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule;
|
|
7
7
|
|
|
8
|
-
var _arrayFrom = _interopRequireDefault(require("../../polyfills/arrayFrom"));
|
|
8
|
+
var _arrayFrom = _interopRequireDefault(require("../../polyfills/arrayFrom.js"));
|
|
9
9
|
|
|
10
|
-
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean"));
|
|
10
|
+
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js"));
|
|
11
11
|
|
|
12
|
-
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
|
|
12
|
+
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js"));
|
|
13
13
|
|
|
14
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
14
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
15
15
|
|
|
16
|
-
var _definition = require("../../type/definition");
|
|
16
|
+
var _definition = require("../../type/definition.js");
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import arrayFrom from '../../polyfills/arrayFrom';
|
|
4
3
|
|
|
5
4
|
import didYouMean from '../../jsutils/didYouMean';
|
|
@@ -7,20 +6,22 @@ import suggestionList from '../../jsutils/suggestionList';
|
|
|
7
6
|
|
|
8
7
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
9
8
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import type { FieldNode } from '../../language/ast';
|
|
10
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
12
11
|
|
|
13
|
-
import {
|
|
12
|
+
import type { GraphQLSchema } from '../../type/schema';
|
|
13
|
+
import type {
|
|
14
|
+
GraphQLOutputType,
|
|
15
|
+
GraphQLObjectType,
|
|
16
|
+
GraphQLInterfaceType,
|
|
17
|
+
} from '../../type/definition';
|
|
14
18
|
import {
|
|
15
|
-
type GraphQLOutputType,
|
|
16
|
-
type GraphQLObjectType,
|
|
17
|
-
type GraphQLInterfaceType,
|
|
18
19
|
isObjectType,
|
|
19
20
|
isInterfaceType,
|
|
20
21
|
isAbstractType,
|
|
21
22
|
} from '../../type/definition';
|
|
22
23
|
|
|
23
|
-
import {
|
|
24
|
+
import type { ValidationContext } from '../ValidationContext';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Fields on correct type
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule;
|
|
7
7
|
|
|
8
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
8
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
9
9
|
|
|
10
|
-
var _printer = require("../../language/printer");
|
|
10
|
+
var _printer = require("../../language/printer.js");
|
|
11
11
|
|
|
12
|
-
var _definition = require("../../type/definition");
|
|
12
|
+
var _definition = require("../../type/definition.js");
|
|
13
13
|
|
|
14
|
-
var _typeFromAST = require("../../utilities/typeFromAST");
|
|
14
|
+
var _typeFromAST = require("../../utilities/typeFromAST.js");
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Fragments on composite type
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
3
|
|
|
4
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
5
5
|
import { print } from '../../language/printer';
|
|
6
|
-
import { type ASTVisitor } from '../../language/visitor';
|
|
7
6
|
|
|
8
7
|
import { isCompositeType } from '../../type/definition';
|
|
9
8
|
|
|
10
9
|
import { typeFromAST } from '../../utilities/typeFromAST';
|
|
11
10
|
|
|
12
|
-
import {
|
|
11
|
+
import type { ValidationContext } from '../ValidationContext';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Fragments on composite type
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.KnownArgumentNamesRule = KnownArgumentNamesRule;
|
|
7
7
|
exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule;
|
|
8
8
|
|
|
9
|
-
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean"));
|
|
9
|
+
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js"));
|
|
10
10
|
|
|
11
|
-
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
|
|
11
|
+
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js"));
|
|
12
12
|
|
|
13
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
13
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
14
14
|
|
|
15
|
-
var _kinds = require("../../language/kinds");
|
|
15
|
+
var _kinds = require("../../language/kinds.js");
|
|
16
16
|
|
|
17
|
-
var _directives = require("../../type/directives");
|
|
17
|
+
var _directives = require("../../type/directives.js");
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import didYouMean from '../../jsutils/didYouMean';
|
|
4
3
|
import suggestionList from '../../jsutils/suggestionList';
|
|
5
4
|
|
|
6
5
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
7
6
|
|
|
7
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
8
8
|
import { Kind } from '../../language/kinds';
|
|
9
|
-
import { type ASTVisitor } from '../../language/visitor';
|
|
10
9
|
|
|
11
10
|
import { specifiedDirectives } from '../../type/directives';
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import type {
|
|
13
|
+
ValidationContext,
|
|
14
|
+
SDLValidationContext,
|
|
16
15
|
} from '../ValidationContext';
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -23,6 +22,7 @@ import {
|
|
|
23
22
|
*/
|
|
24
23
|
export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor {
|
|
25
24
|
return {
|
|
25
|
+
// eslint-disable-next-line new-cap
|
|
26
26
|
...KnownArgumentNamesOnDirectivesRule(context),
|
|
27
27
|
Argument(argNode) {
|
|
28
28
|
const argDef = context.getArgument();
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KnownDirectivesRule = KnownDirectivesRule;
|
|
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 _GraphQLError = require("../../error/GraphQLError");
|
|
12
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
13
13
|
|
|
14
|
-
var _kinds = require("../../language/kinds");
|
|
14
|
+
var _kinds = require("../../language/kinds.js");
|
|
15
15
|
|
|
16
|
-
var _directiveLocation = require("../../language/directiveLocation");
|
|
16
|
+
var _directiveLocation = require("../../language/directiveLocation.js");
|
|
17
17
|
|
|
18
|
-
var _directives = require("../../type/directives");
|
|
18
|
+
var _directives = require("../../type/directives.js");
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import inspect from '../../jsutils/inspect';
|
|
4
3
|
import invariant from '../../jsutils/invariant';
|
|
5
4
|
|
|
6
5
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
7
6
|
|
|
7
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
8
|
+
import type { ASTNode, OperationTypeNode } from '../../language/ast';
|
|
9
|
+
import type { DirectiveLocationEnum } from '../../language/directiveLocation';
|
|
8
10
|
import { Kind } from '../../language/kinds';
|
|
9
|
-
import {
|
|
10
|
-
import { type OperationTypeNode } from '../../language/ast';
|
|
11
|
-
import {
|
|
12
|
-
type DirectiveLocationEnum,
|
|
13
|
-
DirectiveLocation,
|
|
14
|
-
} from '../../language/directiveLocation';
|
|
11
|
+
import { DirectiveLocation } from '../../language/directiveLocation';
|
|
15
12
|
|
|
16
13
|
import { specifiedDirectives } from '../../type/directives';
|
|
17
14
|
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
import type {
|
|
16
|
+
ValidationContext,
|
|
17
|
+
SDLValidationContext,
|
|
21
18
|
} from '../ValidationContext';
|
|
22
19
|
|
|
23
20
|
/**
|
|
@@ -71,7 +68,9 @@ export function KnownDirectivesRule(
|
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
function getDirectiveLocationForASTPath(
|
|
71
|
+
function getDirectiveLocationForASTPath(
|
|
72
|
+
ancestors: $ReadOnlyArray<ASTNode | $ReadOnlyArray<ASTNode>>,
|
|
73
|
+
): DirectiveLocationEnum | void {
|
|
75
74
|
const appliedTo = ancestors[ancestors.length - 1];
|
|
76
75
|
invariant(!Array.isArray(appliedTo));
|
|
77
76
|
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KnownFragmentNamesRule = KnownFragmentNamesRule;
|
|
7
7
|
|
|
8
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
8
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Known fragment names
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
|
-
import { type ASTVisitor } from '../../language/visitor';
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
5
|
+
|
|
6
|
+
import type { ValidationContext } from '../ValidationContext';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Known fragment names
|
|
@@ -5,15 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KnownTypeNamesRule = KnownTypeNamesRule;
|
|
7
7
|
|
|
8
|
-
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean"));
|
|
8
|
+
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js"));
|
|
9
9
|
|
|
10
|
-
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
|
|
10
|
+
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js"));
|
|
11
11
|
|
|
12
|
-
var _GraphQLError = require("../../error/GraphQLError");
|
|
12
|
+
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
13
13
|
|
|
14
|
-
var _predicates = require("../../language/predicates");
|
|
14
|
+
var _predicates = require("../../language/predicates.js");
|
|
15
15
|
|
|
16
|
-
var _scalars = require("../../type/scalars");
|
|
16
|
+
var _scalars = require("../../type/scalars.js");
|
|
17
|
+
|
|
18
|
+
var _introspection = require("../../type/introspection.js");
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
@@ -47,23 +49,23 @@ function KnownTypeNamesRule(context) {
|
|
|
47
49
|
var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent;
|
|
48
50
|
var isSDL = definitionNode != null && isSDLNode(definitionNode);
|
|
49
51
|
|
|
50
|
-
if (isSDL &&
|
|
52
|
+
if (isSDL && isStandardTypeName(typeName)) {
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ?
|
|
56
|
+
var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames);
|
|
55
57
|
context.reportError(new _GraphQLError.GraphQLError("Unknown type \"".concat(typeName, "\".") + (0, _didYouMean.default)(suggestedTypes), node));
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
var
|
|
63
|
+
var standardTypeNames = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes).map(function (type) {
|
|
62
64
|
return type.name;
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
function
|
|
66
|
-
return
|
|
67
|
+
function isStandardTypeName(typeName) {
|
|
68
|
+
return standardTypeNames.indexOf(typeName) !== -1;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
function isSDLNode(value) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
2
|
import didYouMean from '../../jsutils/didYouMean';
|
|
4
3
|
import suggestionList from '../../jsutils/suggestionList';
|
|
5
4
|
|
|
6
5
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import type { ASTNode } from '../../language/ast';
|
|
8
|
+
import type { ASTVisitor } from '../../language/visitor';
|
|
10
9
|
import {
|
|
11
10
|
isTypeDefinitionNode,
|
|
12
11
|
isTypeSystemDefinitionNode,
|
|
@@ -14,10 +13,11 @@ import {
|
|
|
14
13
|
} from '../../language/predicates';
|
|
15
14
|
|
|
16
15
|
import { specifiedScalarTypes } from '../../type/scalars';
|
|
16
|
+
import { introspectionTypes } from '../../type/introspection';
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import type {
|
|
19
|
+
ValidationContext,
|
|
20
|
+
SDLValidationContext,
|
|
21
21
|
} from '../ValidationContext';
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -49,13 +49,13 @@ export function KnownTypeNamesRule(
|
|
|
49
49
|
if (!existingTypesMap[typeName] && !definedTypes[typeName]) {
|
|
50
50
|
const definitionNode = ancestors[2] ?? parent;
|
|
51
51
|
const isSDL = definitionNode != null && isSDLNode(definitionNode);
|
|
52
|
-
if (isSDL &&
|
|
52
|
+
if (isSDL && isStandardTypeName(typeName)) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const suggestedTypes = suggestionList(
|
|
57
57
|
typeName,
|
|
58
|
-
isSDL ?
|
|
58
|
+
isSDL ? standardTypeNames.concat(typeNames) : typeNames,
|
|
59
59
|
);
|
|
60
60
|
context.reportError(
|
|
61
61
|
new GraphQLError(
|
|
@@ -68,9 +68,12 @@ export function KnownTypeNamesRule(
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map(
|
|
72
|
+
(type) => type.name,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
function isStandardTypeName(typeName: string): boolean {
|
|
76
|
+
return standardTypeNames.indexOf(typeName) !== -1;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
function isSDLNode(value: ASTNode | $ReadOnlyArray<ASTNode>): boolean {
|