graphql 16.14.2 → 16.15.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.
Files changed (240) hide show
  1. package/error/GraphQLError.d.ts +5 -1
  2. package/error/GraphQLError.js +12 -7
  3. package/error/GraphQLError.mjs +13 -6
  4. package/error/locatedError.d.ts +6 -4
  5. package/error/locatedError.js +6 -4
  6. package/error/locatedError.mjs +6 -4
  7. package/execution/collectFields.d.ts +1 -0
  8. package/execution/collectFields.js +9 -0
  9. package/execution/collectFields.mjs +9 -0
  10. package/execution/execute.d.ts +9 -10
  11. package/execution/execute.js +44 -29
  12. package/execution/execute.mjs +44 -29
  13. package/execution/mapAsyncIterator.js +12 -11
  14. package/execution/mapAsyncIterator.mjs +12 -11
  15. package/execution/subscribe.d.ts +5 -2
  16. package/execution/subscribe.js +5 -2
  17. package/execution/subscribe.mjs +5 -2
  18. package/execution/values.d.ts +43 -21
  19. package/execution/values.js +52 -24
  20. package/execution/values.mjs +51 -23
  21. package/graphql.d.ts +8 -14
  22. package/graphql.js +16 -15
  23. package/graphql.mjs +11 -15
  24. package/jsutils/SetMap.d.ts +14 -0
  25. package/jsutils/SetMap.js +48 -0
  26. package/jsutils/SetMap.mjs +39 -0
  27. package/jsutils/isIterableObject.d.ts +2 -0
  28. package/jsutils/isIterableObject.js +2 -0
  29. package/jsutils/isIterableObject.mjs +2 -0
  30. package/jsutils/keyMap.d.ts +2 -0
  31. package/jsutils/keyMap.js +2 -0
  32. package/jsutils/keyMap.mjs +2 -0
  33. package/jsutils/keyValMap.d.ts +3 -3
  34. package/jsutils/keyValMap.js +3 -3
  35. package/jsutils/keyValMap.mjs +3 -3
  36. package/language/ast.d.ts +2 -6
  37. package/language/ast.js +2 -6
  38. package/language/ast.mjs +2 -6
  39. package/language/lexer.d.ts +6 -0
  40. package/language/lexer.js +22 -0
  41. package/language/lexer.mjs +22 -0
  42. package/language/location.d.ts +8 -3
  43. package/language/location.js +57 -17
  44. package/language/location.mjs +56 -16
  45. package/language/parser.d.ts +27 -13
  46. package/language/parser.js +31 -9
  47. package/language/parser.mjs +31 -9
  48. package/language/predicates.d.ts +10 -3
  49. package/language/predicates.js +10 -3
  50. package/language/predicates.mjs +10 -3
  51. package/language/printLocation.d.ts +2 -6
  52. package/language/printLocation.js +2 -6
  53. package/language/printLocation.mjs +2 -6
  54. package/language/printer.d.ts +22 -3
  55. package/language/printer.js +394 -308
  56. package/language/printer.mjs +394 -308
  57. package/language/reducer.d.ts +32 -0
  58. package/language/reducer.js +95 -0
  59. package/language/reducer.mjs +86 -0
  60. package/language/source.d.ts +4 -5
  61. package/language/source.js +4 -5
  62. package/language/source.mjs +4 -5
  63. package/language/visitor.d.ts +16 -10
  64. package/language/visitor.js +15 -7
  65. package/language/visitor.mjs +15 -7
  66. package/package.json +1 -4
  67. package/type/definition.d.ts +170 -102
  68. package/type/definition.js +169 -96
  69. package/type/definition.mjs +168 -95
  70. package/type/directives.d.ts +12 -6
  71. package/type/directives.js +12 -6
  72. package/type/directives.mjs +12 -6
  73. package/type/scalars.js +8 -11
  74. package/type/scalars.mjs +1 -1
  75. package/type/schema.d.ts +36 -11
  76. package/type/schema.js +35 -10
  77. package/type/schema.mjs +35 -10
  78. package/type/validate.d.ts +1 -3
  79. package/type/validate.js +1 -3
  80. package/type/validate.mjs +1 -3
  81. package/utilities/TypeInfo.d.ts +15 -11
  82. package/utilities/TypeInfo.js +15 -11
  83. package/utilities/TypeInfo.mjs +15 -11
  84. package/utilities/assertValidName.d.ts +1 -1
  85. package/utilities/assertValidName.js +1 -1
  86. package/utilities/assertValidName.mjs +1 -1
  87. package/utilities/astFromValue.d.ts +3 -1
  88. package/utilities/astFromValue.js +3 -1
  89. package/utilities/astFromValue.mjs +3 -1
  90. package/utilities/buildASTSchema.d.ts +8 -8
  91. package/utilities/buildASTSchema.js +9 -20
  92. package/utilities/buildASTSchema.mjs +9 -20
  93. package/utilities/buildClientSchema.d.ts +6 -2
  94. package/utilities/buildClientSchema.js +6 -2
  95. package/utilities/buildClientSchema.mjs +6 -2
  96. package/utilities/coerceInputValue.d.ts +9 -3
  97. package/utilities/coerceInputValue.js +60 -13
  98. package/utilities/coerceInputValue.mjs +58 -13
  99. package/utilities/concatAST.d.ts +4 -1
  100. package/utilities/concatAST.js +4 -1
  101. package/utilities/concatAST.mjs +4 -1
  102. package/utilities/extendSchema.d.ts +7 -4
  103. package/utilities/extendSchema.js +7 -4
  104. package/utilities/extendSchema.mjs +7 -4
  105. package/utilities/findBreakingChanges.d.ts +2 -2
  106. package/utilities/findBreakingChanges.js +2 -2
  107. package/utilities/findBreakingChanges.mjs +2 -2
  108. package/utilities/getIntrospectionQuery.d.ts +9 -9
  109. package/utilities/getIntrospectionQuery.js +8 -8
  110. package/utilities/getIntrospectionQuery.mjs +8 -8
  111. package/utilities/getOperationAST.d.ts +2 -2
  112. package/utilities/getOperationAST.js +2 -2
  113. package/utilities/getOperationAST.mjs +2 -2
  114. package/utilities/getOperationRootType.d.ts +3 -1
  115. package/utilities/getOperationRootType.js +3 -1
  116. package/utilities/getOperationRootType.mjs +3 -1
  117. package/utilities/introspectionFromSchema.d.ts +12 -4
  118. package/utilities/introspectionFromSchema.js +12 -4
  119. package/utilities/introspectionFromSchema.mjs +12 -4
  120. package/utilities/lexicographicSortSchema.d.ts +17 -13
  121. package/utilities/lexicographicSortSchema.js +17 -13
  122. package/utilities/lexicographicSortSchema.mjs +17 -13
  123. package/utilities/printSchema.d.ts +7 -4
  124. package/utilities/printSchema.js +7 -4
  125. package/utilities/printSchema.mjs +7 -4
  126. package/utilities/resolveSchemaCoordinate.d.ts +9 -8
  127. package/utilities/resolveSchemaCoordinate.js +9 -8
  128. package/utilities/resolveSchemaCoordinate.mjs +9 -8
  129. package/utilities/separateOperations.d.ts +2 -2
  130. package/utilities/separateOperations.js +2 -2
  131. package/utilities/separateOperations.mjs +2 -2
  132. package/utilities/stripIgnoredCharacters.d.ts +19 -5
  133. package/utilities/stripIgnoredCharacters.js +19 -5
  134. package/utilities/stripIgnoredCharacters.mjs +19 -5
  135. package/utilities/typeComparators.d.ts +1 -5
  136. package/utilities/typeComparators.js +1 -5
  137. package/utilities/typeComparators.mjs +1 -5
  138. package/utilities/valueFromAST.js +4 -4
  139. package/utilities/valueFromAST.mjs +4 -4
  140. package/utilities/valueFromASTUntyped.d.ts +1 -3
  141. package/utilities/valueFromASTUntyped.js +1 -3
  142. package/utilities/valueFromASTUntyped.mjs +1 -3
  143. package/validation/ValidationContext.d.ts +22 -3
  144. package/validation/ValidationContext.js +84 -27
  145. package/validation/ValidationContext.mjs +82 -27
  146. package/validation/rules/ExecutableDefinitionsRule.d.ts +6 -4
  147. package/validation/rules/ExecutableDefinitionsRule.js +6 -4
  148. package/validation/rules/ExecutableDefinitionsRule.mjs +6 -4
  149. package/validation/rules/FieldsOnCorrectTypeRule.d.ts +4 -4
  150. package/validation/rules/FieldsOnCorrectTypeRule.js +10 -6
  151. package/validation/rules/FieldsOnCorrectTypeRule.mjs +12 -6
  152. package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +6 -4
  153. package/validation/rules/FragmentsOnCompositeTypesRule.js +6 -4
  154. package/validation/rules/FragmentsOnCompositeTypesRule.mjs +6 -4
  155. package/validation/rules/KnownArgumentNamesRule.d.ts +4 -4
  156. package/validation/rules/KnownArgumentNamesRule.js +26 -17
  157. package/validation/rules/KnownArgumentNamesRule.mjs +21 -11
  158. package/validation/rules/KnownDirectivesRule.d.ts +1 -3
  159. package/validation/rules/KnownDirectivesRule.js +1 -3
  160. package/validation/rules/KnownDirectivesRule.mjs +1 -3
  161. package/validation/rules/KnownFragmentNamesRule.d.ts +4 -4
  162. package/validation/rules/KnownFragmentNamesRule.js +4 -4
  163. package/validation/rules/KnownFragmentNamesRule.mjs +4 -4
  164. package/validation/rules/KnownTypeNamesRule.d.ts +1 -3
  165. package/validation/rules/KnownTypeNamesRule.js +7 -7
  166. package/validation/rules/KnownTypeNamesRule.mjs +7 -7
  167. package/validation/rules/LoneAnonymousOperationRule.d.ts +6 -4
  168. package/validation/rules/LoneAnonymousOperationRule.js +6 -4
  169. package/validation/rules/LoneAnonymousOperationRule.mjs +6 -4
  170. package/validation/rules/MaxIntrospectionDepthRule.d.ts +6 -4
  171. package/validation/rules/MaxIntrospectionDepthRule.js +44 -19
  172. package/validation/rules/MaxIntrospectionDepthRule.mjs +44 -19
  173. package/validation/rules/NoFragmentCyclesRule.d.ts +1 -3
  174. package/validation/rules/NoFragmentCyclesRule.js +1 -3
  175. package/validation/rules/NoFragmentCyclesRule.mjs +1 -3
  176. package/validation/rules/NoUndefinedVariablesRule.d.ts +4 -4
  177. package/validation/rules/NoUndefinedVariablesRule.js +4 -4
  178. package/validation/rules/NoUndefinedVariablesRule.mjs +4 -4
  179. package/validation/rules/NoUnusedFragmentsRule.d.ts +4 -4
  180. package/validation/rules/NoUnusedFragmentsRule.js +10 -14
  181. package/validation/rules/NoUnusedFragmentsRule.mjs +10 -14
  182. package/validation/rules/NoUnusedVariablesRule.d.ts +4 -4
  183. package/validation/rules/NoUnusedVariablesRule.js +4 -4
  184. package/validation/rules/NoUnusedVariablesRule.mjs +4 -4
  185. package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +8 -6
  186. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +552 -354
  187. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +545 -352
  188. package/validation/rules/PossibleFragmentSpreadsRule.d.ts +6 -4
  189. package/validation/rules/PossibleFragmentSpreadsRule.js +6 -4
  190. package/validation/rules/PossibleFragmentSpreadsRule.mjs +6 -4
  191. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +6 -4
  192. package/validation/rules/ProvidedRequiredArgumentsRule.js +6 -4
  193. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +6 -4
  194. package/validation/rules/ScalarLeafsRule.d.ts +1 -3
  195. package/validation/rules/ScalarLeafsRule.js +1 -3
  196. package/validation/rules/ScalarLeafsRule.mjs +1 -3
  197. package/validation/rules/SingleFieldSubscriptionsRule.d.ts +6 -4
  198. package/validation/rules/SingleFieldSubscriptionsRule.js +50 -9
  199. package/validation/rules/SingleFieldSubscriptionsRule.mjs +50 -9
  200. package/validation/rules/UniqueArgumentNamesRule.d.ts +4 -4
  201. package/validation/rules/UniqueArgumentNamesRule.js +4 -4
  202. package/validation/rules/UniqueArgumentNamesRule.mjs +4 -4
  203. package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +6 -4
  204. package/validation/rules/UniqueDirectivesPerLocationRule.js +6 -4
  205. package/validation/rules/UniqueDirectivesPerLocationRule.mjs +6 -4
  206. package/validation/rules/UniqueFragmentNamesRule.d.ts +4 -4
  207. package/validation/rules/UniqueFragmentNamesRule.js +4 -4
  208. package/validation/rules/UniqueFragmentNamesRule.mjs +4 -4
  209. package/validation/rules/UniqueInputFieldNamesRule.d.ts +6 -4
  210. package/validation/rules/UniqueInputFieldNamesRule.js +6 -4
  211. package/validation/rules/UniqueInputFieldNamesRule.mjs +6 -4
  212. package/validation/rules/UniqueOperationNamesRule.d.ts +4 -4
  213. package/validation/rules/UniqueOperationNamesRule.js +4 -4
  214. package/validation/rules/UniqueOperationNamesRule.mjs +4 -4
  215. package/validation/rules/UniqueVariableNamesRule.d.ts +4 -4
  216. package/validation/rules/UniqueVariableNamesRule.js +4 -4
  217. package/validation/rules/UniqueVariableNamesRule.mjs +4 -4
  218. package/validation/rules/ValuesOfCorrectTypeRule.d.ts +4 -4
  219. package/validation/rules/ValuesOfCorrectTypeRule.js +29 -23
  220. package/validation/rules/ValuesOfCorrectTypeRule.mjs +24 -14
  221. package/validation/rules/VariablesAreInputTypesRule.d.ts +6 -4
  222. package/validation/rules/VariablesAreInputTypesRule.js +6 -4
  223. package/validation/rules/VariablesAreInputTypesRule.mjs +6 -4
  224. package/validation/rules/VariablesInAllowedPositionRule.d.ts +6 -4
  225. package/validation/rules/VariablesInAllowedPositionRule.js +6 -4
  226. package/validation/rules/VariablesInAllowedPositionRule.mjs +6 -4
  227. package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +4 -4
  228. package/validation/rules/custom/NoDeprecatedCustomRule.js +4 -4
  229. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +4 -4
  230. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +7 -5
  231. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +7 -5
  232. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +7 -5
  233. package/validation/validate.d.ts +2 -0
  234. package/validation/validate.js +14 -2
  235. package/validation/validate.mjs +13 -2
  236. package/validation/validationAbortedError.d.ts +3 -0
  237. package/validation/validationAbortedError.js +14 -0
  238. package/validation/validationAbortedError.mjs +4 -0
  239. package/version.js +3 -3
  240. package/version.mjs +3 -3
