graphql 16.3.0 → 16.5.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 (109) hide show
  1. package/error/GraphQLError.d.ts +4 -4
  2. package/error/GraphQLError.js +4 -4
  3. package/error/GraphQLError.mjs +4 -4
  4. package/error/index.d.ts +1 -0
  5. package/error/locatedError.js +8 -8
  6. package/error/locatedError.mjs +8 -8
  7. package/error/syntaxError.js +3 -5
  8. package/error/syntaxError.mjs +4 -3
  9. package/execution/execute.js +15 -5
  10. package/execution/execute.mjs +15 -5
  11. package/execution/index.d.ts +5 -1
  12. package/execution/index.js +6 -0
  13. package/execution/index.mjs +5 -1
  14. package/execution/subscribe.js +6 -2
  15. package/execution/subscribe.mjs +6 -2
  16. package/execution/values.d.ts +0 -2
  17. package/execution/values.js +25 -17
  18. package/execution/values.mjs +25 -17
  19. package/index.d.ts +2 -0
  20. package/index.js +6 -0
  21. package/index.mjs +1 -0
  22. package/jsutils/instanceOf.js +2 -1
  23. package/jsutils/instanceOf.mjs +2 -1
  24. package/package.json +2 -2
  25. package/type/definition.d.ts +12 -6
  26. package/type/definition.js +18 -8
  27. package/type/definition.mjs +18 -8
  28. package/type/scalars.js +15 -5
  29. package/type/scalars.mjs +15 -5
  30. package/type/validate.js +5 -1
  31. package/type/validate.mjs +5 -1
  32. package/utilities/coerceInputValue.js +3 -5
  33. package/utilities/coerceInputValue.mjs +3 -8
  34. package/utilities/getOperationRootType.js +12 -4
  35. package/utilities/getOperationRootType.mjs +12 -10
  36. package/validation/rules/ExecutableDefinitionsRule.js +3 -1
  37. package/validation/rules/ExecutableDefinitionsRule.mjs +3 -4
  38. package/validation/rules/FieldsOnCorrectTypeRule.js +3 -1
  39. package/validation/rules/FieldsOnCorrectTypeRule.mjs +3 -1
  40. package/validation/rules/FragmentsOnCompositeTypesRule.js +6 -2
  41. package/validation/rules/FragmentsOnCompositeTypesRule.mjs +6 -2
  42. package/validation/rules/KnownArgumentNamesRule.js +6 -2
  43. package/validation/rules/KnownArgumentNamesRule.mjs +6 -2
  44. package/validation/rules/KnownDirectivesRule.js +6 -2
  45. package/validation/rules/KnownDirectivesRule.mjs +6 -2
  46. package/validation/rules/KnownFragmentNamesRule.js +3 -1
  47. package/validation/rules/KnownFragmentNamesRule.mjs +3 -1
  48. package/validation/rules/KnownTypeNamesRule.js +3 -1
  49. package/validation/rules/KnownTypeNamesRule.mjs +3 -1
  50. package/validation/rules/LoneAnonymousOperationRule.js +3 -1
  51. package/validation/rules/LoneAnonymousOperationRule.mjs +3 -1
  52. package/validation/rules/LoneSchemaDefinitionRule.js +6 -2
  53. package/validation/rules/LoneSchemaDefinitionRule.mjs +6 -2
  54. package/validation/rules/NoFragmentCyclesRule.js +3 -1
  55. package/validation/rules/NoFragmentCyclesRule.mjs +3 -1
  56. package/validation/rules/NoUndefinedVariablesRule.js +3 -1
  57. package/validation/rules/NoUndefinedVariablesRule.mjs +3 -1
  58. package/validation/rules/NoUnusedFragmentsRule.js +3 -1
  59. package/validation/rules/NoUnusedFragmentsRule.mjs +3 -4
  60. package/validation/rules/NoUnusedVariablesRule.js +3 -1
  61. package/validation/rules/NoUnusedVariablesRule.mjs +3 -1
  62. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +3 -1
  63. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +3 -1
  64. package/validation/rules/PossibleFragmentSpreadsRule.js +6 -2
  65. package/validation/rules/PossibleFragmentSpreadsRule.mjs +6 -2
  66. package/validation/rules/PossibleTypeExtensionsRule.js +6 -2
  67. package/validation/rules/PossibleTypeExtensionsRule.mjs +6 -5
  68. package/validation/rules/ProvidedRequiredArgumentsRule.js +6 -2
  69. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +6 -2
  70. package/validation/rules/ScalarLeafsRule.js +6 -2
  71. package/validation/rules/ScalarLeafsRule.mjs +6 -2
  72. package/validation/rules/SingleFieldSubscriptionsRule.js +6 -2
  73. package/validation/rules/SingleFieldSubscriptionsRule.mjs +6 -2
  74. package/validation/rules/UniqueArgumentDefinitionNamesRule.js +3 -1
  75. package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +3 -1
  76. package/validation/rules/UniqueArgumentNamesRule.js +3 -1
  77. package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
  78. package/validation/rules/UniqueDirectiveNamesRule.js +6 -2
  79. package/validation/rules/UniqueDirectiveNamesRule.mjs +6 -2
  80. package/validation/rules/UniqueDirectivesPerLocationRule.js +3 -1
  81. package/validation/rules/UniqueDirectivesPerLocationRule.mjs +3 -1
  82. package/validation/rules/UniqueEnumValueNamesRule.js +6 -2
  83. package/validation/rules/UniqueEnumValueNamesRule.mjs +6 -2
  84. package/validation/rules/UniqueFieldDefinitionNamesRule.js +6 -2
  85. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +6 -2
  86. package/validation/rules/UniqueFragmentNamesRule.js +3 -1
  87. package/validation/rules/UniqueFragmentNamesRule.mjs +3 -1
  88. package/validation/rules/UniqueInputFieldNamesRule.js +3 -1
  89. package/validation/rules/UniqueInputFieldNamesRule.mjs +3 -1
  90. package/validation/rules/UniqueOperationNamesRule.js +6 -1
  91. package/validation/rules/UniqueOperationNamesRule.mjs +6 -1
  92. package/validation/rules/UniqueOperationTypesRule.js +6 -2
  93. package/validation/rules/UniqueOperationTypesRule.mjs +6 -2
  94. package/validation/rules/UniqueTypeNamesRule.js +6 -2
  95. package/validation/rules/UniqueTypeNamesRule.mjs +6 -5
  96. package/validation/rules/UniqueVariableNamesRule.js +3 -1
  97. package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
  98. package/validation/rules/ValuesOfCorrectTypeRule.js +19 -10
  99. package/validation/rules/ValuesOfCorrectTypeRule.mjs +19 -10
  100. package/validation/rules/VariablesAreInputTypesRule.js +3 -1
  101. package/validation/rules/VariablesAreInputTypesRule.mjs +3 -1
  102. package/validation/rules/VariablesInAllowedPositionRule.js +3 -1
  103. package/validation/rules/VariablesInAllowedPositionRule.mjs +3 -1
  104. package/validation/rules/custom/NoDeprecatedCustomRule.js +15 -5
  105. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +15 -5
  106. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +3 -1
  107. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +3 -1
  108. package/version.js +2 -2
  109. package/version.mjs +2 -2
