express-validator
Advanced tools
Comparing version 6.10.1 to 6.11.0
@@ -63,3 +63,3 @@ --- | ||
> _Returns:_ a middleware instance and `{ run: (req) => Promise<void> }` | ||
> _Returns:_ a middleware instance and `{ run: (req) => Promise<Result> }` | ||
@@ -66,0 +66,0 @@ Creates a middleware instance that will ensure at least one of the given chains passes the validation. |
@@ -130,2 +130,4 @@ --- | ||
> _Note:_ async functions must return a resolved or rejected `Promise` because `truthy` or `falsy` values won't stop the chain ([#1028](https://github.com/express-validator/express-validator/issues/1028#issuecomment-830561518)). | ||
- A validation chain [created through `check()` or similar functions](api-check.md#check-field-message). | ||
@@ -132,0 +134,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "6.10.1", | ||
"version": "6.11.0", | ||
"homepage": "https://express-validator.github.io", | ||
@@ -13,0 +13,0 @@ "license": "MIT", |
@@ -7,3 +7,3 @@ import { Request } from '../base'; | ||
import { ContextRunner } from './context-runner'; | ||
declare class ResultWithContext extends Result { | ||
export declare class ResultWithContext extends Result { | ||
readonly context: ReadonlyContext; | ||
@@ -20,2 +20,1 @@ constructor(context: ReadonlyContext); | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContextRunnerImpl = void 0; | ||
exports.ContextRunnerImpl = exports.ResultWithContext = void 0; | ||
const _ = require("lodash"); | ||
@@ -15,2 +15,3 @@ const base_1 = require("../base"); | ||
} | ||
exports.ResultWithContext = ResultWithContext; | ||
class ContextRunnerImpl { | ||
@@ -17,0 +18,0 @@ constructor(builderOrContext, selectFields = select_fields_1.selectFields) { |
import { ValidationChain } from '../chain'; | ||
import { Middleware, Request } from '../base'; | ||
import { Result } from '../validation-result'; | ||
export declare type OneOfCustomMessageBuilder = (options: { | ||
@@ -7,6 +8,6 @@ req: Request; | ||
export declare function oneOf(chains: (ValidationChain | ValidationChain[])[], message?: OneOfCustomMessageBuilder): Middleware & { | ||
run: (req: Request) => Promise<void>; | ||
run: (req: Request) => Promise<Result>; | ||
}; | ||
export declare function oneOf(chains: (ValidationChain | ValidationChain[])[], message?: any): Middleware & { | ||
run: (req: Request) => Promise<void>; | ||
run: (req: Request) => Promise<Result>; | ||
}; |
@@ -10,2 +10,3 @@ "use strict"; | ||
function oneOf(chains, message) { | ||
let result; | ||
const middleware = async (req, _res, next) => { | ||
@@ -36,3 +37,3 @@ const surrogateContext = new context_builder_1.ContextBuilder().addItem(dummyItem).build(); | ||
// Final context running pass to ensure contexts are added and values are modified properly | ||
await new chain_1.ContextRunnerImpl(surrogateContext).run(req); | ||
result = await new chain_1.ContextRunnerImpl(surrogateContext).run(req); | ||
next(); | ||
@@ -47,3 +48,3 @@ } | ||
middleware(req, {}, (e) => { | ||
e ? reject(e) : resolve(); | ||
e ? reject(e) : resolve(result); | ||
}); | ||
@@ -50,0 +51,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291645
149
6728
1