Skip to content

Commit

Permalink
Fixup index.d.ts files to reflect Flow (#2118)
Browse files Browse the repository at this point in the history
* Fixup index.d.ts files to refelct Flow

* Add back TS version header
  • Loading branch information
Jackson Kearl authored and mjmahone committed Aug 23, 2019
1 parent 3104e1f commit 7b9bfda
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 55 deletions.
162 changes: 108 additions & 54 deletions tstypes/index.d.ts
@@ -1,12 +1,40 @@
// TypeScript Version: 2.6

/**
* GraphQL.js provides a reference implementation for the GraphQL specification
* but is also a useful utility for operating on GraphQL files and building
* sophisticated tools.
*
* This primary module exports a general purpose function for fulfilling all
* steps of the GraphQL specification in a single operation, but also includes
* utilities for every part of the GraphQL specification:
*
* - Parsing the GraphQL language.
* - Building a GraphQL type schema.
* - Validating a GraphQL request against a type schema.
* - Executing a GraphQL request against a type schema.
*
* This also includes utility functions for operating on GraphQL types and
* GraphQL documents to facilitate building tools.
*
* You may also import from each sub-directory directly. For example, the
* following two import statements are equivalent:
*
* import { parse } from 'graphql';
* import { parse } from 'graphql/language';
*/

// The GraphQL.js version info.
export { version, versionInfo } from './version';

// The primary entry point into fulfilling a GraphQL request.
export { graphql, graphqlSync, GraphQLArgs } from './graphql';
export { GraphQLArgs, graphql, graphqlSync } from './graphql';

// Create and operate on GraphQL type definitions and schema.
export {
GraphQLSchema,
// Definitions
GraphQLSchema,
GraphQLDirective,
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
Expand All @@ -15,10 +43,7 @@ export {
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull,
GraphQLDirective,
// "Enum" of Type Kinds
TypeKind,
// Scalars
// Standard GraphQL Scalars
specifiedScalarTypes,
GraphQLInt,
GraphQLFloat,
Expand All @@ -30,12 +55,10 @@ export {
GraphQLIncludeDirective,
GraphQLSkipDirective,
GraphQLDeprecatedDirective,
// "Enum" of Type Kinds
TypeKind,
// Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,
// Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
// GraphQL Types for introspection.
introspectionTypes,
__Schema,
Expand All @@ -46,6 +69,10 @@ export {
__InputValue,
__EnumValue,
__TypeKind,
// Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
// Predicates
isSchema,
isDirective,
Expand All @@ -72,6 +99,8 @@ export {
isIntrospectionType,
isSpecifiedDirective,
// Assertions
assertSchema,
assertDirective,
assertType,
assertScalarType,
assertObjectType,
Expand All @@ -95,7 +124,9 @@ export {
// Validate GraphQL schema.
validateSchema,
assertValidSchema,
// type
} from './type';

export {
GraphQLType,
GraphQLInputType,
GraphQLOutputType,
Expand All @@ -107,6 +138,7 @@ export {
GraphQLNamedType,
Thunk,
GraphQLSchemaConfig,
GraphQLDirectiveConfig,
GraphQLArgument,
GraphQLArgumentConfig,
GraphQLEnumTypeConfig,
Expand All @@ -128,10 +160,10 @@ export {
GraphQLIsTypeOfFn,
GraphQLObjectTypeConfig,
GraphQLResolveInfo,
ResponsePath,
GraphQLScalarTypeConfig,
GraphQLTypeResolver,
GraphQLUnionTypeConfig,
GraphQLDirectiveConfig,
GraphQLScalarSerializer,
GraphQLScalarValueParser,
GraphQLScalarLiteralParser,
Expand All @@ -141,6 +173,12 @@ export {
export {
Source,
getLocation,
// Print source location
printLocation,
printSourceLocation,
// Lex
createLexer,
TokenKind,
// Parse
parse,
parseValue,
Expand All @@ -152,10 +190,9 @@ export {
visitInParallel,
visitWithTypeInfo,
getVisitFn,
BREAK,
Kind,
TokenKind,
DirectiveLocation,
BREAK,
// Predicates
isDefinitionNode,
isExecutableDefinitionNode,
Expand All @@ -166,20 +203,26 @@ export {
isTypeDefinitionNode,
isTypeSystemExtensionNode,
isTypeExtensionNode,
// type
} from './language';

export {
Lexer,
ParseOptions,
SourceLocation,
Location,
Token,
TokenKindEnum,
KindEnum,
DirectiveLocationEnum,
// Visitor utilities
ASTVisitor,
Visitor,
VisitFn,
VisitorKeyMap,
// AST nodes
Location,
Token,
ASTNode,
ASTKindToNode,
// Each kind of AST node
NameNode,
DocumentNode,
DefinitionNode,
Expand Down Expand Up @@ -233,25 +276,26 @@ export {
UnionTypeExtensionNode,
EnumTypeExtensionNode,
InputObjectTypeExtensionNode,
KindEnum,
TokenKindEnum,
DirectiveLocationEnum,
} from './language';

// Execute GraphQL queries.
export {
execute,
defaultFieldResolver,
defaultTypeResolver,
responsePathAsArray,
getDirectiveValues,
// type
ExecutionArgs,
ExecutionResult,
} from './execution';

export { subscribe, createSourceEventStream } from './subscription';
export {
subscribe,
createSourceEventStream,
SubscriptionArgs,
} from './subscription';

// Validate GraphQL queries.
// Validate GraphQL documents.
export {
validate,
ValidationContext,
Expand Down Expand Up @@ -283,13 +327,16 @@ export {
ValuesOfCorrectTypeRule,
VariablesAreInputTypesRule,
VariablesInAllowedPositionRule,
ValidationRule,
} from './validation';

// Create and format GraphQL errors.
// Create, format, and print GraphQL errors.
export {
GraphQLError,
formatError,
syntaxError,
locatedError,
printError,
formatError,
GraphQLFormattedError,
} from './error';

Expand All @@ -298,13 +345,13 @@ export {
// Produce the GraphQL query recommended for a full schema introspection.
// Accepts optional IntrospectionOptions.
getIntrospectionQuery,
// @deprecated: use getIntrospectionQuery - will be removed in v15
// @deprecated: use getIntrospectionQuery - will be removed in v15.
introspectionQuery,
// Gets the target Operation from a Document
// Gets the target Operation from a Document.
getOperationAST,
// Gets the Type for the target Operation AST.
getOperationRootType,
// Convert a GraphQLSchema to an IntrospectionQuery
// Convert a GraphQLSchema to an IntrospectionQuery.
introspectionFromSchema,
// Build a GraphQLSchema from an introspection result.
buildClientSchema,
Expand All @@ -313,7 +360,7 @@ export {
// Build a GraphQLSchema from a GraphQL schema language document.
buildSchema,
// @deprecated: Get the description from a schema AST node and supports legacy
// syntax for specifying descriptions - will be removed in v16
// syntax for specifying descriptions - will be removed in v16.
getDescription,
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
// language AST.
Expand All @@ -322,11 +369,11 @@ export {
lexicographicSortSchema,
// Print a GraphQLSchema to GraphQL Schema language.
printSchema,
// Print a GraphQLType to GraphQL Schema language.
printType,
// Prints the built-in introspection schema in the Schema Language
// format.
printIntrospectionSchema,
// Print a GraphQLType to GraphQL Schema language.
printType,
// Create a GraphQLType from a GraphQL language AST.
typeFromAST,
// Create a JavaScript value from a GraphQL language AST with a Type.
Expand All @@ -339,15 +386,20 @@ export {
// the GraphQL type system.
TypeInfo,
// Coerces a JavaScript value to a GraphQL type, or produces errors.
coerceInputValue,
// @deprecated use coerceInputValue - will be removed in v15
coerceValue,
// @deprecated use coerceValue - will be removed in v15
// @deprecated use coerceInputValue - will be removed in v15
isValidJSValue,
// @deprecated use validation - will be removed in v15
isValidLiteralValue,
// Concatenates multiple AST together.
concatAST,
// Separates an AST into an AST per Operation.
separateOperations,
// Strips characters that are not significant to the validity or execution
// of a GraphQL document.
stripIgnoredCharacters,
// Comparators for types
isEqualType,
isTypeSubTypeOf,
Expand All @@ -357,36 +409,38 @@ export {
// Determine if a string is a valid GraphQL name.
isValidNameError,
// Compares two GraphQLSchemas and detects breaking changes.
findBreakingChanges,
findDangerousChanges,
BreakingChangeType,
DangerousChangeType,
findBreakingChanges,
findDangerousChanges,
// Report all deprecated usage within a GraphQL document.
findDeprecatedUsages,
// type
BuildSchemaOptions,
BreakingChange,
DangerousChange,
} from './utilities';

export {
IntrospectionOptions,
IntrospectionDirective,
IntrospectionQuery,
IntrospectionSchema,
IntrospectionType,
IntrospectionInputType,
IntrospectionOutputType,
IntrospectionScalarType,
IntrospectionObjectType,
IntrospectionInterfaceType,
IntrospectionUnionType,
IntrospectionEnumType,
IntrospectionEnumValue,
IntrospectionField,
IntrospectionInputObjectType,
IntrospectionInputType,
IntrospectionTypeRef,
IntrospectionInputTypeRef,
IntrospectionInputValue,
IntrospectionInterfaceType,
IntrospectionListTypeRef,
IntrospectionOutputTypeRef,
IntrospectionNamedTypeRef,
IntrospectionListTypeRef,
IntrospectionNonNullTypeRef,
IntrospectionObjectType,
IntrospectionOutputType,
IntrospectionOutputTypeRef,
IntrospectionQuery,
IntrospectionScalarType,
IntrospectionSchema,
IntrospectionType,
IntrospectionTypeRef,
IntrospectionUnionType,
IntrospectionField,
IntrospectionInputValue,
IntrospectionEnumValue,
IntrospectionDirective,
BuildSchemaOptions,
BreakingChange,
DangerousChange,
} from './utilities';
3 changes: 3 additions & 0 deletions tstypes/language/index.d.ts
@@ -1,5 +1,8 @@
export { Source } from './source';
export { getLocation, SourceLocation } from './location';

export { printLocation, printSourceLocation } from './printLocation';

export { Kind, KindEnum } from './kinds';
export { TokenKind, TokenKindEnum } from './tokenKind';
export { createLexer, Lexer } from './lexer';
Expand Down
2 changes: 2 additions & 0 deletions tstypes/type/index.d.ts
@@ -1,3 +1,5 @@
export { Path as ResponsePath } from '../jsutils/Path';

export {
// Predicate
isSchema,
Expand Down
2 changes: 1 addition & 1 deletion tstypes/validation/index.d.ts
@@ -1,6 +1,6 @@
export { validate } from './validate';

export { ValidationContext } from './ValidationContext';
export { ValidationContext, ValidationRule } from './ValidationContext';

export { specifiedRules } from './specifiedRules';

Expand Down
14 changes: 14 additions & 0 deletions tstypes/version.d.ts
@@ -0,0 +1,14 @@
/**
* A string containing the version of the GraphQL.js library
*/
export const version: string;

/**
* An object containing the components of the GraphQL.js version string
*/
export const versionInfo: {
major: number;
minor: number;
patch: number;
preReleaseTag: number | null;
};

0 comments on commit 7b9bfda

Please sign in to comment.