@zodec/core 0.0.7 → 0.0.8

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/zodec.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare class Zodec {
10
10
  * @param target - The class or object to retrieve the schema from.
11
11
  * @returns The Zod schema if found, otherwise undefined.
12
12
  */
13
- static of(target: any): ZodType<any> | undefined;
13
+ static of(target: any): ZodType<any>;
14
14
  /**
15
15
  * checks if a target class has schema defined or not
16
16
  * @param target
@@ -1 +1 @@
1
- {"version":3,"file":"zodec.d.ts","sourceRoot":"","sources":["../src/zodec.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAKjC;;GAEG;AACH,qBAAa,KAAK;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS;IAIhD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO;IAItC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,GAAE,GAAU,GAAG,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC;CA4B7E"}
1
+ {"version":3,"file":"zodec.d.ts","sourceRoot":"","sources":["../src/zodec.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAKjC;;GAEG;AACH,qBAAa,KAAK;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAQpC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO;IAItC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,GAAE,GAAU,GAAG,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC;CA4B7E"}
package/dist/zodec.js CHANGED
@@ -15,6 +15,10 @@ class Zodec {
15
15
  * @returns The Zod schema if found, otherwise undefined.
16
16
  */
17
17
  static of(target) {
18
+ let schema = Reflect.getMetadata(constants_zodec_js_1.ZODEC__SCHEMA, target);
19
+ if (!schema) {
20
+ return zod_1.z.object({});
21
+ }
18
22
  return Reflect.getMetadata(constants_zodec_js_1.ZODEC__SCHEMA, target);
19
23
  }
20
24
  /**
package/package.json CHANGED
@@ -1,67 +1,66 @@
1
- {
2
- "name": "@zodec/core",
3
- "version": "0.0.7",
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
- },
16
- "type": "commonjs",
17
- "main": "./dist/index.js",
18
- "module": "./dist/index.js",
19
- "types": "./dist/index.d.ts",
20
- "exports": {
21
- "./package.json": "./package.json",
22
- ".": {
23
- "@vizhy/source": "./src/index.ts",
24
- "types": "./dist/index.d.ts",
25
- "import": "./dist/index.js",
26
- "default": "./dist/index.js"
27
- }
28
- },
29
- "files": [
30
- "dist",
31
- "!**/*.tsbuildinfo"
32
- ],
33
- "nx": {
34
- "name": "zodec-core"
35
- },
36
- "dependencies": {
37
- "tslib": "^2.3.0"
38
- },
39
- "publishConfig": {
40
- "access": "public"
41
- },
42
- "keywords": [
43
- "zod",
44
- "decorators",
45
- "schema",
46
- "validation",
47
- "typescript",
48
- "class-validator",
49
- "class-validator-alternative",
50
- "schema-validation",
51
- "runtime-validation",
52
- "type-safe",
53
- "zod-decorators",
54
- "decorator-validation",
55
- "model",
56
- "dto",
57
- "data-validation",
58
- "functional-schema",
59
- "declarative-validation",
60
- "declarative-style",
61
- "metadata",
62
- "reflection",
63
- "reflect-metadata",
64
- "typescript-decorators",
65
- "zodec"
66
- ]
67
- }
1
+ {
2
+ "name": "@zodec/core",
3
+ "version": "0.0.8",
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/x/zodec/core"
11
+ },
12
+ "homepage": "https://github.com/vizhy/js/tree/main/packages/x/zodec/core#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/vizhy/js/issues"
15
+ },
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ "./package.json": "./package.json",
21
+ ".": {
22
+ "@vizhy/source": "./src/index.ts",
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "!**/*.tsbuildinfo"
31
+ ],
32
+ "nx": {
33
+ "name": "zodec-core"
34
+ },
35
+ "dependencies": {
36
+ "tslib": "^2.3.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "keywords": [
42
+ "zod",
43
+ "decorators",
44
+ "schema",
45
+ "validation",
46
+ "typescript",
47
+ "class-validator",
48
+ "class-validator-alternative",
49
+ "schema-validation",
50
+ "runtime-validation",
51
+ "type-safe",
52
+ "zod-decorators",
53
+ "decorator-validation",
54
+ "model",
55
+ "dto",
56
+ "data-validation",
57
+ "functional-schema",
58
+ "declarative-validation",
59
+ "declarative-style",
60
+ "metadata",
61
+ "reflection",
62
+ "reflect-metadata",
63
+ "typescript-decorators",
64
+ "zodec"
65
+ ]
66
+ }