/home2/dakshskx/test.dakshadesign.com/node_modules/express-validator/lib
NameSizeModeActions
chain/-0755rm
context-items/-0755rm
middlewares/-0755rm
base.d.ts56210644editdlrm
base.js3000644editdlrm
context-builder.d.ts5660644editdlrm
context-builder.js10480644editdlrm
context.d.ts18630644editdlrm
context.js39520644editdlrm
express-validator.d.ts78320644editdlrm
express-validator.js59280644editdlrm
field-selection.d.ts10340644editdlrm
field-selection.js76210644editdlrm
index.d.ts6770644editdlrm
index.js11330644editdlrm
matched-data.d.ts9230644editdlrm
matched-data.js18440644editdlrm
options.d.ts136300644editdlrm
options.js770644editdlrm
utils.d.ts6880644editdlrm
utils.js18370644editdlrm
validation-result.d.ts22380644editdlrm
validation-result.js25310644editdlrm
Edit: /home2/dakshskx/test.dakshadesign.com/node_modules/express-validator/lib/express-validator.d.ts (7832B)
import { CustomSanitizer, CustomValidator, ErrorMessage, FieldMessageFactory, Location, Middleware, Request, ValidationError } from './base'; import { ContextRunner, ValidationChain } from './chain'; import { MatchedDataOptions } from './matched-data'; import { checkExact } from './middlewares/exact'; import { OneOfOptions } from './middlewares/one-of'; import { DefaultSchemaKeys, ExtensionSanitizerSchemaOptions, ExtensionValidatorSchemaOptions, ParamSchema, RunnableValidationChains } from './middlewares/schema'; import { ErrorFormatter, Result } from './validation-result'; declare type CustomValidatorsMap = Record; declare type CustomSanitizersMap = Record; declare type CustomOptions = { errorFormatter?: ErrorFormatter; }; /** * A validation chain that contains some extension validators/sanitizers. * * Built-in methods return the same chain type so that chaining using more of the extensions is * possible. * * @example * ``` * function createChain(chain: ValidationChainWithExtensions<'isAllowedDomain' | 'removeEmailAttribute'>) { * return chain * .isEmail() * .isAllowedDomain() * .trim() * .removeEmailAttribute(); * } * ``` */ export declare type ValidationChainWithExtensions = Middleware & { [K in keyof ValidationChain]: ValidationChain[K] extends (...args: infer A) => ValidationChain ? (...params: A) => ValidationChainWithExtensions : ValidationChain[K]; } & { [K in T]: () => ValidationChainWithExtensions; }; /** * Schema of validations/sanitizations for a field, including extension validators/sanitizers */ export declare type ParamSchemaWithExtensions = { [K in keyof ParamSchema | V | S]?: K extends V ? ExtensionValidatorSchemaOptions : K extends S ? ExtensionSanitizerSchemaOptions : K extends keyof ParamSchema ? ParamSchema[K] : never; }; /** * Type of a validation chain created by a custom ExpressValidator instance. * * @example * ``` * const myExpressValidator = new ExpressValidator({ * isAllowedDomain: value => value.endsWith('@gmail.com') * }); * * type MyCustomValidationChain = CustomValidationChain * function createMyCustomChain(): MyCustomValidationChain { * return myExpressValidator.body('email').isAllowedDomain(); * } * ``` */ export declare type CustomValidationChain> = T extends ExpressValidator ? ValidationChainWithExtensions> : never; /** * Mapping from field name to a validations/sanitizations schema, including extensions from an * ExpressValidator instance. */ export declare type CustomSchema, K extends string = DefaultSchemaKeys> = T extends ExpressValidator ? Record, Extract, K>> : never; export declare class ExpressValidator { private readonly validators?; private readonly sanitizers?; private readonly options?; private readonly validatorEntries; private readonly sanitizerEntries; constructor(validators?: V | undefined, sanitizers?: S | undefined, options?: CustomOptions | undefined); private createChain; buildCheckFunction(locations: Location[]): (fields?: string | string[], message?: FieldMessageFactory | ErrorMessage) => CustomValidationChain; /** * Creates a middleware/validation chain for one or more fields that may be located in * any of the following: * * - `req.body` * - `req.cookies` * - `req.headers` * - `req.params` * - `req.query` * * @param fields a string or array of field names to validate/sanitize * @param message an error message to use when failed validations don't specify a custom message. * Defaults to `Invalid Value`. */ readonly check: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Same as {@link ExpressValidator.check}, but only validates in `req.body`. */ readonly body: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Same as {@link ExpressValidator.check}, but only validates in `req.cookies`. */ readonly cookie: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Same as {@link ExpressValidator.check}, but only validates in `req.headers`. */ readonly header: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Same as {@link ExpressValidator.check}, but only validates in `req.params`. */ readonly param: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Same as {@link ExpressValidator.check}, but only validates in `req.query`. */ readonly query: (fields?: string | string[] | undefined, message?: FieldMessageFactory | ErrorMessage | undefined) => CustomValidationChain; /** * Checks whether the request contains exactly only those fields that have been validated. * * This method is here for convenience; it does exactly the same as `checkExact`. * * @see {@link checkExact} */ readonly checkExact: typeof checkExact; /** * Creates an express middleware with validations for multiple fields at once in the form of * a schema object. * * @param schema the schema to validate. * @param defaultLocations which locations to validate in each field. Defaults to every location. */ readonly checkSchema: (schema: CustomSchema, locations?: Location[] | undefined) => RunnableValidationChains>; /** * Creates a middleware that will ensure that at least one of the given validation chains * or validation chain groups are valid. * * If none are, a single error of type `alternative` is added to the request, * with the errors of each chain made available under the `nestedErrors` property. * * @param chains an array of validation chains to check if are valid. * If any of the items of `chains` is an array of validation chains, then all of them * must be valid together for the request to be considered valid. */ oneOf(chains: (CustomValidationChain | CustomValidationChain[])[], options?: OneOfOptions): Middleware & ContextRunner; /** * Extracts the validation errors of an express request using the default error formatter of this * instance. * * @see {@link validationResult()} * @param req the express request object * @returns a `Result` which will by default use the error formatter passed when * instantiating `ExpressValidator`. */ readonly validationResult: (req: Request) => Result; /** * Extracts data validated or sanitized from the request, and builds an object with them. * * This method is a shortcut for `matchedData`; it does nothing different than it. * * @see {@link matchedData} */ matchedData(req: Request, options?: Partial): Record; } export {};