@@ -24,16 +24,18 @@ import type { ASTValidationContext } from '../ValidationContext';
24
24
  * const invalidDocument = parse(`
25
25
  * type Extra { field: String }
26
26
  * `);
27
- * const invalidErrors = validate(schema, invalidDocument, [ExecutableDefinitionsRule]);
27
+ * const invalidErrors = validate(schema, invalidDocument, [
28
+ * ExecutableDefinitionsRule,
29
+ * ]);
28
30
  *
29
31
  * invalidErrors.length; // => 1
30
32
  *
31
33
  * const validDocument = parse(`
32
34
  * { name }
33
35
  * `);
34
- * const validErrors = validate(schema, validDocument, [ExecutableDefinitionsRule]);
35
- *
36
- * validErrors; // => []
36
+ * const validErrors = validate(schema, validDocument, [
37
+ * ExecutableDefinitionsRule,
38
+ * ]); // => []
37
39
  * ```
38
40
  */
39
41
  export declare function ExecutableDefinitionsRule(
@@ -36,16 +36,18 @@ var _predicates = require('../../language/predicates.js');
36
36
  * const invalidDocument = parse(`
37
37
  * type Extra { field: String }
38
38
  * `);
39
- * const invalidErrors = validate(schema, invalidDocument, [ExecutableDefinitionsRule]);
39
+ * const invalidErrors = validate(schema, invalidDocument, [
40
+ * ExecutableDefinitionsRule,
41
+ * ]);
40
42
  *
41
43
  * invalidErrors.length; // => 1
42
44
  *
43
45
  * const validDocument = parse(`
