1 | import { Request, ValidationError } from '../base';
|
2 | import { ReadonlyContext } from '../context';
|
3 | import { Result } from '../validation-result';
|
4 | export type ContextRunningOptions = {
|
5 | /**
|
6 | * Defines whether errors and sanitization should be persisted to `req`.
|
7 | * @default false
|
8 | */
|
9 | dryRun?: boolean;
|
10 | };
|
11 | export interface ResultWithContext extends Result<ValidationError> {
|
12 | readonly context: ReadonlyContext;
|
13 | }
|
14 | export interface ContextRunner {
|
15 | /**
|
16 | * Runs the current validation chain.
|
17 | * @param req the express request to validate
|
18 | * @param options an object of options to customize how the chain will be run
|
19 | * @returns a promise for a {@link Result} that resolves when the validation chain has finished
|
20 | */
|
21 | run(req: Request, options?: ContextRunningOptions): Promise<ResultWithContext>;
|
22 | }
|