UNPKG

994 BTypeScriptView Raw
1import { ExecutionResult } from 'graphql';
2
3export interface GraphiQLData {
4 query?: string | null;
5 variables?: { readonly [name: string]: unknown } | null;
6 operationName?: string | null;
7 result?: ExecutionResult;
8}
9
10export interface GraphiQLOptions {
11 /**
12 * An optional GraphQL string to use when no query is provided and no stored
13 * query exists from a previous session. If undefined is provided, GraphiQL
14 * will use its own default query.
15 */
16 defaultQuery?: string;
17
18 /**
19 * An optional boolean which enables the header editor when true.
20 * Defaults to false.
21 */
22 headerEditorEnabled?: boolean;
23}
24
25/**
26 * When express-graphql receives a request which does not Accept JSON, but does
27 * Accept HTML, it may present GraphiQL, the in-browser GraphQL explorer IDE.
28 *
29 * When shown, it will be pre-populated with the result of having executed the
30 * requested query.
31 */
32export function renderGraphiQL(
33 data: GraphiQLData,
34 options?: GraphiQLOptions,
35): string;