Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

§Classes

GraphQLDirective

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

GraphQLEnumType

Enum Type Definition

GraphQLError

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.

GraphQLInputObjectType

Input Object Type Definition

GraphQLInterfaceType

Interface Type Definition

GraphQLList

List Type Wrapper

GraphQLNonNull

Non-Null Type Wrapper

GraphQLObjectType

Object Type Definition

GraphQLScalarType

Scalar Type Definition

GraphQLSchema

Schema Definition

GraphQLUnionType

Union Type Definition

Lexer

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.

Location

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

Source

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.

Token

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

TypeInfo

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).

ValidationContext

§Enums

BreakingChangeType
DangerousChangeType
DirectiveLocation

The set of allowed directive location values.

Kind

The set of allowed kind values for AST nodes.

OperationTypeNode
TokenKind

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

TypeKind

§Variables

__Directive
__DirectiveLocation
__EnumValue
__Field
__InputValue
__Schema
__Type
__TypeKind
BREAK
DEFAULT_DEPRECATION_REASON

Constant string used for default reason for a deprecation.

defaultFieldResolver

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.

defaultTypeResolver

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

GRAPHQL_MAX_INT

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

GRAPHQL_MIN_INT

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)

GraphQLBoolean
GraphQLDeprecatedDirective

Used to declare element of a GraphQL schema as deprecated.

GraphQLFloat
GraphQLID
GraphQLIncludeDirective

Used to conditionally include fields or fragments.

GraphQLInt
GraphQLSkipDirective

Used to conditionally skip (exclude) fields or fragments.

GraphQLSpecifiedByDirective

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

GraphQLString
introspectionTypes
SchemaMetaFieldDef

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

specifiedDirectives

The full list of specified directives.

specifiedRules

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

specifiedScalarTypes
TypeMetaFieldDef
TypeNameMetaFieldDef
version

A string containing the version of the GraphQL.js library

versionInfo

An object containing the components of the GraphQL.js version string

§Functions

assertAbstractType
assertCompositeType
assertDirective
assertEnumType
assertEnumValueName

Upholds the spec rules about naming enum values.

assertInputObjectType
assertInputType
assertInterfaceType
assertLeafType
assertListType
assertName

Upholds the spec rules about naming.

assertNamedType
assertNonNullType
assertNullableType
assertObjectType
assertOutputType
assertScalarType
assertSchema
assertType
assertUnionType
assertValidName deprecated

Upholds the spec rules about naming.

assertValidSchema

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

assertWrappingType
astFromValue

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:

buildASTSchema

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

buildClientSchema

Build a GraphQLSchema for use by client tools.

buildSchema

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

coerceInputValue

Coerces a JavaScript value given a GraphQL Input Type.

concatAST

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.

createSourceEventStream

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

doTypesOverlap

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

ExecutableDefinitionsRule

Executable definitions

execute

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

executeSync

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.

extendSchema

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.

FieldsOnCorrectTypeRule

Fields on correct type

findBreakingChanges

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

findDangerousChanges

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

formatError deprecated

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

FragmentsOnCompositeTypesRule

Fragments on composite type

getArgumentValues

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

getDirectiveValues

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.

getEnterLeaveForKind

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

getIntrospectionQuery

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

getLocation

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

getNamedType
getNullableType
getOperationAST

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.

getOperationRootType deprecated

Extracts the root type of the operation from the schema.

getVariableValues

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.

getVisitFn deprecated

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

graphql
graphqlSync

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.

introspectionFromSchema

Build an IntrospectionQuery from a GraphQLSchema

isAbstractType
isCompositeType
isConstValueNode
isDefinitionNode
isDirective

Test if the given value is a GraphQL directive.

isEnumType
isEqualType

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

isExecutableDefinitionNode
isInputObjectType
isInputType
isInterfaceType
isIntrospectionType
isLeafType
isListType
isNamedType
isNonNullType
isNullableType
isObjectType
isOutputType
isRequiredArgument
isRequiredInputField
isScalarType

There are predicates for each kind of GraphQL type.

isSchema

Test if the given value is a GraphQL schema.

isSelectionNode
isSpecifiedDirective
isSpecifiedScalarType
isType
isTypeDefinitionNode
isTypeExtensionNode
isTypeNode
isTypeSubTypeOf

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).

