graphql

Search for an npm package

graphql

module "graphql" {

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: Readonly<{
major: number;
minor: number;
patch: number;
preReleaseTag: string | null;
}> = ...

This is the primary entry point function for fulfilling GraphQL operations by parsing, validating, and executing a GraphQL document along side a GraphQL schema.

more
less

More sophisticated GraphQL servers, such as those which persist queries, may wish to separate the validation and execution phases to a static time tooling step, and a server runtime step.

Accepts either an object with named arguments, or individual arguments:

schema: The GraphQL type system to use when validating and executing a query. source: A GraphQL language formatted string representing the requested operation. rootValue: The value provided as the first argument to resolver functions on the top level type (e.g. the query object type). contextValue: The context value is provided as an argument to resolver functions after field arguments. It is used to pass shared information useful at any point during executing this query, for example the currently logged in user and connections to databases or other services. variableValues: A mapping of variable name to runtime value to use for all variables defined in the requestString. operationName: The name of the operation to use if requestString contains multiple possible operations. Can be omitted if requestString contains only one operation. fieldResolver: A resolver function to use when one is not provided by the schema. If not provided, the default field resolver is used (which looks for a value or method on the source value with the field's name). typeResolver: A type resolver function to use when none is provided by the schema. If not provided, the default type resolver is used (which looks for a __typename field or alternatively calls the isTypeOf method).

export interface GraphQLArgs {
schema: GraphQLSchema;
source: string | Source;
rootValue?: unknown;
contextValue?: unknown;
variableValues?: Maybe<{
readonly [key: string]: unknown;
}>;
operationName?: Maybe<string>;
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
}
Referenced by
Unexported symbols referenced here

Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/

type Maybe<T> = null | undefined | T
Referenced by
export function graphql(args: GraphQLArgs): Promise<ExecutionResult>

The graphqlSync function also fulfills GraphQL operations by parsing, validating, and executing a GraphQL document along side a GraphQL schema. However, it guarantees to complete synchronously (or throw an error) assuming that all field resolvers are also synchronous.

export function graphqlSync(args: GraphQLArgs): ExecutionResult
export function resolveReadonlyArrayThunk<T>(thunk: ThunkReadonlyArray<T>): readonly T[]

Schema Definition

more
less

A Schema is created by supplying the root types of each type of operation, query and mutation (optional). A schema definition is then supplied to the validator and executor.

Example:

const MyAppSchema = new GraphQLSchema({
query: MyAppQueryRootType,
mutation: MyAppMutationRootType,
})

Note: When the schema is constructed, by default only the types that are reachable by traversing the root types are included, other types must be explicitly referenced.

Example:

const characterInterface = new GraphQLInterfaceType({
name: 'Character',
...
});
const humanType = new GraphQLObjectType({
name: 'Human',
interfaces: [characterInterface],
...
});
const droidType = new GraphQLObjectType({
name: 'Droid',
interfaces: [characterInterface],
...
});
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
hero: { type: characterInterface, ... },
}
}),
...
// Since this schema references only the `Character` interface it's
// necessary to explicitly list the types that implement it if
// you want them to be included in the final schema.
types: [humanType, droidType],
})

Note: If an array of directives are provided to GraphQLSchema, that will be the exact list of directives represented and allowed. If directives is not provided then a default set of the specified directives (e.g. @include and @skip) will be used. If you wish to provide additional directives to these specified directives, you must explicitly declare them. Example:

const MyAppSchema = new GraphQLSchema({
...
directives: specifiedDirectives.concat([ myCustomDirective ]),
})
export class GraphQLSchema {
constructor(config: Readonly<GraphQLSchemaConfig>)
description: Maybe<string>;
extensions: Readonly<GraphQLSchemaExtensions>;
extensionASTNodes: readonly SchemaExtensionNode[];
__validationErrors: Maybe<readonly GraphQLError[]>;
get [Symbol.toStringTag](): string;
getQueryType(): Maybe<GraphQLObjectType>;
getMutationType(): Maybe<GraphQLObjectType>;
getSubscriptionType(): Maybe<GraphQLObjectType>;
getRootType(operation: OperationTypeNode): Maybe<GraphQLObjectType>;
getTypeMap(): TypeMap;
getType(name: string): GraphQLNamedType | undefined;
getPossibleTypes(abstractType: GraphQLAbstractType): readonly GraphQLObjectType[];
getImplementations(interfaceType: GraphQLInterfaceType): {
objects: readonly GraphQLObjectType[];
interfaces: readonly GraphQLInterfaceType[];
};
isSubType(abstractType: GraphQLAbstractType, maybeSubType: GraphQLObjectType | GraphQLInterfaceType): boolean;
getDirectives(): readonly GraphQLDirective[];
getDirective(name: string): Maybe<GraphQLDirective>;
}
Referenced by
Unexported symbols referenced here

@internal —

interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig {
description: Maybe<string>;
types: readonly GraphQLNamedType[];
directives: readonly GraphQLDirective[];
extensions: Readonly<GraphQLSchemaExtensions>;
extensionASTNodes: readonly SchemaExtensionNode[];
assumeValid: boolean;
}
Referenced by

Directives are used by the GraphQL runtime as a way of modifying execution behavior. Type system creators will usually not create these directly.

export class GraphQLDirective {
constructor(config: Readonly<GraphQLDirectiveConfig>)
name: string;
description: Maybe<string>;
locations: readonly DirectiveLocation[];
args: readonly GraphQLArgument[];
isRepeatable: boolean;
extensions: Readonly<GraphQLDirectiveExtensions>;
get [Symbol.toStringTag](): string;
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
isRepeatable: boolean;
extensions: Readonly<GraphQLDirectiveExtensions>;
}
Referenced by

Scalar Type Definition

more
less

The leaf values of any request and input values to arguments are Scalars (or Enums) and are defined with a name and a series of functions used to parse input from ast or variables and to ensure validity.

If a type's serialize function returns null or does not return a value (i.e. it returns undefined) then an error will be raised and a null value will be returned in the response. It is always better to validate

Example:

