forked from dotansimha/graphql-yoga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
97 lines (83 loc) · 2.42 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { Request } from 'express'
import { CorsOptions } from 'cors'
import {
GraphQLSchema,
GraphQLFieldResolver,
GraphQLScalarType,
GraphQLIsTypeOfFn,
GraphQLTypeResolver,
ValidationContext,
} from 'graphql'
import { IDirectiveResolvers, ITypeDefinitions } from 'graphql-tools/dist/Interfaces'
import { ExecutionParams } from 'subscriptions-transport-ws'
import { LogFunction } from 'apollo-server-core'
export interface IResolvers {
[key: string]: (() => any) | IResolverObject | GraphQLScalarType
}
export type IResolverObject = {
[key: string]: GraphQLFieldResolver<any, any> | IResolverOptions,
}
export interface IResolverOptions {
resolve?: GraphQLFieldResolver<any, any>
subscribe?: GraphQLFieldResolver<any, any>
__resolveType?: GraphQLTypeResolver<any, any>
__isTypeOf?: GraphQLIsTypeOfFn<any, any>
}
export type Context = { [key: string]: any }
export interface ContextParameters {
request: Request
connection: ExecutionParams
}
export type ContextCallback = (params: ContextParameters) => Context
export interface UploadOptions {
maxFieldSize?: number
maxFileSize?: number
maxFiles?: number
}
export interface TracingOptions {
mode: 'enabled' | 'disabled' | 'http-header'
}
export interface ApolloServerOptions {
tracing?: boolean | TracingOptions
cacheControl?: boolean
formatError?: Function
logFunction?: LogFunction
rootValue?: any
validationRules?: Array<(context: ValidationContext) => any>
fieldResolver?: GraphQLFieldResolver<any, any>
formatParams?: Function
formatResponse?: Function
debug?: boolean
}
export interface Options extends ApolloServerOptions {
port?: number
cors?: CorsOptions | false
uploads?: UploadOptions | false
endpoint?: string
subscriptions?: SubscriptionServerOptions | string | false
playground?: string | false
}
export interface SubscriptionServerOptions {
path?: string
onConnect?: Function
onDisconnect?: Function
keepAlive?: number
}
export interface Props {
directiveResolvers?: IDirectiveResolvers<any, any>
typeDefs?: ITypeDefinitions
resolvers?: IResolvers
schema?: GraphQLSchema
context?: Context | ContextCallback
}
export interface LambdaProps {
directiveResolvers?: IDirectiveResolvers<any, any>
typeDefs?: string
resolvers?: IResolvers
schema?: GraphQLSchema
context?: Context | ContextCallback
options?: LambdaOptions
}
export interface LambdaOptions extends ApolloServerOptions {
endpoint?: string
}