@@ -302,10 +302,9 @@ export interface GraphQLScalarTypeExtensions {
302
302
  * Scalars (or Enums) and are defined with a name and a series of functions
303
303
  * used to parse input from ast or variables and to ensure validity.
304
304
  *
305
- * If a type's serialize function does not return a value (i.e. it returns
306
- * `undefined`) then an error will be raised and a `null` value will be returned
307
- * in the response. If the serialize function returns `null`, then no error will
308
- * be included in the response.
305
+ * If a type's serialize function returns `null` or does not return a value
306
+ * (i.e. it returns `undefined`) then an error will be raised and a `null`
307
+ * value will be returned in the response. It is always better to validate
309
308
  *
310
309
  * Example:
311
310
  *
@@ -313,9 +312,16 @@ export interface GraphQLScalarTypeExtensions {
313
312
  * const OddType = new GraphQLScalarType({
314
313
  * name: 'Odd',
315
314
  * serialize(value) {
316
- * if (value % 2 === 1) {
317
- * return value;
315
+ * if (!Number.isFinite(value)) {
316
+ * throw new Error(
317
+ * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
318
+ * );
318
319
  * }
320
+ *
321
+ * if (value % 2 === 0) {
322
+ * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
323
+ * }
324
+ * return value;
319
325
  * }
320
326
  * });
321
327
  * ```
@@ -520,10 +520,9 @@ function resolveObjMapThunk(thunk) {
520
520
  * Scalars (or Enums) and are defined with a name and a series of functions
521
521
  * used to parse input from ast or variables and to ensure validity.
522
522
  *
523
- * If a type's serialize function does not return a value (i.e. it returns
524
- * `undefined`) then an error will be raised and a `null` value will be returned
525
- * in the response. If the serialize function returns `null`, then no error will
526
- * be included in the response.
523
+ * If a type's serialize function returns `null` or does not return a value
524
+ * (i.e. it returns `undefined`) then an error will be raised and a `null`
525
+ * value will be returned in the response. It is always better to validate
527
526
  *
528
527
  * Example:
529
528
  *
@@ -531,9 +530,16 @@ function resolveObjMapThunk(thunk) {
531
530
  * const OddType = new GraphQLScalarType({
532
531
  * name: 'Odd',
533
532
  * serialize(value) {
534
- * if (value % 2 === 1) {
535
- * return value;
533
+ * if (!Number.isFinite(value)) {
534
+ * throw new Error(
535
+ * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
536
+ * );
536
537
  * }
538
+ *
539
+ * if (value % 2 === 0) {
540
+ * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
541
+ * }
542
+ * return value;
537
543
  * }
538
544
  * });
539
545
  * ```
@@ -1134,7 +1140,9 @@ class GraphQLEnumType {
1134
1140
  throw new _GraphQLError.GraphQLError(
1135
1141
  `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` +
1136
1142
  didYouMeanEnumValue(this, valueStr),
1137
- valueNode,
1143
+ {
1144
+ nodes: valueNode,
1145
+ },
1138
1146
  );
1139
1147
  }
1140
1148
 
@@ -1145,7 +1153,9 @@ class GraphQLEnumType {
1145
1153
  throw new _GraphQLError.GraphQLError(
1146
1154
  `Value "${valueStr}" does not exist in "${this.name}" enum.` +
1147
1155
  didYouMeanEnumValue(this, valueStr),
1148
- valueNode,
1156
+ {
1157
+ nodes: valueNode,
1158
+ },
1149
1159
  );
1150
1160
  }
1151
1161
 
@@ -381,10 +381,9 @@ export function resolveObjMapThunk(thunk) {
381
381
  * Scalars (or Enums) and are defined with a name and a series of functions
382
382
  * used to parse input from ast or variables and to ensure validity.
383
383
  *
384
- * If a type's serialize function does not return a value (i.e. it returns
385
- * `undefined`) then an error will be raised and a `null` value will be returned
386
- * in the response. If the serialize function returns `null`, then no error will
387
- * be included in the response.
384
+ * If a type's serialize function returns `null` or does not return a value
385
+ * (i.e. it returns `undefined`) then an error will be raised and a `null`
386
+ * value will be returned in the response. It is always better to validate
388
387
  *
389
388
  * Example:
390
389
  *
@@ -392,9 +391,16 @@ export function resolveObjMapThunk(thunk) {
392
391
  * const OddType = new GraphQLScalarType({
393
392
  * name: 'Odd',
394
393
  * serialize(value) {
395
- * if (value % 2 === 1) {
396
- * return value;
394
+ * if (!Number.isFinite(value)) {
395
+ * throw new Error(
396
+ * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
397
+ * );
397
398
  * }
399
+ *
400
+ * if (value % 2 === 0) {
401
+ * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
402
+ * }
403
+ * return value;
398
404
  * }
399
405
  * });
400
406
  * ```
@@ -981,7 +987,9 @@ export class GraphQLEnumType {
981
987
  throw new GraphQLError(
982
988
  `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` +
983
989
  didYouMeanEnumValue(this, valueStr),
984
- valueNode,
990
+ {
991
+ nodes: valueNode,
992
+ },
985
993
  );
986
994
  }
987
995
 
@@ -992,7 +1000,9 @@ export class GraphQLEnumType {
992
1000
  throw new GraphQLError(
993
1001
  `Value "${valueStr}" does not exist in "${this.name}" enum.` +
994
1002
  didYouMeanEnumValue(this, valueStr),
995
- valueNode,
1003
+ {
1004
+ nodes: valueNode,
1005
+ },
996
1006
  );
997
1007
  }
998
1008
 
package/type/scalars.js CHANGED
@@ -99,7 +99,9 @@ const GraphQLInt = new _definition.GraphQLScalarType({
99
99
  `Int cannot represent non-integer value: ${(0, _printer.print)(
100
100
  valueNode,
101
101
  )}`,
102
- valueNode,
102
+ {
103
+ nodes: valueNode,
104
+ },
103
105
  );
104
106
  }
105
107
 
@@ -108,7 +110,9 @@ const GraphQLInt = new _definition.GraphQLScalarType({
108
110
  if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
109
111
  throw new _GraphQLError.GraphQLError(
110
112
  `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,
111
- valueNode,
113
+ {
114
+ nodes: valueNode,
115
+ },
112
116
  );
113
117
  }
114
118
 
@@ -218,7 +222,9 @@ const GraphQLString = new _definition.GraphQLScalarType({
218
222
  `String cannot represent a non string value: ${(0, _printer.print)(
219
223
  valueNode,
220
224
  )}`,
221
- valueNode,
225
+ {
226
+ nodes: valueNode,
227
+ },
222
228
  );
223
229
  }
224
230
 
@@ -266,7 +272,9 @@ const GraphQLBoolean = new _definition.GraphQLScalarType({
266
272
  `Boolean cannot represent a non boolean value: ${(0, _printer.print)(
267
273
  valueNode,
268
274
  )}`,
269
- valueNode,
275
+ {
276
+ nodes: valueNode,
277
+ },
270
278
  );
271
279
  }
272
280
 
@@ -317,7 +325,9 @@ const GraphQLID = new _definition.GraphQLScalarType({
317
325
  throw new _GraphQLError.GraphQLError(
318
326
  'ID cannot represent a non-string and non-integer value: ' +
319
327
  (0, _printer.print)(valueNode),
320
- valueNode,
328
+ {
329
+ nodes: valueNode,
330
+ },
321
331
  );
322
332
  }
323
333
 
package/type/scalars.mjs CHANGED
@@ -70,7 +70,9 @@ export const GraphQLInt = new GraphQLScalarType({
70
70
  if (valueNode.kind !== Kind.INT) {
71
71
  throw new GraphQLError(
72
72
  `Int cannot represent non-integer value: ${print(valueNode)}`,
73
- valueNode,
73
+ {
74
+ nodes: valueNode,
75
+ },
74
76
  );
75
77
  }
76
78
 
@@ -79,7 +81,9 @@ export const GraphQLInt = new GraphQLScalarType({
79
81
  if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
80
82
  throw new GraphQLError(
81
83
  `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,
82
- valueNode,
84
+ {
85
+ nodes: valueNode,
86
+ },
83
87
  );
84
88
  }
85
89
 
@@ -174,7 +178,9 @@ export const GraphQLString = new GraphQLScalarType({
174
178
  if (valueNode.kind !== Kind.STRING) {
175
179
  throw new GraphQLError(
176
180
  `String cannot represent a non string value: ${print(valueNode)}`,
177
- valueNode,
181
+ {
182
+ nodes: valueNode,
183
+ },
178
184
  );
179
185
  }
180
186
 
@@ -215,7 +221,9 @@ export const GraphQLBoolean = new GraphQLScalarType({
215
221
  if (valueNode.kind !== Kind.BOOLEAN) {
216
222
  throw new GraphQLError(
217
223
  `Boolean cannot represent a non boolean value: ${print(valueNode)}`,
218
- valueNode,
224
+ {
225
+ nodes: valueNode,
226
+ },
219
227
  );
220
228
  }
221
229
 
@@ -260,7 +268,9 @@ export const GraphQLID = new GraphQLScalarType({
260
268
  throw new GraphQLError(
261
269
  'ID cannot represent a non-string and non-integer value: ' +
262
270
  print(valueNode),
263
- valueNode,
271
+ {
272
+ nodes: valueNode,
273
+ },
264
274
  );
265
275
  }
266
276
 
package/type/validate.js CHANGED
@@ -69,7 +69,11 @@ class SchemaValidationContext {
69
69
  reportError(message, nodes) {
70
70
  const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;
71
71
 
72
- this._errors.push(new _GraphQLError.GraphQLError(message, _nodes));
72
+ this._errors.push(
73
+ new _GraphQLError.GraphQLError(message, {
74
+ nodes: _nodes,
75
+ }),
76
+ );
73
77
  }
74
78
 
75
79
  getErrors() {
package/type/validate.mjs CHANGED
@@ -66,7 +66,11 @@ class SchemaValidationContext {
66
66
  reportError(message, nodes) {
67
67
  const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;
68
68
 
69
- this._errors.push(new GraphQLError(message, _nodes));
69
+ this._errors.push(
70
+ new GraphQLError(message, {
71
+ nodes: _nodes,
72
+ }),
73
+ );
70
74
  }
71
75
 
72
76
  getErrors() {
@@ -158,11 +158,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
158
158
  inputValue,
159
159
  new _GraphQLError.GraphQLError(
160
160
  `Expected type "${type.name}". ` + error.message,
161
- undefined,
162
- undefined,
163
- undefined,
164
- undefined,
165
- error,
161
+ {
162
+ originalError: error,
163
+ },
166
164
  ),
167
165
  );
168
166
  }
@@ -141,14 +141,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
141
141
  onError(
142
142
  pathToArray(path),
143
143
  inputValue,
144
- new GraphQLError(
145
- `Expected type "${type.name}". ` + error.message,
146
- undefined,
147
- undefined,
148
- undefined,
149
- undefined,
150
- error,
151
- ),
144
+ new GraphQLError(`Expected type "${type.name}". ` + error.message, {
145
+ originalError: error,
146
+ }),
152
147
  );
153
148
  }
154
149
 
@@ -19,7 +19,9 @@ function getOperationRootType(schema, operation) {
19
19
  if (!queryType) {
20
20
  throw new _GraphQLError.GraphQLError(
21
21
  'Schema does not define the required query root type.',
22
- operation,
22
+ {
23
+ nodes: operation,
24
+ },
23
25
  );
24
26
  }
25
27
 
@@ -32,7 +34,9 @@ function getOperationRootType(schema, operation) {
32
34
  if (!mutationType) {
33
35
  throw new _GraphQLError.GraphQLError(
34
36
  'Schema is not configured for mutations.',
35
- operation,
37
+ {
38
+ nodes: operation,
39
+ },
36
40
  );
37
41
  }
38
42
 
@@ -45,7 +49,9 @@ function getOperationRootType(schema, operation) {
45
49
  if (!subscriptionType) {
46
50
  throw new _GraphQLError.GraphQLError(
47
51
  'Schema is not configured for subscriptions.',
48
- operation,
52
+ {
53
+ nodes: operation,
54
+ },
49
55
  );
50
56
  }
51
57
 
@@ -54,6 +60,8 @@ function getOperationRootType(schema, operation) {
54
60
 
55
61
  throw new _GraphQLError.GraphQLError(
56
62
  'Can only have query, mutation and subscription operations.',
57
- operation,
63
+ {
64
+ nodes: operation,
65
+ },
58
66
  );
59
67
  }
@@ -12,7 +12,9 @@ export function getOperationRootType(schema, operation) {
12
12
  if (!queryType) {
13
13
  throw new GraphQLError(
14
14
  'Schema does not define the required query root type.',
15
- operation,
15
+ {
16
+ nodes: operation,
17
+ },
16
18
  );
17
19
  }
18
20
 
@@ -23,10 +25,9 @@ export function getOperationRootType(schema, operation) {
23
25
  const mutationType = schema.getMutationType();
24
26
 
25
27
  if (!mutationType) {
26
- throw new GraphQLError(
27
- 'Schema is not configured for mutations.',
28
- operation,
29
- );
28
+ throw new GraphQLError('Schema is not configured for mutations.', {
29
+ nodes: operation,
30
+ });
30
31
  }
31
32
 
32
33
  return mutationType;
@@ -36,10 +37,9 @@ export function getOperationRootType(schema, operation) {
36
37
  const subscriptionType = schema.getSubscriptionType();
37
38
 
38
39
  if (!subscriptionType) {
39
- throw new GraphQLError(
40
- 'Schema is not configured for subscriptions.',
41
- operation,
42
- );
40
+ throw new GraphQLError('Schema is not configured for subscriptions.', {
41
+ nodes: operation,
42
+ });
43
43
  }
44
44
 
45
45
  return subscriptionType;
@@ -47,6 +47,8 @@ export function getOperationRootType(schema, operation) {
47
47
 
48
48
  throw new GraphQLError(
49
49
  'Can only have query, mutation and subscription operations.',
50
- operation,
50
+ {
51
+ nodes: operation,
52
+ },
51
53
  );
52
54
  }
@@ -32,7 +32,9 @@ function ExecutableDefinitionsRule(context) {
32
32
  context.reportError(
33
33
  new _GraphQLError.GraphQLError(
34
34
  `The ${defName} definition is not executable.`,
35
- definition,
35
+ {
36
+ nodes: definition,
37
+ },
36
38
  ),
37
39
  );
38
40
  }
@@ -21,10 +21,9 @@ export function ExecutableDefinitionsRule(context) {
21
21
  ? 'schema'
22
22
  : '"' + definition.name.value + '"';
23
23
  context.reportError(
24
- new GraphQLError(
25
- `The ${defName} definition is not executable.`,
26
- definition,
27
- ),
24
+ new GraphQLError(`The ${defName} definition is not executable.`, {
25
+ nodes: definition,
26
+ }),
28
27
  );
29
28
  }
30
29
  }
@@ -51,7 +51,9 @@ function FieldsOnCorrectTypeRule(context) {
51
51
  new _GraphQLError.GraphQLError(
52
52
  `Cannot query field "${fieldName}" on type "${type.name}".` +
53
53
  suggestion,
54
- node,
54
+ {
55
+ nodes: node,
56
+ },
55
57
  ),
56
58
  );
57
59
  }
@@ -42,7 +42,9 @@ export function FieldsOnCorrectTypeRule(context) {
42
42
  new GraphQLError(
43
43
  `Cannot query field "${fieldName}" on type "${type.name}".` +
44
44
  suggestion,
45
- node,
45
+ {
46
+ nodes: node,
47
+ },
46
48
  ),
47
49
  );
48
50
  }
@@ -38,7 +38,9 @@ function FragmentsOnCompositeTypesRule(context) {
38
38
  context.reportError(
39
39
  new _GraphQLError.GraphQLError(
40
40
  `Fragment cannot condition on non composite type "${typeStr}".`,
41
- typeCondition,
41
+ {
42
+ nodes: typeCondition,
43
+ },
42
44
  ),
43
45
  );
44
46
  }
@@ -56,7 +58,9 @@ function FragmentsOnCompositeTypesRule(context) {
56
58
  context.reportError(
57
59
  new _GraphQLError.GraphQLError(
58
60
  `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`,
59
- node.typeCondition,
61
+ {
62
+ nodes: node.typeCondition,
63
+ },
60
64
  ),
61
65
  );
62
66
  }
@@ -25,7 +25,9 @@ export function FragmentsOnCompositeTypesRule(context) {
25
25
  context.reportError(
26
26
  new GraphQLError(
27
27
  `Fragment cannot condition on non composite type "${typeStr}".`,
28
- typeCondition,
28
+ {
29
+ nodes: typeCondition,
30
+ },
29
31
  ),
30
32
  );
31
33
  }
@@ -40,7 +42,9 @@ export function FragmentsOnCompositeTypesRule(context) {
40
42
  context.reportError(
41
43
  new GraphQLError(
42
44
  `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`,
43
- node.typeCondition,
45
+ {
46
+ nodes: node.typeCondition,
47
+ },
44
48
  ),
45
49
  );
46
50
  }
@@ -46,7 +46,9 @@ function KnownArgumentNamesRule(context) {
46
46
  new _GraphQLError.GraphQLError(
47
47
  `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` +
48
48
  (0, _didYouMean.didYouMean)(suggestions),
49
- argNode,
49
+ {
50
+ nodes: argNode,
51
+ },
50
52
  ),
51
53
  );
52
54
  }
@@ -103,7 +105,9 @@ function KnownArgumentNamesOnDirectivesRule(context) {
103
105
  new _GraphQLError.GraphQLError(
104
106
  `Unknown argument "${argName}" on directive "@${directiveName}".` +
105
107
  (0, _didYouMean.didYouMean)(suggestions),
106
- argNode,
108
+ {
109
+ nodes: argNode,
110
+ },
107
111
  ),
108
112
  );
109
113
  }
@@ -31,7 +31,9 @@ export function KnownArgumentNamesRule(context) {
31
31
  new GraphQLError(
32
32
  `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` +
33
33
  didYouMean(suggestions),
34
- argNode,
34
+ {
35
+ nodes: argNode,
36
+ },
35
37
  ),
36
38
  );
37
39
  }
@@ -85,7 +87,9 @@ export function KnownArgumentNamesOnDirectivesRule(context) {
85
87
  new GraphQLError(
86
88
  `Unknown argument "${argName}" on directive "@${directiveName}".` +
87
89
  didYouMean(suggestions),
88
- argNode,
90
+ {
91
+ nodes: argNode,
92
+ },
89
93
  ),
90
94
  );
91
95
  }
@@ -53,7 +53,9 @@ function KnownDirectivesRule(context) {
53
53
 
54
54
  if (!locations) {
55
55
  context.reportError(
56
- new _GraphQLError.GraphQLError(`Unknown directive "@${name}".`, node),
56
+ new _GraphQLError.GraphQLError(`Unknown directive "@${name}".`, {
57
+ nodes: node,
58
+ }),
57
59
  );
58
60
  return;
59
61
  }
@@ -64,7 +66,9 @@ function KnownDirectivesRule(context) {
64
66
  context.reportError(
65
67
  new _GraphQLError.GraphQLError(
66
68
  `Directive "@${name}" may not be used on ${candidateLocation}.`,
67
- node,
69
+ {
70
+ nodes: node,
71
+ },
68
72
  ),
69
73
  );
70
74
  }
@@ -40,7 +40,9 @@ export function KnownDirectivesRule(context) {
40
40
 
41
41
  if (!locations) {
42
42
  context.reportError(
43
- new GraphQLError(`Unknown directive "@${name}".`, node),
43
+ new GraphQLError(`Unknown directive "@${name}".`, {
44
+ nodes: node,
45
+ }),
44
46
  );
45
47
  return;
46
48
  }
@@ -51,7 +53,9 @@ export function KnownDirectivesRule(context) {
51
53
  context.reportError(
52
54
  new GraphQLError(
53
55
  `Directive "@${name}" may not be used on ${candidateLocation}.`,
54
- node,
56
+ {
57
+ nodes: node,
58
+ },
55
59
  ),
56
60
  );
57
61
  }
@@ -25,7 +25,9 @@ function KnownFragmentNamesRule(context) {
25
25
  context.reportError(
26
26
  new _GraphQLError.GraphQLError(
27
27
  `Unknown fragment "${fragmentName}".`,
28
- node.name,
28
+ {
29
+ nodes: node.name,
30
+ },
29
31
  ),
30
32
  );
31
33
  }
@@ -16,7 +16,9 @@ export function KnownFragmentNamesRule(context) {
16
16
 
17
17
  if (!fragment) {
18
18
  context.reportError(
19
- new GraphQLError(`Unknown fragment "${fragmentName}".`, node.name),
19
+ new GraphQLError(`Unknown fragment "${fragmentName}".`, {
20
+ nodes: node.name,
21
+ }),
20
22
  );
21
23
  }
22
24
  },
@@ -65,7 +65,9 @@ function KnownTypeNamesRule(context) {
65
65
  new _GraphQLError.GraphQLError(
66
66
  `Unknown type "${typeName}".` +
67
67
  (0, _didYouMean.didYouMean)(suggestedTypes),
68
- node,
68
+ {
69
+ nodes: node,
70
+ },
69
71
  ),
70
72
  );
71
73
  }
@@ -56,7 +56,9 @@ export function KnownTypeNamesRule(context) {
56
56
  context.reportError(
57
57
  new GraphQLError(
58
58
  `Unknown type "${typeName}".` + didYouMean(suggestedTypes),
59
- node,
59
+ {
60
+ nodes: node,
61
+ },
60
62
  ),
61
63
  );
62
64
  }
@@ -31,7 +31,9 @@ function LoneAnonymousOperationRule(context) {
31
31
  context.reportError(
32
32
  new _GraphQLError.GraphQLError(
33
33
  'This anonymous operation must be the only defined operation.',
34
- node,
34
+ {
35
+ nodes: node,
36
+ },
35
37
  ),
36
38
  );
37
39
  }
@@ -23,7 +23,9 @@ export function LoneAnonymousOperationRule(context) {
23
23
  context.reportError(
24
24
  new GraphQLError(
25
25
  'This anonymous operation must be the only defined operation.',
26
- node,
26
+ {
27
+ nodes: node,
28
+ },
27
29
  ),
28
30
  );
29
31
  }