@miroir-framework/jzod-ts 0.5.3 → 0.6.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/package.json CHANGED
@@ -1,38 +1,40 @@
1
- {
2
- "name": "@miroir-framework/jzod-ts",
3
- "private": false,
4
- "version": "0.5.3",
5
- "description": "The Typescript-related functionalities of Jzod.",
6
- "main": "dist/bundle.js",
7
- "types": "dist/bundle.d.ts",
8
- "type": "module",
9
- "scripts": {
10
- "build": "rollup --config",
11
- "test": "cross-env NODE_ENV=test jest --verbose --silent=false -t"
12
- },
13
- "author": "Arnaud Bailly <miroir-framework@protonmail.com>",
14
- "homepage": "https://github.com/miroir-framework/jzod/#readme",
15
- "bugs": "https://github.com/miroir-framework/jzod/issues",
16
- "license": "MIT",
17
- "dependencies": {
18
- "@miroir-framework/jzod": "0.5.3",
19
- "zod": "^3.22.2",
20
- "zod-to-ts": "^1.2.0"
21
- },
22
- "devDependencies": {
23
- "@babel/plugin-transform-modules-commonjs": "^7.20.11",
24
- "@babel/preset-env": "^7.22.5",
25
- "@jest/globals": "^29.3.1",
26
- "@rollup/plugin-commonjs": "^24.0.1",
27
- "@rollup/plugin-json": "^6.0.0",
28
- "@types/jest": "^29.2.4",
29
- "babel-jest": "^29.4.0",
30
- "rollup": "^3.10.1",
31
- "rollup-plugin-dts": "^5.1.1",
32
- "rollup-plugin-typescript2": "^0.34.1",
33
- "ts-jest": "^29.0.3",
34
- "tsconfig-paths": "^4.1.2",
35
- "typescript": "^4.9.4",
36
- "zod-to-json-schema": "^3.21.2"
37
- }
38
- }
1
+ {
2
+ "name": "@miroir-framework/jzod-ts",
3
+ "private": false,
4
+ "version": "0.6.0",
5
+ "description": "The Typescript-related functionalities of Jzod.",
6
+ "main": "dist/bundle.js",
7
+ "types": "dist/bundle.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "preBuild": "npm run-script ./dist/out-tsc/src/preBuild.js",
11
+ "compile": "npx tsc",
12
+ "build": "rollup --config",
13
+ "test": "cross-env NODE_ENV=test jest --verbose --silent=false -t"
14
+ },
15
+ "author": "Arnaud Bailly <miroir-framework@protonmail.com>",
16
+ "homepage": "https://github.com/miroir-framework/jzod/#readme",
17
+ "bugs": "https://github.com/miroir-framework/jzod/issues",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@miroir-framework/jzod": "0.6.0",
21
+ "zod": "^3.22.2",
22
+ "zod-to-ts": "^1.2.0"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/plugin-transform-modules-commonjs": "^7.20.11",
26
+ "@babel/preset-env": "^7.22.5",
27
+ "@jest/globals": "^29.3.1",
28
+ "@rollup/plugin-commonjs": "^24.0.1",
29
+ "@rollup/plugin-json": "^6.0.0",
30
+ "@types/jest": "^29.2.4",
31
+ "babel-jest": "^29.4.0",
32
+ "rollup": "^3.10.1",
33
+ "rollup-plugin-dts": "^5.1.1",
34
+ "rollup-plugin-typescript2": "^0.34.1",
35
+ "ts-jest": "^29.0.3",
36
+ "tsconfig-paths": "^4.1.2",
37
+ "typescript": "5.0.3",
38
+ "zod-to-json-schema": "^3.21.2"
39
+ }
40
+ }
package/src/JzodToTs.ts CHANGED
@@ -1,109 +1,114 @@
1
- import ts from "typescript";
2
- import { ZodLazy } from "zod";
3
- import { createTypeAlias, printNode, withGetType, zodToTs } from "zod-to-ts";
4
-
5
- import { jzodElementSchemaToZodSchemaAndDescription } from "@miroir-framework/jzod";
6
-
7
- import { JzodElement } from "./JzodTsInterface";
8
-
9
- import { printTsTypeAliases } from "./tools";
10
- // ################################################################################################
11
- export type TsTypeAliases = {
12
- [k: string]: ts.TypeAliasDeclaration;
13
- }
14
-
15
- // ################################################################################################
16
- export interface TsTypeAliasesAndZodText {
17
- contextTsTypeAliases: { [k: string]: ts.TypeAliasDeclaration },
18
- contextZodText: { [k: string]: string },
19
- mainTsTypeAlias: ts.TypeAliasDeclaration,
20
- mainZodText: string
21
- }
22
-
23
- // ################################################################################################
24
- export function jzodToTsTypeAliasesAndZodText(
25
- element: JzodElement,
26
- typeName?: string,
27
- ): TsTypeAliasesAndZodText
28
- {
29
- const elementZodSchemaAndDescription = jzodElementSchemaToZodSchemaAndDescription(
30
- element,
31
- () => ({}),
32
- () => ({}),
33
- (innerReference: ZodLazy<any>, relativeReference: string | undefined) =>
34
- withGetType(innerReference, (ts) => {
35
- const actualTypeName = relativeReference?relativeReference.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
36
- return ts.factory.createTypeReferenceNode(
37
-
38
- ts.factory.createIdentifier(actualTypeName ? actualTypeName : "RELATIVEPATH_NOT_DEFINED")
39
- );
40
- }
41
- )
42
- );
43
-
44
- const contextTsTypesString = Object.fromEntries(
45
- Object.entries(elementZodSchemaAndDescription.contextZodSchema ?? {}).map((curr) => {
46
- const actualTypeName = curr[0]?curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
47
- // console.log("getTsCodeCorrespondingToZodSchemaAndDescription ", JSON.stringify(curr));
48
- const tsNode = zodToTs(curr[1], typeName).node;
49
- const typeAlias = createTypeAlias(tsNode, actualTypeName);
50
- return [curr[0], typeAlias];
51
- })
52
- );
53
-
54
- const tsTypeStringNode = zodToTs(elementZodSchemaAndDescription.zodSchema, typeName).node;
55
- const tsTypeStringTypeAlias = createTypeAlias(tsTypeStringNode, typeName??"");
56
-
57
- return {
58
- contextTsTypeAliases: contextTsTypesString,
59
- contextZodText: elementZodSchemaAndDescription.contextZodText??{},
60
- mainZodText: elementZodSchemaAndDescription.zodText,
61
- mainTsTypeAlias: tsTypeStringTypeAlias,
62
- };
63
- }
64
-
65
-
66
- // ################################################################################################
67
- export function jzodToTsCode (
68
- jzodElement: JzodElement,
69
- exportPrefix: boolean = true,
70
- typeName?: string,
71
- ): string {
72
- // console.log(
73
- // "getTsCodeCorrespondingToZodSchemaAndDescription jzodSchemaZodSchemaAndDescription.contextZodSchema",
74
- // "jzodElement",
75
- // JSON.stringify(jzodElement)
76
- // );
77
-
78
- const schemaName = typeName?typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toLowerCase() + c):"";
79
- const actualTypeName = typeName?typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
80
- // console.log("getTsCodeCorrespondingToZodSchemaAndDescription convertedJsonZodSchema", bodyJsCode);
81
-
82
- const header = `import { ZodType, ZodTypeAny, z } from "zod";`;
83
-
84
- const typeAliasesAndZodText = jzodToTsTypeAliasesAndZodText(jzodElement, actualTypeName);
85
-
86
- const bodyJsCode = `export const ${schemaName}: z.ZodType<${actualTypeName}> = ${typeAliasesAndZodText.mainZodText};`;
87
-
88
- const contextTsTypesString = printTsTypeAliases(typeAliasesAndZodText.contextTsTypeAliases, exportPrefix);
89
- // console.log("getTsCodeCorrespondingToZodSchemaAndDescription contextTsTypesString",contextTsTypesString);
90
-
91
- const contextJsCode = typeAliasesAndZodText.contextZodText
92
- ? Object.entries(typeAliasesAndZodText.contextZodText).reduce((acc, curr) => {
93
- const contextTypeName = curr[0]?curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
94
- return `${acc}
95
- export const ${curr[0]}:z.ZodType<${contextTypeName}> = ${curr[1]};`;
96
- }, "")
97
- : ""
98
- ;
99
-
100
- const tsTypesString = (exportPrefix?"export ":"") + printNode(typeAliasesAndZodText.mainTsTypeAlias);
101
- // console.log("getTsCodeCorrespondingToZodSchemaAndDescription tsTypeString",tsTypesString);
102
-
103
- return `${header}
104
- ${contextTsTypesString}
105
- ${tsTypesString}
106
- ${contextJsCode}
107
- ${bodyJsCode}
108
- `;
109
- }
1
+ import ts from "typescript";
2
+ import { ZodTypeAny } from "zod";
3
+ import { GetType, createTypeAlias, printNode, withGetType, zodToTs } from "zod-to-ts";
4
+
5
+ import { jzodElementSchemaToZodSchemaAndDescription } from "@miroir-framework/jzod";
6
+
7
+ import { JzodElement } from "./generated_jzodBootstrapElementSchema";
8
+
9
+ import { printTsTypeAliases } from "./tools";
10
+ // ################################################################################################
11
+ export type TsTypeAliases = {
12
+ [k: string]: ts.TypeAliasDeclaration;
13
+ }
14
+
15
+ // ################################################################################################
16
+ export interface TsTypeAliasesAndZodText {
17
+ contextTsTypeAliases: { [k: string]: ts.TypeAliasDeclaration },
18
+ contextZodText: { [k: string]: string },
19
+ mainTsTypeAlias: ts.TypeAliasDeclaration,
20
+ mainZodText: string
21
+ }
22
+
23
+ // ################################################################################################
24
+ export function jzodToTsTypeAliasesAndZodText(
25
+ element: JzodElement,
26
+ typeName?: string,
27
+ ): TsTypeAliasesAndZodText
28
+ {
29
+ const elementZodSchemaAndDescription = jzodElementSchemaToZodSchemaAndDescription(
30
+ element,
31
+ () => ({}),
32
+ () => ({}),
33
+ (innerReference: ZodTypeAny & GetType, relativeReference: string | undefined) =>
34
+ withGetType(innerReference, (ts:any) => {
35
+ const actualTypeName = relativeReference?relativeReference.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
36
+ return ts.factory.createTypeReferenceNode(
37
+ ts.factory.createIdentifier(actualTypeName ? actualTypeName : "RELATIVEPATH_NOT_DEFINED"),
38
+ undefined
39
+ );
40
+ }
41
+ )
42
+ );
43
+
44
+ const contextTsTypesString = Object.fromEntries(
45
+ Object.entries(elementZodSchemaAndDescription.contextZodSchema ?? {}).map((curr) => {
46
+ const actualTypeName = curr[0]?curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
47
+ const tsNode = zodToTs(curr[1], typeName).node;
48
+ const typeAlias = createTypeAlias(tsNode, actualTypeName);
49
+ return [curr[0], typeAlias];
50
+ })
51
+ );
52
+
53
+ const tsTypeStringNode = zodToTs(elementZodSchemaAndDescription.zodSchema, typeName).node;
54
+ const tsTypeStringTypeAlias = createTypeAlias(tsTypeStringNode, typeName??"");
55
+
56
+ return {
57
+ contextTsTypeAliases: contextTsTypesString,
58
+ contextZodText: elementZodSchemaAndDescription.contextZodText??{},
59
+ mainZodText: elementZodSchemaAndDescription.zodText,
60
+ mainTsTypeAlias: tsTypeStringTypeAlias,
61
+ };
62
+ }
63
+
64
+
65
+ // ################################################################################################
66
+ export function jzodToTsCode (
67
+ jzodElement: JzodElement,
68
+ exportPrefix: boolean = true,
69
+ typeName?: string,
70
+ typeSchema: boolean = false,
71
+ ): string {
72
+ // console.log(
73
+ // "################################### jzodToTsCode ",
74
+ // "jzodElement",
75
+ // JSON.stringify(jzodElement, null, 2)
76
+ // );
77
+
78
+ const schemaName = typeName?typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toLowerCase() + c):"";
79
+ const actualTypeName = typeName?typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
80
+ // console.log("jzodToTsCode convertedJsonZodSchema", bodyJsCode);
81
+
82
+ const header = `import { ZodType, ZodTypeAny, z } from "zod";`;
83
+
84
+ const typeAliasesAndZodText = jzodToTsTypeAliasesAndZodText(jzodElement, actualTypeName);
85
+
86
+ const bodyJsCode = typeSchema
87
+ ? `export const ${schemaName}: z.ZodType<${actualTypeName}> = ${typeAliasesAndZodText.mainZodText};`
88
+ : `export const ${schemaName} = ${typeAliasesAndZodText.mainZodText};`;
89
+
90
+ const contextTsTypesString = printTsTypeAliases(typeAliasesAndZodText.contextTsTypeAliases, exportPrefix);
91
+ // console.log("jzodToTsCode zod text for converted jzodElement",typeAliasesAndZodText.contextZodText);
92
+
93
+ const contextJsCode = typeAliasesAndZodText.contextZodText
94
+ ? Object.entries(typeAliasesAndZodText.contextZodText).reduce((acc, curr) => {
95
+ const contextTypeName = curr[0]?curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c):"";
96
+ return typeSchema?
97
+ `${acc}
98
+ export const ${curr[0]}: z.ZodType<${contextTypeName}> = ${curr[1]};`:
99
+ `${acc}
100
+ export const ${curr[0]} = ${curr[1]};`;
101
+ }, "")
102
+ : ""
103
+ ;
104
+
105
+ const tsTypesString = (exportPrefix?"export ":"") + printNode(typeAliasesAndZodText.mainTsTypeAlias);
106
+ // console.log("getTsCodeCorrespondingToZodSchemaAndDescription tsTypeString",tsTypesString);
107
+
108
+ return `${header}
109
+ ${contextTsTypesString}
110
+ ${tsTypesString}
111
+ ${contextJsCode}
112
+ ${bodyJsCode}
113
+ `;
114
+ }
@@ -0,0 +1,249 @@
1
+ import { ZodType, ZodTypeAny, z } from "zod";
2
+
3
+ export type JzodBaseObject = {
4
+ optional?: boolean | undefined;
5
+ nullable?: boolean | undefined;
6
+ extra?: {
7
+ [x: string]: any;
8
+ } | undefined;
9
+ };
10
+ export type JzodArray = {
11
+ optional?: boolean | undefined;
12
+ nullable?: boolean | undefined;
13
+ extra?: {
14
+ [x: string]: any;
15
+ } | undefined;
16
+ type: "array";
17
+ definition: JzodElement;
18
+ };
19
+ export type JzodAttribute = {
20
+ optional?: boolean | undefined;
21
+ nullable?: boolean | undefined;
22
+ extra?: {
23
+ [x: string]: any;
24
+ } | undefined;
25
+ type: "simpleType";
26
+ coerce?: boolean | undefined;
27
+ definition: JzodEnumAttributeTypes;
28
+ };
29
+ export type JzodAttributeDateValidations = {
30
+ extra?: {
31
+ [x: string]: any;
32
+ } | undefined;
33
+ type: "min" | "max";
34
+ parameter?: any;
35
+ };
36
+ export type JzodAttributeDateWithValidations = {
37
+ optional?: boolean | undefined;
38
+ nullable?: boolean | undefined;
39
+ extra?: {
40
+ [x: string]: any;
41
+ } | undefined;
42
+ type: "simpleType";
43
+ definition: "date";
44
+ validations: JzodAttributeDateValidations[];
45
+ };
46
+ export type JzodAttributeNumberValidations = {
47
+ extra?: {
48
+ [x: string]: any;
49
+ } | undefined;
50
+ type: "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "multipleOf" | "finite" | "safe";
51
+ parameter?: any;
52
+ };
53
+ export type JzodAttributeNumberWithValidations = {
54
+ optional?: boolean | undefined;
55
+ nullable?: boolean | undefined;
56
+ extra?: {
57
+ [x: string]: any;
58
+ } | undefined;
59
+ type: "simpleType";
60
+ definition: "number";
61
+ validations: JzodAttributeNumberValidations[];
62
+ };
63
+ export type JzodAttributeStringValidations = {
64
+ extra?: {
65
+ [x: string]: any;
66
+ } | undefined;
67
+ type: "max" | "min" | "length" | "email" | "url" | "emoji" | "uuid" | "cuid" | "cuid2" | "ulid" | "regex" | "includes" | "startsWith" | "endsWith" | "datetime" | "ip";
68
+ parameter?: any;
69
+ };
70
+ export type JzodAttributeStringWithValidations = {
71
+ optional?: boolean | undefined;
72
+ nullable?: boolean | undefined;
73
+ extra?: {
74
+ [x: string]: any;
75
+ } | undefined;
76
+ type: "simpleType";
77
+ definition: "string";
78
+ validations: JzodAttributeStringValidations[];
79
+ };
80
+ export type JzodElement = JzodArray | JzodAttribute | JzodAttributeDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributeStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
81
+ export type JzodEnum = {
82
+ optional?: boolean | undefined;
83
+ nullable?: boolean | undefined;
84
+ extra?: {
85
+ [x: string]: any;
86
+ } | undefined;
87
+ type: "enum";
88
+ definition: string[];
89
+ };
90
+ export type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
91
+ export type JzodEnumElementTypes = "array" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "tuple" | "union";
92
+ export type JzodFunction = {
93
+ optional?: boolean | undefined;
94
+ nullable?: boolean | undefined;
95
+ extra?: {
96
+ [x: string]: any;
97
+ } | undefined;
98
+ type: "function";
99
+ definition: {
100
+ args: JzodElement[];
101
+ returns?: JzodElement | undefined;
102
+ };
103
+ };
104
+ export type JzodLazy = {
105
+ optional?: boolean | undefined;
106
+ nullable?: boolean | undefined;
107
+ extra?: {
108
+ [x: string]: any;
109
+ } | undefined;
110
+ type: "lazy";
111
+ definition: JzodFunction;
112
+ };
113
+ export type JzodLiteral = {
114
+ optional?: boolean | undefined;
115
+ nullable?: boolean | undefined;
116
+ extra?: {
117
+ [x: string]: any;
118
+ } | undefined;
119
+ type: "literal";
120
+ definition: string;
121
+ };
122
+ export type JzodIntersection = {
123
+ optional?: boolean | undefined;
124
+ nullable?: boolean | undefined;
125
+ extra?: {
126
+ [x: string]: any;
127
+ } | undefined;
128
+ type: "intersection";
129
+ definition: {
130
+ left: JzodElement;
131
+ right: JzodElement;
132
+ };
133
+ };
134
+ export type JzodMap = {
135
+ optional?: boolean | undefined;
136
+ nullable?: boolean | undefined;
137
+ extra?: {
138
+ [x: string]: any;
139
+ } | undefined;
140
+ type: "map";
141
+ definition: [
142
+ JzodElement,
143
+ JzodElement
144
+ ];
145
+ };
146
+ export type JzodObject = {
147
+ optional?: boolean | undefined;
148
+ nullable?: boolean | undefined;
149
+ extra?: {
150
+ [x: string]: any;
151
+ } | undefined;
152
+ extend?: (JzodReference | JzodObject) | undefined;
153
+ type: "object";
154
+ nonStrict?: boolean | undefined;
155
+ definition: {
156
+ [x: string]: JzodElement;
157
+ };
158
+ };
159
+ export type JzodPromise = {
160
+ optional?: boolean | undefined;
161
+ nullable?: boolean | undefined;
162
+ extra?: {
163
+ [x: string]: any;
164
+ } | undefined;
165
+ type: "promise";
166
+ definition: JzodElement;
167
+ };
168
+ export type JzodRecord = {
169
+ optional?: boolean | undefined;
170
+ nullable?: boolean | undefined;
171
+ extra?: {
172
+ [x: string]: any;
173
+ } | undefined;
174
+ type: "record";
175
+ definition: JzodElement;
176
+ };
177
+ export type JzodReference = {
178
+ optional?: boolean | undefined;
179
+ nullable?: boolean | undefined;
180
+ extra?: {
181
+ [x: string]: any;
182
+ } | undefined;
183
+ type: "schemaReference";
184
+ context?: {
185
+ [x: string]: JzodElement;
186
+ } | undefined;
187
+ definition: {
188
+ eager?: boolean | undefined;
189
+ relativePath?: string | undefined;
190
+ absolutePath?: string | undefined;
191
+ };
192
+ };
193
+ export type JzodSet = {
194
+ optional?: boolean | undefined;
195
+ nullable?: boolean | undefined;
196
+ extra?: {
197
+ [x: string]: any;
198
+ } | undefined;
199
+ type: "set";
200
+ definition: JzodElement;
201
+ };
202
+ export type JzodTuple = {
203
+ optional?: boolean | undefined;
204
+ nullable?: boolean | undefined;
205
+ extra?: {
206
+ [x: string]: any;
207
+ } | undefined;
208
+ type: "tuple";
209
+ definition: JzodElement[];
210
+ };
211
+ export type JzodUnion = {
212
+ optional?: boolean | undefined;
213
+ nullable?: boolean | undefined;
214
+ extra?: {
215
+ [x: string]: any;
216
+ } | undefined;
217
+ type: "union";
218
+ discriminator?: string | undefined;
219
+ definition: JzodElement[];
220
+ };
221
+ export type JzodBootstrapElementSchema = JzodElement;
222
+
223
+ export const jzodBaseObject: z.ZodType<JzodBaseObject> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict();
224
+ export const jzodArray: z.ZodType<JzodArray> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("array"), definition:z.lazy(() =>jzodElement)}).strict();
225
+ export const jzodAttribute: z.ZodType<JzodAttribute> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("simpleType"), coerce:z.boolean().optional(), definition:z.lazy(() =>jzodEnumAttributeTypes)}).strict();
226
+ export const jzodAttributeDateValidations: z.ZodType<JzodAttributeDateValidations> = z.object({extra:z.record(z.string(),z.any()).optional(), type:z.enum(["min","max"]), parameter:z.any()}).strict();
227
+ export const jzodAttributeDateWithValidations: z.ZodType<JzodAttributeDateWithValidations> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("simpleType"), definition:z.literal("date"), validations:z.array(z.lazy(() =>jzodAttributeDateValidations))}).strict();
228
+ export const jzodAttributeNumberValidations: z.ZodType<JzodAttributeNumberValidations> = z.object({extra:z.record(z.string(),z.any()).optional(), type:z.enum(["gt","gte","lt","lte","int","positive","nonpositive","negative","nonnegative","multipleOf","finite","safe"]), parameter:z.any()}).strict();
229
+ export const jzodAttributeNumberWithValidations: z.ZodType<JzodAttributeNumberWithValidations> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("simpleType"), definition:z.literal("number"), validations:z.array(z.lazy(() =>jzodAttributeNumberValidations))}).strict();
230
+ export const jzodAttributeStringValidations: z.ZodType<JzodAttributeStringValidations> = z.object({extra:z.record(z.string(),z.any()).optional(), type:z.enum(["max","min","length","email","url","emoji","uuid","cuid","cuid2","ulid","regex","includes","startsWith","endsWith","datetime","ip"]), parameter:z.any()}).strict();
231
+ export const jzodAttributeStringWithValidations: z.ZodType<JzodAttributeStringWithValidations> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("simpleType"), definition:z.literal("string"), validations:z.array(z.lazy(() =>jzodAttributeStringValidations))}).strict();
232
+ export const jzodElement: z.ZodType<JzodElement> = z.union([z.lazy(() =>jzodArray), z.lazy(() =>jzodAttribute), z.lazy(() =>jzodAttributeDateWithValidations), z.lazy(() =>jzodAttributeNumberWithValidations), z.lazy(() =>jzodAttributeStringWithValidations), z.lazy(() =>jzodEnum), z.lazy(() =>jzodFunction), z.lazy(() =>jzodLazy), z.lazy(() =>jzodLiteral), z.lazy(() =>jzodIntersection), z.lazy(() =>jzodMap), z.lazy(() =>jzodObject), z.lazy(() =>jzodPromise), z.lazy(() =>jzodRecord), z.lazy(() =>jzodReference), z.lazy(() =>jzodSet), z.lazy(() =>jzodTuple), z.lazy(() =>jzodUnion)]);
233
+ export const jzodEnum: z.ZodType<JzodEnum> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("enum"), definition:z.array(z.string())}).strict();
234
+ export const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes> = z.enum(["any","bigint","boolean","date","never","null","number","string","uuid","undefined","unknown","void"]);
235
+ export const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes> = z.enum(["array","enum","function","lazy","literal","intersection","map","object","promise","record","schemaReference","set","simpleType","tuple","union"]);
236
+ export const jzodFunction: z.ZodType<JzodFunction> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("function"), definition:z.object({args:z.array(z.lazy(() =>jzodElement)), returns:z.lazy(() =>jzodElement).optional()}).strict()}).strict();
237
+ export const jzodLazy: z.ZodType<JzodLazy> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("lazy"), definition:z.lazy(() =>jzodFunction)}).strict();
238
+ export const jzodLiteral: z.ZodType<JzodLiteral> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("literal"), definition:z.string()}).strict();
239
+ export const jzodIntersection: z.ZodType<JzodIntersection> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("intersection"), definition:z.object({left:z.lazy(() =>jzodElement), right:z.lazy(() =>jzodElement)}).strict()}).strict();
240
+ export const jzodMap: z.ZodType<JzodMap> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("map"), definition:z.tuple([z.lazy(() =>jzodElement), z.lazy(() =>jzodElement)])}).strict();
241
+ export const jzodObject: z.ZodType<JzodObject> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({extend:z.union([z.lazy(() =>jzodReference), z.lazy(() =>jzodObject)]).optional(), type:z.literal("object"), nonStrict:z.boolean().optional(), definition:z.record(z.string(),z.lazy(() =>jzodElement))}).strict();
242
+ export const jzodPromise: z.ZodType<JzodPromise> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("promise"), definition:z.lazy(() =>jzodElement)}).strict();
243
+ export const jzodRecord: z.ZodType<JzodRecord> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("record"), definition:z.lazy(() =>jzodElement)}).strict();
244
+ export const jzodReference: z.ZodType<JzodReference> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("schemaReference"), context:z.record(z.string(),z.lazy(() =>jzodElement)).optional(), definition:z.object({eager:z.boolean().optional(), relativePath:z.string().optional(), absolutePath:z.string().optional()}).strict()}).strict();
245
+ export const jzodSet: z.ZodType<JzodSet> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("set"), definition:z.lazy(() =>jzodElement)}).strict();
246
+ export const jzodTuple: z.ZodType<JzodTuple> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("tuple"), definition:z.array(z.lazy(() =>jzodElement))}).strict();
247
+ export const jzodUnion: z.ZodType<JzodUnion> = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict().extend({type:z.literal("union"), discriminator:z.string().optional(), definition:z.array(z.lazy(() =>jzodElement))}).strict();
248
+ export const jzodBootstrapElementSchema: z.ZodType<JzodBootstrapElementSchema> = z.lazy(() =>jzodElement);
249
+