const OddType = new GraphQLScalarType({
name: 'Odd',
serialize(value) {
if (!Number.isFinite(value)) {
throw new Error(
`Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
);
}
if (value % 2 === 0) {
throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
}
return value;
}
});
export class GraphQLScalarType<TInternal = unknown, TExternal = TInternal> {
constructor(config: Readonly<GraphQLScalarTypeConfig<TInternal, TExternal>>)
name: string;
description: Maybe<string>;
specifiedByURL: Maybe<string>;
serialize: GraphQLScalarSerializer<TExternal>;
parseValue: GraphQLScalarValueParser<TInternal>;
parseLiteral: GraphQLScalarLiteralParser<TInternal>;
extensions: Readonly<GraphQLScalarTypeExtensions>;
extensionASTNodes: readonly ScalarTypeExtensionNode[];
get [Symbol.toStringTag](): string;
toConfig(): GraphQLScalarTypeNormalizedConfig<TInternal, TExternal>;
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLScalarTypeNormalizedConfig<TInternal, TExternal> extends GraphQLScalarTypeConfig<TInternal, TExternal> {
serialize: GraphQLScalarSerializer<TExternal>;
parseValue: GraphQLScalarValueParser<TInternal>;
parseLiteral: GraphQLScalarLiteralParser<TInternal>;
extensions: Readonly<GraphQLScalarTypeExtensions>;
extensionASTNodes: readonly ScalarTypeExtensionNode[];
}
Referenced by

Object Type Definition

more
less

Almost all of the GraphQL types you define will be object types. Object types have a name, but most importantly describe their fields.

Example:

const AddressType = new GraphQLObjectType({
name: 'Address',
fields: {
street: { type: GraphQLString },
number: { type: GraphQLInt },
formatted: {
type: GraphQLString,
resolve(obj) {
return obj.number + ' ' + obj.street
}
}
}
});

When two types need to refer to each other, or a type needs to refer to itself in a field, you can use a function expression (aka a closure or a thunk) to supply the fields lazily.

Example:

const PersonType = new GraphQLObjectType({
name: 'Person',
fields: () => ({
name: { type: GraphQLString },
bestFriend: { type: PersonType },
})
});
export class GraphQLObjectType<TSource = any, TContext = any> {
constructor(config: Readonly<GraphQLObjectTypeConfig<TSource, TContext>>)
name: string;
description: Maybe<string>;
isTypeOf: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
extensions: Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>;
extensionASTNodes: readonly ObjectTypeExtensionNode[];
get [Symbol.toStringTag](): string;
getFields(): GraphQLFieldMap<TSource, TContext>;
getInterfaces(): readonly GraphQLInterfaceType[];
toConfig(): GraphQLObjectTypeNormalizedConfig<TSource, TContext>;
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLObjectTypeNormalizedConfig<TSource, TContext> extends GraphQLObjectTypeConfig<any, any> {
interfaces: readonly GraphQLInterfaceType[];
fields: GraphQLFieldConfigMap<any, any>;
extensions: Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>;
extensionASTNodes: readonly ObjectTypeExtensionNode[];
}
Referenced by

Interface Type Definition

more
less

When a field can return one of a heterogeneous set of types, a Interface type is used to describe what types are possible, what fields are in common across all types, as well as a function to determine which type is actually used when the field is resolved.

Example:

const EntityType = new GraphQLInterfaceType({
name: 'Entity',
fields: {
name: { type: GraphQLString }
}
});
export class GraphQLInterfaceType {
constructor(config: Readonly<GraphQLInterfaceTypeConfig<any, any>>)
name: string;
description: Maybe<string>;
resolveType: Maybe<GraphQLTypeResolver<any, any>>;
extensions: Readonly<GraphQLInterfaceTypeExtensions>;
extensionASTNodes: readonly InterfaceTypeExtensionNode[];
get [Symbol.toStringTag](): string;
getFields(): GraphQLFieldMap<any, any>;
getInterfaces(): readonly GraphQLInterfaceType[];
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLInterfaceTypeNormalizedConfig extends GraphQLInterfaceTypeConfig<any, any> {
interfaces: readonly GraphQLInterfaceType[];
fields: GraphQLFieldConfigMap<any, any>;
extensions: Readonly<GraphQLInterfaceTypeExtensions>;
extensionASTNodes: readonly InterfaceTypeExtensionNode[];
}
Referenced by

Union Type Definition

more
less

When a field can return one of a heterogeneous set of types, a Union type is used to describe what types are possible as well as providing a function to determine which type is actually used when the field is resolved.

Example:

const PetType = new GraphQLUnionType({
name: 'Pet',
types: [ DogType, CatType ],
resolveType(value) {
if (value instanceof Dog) {
return DogType;
}
if (value instanceof Cat) {
return CatType;
}
}
});
export class GraphQLUnionType {
constructor(config: Readonly<GraphQLUnionTypeConfig<any, any>>)
name: string;
description: Maybe<string>;
resolveType: Maybe<GraphQLTypeResolver<any, any>>;
extensions: Readonly<GraphQLUnionTypeExtensions>;
extensionASTNodes: readonly UnionTypeExtensionNode[];
get [Symbol.toStringTag](): string;
getTypes(): readonly GraphQLObjectType[];
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLUnionTypeNormalizedConfig extends GraphQLUnionTypeConfig<any, any> {
types: readonly GraphQLObjectType[];
extensions: Readonly<GraphQLUnionTypeExtensions>;
extensionASTNodes: readonly UnionTypeExtensionNode[];
}
Referenced by

Enum Type Definition

more
less

Some leaf values of requests and input values are Enums. GraphQL serializes Enum values as strings, however internally Enums can be represented by any kind of type, often integers.

Example:

const RGBType = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 }
}
});

Note: If a value is not provided in a definition, the name of the enum value will be used as its internal value.

export class GraphQLEnumType {
constructor(config: Readonly<GraphQLEnumTypeConfig>)
name: string;
description: Maybe<string>;
extensions: Readonly<GraphQLEnumTypeExtensions>;
extensionASTNodes: readonly EnumTypeExtensionNode[];
get [Symbol.toStringTag](): string;
getValues(): readonly GraphQLEnumValue[];
getValue(name: string): Maybe<GraphQLEnumValue>;
serialize(outputValue: unknown): Maybe<string>;
parseValue(inputValue: unknown): Maybe<any>;
parseLiteral(valueNode: ValueNode, _variables: Maybe<ObjMap<unknown>>): Maybe<any>;
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLEnumTypeNormalizedConfig extends GraphQLEnumTypeConfig {
extensions: Readonly<GraphQLEnumTypeExtensions>;
extensionASTNodes: readonly EnumTypeExtensionNode[];
}
Referenced by

Input Object Type Definition

more
less

An input object defines a structured collection of fields which may be supplied to a field argument.

Using NonNull will ensure that a value must be provided by the query

Example:

const GeoPoint = new GraphQLInputObjectType({
name: 'GeoPoint',
fields: {
lat: { type: new GraphQLNonNull(GraphQLFloat) },
lon: { type: new GraphQLNonNull(GraphQLFloat) },
alt: { type: GraphQLFloat, defaultValue: 0 },
}
});
export class GraphQLInputObjectType {
constructor(config: Readonly<GraphQLInputObjectTypeConfig>)
name: string;
description: Maybe<string>;
extensions: Readonly<GraphQLInputObjectTypeExtensions>;
extensionASTNodes: readonly InputObjectTypeExtensionNode[];
get [Symbol.toStringTag](): string;
getFields(): GraphQLInputFieldMap;
toString(): string;
toJSON(): string;
}
Referenced by
Unexported symbols referenced here
interface GraphQLInputObjectTypeNormalizedConfig extends GraphQLInputObjectTypeConfig {
extensions: Readonly<GraphQLInputObjectTypeExtensions>;
extensionASTNodes: readonly InputObjectTypeExtensionNode[];
}
Referenced by

List Type Wrapper

more
less

A list is a wrapping type which points to another type. Lists are often created within the context of defining the fields of an object type.

Example:

const PersonType = new GraphQLObjectType({
name: 'Person',
fields: () => ({
parents: { type: new GraphQLList(PersonType) },
children: { type: new GraphQLList(PersonType) },
})
})
export class GraphQLList<T extends GraphQLType> {
constructor(ofType: T)
readonly ofType: T;
get [Symbol.toStringTag](): string;
toString(): string;
toJSON(): string;
}
Referenced by

Non-Null Type Wrapper

more
less

A non-null is a wrapping type which points to another type. Non-null types enforce that their values are never null and can ensure an error is raised if this ever occurs during a request. It is useful for fields which you can make a strong guarantee on non-nullability, for example usually the id field of a database row will never be null.

Example:

const RowType = new GraphQLObjectType({
name: 'Row',
fields: () => ({
id: { type: new GraphQLNonNull(GraphQLString) },
})
})

Note: the enforcement of non-nullability occurs within the executor.

export class GraphQLNonNull<T extends GraphQLNullableType> {
constructor(ofType: T)
readonly ofType: T;
get [Symbol.toStringTag](): string;
toString(): string;
toJSON(): string;
}
Referenced by
export const specifiedScalarTypes: readonly GraphQLScalarType[] = ...
export const GraphQLInt: GraphQLScalarType<number, number> = ...
export const GraphQLFloat: GraphQLScalarType<number, number> = ...
export const GraphQLString: GraphQLScalarType<string, string> = ...
export const GraphQLBoolean: GraphQLScalarType<boolean, boolean> = ...
export const GraphQLID: GraphQLScalarType<string, string> = ...

Maximum possible Int value as per GraphQL Spec (32-bit signed integer). n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1

export const GRAPHQL_MAX_INT: 2147483647 = ...

Minimum possible Int value as per GraphQL Spec (32-bit signed integer). n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)

export const GRAPHQL_MIN_INT: -2147483648 = ...

The full list of specified directives.

export const specifiedDirectives: readonly GraphQLDirective[] = ...

Used to conditionally include fields or fragments.

export const GraphQLIncludeDirective: GraphQLDirective = ...

Used to conditionally skip (exclude) fields or fragments.

export const GraphQLSkipDirective: GraphQLDirective = ...

Used to declare element of a GraphQL schema as deprecated.

export const GraphQLDeprecatedDirective: GraphQLDirective = ...

Used to provide a URL for specifying the behavior of custom scalar definitions.

export const GraphQLSpecifiedByDirective: GraphQLDirective = ...
export enum TypeKind {
SCALAR = "SCALAR",
OBJECT = "OBJECT",
INTERFACE = "INTERFACE",
UNION = "UNION",
ENUM = "ENUM",
INPUT_OBJECT = "INPUT_OBJECT",
LIST = "LIST",
NON_NULL = "NON_NULL"
}

Constant string used for default reason for a deprecation.

export const DEFAULT_DEPRECATION_REASON: "No longer supported" = ...
export const introspectionTypes: readonly GraphQLNamedType[] = ...
export const __Schema: GraphQLObjectType = ...
export const __Directive: GraphQLObjectType = ...
export const __DirectiveLocation: GraphQLEnumType = ...
export const __Type: GraphQLObjectType = ...
export const __Field: GraphQLObjectType = ...
export const __InputValue: GraphQLObjectType = ...
export const __EnumValue: GraphQLObjectType = ...
export const __TypeKind: GraphQLEnumType = ...

Note that these are GraphQLField and not GraphQLFieldConfig, so the format for args is different.

export const SchemaMetaFieldDef: GraphQLField<unknown, unknown> = ...
export const TypeMetaFieldDef: GraphQLField<unknown, unknown> = ...
export const TypeNameMetaFieldDef: GraphQLField<unknown, unknown> = ...

Test if the given value is a GraphQL schema.

export function isSchema(schema: unknown): schema is GraphQLSchema

Test if the given value is a GraphQL directive.

export function isDirective(directive: unknown): directive is GraphQLDirective
export function isType(type: unknown): type is GraphQLType

There are predicates for each kind of GraphQL type.

export function isScalarType(type: unknown): type is GraphQLScalarType
export function isObjectType(type: unknown): type is GraphQLObjectType
export function isInterfaceType(type: unknown): type is GraphQLInterfaceType
export function isUnionType(type: unknown): type is GraphQLUnionType
export function isEnumType(type: unknown): type is GraphQLEnumType
export function isInputObjectType(type: unknown): type is GraphQLInputObjectType
export function isListType(type: GraphQLInputType): type is GraphQLList<GraphQLInputType>
export function isListType(type: GraphQLOutputType): type is GraphQLList<GraphQLOutputType>
export function isListType(type: unknown): type is GraphQLList<GraphQLType>
export function isNonNullType(type: GraphQLInputType): type is GraphQLNonNull<GraphQLInputType>
export function isNonNullType(type: GraphQLOutputType): type is GraphQLNonNull<GraphQLOutputType>
export function isNonNullType(type: unknown): type is GraphQLNonNull<GraphQLType>
export function isInputType(type: unknown): type is GraphQLInputType
export function isOutputType(type: unknown): type is GraphQLOutputType
export function isLeafType(type: unknown): type is GraphQLLeafType
export function isCompositeType(type: unknown): type is GraphQLCompositeType
export function isAbstractType(type: unknown): type is GraphQLAbstractType
export function isWrappingType(type: unknown): type is GraphQLWrappingType
export function isNullableType(type: unknown): type is GraphQLNullableType
export function isNamedType(type: unknown): type is GraphQLNamedType
export function isRequiredArgument(arg: GraphQLArgument): boolean
export function isRequiredInputField(field: GraphQLInputField): boolean
export function isSpecifiedScalarType(type: GraphQLNamedType): boolean
export function isIntrospectionType(type: GraphQLNamedType): boolean
export function isSpecifiedDirective(directive: GraphQLDirective): boolean
export function assertSchema(schema: unknown): GraphQLSchema
export function assertDirective(directive: unknown): GraphQLDirective
export function assertType(type: unknown): GraphQLType
export function assertScalarType(type: unknown): GraphQLScalarType
export function assertObjectType(type: unknown): GraphQLObjectType
export function assertInterfaceType(type: unknown): GraphQLInterfaceType
export function assertUnionType(type: unknown): GraphQLUnionType
export function assertEnumType(type: unknown): GraphQLEnumType
export function assertInputObjectType(type: unknown): GraphQLInputObjectType
export function assertListType(type: unknown): GraphQLList<GraphQLType>
export function assertNonNullType(type: unknown): GraphQLNonNull<GraphQLType>
export function assertInputType(type: unknown): GraphQLInputType
export function assertOutputType(type: unknown): GraphQLOutputType
export function assertLeafType(type: unknown): GraphQLLeafType
export function assertCompositeType(type: unknown): GraphQLCompositeType
export function assertAbstractType(type: unknown): GraphQLAbstractType
export function assertWrappingType(type: unknown): GraphQLWrappingType
export function assertNullableType(type: unknown): GraphQLNullableType
export function assertNamedType(type: unknown): GraphQLNamedType
export function getNullableType(type: undefined | null): void
export function getNullableType<T extends GraphQLNullableType>(type: T | GraphQLNonNull<T>): T
export function getNullableType(type: Maybe<GraphQLType>): GraphQLNullableType | undefined
export function getNamedType(type: undefined | null): void
export function getNamedType(type: GraphQLInputType): GraphQLNamedInputType
export function getNamedType(type: GraphQLOutputType): GraphQLNamedOutputType
export function getNamedType(type: GraphQLType): GraphQLNamedType
export function getNamedType(type: Maybe<GraphQLType>): GraphQLNamedType | undefined

Implements the "Type Validation" sub-sections of the specification's "Type System" section.

more
less

Validation runs synchronously, returning an array of encountered errors, or an empty array if no errors were encountered and the Schema is valid.

export function validateSchema(schema: GraphQLSchema): readonly GraphQLError[]

Utility function which asserts a schema is valid by throwing an error if it is invalid.

export function assertValidSchema(schema: GraphQLSchema): void

Upholds the spec rules about naming.

export function assertName(name: string): string

Upholds the spec rules about naming enum values.

more
less

@internal —

export function assertEnumValueName(name: string): string

These types may describe types which may be leaf values.

export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType
Referenced by

These types may describe the parent context of a selection set.

export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType
Referenced by

These types may describe the parent context of a selection set.

export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType
Referenced by

These types wrap and modify other types

export type GraphQLWrappingType = GraphQLList<GraphQLType> | GraphQLNonNull<GraphQLType>
Referenced by

Used while defining GraphQL types to allow for circular references in otherwise immutable type definitions.

export type ThunkReadonlyArray<T> = (() => readonly T[]) | readonly T[]
Referenced by
export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {
description?: Maybe<string>;
subscription?: Maybe<GraphQLObjectType>;
types?: Maybe<readonly GraphQLNamedType[]>;
directives?: Maybe<readonly GraphQLDirective[]>;
extensions?: Maybe<Readonly<GraphQLSchemaExtensions>>;
extensionASTNodes?: Maybe<readonly SchemaExtensionNode[]>;
}
Referenced by
Unexported symbols referenced here
interface GraphQLSchemaValidationOptions {

When building a schema from a GraphQL service's introspection result, it might be safe to assume the schema is valid. Set to true to assume the produced schema is valid.

more
less

Default: false

assumeValid?: boolean;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLSchemaExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLDirectiveConfig {
name: string;
description?: Maybe<string>;
locations: readonly DirectiveLocation[];
isRepeatable?: Maybe<boolean>;
extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLDirectiveExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLArgument {
name: string;
description: Maybe<string>;
defaultValue: unknown;
deprecationReason: Maybe<string>;
extensions: Readonly<GraphQLArgumentExtensions>;
}
Referenced by
export interface GraphQLArgumentConfig {
description?: Maybe<string>;
defaultValue?: unknown;
deprecationReason?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLArgumentExtensions>>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLArgumentExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLEnumTypeConfig {
name: string;
description?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLEnumTypeExtensions>>;
extensionASTNodes?: Maybe<readonly EnumTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLEnumTypeExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLEnumValue {
name: string;
description: Maybe<string>;
value: any;
deprecationReason: Maybe<string>;
extensions: Readonly<GraphQLEnumValueExtensions>;
}
Referenced by
export interface GraphQLEnumValueConfig {
description?: Maybe<string>;
value?: any;
deprecationReason?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLEnumValueExtensions>>;
}
Referenced by
export type GraphQLEnumValueConfigMap = ObjMap<GraphQLEnumValueConfig>
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLEnumValueExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLField<TSource, TContext, TArgs = any> {
name: string;
description: Maybe<string>;
args: readonly GraphQLArgument[];
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
deprecationReason: Maybe<string>;
extensions: Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>;
}
Referenced by
export interface GraphQLFieldConfig<TSource, TContext, TArgs = any> {
description?: Maybe<string>;
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
deprecationReason?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>>;
}
Referenced by
export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<GraphQLFieldConfig<TSource, TContext>>
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

We've provided these template arguments because this is an open type and you may find them useful.

export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> {
[key: string]: unknown;
}
Referenced by
export type GraphQLFieldMap<TSource, TContext> = ObjMap<GraphQLField<TSource, TContext>>
Referenced by
export type GraphQLFieldResolver<TSource, TContext, TArgs = any, TResult = unknown> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult
Referenced by
export interface GraphQLInputField {
name: string;
description: Maybe<string>;
defaultValue: unknown;
deprecationReason: Maybe<string>;
extensions: Readonly<GraphQLInputFieldExtensions>;
}
Referenced by
export interface GraphQLInputFieldConfig {
description?: Maybe<string>;
defaultValue?: unknown;
deprecationReason?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLInputFieldExtensions>>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLInputFieldExtensions {
[key: string]: unknown;
}
Referenced by
export type GraphQLInputFieldMap = ObjMap<GraphQLInputField>
Referenced by
export interface GraphQLInputObjectTypeConfig {
name: string;
description?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLInputObjectTypeExtensions>>;
extensionASTNodes?: Maybe<readonly InputObjectTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLInputObjectTypeExtensions {
[key: string]: unknown;
}
Referenced by
export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;
fields: ThunkObjMap<GraphQLFieldConfig<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?: Maybe<GraphQLTypeResolver<TSource, TContext>>;
extensions?: Maybe<Readonly<GraphQLInterfaceTypeExtensions>>;
extensionASTNodes?: Maybe<readonly InterfaceTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLInterfaceTypeExtensions {
[key: string]: unknown;
}
Referenced by
export type GraphQLIsTypeOfFn<TSource, TContext> = (source: TSource, context: TContext, info: GraphQLResolveInfo) => PromiseOrValue<boolean>
Referenced by
Unexported symbols referenced here
export interface GraphQLObjectTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;
fields: ThunkObjMap<GraphQLFieldConfig<TSource, TContext>>;
isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
extensions?: Maybe<Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>>;
extensionASTNodes?: Maybe<readonly ObjectTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

We've provided these template arguments because this is an open type and you may find them useful.

export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
[key: string]: unknown;
}
Referenced by
export interface GraphQLResolveInfo {
readonly fieldName: string;
readonly fieldNodes: readonly FieldNode[];
readonly returnType: GraphQLOutputType;
readonly parentType: GraphQLObjectType;
readonly path: Path;
readonly schema: GraphQLSchema;
readonly fragments: ObjMap<FragmentDefinitionNode>;
readonly rootValue: unknown;
readonly operation: OperationDefinitionNode;
readonly variableValues: {
[key: string]: unknown;
};
}
Referenced by
export interface ResponsePath {
readonly prev: Path | undefined;
readonly key: string | number;
readonly typename: string | undefined;
}
Referenced by
export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
name: string;
description?: Maybe<string>;
specifiedByURL?: Maybe<string>;

Serializes an internal value to include in a response.

serialize?: GraphQLScalarSerializer<TExternal>;

Parses an externally provided value to use as an input.

parseValue?: GraphQLScalarValueParser<TInternal>;

Parses an externally provided literal value to use as an input.

parseLiteral?: GraphQLScalarLiteralParser<TInternal>;
extensions?: Maybe<Readonly<GraphQLScalarTypeExtensions>>;
extensionASTNodes?: Maybe<readonly ScalarTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLScalarTypeExtensions {
[key: string]: unknown;
}
Referenced by
export type GraphQLTypeResolver<TSource, TContext> = (value: TSource, context: TContext, info: GraphQLResolveInfo, abstractType: GraphQLAbstractType) => PromiseOrValue<string | undefined>
Referenced by
export interface GraphQLUnionTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;

Optionally provide a custom type resolver function. If one is not provided, the default implementation will call isTypeOf on each implementing Object type.

resolveType?: Maybe<GraphQLTypeResolver<TSource, TContext>>;
extensions?: Maybe<Readonly<GraphQLUnionTypeExtensions>>;
extensionASTNodes?: Maybe<readonly UnionTypeExtensionNode[]>;
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLUnionTypeExtensions {
[key: string]: unknown;
}
Referenced by
export type GraphQLScalarSerializer<TExternal> = (outputValue: unknown) => TExternal
Referenced by
export type GraphQLScalarValueParser<TInternal> = (inputValue: unknown) => TInternal
Referenced by
export type GraphQLScalarLiteralParser<TInternal> = (valueNode: ValueNode, variables?: Maybe<ObjMap<unknown>>) => TInternal
Referenced by

Represents a range of characters represented by a lexical token within a Source.

export class Token {
constructor(kind: TokenKind, start: number, end: number, line: number, column: number, value?: string)

The kind of Token.

readonly kind: TokenKind;

The character offset at which this Node begins.

readonly start: number;

The character offset at which this Node ends.

readonly end: number;

The 1-indexed line number on which this Token appears.

readonly line: number;

The 1-indexed column number at which this Token begins.

readonly column: number;

For non-punctuation tokens, represents the interpreted value of the token.

more
less

Note: is undefined for punctuation tokens, but typed as string for convenience in the parser.

readonly value: string;

Tokens exist as nodes in a double-linked-list amongst all tokens including ignored tokens. is always the first node and the last.

readonly prev: Token | null;
readonly next: Token | null;
get [Symbol.toStringTag](): string;
toJSON(): {
kind: TokenKind;
value?: string;
line: number;
column: number;
};
}
Referenced by

A representation of source input to GraphQL. The name and locationOffset parameters are optional, but they are useful for clients who store GraphQL documents in source files. For example, if the GraphQL input starts at line 40 in a file named Foo.graphql, it might be useful for name to be "Foo.graphql" and location to be { line: 40, column: 1 }. The line and column properties in locationOffset are 1-indexed.

export class Source {
constructor(body: string, name?: string, locationOffset?: Location)
body: string;
name: string;
locationOffset: Location;
get [Symbol.toStringTag](): string;
}
Referenced by
Unexported symbols referenced here
interface Location {
line: number;
column: number;
}
Referenced by

Contains a range of UTF-8 character offsets and token references that identify the region of the source from which the AST derived.

export class Location {
constructor(startToken: Token, endToken: Token, source: Source)

The character offset at which this Node begins.

readonly start: number;

The character offset at which this Node ends.

readonly end: number;

The Token at which this Node begins.

readonly startToken: Token;

The Token at which this Node ends.

readonly endToken: Token;

The Source document the AST represents.

readonly source: Source;
get [Symbol.toStringTag](): string;
toJSON(): {
start: number;
end: number;
};
}
Referenced by
export enum OperationTypeNode {
QUERY = "query",
MUTATION = "mutation",
SUBSCRIPTION = "subscription"
}
Referenced by

Takes a Source and a UTF-8 character offset, and returns the corresponding line and column as a SourceLocation.

export function getLocation(source: Source, position: number): SourceLocation

Render a helpful description of the location in the GraphQL Source document.

export function printLocation(location: Location): string

Render a helpful description of the location in the GraphQL Source document.

export function printSourceLocation(source: Source, sourceLocation: SourceLocation): string

Given a Source object, creates a Lexer for that source. A Lexer is a stateful stream generator in that every time it is advanced, it returns the next token in the Source. Assuming the source lexes, the final Token emitted by the lexer will be of kind EOF, after which the lexer will repeatedly return the same EOF token whenever called.

export class Lexer {
constructor(source: Source)
source: Source;

The previously focused non-ignored token.

lastToken: Token;

The currently focused non-ignored token.

token: Token;

The (1-indexed) line containing the current token.

line: number;

The character offset at which the current line begins.

lineStart: number;
get [Symbol.toStringTag](): string;

Advances the token stream to the next non-ignored token.

advance(): Token;

Looks ahead and returns the next non-ignored token, but does not change the state of Lexer.

lookahead(): Token;
}

An exported enum describing the different kinds of tokens that the lexer emits.

export enum TokenKind {
SOF = "<SOF>",
EOF = "<EOF>",
BANG = "!",
DOLLAR = "$",
AMP = "&",
PAREN_L = "(",
PAREN_R = ")",
SPREAD = "...",
COLON = ":",
EQUALS = "=",
AT = "@",
BRACKET_L = "[",
BRACKET_R = "]",
BRACE_L = "{",
PIPE = "|",
BRACE_R = "}",
NAME = "Name",
INT = "Int",
FLOAT = "Float",
STRING = "String",
BLOCK_STRING = "BlockString",
COMMENT = "Comment"
}
Referenced by

Given a GraphQL source, parses it into a Document. Throws GraphQLError if a syntax error is encountered.

export function parse(source: string | Source, options?: ParseOptions | undefined): DocumentNode

Given a string containing a GraphQL value (ex. [42]), parse the AST for that value. Throws GraphQLError if a syntax error is encountered.

more
less

This is useful within tools that operate upon GraphQL Values directly and in isolation of complete GraphQL documents.

Consider providing the results to the utility function: valueFromAST().

export function parseValue(source: string | Source, options?: ParseOptions | undefined): ValueNode

Similar to parseValue(), but raises a parse error if it encounters a variable. The return type will be a constant value.

export function parseConstValue(source: string | Source, options?: ParseOptions | undefined): ConstValueNode

Given a string containing a GraphQL Type (ex. [Int!]), parse the AST for that type. Throws GraphQLError if a syntax error is encountered.

more
less

This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents.

Consider providing the results to the utility function: typeFromAST().

export function parseType(source: string | Source, options?: ParseOptions | undefined): TypeNode

Converts an AST into a string, using one set of reasonable formatting rules.

export function print(ast: ASTNode): string

visit() will walk through an AST using a depth-first traversal, calling the visitor's enter function at each node in the traversal, and calling the leave function after visiting that node and all of its child nodes.

more
less

By returning different values from the enter and leave functions, the behavior of the visitor can be altered, including skipping over a sub-tree of the AST (by returning false), editing the AST by returning a value or null to remove the value, or to stop the whole traversal by returning BREAK.

When using visit() to edit an AST, the original AST will not be modified, and a new version of the AST with the changes applied will be returned from the visit function.

const editedAST = visit(ast, {
enter(node, key, parent, path, ancestors) {
//
@return — // undefined: no action
// false: skip visiting this node
// visitor.BREAK: stop visiting altogether
// null: delete this node
// any value: replace this node with the returned value
},
leave(node, key, parent, path, ancestors) {
//
@return — // undefined: no action
// false: no action
// visitor.BREAK: stop visiting altogether
// null: delete this node
// any value: replace this node with the returned value
}
});

Alternatively to providing enter() and leave() functions, a visitor can instead provide functions named the same as the kinds of AST nodes, or enter/leave visitors at a named key, leading to three permutations of the visitor API:

  1. Named visitors triggered when entering a node of a specific kind.
visit(ast, {
Kind(node) {
// enter the "Kind" node
}
})
  1. Named visitors that trigger upon entering and leaving a node of a specific kind.
visit(ast, {
Kind: {
enter(node) {
// enter the "Kind" node
}
leave(node) {
// leave the "Kind" node
}
}
})
  1. Generic visitors that trigger upon entering and leaving any node.
visit(ast, {
enter(node) {
// enter any node
},
leave(node) {
// leave any node
}
})
export function visit<N extends ASTNode>(root: N, visitor: ASTVisitor, visitorKeys?: ASTVisitorKeyMap): N
export function visit<R>(root: ASTNode, visitor: ASTReducer<R>, visitorKeys?: ASTVisitorKeyMap): R
Unexported symbols referenced here

A reducer is comprised of reducer functions which convert AST nodes into another form.

type ASTReducer<R> = {
readonly [NodeT in ASTNode as NodeT["kind"]]?: {
readonly enter?: ASTVisitFn<NodeT>;
readonly leave: ASTReducerFn<NodeT, R>;
};
}
Referenced by
type ASTReducerFn<TReducedNode extends ASTNode, R> = (node: {
[K in keyof TReducedNode]: ReducedField<TReducedNode[K], R>;
}, key: string | number | undefined, parent: ASTNode | readonly ASTNode[] | undefined, path: readonly string | number[], ancestors: readonly ASTNode | readonly ASTNode[][]) => R
Referenced by
type ReducedField<T, R> = T extends null | undefined ? T : T extends readonly any[] ? readonly R[] : R
Referenced by

Creates a new visitor instance which delegates to many visitors to run in parallel. Each visitor will be visited for each node before moving on.

more
less

If a prior visitor edits a node, no following visitors will see that node.

export function visitInParallel(visitors: readonly ASTVisitor[]): ASTVisitor

Given a visitor instance, if it is leaving or not, and a node kind, return the function the visitor runtime should call.

more
less

@deprecated — Please use getEnterLeaveForKind instead. Will be removed in v17

export function getVisitFn(visitor: ASTVisitor, kind: Kind, isLeaving: boolean): ASTVisitFn<ASTNode> | undefined

Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.

export function getEnterLeaveForKind(visitor: ASTVisitor, kind: Kind): EnterLeaveVisitor<ASTNode>
Unexported symbols referenced here
interface EnterLeaveVisitor<TVisitedNode extends ASTNode> {
readonly enter?: ASTVisitFn<TVisitedNode>;
readonly leave?: ASTVisitFn<TVisitedNode>;
}
Referenced by
export const BREAK: unknown = ...

The set of allowed kind values for AST nodes.

export enum Kind {

Name

NAME = "Name",

Document

DOCUMENT = "Document",
OPERATION_DEFINITION = "OperationDefinition",
VARIABLE_DEFINITION = "VariableDefinition",
SELECTION_SET = "SelectionSet",
FIELD = "Field",
ARGUMENT = "Argument",

Fragments

FRAGMENT_SPREAD = "FragmentSpread",
INLINE_FRAGMENT = "InlineFragment",
FRAGMENT_DEFINITION = "FragmentDefinition",

Values

VARIABLE = "Variable",
INT = "IntValue",
FLOAT = "FloatValue",
STRING = "StringValue",
BOOLEAN = "BooleanValue",
NULL = "NullValue",
ENUM = "EnumValue",
LIST = "ListValue",
OBJECT = "ObjectValue",
OBJECT_FIELD = "ObjectField",

Directives

DIRECTIVE = "Directive",

Types

NAMED_TYPE = "NamedType",
LIST_TYPE = "ListType",
NON_NULL_TYPE = "NonNullType",

Type System Definitions

SCHEMA_DEFINITION = "SchemaDefinition",
OPERATION_TYPE_DEFINITION = "OperationTypeDefinition",

Type Definitions

SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition",
OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition",
FIELD_DEFINITION = "FieldDefinition",
INPUT_VALUE_DEFINITION = "InputValueDefinition",
INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition",
UNION_TYPE_DEFINITION = "UnionTypeDefinition",
ENUM_TYPE_DEFINITION = "EnumTypeDefinition",
ENUM_VALUE_DEFINITION = "EnumValueDefinition",
INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition",

Directive Definitions

DIRECTIVE_DEFINITION = "DirectiveDefinition",

Type System Extensions

SCHEMA_EXTENSION = "SchemaExtension",

Type Extensions

SCALAR_TYPE_EXTENSION = "ScalarTypeExtension",
OBJECT_TYPE_EXTENSION = "ObjectTypeExtension",
INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension",
UNION_TYPE_EXTENSION = "UnionTypeExtension",
ENUM_TYPE_EXTENSION = "EnumTypeExtension",
INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension"
}
Referenced by

The set of allowed directive location values.

export enum DirectiveLocation {

Request Definitions

QUERY = "QUERY",
MUTATION = "MUTATION",
SUBSCRIPTION = "SUBSCRIPTION",
FIELD = "FIELD",
FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION",
FRAGMENT_SPREAD = "FRAGMENT_SPREAD",
INLINE_FRAGMENT = "INLINE_FRAGMENT",
VARIABLE_DEFINITION = "VARIABLE_DEFINITION",

Type System Definitions

SCHEMA = "SCHEMA",
SCALAR = "SCALAR",
OBJECT = "OBJECT",
FIELD_DEFINITION = "FIELD_DEFINITION",
ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION",
INTERFACE = "INTERFACE",
UNION = "UNION",
ENUM = "ENUM",
ENUM_VALUE = "ENUM_VALUE",
INPUT_OBJECT = "INPUT_OBJECT",
INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"
}
Referenced by
export function isDefinitionNode(node: ASTNode): node is DefinitionNode
export function isExecutableDefinitionNode(node: ASTNode): node is ExecutableDefinitionNode
export function isSelectionNode(node: ASTNode): node is SelectionNode
export function isValueNode(node: ASTNode): node is ValueNode
export function isConstValueNode(node: ASTNode): node is ConstValueNode
export function isTypeNode(node: ASTNode): node is TypeNode
export function isTypeSystemDefinitionNode(node: ASTNode): node is TypeSystemDefinitionNode
export function isTypeDefinitionNode(node: ASTNode): node is TypeDefinitionNode
export function isTypeSystemExtensionNode(node: ASTNode): node is TypeSystemExtensionNode
export function isTypeExtensionNode(node: ASTNode): node is TypeExtensionNode

Configuration options to control parser behavior

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;

Parser CPU and memory usage is linear to the number of tokens in a document however in extreme cases it becomes quadratic due to memory exhaustion. Parsing happens before validation so even invalid queries can burn lots of CPU time and memory. To prevent this you can set a maximum number of tokens allowed within a document.

maxTokens?: number | undefined;

@deprecated — will be removed in the v17.0.0

more
less

If enabled, the parser will understand and parse variable definitions contained in a fragment definition. They'll be represented in the variableDefinitions field of the FragmentDefinitionNode.

The syntax is identical to normal, query-defined variables. For example:

fragment A($var: Boolean = false) on T {
...
}
allowLegacyFragmentVariables?: boolean;
}
Referenced by

Represents a location in a Source.

export interface SourceLocation {
readonly line: number;
readonly column: number;
}
Referenced by

The enum type representing the token kinds values.

more
less

@deprecated — Please use TokenKind. Will be remove in v17.

export type TokenKindEnum = typeof TokenKind

The enum type representing the possible kind values of AST nodes.

more
less

@deprecated — Please use Kind. Will be remove in v17.

export type KindEnum = typeof Kind

The enum type representing the directive location values.

more
less

@deprecated — Please use DirectiveLocation. Will be remove in v17.

export type DirectiveLocationEnum = typeof DirectiveLocation

A visitor is provided to visit, it contains the collection of relevant functions to be called during the visitor's traversal.

export type ASTVisitor = EnterLeaveVisitor<ASTNode> | KindVisitor
Referenced by
Unexported symbols referenced here
type KindVisitor = {
readonly [NodeT in ASTNode as NodeT["kind"]]?: ASTVisitFn<NodeT> | EnterLeaveVisitor<NodeT>;
}
Referenced by

A visitor is comprised of visit functions, which are called on each node during the visitor's traversal.

export type ASTVisitFn<TVisitedNode extends ASTNode> = (node: TVisitedNode, key: string | number | undefined, parent: ASTNode | readonly ASTNode[] | undefined, path: readonly string | number[], ancestors: readonly ASTNode | readonly ASTNode[][]) => any
Referenced by

A KeyMap describes each the traversable properties of each kind of node.

more
less

@deprecated — Please inline it. Will be removed in v17

export type ASTVisitorKeyMap = {
[NodeT in ASTNode as NodeT["kind"]]?: readonly keyof NodeT[];
}
Referenced by
Referenced by

Utility type listing all nodes indexed by their kind.

export type ASTKindToNode = {
[NodeT in ASTNode as NodeT["kind"]]: NodeT;
}
export interface OperationDefinitionNode {
readonly kind: OPERATION_DEFINITION;
readonly loc?: Location;
readonly operation: OperationTypeNode;
readonly name?: NameNode;
readonly variableDefinitions?: readonly VariableDefinitionNode[];
readonly directives?: readonly DirectiveNode[];
readonly selectionSet: SelectionSetNode;
}
Referenced by
export interface VariableDefinitionNode {
readonly kind: VARIABLE_DEFINITION;
readonly loc?: Location;
readonly variable: VariableNode;
readonly type: TypeNode;
readonly defaultValue?: ConstValueNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface VariableNode {
readonly kind: VARIABLE;
readonly loc?: Location;
readonly name: NameNode;
}
Referenced by
export interface FieldNode {
readonly kind: FIELD;
readonly loc?: Location;
readonly alias?: NameNode;
readonly name: NameNode;
readonly arguments?: readonly ArgumentNode[];
readonly directives?: readonly DirectiveNode[];
readonly selectionSet?: SelectionSetNode;
}
Referenced by
export interface ArgumentNode {
readonly kind: ARGUMENT;
readonly loc?: Location;
readonly name: NameNode;
readonly value: ValueNode;
}
Referenced by
export interface ConstArgumentNode {
readonly kind: ARGUMENT;
readonly loc?: Location;
readonly name: NameNode;
readonly value: ConstValueNode;
}
Referenced by

Fragments

export interface FragmentSpreadNode {
readonly kind: FRAGMENT_SPREAD;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: readonly DirectiveNode[];
}
Referenced by
export interface InlineFragmentNode {
readonly kind: INLINE_FRAGMENT;
readonly loc?: Location;
readonly typeCondition?: NamedTypeNode;
readonly directives?: readonly DirectiveNode[];
readonly selectionSet: SelectionSetNode;
}
Referenced by
export interface FragmentDefinitionNode {
readonly kind: FRAGMENT_DEFINITION;
readonly loc?: Location;
readonly name: NameNode;

@deprecated — variableDefinitions will be removed in v17.0.0

readonly variableDefinitions?: readonly VariableDefinitionNode[];
readonly typeCondition: NamedTypeNode;
readonly directives?: readonly DirectiveNode[];
readonly selectionSet: SelectionSetNode;
}
Referenced by
export interface IntValueNode {
readonly kind: INT;
readonly loc?: Location;
readonly value: string;
}
Referenced by
export interface FloatValueNode {
readonly kind: FLOAT;
readonly loc?: Location;
readonly value: string;
}
Referenced by
export interface BooleanValueNode {
readonly kind: BOOLEAN;
readonly loc?: Location;
readonly value: boolean;
}
Referenced by
export interface NullValueNode {
readonly kind: NULL;
readonly loc?: Location;
}
Referenced by
export interface EnumValueNode {
readonly kind: ENUM;
readonly loc?: Location;
readonly value: string;
}
Referenced by
export interface ListValueNode {
readonly kind: LIST;
readonly loc?: Location;
readonly values: readonly ValueNode[];
}
Referenced by
export interface ConstListValueNode {
readonly kind: LIST;
readonly loc?: Location;
readonly values: readonly ConstValueNode[];
}
Referenced by
export interface ObjectValueNode {
readonly kind: OBJECT;
readonly loc?: Location;
readonly fields: readonly ObjectFieldNode[];
}
Referenced by
export interface ConstObjectValueNode {
readonly kind: OBJECT;
readonly loc?: Location;
readonly fields: readonly ConstObjectFieldNode[];
}
Referenced by
export interface ObjectFieldNode {
readonly kind: OBJECT_FIELD;
readonly loc?: Location;
readonly name: NameNode;
readonly value: ValueNode;
}
Referenced by
export interface ConstObjectFieldNode {
readonly kind: OBJECT_FIELD;
readonly loc?: Location;
readonly name: NameNode;
readonly value: ConstValueNode;
}
Referenced by

Directives

export interface DirectiveNode {
readonly kind: DIRECTIVE;
readonly loc?: Location;
readonly name: NameNode;
readonly arguments?: readonly ArgumentNode[];
}
Referenced by
export interface ListTypeNode {
readonly kind: LIST_TYPE;
readonly loc?: Location;
readonly type: TypeNode;
}
Referenced by
export interface NonNullTypeNode {
readonly kind: NON_NULL_TYPE;
readonly loc?: Location;
readonly type: NamedTypeNode | ListTypeNode;
}
Referenced by
export interface SchemaDefinitionNode {
readonly kind: SCHEMA_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly operationTypes: readonly OperationTypeDefinitionNode[];
}
Referenced by
export interface OperationTypeDefinitionNode {
readonly loc?: Location;
readonly operation: OperationTypeNode;
readonly type: NamedTypeNode;
}
Referenced by
export interface ScalarTypeDefinitionNode {
readonly kind: SCALAR_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface ObjectTypeDefinitionNode {
readonly kind: OBJECT_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly interfaces?: readonly NamedTypeNode[];
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly FieldDefinitionNode[];
}
Referenced by
export interface FieldDefinitionNode {
readonly kind: FIELD_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly arguments?: readonly InputValueDefinitionNode[];
readonly type: TypeNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface InputValueDefinitionNode {
readonly kind: INPUT_VALUE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly type: TypeNode;
readonly defaultValue?: ConstValueNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface InterfaceTypeDefinitionNode {
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly interfaces?: readonly NamedTypeNode[];
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly FieldDefinitionNode[];
}
Referenced by
export interface UnionTypeDefinitionNode {
readonly kind: UNION_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly types?: readonly NamedTypeNode[];
}
Referenced by
export interface EnumTypeDefinitionNode {
readonly kind: ENUM_TYPE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly values?: readonly EnumValueDefinitionNode[];
}
Referenced by
export interface EnumValueDefinitionNode {
readonly kind: ENUM_VALUE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface InputObjectTypeDefinitionNode {
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly InputValueDefinitionNode[];
}
Referenced by

Directive Definitions

export interface DirectiveDefinitionNode {
readonly kind: DIRECTIVE_DEFINITION;
readonly loc?: Location;
readonly description?: StringValueNode;
readonly name: NameNode;
readonly arguments?: readonly InputValueDefinitionNode[];
readonly repeatable: boolean;
readonly locations: readonly NameNode[];
}
Referenced by

Type System Extensions

export type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode
Referenced by
export interface SchemaExtensionNode {
readonly kind: SCHEMA_EXTENSION;
readonly loc?: Location;
readonly directives?: readonly ConstDirectiveNode[];
readonly operationTypes?: readonly OperationTypeDefinitionNode[];
}
Referenced by
export interface ScalarTypeExtensionNode {
readonly kind: SCALAR_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
}
Referenced by
export interface ObjectTypeExtensionNode {
readonly kind: OBJECT_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly interfaces?: readonly NamedTypeNode[];
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly FieldDefinitionNode[];
}
Referenced by
export interface InterfaceTypeExtensionNode {
readonly kind: INTERFACE_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly interfaces?: readonly NamedTypeNode[];
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly FieldDefinitionNode[];
}
Referenced by
export interface UnionTypeExtensionNode {
readonly kind: UNION_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly types?: readonly NamedTypeNode[];
}
Referenced by
export interface EnumTypeExtensionNode {
readonly kind: ENUM_TYPE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly values?: readonly EnumValueDefinitionNode[];
}
Referenced by
export interface InputObjectTypeExtensionNode {
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: readonly ConstDirectiveNode[];
readonly fields?: readonly InputValueDefinitionNode[];
}
Referenced by

Implements the "Executing requests" section of the GraphQL specification.

more
less

Returns either a synchronous ExecutionResult (if all encountered resolvers are synchronous), or a Promise of an ExecutionResult that will eventually be resolved and never rejected.

If the arguments to this function do not result in a legal execution context, a GraphQLError will be thrown immediately explaining the invalid input.

export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult>

Also implements the "Executing requests" section of the GraphQL specification. However, it guarantees to complete synchronously (or throw an error) assuming that all field resolvers are also synchronous.

export function executeSync(args: ExecutionArgs): ExecutionResult

If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result, or if it's a function, returns the result of calling that function while passing along args and context value.

export const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown> = ...

If a resolveType function is not given, then a default resolve behavior is used which attempts two strategies:

more
less

First, See if the provided value has a __typename field defined, if so, use that value as name of the resolved type.

Otherwise, test each possible type for the abstract type by calling isTypeOf for the object being coerced, returning the first type that matches.

export const defaultTypeResolver: GraphQLTypeResolver<unknown, unknown> = ...

Given a Path, return an Array of the path keys.

export function responsePathAsArray(path: Maybe<Readonly<Path>>): string | number[]

Prepares an object map of argument values given a list of argument definitions and list of argument AST nodes.

more
less

Note: The returned value is a plain Object with a prototype, since it is exposed to user code. Care should be taken to not pull values from the Object prototype.

export function getArgumentValues(def: GraphQLField<unknown, unknown> | GraphQLDirective, node: FieldNode | DirectiveNode, variableValues?: Maybe<ObjMap<unknown>>): {
[key: string]: unknown;
}

Prepares an object map of variableValues of the correct type based on the provided variable definitions and arbitrary input. If the input cannot be parsed to match the variable definitions, a GraphQLError will be thrown.

more
less

Note: The returned value is a plain Object with a prototype, since it is exposed to user code. Care should be taken to not pull values from the Object prototype.

export function getVariableValues(schema: GraphQLSchema, varDefNodes: readonly VariableDefinitionNode[], inputs: {
readonly [key: string]: unknown;
}, options?: {
maxErrors?: number;
}): CoercedVariableValues
Unexported symbols referenced here
type CoercedVariableValues = {
errors: readonly GraphQLError[];
coerced?: never;
} | {
coerced: {
[key: string]: unknown;
};
errors?: never;
}
Referenced by

Prepares an object map of argument values given a directive definition and a AST node which may contain directives. Optionally also accepts a map of variable values.

more
less

If the directive does not exist on the node, returns undefined.

Note: The returned value is a plain Object with a prototype, since it is exposed to user code. Care should be taken to not pull values from the Object prototype.

export function getDirectiveValues(directiveDef: GraphQLDirective, node: {
readonly directives?: readonly DirectiveNode[];
}, variableValues?: Maybe<ObjMap<unknown>>): undefined | {
[key: string]: unknown;
}

Implements the "Subscribe" algorithm described in the GraphQL specification.

more
less

Returns a Promise which resolves to either an AsyncIterator (if successful) or an ExecutionResult (error). The promise will be rejected if the schema or other arguments to this function are invalid, or if the resolved event stream is not an async iterable.

If the client-provided arguments to this function do not result in a compliant subscription, a GraphQL Response (ExecutionResult) with descriptive errors and no data will be returned.

If the source stream could not be created due to faulty subscription resolver logic or underlying systems, the promise will resolve to a single ExecutionResult containing errors and no data.

If the operation succeeded, the promise resolves to an AsyncIterator, which yields a stream of ExecutionResults representing the response stream.

Accepts either an object with named arguments, or individual arguments.

export function subscribe(args: ExecutionArgs): Promise<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult>

Implements the "CreateSourceEventStream" algorithm described in the GraphQL specification, resolving the subscription source event stream.

more
less

Returns a Promise which resolves to either an AsyncIterable (if successful) or an ExecutionResult (error). The promise will be rejected if the schema or other arguments to this function are invalid, or if the resolved event stream is not an async iterable.

If the client-provided arguments to this function do not result in a compliant subscription, a GraphQL Response (ExecutionResult) with descriptive errors and no data will be returned.

If the the source stream could not be created due to faulty subscription resolver logic or underlying systems, the promise will resolve to a single ExecutionResult containing errors and no data.

If the operation succeeded, the promise resolves to the AsyncIterable for the event stream returned by the resolver.

A Source Event Stream represents a sequence of events, each of which triggers a GraphQL execution for that event.

This may be useful when hosting the stateful subscription service in a different process or machine than the stateless GraphQL execution engine, or otherwise separating these two steps. For more on this, see the "Supporting Subscriptions at Scale" information in the GraphQL specification.

export function createSourceEventStream(args: ExecutionArgs): Promise<AsyncIterable<unknown> | ExecutionResult>

@deprecated — will be removed in next major version in favor of named arguments

export function createSourceEventStream(schema: GraphQLSchema, document: DocumentNode, rootValue?: unknown, contextValue?: unknown, variableValues?: Maybe<{
readonly [key: string]: unknown;
}>, operationName?: Maybe<string>, subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>): Promise<AsyncIterable<unknown> | ExecutionResult>
export interface ExecutionArgs {
schema: GraphQLSchema;
document: DocumentNode;
rootValue?: unknown;
contextValue?: unknown;
variableValues?: Maybe<{
readonly [key: string]: unknown;
}>;
operationName?: Maybe<string>;
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
}
Referenced by

The result of GraphQL execution.

more
less
  • errors is included when any errors occurred as a non-empty array.
  • data is the result of a successful execution of the query.
  • extensions is reserved for adding non-standard properties.
export interface ExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> {
errors?: readonly GraphQLError[];
data?: TData | null;
extensions?: TExtensions;
}
Referenced by
export interface FormattedExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> {
errors?: readonly GraphQLFormattedError[];
data?: TData | null;
extensions?: TExtensions;
}

@deprecated — use ExecutionArgs instead. Will be removed in v17

more
less

ExecutionArgs has been broadened to include all properties within SubscriptionArgs. The SubscriptionArgs type is retained for backwards compatibility.

export interface SubscriptionArgs extends ExecutionArgs {}

Implements the "Validation" section of the spec.

more
less

Validation runs synchronously, returning an array of encountered errors, or an empty array if no errors were encountered and the document is valid.

A list of specific validation rules may be provided. If not provided, the default list of rules defined by the GraphQL specification will be used.

Each validation rules is a function which returns a visitor (see the language/visitor API). Visitor methods are expected to return GraphQLErrors, or Arrays of GraphQLErrors when invalid.

Validate will stop validation after a maxErrors limit has been reached. Attackers can send pathologically invalid queries to induce a DoS attack, so by default maxErrors set to 100 errors.

Optionally a custom TypeInfo instance may be provided. If not provided, one will be created from the provided schema.

export function validate(schema: GraphQLSchema, documentAST: DocumentNode, rules?: readonly ValidationRule[], options?: {
maxErrors?: number;
}, typeInfo?: TypeInfo): readonly GraphQLError[]
export class ValidationContext extends ASTValidationContext {
constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo, onError: (error: GraphQLError) => void)
get [Symbol.toStringTag](): string;
getSchema(): GraphQLSchema;
getVariableUsages(node: NodeWithSelectionSet): readonly VariableUsage[];
getRecursiveVariableUsages(operation: OperationDefinitionNode): readonly VariableUsage[];
getParentType(): Maybe<GraphQLCompositeType>;
getInputType(): Maybe<GraphQLInputType>;
getParentInputType(): Maybe<GraphQLInputType>;
getFieldDef(): Maybe<GraphQLField<unknown, unknown>>;
getDirective(): Maybe<GraphQLDirective>;
getArgument(): Maybe<GraphQLArgument>;
getEnumValue(): Maybe<GraphQLEnumValue>;
}
Referenced by
Unexported symbols referenced here

An instance of this class is passed as the "this" context to all validators, allowing access to commonly useful contextual information from within a validation rule.

class ASTValidationContext {
constructor(ast: DocumentNode, onError: (error: GraphQLError) => void)
get [Symbol.toStringTag](): string;
reportError(error: GraphQLError): void;
getDocument(): DocumentNode;
getFragment(name: string): Maybe<FragmentDefinitionNode>;
getFragmentSpreads(node: SelectionSetNode): readonly FragmentSpreadNode[];
getRecursivelyReferencedFragments(operation: OperationDefinitionNode): readonly FragmentDefinitionNode[];
}
Referenced by
interface VariableUsage {
readonly node: VariableNode;
readonly type: Maybe<GraphQLInputType>;
readonly defaultValue: Maybe<unknown>;
}
Referenced by

This set includes all validation rules defined by the GraphQL spec.

more
less

The order of the rules in this list has been adjusted to lead to the most clear output when encountering multiple validation errors.

export const specifiedRules: readonly ValidationRule[] = ...

Executable definitions

more
less

A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.

See https://spec.graphql.org/draft/#sec-Executable-Definitions

export function ExecutableDefinitionsRule(context: ASTValidationContext): ASTVisitor

Fields on correct type

more
less

A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as __typename.

See https://spec.graphql.org/draft/#sec-Field-Selections

export function FieldsOnCorrectTypeRule(context: ValidationContext): ASTVisitor

Fragments on composite type

more
less

Fragments use a type condition to determine if they apply, since fragments can only be spread into a composite type (object, interface, or union), the type condition must also be a composite type.

See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types

export function FragmentsOnCompositeTypesRule(context: ValidationContext): ASTVisitor

Known argument names

more
less

A GraphQL field is only valid if all supplied arguments are defined by that field.

See https://spec.graphql.org/draft/#sec-Argument-Names See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations

export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor

Known directives

more
less

A GraphQL document is only valid if all @directives are known by the schema and legally positioned.

See https://spec.graphql.org/draft/#sec-Directives-Are-Defined

export function KnownDirectivesRule(context: ValidationContext | SDLValidationContext): ASTVisitor
Unexported symbols referenced here

Known fragment names

more
less

A GraphQL document is only valid if all ...Fragment fragment spreads refer to fragments defined in the same document.

See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined

export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor

Known type names

more
less

A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.

See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence

export function KnownTypeNamesRule(context: ValidationContext | SDLValidationContext): ASTVisitor

Lone anonymous operation

more
less

A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.

See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation

export function LoneAnonymousOperationRule(context: ASTValidationContext): ASTVisitor

No fragment cycles

more
less

The graph of fragment spreads must not form any cycles including spreading itself. Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data.

See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles

export function NoFragmentCyclesRule(context: ASTValidationContext): ASTVisitor

No undefined variables

more
less

A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.

See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined

export function NoUndefinedVariablesRule(context: ValidationContext): ASTVisitor

No unused fragments

more
less

A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.

See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used

export function NoUnusedFragmentsRule(context: ASTValidationContext): ASTVisitor

No unused variables

more
less

A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.

See https://spec.graphql.org/draft/#sec-All-Variables-Used

export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor

Overlapping fields can be merged

more
less

A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.

See https://spec.graphql.org/draft/#sec-Field-Selection-Merging

export function OverlappingFieldsCanBeMergedRule(context: ValidationContext): ASTVisitor

Possible fragment spread

more
less

A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.

export function PossibleFragmentSpreadsRule(context: ValidationContext): ASTVisitor

Provided required arguments

more
less

A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.

export function ProvidedRequiredArgumentsRule(context: ValidationContext): ASTVisitor

Scalar leafs

more
less

A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.

export function ScalarLeafsRule(context: ValidationContext): ASTVisitor

Subscriptions must only include a non-introspection field.

more
less

A GraphQL subscription is valid only if it contains a single root field and that root field is not an introspection field.

See https://spec.graphql.org/draft/#sec-Single-root-field

export function SingleFieldSubscriptionsRule(context: ValidationContext): ASTVisitor

Unique argument names

more
less

A GraphQL field or directive is only valid if all supplied arguments are uniquely named.

See https://spec.graphql.org/draft/#sec-Argument-Names

export function UniqueArgumentNamesRule(context: ASTValidationContext): ASTVisitor

Unique directive names per location

more
less

A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.

See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location

export function UniqueDirectivesPerLocationRule(context: ValidationContext | SDLValidationContext): ASTVisitor

Unique fragment names

more
less

A GraphQL document is only valid if all defined fragments have unique names.

See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness

export function UniqueFragmentNamesRule(context: ASTValidationContext): ASTVisitor

Unique input field names

more
less

A GraphQL input object value is only valid if all supplied fields are uniquely named.

See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness

export function UniqueInputFieldNamesRule(context: ASTValidationContext): ASTVisitor

Unique operation names

more
less

A GraphQL document is only valid if all defined operations have unique names.

See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness

export function UniqueOperationNamesRule(context: ASTValidationContext): ASTVisitor

Unique variable names

more
less

A GraphQL operation is only valid if all its variables are uniquely named.

export function UniqueVariableNamesRule(context: ASTValidationContext): ASTVisitor

Value literals of correct type

more
less

A GraphQL document is only valid if all value literals are of the type expected at their position.

See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type

export function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor

Variables are input types

more
less

A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).

See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types

export function VariablesAreInputTypesRule(context: ValidationContext): ASTVisitor

Variables in allowed position

more
less

Variable usages must be compatible with the arguments they are passed to.

See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed

export function VariablesInAllowedPositionRule(context: ValidationContext): ASTVisitor

Lone Schema definition

more
less

A GraphQL document is only valid if it contains only one schema definition.

export function LoneSchemaDefinitionRule(context: SDLValidationContext): ASTVisitor

Unique operation types

more
less

A GraphQL document is only valid if it has only one type per operation.

export function UniqueOperationTypesRule(context: SDLValidationContext): ASTVisitor

Unique type names

more
less

A GraphQL document is only valid if all defined types have unique names.

export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor

Unique enum value names

more
less

A GraphQL enum type is only valid if all its values are uniquely named.

export function UniqueEnumValueNamesRule(context: SDLValidationContext): ASTVisitor

Unique field definition names

more
less

A GraphQL complex type is only valid if all its fields are uniquely named.

export function UniqueFieldDefinitionNamesRule(context: SDLValidationContext): ASTVisitor

Unique argument definition names

more
less

A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. A GraphQL Directive is only valid if all its arguments are uniquely named.

export function UniqueArgumentDefinitionNamesRule(context: SDLValidationContext): ASTVisitor

Unique directive names

more
less

A GraphQL document is only valid if all defined directives have unique names.

export function UniqueDirectiveNamesRule(context: SDLValidationContext): ASTVisitor

Possible type extension

more
less

A type extension is only valid if the type is defined and has the same kind.

export function PossibleTypeExtensionsRule(context: SDLValidationContext): ASTVisitor

No deprecated

more
less

A GraphQL document is only valid if all selected fields and all used enum values have not been deprecated.

Note: This rule is optional and is not part of the Validation section of the GraphQL Specification. The main purpose of this rule is detection of deprecated usages and not necessarily to forbid their use when querying a service.

export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor

Prohibit introspection queries

more
less

A GraphQL document is only valid if all fields selected are not fields that return an introspection type.

Note: This rule is optional and is not part of the Validation section of the GraphQL Specification. This rule effectively disables introspection, which does not reflect best practices and should only be done if absolutely necessary.

export function NoSchemaIntrospectionCustomRule(context: ValidationContext): ASTVisitor
export type ValidationRule = (context: ValidationContext) => ASTVisitor
Referenced by

A GraphQLError describes an Error found during the parse, validate, or execute phases of performing a GraphQL operation. In addition to a message and stack trace, it also includes information about the locations in a GraphQL document and/or execution result that correspond to the Error.

export class GraphQLError extends Error {
constructor(message: string, options?: GraphQLErrorOptions)

@deprecated — Please use the GraphQLErrorOptions constructor overload instead.

constructor(message: string, nodes?: readonly ASTNode[] | ASTNode | null, source?: Maybe<Source>, positions?: Maybe<readonly number[]>, path?: Maybe<readonly string | number[]>, originalError?: Maybe<Error & {
readonly extensions?: unknown;
}>, extensions?: Maybe<GraphQLErrorExtensions>)

An array of { line, column } locations within the source GraphQL document which correspond to this error.

more
less

Errors during validation often contain multiple locations, for example to point out two things with the same name. Errors during execution include a single location, the field which produced the error.

Enumerable, and appears in the result of JSON.stringify().

readonly locations: readonly SourceLocation[] | undefined;

An array describing the JSON-path into the execution response which corresponds to this error. Only included for errors during execution.

more
less

Enumerable, and appears in the result of JSON.stringify().

readonly path: readonly string | number[] | undefined;

An array of GraphQL AST Nodes corresponding to this error.

readonly nodes: readonly ASTNode[] | undefined;

The source GraphQL document for the first location of this error.

more
less

Note that if this Error represents more than one node, the source may not represent nodes after the first node.

readonly source: Source | undefined;

An array of character offsets within the source GraphQL document which correspond to this error.

readonly positions: readonly number[] | undefined;

The original error thrown from a field resolver during execution.

readonly originalError: Error | undefined;

Extension fields to add to the formatted error.

readonly extensions: GraphQLErrorExtensions;
get [Symbol.toStringTag](): string;
toString(): string;
}
Referenced by

Produces a GraphQLError representing a syntax error, containing useful descriptive information about the syntax error's position in the source.

export function syntaxError(source: Source, position: number, description: string): GraphQLError

Given an arbitrary value, presumably thrown while attempting to execute a GraphQL operation, produce a new GraphQLError aware of the location in the document responsible for the original Error.

export function locatedError(rawOriginalError: unknown, nodes: ASTNode | readonly ASTNode[] | undefined | null, path?: Maybe<readonly string | number[]>): GraphQLError

Prints a GraphQLError to a string, representing useful location information about the error's position in the source.

more
less

@deprecated — Please use error.toString instead. Will be removed in v17

export function printError(error: GraphQLError): string

Given a GraphQLError, format it according to the rules described by the Response Format, Errors section of the GraphQL Specification.

more
less

@deprecated — Please use error.toJSON instead. Will be removed in v17

export function formatError(error: GraphQLError): GraphQLFormattedError
export interface GraphQLErrorOptions {
nodes?: readonly ASTNode[] | ASTNode | null;
source?: Maybe<Source>;
positions?: Maybe<readonly number[]>;
path?: Maybe<readonly string | number[]>;
originalError?: Maybe<Error & {
readonly extensions?: unknown;
}>;
}
Referenced by

See: https://spec.graphql.org/draft/#sec-Errors

export interface GraphQLFormattedError {

A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.

readonly message: string;

If an error can be associated to a particular point in the requested GraphQL document, it should contain a list of locations.

readonly locations?: readonly SourceLocation[];

If an error can be associated to a particular field in the GraphQL result, it must contain an entry with the key path that details the path of the response field which experienced the error. This allows clients to identify whether a null result is intentional or caused by a runtime error.

readonly path?: readonly string | number[];

Reserved for implementors to extend the protocol however they see fit, and hence there are no additional restrictions on its contents.

readonly extensions?: {
[key: string]: unknown;
};
}
Referenced by

Custom extensions

more
less

@remarks — Use a unique identifier name for your extension, for example the name of your library or project. Do not use a shortened identifier as this increases the risk of conflicts. We recommend you add at most one extension field, an object which can contain all the values you need.

export interface GraphQLErrorExtensions {
[key: string]: unknown;
}
Referenced by

Produce the GraphQL query recommended for a full schema introspection. Accepts optional IntrospectionOptions.

export function getIntrospectionQuery(options?: IntrospectionOptions): string

Returns an operation AST given a document AST and optionally an operation name. If a name is not provided, an operation is only returned if only one is provided in the document.

export function getOperationAST(documentAST: DocumentNode, operationName?: Maybe<string>): Maybe<OperationDefinitionNode>

Extracts the root type of the operation from the schema.

more
less

@deprecated — Please use GraphQLSchema.getRootType instead. Will be removed in v17

export function getOperationRootType(schema: GraphQLSchema, operation: OperationDefinitionNode | OperationTypeDefinitionNode): GraphQLObjectType

Build an IntrospectionQuery from a GraphQLSchema

more
less

IntrospectionQuery is useful for utilities that care about type and field relationships, but do not need to traverse through those relationships.

This is the inverse of buildClientSchema. The primary use case is outside of the server context, for instance when doing schema comparisons.

export function introspectionFromSchema(schema: GraphQLSchema, options?: IntrospectionOptions): IntrospectionQuery

Build a GraphQLSchema for use by client tools.

more
less

Given the result of a client running the introspection query, creates and returns a GraphQLSchema instance which can be then used with all graphql-js tools, but cannot be used to execute a query, as introspection does not represent the "resolver", "parse" or "serialize" functions or any other server-internal mechanisms.

This function expects a complete introspection result. Don't forget to check the "errors" field of a server response before calling this function.

export function buildClientSchema(introspection: IntrospectionQuery, options?: GraphQLSchemaValidationOptions): GraphQLSchema

This takes the ast of a schema document produced by the parse function in src/language/parser.js.

more
less

If no schema definition is provided, then it will look for types named Query, Mutation and Subscription.

Given that AST it constructs a GraphQLSchema. The resulting schema has no resolve methods, so execution will use default resolvers.

export function buildASTSchema(documentAST: DocumentNode, options?: BuildSchemaOptions): GraphQLSchema

A helper function to build a GraphQLSchema directly from a source document.

export function buildSchema(source: string | Source, options?: BuildSchemaOptions & ParseOptions): GraphQLSchema

Produces a new schema given an existing schema and a document which may contain GraphQL type extensions and definitions. The original schema will remain unaltered.

more
less

Because a schema represents a graph of references, a schema cannot be extended without effectively making an entire copy. We do not know until it's too late if subgraphs remain unchanged.

This algorithm copies the provided schema, applying extensions while producing the copy. The original schema remains unaltered.

export function extendSchema(schema: GraphQLSchema, documentAST: DocumentNode, options?: Options): GraphQLSchema
Unexported symbols referenced here
interface Options extends GraphQLSchemaValidationOptions {

Set to true to assume the SDL is valid.

more
less

Default: false

assumeValidSDL?: boolean;
}
Referenced by

Sort GraphQLSchema.

more
less

This function returns a sorted copy of the given GraphQLSchema.

export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema
export function printSchema(schema: GraphQLSchema): string
export function printType(type: GraphQLNamedType): string
export function printIntrospectionSchema(schema: GraphQLSchema): string

Given a Schema and an AST node describing a type, return a GraphQLType definition which applies to that type. For example, if provided the parsed AST node for [User], a GraphQLList instance will be returned, containing the type called "User" found in the schema. If a type called "User" is not found in the schema, then undefined will be returned.

export function typeFromAST(schema: GraphQLSchema, typeNode: NamedTypeNode): GraphQLNamedType | undefined
export function typeFromAST(schema: GraphQLSchema, typeNode: ListTypeNode): GraphQLList<any> | undefined
export function typeFromAST(schema: GraphQLSchema, typeNode: NonNullTypeNode): GraphQLNonNull<any> | undefined
export function typeFromAST(schema: GraphQLSchema, typeNode: TypeNode): GraphQLType | undefined

Produces a JavaScript value given a GraphQL Value AST.

more
less

A GraphQL type must be provided, which will be used to interpret different GraphQL Value literals.

Returns undefined when the value could not be validly coerced according to the provided type.

GraphQL ValueJSON Value
Input ObjectObject
ListArray
BooleanBoolean
StringString
Int / FloatNumber
Enum ValueUnknown
NullValuenull
export function valueFromAST(valueNode: Maybe<ValueNode>, type: GraphQLInputType, variables?: Maybe<ObjMap<unknown>>): unknown

Produces a JavaScript value given a GraphQL Value AST.

more
less

Unlike valueFromAST(), no type is provided. The resulting JavaScript value will reflect the provided GraphQL value AST.

GraphQL ValueJavaScript Value
Input ObjectObject
ListArray
BooleanBoolean
String / EnumString
Int / FloatNumber
Nullnull
export function valueFromASTUntyped(valueNode: ValueNode, variables?: Maybe<ObjMap<unknown>>): unknown

Produces a GraphQL Value AST given a JavaScript object. Function will match JavaScript/JSON values to GraphQL AST schema format by using suggested GraphQLInputType. For example:

more
less
astFromValue("value", GraphQLString)

A GraphQL type must be provided, which will be used to interpret different JavaScript values.

JSON ValueGraphQL Value
ObjectInput Object
ArrayList
BooleanBoolean
StringString / Enum Value
NumberInt / Float
UnknownEnum Value
nullNullValue
export function astFromValue(value: unknown, type: GraphQLInputType): Maybe<ValueNode>

TypeInfo is a utility class which, given a GraphQL schema, can keep track of the current field and type definitions at any point in a GraphQL document AST during a recursive descent by calling enter(node) and leave(node).

export class TypeInfo {
constructor(schema: GraphQLSchema, initialType?: Maybe<GraphQLType>, getFieldDefFn?: GetFieldDefFn)
get [Symbol.toStringTag](): string;
getParentType(): Maybe<GraphQLCompositeType>;
getInputType(): Maybe<GraphQLInputType>;
getParentInputType(): Maybe<GraphQLInputType>;
getFieldDef(): Maybe<GraphQLField<unknown, unknown>>;
getDefaultValue(): Maybe<unknown>;
getDirective(): Maybe<GraphQLDirective>;
getArgument(): Maybe<GraphQLArgument>;
getEnumValue(): Maybe<GraphQLEnumValue>;
enter(node: ASTNode): void;
leave(node: ASTNode): void;
}
Referenced by
Unexported symbols referenced here
type GetFieldDefFn = (schema: GraphQLSchema, parentType: GraphQLType, fieldNode: FieldNode) => Maybe<GraphQLField<unknown, unknown>>
Referenced by

Creates a new visitor instance which maintains a provided TypeInfo instance along with visiting visitor.

export function visitWithTypeInfo(typeInfo: TypeInfo, visitor: ASTVisitor): ASTVisitor

Coerces a JavaScript value given a GraphQL Input Type.

export function coerceInputValue(inputValue: unknown, type: GraphQLInputType, onError?: OnErrorCB): unknown
Unexported symbols referenced here
type OnErrorCB = (path: readonly string | number[], invalidValue: unknown, error: GraphQLError) => void
Referenced by

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(documents: readonly DocumentNode[]): DocumentNode

separateOperations accepts a single AST document which may contain many operations and fragments and returns a collection of AST documents each of which contains a single operation as well the fragment definitions it refers to.

export function separateOperations(documentAST: DocumentNode): ObjMap<DocumentNode>

Strips characters that are not significant to the validity or execution of a GraphQL document:

more
less
  • UnicodeBOM
  • WhiteSpace
  • LineTerminator
  • Comment
  • Comma
  • BlockString indentation

Note: It is required to have a delimiter character between neighboring non-punctuator tokens and this function always uses single space as delimiter.

It is guaranteed that both input and output documents if parsed would result in the exact same AST except for nodes location.

Warning: It is guaranteed that this function will always produce stable results. However, it's not guaranteed that it will stay the same between different releases due to bugfixes or changes in the GraphQL specification.

Query example:

query SomeQuery($foo: String!, $bar: String) {
  someField(foo: $foo, bar: $bar) {
    a
    b {
      c
      d
    }
  }
}

Becomes:

query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}

SDL example:

"""
Type description
"""
type Foo {
  """
  Field description
  """
  bar: String
}

Becomes:

"""Type description""" type Foo{"""Field description""" bar:String}
export function stripIgnoredCharacters(source: string | Source): string

Provided two types, return true if the types are equal (invariant).

export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean

Provided a type and a super type, return true if the first type is either equal or a subset of the second super type (covariant).

export function isTypeSubTypeOf(schema: GraphQLSchema, maybeSubType: GraphQLType, superType: GraphQLType): boolean

Provided two composite types, determine if they "overlap". Two composite types overlap when the Sets of possible concrete types for each intersect.

more
less

This is often used to determine if a fragment of a given type could possibly be visited in a context of another type.

This function is commutative.

export function doTypesOverlap(schema: GraphQLSchema, typeA: GraphQLCompositeType, typeB: GraphQLCompositeType): boolean

Upholds the spec rules about naming.

more
less

@deprecated — Please use assertName instead. Will be removed in v17

export function assertValidName(name: string): string

Returns an Error if a name is invalid.

more
less

@deprecated — Please use assertName instead. Will be removed in v17

export function isValidNameError(name: string): GraphQLError | undefined
export enum BreakingChangeType {
TYPE_REMOVED = "TYPE_REMOVED",
TYPE_CHANGED_KIND = "TYPE_CHANGED_KIND",
TYPE_REMOVED_FROM_UNION = "TYPE_REMOVED_FROM_UNION",
VALUE_REMOVED_FROM_ENUM = "VALUE_REMOVED_FROM_ENUM",
REQUIRED_INPUT_FIELD_ADDED = "REQUIRED_INPUT_FIELD_ADDED",
IMPLEMENTED_INTERFACE_REMOVED = "IMPLEMENTED_INTERFACE_REMOVED",
FIELD_REMOVED = "FIELD_REMOVED",
FIELD_CHANGED_KIND = "FIELD_CHANGED_KIND",
REQUIRED_ARG_ADDED = "REQUIRED_ARG_ADDED",
ARG_REMOVED = "ARG_REMOVED",
ARG_CHANGED_KIND = "ARG_CHANGED_KIND",
DIRECTIVE_REMOVED = "DIRECTIVE_REMOVED",
DIRECTIVE_ARG_REMOVED = "DIRECTIVE_ARG_REMOVED",
REQUIRED_DIRECTIVE_ARG_ADDED = "REQUIRED_DIRECTIVE_ARG_ADDED",
DIRECTIVE_REPEATABLE_REMOVED = "DIRECTIVE_REPEATABLE_REMOVED",
DIRECTIVE_LOCATION_REMOVED = "DIRECTIVE_LOCATION_REMOVED"
}
Referenced by
export enum DangerousChangeType {
VALUE_ADDED_TO_ENUM = "VALUE_ADDED_TO_ENUM",
TYPE_ADDED_TO_UNION = "TYPE_ADDED_TO_UNION",
OPTIONAL_INPUT_FIELD_ADDED = "OPTIONAL_INPUT_FIELD_ADDED",
OPTIONAL_ARG_ADDED = "OPTIONAL_ARG_ADDED",
IMPLEMENTED_INTERFACE_ADDED = "IMPLEMENTED_INTERFACE_ADDED",
ARG_DEFAULT_VALUE_CHANGE = "ARG_DEFAULT_VALUE_CHANGE"
}
Referenced by

Given two schemas, returns an Array containing descriptions of all the types of breaking changes covered by the other functions down below.

export function findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]

Given two schemas, returns an Array containing descriptions of all the types of potentially dangerous changes covered by the other functions down below.

export function findDangerousChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): DangerousChange[]
export interface IntrospectionOptions {

Whether to include descriptions in the introspection result. Default: true

descriptions?: boolean;

Whether to include specifiedByURL in the introspection result. Default: false

specifiedByUrl?: boolean;

Whether to include isRepeatable flag on directives. Default: false

directiveIsRepeatable?: boolean;

Whether to include description field on schema. Default: false

schemaDescription?: boolean;

Whether target GraphQL server support deprecation of input values. Default: false

inputValueDeprecation?: boolean;
}
Referenced by
export interface IntrospectionQuery {
readonly __schema: IntrospectionSchema;
}
Referenced by
export interface IntrospectionSchema {
readonly description?: Maybe<string>;
readonly types: readonly IntrospectionType[];
readonly directives: readonly IntrospectionDirective[];
}
Referenced by
export interface IntrospectionScalarType {
readonly kind: "SCALAR";
readonly name: string;
readonly description?: Maybe<string>;
readonly specifiedByURL?: Maybe<string>;
}
Referenced by
export interface IntrospectionObjectType {
readonly kind: "OBJECT";
readonly name: string;
readonly description?: Maybe<string>;
readonly fields: readonly IntrospectionField[];
readonly interfaces: readonly IntrospectionNamedTypeRef<IntrospectionInterfaceType>[];
}
Referenced by
export interface IntrospectionInterfaceType {
readonly kind: "INTERFACE";
readonly name: string;
readonly description?: Maybe<string>;
readonly fields: readonly IntrospectionField[];
readonly interfaces: readonly IntrospectionNamedTypeRef<IntrospectionInterfaceType>[];
readonly possibleTypes: readonly IntrospectionNamedTypeRef<IntrospectionObjectType>[];
}
Referenced by
export interface IntrospectionUnionType {
readonly kind: "UNION";
readonly name: string;
readonly description?: Maybe<string>;
readonly possibleTypes: readonly IntrospectionNamedTypeRef<IntrospectionObjectType>[];
}
Referenced by
export interface IntrospectionEnumType {
readonly kind: "ENUM";
readonly name: string;
readonly description?: Maybe<string>;
readonly enumValues: readonly IntrospectionEnumValue[];
}
Referenced by
export interface IntrospectionInputObjectType {
readonly kind: "INPUT_OBJECT";
readonly name: string;
readonly description?: Maybe<string>;
readonly inputFields: readonly IntrospectionInputValue[];
}
Referenced by
export interface IntrospectionListTypeRef<T extends IntrospectionTypeRef = IntrospectionTypeRef> {
readonly kind: "LIST";
readonly ofType: T;
}
Referenced by
export interface IntrospectionNonNullTypeRef<T extends IntrospectionTypeRef = IntrospectionTypeRef> {
readonly kind: "NON_NULL";
readonly ofType: T;
}
Referenced by
export interface IntrospectionField {
readonly name: string;
readonly description?: Maybe<string>;
readonly args: readonly IntrospectionInputValue[];
readonly isDeprecated: boolean;
readonly deprecationReason: Maybe<string>;
}
Referenced by
export interface IntrospectionInputValue {
readonly name: string;
readonly description?: Maybe<string>;
readonly defaultValue: Maybe<string>;
readonly isDeprecated?: boolean;
readonly deprecationReason?: Maybe<string>;
}
Referenced by
export interface IntrospectionEnumValue {
readonly name: string;
readonly description?: Maybe<string>;
readonly isDeprecated: boolean;
readonly deprecationReason: Maybe<string>;
}
Referenced by
export interface IntrospectionDirective {
readonly name: string;
readonly description?: Maybe<string>;
readonly isRepeatable?: boolean;
readonly locations: readonly DirectiveLocation[];
readonly args: readonly IntrospectionInputValue[];
}
Referenced by
export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {

Set to true to assume the SDL is valid.

more
less

Default: false

assumeValidSDL?: boolean;
}
Referenced by
export interface BreakingChange {
description: string;
}
Referenced by
export interface DangerousChange {
description: string;
}
Referenced by

Wrapper type that contains DocumentNode and types that can be deduced from it.

export interface TypedQueryDocumentNode<TResponseData = {
[key: string]: any;
}, TRequestVariables = {
[key: string]: any;
}> extends DocumentNode {
readonly definitions: readonly ExecutableDefinitionNode[];

This type is used to ensure that the variables you pass in to the query are assignable to Variables and that the Result is assignable to whatever you pass your result to. The method is never actually implemented, but the type is valid because we list it as optional

__ensureTypesOfVariablesAndResultMatching?: (variables: TRequestVariables) => TResponseData;
}
}