UNPKG

1.82 kBTypeScriptView Raw
1import { ActionMetadata } from './ActionMetadata';
2import { ControllerMetadataArgs } from './args/ControllerMetadataArgs';
3import { UseMetadata } from './UseMetadata';
4import { ControllerOptions } from '../decorator-options/ControllerOptions';
5import { ResponseHandlerMetadata } from './ResponseHandleMetadata';
6import { InterceptorMetadata } from './InterceptorMetadata';
7import { Action } from '../Action';
8/**
9 * Controller metadata.
10 */
11export declare class ControllerMetadata {
12 /**
13 * Controller actions.
14 */
15 actions: ActionMetadata[];
16 /**
17 * Indicates object which is used by this controller.
18 */
19 target: Function;
20 /**
21 * Base route for all actions registered in this controller.
22 */
23 route: string;
24 /**
25 * Controller type. Can be default or json-typed. Json-typed controllers operate with json requests and responses.
26 */
27 type: 'default' | 'json';
28 /**
29 * Options that apply to all controller actions.
30 */
31 options: ControllerOptions;
32 /**
33 * Middleware "use"-s applied to a whole controller.
34 */
35 uses: UseMetadata[];
36 /**
37 * Middleware "use"-s applied to a whole controller.
38 */
39 interceptors: InterceptorMetadata[];
40 /**
41 * Indicates if this action uses Authorized decorator.
42 */
43 isAuthorizedUsed: boolean;
44 /**
45 * Roles set by @Authorized decorator.
46 */
47 authorizedRoles: any[];
48 constructor(args: ControllerMetadataArgs);
49 /**
50 * Gets instance of the controller.
51 * @param action Details around the request session
52 */
53 getInstance(action: Action): any;
54 /**
55 * Builds everything controller metadata needs.
56 * Controller metadata should be used only after its build.
57 */
58 build(responseHandlers: ResponseHandlerMetadata[]): void;
59}