1 | import type { Kind } from './kinds';
|
2 | import type { Source } from './source';
|
3 | import type { TokenKind } from './tokenKind';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class Location {
|
9 | |
10 |
|
11 |
|
12 | readonly start: number;
|
13 | |
14 |
|
15 |
|
16 | readonly end: number;
|
17 | |
18 |
|
19 |
|
20 | readonly startToken: Token;
|
21 | |
22 |
|
23 |
|
24 | readonly endToken: Token;
|
25 | |
26 |
|
27 |
|
28 | readonly source: Source;
|
29 | constructor(startToken: Token, endToken: Token, source: Source);
|
30 | get [Symbol.toStringTag](): string;
|
31 | toJSON(): {
|
32 | start: number;
|
33 | end: number;
|
34 | };
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export declare class Token {
|
41 | |
42 |
|
43 |
|
44 | readonly kind: TokenKind;
|
45 | |
46 |
|
47 |
|
48 | readonly start: number;
|
49 | |
50 |
|
51 |
|
52 | readonly end: number;
|
53 | |
54 |
|
55 |
|
56 | readonly line: number;
|
57 | |
58 |
|
59 |
|
60 | readonly column: number;
|
61 | |
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | readonly value: string;
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 | readonly prev: Token | null;
|
74 | readonly next: Token | null;
|
75 | constructor(
|
76 | kind: TokenKind,
|
77 | start: number,
|
78 | end: number,
|
79 | line: number,
|
80 | column: number,
|
81 | value?: string,
|
82 | );
|
83 | get [Symbol.toStringTag](): string;
|
84 | toJSON(): {
|
85 | kind: TokenKind;
|
86 | value?: string;
|
87 | line: number;
|
88 | column: number;
|
89 | };
|
90 | }
|
91 |
|
92 |
|
93 |
|
94 | export declare type ASTNode =
|
95 | | NameNode
|
96 | | DocumentNode
|
97 | | OperationDefinitionNode
|
98 | | VariableDefinitionNode
|
99 | | VariableNode
|
100 | | SelectionSetNode
|
101 | | FieldNode
|
102 | | ArgumentNode
|
103 | | FragmentSpreadNode
|
104 | | InlineFragmentNode
|
105 | | FragmentDefinitionNode
|
106 | | IntValueNode
|
107 | | FloatValueNode
|
108 | | StringValueNode
|
109 | | BooleanValueNode
|
110 | | NullValueNode
|
111 | | EnumValueNode
|
112 | | ListValueNode
|
113 | | ObjectValueNode
|
114 | | ObjectFieldNode
|
115 | | DirectiveNode
|
116 | | NamedTypeNode
|
117 | | ListTypeNode
|
118 | | NonNullTypeNode
|
119 | | SchemaDefinitionNode
|
120 | | OperationTypeDefinitionNode
|
121 | | ScalarTypeDefinitionNode
|
122 | | ObjectTypeDefinitionNode
|
123 | | FieldDefinitionNode
|
124 | | InputValueDefinitionNode
|
125 | | InterfaceTypeDefinitionNode
|
126 | | UnionTypeDefinitionNode
|
127 | | EnumTypeDefinitionNode
|
128 | | EnumValueDefinitionNode
|
129 | | InputObjectTypeDefinitionNode
|
130 | | DirectiveDefinitionNode
|
131 | | SchemaExtensionNode
|
132 | | ScalarTypeExtensionNode
|
133 | | ObjectTypeExtensionNode
|
134 | | InterfaceTypeExtensionNode
|
135 | | UnionTypeExtensionNode
|
136 | | EnumTypeExtensionNode
|
137 | | InputObjectTypeExtensionNode;
|
138 |
|
139 |
|
140 |
|
141 | export declare type ASTKindToNode = {
|
142 | [NodeT in ASTNode as NodeT['kind']]: NodeT;
|
143 | };
|
144 |
|
145 |
|
146 |
|
147 | export declare const QueryDocumentKeys: {
|
148 | [NodeT in ASTNode as NodeT['kind']]: ReadonlyArray<keyof NodeT>;
|
149 | };
|
150 |
|
151 |
|
152 |
|
153 | export declare function isNode(maybeNode: any): maybeNode is ASTNode;
|
154 |
|
155 | export interface NameNode {
|
156 | readonly kind: Kind.NAME;
|
157 | readonly loc?: Location;
|
158 | readonly value: string;
|
159 | }
|
160 |
|
161 | export interface DocumentNode {
|
162 | readonly kind: Kind.DOCUMENT;
|
163 | readonly loc?: Location;
|
164 | readonly definitions: ReadonlyArray<DefinitionNode>;
|
165 | readonly tokenCount?: number | undefined;
|
166 | }
|
167 | export declare type DefinitionNode =
|
168 | | ExecutableDefinitionNode
|
169 | | TypeSystemDefinitionNode
|
170 | | TypeSystemExtensionNode;
|
171 | export declare type ExecutableDefinitionNode =
|
172 | | OperationDefinitionNode
|
173 | | FragmentDefinitionNode;
|
174 | export interface OperationDefinitionNode {
|
175 | readonly kind: Kind.OPERATION_DEFINITION;
|
176 | readonly loc?: Location;
|
177 | readonly operation: OperationTypeNode;
|
178 | readonly name?: NameNode;
|
179 | readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;
|
180 | readonly directives?: ReadonlyArray<DirectiveNode>;
|
181 | readonly selectionSet: SelectionSetNode;
|
182 | }
|
183 | declare enum OperationTypeNode {
|
184 | QUERY = 'query',
|
185 | MUTATION = 'mutation',
|
186 | SUBSCRIPTION = 'subscription',
|
187 | }
|
188 | export { OperationTypeNode };
|
189 | export interface VariableDefinitionNode {
|
190 | readonly kind: Kind.VARIABLE_DEFINITION;
|
191 | readonly loc?: Location;
|
192 | readonly variable: VariableNode;
|
193 | readonly type: TypeNode;
|
194 | readonly defaultValue?: ConstValueNode;
|
195 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
196 | }
|
197 | export interface VariableNode {
|
198 | readonly kind: Kind.VARIABLE;
|
199 | readonly loc?: Location;
|
200 | readonly name: NameNode;
|
201 | }
|
202 | export interface SelectionSetNode {
|
203 | kind: Kind.SELECTION_SET;
|
204 | loc?: Location;
|
205 | selections: ReadonlyArray<SelectionNode>;
|
206 | }
|
207 | export declare type SelectionNode =
|
208 | | FieldNode
|
209 | | FragmentSpreadNode
|
210 | | InlineFragmentNode;
|
211 | export interface FieldNode {
|
212 | readonly kind: Kind.FIELD;
|
213 | readonly loc?: Location;
|
214 | readonly alias?: NameNode;
|
215 | readonly name: NameNode;
|
216 | readonly arguments?: ReadonlyArray<ArgumentNode>;
|
217 | readonly directives?: ReadonlyArray<DirectiveNode>;
|
218 | readonly selectionSet?: SelectionSetNode;
|
219 | }
|
220 | export interface ArgumentNode {
|
221 | readonly kind: Kind.ARGUMENT;
|
222 | readonly loc?: Location;
|
223 | readonly name: NameNode;
|
224 | readonly value: ValueNode;
|
225 | }
|
226 | export interface ConstArgumentNode {
|
227 | readonly kind: Kind.ARGUMENT;
|
228 | readonly loc?: Location;
|
229 | readonly name: NameNode;
|
230 | readonly value: ConstValueNode;
|
231 | }
|
232 |
|
233 | export interface FragmentSpreadNode {
|
234 | readonly kind: Kind.FRAGMENT_SPREAD;
|
235 | readonly loc?: Location;
|
236 | readonly name: NameNode;
|
237 | readonly directives?: ReadonlyArray<DirectiveNode>;
|
238 | }
|
239 | export interface InlineFragmentNode {
|
240 | readonly kind: Kind.INLINE_FRAGMENT;
|
241 | readonly loc?: Location;
|
242 | readonly typeCondition?: NamedTypeNode;
|
243 | readonly directives?: ReadonlyArray<DirectiveNode>;
|
244 | readonly selectionSet: SelectionSetNode;
|
245 | }
|
246 | export interface FragmentDefinitionNode {
|
247 | readonly kind: Kind.FRAGMENT_DEFINITION;
|
248 | readonly loc?: Location;
|
249 | readonly name: NameNode;
|
250 |
|
251 | readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;
|
252 | readonly typeCondition: NamedTypeNode;
|
253 | readonly directives?: ReadonlyArray<DirectiveNode>;
|
254 | readonly selectionSet: SelectionSetNode;
|
255 | }
|
256 |
|
257 | export declare type ValueNode =
|
258 | | VariableNode
|
259 | | IntValueNode
|
260 | | FloatValueNode
|
261 | | StringValueNode
|
262 | | BooleanValueNode
|
263 | | NullValueNode
|
264 | | EnumValueNode
|
265 | | ListValueNode
|
266 | | ObjectValueNode;
|
267 | export declare type ConstValueNode =
|
268 | | IntValueNode
|
269 | | FloatValueNode
|
270 | | StringValueNode
|
271 | | BooleanValueNode
|
272 | | NullValueNode
|
273 | | EnumValueNode
|
274 | | ConstListValueNode
|
275 | | ConstObjectValueNode;
|
276 | export interface IntValueNode {
|
277 | readonly kind: Kind.INT;
|
278 | readonly loc?: Location;
|
279 | readonly value: string;
|
280 | }
|
281 | export interface FloatValueNode {
|
282 | readonly kind: Kind.FLOAT;
|
283 | readonly loc?: Location;
|
284 | readonly value: string;
|
285 | }
|
286 | export interface StringValueNode {
|
287 | readonly kind: Kind.STRING;
|
288 | readonly loc?: Location;
|
289 | readonly value: string;
|
290 | readonly block?: boolean;
|
291 | }
|
292 | export interface BooleanValueNode {
|
293 | readonly kind: Kind.BOOLEAN;
|
294 | readonly loc?: Location;
|
295 | readonly value: boolean;
|
296 | }
|
297 | export interface NullValueNode {
|
298 | readonly kind: Kind.NULL;
|
299 | readonly loc?: Location;
|
300 | }
|
301 | export interface EnumValueNode {
|
302 | readonly kind: Kind.ENUM;
|
303 | readonly loc?: Location;
|
304 | readonly value: string;
|
305 | }
|
306 | export interface ListValueNode {
|
307 | readonly kind: Kind.LIST;
|
308 | readonly loc?: Location;
|
309 | readonly values: ReadonlyArray<ValueNode>;
|
310 | }
|
311 | export interface ConstListValueNode {
|
312 | readonly kind: Kind.LIST;
|
313 | readonly loc?: Location;
|
314 | readonly values: ReadonlyArray<ConstValueNode>;
|
315 | }
|
316 | export interface ObjectValueNode {
|
317 | readonly kind: Kind.OBJECT;
|
318 | readonly loc?: Location;
|
319 | readonly fields: ReadonlyArray<ObjectFieldNode>;
|
320 | }
|
321 | export interface ConstObjectValueNode {
|
322 | readonly kind: Kind.OBJECT;
|
323 | readonly loc?: Location;
|
324 | readonly fields: ReadonlyArray<ConstObjectFieldNode>;
|
325 | }
|
326 | export interface ObjectFieldNode {
|
327 | readonly kind: Kind.OBJECT_FIELD;
|
328 | readonly loc?: Location;
|
329 | readonly name: NameNode;
|
330 | readonly value: ValueNode;
|
331 | }
|
332 | export interface ConstObjectFieldNode {
|
333 | readonly kind: Kind.OBJECT_FIELD;
|
334 | readonly loc?: Location;
|
335 | readonly name: NameNode;
|
336 | readonly value: ConstValueNode;
|
337 | }
|
338 |
|
339 | export interface DirectiveNode {
|
340 | readonly kind: Kind.DIRECTIVE;
|
341 | readonly loc?: Location;
|
342 | readonly name: NameNode;
|
343 | readonly arguments?: ReadonlyArray<ArgumentNode>;
|
344 | }
|
345 | export interface ConstDirectiveNode {
|
346 | readonly kind: Kind.DIRECTIVE;
|
347 | readonly loc?: Location;
|
348 | readonly name: NameNode;
|
349 | readonly arguments?: ReadonlyArray<ConstArgumentNode>;
|
350 | }
|
351 |
|
352 | export declare type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;
|
353 | export interface NamedTypeNode {
|
354 | readonly kind: Kind.NAMED_TYPE;
|
355 | readonly loc?: Location;
|
356 | readonly name: NameNode;
|
357 | }
|
358 | export interface ListTypeNode {
|
359 | readonly kind: Kind.LIST_TYPE;
|
360 | readonly loc?: Location;
|
361 | readonly type: TypeNode;
|
362 | }
|
363 | export interface NonNullTypeNode {
|
364 | readonly kind: Kind.NON_NULL_TYPE;
|
365 | readonly loc?: Location;
|
366 | readonly type: NamedTypeNode | ListTypeNode;
|
367 | }
|
368 |
|
369 | export declare type TypeSystemDefinitionNode =
|
370 | | SchemaDefinitionNode
|
371 | | TypeDefinitionNode
|
372 | | DirectiveDefinitionNode;
|
373 | export interface SchemaDefinitionNode {
|
374 | readonly kind: Kind.SCHEMA_DEFINITION;
|
375 | readonly loc?: Location;
|
376 | readonly description?: StringValueNode;
|
377 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
378 | readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>;
|
379 | }
|
380 | export interface OperationTypeDefinitionNode {
|
381 | readonly kind: Kind.OPERATION_TYPE_DEFINITION;
|
382 | readonly loc?: Location;
|
383 | readonly operation: OperationTypeNode;
|
384 | readonly type: NamedTypeNode;
|
385 | }
|
386 |
|
387 | export declare type TypeDefinitionNode =
|
388 | | ScalarTypeDefinitionNode
|
389 | | ObjectTypeDefinitionNode
|
390 | | InterfaceTypeDefinitionNode
|
391 | | UnionTypeDefinitionNode
|
392 | | EnumTypeDefinitionNode
|
393 | | InputObjectTypeDefinitionNode;
|
394 | export interface ScalarTypeDefinitionNode {
|
395 | readonly kind: Kind.SCALAR_TYPE_DEFINITION;
|
396 | readonly loc?: Location;
|
397 | readonly description?: StringValueNode;
|
398 | readonly name: NameNode;
|
399 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
400 | }
|
401 | export interface ObjectTypeDefinitionNode {
|
402 | readonly kind: Kind.OBJECT_TYPE_DEFINITION;
|
403 | readonly loc?: Location;
|
404 | readonly description?: StringValueNode;
|
405 | readonly name: NameNode;
|
406 | readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
407 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
408 | readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
409 | }
|
410 | export interface FieldDefinitionNode {
|
411 | readonly kind: Kind.FIELD_DEFINITION;
|
412 | readonly loc?: Location;
|
413 | readonly description?: StringValueNode;
|
414 | readonly name: NameNode;
|
415 | readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
|
416 | readonly type: TypeNode;
|
417 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
418 | }
|
419 | export interface InputValueDefinitionNode {
|
420 | readonly kind: Kind.INPUT_VALUE_DEFINITION;
|
421 | readonly loc?: Location;
|
422 | readonly description?: StringValueNode;
|
423 | readonly name: NameNode;
|
424 | readonly type: TypeNode;
|
425 | readonly defaultValue?: ConstValueNode;
|
426 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
427 | }
|
428 | export interface InterfaceTypeDefinitionNode {
|
429 | readonly kind: Kind.INTERFACE_TYPE_DEFINITION;
|
430 | readonly loc?: Location;
|
431 | readonly description?: StringValueNode;
|
432 | readonly name: NameNode;
|
433 | readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
434 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
435 | readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
436 | }
|
437 | export interface UnionTypeDefinitionNode {
|
438 | readonly kind: Kind.UNION_TYPE_DEFINITION;
|
439 | readonly loc?: Location;
|
440 | readonly description?: StringValueNode;
|
441 | readonly name: NameNode;
|
442 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
443 | readonly types?: ReadonlyArray<NamedTypeNode>;
|
444 | }
|
445 | export interface EnumTypeDefinitionNode {
|
446 | readonly kind: Kind.ENUM_TYPE_DEFINITION;
|
447 | readonly loc?: Location;
|
448 | readonly description?: StringValueNode;
|
449 | readonly name: NameNode;
|
450 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
451 | readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
|
452 | }
|
453 | export interface EnumValueDefinitionNode {
|
454 | readonly kind: Kind.ENUM_VALUE_DEFINITION;
|
455 | readonly loc?: Location;
|
456 | readonly description?: StringValueNode;
|
457 | readonly name: NameNode;
|
458 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
459 | }
|
460 | export interface InputObjectTypeDefinitionNode {
|
461 | readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
462 | readonly loc?: Location;
|
463 | readonly description?: StringValueNode;
|
464 | readonly name: NameNode;
|
465 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
466 | readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
|
467 | }
|
468 |
|
469 | export interface DirectiveDefinitionNode {
|
470 | readonly kind: Kind.DIRECTIVE_DEFINITION;
|
471 | readonly loc?: Location;
|
472 | readonly description?: StringValueNode;
|
473 | readonly name: NameNode;
|
474 | readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
|
475 | readonly repeatable: boolean;
|
476 | readonly locations: ReadonlyArray<NameNode>;
|
477 | }
|
478 |
|
479 | export declare type TypeSystemExtensionNode =
|
480 | | SchemaExtensionNode
|
481 | | TypeExtensionNode;
|
482 | export interface SchemaExtensionNode {
|
483 | readonly kind: Kind.SCHEMA_EXTENSION;
|
484 | readonly loc?: Location;
|
485 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
486 | readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode>;
|
487 | }
|
488 |
|
489 | export declare type TypeExtensionNode =
|
490 | | ScalarTypeExtensionNode
|
491 | | ObjectTypeExtensionNode
|
492 | | InterfaceTypeExtensionNode
|
493 | | UnionTypeExtensionNode
|
494 | | EnumTypeExtensionNode
|
495 | | InputObjectTypeExtensionNode;
|
496 | export interface ScalarTypeExtensionNode {
|
497 | readonly kind: Kind.SCALAR_TYPE_EXTENSION;
|
498 | readonly loc?: Location;
|
499 | readonly name: NameNode;
|
500 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
501 | }
|
502 | export interface ObjectTypeExtensionNode {
|
503 | readonly kind: Kind.OBJECT_TYPE_EXTENSION;
|
504 | readonly loc?: Location;
|
505 | readonly name: NameNode;
|
506 | readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
507 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
508 | readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
509 | }
|
510 | export interface InterfaceTypeExtensionNode {
|
511 | readonly kind: Kind.INTERFACE_TYPE_EXTENSION;
|
512 | readonly loc?: Location;
|
513 | readonly name: NameNode;
|
514 | readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
515 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
516 | readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
517 | }
|
518 | export interface UnionTypeExtensionNode {
|
519 | readonly kind: Kind.UNION_TYPE_EXTENSION;
|
520 | readonly loc?: Location;
|
521 | readonly name: NameNode;
|
522 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
523 | readonly types?: ReadonlyArray<NamedTypeNode>;
|
524 | }
|
525 | export interface EnumTypeExtensionNode {
|
526 | readonly kind: Kind.ENUM_TYPE_EXTENSION;
|
527 | readonly loc?: Location;
|
528 | readonly name: NameNode;
|
529 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
530 | readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
|
531 | }
|
532 | export interface InputObjectTypeExtensionNode {
|
533 | readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION;
|
534 | readonly loc?: Location;
|
535 | readonly name: NameNode;
|
536 | readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
537 | readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
|
538 | }
|