1 | import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';
|
2 | import { TransformerPackage } from '../interfaces/external/transformer-package.interface';
|
3 | import { ValidationError } from '../interfaces/external/validation-error.interface';
|
4 | import { ValidatorOptions } from '../interfaces/external/validator-options.interface';
|
5 | import { ValidatorPackage } from '../interfaces/external/validator-package.interface';
|
6 | import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
|
7 | import { Type } from '../interfaces/type.interface';
|
8 | import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
|
9 |
|
10 |
|
11 |
|
12 | export interface ValidationPipeOptions extends ValidatorOptions {
|
13 | transform?: boolean;
|
14 | disableErrorMessages?: boolean;
|
15 | transformOptions?: ClassTransformOptions;
|
16 | errorHttpStatusCode?: ErrorHttpStatusCode;
|
17 | exceptionFactory?: (errors: ValidationError[]) => any;
|
18 | validateCustomDecorators?: boolean;
|
19 | expectedType?: Type<any>;
|
20 | validatorPackage?: ValidatorPackage;
|
21 | transformerPackage?: TransformerPackage;
|
22 | }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export declare class ValidationPipe implements PipeTransform<any> {
|
29 | protected isTransformEnabled: boolean;
|
30 | protected isDetailedOutputDisabled?: boolean;
|
31 | protected validatorOptions: ValidatorOptions;
|
32 | protected transformOptions: ClassTransformOptions;
|
33 | protected errorHttpStatusCode: ErrorHttpStatusCode;
|
34 | protected expectedType: Type<any>;
|
35 | protected exceptionFactory: (errors: ValidationError[]) => any;
|
36 | protected validateCustomDecorators: boolean;
|
37 | constructor(options?: ValidationPipeOptions);
|
38 | protected loadValidator(validatorPackage?: ValidatorPackage): ValidatorPackage;
|
39 | protected loadTransformer(transformerPackage?: TransformerPackage): TransformerPackage;
|
40 | transform(value: any, metadata: ArgumentMetadata): Promise<any>;
|
41 | createExceptionFactory(): (validationErrors?: ValidationError[]) => unknown;
|
42 | protected toValidate(metadata: ArgumentMetadata): boolean;
|
43 | protected transformPrimitive(value: any, metadata: ArgumentMetadata): any;
|
44 | protected toEmptyIfNil<T = any, R = any>(value: T): R | {};
|
45 | protected stripProtoKeys(value: any): void;
|
46 | protected isPrimitive(value: unknown): boolean;
|
47 | protected validate(object: object, validatorOptions?: ValidatorOptions): Promise<ValidationError[]> | ValidationError[];
|
48 | protected flattenValidationErrors(validationErrors: ValidationError[]): string[];
|
49 | protected mapChildrenToValidationErrors(error: ValidationError, parentPath?: string): ValidationError[];
|
50 | protected prependConstraintsWithParentProp(parentPath: string, error: ValidationError): ValidationError;
|
51 | }
|