Skip to main content
Module

x/graphql_deno/lib/index.js

GraphQL-JS ported to Deno
Latest
import * as graphqlDeno from "https://deno.land/x/graphql_deno@v15.0.0/lib/index.js";

Classes

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

Enum Type Definition

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.

Input Object Type Definition

Interface Type Definition

Object Type Definition

Scalar Type Definition

Schema Definition

Union Type Definition

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.

A representation of source input to GraphQL. name and locationOffset are optional. 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: 0 }. line and column in locationOffset are 1-indexed

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

Variables

Constant string used for default reason for a deprecation.

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.

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

The set of allowed directive location values.

Used to declare element of a GraphQL schema as deprecated.

Used to conditionally include fields or fragments.

Used to conditionally skip (exclude) fields or fragments.

The set of allowed kind values for AST nodes.

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

The full list of specified directives.

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

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

A string containing the version of the GraphQL.js library

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

Functions

Upholds the spec rules about naming.

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

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:

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

Build a GraphQLSchema for use by client tools.

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

Coerces a JavaScript value given a GraphQL Input Type.

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.

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

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

Executable definitions

Data that must be available at all points during query execution.

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.

Fields on correct type

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

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

A validation rule which reports deprecated usages.

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

Fragments on composite type

f
getDescription
deprecated

Given an ast node, returns its string description.

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.

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

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.

Extracts the root type of the operation from the schema.

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

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

List Type Wrapper

Non-Null Type Wrapper

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.

Build an IntrospectionQuery from a GraphQLSchema

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

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

Test if the given value is a GraphQL directive.

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

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

These types may describe types which may be leaf values.

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

These types can all accept null as a value.

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

There are predicates for each kind of GraphQL type.

Test if the given value is a GraphQL schema.

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

Returns an Error if a name is invalid.

These types wrap and modify other types

Known argument names

Known directives

Known fragment names

Known type names

Sort GraphQLSchema.

Given an arbitrary Error, 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.

Lone anonymous operation

Lone Schema definition

No undefined variables

No unused fragments

No unused variables

Overlapping fields can be merged

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

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

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

Possible fragment spread

Possible type extension

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

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

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

Accepts options as a second argument:

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

Provided required arguments

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

Scalar leafs

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.

Subscriptions must only include one field.

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

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

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

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.

Unique argument names

Unique directive names

Unique directive names per location

Unique enum value names

Unique field definition names

Unique fragment names

Unique input field names

Unique operation names

Unique operation types

Unique type names

Unique variable names

Implements the "Validation" section of the spec.

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

Produces a JavaScript value given a GraphQL Value AST.

Produces a JavaScript value given a GraphQL Value AST.

Value literals of correct type

Variables are input types

Variables passed to field arguments conform to type

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.

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.

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