phecda-zod 1.0.0 → 1.0.1-beta.0
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.js +3 -3
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,8 +27,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
27
27
|
var import_phecda_core = require("phecda-core");
|
|
28
28
|
function ZodTo(cb) {
|
|
29
29
|
return (proto, key) => {
|
|
30
|
-
(0, import_phecda_core.setStateKey)(proto
|
|
31
|
-
(0, import_phecda_core.setHandler)(proto
|
|
30
|
+
(0, import_phecda_core.setStateKey)(proto, key);
|
|
31
|
+
(0, import_phecda_core.setHandler)(proto, key, {
|
|
32
32
|
async pipe(instance, addError) {
|
|
33
33
|
const ret = cb(instance, addError);
|
|
34
34
|
if (ret) {
|
|
@@ -52,7 +52,7 @@ function zodToClass(zod) {
|
|
|
52
52
|
}
|
|
53
53
|
static schema = zod;
|
|
54
54
|
}, "Z");
|
|
55
|
-
(0, import_phecda_core.addDecoToClass)(Z,
|
|
55
|
+
(0, import_phecda_core.addDecoToClass)(Z, void 0, ZodTo((ins, addError) => {
|
|
56
56
|
const result = zod.safeParse(ins);
|
|
57
57
|
if (!result.success)
|
|
58
58
|
result.error.issues.forEach(({ message }) => addError(message));
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
|
-
import {
|
|
5
|
+
import { addDecoToClass, setHandler, setStateKey } from "phecda-core";
|
|
6
6
|
function ZodTo(cb) {
|
|
7
7
|
return (proto, key) => {
|
|
8
|
-
setStateKey(proto
|
|
9
|
-
setHandler(proto
|
|
8
|
+
setStateKey(proto, key);
|
|
9
|
+
setHandler(proto, key, {
|
|
10
10
|
async pipe(instance, addError) {
|
|
11
11
|
const ret = cb(instance, addError);
|
|
12
12
|
if (ret) {
|
|
@@ -30,7 +30,7 @@ function zodToClass(zod) {
|
|
|
30
30
|
}
|
|
31
31
|
static schema = zod;
|
|
32
32
|
}, "Z");
|
|
33
|
-
addDecoToClass(Z,
|
|
33
|
+
addDecoToClass(Z, void 0, ZodTo((ins, addError) => {
|
|
34
34
|
const result = zod.safeParse(ins);
|
|
35
35
|
if (!result.success)
|
|
36
36
|
result.error.issues.forEach(({ message }) => addError(message));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-zod",
|
|
3
|
-
"version": "1.0.0",
|
|
3
|
+
"version": "1.0.1-beta.0",
|
|
4
4
|
"description": "use zod instead of decorator/reflect-metadata",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"tsup": "^6.5.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"phecda-core": "3.0.0-beta.
|
|
18
|
+
"phecda-core": "3.0.0-beta.17",
|
|
19
19
|
"zod": "^3.23.5"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|