Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/kilatgraphql/mod.ts

Graphql middleware
Latest
import * as kilatgraphql from "https://deno.land/x/kilatgraphql@16.6.0-1/mod.ts";

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

List Type Wrapper

Non-Null Type Wrapper

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.

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

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.

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

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

Enums

The set of allowed directive location values.

The set of allowed kind values for AST nodes.

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

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:

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

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)

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.

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

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.

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 enum values.

Upholds the spec rules about naming.

f
assertValidName
deprecated

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

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

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.

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.

f
formatError
deprecated

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

Fragments on composite type

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

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.

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

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

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.

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.

f
getVisitFn
deprecated

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

Create a GraphQL AST from template literal

Create a new GraphQL HTTP middleware with schema, context etc

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

Test if the given value is a GraphQL directive.

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

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

f
isValidNameError
deprecated

Returns an Error if a name is invalid.

Known argument names

Known directives

Known fragment names

Known type names

Sort GraphQLSchema.

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.

Lone anonymous operation

Lone Schema definition

No deprecated

No fragment cycles

Prohibit introspection queries

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.

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

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.

f
printError
deprecated

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.

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.

Execute a GraphQL query

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 a non-introspection field.

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

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

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

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 definition names

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 in allowed position

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.

Interfaces

Directive Definitions

Directives

Document

The result of GraphQL execution.

Fragments

gql options

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

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Custom extensions

Name

Configuration options to control parser behavior

Represents a location in a Source.

I
SubscriptionArgs
deprecated

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

Type Aliases

Utility type listing all nodes indexed by their kind.

The list of all possible AST node types.

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

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

T
ASTVisitorKeyMap
deprecated

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

The enum type representing the directive location values.

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

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

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.

These are all of the possible kinds of types.

These types wrap and modify other types

T
KindEnum
deprecated

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

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

T
TokenKindEnum
deprecated

The enum type representing the token kinds values.

Type Definition

Type Extensions

Type Reference

Type System Definition

Type System Extensions

Values