UNPKG

1.37 kBTypeScriptView Raw
1import { Type } from '../interfaces';
2import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
3import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
4/**
5 * @publicApi
6 */
7export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {
8 items?: Type<unknown>;
9 separator?: string;
10 optional?: boolean;
11 exceptionFactory?: (error: any) => any;
12}
13/**
14 * Defines the built-in ParseArray Pipe
15 *
16 * @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
17 *
18 * @publicApi
19 */
20export declare class ParseArrayPipe implements PipeTransform {
21 protected readonly options: ParseArrayOptions;
22 protected readonly validationPipe: ValidationPipe;
23 protected exceptionFactory: (error: string) => any;
24 constructor(options?: ParseArrayOptions);
25 /**
26 * Method that accesses and performs optional transformation on argument for
27 * in-flight requests.
28 *
29 * @param value currently processed route argument
30 * @param metadata contains metadata about the currently processed route argument
31 */
32 transform(value: any, metadata: ArgumentMetadata): Promise<any>;
33 protected isExpectedTypePrimitive(): boolean;
34 protected validatePrimitive(originalValue: any, index?: number): any;
35}