44
46
  * { name }
45
47
  * `);
46
- * const validErrors = validate(schema, validDocument, [ExecutableDefinitionsRule]);
47
- *
48
- * validErrors; // => []
48
+ * const validErrors = validate(schema, validDocument, [
49
+ * ExecutableDefinitionsRule,
50
+ * ]); // => []
49
51
  * ```
50
52
  */
51
53
  function ExecutableDefinitionsRule(context) {
@@ -26,16 +26,18 @@ import { isExecutableDefinitionNode } from '../../language/predicates.mjs';
26
26
  * const invalidDocument = parse(`
27
27
  * type Extra { field: String }
28
28
  * `);
29
- * const invalidErrors = validate(schema, invalidDocument, [ExecutableDefinitionsRule]);
29
+ * const invalidErrors = validate(schema, invalidDocument, [
30
+ * ExecutableDefinitionsRule,
31
+ * ]);
30
32
  *
31
33
  * invalidErrors.length; // => 1
32
34
  *
33
35
  * const validDocument = parse(`
34
36
  * { name }
35
37
  * `);
36
- * const validErrors = validate(schema, validDocument, [ExecutableDefinitionsRule]);
37
- *
38
- * validErrors; // => []
38
+ * const validErrors = validate(schema, validDocument, [
39
+ * ExecutableDefinitionsRule,
40
+ * ]); // => []
39
41
  * ```
40
42
  */
41
43
  export function ExecutableDefinitionsRule(context) {
@@ -24,16 +24,16 @@ import type { ValidationContext } from '../ValidationContext';
24
24
  * const invalidDocument = parse(`
25
25
  * { missing }
26
26
  * `);
27
- * const invalidErrors = validate(schema, invalidDocument, [FieldsOnCorrectTypeRule]);
27
+ * const invalidErrors = validate(schema, invalidDocument, [
28
+ * FieldsOnCorrectTypeRule,
29
+ * ]);
28
30
  *
29
31
  * invalidErrors.length; // => 1
30
32
  *
31
33
  * const validDocument = parse(`
32
34
  * { name }
33
35
  * `);
34
- * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]);
35
- *
36
- * validErrors; // => []
36
+ * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]); // => []
37
37
  * ```
38
38
  */
39
39
  export declare function FieldsOnCorrectTypeRule(
@@ -40,16 +40,16 @@ var _definition = require('../../type/definition.js');
40
40
  * const invalidDocument = parse(`
41
41
  * { missing }
42
42
  * `);
43
- * const invalidErrors = validate(schema, invalidDocument, [FieldsOnCorrectTypeRule]);
43
+ * const invalidErrors = validate(schema, invalidDocument, [
44
+ * FieldsOnCorrectTypeRule,
45
+ * ]);
44
46
  *
45
47
  * invalidErrors.length; // => 1
46
48
  *
47
49
  * const validDocument = parse(`
48
50
  * { name }
49
51
  * `);
50
- * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]);
51
- *
52
- * validErrors; // => []
52
+ * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]); // => []
53
53
  * ```
54
54
  */
55
55
  function FieldsOnCorrectTypeRule(context) {
@@ -67,12 +67,16 @@ function FieldsOnCorrectTypeRule(context) {
67
67
 
68
68
  let suggestion = (0, _didYouMean.didYouMean)(
69
69
  'to use an inline fragment on',
70
- getSuggestedTypeNames(schema, type, fieldName),
70
+ context.hideSuggestions
71
+ ? []
72
+ : getSuggestedTypeNames(schema, type, fieldName),
71
73
  ); // If there are no suggested types, then perhaps this was a typo?
72
74
 
73
75
  if (suggestion === '') {
74
76
  suggestion = (0, _didYouMean.didYouMean)(
75
- getSuggestedFieldNames(type, fieldName),
77
+ context.hideSuggestions
78
+ ? []
79
+ : getSuggestedFieldNames(type, fieldName),
76
80
  );
77
81
  } // Report an error, including helpful suggestions.
78
82
 
@@ -32,16 +32,16 @@ import {
32
32
  * const invalidDocument = parse(`
