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
@@ -14,7 +14,7 @@ import type { Source } from '../language/source';
14
14
  export interface GraphQLErrorExtensions {
15
15
  [attributeName: string]: unknown;
16
16
  }
17
- export interface GraphQLErrorArgs {
17
+ export interface GraphQLErrorOptions {
18
18
  nodes?: ReadonlyArray<ASTNode> | ASTNode | null;
19
19
  source?: Maybe<Source>;
20
20
  positions?: Maybe<ReadonlyArray<number>>;
@@ -75,8 +75,9 @@ export declare class GraphQLError extends Error {
75
75
  * Extension fields to add to the formatted error.
76
76
  */
77
77
  readonly extensions: GraphQLErrorExtensions;
78
+ constructor(message: string, options?: GraphQLErrorOptions);
78
79
  /**
79
- * @deprecated Please use the `GraphQLErrorArgs` constructor overload instead.
80
+ * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
80
81
  */
81
82
  constructor(
82
83
  message: string,
@@ -91,7 +92,6 @@ export declare class GraphQLError extends Error {
91
92
  >,
92
93
  extensions?: Maybe<GraphQLErrorExtensions>,
93
94
  );
94
- constructor(message: string, args?: GraphQLErrorArgs);
95
95
  get [Symbol.toStringTag](): string;
96
96
  toString(): string;
97
97
  toJSON(): GraphQLFormattedError;
@@ -137,6 +137,6 @@ export declare function printError(error: GraphQLError): string;
137
137
  * Given a GraphQLError, format it according to the rules described by the
138
138
  * Response Format, Errors section of the GraphQL Specification.
139
139
  *
140
- * @deprecated Please use `error.toString` instead. Will be removed in v17
140
+ * @deprecated Please use `error.toJSON` instead. Will be removed in v17
141
141
  */
142
142
  export declare function formatError(error: GraphQLError): GraphQLFormattedError;
@@ -13,7 +13,7 @@ var _location = require('../language/location.js');
13
13
 
14
14
  var _printLocation = require('../language/printLocation.js');
15
15
 
16
- function toNormalizedArgs(args) {
16
+ function toNormalizedOptions(args) {
17
17
  const firstArg = args[0];
18
18
 
19
19
  if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {
@@ -80,13 +80,13 @@ class GraphQLError extends Error {
80
80
  */
81
81
 
82
82
  /**
83
- * @deprecated Please use the `GraphQLErrorArgs` constructor overload instead.
83
+ * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
84
84
  */
85
85
  constructor(message, ...rawArgs) {
86
86
  var _this$nodes, _nodeLocations$, _ref;
87
87
 
88
88
  const { nodes, source, positions, path, originalError, extensions } =
89
- toNormalizedArgs(rawArgs);
89
+ toNormalizedOptions(rawArgs);
90
90
  super(message);
91
91
  this.name = 'GraphQLError';
92
92
  this.path = path !== null && path !== void 0 ? path : undefined;
@@ -259,7 +259,7 @@ function printError(error) {
259
259
  * Given a GraphQLError, format it according to the rules described by the
260
260
  * Response Format, Errors section of the GraphQL Specification.
261
261
  *
262
- * @deprecated Please use `error.toString` instead. Will be removed in v17
262
+ * @deprecated Please use `error.toJSON` instead. Will be removed in v17
263
263
  */
264
264
 
265
265
  function formatError(error) {
@@ -5,7 +5,7 @@ import {
5
5
  printSourceLocation,
6
6
  } from '../language/printLocation.mjs';
7
7
 
8
- function toNormalizedArgs(args) {
8
+ function toNormalizedOptions(args) {
9
9
  const firstArg = args[0];
10
10
 
11
11
  if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {
@@ -72,13 +72,13 @@ export class GraphQLError extends Error {
72
72
  */
73
73
 
74
74
  /**
75
- * @deprecated Please use the `GraphQLErrorArgs` constructor overload instead.
75
+ * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
76
76
  */
77
77
  constructor(message, ...rawArgs) {
78
78
  var _this$nodes, _nodeLocations$, _ref;
79
79
 
80
80
  const { nodes, source, positions, path, originalError, extensions } =
81
- toNormalizedArgs(rawArgs);
81
+ toNormalizedOptions(rawArgs);
82
82
  super(message);
83
83
  this.name = 'GraphQLError';
84
84
  this.path = path !== null && path !== void 0 ? path : undefined;
@@ -245,7 +245,7 @@ export function printError(error) {
245
245
  * Given a GraphQLError, format it according to the rules described by the
246
246
  * Response Format, Errors section of the GraphQL Specification.
247
247
  *
248
- * @deprecated Please use `error.toString` instead. Will be removed in v17
248
+ * @deprecated Please use `error.toJSON` instead. Will be removed in v17
249
249
  */
250
250
 
251
251
  export function formatError(error) {
package/error/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { GraphQLError, printError, formatError } from './GraphQLError';
2
2
  export type {
3
+ GraphQLErrorOptions,
3
4
  GraphQLFormattedError,
4
5
  GraphQLErrorExtensions,
5
6
  } from './GraphQLError';
@@ -23,16 +23,16 @@ function locatedError(rawOriginalError, nodes, path) {
23
23
  return originalError;
24
24
  }
25
25
 
26
- return new _GraphQLError.GraphQLError(
27
- originalError.message,
28
- (_nodes = originalError.nodes) !== null && _nodes !== void 0
29
- ? _nodes
30
- : nodes,
31
- originalError.source,
32
- originalError.positions,
26
+ return new _GraphQLError.GraphQLError(originalError.message, {
27
+ nodes:
28
+ (_nodes = originalError.nodes) !== null && _nodes !== void 0
29
+ ? _nodes
30
+ : nodes,
31
+ source: originalError.source,
32
+ positions: originalError.positions,
33
33
  path,
34
34
  originalError,
35
- );
35
+ });
36
36
  }
37
37
 
38
38
  function isLocatedGraphQLError(error) {
@@ -15,16 +15,16 @@ export function locatedError(rawOriginalError, nodes, path) {
15
15
  return originalError;
16
16
  }
17
17
 
18
- return new GraphQLError(
19
- originalError.message,
20
- (_nodes = originalError.nodes) !== null && _nodes !== void 0
21
- ? _nodes
22
- : nodes,
23
- originalError.source,
24
- originalError.positions,
18
+ return new GraphQLError(originalError.message, {
19
+ nodes:
20
+ (_nodes = originalError.nodes) !== null && _nodes !== void 0
21
+ ? _nodes
22
+ : nodes,
23
+ source: originalError.source,
24
+ positions: originalError.positions,
25
25
  path,
26
26
  originalError,
27
- );
27
+ });
28
28
  }
29
29
 
30
30
  function isLocatedGraphQLError(error) {
@@ -12,10 +12,8 @@ var _GraphQLError = require('./GraphQLError.js');
12
12
  * descriptive information about the syntax error's position in the source.
13
13
  */
14
14
  function syntaxError(source, position, description) {
15
- return new _GraphQLError.GraphQLError(
16
- `Syntax Error: ${description}`,
17
- undefined,
15
+ return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, {
18
16
  source,
19
- [position],
20
- );
17
+ positions: [position],
18
+ });
21
19
  }
@@ -5,7 +5,8 @@ import { GraphQLError } from './GraphQLError.mjs';
5
5
  */
6
6
 
7
7
  export function syntaxError(source, position, description) {
8
- return new GraphQLError(`Syntax Error: ${description}`, undefined, source, [
9
- position,
10
- ]);
8
+ return new GraphQLError(`Syntax Error: ${description}`, {
9
+ source,
10
+ positions: [position],
11
+ });
11
12
  }
@@ -324,7 +324,9 @@ function executeOperation(exeContext, operation, rootValue) {
324
324
  if (rootType == null) {
325
325
  throw new _GraphQLError.GraphQLError(
326
326
  `Schema is not configured to execute ${operation.operation} operation.`,
327
- operation,
327
+ {
328
+ nodes: operation,
329
+ },
328
330
  );
329
331
  }
330
332
 
@@ -842,21 +844,27 @@ function ensureValidRuntimeType(
842
844
  if (runtimeType == null) {
843
845
  throw new _GraphQLError.GraphQLError(
844
846
  `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
845
- fieldNodes,
847
+ {
848
+ nodes: fieldNodes,
849
+ },
846
850
  );
847
851
  }
848
852
 
849
853
  if (!(0, _definition.isObjectType)(runtimeType)) {
850
854
  throw new _GraphQLError.GraphQLError(
851
855
  `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`,
852
- fieldNodes,
856
+ {
857
+ nodes: fieldNodes,
858
+ },
853
859
  );
854
860
  }
855
861
 
856
862
  if (!exeContext.schema.isSubType(returnType, runtimeType)) {
857
863
  throw new _GraphQLError.GraphQLError(
858
864
  `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`,
859
- fieldNodes,
865
+ {
866
+ nodes: fieldNodes,
867
+ },
860
868
  );
861
869
  }
862
870
 
@@ -910,7 +918,9 @@ function invalidReturnTypeError(returnType, result, fieldNodes) {
910
918
  return new _GraphQLError.GraphQLError(
911
919
  `Expected value of type "${returnType.name}" but got: ${(0,
912
920
  _inspect.inspect)(result)}.`,
913
- fieldNodes,
921
+ {
922
+ nodes: fieldNodes,
923
+ },
914
924
  );
915
925
  }
916
926
  /**
@@ -305,7 +305,9 @@ function executeOperation(exeContext, operation, rootValue) {
305
305
  if (rootType == null) {
306
306
  throw new GraphQLError(
307
307
  `Schema is not configured to execute ${operation.operation} operation.`,
308
- operation,
308
+ {
309
+ nodes: operation,
310
+ },
309
311
  );
310
312
  }
311
313
 
@@ -812,21 +814,27 @@ function ensureValidRuntimeType(
812
814
  if (runtimeType == null) {
813
815
  throw new GraphQLError(
814
816
  `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
815
- fieldNodes,
817
+ {
818
+ nodes: fieldNodes,
819
+ },
816
820
  );
817
821
  }
818
822
 
819
823
  if (!isObjectType(runtimeType)) {
820
824
  throw new GraphQLError(
821
825
  `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`,
822
- fieldNodes,
826
+ {
827
+ nodes: fieldNodes,
828
+ },
823
829
  );
824
830
  }
825
831
 
826
832
  if (!exeContext.schema.isSubType(returnType, runtimeType)) {
827
833
  throw new GraphQLError(
828
834
  `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`,
829
- fieldNodes,
835
+ {
836
+ nodes: fieldNodes,
837
+ },
830
838
  );
831
839
  }
832
840
 
@@ -879,7 +887,9 @@ function completeObjectValue(
879
887
  function invalidReturnTypeError(returnType, result, fieldNodes) {
880
888
  return new GraphQLError(
881
889
  `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`,
882
- fieldNodes,
890
+ {
891
+ nodes: fieldNodes,
892
+ },
883
893
  );
884
894
  }
885
895
  /**
@@ -11,4 +11,8 @@ export type {
11
11
  FormattedExecutionResult,
12
12
  } from './execute';
13
13
  export { subscribe, createSourceEventStream } from './subscribe';
14
- export { getVariableValues, getDirectiveValues } from './values';
14
+ export {
15
+ getArgumentValues,
16
+ getVariableValues,
17
+ getDirectiveValues,
18
+ } from './values';
@@ -33,6 +33,12 @@ Object.defineProperty(exports, 'executeSync', {
33
33
  return _execute.executeSync;
34
34
  },
35
35
  });
36
+ Object.defineProperty(exports, 'getArgumentValues', {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _values.getArgumentValues;
40
+ },
41
+ });
36
42
  Object.defineProperty(exports, 'getDirectiveValues', {
37
43
  enumerable: true,
38
44
  get: function () {
@@ -6,4 +6,8 @@ export {
6
6
  defaultTypeResolver,
7
7
  } from './execute.mjs';
8
8
  export { subscribe, createSourceEventStream } from './subscribe.mjs';
9
- export { getVariableValues, getDirectiveValues } from './values.mjs';
9
+ export {
10
+ getArgumentValues,
11
+ getVariableValues,
12
+ getDirectiveValues,
13
+ } from './values.mjs';
@@ -190,7 +190,9 @@ async function executeSubscription(exeContext) {
190
190
  if (rootType == null) {
191
191
  throw new _GraphQLError.GraphQLError(
192
192
  'Schema is not configured to execute subscription operation.',
193
- operation,
193
+ {
194
+ nodes: operation,
195
+ },
194
196
  );
195
197
  }
196
198
 
@@ -208,7 +210,9 @@ async function executeSubscription(exeContext) {
208
210
  const fieldName = fieldNodes[0].name.value;
209
211
  throw new _GraphQLError.GraphQLError(
210
212
  `The subscription field "${fieldName}" is not defined.`,
211
- fieldNodes,
213
+ {
214
+ nodes: fieldNodes,
215
+ },
212
216
  );
213
217
  }
214
218
 
@@ -176,7 +176,9 @@ async function executeSubscription(exeContext) {
176
176
  if (rootType == null) {
177
177
  throw new GraphQLError(
178
178
  'Schema is not configured to execute subscription operation.',
179
- operation,
179
+ {
180
+ nodes: operation,
181
+ },
180
182
  );
181
183
  }
182
184
 
@@ -194,7 +196,9 @@ async function executeSubscription(exeContext) {
194
196
  const fieldName = fieldNodes[0].name.value;
195
197
  throw new GraphQLError(
196
198
  `The subscription field "${fieldName}" is not defined.`,
197
- fieldNodes,
199
+ {
200
+ nodes: fieldNodes,
201
+ },
198
202
  );
199
203
  }
200
204
 
@@ -46,8 +46,6 @@ export declare function getVariableValues(
46
46
  * Note: The returned value is a plain Object with a prototype, since it is
47
47
  * exposed to user code. Care should be taken to not pull values from the
48
48
  * Object prototype.
49
- *
50
- * @internal
51
49
  */
52
50
  export declare function getArgumentValues(
53
51
  def: GraphQLField<unknown, unknown> | GraphQLDirective,
@@ -85,7 +85,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
85
85
  onError(
86
86
  new _GraphQLError.GraphQLError(
87
87
  `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
88
- varDefNode.type,
88
+ {
89
+ nodes: varDefNode.type,
90
+ },
89
91
  ),
90
92
  );
91
93
  continue;
@@ -102,7 +104,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
102
104
  onError(
103
105
  new _GraphQLError.GraphQLError(
104
106
  `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
105
- varDefNode,
107
+ {
108
+ nodes: varDefNode,
109
+ },
106
110
  ),
107
111
  );
108
112
  }
@@ -117,7 +121,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
117
121
  onError(
118
122
  new _GraphQLError.GraphQLError(
119
123
  `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
120
- varDefNode,
124
+ {
125
+ nodes: varDefNode,
126
+ },
121
127
  ),
122
128
  );
123
129
  continue;
@@ -138,14 +144,10 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
138
144
  }
139
145
 
140
146
  onError(
141
- new _GraphQLError.GraphQLError(
142
- prefix + '; ' + error.message,
143
- varDefNode,
144
- undefined,
145
- undefined,
146
- undefined,
147
- error.originalError,
148
- ),
147
+ new _GraphQLError.GraphQLError(prefix + '; ' + error.message, {
148
+ nodes: varDefNode,
149
+ originalError: error.originalError,
150
+ }),
149
151
  );
150
152
  },
151
153
  );
@@ -160,8 +162,6 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
160
162
  * Note: The returned value is a plain Object with a prototype, since it is
161
163
  * exposed to user code. Care should be taken to not pull values from the
162
164
  * Object prototype.
163
- *
164
- * @internal
165
165
  */
166
166
 
167
167
  function getArgumentValues(def, node, variableValues) {
@@ -193,7 +193,9 @@ function getArgumentValues(def, node, variableValues) {
193
193
  `Argument "${name}" of required type "${(0, _inspect.inspect)(
194
194
  argType,
195
195
  )}" ` + 'was not provided.',
196
- node,
196
+ {
197
+ nodes: node,
198
+ },
197
199
  );
198
200
  }
199
201
 
@@ -218,7 +220,9 @@ function getArgumentValues(def, node, variableValues) {
218
220
  argType,
219
221
  )}" ` +
220
222
  `was provided the variable "$${variableName}" which was not provided a runtime value.`,
221
- valueNode,
223
+ {
224
+ nodes: valueNode,
225
+ },
222
226
  );
223
227
  }
224
228
 
@@ -233,7 +237,9 @@ function getArgumentValues(def, node, variableValues) {
233
237
  `Argument "${name}" of non-null type "${(0, _inspect.inspect)(
234
238
  argType,
235
239
  )}" ` + 'must not be null.',
236
- valueNode,
240
+ {
241
+ nodes: valueNode,
242
+ },
237
243
  );
238
244
  }
239
245
 
@@ -251,7 +257,9 @@ function getArgumentValues(def, node, variableValues) {
251
257
  `Argument "${name}" has invalid value ${(0, _printer.print)(
252
258
  valueNode,
253
259
  )}.`,
254
- valueNode,
260
+ {
261
+ nodes: valueNode,
262
+ },
255
263
  );
256
264
  }
257
265
 
@@ -67,7 +67,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
67
67
  onError(
68
68
  new GraphQLError(
69
69
  `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
70
- varDefNode.type,
70
+ {
71
+ nodes: varDefNode.type,
72
+ },
71
73
  ),
72
74
  );
73
75
  continue;
@@ -81,7 +83,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
81
83
  onError(
82
84
  new GraphQLError(
83
85
  `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
84
- varDefNode,
86
+ {
87
+ nodes: varDefNode,
88
+ },
85
89
  ),
86
90
  );
87
91
  }
@@ -96,7 +100,9 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
96
100
  onError(
97
101
  new GraphQLError(
98
102
  `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
99
- varDefNode,
103
+ {
104
+ nodes: varDefNode,
105
+ },
100
106
  ),
101
107
  );
102
108
  continue;
@@ -114,14 +120,10 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
114
120
  }
115
121
 
116
122
  onError(
117
- new GraphQLError(
118
- prefix + '; ' + error.message,
119
- varDefNode,
120
- undefined,
121
- undefined,
122
- undefined,
123
- error.originalError,
124
- ),
123
+ new GraphQLError(prefix + '; ' + error.message, {
124
+ nodes: varDefNode,
125
+ originalError: error.originalError,
126
+ }),
125
127
  );
126
128
  },
127
129
  );
@@ -136,8 +138,6 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
136
138
  * Note: The returned value is a plain Object with a prototype, since it is
137
139
  * exposed to user code. Care should be taken to not pull values from the
138
140
  * Object prototype.
139
- *
140
- * @internal
141
141
  */
142
142
 
143
143
  export function getArgumentValues(def, node, variableValues) {
@@ -165,7 +165,9 @@ export function getArgumentValues(def, node, variableValues) {
165
165
  throw new GraphQLError(
166
166
  `Argument "${name}" of required type "${inspect(argType)}" ` +
167
167
  'was not provided.',
168
- node,
168
+ {
169
+ nodes: node,
170
+ },
169
171
  );
170
172
  }
171
173
 
@@ -188,7 +190,9 @@ export function getArgumentValues(def, node, variableValues) {
188
190
  throw new GraphQLError(
189
191
  `Argument "${name}" of required type "${inspect(argType)}" ` +
190
192
  `was provided the variable "$${variableName}" which was not provided a runtime value.`,
191
- valueNode,
193
+ {
194
+ nodes: valueNode,
195
+ },
192
196
  );
193
197
  }
194
198
 
@@ -202,7 +206,9 @@ export function getArgumentValues(def, node, variableValues) {
202
206
  throw new GraphQLError(
203
207
  `Argument "${name}" of non-null type "${inspect(argType)}" ` +
204
208
  'must not be null.',
205
- valueNode,
209
+ {
210
+ nodes: valueNode,
211
+ },
206
212
  );
207
213
  }
208
214
 
@@ -214,7 +220,9 @@ export function getArgumentValues(def, node, variableValues) {
214
220
  // continue with an invalid argument value.
215
221
  throw new GraphQLError(
216
222
  `Argument "${name}" has invalid value ${print(valueNode)}.`,
217
- valueNode,
223
+ {
224
+ nodes: valueNode,
225
+ },
218
226
  );
219
227
  }
220
228
 
package/index.d.ts CHANGED
@@ -284,6 +284,7 @@ export {
284
284
  defaultFieldResolver,
285
285
  defaultTypeResolver,
286
286
  responsePathAsArray,
287
+ getArgumentValues,
287
288
  getVariableValues,
288
289
  getDirectiveValues,
289
290
  subscribe,
@@ -345,6 +346,7 @@ export {
345
346
  formatError,
346
347
  } from './error/index';
347
348
  export type {
349
+ GraphQLErrorOptions,
348
350
  GraphQLFormattedError,
349
351
  GraphQLErrorExtensions,
350
352
  } from './error/index';
package/index.js CHANGED
@@ -741,6 +741,12 @@ Object.defineProperty(exports, 'formatError', {
741
741
  return _index5.formatError;
742
742
  },
743
743
  });
744
+ Object.defineProperty(exports, 'getArgumentValues', {
745
+ enumerable: true,
746
+ get: function () {
747
+ return _index3.getArgumentValues;
748
+ },
749
+ });
744
750
  Object.defineProperty(exports, 'getDirectiveValues', {
745
751
  enumerable: true,
746
752
  get: function () {
package/index.mjs CHANGED
@@ -161,6 +161,7 @@ export {
161
161
  defaultFieldResolver,
162
162
  defaultTypeResolver,
163
163
  responsePathAsArray,
164
+ getArgumentValues,
164
165
  getVariableValues,
165
166
  getDirectiveValues,
166
167
  subscribe,
@@ -14,8 +14,9 @@ var _inspect = require('./inspect.js');
14
14
  * See: https://webpack.js.org/guides/production/
15
15
  */
16
16
  const instanceOf =
17
- /* c8 ignore next 5 */
17
+ /* c8 ignore next 6 */
18
18
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
19
+ // eslint-disable-next-line no-undef
19
20
  process.env.NODE_ENV === 'production'
20
21
  ? function instanceOf(value, constructor) {
21
22
  return value instanceof constructor;
@@ -7,8 +7,9 @@ import { inspect } from './inspect.mjs';
7
7
  */
8
8
 
9
9
  export const instanceOf =
10
- /* c8 ignore next 5 */
10
+ /* c8 ignore next 6 */
11
11
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
12
+ // eslint-disable-next-line no-undef
12
13
  process.env.NODE_ENV === 'production'
13
14
  ? function instanceOf(value, constructor) {
14
15
  return value instanceof constructor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql",
3
- "version": "16.3.0",
3
+ "version": "16.5.0",
4
4
  "description": "A Query Language and Runtime which can target any service.",
5
5
  "license": "MIT",
6
6
  "main": "index",
@@ -31,7 +31,7 @@
31
31
  "graphql-js"
32
32
  ],
33
33
  "engines": {
34
- "node": "^12.22.0 || ^14.16.0 || >=16.0.0"
34
+ "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "tag": "latest"