1 | import Koa, { Next } from 'koa';
|
2 | import { Server } from 'http';
|
3 | import { Application as FeathersApplication, HookContext, Params, RouteLookup } from '@feathersjs/feathers';
|
4 | import '@feathersjs/authentication';
|
5 | export type ApplicationAddons = {
|
6 | server: Server;
|
7 | listen(port?: number, ...args: any[]): Promise<Server>;
|
8 | };
|
9 | export type Application<T = any, C = any> = Omit<Koa, 'listen'> & FeathersApplication<T, C> & ApplicationAddons;
|
10 | export type FeathersKoaContext<A = Application> = Koa.Context & {
|
11 | app: A;
|
12 | };
|
13 | export type Middleware<A = Application> = (context: FeathersKoaContext<A>, next: Next) => any;
|
14 | declare module '@feathersjs/feathers/lib/declarations' {
|
15 | interface ServiceOptions {
|
16 | koa?: {
|
17 | before?: Middleware[];
|
18 | after?: Middleware[];
|
19 | composed?: Middleware;
|
20 | };
|
21 | }
|
22 | }
|
23 | declare module 'koa' {
|
24 | interface ExtendableContext {
|
25 | feathers?: Partial<Params>;
|
26 | lookup?: RouteLookup;
|
27 | hook?: HookContext;
|
28 | }
|
29 | }
|