UNPKG

1.06 kBTypeScriptView Raw
1import type { FormattedExecutionResult } from 'graphql';
2export interface GraphiQLData {
3 query?: string | null;
4 variables?: {
5 readonly [name: string]: unknown;
6 } | null;
7 operationName?: string | null;
8 result?: FormattedExecutionResult;
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 * An optional boolean which enables the header editor when true.
19 * Defaults to false.
20 */
21 headerEditorEnabled?: boolean;
22}
23/**
24 * When express-graphql receives a request which does not Accept JSON, but does
25 * Accept HTML, it may present GraphiQL, the in-browser GraphQL explorer IDE.
26 *
27 * When shown, it will be pre-populated with the result of having executed the
28 * requested query.
29 */
30export declare function renderGraphiQL(data: GraphiQLData, options?: GraphiQLOptions): string;