@deploybaseline/graphql
v0.14.0
Published
GraphQL endpoint kit for Baseline emulators: execution, coverage, connections, and errors
Readme
@deploybaseline/graphql
The GraphQL kit for Baseline emulators. The Linear and GitHub emulators run on it, and custom emulators can use it to serve a GraphQL API.
import { buildSchema, connectionFromArray, graphqlEndpoint } from "@deploybaseline/graphql";
graphqlEndpoint(app, {
schema: buildSchema(sdl),
context: (c) => ({ state, token: c.req.header("authorization") }),
root: ({ state }) => ({ books: (args) => connectionFromArray(state.books, args) }),
});- Validates every query against the schema with graphql-js, over POST (JSON, form, or
application/graphql) and GET (queries only). - A root field without a resolver answers
Query.<field> is not emulated by baseline. - Relay connections, global IDs, and error helpers.
- Declares and records root fields for Baseline's coverage gates.
Build the schema with this package's buildSchema: graphql-js refuses a schema built by a different copy of the library.
See GraphQL.
