1 | import { Action } from '../../Action';
|
2 | import { ActionMetadata } from '../../metadata/ActionMetadata';
|
3 | import { BaseDriver } from '../BaseDriver';
|
4 | import { MiddlewareMetadata } from '../../metadata/MiddlewareMetadata';
|
5 | import { ParamMetadata } from '../../metadata/ParamMetadata';
|
6 | import { UseMetadata } from '../../metadata/UseMetadata';
|
7 |
|
8 |
|
9 |
|
10 | export declare class KoaDriver extends BaseDriver {
|
11 | koa?: any;
|
12 | router?: any;
|
13 | constructor(koa?: any, router?: any);
|
14 | /**
|
15 | * Initializes the things driver needs before routes and middleware registration.
|
16 | */
|
17 | initialize(): void;
|
18 | /**
|
19 | * Registers middleware that run before controller actions.
|
20 | */
|
21 | registerMiddleware(middleware: MiddlewareMetadata): void;
|
22 | /**
|
23 | * Registers action in the driver.
|
24 | */
|
25 | registerAction(actionMetadata: ActionMetadata, executeCallback: (options: Action) => any): void;
|
26 | /**
|
27 | * Registers all routes in the framework.
|
28 | */
|
29 | registerRoutes(): void;
|
30 | /**
|
31 | * Gets param from the request.
|
32 | */
|
33 | getParamFromRequest(actionOptions: Action, param: ParamMetadata): any;
|
34 | /**
|
35 | * Handles result of successfully executed controller action.
|
36 | */
|
37 | handleSuccess(result: any, action: ActionMetadata, options: Action): void;
|
38 | /**
|
39 | * Handles result of failed executed controller action.
|
40 | */
|
41 | handleError(error: any, action: ActionMetadata | undefined, options: Action): Promise<void>;
|
42 | /**
|
43 | * Creates middlewares from the given "use"-s.
|
44 | */
|
45 | protected prepareMiddlewares(uses: UseMetadata[]): Function[];
|
46 | /**
|
47 | * Dynamically loads koa module.
|
48 | */
|
49 | protected loadKoa(): void;
|
50 | /**
|
51 | * Dynamically loads @koa/router module.
|
52 | */
|
53 | private loadRouter;
|
54 | /**
|
55 | * Dynamically loads @koa/multer module.
|
56 | */
|
57 | private loadMulter;
|
58 | }
|