@atscript/moost-validator 0.1.54 → 0.1.56
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/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ const __moostjs_event_http = __toESM(require("@moostjs/event-http"));
|
|
|
28
28
|
|
|
29
29
|
//#region packages/moost-validator/src/as-validator.pipe.ts
|
|
30
30
|
const validatorPipe = (opts) => (0, moost.definePipeFn)((value, metas, level) => {
|
|
31
|
+
if (metas?.targetMeta?.optional && (value === undefined || value === null)) return value;
|
|
31
32
|
if ((0, __atscript_typescript_utils.isAnnotatedType)(metas?.targetMeta?.type) && typeof metas.targetMeta.type.validator === "function") {
|
|
32
33
|
const validator = metas.targetMeta.type.validator(opts);
|
|
33
34
|
validator.validate(value);
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { HttpError } from "@moostjs/event-http";
|
|
|
4
4
|
|
|
5
5
|
//#region packages/moost-validator/src/as-validator.pipe.ts
|
|
6
6
|
const validatorPipe = (opts) => definePipeFn((value, metas, level) => {
|
|
7
|
+
if (metas?.targetMeta?.optional && (value === undefined || value === null)) return value;
|
|
7
8
|
if (isAnnotatedType(metas?.targetMeta?.type) && typeof metas.targetMeta.type.validator === "function") {
|
|
8
9
|
const validator = metas.targetMeta.type.validator(opts);
|
|
9
10
|
validator.validate(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/moost-validator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.56",
|
|
4
4
|
"description": "Validator pipe and utils for Moost.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@moostjs/event-http": "^0.6.
|
|
40
|
-
"moost": "^0.6.
|
|
39
|
+
"@moostjs/event-http": "^0.6.10",
|
|
40
|
+
"moost": "^0.6.10",
|
|
41
41
|
"vitest": "3.2.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@moostjs/event-http": "^0.6.
|
|
45
|
-
"moost": "^0.6.
|
|
46
|
-
"@atscript/core": "^0.1.
|
|
47
|
-
"@atscript/typescript": "^0.1.
|
|
44
|
+
"@moostjs/event-http": "^0.6.10",
|
|
45
|
+
"moost": "^0.6.10",
|
|
46
|
+
"@atscript/core": "^0.1.56",
|
|
47
|
+
"@atscript/typescript": "^0.1.56"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"pub": "pnpm publish --access public",
|