@miroir-framework/jzod-ts 0.5.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/README.md +3 -0
- package/babel.config.cjs +13 -0
- package/dist/bundle.d.ts +419 -0
- package/dist/bundle.js +303 -0
- package/dist/src/JzodToTs.d.ts +17 -0
- package/dist/src/JzodTsInterface.d.ts +397 -0
- package/dist/src/facade.d.ts +8 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/tools.d.ts +4 -0
- package/jest.config.js +63 -0
- package/package.json +38 -0
- package/rollup.config.js +36 -0
- package/src/JzodToTs.ts +104 -0
- package/src/JzodTsInterface.ts +450 -0
- package/src/index.ts +60 -0
- package/src/tools.ts +25 -0
- package/tests/jzod-ts.test.ts +108 -0
- package/tests/resources/tsTypeGeneration-testJzodSchema1 - reference.ts +5 -0
- package/tests/resources/tsTypeGeneration-testJzodSchema2 - reference.ts +11 -0
- package/tests/resources/tsTypeGeneration-testJzodSchema3 - reference.ts +19 -0
- package/tests/resources/tsTypeGeneration-testJzodSchema4 - reference.ts +250 -0
- package/tsconfig.json +26 -0
package/README.md
ADDED
package/babel.config.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = api => {
|
|
2
|
+
const isTest = api.env('test');
|
|
3
|
+
// You can use isTest to determine what presets and plugins to use.
|
|
4
|
+
console.log('########################################################')
|
|
5
|
+
return {
|
|
6
|
+
presets: [['@babel/preset-env', {targets: {node: 'current'}}]],
|
|
7
|
+
"env": {
|
|
8
|
+
"test": {
|
|
9
|
+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { z, ZodType } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const jzodRootSchema: z.ZodObject<{
|
|
5
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
optional?: boolean | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
optional?: boolean | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
type JzodRoot = z.infer<typeof jzodRootSchema>;
|
|
12
|
+
declare const jzodEnumAttributeTypesSchema: z.ZodEnum<["any", "bigint", "boolean", "date", "never", "null", "number", "string", "uuid", "undefined", "unknown", "void"]>;
|
|
13
|
+
type JzodEnumTypes = z.infer<typeof jzodEnumAttributeTypesSchema>;
|
|
14
|
+
declare const jzodEnumElementTypesSchema: z.ZodEnum<["array", "enum", "function", "lazy", "literal", "intersection", "map", "object", "promise", "record", "schemaReference", "set", "simpleType", "tuple", "union"]>;
|
|
15
|
+
type JzodEnumElementTypes = z.infer<typeof jzodEnumElementTypesSchema>;
|
|
16
|
+
interface JzodArray extends JzodRoot {
|
|
17
|
+
optional?: boolean;
|
|
18
|
+
nullable?: boolean;
|
|
19
|
+
extra?: {
|
|
20
|
+
[k: string]: any;
|
|
21
|
+
};
|
|
22
|
+
type: 'array';
|
|
23
|
+
definition: JzodElement;
|
|
24
|
+
}
|
|
25
|
+
declare const jzodArraySchema: z.ZodType<JzodArray>;
|
|
26
|
+
declare const jzodAttributeDateValidationsSchema: z.ZodObject<{
|
|
27
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
28
|
+
type: z.ZodEnum<["min", "max"]>;
|
|
29
|
+
parameter: z.ZodAny;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
type: "min" | "max";
|
|
32
|
+
extra?: Record<string, any> | undefined;
|
|
33
|
+
parameter?: any;
|
|
34
|
+
}, {
|
|
35
|
+
type: "min" | "max";
|
|
36
|
+
extra?: Record<string, any> | undefined;
|
|
37
|
+
parameter?: any;
|
|
38
|
+
}>;
|
|
39
|
+
type JzodAttributeDateValidations = z.infer<typeof jzodAttributeDateValidationsSchema>;
|
|
40
|
+
declare const jzodAttributeNumberValidationsSchema: z.ZodObject<{
|
|
41
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
42
|
+
type: z.ZodEnum<["gt", "gte", "lt", "lte", "int", "positive", "nonpositive", "negative", "nonnegative", "multipleOf", "finite", "safe"]>;
|
|
43
|
+
parameter: z.ZodAny;
|
|
44
|
+
}, "strict", z.ZodTypeAny, {
|
|
45
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
46
|
+
extra?: Record<string, any> | undefined;
|
|
47
|
+
parameter?: any;
|
|
48
|
+
}, {
|
|
49
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
50
|
+
extra?: Record<string, any> | undefined;
|
|
51
|
+
parameter?: any;
|
|
52
|
+
}>;
|
|
53
|
+
type JzodAttributeNumberValidations = z.infer<typeof jzodAttributeNumberValidationsSchema>;
|
|
54
|
+
declare const jzodAttributeStringValidationsSchema: z.ZodObject<{
|
|
55
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
56
|
+
type: z.ZodEnum<["max", "min", "length", "email", "url", "emoji", "uuid", "cuid", "cuid2", "ulid", "regex", "includes", "startsWith", "endsWith", "datetime", "ip"]>;
|
|
57
|
+
parameter: z.ZodAny;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
60
|
+
extra?: Record<string, any> | undefined;
|
|
61
|
+
parameter?: any;
|
|
62
|
+
}, {
|
|
63
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
64
|
+
extra?: Record<string, any> | undefined;
|
|
65
|
+
parameter?: any;
|
|
66
|
+
}>;
|
|
67
|
+
type JzodAttributeStringValidations = z.infer<typeof jzodAttributeStringValidationsSchema>;
|
|
68
|
+
declare const jzodAttributeDateWithValidationsSchema: z.ZodObject<{
|
|
69
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
72
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
type: z.ZodLiteral<"simpleType">;
|
|
74
|
+
definition: z.ZodLiteral<"date">;
|
|
75
|
+
validations: z.ZodArray<z.ZodObject<{
|
|
76
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
77
|
+
type: z.ZodEnum<["min", "max"]>;
|
|
78
|
+
parameter: z.ZodAny;
|
|
79
|
+
}, "strict", z.ZodTypeAny, {
|
|
80
|
+
type: "min" | "max";
|
|
81
|
+
extra?: Record<string, any> | undefined;
|
|
82
|
+
parameter?: any;
|
|
83
|
+
}, {
|
|
84
|
+
type: "min" | "max";
|
|
85
|
+
extra?: Record<string, any> | undefined;
|
|
86
|
+
parameter?: any;
|
|
87
|
+
}>, "many">;
|
|
88
|
+
}, "strict", z.ZodTypeAny, {
|
|
89
|
+
type: "simpleType";
|
|
90
|
+
definition: "date";
|
|
91
|
+
validations: {
|
|
92
|
+
type: "min" | "max";
|
|
93
|
+
extra?: Record<string, any> | undefined;
|
|
94
|
+
parameter?: any;
|
|
95
|
+
}[];
|
|
96
|
+
optional?: boolean | undefined;
|
|
97
|
+
nullable?: boolean | undefined;
|
|
98
|
+
extra?: Record<string, any> | undefined;
|
|
99
|
+
coerce?: boolean | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
type: "simpleType";
|
|
102
|
+
definition: "date";
|
|
103
|
+
validations: {
|
|
104
|
+
type: "min" | "max";
|
|
105
|
+
extra?: Record<string, any> | undefined;
|
|
106
|
+
parameter?: any;
|
|
107
|
+
}[];
|
|
108
|
+
optional?: boolean | undefined;
|
|
109
|
+
nullable?: boolean | undefined;
|
|
110
|
+
extra?: Record<string, any> | undefined;
|
|
111
|
+
coerce?: boolean | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
type JzodAttributeDateWithValidations = z.infer<typeof jzodAttributeDateWithValidationsSchema>;
|
|
114
|
+
declare const jzodAttributeNumberWithValidationsSchema: z.ZodObject<{
|
|
115
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
118
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
type: z.ZodLiteral<"simpleType">;
|
|
120
|
+
definition: z.ZodLiteral<"number">;
|
|
121
|
+
validations: z.ZodArray<z.ZodObject<{
|
|
122
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
123
|
+
type: z.ZodEnum<["gt", "gte", "lt", "lte", "int", "positive", "nonpositive", "negative", "nonnegative", "multipleOf", "finite", "safe"]>;
|
|
124
|
+
parameter: z.ZodAny;
|
|
125
|
+
}, "strict", z.ZodTypeAny, {
|
|
126
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
127
|
+
extra?: Record<string, any> | undefined;
|
|
128
|
+
parameter?: any;
|
|
129
|
+
}, {
|
|
130
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
131
|
+
extra?: Record<string, any> | undefined;
|
|
132
|
+
parameter?: any;
|
|
133
|
+
}>, "many">;
|
|
134
|
+
}, "strict", z.ZodTypeAny, {
|
|
135
|
+
type: "simpleType";
|
|
136
|
+
definition: "number";
|
|
137
|
+
validations: {
|
|
138
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
139
|
+
extra?: Record<string, any> | undefined;
|
|
140
|
+
parameter?: any;
|
|
141
|
+
}[];
|
|
142
|
+
optional?: boolean | undefined;
|
|
143
|
+
nullable?: boolean | undefined;
|
|
144
|
+
extra?: Record<string, any> | undefined;
|
|
145
|
+
coerce?: boolean | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
type: "simpleType";
|
|
148
|
+
definition: "number";
|
|
149
|
+
validations: {
|
|
150
|
+
type: "multipleOf" | "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "finite" | "safe";
|
|
151
|
+
extra?: Record<string, any> | undefined;
|
|
152
|
+
parameter?: any;
|
|
153
|
+
}[];
|
|
154
|
+
optional?: boolean | undefined;
|
|
155
|
+
nullable?: boolean | undefined;
|
|
156
|
+
extra?: Record<string, any> | undefined;
|
|
157
|
+
coerce?: boolean | undefined;
|
|
158
|
+
}>;
|
|
159
|
+
type JzodAttributeNumberWithValidations = z.infer<typeof jzodAttributeNumberWithValidationsSchema>;
|
|
160
|
+
declare const jzodAttributeStringWithValidationsSchema: z.ZodObject<{
|
|
161
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
164
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
type: z.ZodLiteral<"simpleType">;
|
|
166
|
+
definition: z.ZodLiteral<"string">;
|
|
167
|
+
validations: z.ZodArray<z.ZodObject<{
|
|
168
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
169
|
+
type: z.ZodEnum<["max", "min", "length", "email", "url", "emoji", "uuid", "cuid", "cuid2", "ulid", "regex", "includes", "startsWith", "endsWith", "datetime", "ip"]>;
|
|
170
|
+
parameter: z.ZodAny;
|
|
171
|
+
}, "strict", z.ZodTypeAny, {
|
|
172
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
173
|
+
extra?: Record<string, any> | undefined;
|
|
174
|
+
parameter?: any;
|
|
175
|
+
}, {
|
|
176
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
177
|
+
extra?: Record<string, any> | undefined;
|
|
178
|
+
parameter?: any;
|
|
179
|
+
}>, "many">;
|
|
180
|
+
}, "strict", z.ZodTypeAny, {
|
|
181
|
+
type: "simpleType";
|
|
182
|
+
definition: "string";
|
|
183
|
+
validations: {
|
|
184
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
185
|
+
extra?: Record<string, any> | undefined;
|
|
186
|
+
parameter?: any;
|
|
187
|
+
}[];
|
|
188
|
+
optional?: boolean | undefined;
|
|
189
|
+
nullable?: boolean | undefined;
|
|
190
|
+
extra?: Record<string, any> | undefined;
|
|
191
|
+
coerce?: boolean | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
type: "simpleType";
|
|
194
|
+
definition: "string";
|
|
195
|
+
validations: {
|
|
196
|
+
type: "length" | "includes" | "uuid" | "min" | "max" | "email" | "url" | "emoji" | "cuid" | "cuid2" | "ulid" | "regex" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
197
|
+
extra?: Record<string, any> | undefined;
|
|
198
|
+
parameter?: any;
|
|
199
|
+
}[];
|
|
200
|
+
optional?: boolean | undefined;
|
|
201
|
+
nullable?: boolean | undefined;
|
|
202
|
+
extra?: Record<string, any> | undefined;
|
|
203
|
+
coerce?: boolean | undefined;
|
|
204
|
+
}>;
|
|
205
|
+
type JzodAttributeStringWithValidations = z.infer<typeof jzodAttributeStringWithValidationsSchema>;
|
|
206
|
+
declare const jzodAttributeSchema: z.ZodObject<{
|
|
207
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
210
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
211
|
+
type: z.ZodLiteral<"simpleType">;
|
|
212
|
+
definition: z.ZodLazy<z.ZodEnum<["any", "bigint", "boolean", "date", "never", "null", "number", "string", "uuid", "undefined", "unknown", "void"]>>;
|
|
213
|
+
}, "strict", z.ZodTypeAny, {
|
|
214
|
+
type: "simpleType";
|
|
215
|
+
definition: "string" | "number" | "bigint" | "boolean" | "undefined" | "any" | "date" | "never" | "null" | "uuid" | "unknown" | "void";
|
|
216
|
+
optional?: boolean | undefined;
|
|
217
|
+
nullable?: boolean | undefined;
|
|
218
|
+
extra?: Record<string, any> | undefined;
|
|
219
|
+
coerce?: boolean | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
type: "simpleType";
|
|
222
|
+
definition: "string" | "number" | "bigint" | "boolean" | "undefined" | "any" | "date" | "never" | "null" | "uuid" | "unknown" | "void";
|
|
223
|
+
optional?: boolean | undefined;
|
|
224
|
+
nullable?: boolean | undefined;
|
|
225
|
+
extra?: Record<string, any> | undefined;
|
|
226
|
+
coerce?: boolean | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
type JzodAttribute = z.infer<typeof jzodAttributeSchema>;
|
|
229
|
+
type JzodElement = JzodArray | JzodAttribute | JzodAttributeDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributeStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodRecord | JzodObject | JzodPromise | JzodReference | JzodSet | JzodTuple | JzodUnion;
|
|
230
|
+
declare const jzodElementSchema: z.ZodType<JzodElement>;
|
|
231
|
+
declare const jzodEnumSchema: z.ZodObject<{
|
|
232
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
235
|
+
type: z.ZodLiteral<"enum">;
|
|
236
|
+
definition: z.ZodArray<z.ZodString, "many">;
|
|
237
|
+
}, "strict", z.ZodTypeAny, {
|
|
238
|
+
type: "enum";
|
|
239
|
+
definition: string[];
|
|
240
|
+
optional?: boolean | undefined;
|
|
241
|
+
nullable?: boolean | undefined;
|
|
242
|
+
extra?: Record<string, any> | undefined;
|
|
243
|
+
}, {
|
|
244
|
+
type: "enum";
|
|
245
|
+
definition: string[];
|
|
246
|
+
optional?: boolean | undefined;
|
|
247
|
+
nullable?: boolean | undefined;
|
|
248
|
+
extra?: Record<string, any> | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
type JzodEnum = z.infer<typeof jzodEnumSchema>;
|
|
251
|
+
interface JzodFunction {
|
|
252
|
+
extra?: {
|
|
253
|
+
[k: string]: any;
|
|
254
|
+
};
|
|
255
|
+
type: 'function';
|
|
256
|
+
definition: {
|
|
257
|
+
args: JzodElement[];
|
|
258
|
+
returns?: JzodElement;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
declare const jzodFunctionSchema: ZodType<JzodFunction>;
|
|
262
|
+
declare const jzodLazySchema: z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<"lazy">;
|
|
264
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
265
|
+
definition: ZodType<JzodFunction, z.ZodTypeDef, JzodFunction>;
|
|
266
|
+
}, "strict", z.ZodTypeAny, {
|
|
267
|
+
type: "lazy";
|
|
268
|
+
definition: JzodFunction;
|
|
269
|
+
extra?: Record<string, any> | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
type: "lazy";
|
|
272
|
+
definition: JzodFunction;
|
|
273
|
+
extra?: Record<string, any> | undefined;
|
|
274
|
+
}>;
|
|
275
|
+
type JzodLazy = z.infer<typeof jzodLazySchema>;
|
|
276
|
+
declare const jzodLiteralSchema: z.ZodObject<{
|
|
277
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
278
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
280
|
+
type: z.ZodLiteral<"literal">;
|
|
281
|
+
definition: z.ZodString;
|
|
282
|
+
}, "strict", z.ZodTypeAny, {
|
|
283
|
+
type: "literal";
|
|
284
|
+
definition: string;
|
|
285
|
+
optional?: boolean | undefined;
|
|
286
|
+
nullable?: boolean | undefined;
|
|
287
|
+
extra?: Record<string, any> | undefined;
|
|
288
|
+
}, {
|
|
289
|
+
type: "literal";
|
|
290
|
+
definition: string;
|
|
291
|
+
optional?: boolean | undefined;
|
|
292
|
+
nullable?: boolean | undefined;
|
|
293
|
+
extra?: Record<string, any> | undefined;
|
|
294
|
+
}>;
|
|
295
|
+
type JzodLiteral = z.infer<typeof jzodLiteralSchema>;
|
|
296
|
+
interface JzodIntersection {
|
|
297
|
+
optional?: boolean;
|
|
298
|
+
nullable?: boolean;
|
|
299
|
+
extra?: {
|
|
300
|
+
[k: string]: any;
|
|
301
|
+
};
|
|
302
|
+
type: 'intersection';
|
|
303
|
+
definition: {
|
|
304
|
+
left: JzodElement;
|
|
305
|
+
right: JzodElement;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
declare const jzodIntersectionSchema: z.ZodType<JzodIntersection>;
|
|
309
|
+
interface JzodMap extends JzodRoot {
|
|
310
|
+
optional?: boolean;
|
|
311
|
+
nullable?: boolean;
|
|
312
|
+
extra?: {
|
|
313
|
+
[k: string]: any;
|
|
314
|
+
};
|
|
315
|
+
type: 'map';
|
|
316
|
+
definition: [JzodElement, JzodElement];
|
|
317
|
+
}
|
|
318
|
+
declare const jzodMapSchema: z.ZodType<JzodMap>;
|
|
319
|
+
interface JzodObject extends JzodRoot {
|
|
320
|
+
optional?: boolean;
|
|
321
|
+
nullable?: boolean;
|
|
322
|
+
extend?: JzodReference | JzodObject;
|
|
323
|
+
extra?: {
|
|
324
|
+
[k: string]: any;
|
|
325
|
+
};
|
|
326
|
+
type: "object";
|
|
327
|
+
nonStrict?: boolean;
|
|
328
|
+
definition: {
|
|
329
|
+
[attributeName: string]: JzodElement;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
declare const jzodObjectSchema: z.ZodType<JzodObject>;
|
|
333
|
+
interface JzodPromise extends JzodRoot {
|
|
334
|
+
extra?: {
|
|
335
|
+
[k: string]: any;
|
|
336
|
+
};
|
|
337
|
+
type: 'promise';
|
|
338
|
+
definition: JzodElement;
|
|
339
|
+
}
|
|
340
|
+
declare const jzodPromiseSchema: z.ZodType<JzodPromise>;
|
|
341
|
+
interface JzodRecord {
|
|
342
|
+
optional?: boolean;
|
|
343
|
+
nullable?: boolean;
|
|
344
|
+
extra?: {
|
|
345
|
+
[k: string]: any;
|
|
346
|
+
};
|
|
347
|
+
type: 'record';
|
|
348
|
+
definition: JzodElement;
|
|
349
|
+
}
|
|
350
|
+
declare const jzodRecordSchema: z.ZodType<JzodRecord>;
|
|
351
|
+
interface JzodReference {
|
|
352
|
+
optional?: boolean;
|
|
353
|
+
nullable?: boolean;
|
|
354
|
+
extra?: {
|
|
355
|
+
[k: string]: any;
|
|
356
|
+
};
|
|
357
|
+
context?: {
|
|
358
|
+
[attributeName: string]: JzodElement;
|
|
359
|
+
};
|
|
360
|
+
type: 'schemaReference';
|
|
361
|
+
definition: {
|
|
362
|
+
eager?: boolean;
|
|
363
|
+
relativePath?: string;
|
|
364
|
+
absolutePath?: string;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
declare const jzodReferenceSchema: ZodType<JzodReference>;
|
|
368
|
+
interface JzodSet extends JzodRoot {
|
|
369
|
+
optional?: boolean;
|
|
370
|
+
nullable?: boolean;
|
|
371
|
+
extra?: {
|
|
372
|
+
[k: string]: any;
|
|
373
|
+
};
|
|
374
|
+
type: 'set';
|
|
375
|
+
definition: JzodElement;
|
|
376
|
+
}
|
|
377
|
+
declare const jzodSetSchema: z.ZodType<JzodSet>;
|
|
378
|
+
interface JzodTuple {
|
|
379
|
+
optional?: boolean;
|
|
380
|
+
nullable?: boolean;
|
|
381
|
+
extra?: {
|
|
382
|
+
[k: string]: any;
|
|
383
|
+
};
|
|
384
|
+
type: 'tuple';
|
|
385
|
+
definition: JzodElement[];
|
|
386
|
+
}
|
|
387
|
+
declare const jzodTupleSchema: z.ZodType<JzodTuple>;
|
|
388
|
+
interface JzodUnion {
|
|
389
|
+
optional?: boolean;
|
|
390
|
+
nullable?: boolean;
|
|
391
|
+
extra?: {
|
|
392
|
+
[k: string]: any;
|
|
393
|
+
};
|
|
394
|
+
type: "union";
|
|
395
|
+
discriminator?: string;
|
|
396
|
+
definition: JzodElement[];
|
|
397
|
+
}
|
|
398
|
+
declare const jzodUnionSchema: z.ZodType<JzodUnion>;
|
|
399
|
+
|
|
400
|
+
type TsTypeAliases = {
|
|
401
|
+
[k: string]: ts.TypeAliasDeclaration;
|
|
402
|
+
};
|
|
403
|
+
interface TsTypeAliasesAndZodText {
|
|
404
|
+
contextTsTypeAliases: {
|
|
405
|
+
[k: string]: ts.TypeAliasDeclaration;
|
|
406
|
+
};
|
|
407
|
+
contextZodText: {
|
|
408
|
+
[k: string]: string;
|
|
409
|
+
};
|
|
410
|
+
mainTsTypeAlias: ts.TypeAliasDeclaration;
|
|
411
|
+
mainZodText: string;
|
|
412
|
+
}
|
|
413
|
+
declare function jzodToTsTypeAliasesAndZodText(element: JzodElement, typeName?: string): TsTypeAliasesAndZodText;
|
|
414
|
+
declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean, typeName?: string): string;
|
|
415
|
+
|
|
416
|
+
declare function printTsTypeAlias(typeAlias: ts.TypeAliasDeclaration, exportPrefix?: boolean): string;
|
|
417
|
+
declare function printTsTypeAliases(typeAliases: TsTypeAliases, exportPrefix?: boolean): string;
|
|
418
|
+
|
|
419
|
+
export { JzodArray, JzodAttribute, JzodAttributeDateValidations, JzodAttributeDateWithValidations, JzodAttributeNumberValidations, JzodAttributeNumberWithValidations, JzodAttributeStringValidations, JzodAttributeStringWithValidations, JzodElement, JzodEnum, JzodEnumElementTypes, JzodEnumTypes, JzodFunction, JzodIntersection, JzodLazy, JzodLiteral, JzodMap, JzodObject, JzodPromise, JzodRecord, JzodReference, JzodSet, JzodTuple, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, JzodUnion, TsTypeAliases, jzodArraySchema, jzodAttributeDateValidationsSchema, jzodAttributeDateWithValidationsSchema, jzodAttributeNumberValidationsSchema, jzodAttributeNumberWithValidationsSchema, jzodAttributeSchema, jzodAttributeStringValidationsSchema, jzodAttributeStringWithValidationsSchema, jzodElementSchema, jzodEnumAttributeTypesSchema, jzodEnumElementTypesSchema, jzodEnumSchema, jzodFunctionSchema, jzodIntersectionSchema, jzodLazySchema, jzodLiteralSchema, jzodMapSchema, jzodObjectSchema, jzodPromiseSchema, jzodRecordSchema, jzodReferenceSchema, jzodSetSchema, jzodToTsCode, jzodToTsTypeAliasesAndZodText, jzodTupleSchema, jzodUnionSchema, printTsTypeAlias, printTsTypeAliases };
|