-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
types.ts
41 lines (36 loc) · 864 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type { HandlerOptions, OperationContext } from './deps.ts'
import type { RenderPageOptions } from './graphiql/render.ts'
/**
* gql options
*/
export interface GQLOptions<
Req = Request,
ReqCtx = unknown,
Context extends OperationContext = OperationContext,
> extends HandlerOptions<Req, ReqCtx, Context> {
/**
* GraphQL playground
*/
graphiql?: boolean
/**
* Custom headers for responses
*/
headers?: HeadersInit
/**
* Custom options for GraphQL Playground
*/
playgroundOptions?: Omit<RenderPageOptions, 'endpoint'>
}
interface Params {
variables?: Record<string, unknown>
operationName?: string
}
interface QueryParams extends Params {
query: string
mutation?: never
}
interface MutationParams extends Params {
mutation: string
query?: never
}
export type GraphQLParams = QueryParams | MutationParams