isTypeSystemDefinitionNode
isTypeSystemExtensionNode
isUnionType
isValidNameError deprecated

Returns an Error if a name is invalid.

isValueNode
isWrappingType
KnownArgumentNamesRule

Known argument names

KnownDirectivesRule

Known directives

KnownFragmentNamesRule

Known fragment names

KnownTypeNamesRule

Known type names

lexicographicSortSchema

Sort GraphQLSchema.

locatedError

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.

LoneAnonymousOperationRule

Lone anonymous operation

LoneSchemaDefinitionRule

Lone Schema definition

NoDeprecatedCustomRule

No deprecated

NoFragmentCyclesRule

No fragment cycles

NoSchemaIntrospectionCustomRule

Prohibit introspection queries

NoUndefinedVariablesRule

No undefined variables

NoUnusedFragmentsRule

No unused fragments

NoUnusedVariablesRule

No unused variables

OverlappingFieldsCanBeMergedRule

Overlapping fields can be merged

parse

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

parseConstValue

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

parseType

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

parseValue

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

PossibleFragmentSpreadsRule

Possible fragment spread

PossibleTypeExtensionsRule

Possible type extension

print

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

printError deprecated

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

printIntrospectionSchema
printLocation

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

printSchema
printSourceLocation

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

printType
ProvidedRequiredArgumentsRule

Provided required arguments

resolveObjMapThunk
resolveReadonlyArrayThunk
responsePathAsArray

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

ScalarLeafsRule

Scalar leafs

separateOperations

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.

SingleFieldSubscriptionsRule

Subscriptions must only include a non-introspection field.

stripIgnoredCharacters

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

  • UnicodeBOM
  • WhiteSpace
  • LineTerminator
  • Comment
  • Comma
  • BlockString indentation
subscribe

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

syntaxError

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

typeFromAST

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.

UniqueArgumentDefinitionNamesRule

Unique argument definition names

UniqueArgumentNamesRule

Unique argument names

UniqueDirectiveNamesRule

Unique directive names

UniqueDirectivesPerLocationRule

Unique directive names per location

UniqueEnumValueNamesRule

Unique enum value names

UniqueFieldDefinitionNamesRule

Unique field definition names

UniqueFragmentNamesRule

Unique fragment names

UniqueInputFieldNamesRule

Unique input field names

UniqueOperationNamesRule

Unique operation names

UniqueOperationTypesRule

Unique operation types

UniqueTypeNamesRule

Unique type names

UniqueVariableNamesRule

Unique variable names

validate

Implements the "Validation" section of the spec.

validateSchema

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

valueFromAST

Produces a JavaScript value given a GraphQL Value AST.

valueFromASTUntyped

Produces a JavaScript value given a GraphQL Value AST.

ValuesOfCorrectTypeRule

Value literals of correct type

VariablesAreInputTypesRule

Variables are input types

VariablesInAllowedPositionRule

Variables in allowed position

visit

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.

visitInParallel

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.

visitWithTypeInfo

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

§Interfaces

ArgumentNode
BooleanValueNode
BreakingChange
BuildSchemaOptions
ConstArgumentNode
ConstDirectiveNode
ConstListValueNode
ConstObjectFieldNode
ConstObjectValueNode
DangerousChange
DirectiveDefinitionNode

Directive Definitions

DirectiveNode

Directives

DocumentNode

Document

EnumTypeDefinitionNode
EnumTypeExtensionNode
EnumValueDefinitionNode
EnumValueNode
ExecutionArgs
ExecutionResult

The result of GraphQL execution.

FieldDefinitionNode
FieldNode
FloatValueNode
FormattedExecutionResult
FragmentDefinitionNode
FragmentSpreadNode

Fragments

GraphQLArgs

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

GraphQLArgument
GraphQLArgumentConfig
GraphQLArgumentExtensions

Custom extensions

GraphQLDirectiveConfig
GraphQLDirectiveExtensions

Custom extensions

GraphQLEnumTypeConfig
GraphQLEnumTypeExtensions

Custom extensions

GraphQLEnumValue
GraphQLEnumValueConfig
GraphQLEnumValueExtensions

Custom extensions

GraphQLErrorExtensions

Custom extensions

GraphQLErrorOptions
GraphQLField
GraphQLFieldConfig
GraphQLFieldExtensions

