Repository URL to install this package:
|
Version:
2.0.11 ▾
|
import { Request as ExpressRequest, Response as ExpressResponse } from 'express'
import { config, Request as OneRequest } from '@skava/request'
import * as endpoints from './endpoints'
import { DataSources } from 'apollo-server-core/dist/graphqlOptions'
import { DataSource } from 'apollo-datasource'
import { EMPTY_OBJ } from 'exotic'
export interface ExpressRequest extends ExpressRequest {
isSafe: boolean
}
export interface ExpressResponse extends ExpressResponse {
}
export interface ResolverObj {
self: any
}
export interface ResolverArgs<Args = any> {
// @todo remove @any...
[key: string]: string | number | boolean | ResolverArgs<Args> | Array<ResolverArgs> | undefined | any
}
// meta
export interface ResolverInfo {
cacheControl: any
directives: any
}
export type Context = typeof endpoints & {
req: ExpressRequest
res: ExpressResponse
// @note this was in the fork, but this is done in the .prototype hack above
request: Request
dataSources: DataSources<Context>
}
export interface ResolverFunction<Type = any> extends Function {
(obj: ResolverObj, args: ResolverArgs, context: Context, info: ResolverInfo): Promise<Type> | Type
}
export interface ResolverType<Type = any> {
[key: string]: ResolverFunction
}
export interface ResolverExport<Type = any> {
Query?: ResolverType<Type>
Mutation?: ResolverType<Type>
}