Skip to content

Commit 7b9bfda

Browse files
Jackson Kearlmjmahone
Jackson Kearl
authored andcommitted
Fixup index.d.ts files to reflect Flow (#2118)
* Fixup index.d.ts files to refelct Flow * Add back TS version header
1 parent 3104e1f commit 7b9bfda

File tree

5 files changed

+128
-55
lines changed

5 files changed

+128
-55
lines changed

tstypes/index.d.ts

+108-54
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
// TypeScript Version: 2.6
22

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+
330
// The primary entry point into fulfilling a GraphQL request.
4-
export { graphql, graphqlSync, GraphQLArgs } from './graphql';
31+
export { GraphQLArgs, graphql, graphqlSync } from './graphql';
532

633
// Create and operate on GraphQL type definitions and schema.
734
export {
8-
GraphQLSchema,
935
// Definitions
36+
GraphQLSchema,
37+
GraphQLDirective,
1038
GraphQLScalarType,
1139
GraphQLObjectType,
1240
GraphQLInterfaceType,
@@ -15,10 +43,7 @@ export {
1543
GraphQLInputObjectType,
1644
GraphQLList,
1745
GraphQLNonNull,
18-
GraphQLDirective,
19-
// "Enum" of Type Kinds
20-
TypeKind,
21-
// Scalars
46+
// Standard GraphQL Scalars
2247
specifiedScalarTypes,
2348
GraphQLInt,
2449
GraphQLFloat,
@@ -30,12 +55,10 @@ export {
3055
GraphQLIncludeDirective,
3156
GraphQLSkipDirective,
3257
GraphQLDeprecatedDirective,
58+
// "Enum" of Type Kinds
59+
TypeKind,
3360
// Constant Deprecation Reason
3461
DEFAULT_DEPRECATION_REASON,
35-
// Meta-field definitions.
36-
SchemaMetaFieldDef,
37-
TypeMetaFieldDef,
38-
TypeNameMetaFieldDef,
3962
// GraphQL Types for introspection.
4063
introspectionTypes,
4164
__Schema,
@@ -46,6 +69,10 @@ export {
4669
__InputValue,
4770
__EnumValue,
4871
__TypeKind,
72+
// Meta-field definitions.
73+
SchemaMetaFieldDef,
74+
TypeMetaFieldDef,
75+
TypeNameMetaFieldDef,
4976
// Predicates
5077
isSchema,
5178
isDirective,
@@ -72,6 +99,8 @@ export {
7299
isIntrospectionType,
73100
isSpecifiedDirective,
74101
// Assertions
102+
assertSchema,
103+
assertDirective,
75104
assertType,
76105
assertScalarType,
77106
assertObjectType,
@@ -95,7 +124,9 @@ export {
95124
// Validate GraphQL schema.
96125
validateSchema,
97126
assertValidSchema,
98-
// type
127+
} from './type';
128+
129+
export {
99130
GraphQLType,
100131
GraphQLInputType,
101132
GraphQLOutputType,
@@ -107,6 +138,7 @@ export {
107138
GraphQLNamedType,
108139
Thunk,
109140
GraphQLSchemaConfig,
141+
GraphQLDirectiveConfig,
110142
GraphQLArgument,
111143
GraphQLArgumentConfig,
112144
GraphQLEnumTypeConfig,
@@ -128,10 +160,10 @@ export {
128160
GraphQLIsTypeOfFn,
129161
GraphQLObjectTypeConfig,
130162
GraphQLResolveInfo,
163+
ResponsePath,
131164
GraphQLScalarTypeConfig,
132165
GraphQLTypeResolver,
133166
GraphQLUnionTypeConfig,
134-
GraphQLDirectiveConfig,
135167
GraphQLScalarSerializer,
136168
GraphQLScalarValueParser,
137169
GraphQLScalarLiteralParser,
@@ -141,6 +173,12 @@ export {
141173
export {
142174
Source,
143175
getLocation,
176+
// Print source location
177+
printLocation,
178+
printSourceLocation,
179+
// Lex
180+
createLexer,
181+
TokenKind,
144182
// Parse
145183
parse,
146184
parseValue,
@@ -152,10 +190,9 @@ export {
152190
visitInParallel,
153191
visitWithTypeInfo,
154192
getVisitFn,
193+
BREAK,
155194
Kind,
156-
TokenKind,
157195
DirectiveLocation,
158-
BREAK,
159196
// Predicates
160197
isDefinitionNode,
161198
isExecutableDefinitionNode,
@@ -166,20 +203,26 @@ export {
166203
isTypeDefinitionNode,
167204
isTypeSystemExtensionNode,
168205
isTypeExtensionNode,
169-
// type
206+
} from './language';
207+
208+
export {
170209
Lexer,
171210
ParseOptions,
172211
SourceLocation,
212+
Location,
213+
Token,
214+
TokenKindEnum,
215+
KindEnum,
216+
DirectiveLocationEnum,
173217
// Visitor utilities
174218
ASTVisitor,
175219
Visitor,
176220
VisitFn,
177221
VisitorKeyMap,
178222
// AST nodes
179-
Location,
180-
Token,
181223
ASTNode,
182224
ASTKindToNode,
225+
// Each kind of AST node
183226
NameNode,
184227
DocumentNode,
185228
DefinitionNode,
@@ -233,25 +276,26 @@ export {
233276
UnionTypeExtensionNode,
234277
EnumTypeExtensionNode,
235278
InputObjectTypeExtensionNode,
236-
KindEnum,
237-
TokenKindEnum,
238-
DirectiveLocationEnum,
239279
} from './language';
240280

241281
// Execute GraphQL queries.
242282
export {
243283
execute,
244284
defaultFieldResolver,
285+
defaultTypeResolver,
245286
responsePathAsArray,
246287
getDirectiveValues,
247-
// type
248288
ExecutionArgs,
249289
ExecutionResult,
250290
} from './execution';
251291

252-
export { subscribe, createSourceEventStream } from './subscription';
292+
export {
293+
subscribe,
294+
createSourceEventStream,
295+
SubscriptionArgs,
296+
} from './subscription';
253297

254-
// Validate GraphQL queries.
298+
// Validate GraphQL documents.
255299
export {
256300
validate,
257301
ValidationContext,
@@ -283,13 +327,16 @@ export {
283327
ValuesOfCorrectTypeRule,
284328
VariablesAreInputTypesRule,
285329
VariablesInAllowedPositionRule,
330+
ValidationRule,
286331
} from './validation';
287332

288-
// Create and format GraphQL errors.
333+
// Create, format, and print GraphQL errors.
289334
export {
290335
GraphQLError,
291-
formatError,
336+
syntaxError,
337+
locatedError,
292338
printError,
339+
formatError,
293340
GraphQLFormattedError,
294341
} from './error';
295342

@@ -298,13 +345,13 @@ export {
298345
// Produce the GraphQL query recommended for a full schema introspection.
299346
// Accepts optional IntrospectionOptions.
300347
getIntrospectionQuery,
301-
// @deprecated: use getIntrospectionQuery - will be removed in v15
348+
// @deprecated: use getIntrospectionQuery - will be removed in v15.
302349
introspectionQuery,
303-
// Gets the target Operation from a Document
350+
// Gets the target Operation from a Document.
304351
getOperationAST,
305352
// Gets the Type for the target Operation AST.
306353
getOperationRootType,
307-
// Convert a GraphQLSchema to an IntrospectionQuery
354+
// Convert a GraphQLSchema to an IntrospectionQuery.
308355
introspectionFromSchema,
309356
// Build a GraphQLSchema from an introspection result.
310357
buildClientSchema,
@@ -313,7 +360,7 @@ export {
313360
// Build a GraphQLSchema from a GraphQL schema language document.
314361
buildSchema,
315362
// @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.
317364
getDescription,
318365
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
319366
// language AST.
@@ -322,11 +369,11 @@ export {
322369
lexicographicSortSchema,
323370
// Print a GraphQLSchema to GraphQL Schema language.
324371
printSchema,
372+
// Print a GraphQLType to GraphQL Schema language.
373+
printType,
325374
// Prints the built-in introspection schema in the Schema Language
326375
// format.
327376
printIntrospectionSchema,
328-
// Print a GraphQLType to GraphQL Schema language.
329-
printType,
330377
// Create a GraphQLType from a GraphQL language AST.
331378
typeFromAST,
332379
// Create a JavaScript value from a GraphQL language AST with a Type.
@@ -339,15 +386,20 @@ export {
339386
// the GraphQL type system.
340387
TypeInfo,
341388
// Coerces a JavaScript value to a GraphQL type, or produces errors.
389+
coerceInputValue,
390+
// @deprecated use coerceInputValue - will be removed in v15
342391
coerceValue,
343-
// @deprecated use coerceValue - will be removed in v15
392+
// @deprecated use coerceInputValue - will be removed in v15
344393
isValidJSValue,
345394
// @deprecated use validation - will be removed in v15
346395
isValidLiteralValue,
347396
// Concatenates multiple AST together.
348397
concatAST,
349398
// Separates an AST into an AST per Operation.
350399
separateOperations,
400+
// Strips characters that are not significant to the validity or execution
401+
// of a GraphQL document.
402+
stripIgnoredCharacters,
351403
// Comparators for types
352404
isEqualType,
353405
isTypeSubTypeOf,
@@ -357,36 +409,38 @@ export {
357409
// Determine if a string is a valid GraphQL name.
358410
isValidNameError,
359411
// Compares two GraphQLSchemas and detects breaking changes.
360-
findBreakingChanges,
361-
findDangerousChanges,
362412
BreakingChangeType,
363413
DangerousChangeType,
414+
findBreakingChanges,
415+
findDangerousChanges,
364416
// Report all deprecated usage within a GraphQL document.
365417
findDeprecatedUsages,
366-
// type
367-
BuildSchemaOptions,
368-
BreakingChange,
369-
DangerousChange,
418+
} from './utilities';
419+
420+
export {
370421
IntrospectionOptions,
371-
IntrospectionDirective,
422+
IntrospectionQuery,
423+
IntrospectionSchema,
424+
IntrospectionType,
425+
IntrospectionInputType,
426+
IntrospectionOutputType,
427+
IntrospectionScalarType,
428+
IntrospectionObjectType,
429+
IntrospectionInterfaceType,
430+
IntrospectionUnionType,
372431
IntrospectionEnumType,
373-
IntrospectionEnumValue,
374-
IntrospectionField,
375432
IntrospectionInputObjectType,
376-
IntrospectionInputType,
433+
IntrospectionTypeRef,
377434
IntrospectionInputTypeRef,
378-
IntrospectionInputValue,
379-
IntrospectionInterfaceType,
380-
IntrospectionListTypeRef,
435+
IntrospectionOutputTypeRef,
381436
IntrospectionNamedTypeRef,
437+
IntrospectionListTypeRef,
382438
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,
392446
} from './utilities';

tstypes/language/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export { Source } from './source';
22
export { getLocation, SourceLocation } from './location';
3+
4+
export { printLocation, printSourceLocation } from './printLocation';
5+
36
export { Kind, KindEnum } from './kinds';
47
export { TokenKind, TokenKindEnum } from './tokenKind';
58
export { createLexer, Lexer } from './lexer';

tstypes/type/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export { Path as ResponsePath } from '../jsutils/Path';
2+
13
export {
24
// Predicate
35
isSchema,

tstypes/validation/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { validate } from './validate';
22

3-
export { ValidationContext } from './ValidationContext';
3+
export { ValidationContext, ValidationRule } from './ValidationContext';
44

55
export { specifiedRules } from './specifiedRules';
66

tstypes/version.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* A string containing the version of the GraphQL.js library
3+
*/
4+
export const version: string;
5+
6+
/**
7+
* An object containing the components of the GraphQL.js version string
8+
*/
9+
export const versionInfo: {
10+
major: number;
11+
minor: number;
12+
patch: number;
13+
preReleaseTag: number | null;
14+
};

0 commit comments

Comments
 (0)