UNPKG

1.92 kBTypeScriptView Raw
1import { Action } from './Action';
2import { BaseDriver } from './driver/BaseDriver';
3import { ActionMetadata } from './metadata/ActionMetadata';
4import { InterceptorMetadata } from './metadata/InterceptorMetadata';
5import { RoutingControllersOptions } from './RoutingControllersOptions';
6/**
7 * Registers controllers and middlewares in the given server framework.
8 */
9export declare class RoutingControllers<T extends BaseDriver> {
10 private driver;
11 private options;
12 /**
13 * Used to check and handle controller action parameters.
14 */
15 private parameterHandler;
16 /**
17 * Used to build metadata objects for controllers and middlewares.
18 */
19 private metadataBuilder;
20 /**
21 * Global interceptors run on each controller action.
22 */
23 private interceptors;
24 constructor(driver: T, options: RoutingControllersOptions);
25 /**
26 * Initializes the things driver needs before routes and middleware registration.
27 */
28 initialize(): this;
29 /**
30 * Registers all given interceptors.
31 */
32 registerInterceptors(classes?: Function[]): this;
33 /**
34 * Registers all given controllers and actions from those controllers.
35 */
36 registerControllers(classes?: Function[]): this;
37 /**
38 * Registers post-execution middlewares in the driver.
39 */
40 registerMiddlewares(type: 'before' | 'after', classes?: Function[]): this;
41 /**
42 * Executes given controller action.
43 */
44 protected executeAction(actionMetadata: ActionMetadata, action: Action, interceptorFns: Function[]): Promise<any>;
45 /**
46 * Handles result of the action method execution.
47 */
48 protected handleCallMethodResult(result: any, action: ActionMetadata, options: Action, interceptorFns: Function[]): any;
49 /**
50 * Creates interceptors from the given "use interceptors".
51 */
52 protected prepareInterceptors(uses: InterceptorMetadata[]): Function[];
53}