Custom extensions

GraphQLFormattedError

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

GraphQLInputField
GraphQLInputFieldConfig
GraphQLInputFieldExtensions

Custom extensions

GraphQLInputObjectTypeConfig
GraphQLInputObjectTypeExtensions

Custom extensions

GraphQLInterfaceTypeConfig
GraphQLInterfaceTypeExtensions

Custom extensions

GraphQLObjectTypeConfig
GraphQLObjectTypeExtensions

Custom extensions

GraphQLResolveInfo
GraphQLScalarTypeConfig
GraphQLScalarTypeExtensions

Custom extensions

GraphQLSchemaConfig
GraphQLSchemaExtensions

Custom extensions

GraphQLUnionTypeConfig
GraphQLUnionTypeExtensions

Custom extensions

InlineFragmentNode
InputObjectTypeDefinitionNode
InputObjectTypeExtensionNode
InputValueDefinitionNode
InterfaceTypeDefinitionNode
InterfaceTypeExtensionNode
IntrospectionDirective
IntrospectionEnumType
IntrospectionEnumValue
IntrospectionField
IntrospectionInputObjectType
IntrospectionInputValue
IntrospectionInterfaceType
IntrospectionListTypeRef
IntrospectionNamedTypeRef
IntrospectionNonNullTypeRef
IntrospectionObjectType
IntrospectionOptions
IntrospectionQuery
IntrospectionScalarType
IntrospectionSchema
IntrospectionUnionType
IntValueNode
ListTypeNode
ListValueNode
NamedTypeNode
NameNode

Name

NonNullTypeNode
NullValueNode
ObjectFieldNode
ObjectTypeDefinitionNode
ObjectTypeExtensionNode
ObjectValueNode
OperationDefinitionNode
OperationTypeDefinitionNode
ParseOptions

Configuration options to control parser behavior

ResponsePath
ScalarTypeDefinitionNode
ScalarTypeExtensionNode
SchemaDefinitionNode
SchemaExtensionNode
SelectionSetNode
SourceLocation

Represents a location in a Source.

StringValueNode
SubscriptionArgs deprecated
TypedQueryDocumentNode

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

UnionTypeDefinitionNode
UnionTypeExtensionNode
VariableDefinitionNode
VariableNode

§Type Aliases

ASTKindToNode

Utility type listing all nodes indexed by their kind.

ASTNode

The list of all possible AST node types.

ASTVisitFn

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

ASTVisitor

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

ASTVisitorKeyMap deprecated

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

ConstValueNode
DefinitionNode
DirectiveLocationEnum deprecated

The enum type representing the directive location values.

ExecutableDefinitionNode
GraphQLAbstractType

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

GraphQLCompositeType

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

GraphQLEnumValueConfigMap
GraphQLFieldConfigArgumentMap
GraphQLFieldConfigMap
GraphQLFieldMap
GraphQLFieldResolver
GraphQLInputFieldConfigMap
GraphQLInputFieldMap
GraphQLInputType

These types may be used as input types for arguments and directives.

GraphQLIsTypeOfFn
GraphQLLeafType

These types may describe types which may be leaf values.

GraphQLNamedInputType
GraphQLNamedOutputType
GraphQLNamedType

These named types do not include modifiers like List or NonNull.

GraphQLNullableType

These types can all accept null as a value.

GraphQLOutputType

These types may be used as output types as the result of fields.

GraphQLScalarLiteralParser
GraphQLScalarSerializer
GraphQLScalarValueParser
GraphQLType

These are all of the possible kinds of types.

GraphQLTypeResolver
GraphQLWrappingType

These types wrap and modify other types

IntrospectionInputType
IntrospectionInputTypeRef
IntrospectionOutputType
IntrospectionOutputTypeRef
IntrospectionType
IntrospectionTypeRef
KindEnum deprecated

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

SelectionNode
ThunkObjMap
ThunkReadonlyArray

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

TokenKindEnum deprecated

The enum type representing the token kinds values.

TypeDefinitionNode

Type Definition

TypeExtensionNode

Type Extensions

TypeNode

Type Reference

TypeSystemDefinitionNode

Type System Definition

TypeSystemExtensionNode

Type System Extensions

ValidationRule
ValueNode

Values