@zodec/core 0.0.1 → 0.0.3
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/README.md +3 -1
- package/dist/decorators/zclass.decorator.d.ts +5 -0
- package/dist/decorators/zclass.decorator.d.ts.map +1 -1
- package/dist/index.cjs +6 -4
- package/dist/index.js +6 -3
- package/dist/zodec.d.ts +9 -2
- package/dist/zodec.d.ts.map +1 -1
- package/package.json +42 -5
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* decorate a class by providing defined zod schema object
|
|
5
|
+
* @param schema
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
3
8
|
export declare function zclass(schema: z.ZodType<any>): ClassDecorator;
|
|
4
9
|
//# sourceMappingURL=zclass.decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zclass.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/zclass.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,wBAAgB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,cAAc,CAW7D"}
|
|
1
|
+
{"version":3,"file":"zclass.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/zclass.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,cAAc,CAW7D"}
|
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,6 @@ __export(src_exports, {
|
|
|
33
33
|
ZODEC__SCHEMA: () => ZODEC__SCHEMA,
|
|
34
34
|
ZODEC__TYPE: () => ZODEC__TYPE,
|
|
35
35
|
Zodec: () => Zodec,
|
|
36
|
-
ZodifyProvider: () => ZodifyProvider,
|
|
37
36
|
zatt: () => zatt,
|
|
38
37
|
zclass: () => zclass
|
|
39
38
|
});
|
|
@@ -47,9 +46,13 @@ var ZODEC__SCHEMA = "zodec:schema";
|
|
|
47
46
|
var ZODEC__TYPE = "zodec:type";
|
|
48
47
|
|
|
49
48
|
// packages/zodec/core/src/zodec.ts
|
|
50
|
-
var ZodifyProvider = class {
|
|
51
|
-
};
|
|
52
49
|
var Zodec = class {
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the Zod schema associated with a class.
|
|
52
|
+
*
|
|
53
|
+
* @param target - The class or object to retrieve the schema from.
|
|
54
|
+
* @returns The Zod schema if found, otherwise undefined.
|
|
55
|
+
*/
|
|
53
56
|
static of(target) {
|
|
54
57
|
return Reflect.getMetadata(ZODEC__SCHEMA, target);
|
|
55
58
|
}
|
|
@@ -88,7 +91,6 @@ function zclass(schema) {
|
|
|
88
91
|
ZODEC__SCHEMA,
|
|
89
92
|
ZODEC__TYPE,
|
|
90
93
|
Zodec,
|
|
91
|
-
ZodifyProvider,
|
|
92
94
|
zatt,
|
|
93
95
|
zclass
|
|
94
96
|
});
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,13 @@ var ZODEC__SCHEMA = "zodec:schema";
|
|
|
6
6
|
var ZODEC__TYPE = "zodec:type";
|
|
7
7
|
|
|
8
8
|
// packages/zodec/core/src/zodec.ts
|
|
9
|
-
var ZodifyProvider = class {
|
|
10
|
-
};
|
|
11
9
|
var Zodec = class {
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the Zod schema associated with a class.
|
|
12
|
+
*
|
|
13
|
+
* @param target - The class or object to retrieve the schema from.
|
|
14
|
+
* @returns The Zod schema if found, otherwise undefined.
|
|
15
|
+
*/
|
|
12
16
|
static of(target) {
|
|
13
17
|
return Reflect.getMetadata(ZODEC__SCHEMA, target);
|
|
14
18
|
}
|
|
@@ -46,7 +50,6 @@ export {
|
|
|
46
50
|
ZODEC__SCHEMA,
|
|
47
51
|
ZODEC__TYPE,
|
|
48
52
|
Zodec,
|
|
49
|
-
ZodifyProvider,
|
|
50
53
|
zatt,
|
|
51
54
|
zclass
|
|
52
55
|
};
|
package/dist/zodec.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { ZodType } from "zod";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Utility class for schemas and classes.
|
|
5
|
+
*/
|
|
5
6
|
export declare class Zodec {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the Zod schema associated with a class.
|
|
9
|
+
*
|
|
10
|
+
* @param target - The class or object to retrieve the schema from.
|
|
11
|
+
* @returns The Zod schema if found, otherwise undefined.
|
|
12
|
+
*/
|
|
6
13
|
static of(target: any): ZodType<any> | undefined;
|
|
7
14
|
}
|
|
8
15
|
//# sourceMappingURL=zodec.d.ts.map
|
package/dist/zodec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodec.d.ts","sourceRoot":"","sources":["../src/zodec.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAK9B
|
|
1
|
+
{"version":3,"file":"zodec.d.ts","sourceRoot":"","sources":["../src/zodec.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAK9B;;GAEG;AACH,qBAAa,KAAK;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS;CAGnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zodec/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Generate Zod schemas using TypeScript decorators. Define validation inline with class definitions - combining Zod's power with decorator syntax.",
|
|
5
|
+
"author": "Vizhy",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/vizhy/js",
|
|
10
|
+
"directory": "packages/zodec/core"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/vizhy/js/tree/main/packages/zodec/core#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/vizhy/js/issues"
|
|
15
|
+
},
|
|
4
16
|
"type": "module",
|
|
5
17
|
"main": "./dist/index.cjs",
|
|
6
18
|
"module": "./dist/index.js",
|
|
@@ -42,10 +54,35 @@
|
|
|
42
54
|
},
|
|
43
55
|
"dependencies": {},
|
|
44
56
|
"peerDependencies": {
|
|
45
|
-
"zod": "^
|
|
46
|
-
"reflect-metadata": "^0.1.
|
|
57
|
+
"zod": "^3.0.0",
|
|
58
|
+
"reflect-metadata": "^0.1.13 || ^0.2.0"
|
|
47
59
|
},
|
|
48
60
|
"publishConfig": {
|
|
49
61
|
"access": "public"
|
|
50
|
-
}
|
|
51
|
-
|
|
62
|
+
},
|
|
63
|
+
"keywords": [
|
|
64
|
+
"zod",
|
|
65
|
+
"decorators",
|
|
66
|
+
"schema",
|
|
67
|
+
"validation",
|
|
68
|
+
"typescript",
|
|
69
|
+
"class-validator",
|
|
70
|
+
"class-validator-alternative",
|
|
71
|
+
"schema-validation",
|
|
72
|
+
"runtime-validation",
|
|
73
|
+
"type-safe",
|
|
74
|
+
"zod-decorators",
|
|
75
|
+
"decorator-validation",
|
|
76
|
+
"model",
|
|
77
|
+
"dto",
|
|
78
|
+
"data-validation",
|
|
79
|
+
"functional-schema",
|
|
80
|
+
"declarative-validation",
|
|
81
|
+
"declarative-style",
|
|
82
|
+
"metadata",
|
|
83
|
+
"reflection",
|
|
84
|
+
"reflect-metadata",
|
|
85
|
+
"typescript-decorators",
|
|
86
|
+
"zodec"
|
|
87
|
+
]
|
|
88
|
+
}
|