graphql 15.5.0 → 15.6.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/index.d.ts CHANGED
@@ -230,6 +230,7 @@ export {
230
230
  Visitor,
231
231
  VisitFn,
232
232
  VisitorKeyMap,
233
+ ASTVisitorKeyMap,
233
234
  // AST nodes
234
235
  ASTNode,
235
236
  ASTKindToNode,
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- /**
9
- * A replacement for instanceof which includes an error warning when multi-realm
10
- * constructors are detected.
11
- */
8
+ var _inspect = _interopRequireDefault(require("./inspect.js"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
13
+
12
14
  // See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
13
15
  // See: https://webpack.js.org/guides/production/
14
16
  var _default = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
@@ -21,12 +23,16 @@ function instanceOf(value, constructor) {
21
23
  return true;
22
24
  }
23
25
 
24
- if (value) {
25
- var valueClass = value.constructor;
26
- var className = constructor.name;
26
+ if (_typeof(value) === 'object' && value !== null) {
27
+ var _value$constructor;
28
+
29
+ var className = constructor.prototype[Symbol.toStringTag];
30
+ var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
31
+ Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;
27
32
 
28
- if (className && valueClass && valueClass.name === className) {
29
- throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
33
+ if (className === valueClassName) {
34
+ var stringifiedValue = (0, _inspect.default)(value);
35
+ throw new Error("Cannot use ".concat(className, " \"").concat(stringifiedValue, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
30
36
  }
31
37
  }
32
38
 
@@ -1,4 +1,6 @@
1
1
  // @flow strict
2
+ import inspect from './inspect';
3
+
2
4
  /**
3
5
  * A replacement for instanceof which includes an error warning when multi-realm
4
6
  * constructors are detected.
@@ -21,12 +23,17 @@ export default process.env.NODE_ENV === 'production'
21
23
  if (value instanceof constructor) {
22
24
  return true;
23
25
  }
24
- if (value) {
25
- const valueClass = value.constructor;
26
- const className = constructor.name;
27
- if (className && valueClass && valueClass.name === className) {
26
+ if (typeof value === 'object' && value !== null) {
27
+ const className = constructor.prototype[Symbol.toStringTag];
28
+ const valueClassName =
29
+ // We still need to support constructor's name to detect conflicts with older versions of this library.
30
+ Symbol.toStringTag in value
31
+ ? value[Symbol.toStringTag]
32
+ : value.constructor?.name;
33
+ if (className === valueClassName) {
34
+ const stringifiedValue = inspect(value);
28
35
  throw new Error(
29
- `Cannot use ${className} "${value}" from another module or realm.
36
+ `Cannot use ${className} "${stringifiedValue}" from another module or realm.
30
37
 
31
38
  Ensure that there is only one instance of "graphql" in the node_modules
32
39
  directory. If different versions of "graphql" are the dependencies of other
@@ -1,7 +1,11 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
+
3
+ import inspect from "./inspect.mjs";
1
4
  /**
2
5
  * A replacement for instanceof which includes an error warning when multi-realm
3
6
  * constructors are detected.
4
7
  */
8
+
5
9
  // See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
6
10
  // See: https://webpack.js.org/guides/production/
7
11
  export default process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
@@ -14,12 +18,16 @@ function instanceOf(value, constructor) {
14
18
  return true;
15
19
  }
16
20
 
17
- if (value) {
18
- var valueClass = value.constructor;
19
- var className = constructor.name;
21
+ if (_typeof(value) === 'object' && value !== null) {
22
+ var _value$constructor;
23
+
24
+ var className = constructor.prototype[Symbol.toStringTag];
25
+ var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
26
+ Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;
20
27
 
21
- if (className && valueClass && valueClass.name === className) {
22
- throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
28
+ if (className === valueClassName) {
29
+ var stringifiedValue = inspect(value);
30
+ throw new Error("Cannot use ".concat(className, " \"").concat(stringifiedValue, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
23
31
  }
24
32
  }
25
33
 
@@ -17,6 +17,7 @@ export {
17
17
  Visitor,
18
18
  VisitFn,
19
19
  VisitorKeyMap,
20
+ ASTVisitorKeyMap,
20
21
  } from './visitor';
21
22
 
22
23
  export {
@@ -1,5 +1,55 @@
1
+ import { Maybe } from '../jsutils/Maybe';
2
+ import { GraphQLError } from '..';
3
+
4
+ import { TokenKindEnum } from './tokenKind';
1
5
  import { Source } from './source';
2
- import { TypeNode, ValueNode, DocumentNode } from './ast';
6
+ import {
7
+ TypeNode,
8
+ ValueNode,
9
+ DocumentNode,
10
+ Token,
11
+ Location,
12
+ NameNode,
13
+ DirectiveDefinitionNode,
14
+ InputObjectTypeExtensionNode,
15
+ EnumTypeExtensionNode,
16
+ UnionTypeExtensionNode,
17
+ InterfaceTypeExtensionNode,
18
+ ObjectTypeExtensionNode,
19
+ ScalarTypeExtensionNode,
20
+ SchemaExtensionNode,
21
+ TypeSystemExtensionNode,
22
+ InputValueDefinitionNode,
23
+ InputObjectTypeDefinitionNode,
24
+ EnumValueDefinitionNode,
25
+ EnumTypeDefinitionNode,
26
+ NamedTypeNode,
27
+ UnionTypeDefinitionNode,
28
+ InterfaceTypeDefinitionNode,
29
+ FieldDefinitionNode,
30
+ ObjectTypeDefinitionNode,
31
+ ScalarTypeDefinitionNode,
32
+ OperationTypeDefinitionNode,
33
+ SchemaDefinitionNode,
34
+ StringValueNode,
35
+ DirectiveNode,
36
+ ObjectFieldNode,
37
+ ObjectValueNode,
38
+ FragmentSpreadNode,
39
+ InlineFragmentNode,
40
+ ArgumentNode,
41
+ FieldNode,
42
+ SelectionNode,
43
+ SelectionSetNode,
44
+ VariableNode,
45
+ VariableDefinitionNode,
46
+ OperationTypeNode,
47
+ OperationDefinitionNode,
48
+ DefinitionNode,
49
+ FragmentDefinitionNode,
50
+ ListValueNode,
51
+ } from './ast';
52
+ import { Lexer } from './lexer';
3
53
 
4
54
  /**
5
55
  * Configuration options to control parser behavior
@@ -86,3 +136,408 @@ export function parseType(
86
136
  source: string | Source,
87
137
  options?: ParseOptions,
88
138
  ): TypeNode;
139
+
140
+ export class Parser {
141
+ protected _lexer: Lexer;
142
+ protected _options?: ParseOptions;
143
+ constructor(source: string | Source, options?: ParseOptions);
144
+
145
+ /**
146
+ * Converts a name lex token into a name parse node.
147
+ */
148
+ parseName(): NameNode;
149
+ /**
150
+ * Document : Definition+
151
+ */
152
+ parseDocument(): DocumentNode;
153
+ /**
154
+ * Definition :
155
+ * - ExecutableDefinition
156
+ * - TypeSystemDefinition
157
+ * - TypeSystemExtension
158
+ *
159
+ * ExecutableDefinition :
160
+ * - OperationDefinition
161
+ * - FragmentDefinition
162
+ *
163
+ * TypeSystemDefinition :
164
+ * - SchemaDefinition
165
+ * - TypeDefinition
166
+ * - DirectiveDefinition
167
+ *
168
+ * TypeDefinition :
169
+ * - ScalarTypeDefinition
170
+ * - ObjectTypeDefinition
171
+ * - InterfaceTypeDefinition
172
+ * - UnionTypeDefinition
173
+ * - EnumTypeDefinition
174
+ * - InputObjectTypeDefinition
175
+ */
176
+ parseDefinition(): DefinitionNode;
177
+ /**
178
+ * OperationDefinition :
179
+ * - SelectionSet
180
+ * - OperationType Name? VariableDefinitions? Directives? SelectionSet
181
+ */
182
+ parseOperationDefinition(): OperationDefinitionNode;
183
+ /**
184
+ * OperationType : one of query mutation subscription
185
+ */
186
+ parseOperationType(): OperationTypeNode;
187
+ /**
188
+ * VariableDefinitions : ( VariableDefinition+ )
189
+ */
190
+ parseVariableDefinitions(): Array<VariableDefinitionNode>;
191
+ /**
192
+ * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
193
+ */
194
+ parseVariableDefinition(): VariableDefinitionNode;
195
+ /**
196
+ * Variable : $ Name
197
+ */
198
+ parseVariable(): VariableNode;
199
+ /**
200
+ * ```
201
+ * SelectionSet : { Selection+ }
202
+ * ```
203
+ */
204
+ parseSelectionSet(): SelectionSetNode;
205
+ /**
206
+ * Selection :
207
+ * - Field
208
+ * - FragmentSpread
209
+ * - InlineFragment
210
+ */
211
+ parseSelection(): SelectionNode;
212
+ /**
213
+ * Field : Alias? Name Arguments? Directives? SelectionSet?
214
+ *
215
+ * Alias : Name :
216
+ */
217
+ parseField(): FieldNode;
218
+ /**
219
+ * Arguments[Const] : ( Argument[?Const]+ )
220
+ */
221
+ parseArguments(): Array<ArgumentNode>;
222
+ /**
223
+ * Argument[Const] : Name : Value[?Const]
224
+ */
225
+ parseArgument(): ArgumentNode;
226
+ /**
227
+ * Corresponds to both FragmentSpread and InlineFragment in the spec.
228
+ *
229
+ * FragmentSpread : ... FragmentName Directives?
230
+ *
231
+ * InlineFragment : ... TypeCondition? Directives? SelectionSet
232
+ */
233
+ parseFragment(): FragmentSpreadNode | InlineFragmentNode;
234
+ /**
235
+ * FragmentDefinition :
236
+ * - fragment FragmentName on TypeCondition Directives? SelectionSet
237
+ *
238
+ * TypeCondition : NamedType
239
+ */
240
+ parseFragmentDefinition(): FragmentDefinitionNode;
241
+ /**
242
+ * FragmentName : Name but not `on`
243
+ */
244
+ parseFragmentName(): NameNode;
245
+ /**
246
+ * Value[Const] :
247
+ * - [~Const] Variable
248
+ * - IntValue
249
+ * - FloatValue
250
+ * - StringValue
251
+ * - BooleanValue
252
+ * - NullValue
253
+ * - EnumValue
254
+ * - ListValue[?Const]
255
+ * - ObjectValue[?Const]
256
+ *
257
+ * BooleanValue : one of `true` `false`
258
+ *
259
+ * NullValue : `null`
260
+ *
261
+ * EnumValue : Name but not `true`, `false` or `null`
262
+ */
263
+ parseValueLiteral(): ValueNode;
264
+ parseStringLiteral(): StringValueNode;
265
+ /**
266
+ * ListValue[Const] :
267
+ * - [ ]
268
+ * - [ Value[?Const]+ ]
269
+ */
270
+ parseList(): ListValueNode;
271
+ /**
272
+ * ```
273
+ * ObjectValue[Const] :
274
+ * - { }
275
+ * - { ObjectField[?Const]+ }
276
+ * ```
277
+ */
278
+ parseObject(isConst: boolean): ObjectValueNode;
279
+ /**
280
+ * ObjectField[Const] : Name : Value[?Const]
281
+ */
282
+ parseObjectField: ObjectFieldNode;
283
+ /**
284
+ * Directives[Const] : Directive[?Const]+
285
+ */
286
+ parseDirectives(): Array<DirectiveNode>;
287
+ /**
288
+ * ```
289
+ * Directive[Const] : @ Name Arguments[?Const]?
290
+ * ```
291
+ */
292
+ parseDirective(): DirectiveNode;
293
+ /**
294
+ * Type :
295
+ * - NamedType
296
+ * - ListType
297
+ * - NonNullType
298
+ */
299
+ parseTypeReference(): TypeNode;
300
+ /**
301
+ * NamedType : Name
302
+ */
303
+ parseNamedType(): NamedTypeNode;
304
+ peekDescription(): boolean;
305
+ /**
306
+ * Description : StringValue
307
+ */
308
+ parseDescription(): undefined | StringValueNode;
309
+ /**
310
+ * ```
311
+ * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
312
+ * ```
313
+ */
314
+ parseSchemaDefinition(): SchemaDefinitionNode;
315
+ /**
316
+ * OperationTypeDefinition : OperationType : NamedType
317
+ */
318
+ parseOperationTypeDefinition(): OperationTypeDefinitionNode;
319
+ /**
320
+ * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
321
+ */
322
+ parseScalarTypeDefinition(): ScalarTypeDefinitionNode;
323
+ /**
324
+ * ObjectTypeDefinition :
325
+ * Description?
326
+ * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
327
+ */
328
+ parseObjectTypeDefinition(): ObjectTypeDefinitionNode;
329
+ /**
330
+ * ImplementsInterfaces :
331
+ * - implements `&`? NamedType
332
+ * - ImplementsInterfaces & NamedType
333
+ */
334
+ parseImplementsInterfaces(): Array<NamedTypeNode>;
335
+ /**
336
+ * ```
337
+ * FieldsDefinition : { FieldDefinition+ }
338
+ * ```
339
+ */
340
+ parseFieldsDefinition(): Array<FieldDefinitionNode>;
341
+ /**
342
+ * FieldDefinition :
343
+ * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
344
+ */
345
+ parseFieldDefinition(): FieldDefinitionNode;
346
+ /**
347
+ * ArgumentsDefinition : ( InputValueDefinition+ )
348
+ */
349
+ parseArgumentDefs(): Array<InputValueDefinitionNode>;
350
+ /**
351
+ * InputValueDefinition :
352
+ * - Description? Name : Type DefaultValue? Directives[Const]?
353
+ */
354
+ parseInputValueDef(): InputValueDefinitionNode;
355
+ /**
356
+ * InterfaceTypeDefinition :
357
+ * - Description? interface Name Directives[Const]? FieldsDefinition?
358
+ */
359
+ parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode;
360
+ /**
361
+ * UnionTypeDefinition :
362
+ * - Description? union Name Directives[Const]? UnionMemberTypes?
363
+ */
364
+ parseUnionTypeDefinition(): UnionTypeDefinitionNode;
365
+ /**
366
+ * UnionMemberTypes :
367
+ * - = `|`? NamedType
368
+ * - UnionMemberTypes | NamedType
369
+ */
370
+ parseUnionMemberTypes(): Array<NamedTypeNode>;
371
+ /**
372
+ * EnumTypeDefinition :
373
+ * - Description? enum Name Directives[Const]? EnumValuesDefinition?
374
+ */
375
+ parseEnumTypeDefinition(): EnumTypeDefinitionNode;
376
+ /**
377
+ * ```
378
+ * EnumValuesDefinition : { EnumValueDefinition+ }
379
+ * ```
380
+ */
381
+ parseEnumValuesDefinition(): Array<EnumValueDefinitionNode>;
382
+ /**
383
+ * EnumValueDefinition : Description? EnumValue Directives[Const]?
384
+ */
385
+ parseEnumValueDefinition(): EnumValueDefinitionNode;
386
+ /**
387
+ * EnumValue : Name but not `true`, `false` or `null`
388
+ */
389
+ parseEnumValueName(): NameNode;
390
+ /**
391
+ * InputObjectTypeDefinition :
392
+ * - Description? input Name Directives[Const]? InputFieldsDefinition?
393
+ */
394
+ parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode;
395
+ /**
396
+ * ```
397
+ * InputFieldsDefinition : { InputValueDefinition+ }
398
+ * ```
399
+ */
400
+ parseInputFieldsDefinition(): Array<InputValueDefinitionNode>;
401
+ /**
402
+ * TypeSystemExtension :
403
+ * - SchemaExtension
404
+ * - TypeExtension
405
+ *
406
+ * TypeExtension :
407
+ * - ScalarTypeExtension
408
+ * - ObjectTypeExtension
409
+ * - InterfaceTypeExtension
410
+ * - UnionTypeExtension
411
+ * - EnumTypeExtension
412
+ * - InputObjectTypeDefinition
413
+ */
414
+ parseTypeSystemExtension(): TypeSystemExtensionNode;
415
+ /**
416
+ * ```
417
+ * SchemaExtension :
418
+ * - extend schema Directives[Const]? { OperationTypeDefinition+ }
419
+ * - extend schema Directives[Const]
420
+ * ```
421
+ */
422
+ parseSchemaExtension(): SchemaExtensionNode;
423
+ /**
424
+ * ScalarTypeExtension :
425
+ * - extend scalar Name Directives[Const]
426
+ */
427
+ parseScalarTypeExtension(): ScalarTypeExtensionNode;
428
+ /**
429
+ * ObjectTypeExtension :
430
+ * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
431
+ * - extend type Name ImplementsInterfaces? Directives[Const]
432
+ * - extend type Name ImplementsInterfaces
433
+ */
434
+ parseObjectTypeExtension(): ObjectTypeExtensionNode;
435
+ /**
436
+ * InterfaceTypeExtension :
437
+ * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
438
+ * - extend interface Name ImplementsInterfaces? Directives[Const]
439
+ * - extend interface Name ImplementsInterfaces
440
+ */
441
+ parseInterfaceTypeExtension(): InterfaceTypeExtensionNode;
442
+ /**
443
+ * UnionTypeExtension :
444
+ * - extend union Name Directives[Const]? UnionMemberTypes
445
+ * - extend union Name Directives[Const]
446
+ */
447
+ parseUnionTypeExtension(): UnionTypeExtensionNode;
448
+ /**
449
+ * EnumTypeExtension :
450
+ * - extend enum Name Directives[Const]? EnumValuesDefinition
451
+ * - extend enum Name Directives[Const]
452
+ */
453
+ parseEnumTypeExtension(): EnumTypeExtensionNode;
454
+ /**
455
+ * InputObjectTypeExtension :
456
+ * - extend input Name Directives[Const]? InputFieldsDefinition
457
+ * - extend input Name Directives[Const]
458
+ */
459
+ parseInputObjectTypeExtension(): InputObjectTypeExtensionNode;
460
+ /**
461
+ * ```
462
+ * DirectiveDefinition :
463
+ * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
464
+ * ```
465
+ */
466
+ parseDirectiveDefinition(): DirectiveDefinitionNode;
467
+ /**
468
+ * DirectiveLocations :
469
+ * - `|`? DirectiveLocation
470
+ * - DirectiveLocations | DirectiveLocation
471
+ */
472
+ parseDirectiveLocations(): Array<NameNode>;
473
+ parseDirectiveLocation(): NameNode;
474
+ /**
475
+ * Returns a location object, used to identify the place in the source that created a given parsed object.
476
+ */
477
+ loc(startToken: Token): Location | undefined;
478
+ /**
479
+ * Determines if the next token is of a given kind
480
+ */
481
+ peek(kind: TokenKindEnum): boolean;
482
+ /**
483
+ * If the next token is of the given kind, return that token after advancing the lexer.
484
+ * Otherwise, do not change the parser state and throw an error.
485
+ */
486
+ expectToken(kind: TokenKindEnum): Token;
487
+ /**
488
+ * If the next token is of the given kind, return "true" after advancing the lexer.
489
+ * Otherwise, do not change the parser state and return "false".
490
+ */
491
+ expectOptionalToken(kind: TokenKindEnum): boolean;
492
+ /**
493
+ * If the next token is a given keyword, advance the lexer.
494
+ * Otherwise, do not change the parser state and throw an error.
495
+ */
496
+ expectKeyword(value: string): void;
497
+ /**
498
+ * If the next token is a given keyword, return "true" after advancing the lexer.
499
+ * Otherwise, do not change the parser state and return "false".
500
+ */
501
+ expectOptionalKeyword(value: string): boolean;
502
+ /**
503
+ * Helper function for creating an error when an unexpected lexed token is encountered.
504
+ */
505
+ unexpected(atToken?: Maybe<Token>): GraphQLError;
506
+ /**
507
+ * Returns a possibly empty list of parse nodes, determined by the parseFn.
508
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
509
+ * Advances the parser to the next lex token after the closing token.
510
+ */
511
+ any<T>(
512
+ openKind: TokenKindEnum,
513
+ parseFn: () => T,
514
+ closeKind: TokenKindEnum,
515
+ ): Array<T>;
516
+ /**
517
+ * Returns a list of parse nodes, determined by the parseFn.
518
+ * It can be empty only if open token is missing otherwise it will always return non-empty list
519
+ * that begins with a lex token of openKind and ends with a lex token of closeKind.
520
+ * Advances the parser to the next lex token after the closing token.
521
+ */
522
+ optionalMany<T>(
523
+ openKind: TokenKindEnum,
524
+ parseFn: () => T,
525
+ closeKind: TokenKindEnum,
526
+ ): Array<T>;
527
+ /**
528
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
529
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
530
+ * Advances the parser to the next lex token after the closing token.
531
+ */
532
+ many<T>(
533
+ openKind: TokenKindEnum,
534
+ parseFn: () => T,
535
+ closeKind: TokenKindEnum,
536
+ ): Array<T>;
537
+ /**
538
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
539
+ * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
540
+ * Advances the parser to the next lex token after last item in the list.
541
+ */
542
+ delimitedMany<T>(delimiterKind: TokenKindEnum, parseFn: () => T): Array<T>;
543
+ }
@@ -49,9 +49,18 @@ export type VisitFn<TAnyNode, TVisitedNode = TAnyNode> = (
49
49
 
50
50
  /**
51
51
  * A KeyMap describes each the traversable properties of each kind of node.
52
+ *
53
+ * @deprecated Please using ASTVisitorKeyMap instead
52
54
  */
53
55
  export type VisitorKeyMap<T> = { [P in keyof T]: ReadonlyArray<keyof T[P]> };
54
56
 
57
+ /**
58
+ * A KeyMap describes each the traversable properties of each kind of node.
59
+ */
60
+ export type ASTVisitorKeyMap = {
61
+ [P in keyof ASTKindToNode]?: ReadonlyArray<keyof ASTKindToNode[P]>;
62
+ };
63
+
55
64
  // TODO: Should be `[]`, but that requires TypeScript@3
56
65
  type EmptyTuple = Array<never>;
57
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql",
3
- "version": "15.5.0",
3
+ "version": "15.6.0",
4
4
  "description": "A Query Language and Runtime which can target any service.",
5
5
  "license": "MIT",
6
6
  "main": "index",
@@ -22,4 +22,4 @@
22
22
  "engines": {
23
23
  "node": ">= 10.x"
24
24
  }
25
- }
25
+ }
@@ -1166,6 +1166,7 @@ var GraphQLInputObjectType = /*#__PURE__*/function () {
1166
1166
  description: field.description,
1167
1167
  type: field.type,
1168
1168
  defaultValue: field.defaultValue,
1169
+ deprecationReason: field.deprecationReason,
1169
1170
  extensions: field.extensions,
1170
1171
  astNode: field.astNode
1171
1172
  };
@@ -1547,6 +1547,7 @@ export class GraphQLInputObjectType {
1547
1547
  description: field.description,
1548
1548
  type: field.type,
1549
1549
  defaultValue: field.defaultValue,
1550
+ deprecationReason: field.deprecationReason,
1550
1551
  extensions: field.extensions,
1551
1552
  astNode: field.astNode,
1552
1553
  }));
@@ -1049,6 +1049,7 @@ export var GraphQLInputObjectType = /*#__PURE__*/function () {
1049
1049
  description: field.description,
1050
1050
  type: field.type,
1051
1051
  defaultValue: field.defaultValue,
1052
+ deprecationReason: field.deprecationReason,
1052
1053
  extensions: field.extensions,
1053
1054
  astNode: field.astNode
1054
1055
  };
package/version.js CHANGED
@@ -13,7 +13,7 @@ exports.versionInfo = exports.version = void 0;
13
13
  /**
14
14
  * A string containing the version of the GraphQL.js library
15
15
  */
16
- var version = '15.5.0';
16
+ var version = '15.6.0';
17
17
  /**
18
18
  * An object containing the components of the GraphQL.js version string
19
19
  */
@@ -21,7 +21,7 @@ var version = '15.5.0';
21
21
  exports.version = version;
22
22
  var versionInfo = Object.freeze({
23
23
  major: 15,
24
- minor: 5,
24
+ minor: 6,
25
25
  patch: 0,
26
26
  preReleaseTag: null
27
27
  });
package/version.js.flow CHANGED
@@ -7,14 +7,14 @@
7
7
  /**
8
8
  * A string containing the version of the GraphQL.js library
9
9
  */
10
- export const version = '15.5.0';
10
+ export const version = '15.6.0';
11
11
 
12
12
  /**
13
13
  * An object containing the components of the GraphQL.js version string
14
14
  */
15
15
  export const versionInfo = Object.freeze({
16
16
  major: 15,
17
- minor: 5,
17
+ minor: 6,
18
18
  patch: 0,
19
19
  preReleaseTag: null,
20
20
  });
package/version.mjs CHANGED
@@ -6,14 +6,14 @@
6
6
  /**
7
7
  * A string containing the version of the GraphQL.js library
8
8
  */
9
- export var version = '15.5.0';
9
+ export var version = '15.6.0';
10
10
  /**
11
11
  * An object containing the components of the GraphQL.js version string
12
12
  */
13
13
 
14
14
  export var versionInfo = Object.freeze({
15
15
  major: 15,
16
- minor: 5,
16
+ minor: 6,
17
17
  patch: 0,
18
18
  preReleaseTag: null
19
19
  });