@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.
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jzodUnion = exports.jzodTuple = exports.jzodSet = exports.jzodReference = exports.jzodRecord = exports.jzodPromise = exports.jzodObject = exports.jzodMapSchema = exports.jzodIntersection = exports.jzodLiteral = exports.jzodLazy = exports.jzodFunction = exports.jzodEnum = exports.jzodElement = exports.jzodAttribute = exports.jzodAttributeStringWithValidations = exports.jzodAttributeNumberWithValidations = exports.jzodAttributeDateWithValidations = exports.jzodAttributeStringValidations = exports.jzodAttributeNumberValidations = exports.jzodAttributeDateValidations = exports.jzodArray = exports.jzodEnumElementTypes = exports.jzodEnumAttributeTypes = void 0;
4
+ var zod_1 = require("zod");
5
+ var jzodRootSchema = zod_1.z.object({
6
+ optional: zod_1.z.boolean().optional(),
7
+ }).strict();
8
+ exports.jzodEnumAttributeTypes = zod_1.z.enum([
9
+ "any",
10
+ "bigint",
11
+ "boolean",
12
+ "date",
13
+ "never",
14
+ "null",
15
+ "number",
16
+ "string",
17
+ "uuid",
18
+ "undefined",
19
+ "unknown",
20
+ "void",
21
+ ]);
22
+ exports.jzodEnumElementTypes = zod_1.z.enum([
23
+ "array",
24
+ "enum",
25
+ "function",
26
+ "lazy",
27
+ "literal",
28
+ "intersection",
29
+ "map",
30
+ "object",
31
+ "promise",
32
+ "record",
33
+ "schemaReference",
34
+ "set",
35
+ "simpleType",
36
+ "tuple",
37
+ "union",
38
+ ]);
39
+ exports.jzodArray = zod_1.z.object({
40
+ optional: zod_1.z.boolean().optional(),
41
+ nullable: zod_1.z.boolean().optional(),
42
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
43
+ type: zod_1.z.literal('array'),
44
+ definition: zod_1.z.lazy(function () { return exports.jzodElement; })
45
+ }).strict();
46
+ exports.jzodAttributeDateValidations = zod_1.z
47
+ .object({
48
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
49
+ type: zod_1.z.enum([
50
+ "min",
51
+ "max",
52
+ ]),
53
+ parameter: zod_1.z.any(),
54
+ })
55
+ .strict();
56
+ exports.jzodAttributeNumberValidations = zod_1.z
57
+ .object({
58
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
59
+ type: zod_1.z.enum([
60
+ "gt",
61
+ "gte",
62
+ "lt",
63
+ "lte",
64
+ "int",
65
+ "positive",
66
+ "nonpositive",
67
+ "negative",
68
+ "nonnegative",
69
+ "multipleOf",
70
+ "finite",
71
+ "safe",
72
+ ]),
73
+ parameter: zod_1.z.any(),
74
+ })
75
+ .strict();
76
+ exports.jzodAttributeStringValidations = zod_1.z
77
+ .object({
78
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
79
+ type: zod_1.z.enum([
80
+ "max",
81
+ "min",
82
+ "length",
83
+ "email",
84
+ "url",
85
+ "emoji",
86
+ "uuid",
87
+ "cuid",
88
+ "cuid2",
89
+ "ulid",
90
+ "regex",
91
+ "includes",
92
+ "startsWith",
93
+ "endsWith",
94
+ "datetime",
95
+ "ip",
96
+ ]),
97
+ parameter: zod_1.z.any(),
98
+ })
99
+ .strict();
100
+ exports.jzodAttributeDateWithValidations = zod_1.z.object({
101
+ optional: zod_1.z.boolean().optional(),
102
+ nullable: zod_1.z.boolean().optional(),
103
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
104
+ coerce: zod_1.z.boolean().optional(),
105
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.simpleType),
106
+ definition: zod_1.z.literal(exports.jzodEnumAttributeTypes.enum.date),
107
+ validations: zod_1.z.array(exports.jzodAttributeDateValidations),
108
+ }).strict();
109
+ exports.jzodAttributeNumberWithValidations = zod_1.z.object({
110
+ optional: zod_1.z.boolean().optional(),
111
+ nullable: zod_1.z.boolean().optional(),
112
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
113
+ coerce: zod_1.z.boolean().optional(),
114
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.simpleType),
115
+ definition: zod_1.z.literal(exports.jzodEnumAttributeTypes.enum.number),
116
+ validations: zod_1.z.array(exports.jzodAttributeNumberValidations),
117
+ }).strict();
118
+ exports.jzodAttributeStringWithValidations = zod_1.z.object({
119
+ optional: zod_1.z.boolean().optional(),
120
+ nullable: zod_1.z.boolean().optional(),
121
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
122
+ coerce: zod_1.z.boolean().optional(),
123
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.simpleType),
124
+ definition: zod_1.z.literal(exports.jzodEnumAttributeTypes.enum.string),
125
+ validations: zod_1.z.array(exports.jzodAttributeStringValidations),
126
+ }).strict();
127
+ exports.jzodAttribute = zod_1.z.object({
128
+ optional: zod_1.z.boolean().optional(),
129
+ nullable: zod_1.z.boolean().optional(),
130
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
131
+ coerce: zod_1.z.boolean().optional(),
132
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.simpleType),
133
+ definition: zod_1.z.lazy(function () { return exports.jzodEnumAttributeTypes; }),
134
+ }).strict();
135
+ exports.jzodElement = zod_1.z.union([
136
+ zod_1.z.lazy(function () { return exports.jzodArray; }),
137
+ zod_1.z.lazy(function () { return exports.jzodAttribute; }),
138
+ zod_1.z.lazy(function () { return exports.jzodAttributeDateWithValidations; }),
139
+ zod_1.z.lazy(function () { return exports.jzodAttributeNumberWithValidations; }),
140
+ zod_1.z.lazy(function () { return exports.jzodAttributeStringWithValidations; }),
141
+ zod_1.z.lazy(function () { return exports.jzodEnum; }),
142
+ zod_1.z.lazy(function () { return exports.jzodFunction; }),
143
+ zod_1.z.lazy(function () { return exports.jzodLazy; }),
144
+ zod_1.z.lazy(function () { return exports.jzodLiteral; }),
145
+ zod_1.z.lazy(function () { return exports.jzodIntersection; }),
146
+ zod_1.z.lazy(function () { return exports.jzodMapSchema; }),
147
+ zod_1.z.lazy(function () { return exports.jzodObject; }),
148
+ zod_1.z.lazy(function () { return exports.jzodPromise; }),
149
+ zod_1.z.lazy(function () { return exports.jzodRecord; }),
150
+ zod_1.z.lazy(function () { return exports.jzodReference; }),
151
+ zod_1.z.lazy(function () { return exports.jzodSet; }),
152
+ zod_1.z.lazy(function () { return exports.jzodTuple; }),
153
+ zod_1.z.lazy(function () { return exports.jzodUnion; }),
154
+ ]);
155
+ exports.jzodEnum = zod_1.z.object({
156
+ optional: zod_1.z.boolean().optional(),
157
+ nullable: zod_1.z.boolean().optional(),
158
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
159
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.enum),
160
+ definition: zod_1.z.array(zod_1.z.string()),
161
+ }).strict();
162
+ exports.jzodFunction = zod_1.z.object({
163
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.function),
164
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
165
+ definition: zod_1.z.object({
166
+ args: zod_1.z.array(exports.jzodElement),
167
+ returns: exports.jzodElement.optional(),
168
+ })
169
+ }).strict();
170
+ exports.jzodLazy = zod_1.z.object({
171
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.lazy),
172
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
173
+ definition: exports.jzodFunction,
174
+ }).strict();
175
+ exports.jzodLiteral = zod_1.z.object({
176
+ optional: zod_1.z.boolean().optional(),
177
+ nullable: zod_1.z.boolean().optional(),
178
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
179
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.literal),
180
+ definition: zod_1.z.string(),
181
+ }).strict();
182
+ exports.jzodIntersection = zod_1.z.object({
183
+ optional: zod_1.z.boolean().optional(),
184
+ nullable: zod_1.z.boolean().optional(),
185
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
186
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.intersection),
187
+ definition: zod_1.z.lazy(function () { return zod_1.z.object({ left: exports.jzodElement, right: exports.jzodElement }); })
188
+ }).strict();
189
+ exports.jzodMapSchema = zod_1.z.object({
190
+ optional: zod_1.z.boolean().optional(),
191
+ nullable: zod_1.z.boolean().optional(),
192
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
193
+ type: zod_1.z.literal('map'),
194
+ definition: zod_1.z.lazy(function () { return zod_1.z.tuple([exports.jzodElement, exports.jzodElement]); })
195
+ }).strict();
196
+ exports.jzodObject = zod_1.z.object({
197
+ optional: zod_1.z.boolean().optional(),
198
+ nullable: zod_1.z.boolean().optional(),
199
+ extend: zod_1.z.lazy(function () { return zod_1.z.union([exports.jzodReference, exports.jzodObject]); }).optional(),
200
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
201
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.object),
202
+ nonStrict: zod_1.z.boolean().optional(),
203
+ definition: zod_1.z.lazy(function () { return zod_1.z.record(zod_1.z.string(), exports.jzodElement); }),
204
+ }).strict();
205
+ exports.jzodPromise = zod_1.z.object({
206
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
207
+ type: zod_1.z.literal('promise'),
208
+ definition: zod_1.z.lazy(function () { return exports.jzodElement; })
209
+ }).strict();
210
+ exports.jzodRecord = zod_1.z.object({
211
+ optional: zod_1.z.boolean().optional(),
212
+ nullable: zod_1.z.boolean().optional(),
213
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
214
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.record),
215
+ definition: zod_1.z.lazy(function () { return exports.jzodElement; })
216
+ }).strict();
217
+ exports.jzodReference = zod_1.z.object({
218
+ optional: zod_1.z.boolean().optional(),
219
+ nullable: zod_1.z.boolean().optional(),
220
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
221
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.schemaReference),
222
+ context: zod_1.z.lazy(function () { return zod_1.z.record(zod_1.z.string(), exports.jzodElement); }).optional(),
223
+ definition: zod_1.z.object({
224
+ eager: zod_1.z.boolean().optional(),
225
+ relativePath: zod_1.z.string().optional(),
226
+ absolutePath: zod_1.z.string().optional(),
227
+ })
228
+ }).strict();
229
+ exports.jzodSet = zod_1.z.object({
230
+ optional: zod_1.z.boolean().optional(),
231
+ nullable: zod_1.z.boolean().optional(),
232
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
233
+ type: zod_1.z.literal('set'),
234
+ definition: zod_1.z.lazy(function () { return exports.jzodElement; })
235
+ }).strict();
236
+ exports.jzodTuple = zod_1.z.object({
237
+ optional: zod_1.z.boolean().optional(),
238
+ nullable: zod_1.z.boolean().optional(),
239
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
240
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.tuple),
241
+ definition: zod_1.z.array(exports.jzodElement),
242
+ }).strict();
243
+ exports.jzodUnion = zod_1.z.object({
244
+ optional: zod_1.z.boolean().optional(),
245
+ nullable: zod_1.z.boolean().optional(),
246
+ extra: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
247
+ type: zod_1.z.literal(exports.jzodEnumElementTypes.enum.union),
248
+ discriminator: zod_1.z.string().optional(),
249
+ definition: zod_1.z.lazy(function () { return zod_1.z.array(exports.jzodElement); })
250
+ }).strict();
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jzodUnion = exports.jzodTuple = exports.jzodSet = exports.jzodReference = exports.jzodRecord = exports.jzodPromise = exports.jzodObject = exports.jzodMapSchema = exports.jzodLiteral = exports.jzodLazy = exports.jzodIntersection = exports.jzodFunction = exports.jzodEnum = exports.jzodEnumElementTypes = exports.jzodEnumAttributeTypes = exports.jzodElement = exports.jzodAttributeStringWithValidations = exports.jzodAttributeStringValidations = exports.jzodAttributeNumberWithValidations = exports.jzodAttributeNumberValidations = exports.jzodAttributeDateWithValidations = exports.jzodAttributeDateValidations = exports.jzodAttribute = exports.jzodArray = exports.printTsTypeAliases = exports.printTsTypeAlias = exports.jzodToTsTypeAliasesAndZodText = exports.jzodToTsCode = void 0;
4
+ var JzodToTs_1 = require("./JzodToTs");
5
+ Object.defineProperty(exports, "jzodToTsCode", { enumerable: true, get: function () { return JzodToTs_1.jzodToTsCode; } });
6
+ Object.defineProperty(exports, "jzodToTsTypeAliasesAndZodText", { enumerable: true, get: function () { return JzodToTs_1.jzodToTsTypeAliasesAndZodText; } });
7
+ var tools_1 = require("./tools");
8
+ Object.defineProperty(exports, "printTsTypeAlias", { enumerable: true, get: function () { return tools_1.printTsTypeAlias; } });
9
+ Object.defineProperty(exports, "printTsTypeAliases", { enumerable: true, get: function () { return tools_1.printTsTypeAliases; } });
10
+ var JzodTsInterface_1 = require("./JzodTsInterface");
11
+ Object.defineProperty(exports, "jzodArray", { enumerable: true, get: function () { return JzodTsInterface_1.jzodArray; } });
12
+ Object.defineProperty(exports, "jzodAttribute", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttribute; } });
13
+ Object.defineProperty(exports, "jzodAttributeDateValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeDateValidations; } });
14
+ Object.defineProperty(exports, "jzodAttributeDateWithValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeDateWithValidations; } });
15
+ Object.defineProperty(exports, "jzodAttributeNumberValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeNumberValidations; } });
16
+ Object.defineProperty(exports, "jzodAttributeNumberWithValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeNumberWithValidations; } });
17
+ Object.defineProperty(exports, "jzodAttributeStringValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeStringValidations; } });
18
+ Object.defineProperty(exports, "jzodAttributeStringWithValidations", { enumerable: true, get: function () { return JzodTsInterface_1.jzodAttributeStringWithValidations; } });
19
+ Object.defineProperty(exports, "jzodElement", { enumerable: true, get: function () { return JzodTsInterface_1.jzodElement; } });
20
+ Object.defineProperty(exports, "jzodEnumAttributeTypes", { enumerable: true, get: function () { return JzodTsInterface_1.jzodEnumAttributeTypes; } });
21
+ Object.defineProperty(exports, "jzodEnumElementTypes", { enumerable: true, get: function () { return JzodTsInterface_1.jzodEnumElementTypes; } });
22
+ Object.defineProperty(exports, "jzodEnum", { enumerable: true, get: function () { return JzodTsInterface_1.jzodEnum; } });
23
+ Object.defineProperty(exports, "jzodFunction", { enumerable: true, get: function () { return JzodTsInterface_1.jzodFunction; } });
24
+ Object.defineProperty(exports, "jzodIntersection", { enumerable: true, get: function () { return JzodTsInterface_1.jzodIntersection; } });
25
+ Object.defineProperty(exports, "jzodLazy", { enumerable: true, get: function () { return JzodTsInterface_1.jzodLazy; } });
26
+ Object.defineProperty(exports, "jzodLiteral", { enumerable: true, get: function () { return JzodTsInterface_1.jzodLiteral; } });
27
+ Object.defineProperty(exports, "jzodMapSchema", { enumerable: true, get: function () { return JzodTsInterface_1.jzodMapSchema; } });
28
+ Object.defineProperty(exports, "jzodObject", { enumerable: true, get: function () { return JzodTsInterface_1.jzodObject; } });
29
+ Object.defineProperty(exports, "jzodPromise", { enumerable: true, get: function () { return JzodTsInterface_1.jzodPromise; } });
30
+ Object.defineProperty(exports, "jzodRecord", { enumerable: true, get: function () { return JzodTsInterface_1.jzodRecord; } });
31
+ Object.defineProperty(exports, "jzodReference", { enumerable: true, get: function () { return JzodTsInterface_1.jzodReference; } });
32
+ Object.defineProperty(exports, "jzodSet", { enumerable: true, get: function () { return JzodTsInterface_1.jzodSet; } });
33
+ Object.defineProperty(exports, "jzodTuple", { enumerable: true, get: function () { return JzodTsInterface_1.jzodTuple; } });
34
+ Object.defineProperty(exports, "jzodUnion", { enumerable: true, get: function () { return JzodTsInterface_1.jzodUnion; } });
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateZodSchemaFileFromJzodSchema = void 0;
4
+ var fs_1 = require("fs");
5
+ var jzod_1 = require("@miroir-framework/jzod");
6
+ var JzodToTs_1 = require("./JzodToTs");
7
+ function generateZodSchemaFileFromJzodSchema(jzodElement, targetFileName, jzodSchemaVariableName) {
8
+ console.log("generateZodSchemaFileFromJzodSchema called!");
9
+ var newFileContentsNotFormated = (0, JzodToTs_1.jzodToTsCode)(jzodElement, true, jzodSchemaVariableName);
10
+ var newFileContents = "import { JzodObject, jzodObject } from \"@miroir-framework/jzod-ts\";\n".concat(newFileContentsNotFormated, "\n");
11
+ if (targetFileName && (0, fs_1.existsSync)(targetFileName)) {
12
+ var oldFileContents = (0, fs_1.readFileSync)(targetFileName).toString();
13
+ if (newFileContents != oldFileContents) {
14
+ console.log("generateZodSchemaFileFromJzodSchema newFileContents", newFileContents);
15
+ (0, fs_1.writeFileSync)(targetFileName, newFileContents);
16
+ }
17
+ else {
18
+ console.log("generateZodSchemaFileFromJzodSchema entityDefinitionReport old contents equal new contents, no file generation needed.");
19
+ }
20
+ }
21
+ else {
22
+ (0, fs_1.writeFileSync)(targetFileName, newFileContents);
23
+ }
24
+ }
25
+ exports.generateZodSchemaFileFromJzodSchema = generateZodSchemaFileFromJzodSchema;
26
+ var jzodSchemaConversion = [
27
+ {
28
+ jzodElement: jzod_1.jzodBootstrapElementSchema.definition,
29
+ targetFileName: "./src/generated_jzodBootstrapElementSchema.ts",
30
+ jzodSchemaVariableName: "jzodBootstrapElementSchema",
31
+ },
32
+ ];
33
+ try {
34
+ for (var _i = 0, jzodSchemaConversion_1 = jzodSchemaConversion; _i < jzodSchemaConversion_1.length; _i++) {
35
+ var schema = jzodSchemaConversion_1[_i];
36
+ generateZodSchemaFileFromJzodSchema(schema.jzodElement, schema.targetFileName, schema.jzodSchemaVariableName);
37
+ console.info("GENERATED", schema.targetFileName);
38
+ }
39
+ }
40
+ catch (error) {
41
+ console.error("could not generate TS files from Jzod schemas", error);
42
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printTsTypeAliases = exports.printTsTypeAlias = void 0;
4
+ var zod_to_ts_1 = require("zod-to-ts");
5
+ function printTsTypeAlias(typeAlias, exportPrefix) {
6
+ if (exportPrefix === void 0) { exportPrefix = true; }
7
+ return (exportPrefix ? "export " : "") + (0, zod_to_ts_1.printNode)(typeAlias);
8
+ }
9
+ exports.printTsTypeAlias = printTsTypeAlias;
10
+ function printTsTypeAliases(typeAliases, exportPrefix) {
11
+ if (exportPrefix === void 0) { exportPrefix = true; }
12
+ var result = Object.entries(typeAliases).reduce(function (acc, curr) {
13
+ return "".concat(acc, "\n").concat(printTsTypeAlias(curr[1], exportPrefix));
14
+ }, "");
15
+ return result;
16
+ }
17
+ exports.printTsTypeAliases = printTsTypeAliases;
@@ -1,5 +1,5 @@
1
1
  import ts from "typescript";
2
- import { JzodElement } from "./JzodTsInterface";
2
+ import { JzodElement } from "./generated_jzodBootstrapElementSchema";
3
3
  export type TsTypeAliases = {
4
4
  [k: string]: ts.TypeAliasDeclaration;
5
5
  };
@@ -14,4 +14,4 @@ export interface TsTypeAliasesAndZodText {
14
14
  mainZodText: string;
15
15
  }
16
16
  export declare function jzodToTsTypeAliasesAndZodText(element: JzodElement, typeName?: string): TsTypeAliasesAndZodText;
17
- export declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean, typeName?: string): string;
17
+ export declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean, typeName?: string, typeSchema?: boolean): string;
@@ -0,0 +1,246 @@
1
+ import { z } from "zod";
2
+ export type JzodBaseObject = {
3
+ optional?: boolean | undefined;
4
+ nullable?: boolean | undefined;
5
+ extra?: {
6
+ [x: string]: any;
7
+ } | undefined;
8
+ };
9
+ export type JzodArray = {
10
+ optional?: boolean | undefined;
11
+ nullable?: boolean | undefined;
12
+ extra?: {
13
+ [x: string]: any;
14
+ } | undefined;
15
+ type: "array";
16
+ definition: JzodElement;
17
+ };
18
+ export type JzodAttribute = {
19
+ optional?: boolean | undefined;
20
+ nullable?: boolean | undefined;
21
+ extra?: {
22
+ [x: string]: any;
23
+ } | undefined;
24
+ type: "simpleType";
25
+ coerce?: boolean | undefined;
26
+ definition: JzodEnumAttributeTypes;
27
+ };
28
+ export type JzodAttributeDateValidations = {
29
+ extra?: {
30
+ [x: string]: any;
31
+ } | undefined;
32
+ type: "min" | "max";
33
+ parameter?: any;
34
+ };
35
+ export type JzodAttributeDateWithValidations = {
36
+ optional?: boolean | undefined;
37
+ nullable?: boolean | undefined;
38
+ extra?: {
39
+ [x: string]: any;
40
+ } | undefined;
41
+ type: "simpleType";
42
+ definition: "date";
43
+ validations: JzodAttributeDateValidations[];
44
+ };
45
+ export type JzodAttributeNumberValidations = {
46
+ extra?: {
47
+ [x: string]: any;
48
+ } | undefined;
49
+ type: "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "multipleOf" | "finite" | "safe";
50
+ parameter?: any;
51
+ };
52
+ export type JzodAttributeNumberWithValidations = {
53
+ optional?: boolean | undefined;
54
+ nullable?: boolean | undefined;
55
+ extra?: {
56
+ [x: string]: any;
57
+ } | undefined;
58
+ type: "simpleType";
59
+ definition: "number";
60
+ validations: JzodAttributeNumberValidations[];
61
+ };
62
+ export type JzodAttributeStringValidations = {
63
+ extra?: {
64
+ [x: string]: any;
65
+ } | undefined;
66
+ type: "max" | "min" | "length" | "email" | "url" | "emoji" | "uuid" | "cuid" | "cuid2" | "ulid" | "regex" | "includes" | "startsWith" | "endsWith" | "datetime" | "ip";
67
+ parameter?: any;
68
+ };
69
+ export type JzodAttributeStringWithValidations = {
70
+ optional?: boolean | undefined;
71
+ nullable?: boolean | undefined;
72
+ extra?: {
73
+ [x: string]: any;
74
+ } | undefined;
75
+ type: "simpleType";
76
+ definition: "string";
77
+ validations: JzodAttributeStringValidations[];
78
+ };
79
+ export type JzodElement = JzodArray | JzodAttribute | JzodAttributeDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributeStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
80
+ export type JzodEnum = {
81
+ optional?: boolean | undefined;
82
+ nullable?: boolean | undefined;
83
+ extra?: {
84
+ [x: string]: any;
85
+ } | undefined;
86
+ type: "enum";
87
+ definition: string[];
88
+ };
89
+ export type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
90
+ export type JzodEnumElementTypes = "array" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "tuple" | "union";
91
+ export type JzodFunction = {
92
+ optional?: boolean | undefined;
93
+ nullable?: boolean | undefined;
94
+ extra?: {
95
+ [x: string]: any;
96
+ } | undefined;
97
+ type: "function";
98
+ definition: {
99
+ args: JzodElement[];
100
+ returns?: JzodElement | undefined;
101
+ };
102
+ };
103
+ export type JzodLazy = {
104
+ optional?: boolean | undefined;
105
+ nullable?: boolean | undefined;
106
+ extra?: {
107
+ [x: string]: any;
108
+ } | undefined;
109
+ type: "lazy";
110
+ definition: JzodFunction;
111
+ };
112
+ export type JzodLiteral = {
113
+ optional?: boolean | undefined;
114
+ nullable?: boolean | undefined;
115
+ extra?: {
116
+ [x: string]: any;
117
+ } | undefined;
118
+ type: "literal";
119
+ definition: string;
120
+ };
121
+ export type JzodIntersection = {
122
+ optional?: boolean | undefined;
123
+ nullable?: boolean | undefined;
124
+ extra?: {
125
+ [x: string]: any;
126
+ } | undefined;
127
+ type: "intersection";
128
+ definition: {
129
+ left: JzodElement;
130
+ right: JzodElement;
131
+ };
132
+ };
133
+ export type JzodMap = {
134
+ optional?: boolean | undefined;
135
+ nullable?: boolean | undefined;
136
+ extra?: {
137
+ [x: string]: any;
138
+ } | undefined;
139
+ type: "map";
140
+ definition: [
141
+ JzodElement,
142
+ JzodElement
143
+ ];
144
+ };
145
+ export type JzodObject = {
146
+ optional?: boolean | undefined;
147
+ nullable?: boolean | undefined;
148
+ extra?: {
149
+ [x: string]: any;
150
+ } | undefined;
151
+ extend?: (JzodReference | JzodObject) | undefined;
152
+ type: "object";
153
+ nonStrict?: boolean | undefined;
154
+ definition: {
155
+ [x: string]: JzodElement;
156
+ };
157
+ };
158
+ export type JzodPromise = {
159
+ optional?: boolean | undefined;
160
+ nullable?: boolean | undefined;
161
+ extra?: {
162
+ [x: string]: any;
163
+ } | undefined;
164
+ type: "promise";
165
+ definition: JzodElement;
166
+ };
167
+ export type JzodRecord = {
168
+ optional?: boolean | undefined;
169
+ nullable?: boolean | undefined;
170
+ extra?: {
171
+ [x: string]: any;
172
+ } | undefined;
173
+ type: "record";
174
+ definition: JzodElement;
175
+ };
176
+ export type JzodReference = {
177
+ optional?: boolean | undefined;
178
+ nullable?: boolean | undefined;
179
+ extra?: {
180
+ [x: string]: any;
181
+ } | undefined;
182
+ type: "schemaReference";
183
+ context?: {
184
+ [x: string]: JzodElement;
185
+ } | undefined;
186
+ definition: {
187
+ eager?: boolean | undefined;
188
+ relativePath?: string | undefined;
189
+ absolutePath?: string | undefined;
190
+ };
191
+ };
192
+ export type JzodSet = {
193
+ optional?: boolean | undefined;
194
+ nullable?: boolean | undefined;
195
+ extra?: {
196
+ [x: string]: any;
197
+ } | undefined;
198
+ type: "set";
199
+ definition: JzodElement;
200
+ };
201
+ export type JzodTuple = {
202
+ optional?: boolean | undefined;
203
+ nullable?: boolean | undefined;
204
+ extra?: {
205
+ [x: string]: any;
206
+ } | undefined;
207
+ type: "tuple";
208
+ definition: JzodElement[];
209
+ };
210
+ export type JzodUnion = {
211
+ optional?: boolean | undefined;
212
+ nullable?: boolean | undefined;
213
+ extra?: {
214
+ [x: string]: any;
215
+ } | undefined;
216
+ type: "union";
217
+ discriminator?: string | undefined;
218
+ definition: JzodElement[];
219
+ };
220
+ export type JzodBootstrapElementSchema = JzodElement;
221
+ export declare const jzodBaseObject: z.ZodType<JzodBaseObject>;
222
+ export declare const jzodArray: z.ZodType<JzodArray>;
223
+ export declare const jzodAttribute: z.ZodType<JzodAttribute>;
224
+ export declare const jzodAttributeDateValidations: z.ZodType<JzodAttributeDateValidations>;
225
+ export declare const jzodAttributeDateWithValidations: z.ZodType<JzodAttributeDateWithValidations>;
226
+ export declare const jzodAttributeNumberValidations: z.ZodType<JzodAttributeNumberValidations>;
227
+ export declare const jzodAttributeNumberWithValidations: z.ZodType<JzodAttributeNumberWithValidations>;
228
+ export declare const jzodAttributeStringValidations: z.ZodType<JzodAttributeStringValidations>;
229
+ export declare const jzodAttributeStringWithValidations: z.ZodType<JzodAttributeStringWithValidations>;
230
+ export declare const jzodElement: z.ZodType<JzodElement>;
231
+ export declare const jzodEnum: z.ZodType<JzodEnum>;
232
+ export declare const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes>;
233
+ export declare const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes>;
234
+ export declare const jzodFunction: z.ZodType<JzodFunction>;
235
+ export declare const jzodLazy: z.ZodType<JzodLazy>;
236
+ export declare const jzodLiteral: z.ZodType<JzodLiteral>;
237
+ export declare const jzodIntersection: z.ZodType<JzodIntersection>;
238
+ export declare const jzodMap: z.ZodType<JzodMap>;
239
+ export declare const jzodObject: z.ZodType<JzodObject>;
240
+ export declare const jzodPromise: z.ZodType<JzodPromise>;
241
+ export declare const jzodRecord: z.ZodType<JzodRecord>;
242
+ export declare const jzodReference: z.ZodType<JzodReference>;
243
+ export declare const jzodSet: z.ZodType<JzodSet>;
244
+ export declare const jzodTuple: z.ZodType<JzodTuple>;
245
+ export declare const jzodUnion: z.ZodType<JzodUnion>;
246
+ export declare const jzodBootstrapElementSchema: z.ZodType<JzodBootstrapElementSchema>;
@@ -1,3 +1,3 @@
1
1
  export { jzodToTsCode, jzodToTsTypeAliasesAndZodText, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, TsTypeAliases, } from "./JzodToTs";
2
2
  export { printTsTypeAlias, printTsTypeAliases } from "./tools";
3
- export { jzodArray, jzodAttribute, jzodAttributeDateValidations, jzodAttributeDateWithValidations, jzodAttributeNumberValidations, jzodAttributeNumberWithValidations, jzodAttributeStringValidations, jzodAttributeStringWithValidations, jzodElement, jzodEnumAttributeTypes, jzodEnumElementTypes, jzodEnum, jzodFunction, jzodIntersection, jzodLazy, jzodLiteral, jzodMapSchema, jzodObject, jzodPromise, jzodRecord, jzodReference, jzodSet, jzodTuple, jzodUnion, JzodArray, JzodAttribute, JzodAttributeDateValidations, JzodAttributeDateWithValidations, JzodAttributeNumberValidations, JzodAttributeNumberWithValidations, JzodAttributeStringValidations, JzodAttributeStringWithValidations, JzodElement, JzodEnum, JzodEnumTypes, JzodFunction, JzodEnumElementTypes, JzodIntersection, JzodLazy, JzodLiteral, JzodMap, JzodObject, JzodPromise, JzodRecord, JzodReference, JzodSet, JzodUnion, JzodTuple, } from "./JzodTsInterface";
3
+ export { jzodArray, jzodAttribute, jzodAttributeDateValidations, jzodAttributeDateWithValidations, jzodAttributeNumberValidations, jzodAttributeNumberWithValidations, jzodAttributeStringValidations, jzodAttributeStringWithValidations, jzodElement, jzodEnumAttributeTypes, jzodEnumElementTypes, jzodEnum, jzodFunction, jzodIntersection, jzodLazy, jzodLiteral, jzodMap, jzodObject, jzodPromise, jzodRecord, jzodReference, jzodSet, jzodTuple, jzodUnion, JzodArray, JzodAttribute, JzodAttributeDateValidations, JzodAttributeDateWithValidations, JzodAttributeNumberValidations, JzodAttributeNumberWithValidations, JzodAttributeStringValidations, JzodAttributeStringWithValidations, JzodElement, JzodEnum, JzodEnumAttributeTypes, JzodFunction, JzodEnumElementTypes, JzodIntersection, JzodLazy, JzodLiteral, JzodMap, JzodObject, JzodPromise, JzodRecord, JzodReference, JzodSet, JzodUnion, JzodTuple, } from "./generated_jzodBootstrapElementSchema";
@@ -0,0 +1 @@
1
+ export declare function generateZodSchemaFileFromJzodSchema(jzodElement: any, targetFileName: string, jzodSchemaVariableName: string): void;