UNPKG

2.08 kBTypeScriptView Raw
1import { ValidatorOptions } from 'class-validator';
2import { ActionMetadata } from './ActionMetadata';
3import { ParamMetadataArgs } from './args/ParamMetadataArgs';
4import { ParamType } from './types/ParamType';
5import { ClassTransformOptions } from 'class-transformer';
6import { Action } from '../Action';
7/**
8 * Action Parameter metadata.
9 */
10export declare class ParamMetadata {
11 /**
12 * Parameter's action.
13 */
14 actionMetadata: ActionMetadata;
15 /**
16 * Object on which's method's parameter this parameter is attached.
17 */
18 object: any;
19 /**
20 * Method on which's parameter is attached.
21 */
22 method: string;
23 /**
24 * Index (# number) of the parameter in the method signature.
25 */
26 index: number;
27 /**
28 * Parameter type.
29 */
30 type: ParamType;
31 /**
32 * Parameter name.
33 */
34 name: string;
35 /**
36 * Parameter target type.
37 */
38 targetType?: any;
39 /**
40 * Parameter target type's name in lowercase.
41 */
42 targetName: string;
43 /**
44 * Indicates if target type is an object.
45 */
46 isTargetObject: boolean;
47 /**
48 * Parameter target.
49 */
50 target: any;
51 /**
52 * Specifies if parameter should be parsed as json or not.
53 */
54 parse: boolean;
55 /**
56 * Indicates if this parameter is required or not
57 */
58 required: boolean;
59 /**
60 * Transforms the value.
61 */
62 transform: (action: Action, value?: any) => Promise<any> | any;
63 /**
64 * Additional parameter options.
65 * For example it can be uploader middleware options or body-parser middleware options.
66 */
67 extraOptions: any;
68 /**
69 * Class transform options used to perform plainToClass operation.
70 */
71 classTransform?: ClassTransformOptions;
72 /**
73 * If true, class-validator will be used to validate param object.
74 * If validation options are given then it means validation will be applied (is true).
75 */
76 validate?: boolean | ValidatorOptions;
77 constructor(actionMetadata: ActionMetadata, args: ParamMetadataArgs);
78}