graphql 15.5.1 → 15.5.2

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.
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql",
3
- "version": "15.5.1",
3
+ "version": "15.5.2",
4
4
  "description": "A Query Language and Runtime which can target any service.",
5
5
  "license": "MIT",
6
6
  "main": "index",
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.1';
16
+ var version = '15.5.2';
17
17
  /**
18
18
  * An object containing the components of the GraphQL.js version string
19
19
  */
@@ -22,7 +22,7 @@ exports.version = version;
22
22
  var versionInfo = Object.freeze({
23
23
  major: 15,
24
24
  minor: 5,
25
- patch: 1,
25
+ patch: 2,
26
26
  preReleaseTag: null
27
27
  });
28
28
  exports.versionInfo = versionInfo;
package/version.js.flow CHANGED
@@ -7,7 +7,7 @@
7
7
  /**
8
8
  * A string containing the version of the GraphQL.js library
9
9
  */
10
- export const version = '15.5.1';
10
+ export const version = '15.5.2';
11
11
 
12
12
  /**
13
13
  * An object containing the components of the GraphQL.js version string
@@ -15,6 +15,6 @@ export const version = '15.5.1';
15
15
  export const versionInfo = Object.freeze({
16
16
  major: 15,
17
17
  minor: 5,
18
- patch: 1,
18
+ patch: 2,
19
19
  preReleaseTag: null,
20
20
  });
package/version.mjs CHANGED
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * A string containing the version of the GraphQL.js library
8
8
  */
9
- export var version = '15.5.1';
9
+ export var version = '15.5.2';
10
10
  /**
11
11
  * An object containing the components of the GraphQL.js version string
12
12
  */
@@ -14,6 +14,6 @@ export var version = '15.5.1';
14
14
  export var versionInfo = Object.freeze({
15
15
  major: 15,
16
16
  minor: 5,
17
- patch: 1,
17
+ patch: 2,
18
18
  preReleaseTag: null
19
19
  });