33
33
  * { missing }
34
34
  * `);
35
- * const invalidErrors = validate(schema, invalidDocument, [FieldsOnCorrectTypeRule]);
35
+ * const invalidErrors = validate(schema, invalidDocument, [
36
+ * FieldsOnCorrectTypeRule,
37
+ * ]);
36
38
  *
37
39
  * invalidErrors.length; // => 1
38
40
  *
39
41
  * const validDocument = parse(`
40
42
  * { name }
41
43
  * `);
42
- * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]);
43
- *
44
- * validErrors; // => []
44
+ * const validErrors = validate(schema, validDocument, [FieldsOnCorrectTypeRule]); // => []
45
45
  * ```
46
46
  */
47
47
  export function FieldsOnCorrectTypeRule(context) {
@@ -59,11 +59,17 @@ export function FieldsOnCorrectTypeRule(context) {
59
59
 
60
60
  let suggestion = didYouMean(
61
61
  'to use an inline fragment on',
62
- getSuggestedTypeNames(schema, type, fieldName),
62
+ context.hideSuggestions
63
+ ? []
64
+ : getSuggestedTypeNames(schema, type, fieldName),
63
65
  ); // If there are no suggested types, then perhaps this was a typo?
64
66
 
65
67
  if (suggestion === '') {
66
- suggestion = didYouMean(getSuggestedFieldNames(type, fieldName));
68
+ suggestion = didYouMean(
69
+ context.hideSuggestions
70
+ ? []
71
+ : getSuggestedFieldNames(type, fieldName),
72
+ );
67
73
  } // Report an error, including helpful suggestions.
68
74
 
69
75
  context.reportError(
@@ -25,16 +25,18 @@ import type { ValidationContext } from '../ValidationContext';
25
25
  * const invalidDocument = parse(`
26
26
  * fragment Bad on String { length }
27
27
  * `);
28
- * const invalidErrors = validate(schema, invalidDocument, [FragmentsOnCompositeTypesRule]);
28
+ * const invalidErrors = validate(schema, invalidDocument, [
29
+ * FragmentsOnCompositeTypesRule,
30
+ * ]);
29
31
  *
30
32
  * invalidErrors.length; // => 1
31
33
  *
32
34
  * const validDocument = parse(`
33
35
  * fragment Good on Query { name }
34
36
  * `);
35
- * const validErrors = validate(schema, validDocument, [FragmentsOnCompositeTypesRule]);
36
- *
37
- * validErrors; // => []
37
+ * const validErrors = validate(schema, validDocument, [
38
+ * FragmentsOnCompositeTypesRule,
39
+ * ]); // => []
38
40
  * ```
39
41
  */
40
42
  export declare function FragmentsOnCompositeTypesRule(
@@ -39,16 +39,18 @@ var _typeFromAST = require('../../utilities/typeFromAST.js');
39
39
  * const invalidDocument = parse(`
40
40
  * fragment Bad on String { length }
41
41
  * `);
42
- * const invalidErrors = validate(schema, invalidDocument, [FragmentsOnCompositeTypesRule]);
42
+ * const invalidErrors = validate(schema, invalidDocument, [
43
+ * FragmentsOnCompositeTypesRule,
44
+ * ]);
43
45
  *
44
46
  * invalidErrors.length; // => 1
45
47
  *
46
48
  * const validDocument = parse(`
47
49
  * fragment Good on Query { name }
48
50
  * `);
49
- * const validErrors = validate(schema, validDocument, [FragmentsOnCompositeTypesRule]);
50
- *
51
- * validErrors; // => []
51
+ * const validErrors = validate(schema, validDocument, [
52
+ * FragmentsOnCompositeTypesRule,
53
+ * ]); // => []
52
54
  * ```
53
55
  */
54
56
  function FragmentsOnCompositeTypesRule(context) {
@@ -28,16 +28,18 @@ import { typeFromAST } from '../../utilities/typeFromAST.mjs';
28
28
  * const invalidDocument = parse(`
29
29
  * fragment Bad on String { length }
30
30
  * `);
31
- * const invalidErrors = validate(schema, invalidDocument, [FragmentsOnCompositeTypesRule]);
31
+ * const invalidErrors = validate(schema, invalidDocument, [
32
+ * FragmentsOnCompositeTypesRule,
33
+ * ]);
32
34
  *
33
35
  * invalidErrors.length; // => 1
34
36
  *
35
37
  * const validDocument = parse(`
36
38
  * fragment Good on Query { name }
37
39
  * `);
38
- * const validErrors = validate(schema, validDocument, [FragmentsOnCompositeTypesRule]);
39
- *
40
- * validErrors; // => []
40
+ * const validErrors = validate(schema, validDocument, [
41
+ * FragmentsOnCompositeTypesRule,
42
+ * ]); // => []
41
43
  * ```
42
44
  */
43
45
  export function FragmentsOnCompositeTypesRule(context) {
@@ -28,16 +28,16 @@ import type {
28
28
  * const invalidDocument = parse(`
29
29
  * { field(unknown: "1") }
30
30
  * `);
31
- * const invalidErrors = validate(schema, invalidDocument, [KnownArgumentNamesRule]);
31
+ * const invalidErrors = validate(schema, invalidDocument, [
32
+ * KnownArgumentNamesRule,
33
+ * ]);
32
34
  *
33
35
  * invalidErrors.length; // => 1
34
36
  *
35
37
  * const validDocument = parse(`
36
38
  * { field(arg: "1") }
37
39
  * `);
38
- * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]);
39
- *
40
- * validErrors; // => []
40
+ * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]); // => []
41
41
  * ```
42
42
  */
43
43
  export declare function KnownArgumentNamesRule(
@@ -42,16 +42,16 @@ var _directives = require('../../type/directives.js');
42
42
  * const invalidDocument = parse(`
43
43
  * { field(unknown: "1") }
44
44
  * `);
45
- * const invalidErrors = validate(schema, invalidDocument, [KnownArgumentNamesRule]);
45
+ * const invalidErrors = validate(schema, invalidDocument, [
46
+ * KnownArgumentNamesRule,
47
+ * ]);
46
48
  *
47
49
  * invalidErrors.length; // => 1
48
50
  *
49
51
  * const validDocument = parse(`
50
52
  * { field(arg: "1") }
51
53
  * `);
52
- * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]);
53
- *
54
- * validErrors; // => []
54
+ * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]); // => []
55
55
  * ```
56
56
  */
57
57
  function KnownArgumentNamesRule(context) {
@@ -66,11 +66,12 @@ function KnownArgumentNamesRule(context) {
66
66
 
67
67
  if (!argDef && fieldDef && parentType) {
68
68
  const argName = argNode.name.value;
69
- const knownArgsNames = fieldDef.args.map((arg) => arg.name);
70
- const suggestions = (0, _suggestionList.suggestionList)(
71
- argName,
72
- knownArgsNames,
73
- );
69
+ const suggestions = context.hideSuggestions
70
+ ? []
71
+ : (0, _suggestionList.suggestionList)(
72
+ argName,
73
+ fieldDef.args.map((arg) => arg.name),
74
+ );
74
75
  context.reportError(
75
76
  new _GraphQLError.GraphQLError(
76
77
  `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` +
@@ -94,7 +95,9 @@ function KnownArgumentNamesOnDirectivesRule(context) {
94
95
  : _directives.specifiedDirectives;
95
96
 
96
97
  for (const directive of definedDirectives) {
97
- directiveArgs[directive.name] = directive.args.map((arg) => arg.name);
98
+ directiveArgs[directive.name] = new Set(
99
+ directive.args.map((arg) => arg.name),
100
+ );
98
101
  }
99
102
 
100
103
  const astDefinitions = context.getDocument().definitions;
@@ -110,7 +113,9 @@ function KnownArgumentNamesOnDirectivesRule(context) {
110
113
  (_def$arguments = def.arguments) !== null && _def$arguments !== void 0
111
114
  ? _def$arguments
112
115
  : [];
113
- directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value);
116
+ directiveArgs[def.name.value] = new Set(
117
+ argsNodes.map((arg) => arg.name.value),
118
+ );
114
119
  }
115
120
  }
116
121
 
@@ -123,15 +128,19 @@ function KnownArgumentNamesOnDirectivesRule(context) {
123
128
  for (const argNode of directiveNode.arguments) {
124
129
  const argName = argNode.name.value;
125
130
 
126
- if (!knownArgs.includes(argName)) {
127
- const suggestions = (0, _suggestionList.suggestionList)(
128
- argName,
129
- knownArgs,
130
- );
131
+ if (!knownArgs.has(argName)) {
132
+ const suggestions = context.hideSuggestions
133
+ ? []
134
+ : (0, _suggestionList.suggestionList)(
135
+ argName,
136
+ Array.from(knownArgs),
137
+ );
131
138
  context.reportError(
132
139
  new _GraphQLError.GraphQLError(
133
140
  `Unknown argument "${argName}" on directive "@${directiveName}".` +
134
- (0, _didYouMean.didYouMean)(suggestions),
141
+ (context.hideSuggestions
142
+ ? ''
143
+ : (0, _didYouMean.didYouMean)(suggestions)),
135
144
  {
136
145
  nodes: argNode,
137
146
  },
@@ -29,16 +29,16 @@ import { specifiedDirectives } from '../../type/directives.mjs';
29
29
  * const invalidDocument = parse(`
30
30
  * { field(unknown: "1") }
31
31
  * `);
32
- * const invalidErrors = validate(schema, invalidDocument, [KnownArgumentNamesRule]);
32
+ * const invalidErrors = validate(schema, invalidDocument, [
33
+ * KnownArgumentNamesRule,
34
+ * ]);
33
35
  *
34
36
  * invalidErrors.length; // => 1
35
37
  *
36
38
  * const validDocument = parse(`
37
39
  * { field(arg: "1") }
38
40
  * `);
39
- * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]);
40
- *
41
- * validErrors; // => []
41
+ * const validErrors = validate(schema, validDocument, [KnownArgumentNamesRule]); // => []
42
42
  * ```
43
43
  */
44
44
  export function KnownArgumentNamesRule(context) {
@@ -53,8 +53,12 @@ export function KnownArgumentNamesRule(context) {
53
53
 
54
54
  if (!argDef && fieldDef && parentType) {
55
55
  const argName = argNode.name.value;
56
- const knownArgsNames = fieldDef.args.map((arg) => arg.name);
57
- const suggestions = suggestionList(argName, knownArgsNames);
56
+ const suggestions = context.hideSuggestions
57
+ ? []
58
+ : suggestionList(
59
+ argName,
60
+ fieldDef.args.map((arg) => arg.name),
61
+ );
58
62
  context.reportError(
59
63
  new GraphQLError(
60
64
  `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` +
@@ -78,7 +82,9 @@ export function KnownArgumentNamesOnDirectivesRule(context) {
78
82
  : specifiedDirectives;
79
83
 
80
84
  for (const directive of definedDirectives) {
81
- directiveArgs[directive.name] = directive.args.map((arg) => arg.name);
85
+ directiveArgs[directive.name] = new Set(
86
+ directive.args.map((arg) => arg.name),
87
+ );
82
88
  }
83
89
 
84
90
  const astDefinitions = context.getDocument().definitions;
@@ -94,7 +100,9 @@ export function KnownArgumentNamesOnDirectivesRule(context) {
94
100
  (_def$arguments = def.arguments) !== null && _def$arguments !== void 0
95
101
  ? _def$arguments
96
102
  : [];
97
- directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value);
103
+ directiveArgs[def.name.value] = new Set(
104
+ argsNodes.map((arg) => arg.name.value),
105
+ );
98
106
  }
99
107
  }
100
108
 
@@ -107,12 +115,14 @@ export function KnownArgumentNamesOnDirectivesRule(context) {
107
115
  for (const argNode of directiveNode.arguments) {
108
116
  const argName = argNode.name.value;
109
117
 
110
- if (!knownArgs.includes(argName)) {
111
- const suggestions = suggestionList(argName, knownArgs);
118
+ if (!knownArgs.has(argName)) {
119
+ const suggestions = context.hideSuggestions
120
+ ? []
121
+ : suggestionList(argName, Array.from(knownArgs));
112
122
  context.reportError(
113
123
  new GraphQLError(
114
124
  `Unknown argument "${argName}" on directive "@${directiveName}".` +
115
- didYouMean(suggestions),
125
+ (context.hideSuggestions ? '' : didYouMean(suggestions)),
116
126
  {
117
127
  nodes: argNode,
118
128
  },
@@ -34,9 +34,7 @@ import type {
34
34
  * const validDocument = parse(`
35
35
  * { name @include(if: true) }
36
36
  * `);
37
- * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]);
38
- *
39
- * validErrors; // => []
37
+ * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]); // => []
40
38
  * ```
41
39
  */
42
40
  export declare function KnownDirectivesRule(
@@ -51,9 +51,7 @@ var _directives = require('../../type/directives.js');
51
51
  * const validDocument = parse(`
52
52
  * { name @include(if: true) }
53
53
  * `);
54
- * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]);
55
- *
56
- * validErrors; // => []
54
+ * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]); // => []
57
55
  * ```
58
56
  */
59
57
  function KnownDirectivesRule(context) {
@@ -37,9 +37,7 @@ import { specifiedDirectives } from '../../type/directives.mjs';
37
37
  * const validDocument = parse(`
38
38
  * { name @include(if: true) }
39
39
  * `);
40
- * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]);
41
- *
42
- * validErrors; // => []
40
+ * const validErrors = validate(schema, validDocument, [KnownDirectivesRule]); // => []
43
41
  * ```
44
42
  */
45
43
  export function KnownDirectivesRule(context) {
@@ -24,16 +24,16 @@ import type { ValidationContext } from '../ValidationContext';
24
24
  * const invalidDocument = parse(`
25
25
  * { ...Missing }
26
26
  * `);
27
- * const invalidErrors = validate(schema, invalidDocument, [KnownFragmentNamesRule]);
27
+ * const invalidErrors = validate(schema, invalidDocument, [
28
+ * KnownFragmentNamesRule,
29
+ * ]);
28
30
  *
29
31
  * invalidErrors.length; // => 1
30
32
  *
31
33
  * const validDocument = parse(`
32
34
  * fragment NameFields on Query { name } query { ...NameFields }
33
35
  * `);
34
- * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]);
35
- *
36
- * validErrors; // => []
36
+ * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]); // => []
37
37
  * ```
38
38
  */
39
39
  export declare function KnownFragmentNamesRule(
@@ -32,16 +32,16 @@ var _GraphQLError = require('../../error/GraphQLError.js');
32
32
  * const invalidDocument = parse(`
33
33
  * { ...Missing }
34
34
  * `);
35
- * const invalidErrors = validate(schema, invalidDocument, [KnownFragmentNamesRule]);
35
+ * const invalidErrors = validate(schema, invalidDocument, [
36
+ * KnownFragmentNamesRule,
37
+ * ]);
36
38
  *
37
39
  * invalidErrors.length; // => 1
38
40
  *
39
41
  * const validDocument = parse(`
40
42
  * fragment NameFields on Query { name } query { ...NameFields }
41
43
  * `);
42
- * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]);
43
- *
44
- * validErrors; // => []
44
+ * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]); // => []
45
45
  * ```
46
46
  */
47
47
  function KnownFragmentNamesRule(context) {
@@ -24,16 +24,16 @@ import { GraphQLError } from '../../error/GraphQLError.mjs';
24
24
  * const invalidDocument = parse(`
25
25
  * { ...Missing }
26
26
  * `);
27
- * const invalidErrors = validate(schema, invalidDocument, [KnownFragmentNamesRule]);
27
+ * const invalidErrors = validate(schema, invalidDocument, [
28
+ * KnownFragmentNamesRule,
29
+ * ]);
28
30
  *
29
31
  * invalidErrors.length; // => 1
30
32
  *
31
33
  * const validDocument = parse(`
32
34
  * fragment NameFields on Query { name } query { ...NameFields }
33
35
  * `);
34
- * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]);
35
- *
36
- * validErrors; // => []
36
+ * const validErrors = validate(schema, validDocument, [KnownFragmentNamesRule]); // => []
37
37
  * ```
38
38
  */
39
39
  export function KnownFragmentNamesRule(context) {
@@ -34,9 +34,7 @@ import type {
34
34
  * const validDocument = parse(`
35
35
  * fragment Good on Query { name }
36
36
  * `);
37
- * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]);
38
- *
39
- * validErrors; // => []
37
+ * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]); // => []
40
38
  * ```
41
39
  */
42
40
  export declare function KnownTypeNamesRule(
@@ -49,9 +49,7 @@ var _scalars = require('../../type/scalars.js');
49
49
  * const validDocument = parse(`
50
50
  * fragment Good on Query { name }
51
51
  * `);
52
- * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]);
53
- *
54
- * validErrors; // => []
52
+ * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]); // => []
55
53
  * ```
56
54
  */
57
55
  function KnownTypeNamesRule(context) {
@@ -86,10 +84,12 @@ function KnownTypeNamesRule(context) {
86
84
  return;
87
85
  }
88
86
 
89
- const suggestedTypes = (0, _suggestionList.suggestionList)(
90
- typeName,
91
- isSDL ? standardTypeNames.concat(typeNames) : typeNames,
92
- );
87
+ const suggestedTypes = context.hideSuggestions
88
+ ? []
89
+ : (0, _suggestionList.suggestionList)(
90
+ typeName,
91
+ isSDL ? standardTypeNames.concat(typeNames) : typeNames,
92
+ );
93
93
  context.reportError(
94
94
  new _GraphQLError.GraphQLError(
95
95
  `Unknown type "${typeName}".` +
@@ -40,9 +40,7 @@ import { specifiedScalarTypes } from '../../type/scalars.mjs';
40
40
  * const validDocument = parse(`
41
41
  * fragment Good on Query { name }
42
42
  * `);
43
- * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]);
44
- *
45
- * validErrors; // => []
43
+ * const validErrors = validate(schema, validDocument, [KnownTypeNamesRule]); // => []
46
44
  * ```
47
45
  */
48
46
  export function KnownTypeNamesRule(context) {
@@ -77,10 +75,12 @@ export function KnownTypeNamesRule(context) {
77
75
  return;
78
76
  }
79
77
 
80
- const suggestedTypes = suggestionList(
81
- typeName,
82
- isSDL ? standardTypeNames.concat(typeNames) : typeNames,
83
- );
78
+ const suggestedTypes = context.hideSuggestions
79
+ ? []
80
+ : suggestionList(
81
+ typeName,
82
+ isSDL ? standardTypeNames.concat(typeNames) : typeNames,
83
+ );
84
84
  context.reportError(
85
85
  new GraphQLError(
86
86
  `Unknown type "${typeName}".` + didYouMean(suggestedTypes),
@@ -24,16 +24,18 @@ import type { ASTValidationContext } from '../ValidationContext';
24
24
  * const invalidDocument = parse(`
25
25
  * query { name } query Other { name }
26
26
  * `);
27
- * const invalidErrors = validate(schema, invalidDocument, [LoneAnonymousOperationRule]);
27
+ * const invalidErrors = validate(schema, invalidDocument, [
28
+ * LoneAnonymousOperationRule,
29
+ * ]);
28
30
  *
29
31
  * invalidErrors.length; // => 1
30
32
  *
31
33
  * const validDocument = parse(`
32
34
  * { name }
33
35
  * `);
34
- * const validErrors = validate(schema, validDocument, [LoneAnonymousOperationRule]);
35
- *
36
- * validErrors; // => []
36
+ * const validErrors = validate(schema, validDocument, [
37
+ * LoneAnonymousOperationRule,
38
+ * ]); // => []
37
39
  * ```
38
40
  */
39
41
  export declare function LoneAnonymousOperationRule(
@@ -34,16 +34,18 @@ var _kinds = require('../../language/kinds.js');
34
34
  * const invalidDocument = parse(`
35
35
  * query { name } query Other { name }
36
36
  * `);
37
- * const invalidErrors = validate(schema, invalidDocument, [LoneAnonymousOperationRule]);
37
+ * const invalidErrors = validate(schema, invalidDocument, [
38
+ * LoneAnonymousOperationRule,
39
+ * ]);
38
40
  *
39
41
  * invalidErrors.length; // => 1
40
42
  *
41
43
  * const validDocument = parse(`
42
44
  * { name }
43
45
  * `);
44
- * const validErrors = validate(schema, validDocument, [LoneAnonymousOperationRule]);
45
- *
46
- * validErrors; // => []
46
+ * const validErrors = validate(schema, validDocument, [
47
+ * LoneAnonymousOperationRule,
48
+ * ]); // => []
47
49
  * ```
48
50
  */
49
51
  function LoneAnonymousOperationRule(context) {