CX · Reference guidegraphql
PlaygroundDownloadsAboutv0.18.0-pre.1

graphql

The GraphQL client codec: text and values in, text and values out. It builds a GraphQL document as an element tree, carries that document's variables in a request envelope, reads a response envelope and the errors a 200 can hide, reads a schema from SDL or from an introspection result, validates an operation against it, measures a document's cost against a bound before the call, and projects a Relay connection's page. Every def is pure and Ring 1 — no socket, no clock, no capability, no handle: the transport is the caller's and the GraphQL server half is not this module.

graphql:parse

[$graphql:parse] -> element — Parse GraphQL executable-document text into a [document] carrying [operation …] and [fragment …] definitions; refuses unparseable text, a document over the byte bound, and a name outside GraphQL's own production.

graphql:emit

[$graphql:emit] -> string — Emit a document's canonical form — one line, no commas, one space between tokens — so two documents differing only in whitespace emit the same bytes.

graphql:schema

[$graphql:schema] -> element — Read a schema from SDL text or from a parsed introspection result into one [schema …] representation, carrying each field's nullability and list-ness as separate facts.

graphql:request

[$graphql:request] -> element — Build the wire request envelope [request query= operation-name= [variables …]] for ONE operation, carrying each supplied value as a variable and refusing an undeclared variable, a missing non-null one, a value the declared type does not carry, and a batch.

graphql:response

[$graphql:response] -> element — Read a parsed response body into [response [data] [errors] [extensions]]; refuses a body carrying neither data nor errors, an errors member that is not a list, an error with no message, and a batched list body.

graphql:outcome

[$graphql:outcome] -> element — Answer [outcome state=:ok|:partial|:failed] for a response — :partial is data and errors together, the state no status code can express.

graphql:errors

[$graphql:errors] -> [sequence element] — The [error …] children of a response in the order the server sent them; empty for a clean response.

graphql:error-code

[$graphql:error-code] -> string — An error's extensions.code verbatim, or the empty string where it carries none — read here and classified by the connector kit.

graphql:cost

[$graphql:cost] -> element — Measure a document after fragment expansion: [cost depth= aliases= fields= nodes= operations=]; a fragment cycle is refused rather than bounded.

graphql:bound

[$graphql:bound] -> element — Measure a document against the depth, alias and field bounds before the call and answer [ok], or refuse naming the bound — never a truncation and never a clamp.

graphql:validate

[$graphql:validate] -> element — Validate an operation against a schema, answering [ok] or [invalid [violation …] …] as an inspectable value; a schema this module cannot read is an err, never an empty verdict.

graphql:connection

[$graphql:connection] -> element — Project the Relay connection named by a path inside data: its nodes, its emptiness and its continuation; refuses a connection that says there is more and hands back nothing to ask with.