1
1
// TypeScript Version: 2.6
2
2
3
+ /**
4
+ * GraphQL.js provides a reference implementation for the GraphQL specification
5
+ * but is also a useful utility for operating on GraphQL files and building
6
+ * sophisticated tools.
7
+ *
8
+ * This primary module exports a general purpose function for fulfilling all
9
+ * steps of the GraphQL specification in a single operation, but also includes
10
+ * utilities for every part of the GraphQL specification:
11
+ *
12
+ * - Parsing the GraphQL language.
13
+ * - Building a GraphQL type schema.
14
+ * - Validating a GraphQL request against a type schema.
15
+ * - Executing a GraphQL request against a type schema.
16
+ *
17
+ * This also includes utility functions for operating on GraphQL types and
18
+ * GraphQL documents to facilitate building tools.
19
+ *
20
+ * You may also import from each sub-directory directly. For example, the
21
+ * following two import statements are equivalent:
22
+ *
23
+ * import { parse } from 'graphql';
24
+ * import { parse } from 'graphql/language';
25
+ */
26
+
27
+ // The GraphQL.js version info.
28
+ export { version , versionInfo } from './version' ;
29
+
3
30
// The primary entry point into fulfilling a GraphQL request.
4
- export { graphql , graphqlSync , GraphQLArgs } from './graphql' ;
31
+ export { GraphQLArgs , graphql , graphqlSync } from './graphql' ;
5
32
6
33
// Create and operate on GraphQL type definitions and schema.
7
34
export {
8
- GraphQLSchema ,
9
35
// Definitions
36
+ GraphQLSchema ,
37
+ GraphQLDirective ,
10
38
GraphQLScalarType ,
11
39
GraphQLObjectType ,
12
40
GraphQLInterfaceType ,
@@ -15,10 +43,7 @@ export {
15
43
GraphQLInputObjectType ,
16
44
GraphQLList ,
17
45
GraphQLNonNull ,
18
- GraphQLDirective ,
19
- // "Enum" of Type Kinds
20
- TypeKind ,
21
- // Scalars
46
+ // Standard GraphQL Scalars
22
47
specifiedScalarTypes ,
23
48
GraphQLInt ,
24
49
GraphQLFloat ,
@@ -30,12 +55,10 @@ export {
30
55
GraphQLIncludeDirective ,
31
56
GraphQLSkipDirective ,
32
57
GraphQLDeprecatedDirective ,
58
+ // "Enum" of Type Kinds
59
+ TypeKind ,
33
60
// Constant Deprecation Reason
34
61
DEFAULT_DEPRECATION_REASON ,
35
- // Meta-field definitions.
36
- SchemaMetaFieldDef ,
37
- TypeMetaFieldDef ,
38
- TypeNameMetaFieldDef ,
39
62
// GraphQL Types for introspection.
40
63
introspectionTypes ,
41
64
__Schema ,
@@ -46,6 +69,10 @@ export {
46
69
__InputValue ,
47
70
__EnumValue ,
48
71
__TypeKind ,
72
+ // Meta-field definitions.
73
+ SchemaMetaFieldDef ,
74
+ TypeMetaFieldDef ,
75
+ TypeNameMetaFieldDef ,
49
76
// Predicates
50
77
isSchema ,
51
78
isDirective ,
@@ -72,6 +99,8 @@ export {
72
99
isIntrospectionType ,
73
100
isSpecifiedDirective ,
74
101
// Assertions
102
+ assertSchema ,
103
+ assertDirective ,
75
104
assertType ,
76
105
assertScalarType ,
77
106
assertObjectType ,
@@ -95,7 +124,9 @@ export {
95
124
// Validate GraphQL schema.
96
125
validateSchema ,
97
126
assertValidSchema ,
98
- // type
127
+ } from './type' ;
128
+
129
+ export {
99
130
GraphQLType ,
100
131
GraphQLInputType ,
101
132
GraphQLOutputType ,
@@ -107,6 +138,7 @@ export {
107
138
GraphQLNamedType ,
108
139
Thunk ,
109
140
GraphQLSchemaConfig ,
141
+ GraphQLDirectiveConfig ,
110
142
GraphQLArgument ,
111
143
GraphQLArgumentConfig ,
112
144
GraphQLEnumTypeConfig ,
@@ -128,10 +160,10 @@ export {
128
160
GraphQLIsTypeOfFn ,
129
161
GraphQLObjectTypeConfig ,
130
162
GraphQLResolveInfo ,
163
+ ResponsePath ,
131
164
GraphQLScalarTypeConfig ,
132
165
GraphQLTypeResolver ,
133
166
GraphQLUnionTypeConfig ,
134
- GraphQLDirectiveConfig ,
135
167
GraphQLScalarSerializer ,
136
168
GraphQLScalarValueParser ,
137
169
GraphQLScalarLiteralParser ,
@@ -141,6 +173,12 @@ export {
141
173
export {
142
174
Source ,
143
175
getLocation ,
176
+ // Print source location
177
+ printLocation ,
178
+ printSourceLocation ,
179
+ // Lex
180
+ createLexer ,
181
+ TokenKind ,
144
182
// Parse
145
183
parse ,
146
184
parseValue ,
@@ -152,10 +190,9 @@ export {
152
190
visitInParallel ,
153
191
visitWithTypeInfo ,
154
192
getVisitFn ,
193
+ BREAK ,
155
194
Kind ,
156
- TokenKind ,
157
195
DirectiveLocation ,
158
- BREAK ,
159
196
// Predicates
160
197
isDefinitionNode ,
161
198
isExecutableDefinitionNode ,
@@ -166,20 +203,26 @@ export {
166
203
isTypeDefinitionNode ,
167
204
isTypeSystemExtensionNode ,
168
205
isTypeExtensionNode ,
169
- // type
206
+ } from './language' ;
207
+
208
+ export {
170
209
Lexer ,
171
210
ParseOptions ,
172
211
SourceLocation ,
212
+ Location ,
213
+ Token ,
214
+ TokenKindEnum ,
215
+ KindEnum ,
216
+ DirectiveLocationEnum ,
173
217
// Visitor utilities
174
218
ASTVisitor ,
175
219
Visitor ,
176
220
VisitFn ,
177
221
VisitorKeyMap ,
178
222
// AST nodes
179
- Location ,
180
- Token ,
181
223
ASTNode ,
182
224
ASTKindToNode ,
225
+ // Each kind of AST node
183
226
NameNode ,
184
227
DocumentNode ,
185
228
DefinitionNode ,
@@ -233,25 +276,26 @@ export {
233
276
UnionTypeExtensionNode ,
234
277
EnumTypeExtensionNode ,
235
278
InputObjectTypeExtensionNode ,
236
- KindEnum ,
237
- TokenKindEnum ,
238
- DirectiveLocationEnum ,
239
279
} from './language' ;
240
280
241
281
// Execute GraphQL queries.
242
282
export {
243
283
execute ,
244
284
defaultFieldResolver ,
285
+ defaultTypeResolver ,
245
286
responsePathAsArray ,
246
287
getDirectiveValues ,
247
- // type
248
288
ExecutionArgs ,
249
289
ExecutionResult ,
250
290
} from './execution' ;
251
291
252
- export { subscribe , createSourceEventStream } from './subscription' ;
292
+ export {
293
+ subscribe ,
294
+ createSourceEventStream ,
295
+ SubscriptionArgs ,
296
+ } from './subscription' ;
253
297
254
- // Validate GraphQL queries .
298
+ // Validate GraphQL documents .
255
299
export {
256
300
validate ,
257
301
ValidationContext ,
@@ -283,13 +327,16 @@ export {
283
327
ValuesOfCorrectTypeRule ,
284
328
VariablesAreInputTypesRule ,
285
329
VariablesInAllowedPositionRule ,
330
+ ValidationRule ,
286
331
} from './validation' ;
287
332
288
- // Create and format GraphQL errors.
333
+ // Create, format, and print GraphQL errors.
289
334
export {
290
335
GraphQLError ,
291
- formatError ,
336
+ syntaxError ,
337
+ locatedError ,
292
338
printError ,
339
+ formatError ,
293
340
GraphQLFormattedError ,
294
341
} from './error' ;
295
342
@@ -298,13 +345,13 @@ export {
298
345
// Produce the GraphQL query recommended for a full schema introspection.
299
346
// Accepts optional IntrospectionOptions.
300
347
getIntrospectionQuery ,
301
- // @deprecated : use getIntrospectionQuery - will be removed in v15
348
+ // @deprecated : use getIntrospectionQuery - will be removed in v15.
302
349
introspectionQuery ,
303
- // Gets the target Operation from a Document
350
+ // Gets the target Operation from a Document.
304
351
getOperationAST ,
305
352
// Gets the Type for the target Operation AST.
306
353
getOperationRootType ,
307
- // Convert a GraphQLSchema to an IntrospectionQuery
354
+ // Convert a GraphQLSchema to an IntrospectionQuery.
308
355
introspectionFromSchema ,
309
356
// Build a GraphQLSchema from an introspection result.
310
357
buildClientSchema ,
@@ -313,7 +360,7 @@ export {
313
360
// Build a GraphQLSchema from a GraphQL schema language document.
314
361
buildSchema ,
315
362
// @deprecated : Get the description from a schema AST node and supports legacy
316
- // syntax for specifying descriptions - will be removed in v16
363
+ // syntax for specifying descriptions - will be removed in v16.
317
364
getDescription ,
318
365
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
319
366
// language AST.
@@ -322,11 +369,11 @@ export {
322
369
lexicographicSortSchema ,
323
370
// Print a GraphQLSchema to GraphQL Schema language.
324
371
printSchema ,
372
+ // Print a GraphQLType to GraphQL Schema language.
373
+ printType ,
325
374
// Prints the built-in introspection schema in the Schema Language
326
375
// format.
327
376
printIntrospectionSchema ,
328
- // Print a GraphQLType to GraphQL Schema language.
329
- printType ,
330
377
// Create a GraphQLType from a GraphQL language AST.
331
378
typeFromAST ,
332
379
// Create a JavaScript value from a GraphQL language AST with a Type.
@@ -339,15 +386,20 @@ export {
339
386
// the GraphQL type system.
340
387
TypeInfo ,
341
388
// Coerces a JavaScript value to a GraphQL type, or produces errors.
389
+ coerceInputValue ,
390
+ // @deprecated use coerceInputValue - will be removed in v15
342
391
coerceValue ,
343
- // @deprecated use coerceValue - will be removed in v15
392
+ // @deprecated use coerceInputValue - will be removed in v15
344
393
isValidJSValue ,
345
394
// @deprecated use validation - will be removed in v15
346
395
isValidLiteralValue ,
347
396
// Concatenates multiple AST together.
348
397
concatAST ,
349
398
// Separates an AST into an AST per Operation.
350
399
separateOperations ,
400
+ // Strips characters that are not significant to the validity or execution
401
+ // of a GraphQL document.
402
+ stripIgnoredCharacters ,
351
403
// Comparators for types
352
404
isEqualType ,
353
405
isTypeSubTypeOf ,
@@ -357,36 +409,38 @@ export {
357
409
// Determine if a string is a valid GraphQL name.
358
410
isValidNameError ,
359
411
// Compares two GraphQLSchemas and detects breaking changes.
360
- findBreakingChanges ,
361
- findDangerousChanges ,
362
412
BreakingChangeType ,
363
413
DangerousChangeType ,
414
+ findBreakingChanges ,
415
+ findDangerousChanges ,
364
416
// Report all deprecated usage within a GraphQL document.
365
417
findDeprecatedUsages ,
366
- // type
367
- BuildSchemaOptions ,
368
- BreakingChange ,
369
- DangerousChange ,
418
+ } from './utilities' ;
419
+
420
+ export {
370
421
IntrospectionOptions ,
371
- IntrospectionDirective ,
422
+ IntrospectionQuery ,
423
+ IntrospectionSchema ,
424
+ IntrospectionType ,
425
+ IntrospectionInputType ,
426
+ IntrospectionOutputType ,
427
+ IntrospectionScalarType ,
428
+ IntrospectionObjectType ,
429
+ IntrospectionInterfaceType ,
430
+ IntrospectionUnionType ,
372
431
IntrospectionEnumType ,
373
- IntrospectionEnumValue ,
374
- IntrospectionField ,
375
432
IntrospectionInputObjectType ,
376
- IntrospectionInputType ,
433
+ IntrospectionTypeRef ,
377
434
IntrospectionInputTypeRef ,
378
- IntrospectionInputValue ,
379
- IntrospectionInterfaceType ,
380
- IntrospectionListTypeRef ,
435
+ IntrospectionOutputTypeRef ,
381
436
IntrospectionNamedTypeRef ,
437
+ IntrospectionListTypeRef ,
382
438
IntrospectionNonNullTypeRef ,
383
- IntrospectionObjectType ,
384
- IntrospectionOutputType ,
385
- IntrospectionOutputTypeRef ,
386
- IntrospectionQuery ,
387
- IntrospectionScalarType ,
388
- IntrospectionSchema ,
389
- IntrospectionType ,
390
- IntrospectionTypeRef ,
391
- IntrospectionUnionType ,
439
+ IntrospectionField ,
440
+ IntrospectionInputValue ,
441
+ IntrospectionEnumValue ,
442
+ IntrospectionDirective ,
443
+ BuildSchemaOptions ,
444
+ BreakingChange ,
445
+ DangerousChange ,
392
446
} from './utilities' ;
0 commit comments