@midwayjs/validate 3.10.6 → 3.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decorator/valid.d.ts +2 -1
- package/dist/decorator/valid.js +10 -3
- package/dist/pipe.d.ts +1 -2
- package/dist/pipe.js +2 -1
- package/package.json +7 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PipeUnionTransform } from '@midwayjs/core';
|
|
1
2
|
import { AnySchema } from 'joi';
|
|
2
|
-
export declare function Valid(
|
|
3
|
+
export declare function Valid(schemaOrPipes?: AnySchema<any> | PipeUnionTransform[], pipes?: PipeUnionTransform[]): ParameterDecorator;
|
|
3
4
|
//# sourceMappingURL=valid.d.ts.map
|
package/dist/decorator/valid.js
CHANGED
|
@@ -4,11 +4,18 @@ exports.Valid = void 0;
|
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const pipe_1 = require("../pipe");
|
|
7
|
-
function Valid(
|
|
7
|
+
function Valid(schemaOrPipes, pipes) {
|
|
8
|
+
if (Array.isArray(schemaOrPipes)) {
|
|
9
|
+
pipes = schemaOrPipes;
|
|
10
|
+
schemaOrPipes = undefined;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
pipes = pipes || [];
|
|
14
|
+
}
|
|
8
15
|
return (0, core_1.createCustomParamDecorator)(constants_1.VALID_KEY, {
|
|
9
|
-
schema,
|
|
16
|
+
schema: schemaOrPipes,
|
|
10
17
|
}, {
|
|
11
|
-
pipes: [pipe_1.DecoratorValidPipe],
|
|
18
|
+
pipes: [pipe_1.DecoratorValidPipe, ...pipes],
|
|
12
19
|
});
|
|
13
20
|
}
|
|
14
21
|
exports.Valid = Valid;
|
package/dist/pipe.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare abstract class AbstractValidationPipe implements PipeTransform {
|
|
|
13
13
|
export declare class ValidationPipe extends AbstractValidationPipe {
|
|
14
14
|
transform(value: any, options: TransformOptions): any;
|
|
15
15
|
}
|
|
16
|
-
declare abstract class ParsePipe extends AbstractValidationPipe {
|
|
16
|
+
export declare abstract class ParsePipe extends AbstractValidationPipe {
|
|
17
17
|
transform(value: any, options: TransformOptions): any;
|
|
18
18
|
}
|
|
19
19
|
export declare class DecoratorValidPipe extends ParsePipe {
|
|
@@ -32,5 +32,4 @@ export declare class DefaultValuePipe<T = any, R = any> implements PipeTransform
|
|
|
32
32
|
constructor(defaultValue: R);
|
|
33
33
|
transform(value: any, options: any): any;
|
|
34
34
|
}
|
|
35
|
-
export {};
|
|
36
35
|
//# sourceMappingURL=pipe.d.ts.map
|
package/dist/pipe.js
CHANGED
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DefaultValuePipe = exports.ParseFloatPipe = exports.ParseBoolPipe = exports.ParseIntPipe = exports.DecoratorValidPipe = exports.ValidationPipe = exports.AbstractValidationPipe = void 0;
|
|
12
|
+
exports.DefaultValuePipe = exports.ParseFloatPipe = exports.ParseBoolPipe = exports.ParseIntPipe = exports.DecoratorValidPipe = exports.ParsePipe = exports.ValidationPipe = exports.AbstractValidationPipe = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const service_1 = require("./service");
|
|
15
15
|
const i18n = require("@midwayjs/i18n");
|
|
@@ -69,6 +69,7 @@ class ParsePipe extends AbstractValidationPipe {
|
|
|
69
69
|
return this.validateWithSchema(value, options, options.metadata['schema'] || this.getSchema());
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
exports.ParsePipe = ParsePipe;
|
|
72
73
|
let DecoratorValidPipe = class DecoratorValidPipe extends ParsePipe {
|
|
73
74
|
};
|
|
74
75
|
DecoratorValidPipe = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/validate",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.9",
|
|
4
4
|
"description": "Midway Component for mongoose",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@midwayjs/i18n": "^3.10.
|
|
26
|
+
"@midwayjs/i18n": "^3.10.9",
|
|
27
27
|
"joi": "^17.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@midwayjs/core": "^3.10.
|
|
31
|
-
"@midwayjs/express": "^3.10.
|
|
32
|
-
"@midwayjs/koa": "^3.10.
|
|
33
|
-
"@midwayjs/mock": "^3.10.
|
|
30
|
+
"@midwayjs/core": "^3.10.9",
|
|
31
|
+
"@midwayjs/express": "^3.10.9",
|
|
32
|
+
"@midwayjs/koa": "^3.10.9",
|
|
33
|
+
"@midwayjs/mock": "^3.10.9"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "4c8368283bd5ff3c14c23080838e2567c3e9a749"
|
|
36
36
|
}
|