UNPKG

@as-integrations/koa

Version:
15 lines 1.08 kB
import type { WithRequired } from '@apollo/utils.withrequired'; import { type ApolloServer, type BaseContext, type ContextFunction } from '@apollo/server'; import type Koa from 'koa'; export interface KoaContextFunctionArgument<StateT = Koa.DefaultState, ContextT = Koa.DefaultContext> { ctx: Koa.ParameterizedContext<StateT, ContextT>; } interface KoaMiddlewareOptions<TContext extends BaseContext, StateT, ContextT> { context?: ContextFunction<[ KoaContextFunctionArgument<StateT, ContextT> ], TContext>; } export declare function koaMiddleware<StateT = Koa.DefaultState, ContextT = Koa.DefaultContext>(server: ApolloServer<BaseContext>, options?: KoaMiddlewareOptions<BaseContext, StateT, ContextT>): Koa.Middleware<StateT, ContextT>; export declare function koaMiddleware<TContext extends BaseContext, StateT = Koa.DefaultState, ContextT = Koa.DefaultContext>(server: ApolloServer<TContext>, options: WithRequired<KoaMiddlewareOptions<TContext, StateT, ContextT>, 'context'>): Koa.Middleware<StateT, ContextT>; export {}; //# sourceMappingURL=index.d.ts.map