mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
graphql: Lint (#18257)
This commit is contained in:
+4
-5
@@ -9,7 +9,6 @@ import { Source } from '../language/source';
|
||||
* GraphQL document and/or execution result that correspond to the Error.
|
||||
*/
|
||||
export class GraphQLError extends Error {
|
||||
|
||||
/**
|
||||
* A message describing the Error for debugging purposes.
|
||||
*
|
||||
@@ -40,7 +39,7 @@ export class GraphQLError extends Error {
|
||||
/**
|
||||
* An array of GraphQL AST Nodes corresponding to this error.
|
||||
*/
|
||||
nodes?: Array<ASTNode> | undefined;
|
||||
nodes?: ASTNode[] | undefined;
|
||||
|
||||
/**
|
||||
* The source GraphQL document corresponding to this error.
|
||||
@@ -51,7 +50,7 @@ export class GraphQLError extends Error {
|
||||
* An array of character offsets within the source GraphQL document
|
||||
* which correspond to this error.
|
||||
*/
|
||||
positions?: Array<number> | undefined;
|
||||
positions?: number[] | undefined;
|
||||
|
||||
/**
|
||||
* The original error thrown from a field resolver during execution.
|
||||
@@ -60,9 +59,9 @@ export class GraphQLError extends Error {
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
nodes?: Array<any>,
|
||||
nodes?: any[],
|
||||
source?: Source,
|
||||
positions?: Array<number>,
|
||||
positions?: number[],
|
||||
path?: Array<string | number>,
|
||||
originalError?: Error,
|
||||
);
|
||||
|
||||
Vendored
+9
-9
@@ -6,13 +6,13 @@ import { GraphQLError } from './GraphQLError';
|
||||
*/
|
||||
export function formatError(error: GraphQLError): GraphQLFormattedError;
|
||||
|
||||
export type GraphQLFormattedError = {
|
||||
message: string,
|
||||
locations?: Array<GraphQLErrorLocation>,
|
||||
path?: Array<string | number>
|
||||
};
|
||||
export interface GraphQLFormattedError {
|
||||
message: string;
|
||||
locations?: GraphQLErrorLocation[];
|
||||
path?: Array<string | number>;
|
||||
}
|
||||
|
||||
export type GraphQLErrorLocation = {
|
||||
line: number,
|
||||
column: number
|
||||
};
|
||||
export interface GraphQLErrorLocation {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
export { GraphQLError } from './GraphQLError';
|
||||
export { syntaxError } from './syntaxError';
|
||||
export { locatedError } from './locatedError';
|
||||
export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError';
|
||||
export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError';
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ import { GraphQLError } from './GraphQLError';
|
||||
*/
|
||||
export function locatedError<T>(
|
||||
originalError: Error,
|
||||
nodes: Array<T>,
|
||||
nodes: T[],
|
||||
path: Array<string | number>
|
||||
): GraphQLError;
|
||||
|
||||
Vendored
+1
-1
@@ -9,4 +9,4 @@ export function syntaxError(
|
||||
source: Source,
|
||||
position: number,
|
||||
description: string
|
||||
): GraphQLError;
|
||||
): GraphQLError;
|
||||
|
||||
Vendored
+2
-2
@@ -22,7 +22,7 @@ export interface ExecutionContext {
|
||||
rootValue: any;
|
||||
operation: OperationDefinitionNode;
|
||||
variableValues: { [key: string]: any };
|
||||
errors: Array<GraphQLError>;
|
||||
errors: GraphQLError[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export interface ExecutionContext {
|
||||
*/
|
||||
export interface ExecutionResult {
|
||||
data?: { [key: string]: any };
|
||||
errors?: Array<GraphQLError>;
|
||||
errors?: GraphQLError[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+2
-2
@@ -10,9 +10,9 @@ import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/as
|
||||
*/
|
||||
export function getVariableValues(
|
||||
schema: GraphQLSchema,
|
||||
varDefNodes: Array<VariableDefinitionNode>,
|
||||
varDefNodes: VariableDefinitionNode[],
|
||||
inputs: { [key: string]: any }
|
||||
): { [key: string]: any }
|
||||
): { [key: string]: any };
|
||||
|
||||
/**
|
||||
* Prepares an object map of argument values given a list of argument
|
||||
|
||||
@@ -3,180 +3,180 @@ import * as graphql from 'graphql';
|
||||
///////////////////////////
|
||||
// graphql //
|
||||
///////////////////////////
|
||||
namespace graphql_tests {
|
||||
function graphql_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/language //
|
||||
///////////////////////////
|
||||
namespace language_ast_tests {
|
||||
// TODOS
|
||||
function language_ast_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_index_tests {
|
||||
// TODOS
|
||||
function language_index_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_kinds_tests {
|
||||
// TODOS
|
||||
function language_kinds_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_lexer_tests {
|
||||
// TODOS
|
||||
function language_lexer_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_location_tests {
|
||||
// TODOS
|
||||
function language_location_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_parser_tests {
|
||||
// TODOS
|
||||
function language_parser_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_printer_tests {
|
||||
// TODOS
|
||||
function language_printer_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_source_tests {
|
||||
// TODOS
|
||||
function language_source_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace language_visitor_tests {
|
||||
// TODOS
|
||||
function language_visitor_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/type //
|
||||
///////////////////////////
|
||||
namespace type_definition_tests {
|
||||
function type_definition_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace type_directives_tests {
|
||||
function type_directives_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace type_introspection_tests {
|
||||
function type_introspection_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace type_scalars_tests {
|
||||
function type_scalars_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace type_schema_tests {
|
||||
function type_schema_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/validation //
|
||||
///////////////////////////
|
||||
namespace validation_specifiedRules_tests {
|
||||
|
||||
function validation_specifiedRules_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace validation_validate_tests {
|
||||
|
||||
function validation_validate_tests() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/execution //
|
||||
///////////////////////////
|
||||
namespace execution_execute_tests {
|
||||
function execution_execute_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace execution_values_tests {
|
||||
function execution_values_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/error //
|
||||
///////////////////////////
|
||||
namespace error_GraphQLError {
|
||||
|
||||
function error_GraphQLError() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace error_formatError {
|
||||
|
||||
function error_formatError() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace error_locatedError {
|
||||
|
||||
function error_locatedError() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace error_syntaxError {
|
||||
|
||||
function error_syntaxError() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// graphql/utilities //
|
||||
///////////////////////////
|
||||
namespace utilities_TypeInfo_tests {
|
||||
//TODOS
|
||||
function utilities_TypeInfo_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_assertValidName_tests {
|
||||
//TODOS
|
||||
function utilities_assertValidName_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_astFromValue_tests {
|
||||
//TODOS
|
||||
function utilities_astFromValue_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_buildASTSchema_tests {
|
||||
//TODOS
|
||||
function utilities_buildASTSchema_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_buildClientSchema_tests {
|
||||
//TODOS
|
||||
function utilities_buildClientSchema_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_concatAST_tests {
|
||||
//TODOS
|
||||
function utilities_concatAST_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_extendSchema_tests {
|
||||
//TODOS
|
||||
function utilities_extendSchema_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_getOperationAST_tests {
|
||||
//TODOS
|
||||
function utilities_getOperationAST_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_index_tests {
|
||||
//TODOS
|
||||
function utilities_index_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_introspectionQuery_tests {
|
||||
//TODOS
|
||||
function utilities_introspectionQuery_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_isValidJSValue_tests {
|
||||
//TODOS
|
||||
function utilities_isValidJSValue_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_isValidLiteralValue_tests {
|
||||
//TODOS
|
||||
function utilities_isValidLiteralValue_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_schemaPrinter_tests {
|
||||
//TODOS
|
||||
function utilities_schemaPrinter_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_separateOperations_tests {
|
||||
//TODOS
|
||||
function utilities_separateOperations_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_typeComparators_tests {
|
||||
//TODOS
|
||||
function utilities_typeComparators_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_typeFromAST_tests {
|
||||
//TODOS
|
||||
function utilities_typeFromAST_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
namespace utilities_valueFromAST_tests {
|
||||
//TODOS
|
||||
function utilities_valueFromAST_tests() {
|
||||
// TODOS
|
||||
}
|
||||
|
||||
Vendored
+5
-7
@@ -1,6 +1,10 @@
|
||||
// Type definitions for graphql 0.10
|
||||
// Project: https://www.npmjs.com/package/graphql
|
||||
// Definitions by: TonyYang <https://github.com/TonyPythoneer>, Caleb Meredith <https://github.com/calebmer>, Dominic Watson <https://github.com/intellix>, Firede <https://github.com/firede>, Kepennar <https://github.com/kepennar>
|
||||
// Definitions by: TonyYang <https://github.com/TonyPythoneer>
|
||||
// Caleb Meredith <https://github.com/calebmer>
|
||||
// Dominic Watson <https://github.com/intellix>
|
||||
// Firede <https://github.com/firede>
|
||||
// Kepennar <https://github.com/kepennar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -9,12 +13,9 @@ export {
|
||||
graphql
|
||||
} from './graphql';
|
||||
|
||||
/// <reference types="graphql" />
|
||||
|
||||
// Create and operate on GraphQL type definitions and schema.
|
||||
export * from './type';
|
||||
|
||||
|
||||
// Parse and operate on GraphQL language source files.
|
||||
export * from './language';
|
||||
|
||||
@@ -28,7 +29,6 @@ export {
|
||||
ExecutionResult,
|
||||
} from './execution';
|
||||
|
||||
|
||||
// Validate GraphQL queries.
|
||||
export {
|
||||
validate,
|
||||
@@ -36,7 +36,6 @@ export {
|
||||
specifiedRules,
|
||||
} from './validation';
|
||||
|
||||
|
||||
// Create and format GraphQL errors.
|
||||
export {
|
||||
GraphQLError,
|
||||
@@ -45,7 +44,6 @@ export {
|
||||
GraphQLErrorLocation,
|
||||
} from './error';
|
||||
|
||||
|
||||
// Utilities for operating on GraphQL type schema and parsed sources.
|
||||
export {
|
||||
// The GraphQL query recommended for a full schema introspection.
|
||||
|
||||
Vendored
+115
-113
@@ -4,8 +4,7 @@ import { Source } from './source';
|
||||
* Contains a range of UTF-8 character offsets and token references that
|
||||
* identify the region of the source from which the AST derived.
|
||||
*/
|
||||
export type Location = {
|
||||
|
||||
export interface Location {
|
||||
/**
|
||||
* The character offset at which this Node begins.
|
||||
*/
|
||||
@@ -30,37 +29,37 @@ export type Location = {
|
||||
* The Source document the AST represents.
|
||||
*/
|
||||
source: Source;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a range of characters represented by a lexical token
|
||||
* within a Source.
|
||||
*/
|
||||
export type Token = {
|
||||
|
||||
export interface Token {
|
||||
/**
|
||||
* The kind of Token.
|
||||
*/
|
||||
kind: '<SOF>'
|
||||
| '<EOF>'
|
||||
| '!'
|
||||
| '$'
|
||||
| '('
|
||||
| ')'
|
||||
| '...'
|
||||
| ':'
|
||||
| '='
|
||||
| '@'
|
||||
| '['
|
||||
| ']'
|
||||
| '{'
|
||||
| '|'
|
||||
| '}'
|
||||
| 'Name'
|
||||
| 'Int'
|
||||
| 'Float'
|
||||
| 'String'
|
||||
| 'Comment';
|
||||
kind:
|
||||
| '<SOF>'
|
||||
| '<EOF>'
|
||||
| '!'
|
||||
| '$'
|
||||
| '('
|
||||
| ')'
|
||||
| '...'
|
||||
| ':'
|
||||
| '='
|
||||
| '@'
|
||||
| '['
|
||||
| ']'
|
||||
| '{'
|
||||
| '|'
|
||||
| '}'
|
||||
| 'Name'
|
||||
| 'Int'
|
||||
| 'Float'
|
||||
| 'String'
|
||||
| 'Comment';
|
||||
|
||||
/**
|
||||
* The character offset at which this Node begins.
|
||||
@@ -94,12 +93,13 @@ export type Token = {
|
||||
*/
|
||||
prev?: Token;
|
||||
next?: Token;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of all possible AST node types.
|
||||
*/
|
||||
export type ASTNode = NameNode
|
||||
export type ASTNode =
|
||||
| NameNode
|
||||
| DocumentNode
|
||||
| OperationDefinitionNode
|
||||
| VariableDefinitionNode
|
||||
@@ -139,7 +139,7 @@ export type ASTNode = NameNode
|
||||
|
||||
// Name
|
||||
|
||||
export type NameNode = {
|
||||
export interface NameNode {
|
||||
kind: 'Name';
|
||||
loc?: Location;
|
||||
value: string;
|
||||
@@ -147,30 +147,31 @@ export type NameNode = {
|
||||
|
||||
// Document
|
||||
|
||||
export type DocumentNode = {
|
||||
export interface DocumentNode {
|
||||
kind: 'Document';
|
||||
loc?: Location;
|
||||
definitions: Array<DefinitionNode>;
|
||||
definitions: DefinitionNode[];
|
||||
}
|
||||
|
||||
export type DefinitionNode = OperationDefinitionNode
|
||||
export type DefinitionNode =
|
||||
| OperationDefinitionNode
|
||||
| FragmentDefinitionNode
|
||||
| TypeSystemDefinitionNode // experimental non-spec addition.
|
||||
| TypeSystemDefinitionNode; // experimental non-spec addition.
|
||||
|
||||
export type OperationDefinitionNode = {
|
||||
export interface OperationDefinitionNode {
|
||||
kind: 'OperationDefinition';
|
||||
loc?: Location;
|
||||
operation: OperationTypeNode;
|
||||
name?: NameNode;
|
||||
variableDefinitions?: Array<VariableDefinitionNode>;
|
||||
directives?: Array<DirectiveNode>;
|
||||
variableDefinitions?: VariableDefinitionNode[];
|
||||
directives?: DirectiveNode[];
|
||||
selectionSet: SelectionSetNode;
|
||||
}
|
||||
|
||||
// Note: subscription is an experimental non-spec addition.
|
||||
export type OperationTypeNode = 'query' | 'mutation' | 'subscription';
|
||||
|
||||
export type VariableDefinitionNode = {
|
||||
export interface VariableDefinitionNode {
|
||||
kind: 'VariableDefinition';
|
||||
loc?: Location;
|
||||
variable: VariableNode;
|
||||
@@ -178,70 +179,70 @@ export type VariableDefinitionNode = {
|
||||
defaultValue?: ValueNode;
|
||||
}
|
||||
|
||||
export type VariableNode = {
|
||||
export interface VariableNode {
|
||||
kind: 'Variable';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
}
|
||||
|
||||
export type SelectionSetNode = {
|
||||
export interface SelectionSetNode {
|
||||
kind: 'SelectionSet';
|
||||
loc?: Location;
|
||||
selections: Array<SelectionNode>;
|
||||
selections: SelectionNode[];
|
||||
}
|
||||
|
||||
export type SelectionNode = FieldNode
|
||||
export type SelectionNode =
|
||||
| FieldNode
|
||||
| FragmentSpreadNode
|
||||
| InlineFragmentNode
|
||||
| InlineFragmentNode;
|
||||
|
||||
export type FieldNode = {
|
||||
export interface FieldNode {
|
||||
kind: 'Field';
|
||||
loc?: Location;
|
||||
alias?: NameNode;
|
||||
name: NameNode;
|
||||
arguments?: Array<ArgumentNode>;
|
||||
directives?: Array<DirectiveNode>;
|
||||
arguments?: ArgumentNode[];
|
||||
directives?: DirectiveNode[];
|
||||
selectionSet?: SelectionSetNode;
|
||||
}
|
||||
|
||||
export type ArgumentNode = {
|
||||
export interface ArgumentNode {
|
||||
kind: 'Argument';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
value: ValueNode;
|
||||
}
|
||||
|
||||
|
||||
// Fragments
|
||||
|
||||
export type FragmentSpreadNode = {
|
||||
export interface FragmentSpreadNode {
|
||||
kind: 'FragmentSpread';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
}
|
||||
|
||||
export type InlineFragmentNode = {
|
||||
export interface InlineFragmentNode {
|
||||
kind: 'InlineFragment';
|
||||
loc?: Location;
|
||||
typeCondition?: NamedTypeNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
selectionSet: SelectionSetNode;
|
||||
}
|
||||
|
||||
export type FragmentDefinitionNode = {
|
||||
export interface FragmentDefinitionNode {
|
||||
kind: 'FragmentDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
typeCondition: NamedTypeNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
selectionSet: SelectionSetNode;
|
||||
}
|
||||
|
||||
|
||||
// Values
|
||||
|
||||
export type ValueNode = VariableNode
|
||||
export type ValueNode =
|
||||
| VariableNode
|
||||
| IntValueNode
|
||||
| FloatValueNode
|
||||
| StringValueNode
|
||||
@@ -249,92 +250,91 @@ export type ValueNode = VariableNode
|
||||
| NullValueNode
|
||||
| EnumValueNode
|
||||
| ListValueNode
|
||||
| ObjectValueNode
|
||||
| ObjectValueNode;
|
||||
|
||||
export type IntValueNode = {
|
||||
export interface IntValueNode {
|
||||
kind: 'IntValue';
|
||||
loc?: Location;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type FloatValueNode = {
|
||||
export interface FloatValueNode {
|
||||
kind: 'FloatValue';
|
||||
loc?: Location;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type StringValueNode = {
|
||||
export interface StringValueNode {
|
||||
kind: 'StringValue';
|
||||
loc?: Location;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type BooleanValueNode = {
|
||||
export interface BooleanValueNode {
|
||||
kind: 'BooleanValue';
|
||||
loc?: Location;
|
||||
value: boolean;
|
||||
}
|
||||
|
||||
export type NullValueNode = {
|
||||
export interface NullValueNode {
|
||||
kind: 'NullValue';
|
||||
loc?: Location;
|
||||
}
|
||||
|
||||
export type EnumValueNode = {
|
||||
export interface EnumValueNode {
|
||||
kind: 'EnumValue';
|
||||
loc?: Location;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type ListValueNode = {
|
||||
export interface ListValueNode {
|
||||
kind: 'ListValue';
|
||||
loc?: Location;
|
||||
values: Array<ValueNode>;
|
||||
values: ValueNode[];
|
||||
}
|
||||
|
||||
export type ObjectValueNode = {
|
||||
export interface ObjectValueNode {
|
||||
kind: 'ObjectValue';
|
||||
loc?: Location;
|
||||
fields: Array<ObjectFieldNode>;
|
||||
fields: ObjectFieldNode[];
|
||||
}
|
||||
|
||||
export type ObjectFieldNode = {
|
||||
export interface ObjectFieldNode {
|
||||
kind: 'ObjectField';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
value: ValueNode;
|
||||
}
|
||||
|
||||
|
||||
// Directives
|
||||
|
||||
export type DirectiveNode = {
|
||||
export interface DirectiveNode {
|
||||
kind: 'Directive';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
arguments?: Array<ArgumentNode>;
|
||||
arguments?: ArgumentNode[];
|
||||
}
|
||||
|
||||
|
||||
// Type Reference
|
||||
|
||||
export type TypeNode = NamedTypeNode
|
||||
export type TypeNode =
|
||||
| NamedTypeNode
|
||||
| ListTypeNode
|
||||
| NonNullTypeNode
|
||||
| NonNullTypeNode;
|
||||
|
||||
export type NamedTypeNode = {
|
||||
export interface NamedTypeNode {
|
||||
kind: 'NamedType';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
};
|
||||
}
|
||||
|
||||
export type ListTypeNode = {
|
||||
export interface ListTypeNode {
|
||||
kind: 'ListType';
|
||||
loc?: Location;
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export type NonNullTypeNode = {
|
||||
export interface NonNullTypeNode {
|
||||
kind: 'NonNullType';
|
||||
loc?: Location;
|
||||
type: NamedTypeNode | ListTypeNode;
|
||||
@@ -342,115 +342,117 @@ export type NonNullTypeNode = {
|
||||
|
||||
// Type System Definition
|
||||
|
||||
export type TypeSystemDefinitionNode = SchemaDefinitionNode
|
||||
export type TypeSystemDefinitionNode =
|
||||
| SchemaDefinitionNode
|
||||
| TypeDefinitionNode
|
||||
| TypeExtensionDefinitionNode
|
||||
| DirectiveDefinitionNode
|
||||
| DirectiveDefinitionNode;
|
||||
|
||||
export type SchemaDefinitionNode = {
|
||||
export interface SchemaDefinitionNode {
|
||||
kind: 'SchemaDefinition';
|
||||
loc?: Location;
|
||||
directives: Array<DirectiveNode>;
|
||||
operationTypes: Array<OperationTypeDefinitionNode>;
|
||||
directives: DirectiveNode[];
|
||||
operationTypes: OperationTypeDefinitionNode[];
|
||||
}
|
||||
|
||||
export type OperationTypeDefinitionNode = {
|
||||
export interface OperationTypeDefinitionNode {
|
||||
kind: 'OperationTypeDefinition';
|
||||
loc?: Location;
|
||||
operation: OperationTypeNode;
|
||||
type: NamedTypeNode;
|
||||
}
|
||||
|
||||
export type TypeDefinitionNode = ScalarTypeDefinitionNode
|
||||
export type TypeDefinitionNode =
|
||||
| ScalarTypeDefinitionNode
|
||||
| ObjectTypeDefinitionNode
|
||||
| InterfaceTypeDefinitionNode
|
||||
| UnionTypeDefinitionNode
|
||||
| EnumTypeDefinitionNode
|
||||
| InputObjectTypeDefinitionNode
|
||||
| InputObjectTypeDefinitionNode;
|
||||
|
||||
export type ScalarTypeDefinitionNode = {
|
||||
export interface ScalarTypeDefinitionNode {
|
||||
kind: 'ScalarTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
}
|
||||
|
||||
export type ObjectTypeDefinitionNode = {
|
||||
export interface ObjectTypeDefinitionNode {
|
||||
kind: 'ObjectTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
interfaces?: Array<NamedTypeNode>;
|
||||
directives?: Array<DirectiveNode>;
|
||||
fields: Array<FieldDefinitionNode>;
|
||||
interfaces?: NamedTypeNode[];
|
||||
directives?: DirectiveNode[];
|
||||
fields: FieldDefinitionNode[];
|
||||
}
|
||||
|
||||
export type FieldDefinitionNode = {
|
||||
export interface FieldDefinitionNode {
|
||||
kind: 'FieldDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
arguments: Array<InputValueDefinitionNode>;
|
||||
arguments: InputValueDefinitionNode[];
|
||||
type: TypeNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
}
|
||||
|
||||
export type InputValueDefinitionNode = {
|
||||
export interface InputValueDefinitionNode {
|
||||
kind: 'InputValueDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
type: TypeNode;
|
||||
defaultValue?: ValueNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
}
|
||||
|
||||
export type InterfaceTypeDefinitionNode = {
|
||||
export interface InterfaceTypeDefinitionNode {
|
||||
kind: 'InterfaceTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
fields: Array<FieldDefinitionNode>;
|
||||
directives?: DirectiveNode[];
|
||||
fields: FieldDefinitionNode[];
|
||||
}
|
||||
|
||||
export type UnionTypeDefinitionNode = {
|
||||
export interface UnionTypeDefinitionNode {
|
||||
kind: 'UnionTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
types: Array<NamedTypeNode>;
|
||||
directives?: DirectiveNode[];
|
||||
types: NamedTypeNode[];
|
||||
}
|
||||
|
||||
export type EnumTypeDefinitionNode = {
|
||||
export interface EnumTypeDefinitionNode {
|
||||
kind: 'EnumTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
values: Array<EnumValueDefinitionNode>;
|
||||
directives?: DirectiveNode[];
|
||||
values: EnumValueDefinitionNode[];
|
||||
}
|
||||
|
||||
export type EnumValueDefinitionNode = {
|
||||
export interface EnumValueDefinitionNode {
|
||||
kind: 'EnumValueDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
directives?: DirectiveNode[];
|
||||
}
|
||||
|
||||
export type InputObjectTypeDefinitionNode = {
|
||||
export interface InputObjectTypeDefinitionNode {
|
||||
kind: 'InputObjectTypeDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
directives?: Array<DirectiveNode>;
|
||||
fields: Array<InputValueDefinitionNode>;
|
||||
directives?: DirectiveNode[];
|
||||
fields: InputValueDefinitionNode[];
|
||||
}
|
||||
|
||||
export type TypeExtensionDefinitionNode = {
|
||||
export interface TypeExtensionDefinitionNode {
|
||||
kind: 'TypeExtensionDefinition';
|
||||
loc?: Location;
|
||||
definition: ObjectTypeDefinitionNode;
|
||||
}
|
||||
|
||||
export type DirectiveDefinitionNode = {
|
||||
export interface DirectiveDefinitionNode {
|
||||
kind: 'DirectiveDefinition';
|
||||
loc?: Location;
|
||||
name: NameNode;
|
||||
arguments?: Array<InputValueDefinitionNode>;
|
||||
locations: Array<NameNode>;
|
||||
arguments?: InputValueDefinitionNode[];
|
||||
locations: NameNode[];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -63,4 +63,4 @@ export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition';
|
||||
|
||||
// Directive Definitions
|
||||
|
||||
export const DIRECTIVE_DEFINITION: 'DirectiveDefinition';
|
||||
export const DIRECTIVE_DEFINITION: 'DirectiveDefinition';
|
||||
|
||||
Vendored
+2
-2
@@ -18,7 +18,7 @@ export function createLexer<TOptions>(
|
||||
/**
|
||||
* The return type of createLexer.
|
||||
*/
|
||||
export type Lexer<TOptions> = {
|
||||
export interface Lexer<TOptions> {
|
||||
source: Source;
|
||||
options: TOptions;
|
||||
|
||||
@@ -46,7 +46,7 @@ export type Lexer<TOptions> = {
|
||||
* Advances the token stream to the next non-ignored token.
|
||||
*/
|
||||
advance(): Token;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* An exported enum describing the different kinds of tokens that the
|
||||
|
||||
Vendored
-1
@@ -1,6 +1,5 @@
|
||||
import { Source } from "./source";
|
||||
|
||||
|
||||
export interface SourceLocation {
|
||||
line: number;
|
||||
column: number;
|
||||
|
||||
Vendored
+3
-3
@@ -5,14 +5,14 @@ import { Lexer } from "./lexer";
|
||||
/**
|
||||
* Configuration options to control parser behavior
|
||||
*/
|
||||
export type ParseOptions = {
|
||||
export interface ParseOptions {
|
||||
/**
|
||||
* By default, the parser creates AST nodes that know the location
|
||||
* in the source that they correspond to. This configuration flag
|
||||
* disables that behavior for performance or testing.
|
||||
*/
|
||||
noLocation?: boolean
|
||||
};
|
||||
noLocation?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a GraphQL source, parses it into a Document.
|
||||
|
||||
Vendored
+1
-1
@@ -38,7 +38,7 @@ export const QueryDocumentKeys: {
|
||||
EnumValueDefinition: string[];
|
||||
InputObjectTypeDefinition: string[];
|
||||
TypeExtensionDefinition: string[];
|
||||
}
|
||||
};
|
||||
|
||||
export const BREAK: any;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+66
-69
@@ -10,14 +10,14 @@ import { GraphQLSchema } from './schema';
|
||||
* These are all of the possible kinds of types.
|
||||
*/
|
||||
export type GraphQLType =
|
||||
GraphQLScalarType |
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType |
|
||||
GraphQLEnumType |
|
||||
GraphQLInputObjectType |
|
||||
GraphQLList<any> |
|
||||
GraphQLNonNull<any>;
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLInputObjectType
|
||||
| GraphQLList<any>
|
||||
| GraphQLNonNull<any>;
|
||||
|
||||
export function isType(type: any): type is GraphQLType;
|
||||
|
||||
@@ -27,16 +27,15 @@ export function assertType(type: any): GraphQLType;
|
||||
* These types may be used as input types for arguments and directives.
|
||||
*/
|
||||
export type GraphQLInputType =
|
||||
GraphQLScalarType |
|
||||
GraphQLEnumType |
|
||||
GraphQLInputObjectType |
|
||||
GraphQLList<any> |
|
||||
GraphQLNonNull<
|
||||
GraphQLScalarType |
|
||||
GraphQLEnumType |
|
||||
GraphQLInputObjectType |
|
||||
GraphQLList<any>
|
||||
>;
|
||||
| GraphQLScalarType
|
||||
| GraphQLEnumType
|
||||
| GraphQLInputObjectType
|
||||
| GraphQLList<any>
|
||||
| GraphQLNonNull<
|
||||
| GraphQLScalarType
|
||||
| GraphQLEnumType
|
||||
| GraphQLInputObjectType
|
||||
| GraphQLList<any>>;
|
||||
|
||||
export function isInputType(type: GraphQLType): type is GraphQLInputType;
|
||||
|
||||
@@ -46,20 +45,19 @@ export function assertInputType(type: GraphQLType): GraphQLInputType;
|
||||
* These types may be used as output types as the result of fields.
|
||||
*/
|
||||
export type GraphQLOutputType =
|
||||
GraphQLScalarType |
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType |
|
||||
GraphQLEnumType |
|
||||
GraphQLList<any> |
|
||||
GraphQLNonNull<
|
||||
GraphQLScalarType |
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType |
|
||||
GraphQLEnumType |
|
||||
GraphQLList<any>
|
||||
>;
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLList<any>
|
||||
| GraphQLNonNull<
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLList<any>>;
|
||||
|
||||
export function isOutputType(type: GraphQLType): type is GraphQLOutputType;
|
||||
|
||||
@@ -69,8 +67,8 @@ export function assertOutputType(type: GraphQLType): GraphQLOutputType;
|
||||
* These types may describe types which may be leaf values.
|
||||
*/
|
||||
export type GraphQLLeafType =
|
||||
GraphQLScalarType |
|
||||
GraphQLEnumType;
|
||||
| GraphQLScalarType
|
||||
| GraphQLEnumType;
|
||||
|
||||
export function isLeafType(type: GraphQLType): type is GraphQLLeafType;
|
||||
|
||||
@@ -80,9 +78,9 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType;
|
||||
* These types may describe the parent context of a selection set.
|
||||
*/
|
||||
export type GraphQLCompositeType =
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType;
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType;
|
||||
|
||||
export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType;
|
||||
|
||||
@@ -92,8 +90,8 @@ export function assertCompositeType(type: GraphQLType): GraphQLCompositeType;
|
||||
* These types may describe the parent context of a selection set.
|
||||
*/
|
||||
export type GraphQLAbstractType =
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType;
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType;
|
||||
|
||||
export function isAbstractType(type: GraphQLType): type is GraphQLAbstractType;
|
||||
|
||||
@@ -103,13 +101,13 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType;
|
||||
* These types can all accept null as a value.
|
||||
*/
|
||||
export type GraphQLNullableType =
|
||||
GraphQLScalarType |
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType |
|
||||
GraphQLEnumType |
|
||||
GraphQLInputObjectType |
|
||||
GraphQLList<any>;
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLInputObjectType
|
||||
| GraphQLList<any>;
|
||||
|
||||
export function getNullableType<T extends GraphQLType>(
|
||||
type: T
|
||||
@@ -119,12 +117,12 @@ export function getNullableType<T extends GraphQLType>(
|
||||
* These named types do not include modifiers like List or NonNull.
|
||||
*/
|
||||
export type GraphQLNamedType =
|
||||
GraphQLScalarType |
|
||||
GraphQLObjectType |
|
||||
GraphQLInterfaceType |
|
||||
GraphQLUnionType |
|
||||
GraphQLEnumType |
|
||||
GraphQLInputObjectType;
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLInputObjectType;
|
||||
|
||||
export function isNamedType(type: GraphQLType): boolean;
|
||||
|
||||
@@ -175,9 +173,9 @@ export class GraphQLScalarType {
|
||||
export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
|
||||
name: string;
|
||||
description?: string;
|
||||
serialize: (value: any) => TExternal | null | undefined;
|
||||
parseValue?: (value: any) => TInternal | null | undefined;
|
||||
parseLiteral?: (valueNode: ValueNode) => TInternal | null | undefined;
|
||||
serialize(value: any): TExternal | null | undefined;
|
||||
parseValue?(value: any): TInternal | null | undefined;
|
||||
parseLiteral?(valueNode: ValueNode): TInternal | null | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,17 +222,16 @@ export class GraphQLObjectType {
|
||||
|
||||
constructor(config: GraphQLObjectTypeConfig<any, any>);
|
||||
getFields(): GraphQLFieldMap<any, any>;
|
||||
getInterfaces(): Array<GraphQLInterfaceType>;
|
||||
getInterfaces(): GraphQLInterfaceType[];
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
export interface GraphQLObjectTypeConfig<TSource, TContext> {
|
||||
name: string;
|
||||
interfaces?: Thunk<Array<GraphQLInterfaceType>>;
|
||||
interfaces?: Thunk<GraphQLInterfaceType[]>;
|
||||
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
|
||||
isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
|
||||
description?: string
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export type GraphQLTypeResolver<TSource, TContext> = (
|
||||
@@ -258,7 +255,7 @@ export type GraphQLFieldResolver<TSource, TContext> = (
|
||||
|
||||
export interface GraphQLResolveInfo {
|
||||
fieldName: string;
|
||||
fieldNodes: Array<FieldNode>;
|
||||
fieldNodes: FieldNode[];
|
||||
returnType: GraphQLOutputType;
|
||||
parentType: GraphQLCompositeType;
|
||||
path: ResponsePath;
|
||||
@@ -297,7 +294,7 @@ export interface GraphQLField<TSource, TContext> {
|
||||
name: string;
|
||||
description: string;
|
||||
type: GraphQLOutputType;
|
||||
args: Array<GraphQLArgument>;
|
||||
args: GraphQLArgument[];
|
||||
resolve?: GraphQLFieldResolver<TSource, TContext>;
|
||||
isDeprecated?: boolean;
|
||||
deprecationReason?: string;
|
||||
@@ -345,15 +342,15 @@ export class GraphQLInterfaceType {
|
||||
}
|
||||
|
||||
export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
|
||||
name: string,
|
||||
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
|
||||
name: string;
|
||||
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
|
||||
/**
|
||||
* Optionally provide a custom type resolver function. If one is not provided,
|
||||
* the default implementation will call `isTypeOf` on each implementing
|
||||
* Object type.
|
||||
*/
|
||||
resolveType?: GraphQLTypeResolver<TSource, TContext>,
|
||||
description?: string
|
||||
resolveType?: GraphQLTypeResolver<TSource, TContext>;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,14 +383,14 @@ export class GraphQLUnionType {
|
||||
|
||||
constructor(config: GraphQLUnionTypeConfig<any, any>);
|
||||
|
||||
getTypes(): Array<GraphQLObjectType>;
|
||||
getTypes(): GraphQLObjectType[];
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface GraphQLUnionTypeConfig<TSource, TContext> {
|
||||
name: string,
|
||||
types: Thunk<Array<GraphQLObjectType>>,
|
||||
name: string;
|
||||
types: Thunk<GraphQLObjectType[]>;
|
||||
/**
|
||||
* Optionally provide a custom type resolver function. If one is not provided,
|
||||
* the default implementation will call `isTypeOf` on each implementing
|
||||
@@ -429,7 +426,7 @@ export class GraphQLEnumType {
|
||||
description: string;
|
||||
|
||||
constructor(config: GraphQLEnumTypeConfig);
|
||||
getValues(): Array<GraphQLEnumValue>;
|
||||
getValues(): GraphQLEnumValue[];
|
||||
getValue(name: string): GraphQLEnumValue;
|
||||
serialize(value: any): string;
|
||||
parseValue(value: any): any;
|
||||
|
||||
Vendored
+5
-6
@@ -3,7 +3,6 @@ import {
|
||||
GraphQLArgument
|
||||
} from './definition';
|
||||
|
||||
|
||||
export const DirectiveLocation: {
|
||||
// Operations
|
||||
QUERY: 'QUERY',
|
||||
@@ -27,7 +26,7 @@ export const DirectiveLocation: {
|
||||
INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION',
|
||||
};
|
||||
|
||||
export type DirectiveLocationEnum = any //$Keys<typeof DirectiveLocation>
|
||||
export type DirectiveLocationEnum = keyof typeof DirectiveLocation;
|
||||
|
||||
/**
|
||||
* Directives are used by the GraphQL runtime as a way of modifying execution
|
||||
@@ -36,8 +35,8 @@ export type DirectiveLocationEnum = any //$Keys<typeof DirectiveLocation>
|
||||
export class GraphQLDirective {
|
||||
name: string;
|
||||
description: string;
|
||||
locations: Array<DirectiveLocationEnum>;
|
||||
args: Array<GraphQLArgument>;
|
||||
locations: DirectiveLocationEnum[];
|
||||
args: GraphQLArgument[];
|
||||
|
||||
constructor(config: GraphQLDirectiveConfig);
|
||||
}
|
||||
@@ -45,7 +44,7 @@ export class GraphQLDirective {
|
||||
export interface GraphQLDirectiveConfig {
|
||||
name: string;
|
||||
description?: string;
|
||||
locations: Array<DirectiveLocationEnum>;
|
||||
locations: DirectiveLocationEnum[];
|
||||
args?: GraphQLFieldConfigArgumentMap;
|
||||
}
|
||||
|
||||
@@ -72,4 +71,4 @@ export const GraphQLDeprecatedDirective: GraphQLDirective;
|
||||
/**
|
||||
* The full list of specified directives.
|
||||
*/
|
||||
export const specifiedDirectives: Array<GraphQLDirective>;
|
||||
export const specifiedDirectives: GraphQLDirective[];
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ import {
|
||||
} from './definition';
|
||||
import { GraphQLField } from './definition';
|
||||
|
||||
|
||||
export const __Schema: GraphQLObjectType;
|
||||
export const __Directive: GraphQLObjectType;
|
||||
export const __DirectiveLocation: GraphQLEnumType;
|
||||
@@ -28,7 +27,7 @@ export const TypeKind: {
|
||||
INPUT_OBJECT: 'INPUT_OBJECT',
|
||||
LIST: 'LIST',
|
||||
NON_NULL: 'NON_NULL',
|
||||
}
|
||||
};
|
||||
|
||||
export const __TypeKind: GraphQLEnumType;
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,6 +1,5 @@
|
||||
import { GraphQLScalarType } from './definition';
|
||||
|
||||
|
||||
export const GraphQLInt: GraphQLScalarType;
|
||||
export const GraphQLFloat: GraphQLScalarType;
|
||||
export const GraphQLString: GraphQLScalarType;
|
||||
|
||||
Vendored
+4
-5
@@ -10,7 +10,6 @@ import {
|
||||
GraphQLDirective,
|
||||
} from './directives';
|
||||
|
||||
|
||||
/**
|
||||
* Schema Definition
|
||||
*
|
||||
@@ -53,14 +52,14 @@ export class GraphQLSchema {
|
||||
getSubscriptionType(): GraphQLObjectType|null|undefined;
|
||||
getTypeMap(): { [typeName: string]: GraphQLNamedType };
|
||||
getType(name: string): GraphQLType;
|
||||
getPossibleTypes(abstractType: GraphQLAbstractType): Array<GraphQLObjectType>;
|
||||
getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[];
|
||||
|
||||
isPossibleType(
|
||||
abstractType: GraphQLAbstractType,
|
||||
possibleType: GraphQLObjectType
|
||||
): boolean;
|
||||
|
||||
getDirectives(): Array<GraphQLDirective>;
|
||||
getDirectives(): GraphQLDirective[];
|
||||
getDirective(name: string): GraphQLDirective;
|
||||
}
|
||||
|
||||
@@ -68,6 +67,6 @@ export interface GraphQLSchemaConfig {
|
||||
query: GraphQLObjectType;
|
||||
mutation?: GraphQLObjectType;
|
||||
subscription?: GraphQLObjectType;
|
||||
types?: Array<GraphQLNamedType>;
|
||||
directives?: Array<GraphQLDirective>;
|
||||
types?: GraphQLNamedType[];
|
||||
directives?: GraphQLDirective[];
|
||||
}
|
||||
|
||||
+5
-7
@@ -36,10 +36,8 @@ export class TypeInfo {
|
||||
leave(node: ASTNode): any;
|
||||
}
|
||||
|
||||
export interface getFieldDef {
|
||||
(
|
||||
schema: GraphQLSchema,
|
||||
parentType: GraphQLType,
|
||||
fieldNode: FieldNode
|
||||
): GraphQLField<any, any>
|
||||
}
|
||||
export type getFieldDef = (
|
||||
schema: GraphQLSchema,
|
||||
parentType: GraphQLType,
|
||||
fieldNode: FieldNode,
|
||||
) => GraphQLField<any, any>;
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
// Helper to assert that provided names are valid.
|
||||
export function assertValidName(name: string): void;
|
||||
export function assertValidName(name: string): void;
|
||||
|
||||
+11
-8
@@ -1,12 +1,15 @@
|
||||
import {
|
||||
ValueNode,
|
||||
//IntValueNode,
|
||||
//FloatValueNode,
|
||||
//StringValueNode,
|
||||
//BooleanValueNode,
|
||||
//EnumValueNode,
|
||||
//ListValueNode,
|
||||
//ObjectValueNode,
|
||||
/*
|
||||
TODO:
|
||||
IntValueNode,
|
||||
FloatValueNode,
|
||||
StringValueNode,
|
||||
BooleanValueNode,
|
||||
EnumValueNode,
|
||||
ListValueNode,
|
||||
ObjectValueNode,
|
||||
*/
|
||||
} from '../language/ast';
|
||||
import { GraphQLInputType } from '../type/definition';
|
||||
|
||||
@@ -30,4 +33,4 @@ import { GraphQLInputType } from '../type/definition';
|
||||
export function astFromValue(
|
||||
value: any,
|
||||
type: GraphQLInputType
|
||||
): ValueNode // Warning: there is a code in bottom: throw new TypeError
|
||||
): ValueNode; // Warning: there is a code in bottom: throw new TypeError
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@ import { DocumentNode, Location } from '../language/ast';
|
||||
import { Source } from '../language/source';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
|
||||
|
||||
/**
|
||||
* This takes the ast of a schema document produced by the parse function in
|
||||
* src/language/parser.js.
|
||||
@@ -24,5 +23,5 @@ export function getDescription(node: { loc?: Location }): string;
|
||||
/**
|
||||
* A helper function to build a GraphQLSchema directly from a source
|
||||
* document.
|
||||
*/
|
||||
*/
|
||||
export function buildSchema(source: string | Source): GraphQLSchema;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { IntrospectionQuery } from './introspectionQuery';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
|
||||
|
||||
/**
|
||||
* Build a GraphQLSchema for use by client tools.
|
||||
*
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
import { DocumentNode } from '../language/ast';
|
||||
|
||||
|
||||
/**
|
||||
* Provided a collection of ASTs, presumably each from different files,
|
||||
* concatenate the ASTs together into batched AST, useful for validating many
|
||||
* GraphQL source files which together represent one conceptual application.
|
||||
*/
|
||||
export function concatAST(asts: Array<DocumentNode>): DocumentNode;
|
||||
export function concatAST(asts: DocumentNode[]): DocumentNode;
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
import { DocumentNode } from '../language/ast';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
|
||||
|
||||
/**
|
||||
* Produces a new schema given an existing schema and a document which may
|
||||
* contain GraphQL type extensions and definitions. The original schema will
|
||||
|
||||
+10
-10
@@ -10,7 +10,6 @@ import {
|
||||
} from '../type/definition';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
|
||||
|
||||
export const BreakingChangeType: {
|
||||
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND',
|
||||
FIELD_REMOVED: 'FIELD_REMOVED',
|
||||
@@ -20,17 +19,18 @@ export const BreakingChangeType: {
|
||||
VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM',
|
||||
};
|
||||
|
||||
export type BreakingChangeKey = 'FIELD_CHANGED_KIND'
|
||||
export type BreakingChangeKey =
|
||||
| 'FIELD_CHANGED_KIND'
|
||||
| 'FIELD_REMOVED'
|
||||
| 'TYPE_CHANGED_KIND'
|
||||
| 'TYPE_REMOVED'
|
||||
| 'TYPE_REMOVED_FROM_UNION'
|
||||
| 'VALUE_REMOVED_FROM_ENUM';
|
||||
|
||||
export type BreakingChange = {
|
||||
export interface BreakingChange {
|
||||
type: BreakingChangeKey;
|
||||
description: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of all the types
|
||||
@@ -39,7 +39,7 @@ export type BreakingChange = {
|
||||
export function findBreakingChanges(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>
|
||||
): BreakingChange[];
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of any breaking
|
||||
@@ -48,7 +48,7 @@ export function findBreakingChanges(
|
||||
export function findRemovedTypes(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>
|
||||
): BreakingChange[];
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of any breaking
|
||||
@@ -57,7 +57,7 @@ export function findRemovedTypes(
|
||||
export function findTypesThatChangedKind(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>
|
||||
): BreakingChange[];
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of any breaking
|
||||
@@ -67,7 +67,7 @@ export function findTypesThatChangedKind(
|
||||
export function findFieldsThatChangedType(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>;
|
||||
): BreakingChange[];
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of any breaking
|
||||
@@ -76,7 +76,7 @@ export function findFieldsThatChangedType(
|
||||
export function findTypesRemovedFromUnions(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>;
|
||||
): BreakingChange[];
|
||||
|
||||
/**
|
||||
* Given two schemas, returns an Array containing descriptions of any breaking
|
||||
@@ -85,4 +85,4 @@ export function findTypesRemovedFromUnions(
|
||||
export function findValuesRemovedFromEnums(
|
||||
oldSchema: GraphQLSchema,
|
||||
newSchema: GraphQLSchema
|
||||
): Array<BreakingChange>;
|
||||
): BreakingChange[];
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ import { GraphQLError } from '../error/GraphQLError';
|
||||
export function findDeprecatedUsages(
|
||||
schema: GraphQLSchema,
|
||||
ast: DocumentNode
|
||||
): Array<GraphQLError>
|
||||
): GraphQLError[];
|
||||
|
||||
+22
-23
@@ -95,26 +95,25 @@ fragment TypeRef on __Type {
|
||||
*/
|
||||
export const introspectionQuery: string;
|
||||
|
||||
|
||||
export interface IntrospectionQuery {
|
||||
__schema: IntrospectionSchema
|
||||
__schema: IntrospectionSchema;
|
||||
}
|
||||
|
||||
export interface IntrospectionSchema {
|
||||
queryType: IntrospectionNamedTypeRef;
|
||||
mutationType?: IntrospectionNamedTypeRef;
|
||||
subscriptionType?: IntrospectionNamedTypeRef;
|
||||
types: Array<IntrospectionType>;
|
||||
directives: Array<IntrospectionDirective>;
|
||||
types: IntrospectionType[];
|
||||
directives: IntrospectionDirective[];
|
||||
}
|
||||
|
||||
export type IntrospectionType =
|
||||
IntrospectionScalarType |
|
||||
IntrospectionObjectType |
|
||||
IntrospectionInterfaceType |
|
||||
IntrospectionUnionType |
|
||||
IntrospectionEnumType |
|
||||
IntrospectionInputObjectType;
|
||||
| IntrospectionScalarType
|
||||
| IntrospectionObjectType
|
||||
| IntrospectionInterfaceType
|
||||
| IntrospectionUnionType
|
||||
| IntrospectionEnumType
|
||||
| IntrospectionInputObjectType;
|
||||
|
||||
export interface IntrospectionScalarType {
|
||||
kind: 'SCALAR';
|
||||
@@ -126,43 +125,43 @@ export interface IntrospectionObjectType {
|
||||
kind: 'OBJECT';
|
||||
name: string;
|
||||
description?: string;
|
||||
fields: Array<IntrospectionField>;
|
||||
interfaces: Array<IntrospectionNamedTypeRef>;
|
||||
fields: IntrospectionField[];
|
||||
interfaces: IntrospectionNamedTypeRef[];
|
||||
}
|
||||
|
||||
export interface IntrospectionInterfaceType {
|
||||
kind: 'INTERFACE';
|
||||
name: string;
|
||||
description?: string;
|
||||
fields: Array<IntrospectionField>;
|
||||
possibleTypes: Array<IntrospectionNamedTypeRef>;
|
||||
fields: IntrospectionField[];
|
||||
possibleTypes: IntrospectionNamedTypeRef[];
|
||||
}
|
||||
|
||||
export interface IntrospectionUnionType {
|
||||
kind: 'UNION';
|
||||
name: string;
|
||||
description?: string;
|
||||
possibleTypes: Array<IntrospectionNamedTypeRef>;
|
||||
possibleTypes: IntrospectionNamedTypeRef[];
|
||||
}
|
||||
|
||||
export interface IntrospectionEnumType {
|
||||
kind: 'ENUM';
|
||||
name: string;
|
||||
description?: string;
|
||||
enumValues: Array<IntrospectionEnumValue>;
|
||||
enumValues: IntrospectionEnumValue[];
|
||||
}
|
||||
|
||||
export interface IntrospectionInputObjectType {
|
||||
kind: 'INPUT_OBJECT';
|
||||
name: string;
|
||||
description?: string;
|
||||
inputFields: Array<IntrospectionInputValue>;
|
||||
inputFields: IntrospectionInputValue[];
|
||||
}
|
||||
|
||||
export type IntrospectionTypeRef =
|
||||
IntrospectionNamedTypeRef |
|
||||
IntrospectionListTypeRef |
|
||||
IntrospectionNonNullTypeRef
|
||||
| IntrospectionNamedTypeRef
|
||||
| IntrospectionListTypeRef
|
||||
| IntrospectionNonNullTypeRef;
|
||||
|
||||
export interface IntrospectionNamedTypeRef {
|
||||
kind: string;
|
||||
@@ -182,7 +181,7 @@ export interface IntrospectionNonNullTypeRef {
|
||||
export interface IntrospectionField {
|
||||
name: string;
|
||||
description?: string;
|
||||
args: Array<IntrospectionInputValue>;
|
||||
args: IntrospectionInputValue[];
|
||||
type: IntrospectionTypeRef;
|
||||
isDeprecated: boolean;
|
||||
deprecationReason?: string;
|
||||
@@ -205,6 +204,6 @@ export interface IntrospectionEnumValue {
|
||||
export interface IntrospectionDirective {
|
||||
name: string;
|
||||
description?: string;
|
||||
locations: Array<DirectiveLocationEnum>;
|
||||
args: Array<IntrospectionInputValue>;
|
||||
locations: DirectiveLocationEnum[];
|
||||
args: IntrospectionInputValue[];
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ import { GraphQLInputType } from '../type/definition';
|
||||
export function isValidJSValue(
|
||||
value: any,
|
||||
type: GraphQLInputType
|
||||
): Array<string>
|
||||
): string[];
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ import { GraphQLInputType } from '../type/definition';
|
||||
export function isValidLiteralValue(
|
||||
type: GraphQLInputType,
|
||||
valueNode: ValueNode
|
||||
): Array<string>
|
||||
): string[];
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ import {
|
||||
|
||||
export function separateOperations(
|
||||
documentAST: DocumentNode
|
||||
): { [operationName: string]: DocumentNode }
|
||||
): { [operationName: string]: DocumentNode };
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
GraphQLSchema
|
||||
} from '../type/schema';
|
||||
|
||||
|
||||
/**
|
||||
* Provided two types, return true if the types are equal (invariant).
|
||||
*/
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ import { GraphQLSchema } from '../type/schema';
|
||||
export function typeFromAST(
|
||||
schema: GraphQLSchema,
|
||||
typeNode: TypeNode
|
||||
): GraphQLType
|
||||
): GraphQLType;
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ import {
|
||||
ObjectValueNode
|
||||
} from '../language/ast';
|
||||
|
||||
|
||||
export function valueFromAST(
|
||||
valueNode: ValueNode,
|
||||
type: GraphQLInputType,
|
||||
|
||||
+12
-15
@@ -19,9 +19,6 @@ import { GraphQLDirective } from '../type/directives';
|
||||
import { TypeInfo } from '../utilities/TypeInfo';
|
||||
import { specifiedRules } from './specifiedRules';
|
||||
|
||||
|
||||
//type ValidationRule = (context: ValidationContext) => any;
|
||||
|
||||
/**
|
||||
* Implements the "Validation" section of the spec.
|
||||
*
|
||||
@@ -38,8 +35,8 @@ import { specifiedRules } from './specifiedRules';
|
||||
export function validate(
|
||||
schema: GraphQLSchema,
|
||||
ast: DocumentNode,
|
||||
rules?: Array<any>
|
||||
): Array<GraphQLError>;
|
||||
rules?: any[]
|
||||
): GraphQLError[];
|
||||
|
||||
/**
|
||||
* This uses a specialized visitor which runs multiple visitors in parallel,
|
||||
@@ -51,13 +48,13 @@ export function visitUsingRules(
|
||||
schema: GraphQLSchema,
|
||||
typeInfo: TypeInfo,
|
||||
documentAST: DocumentNode,
|
||||
rules: Array<any>
|
||||
): Array<GraphQLError>;
|
||||
rules: any[]
|
||||
): GraphQLError[];
|
||||
|
||||
export type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
|
||||
export interface VariableUsage {
|
||||
node: VariableNode,
|
||||
type: GraphQLInputType
|
||||
node: VariableNode;
|
||||
type: GraphQLInputType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +66,7 @@ export class ValidationContext {
|
||||
constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo);
|
||||
reportError(error: GraphQLError): void;
|
||||
|
||||
getErrors(): Array<GraphQLError>;
|
||||
getErrors(): GraphQLError[];
|
||||
|
||||
getSchema(): GraphQLSchema;
|
||||
|
||||
@@ -77,17 +74,17 @@ export class ValidationContext {
|
||||
|
||||
getFragment(name: string): FragmentDefinitionNode;
|
||||
|
||||
getFragmentSpreads(node: SelectionSetNode): Array<FragmentSpreadNode>;
|
||||
getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[];
|
||||
|
||||
getRecursivelyReferencedFragments(
|
||||
operation: OperationDefinitionNode
|
||||
): Array<FragmentDefinitionNode>;
|
||||
): FragmentDefinitionNode[];
|
||||
|
||||
getVariableUsages(node: NodeWithSelectionSet): Array<VariableUsage>;
|
||||
getVariableUsages(node: NodeWithSelectionSet): VariableUsage[];
|
||||
|
||||
getRecursiveVariableUsages(
|
||||
operation: OperationDefinitionNode
|
||||
): Array<VariableUsage>;
|
||||
): VariableUsage[];
|
||||
|
||||
getType(): GraphQLOutputType;
|
||||
|
||||
@@ -100,4 +97,4 @@ export class ValidationContext {
|
||||
getDirective(): GraphQLDirective;
|
||||
|
||||
getArgument(): GraphQLArgument;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user