@miroir-framework/jzod-ts 0.6.0 → 0.6.1

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.
@@ -1,249 +1,252 @@
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
-
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
+ coerce?: boolean | undefined;
45
+ validations: JzodAttributeDateValidations[];
46
+ };
47
+ export type JzodAttributeNumberValidations = {
48
+ extra?: {
49
+ [x: string]: any;
50
+ } | undefined;
51
+ type: "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "multipleOf" | "finite" | "safe";
52
+ parameter?: any;
53
+ };
54
+ export type JzodAttributeNumberWithValidations = {
55
+ optional?: boolean | undefined;
56
+ nullable?: boolean | undefined;
57
+ extra?: {
58
+ [x: string]: any;
59
+ } | undefined;
60
+ type: "simpleType";
61
+ definition: "number";
62
+ coerce?: boolean | undefined;
63
+ validations: JzodAttributeNumberValidations[];
64
+ };
65
+ export type JzodAttributeStringValidations = {
66
+ extra?: {
67
+ [x: string]: any;
68
+ } | undefined;
69
+ type: "max" | "min" | "length" | "email" | "url" | "emoji" | "uuid" | "cuid" | "cuid2" | "ulid" | "regex" | "includes" | "startsWith" | "endsWith" | "datetime" | "ip";
70
+ parameter?: any;
71
+ };
72
+ export type JzodAttributeStringWithValidations = {
73
+ optional?: boolean | undefined;
74
+ nullable?: boolean | undefined;
75
+ extra?: {
76
+ [x: string]: any;
77
+ } | undefined;
78
+ type: "simpleType";
79
+ definition: "string";
80
+ coerce?: boolean | undefined;
81
+ validations: JzodAttributeStringValidations[];
82
+ };
83
+ export type JzodElement = JzodArray | JzodAttribute | JzodAttributeDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributeStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
84
+ export type JzodEnum = {
85
+ optional?: boolean | undefined;
86
+ nullable?: boolean | undefined;
87
+ extra?: {
88
+ [x: string]: any;
89
+ } | undefined;
90
+ type: "enum";
91
+ definition: string[];
92
+ };
93
+ export type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
94
+ export type JzodEnumElementTypes = "array" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "tuple" | "union";
95
+ export type JzodFunction = {
96
+ optional?: boolean | undefined;
97
+ nullable?: boolean | undefined;
98
+ extra?: {
99
+ [x: string]: any;
100
+ } | undefined;
101
+ type: "function";
102
+ definition: {
103
+ args: JzodElement[];
104
+ returns?: JzodElement | undefined;
105
+ };
106
+ };
107
+ export type JzodLazy = {
108
+ optional?: boolean | undefined;
109
+ nullable?: boolean | undefined;
110
+ extra?: {
111
+ [x: string]: any;
112
+ } | undefined;
113
+ type: "lazy";
114
+ definition: JzodFunction;
115
+ };
116
+ export type JzodLiteral = {
117
+ optional?: boolean | undefined;
118
+ nullable?: boolean | undefined;
119
+ extra?: {
120
+ [x: string]: any;
121
+ } | undefined;
122
+ type: "literal";
123
+ definition: string;
124
+ };
125
+ export type JzodIntersection = {
126
+ optional?: boolean | undefined;
127
+ nullable?: boolean | undefined;
128
+ extra?: {
129
+ [x: string]: any;
130
+ } | undefined;
131
+ type: "intersection";
132
+ definition: {
133
+ left: JzodElement;
134
+ right: JzodElement;
135
+ };
136
+ };
137
+ export type JzodMap = {
138
+ optional?: boolean | undefined;
139
+ nullable?: boolean | undefined;
140
+ extra?: {
141
+ [x: string]: any;
142
+ } | undefined;
143
+ type: "map";
144
+ definition: [
145
+ JzodElement,
146
+ JzodElement
147
+ ];
148
+ };
149
+ export type JzodObject = {
150
+ optional?: boolean | undefined;
151
+ nullable?: boolean | undefined;
152
+ extra?: {
153
+ [x: string]: any;
154
+ } | undefined;
155
+ extend?: (JzodReference | JzodObject) | undefined;
156
+ type: "object";
157
+ nonStrict?: boolean | undefined;
158
+ definition: {
159
+ [x: string]: JzodElement;
160
+ };
161
+ };
162
+ export type JzodPromise = {
163
+ optional?: boolean | undefined;
164
+ nullable?: boolean | undefined;
165
+ extra?: {
166
+ [x: string]: any;
167
+ } | undefined;
168
+ type: "promise";
169
+ definition: JzodElement;
170
+ };
171
+ export type JzodRecord = {
172
+ optional?: boolean | undefined;
173
+ nullable?: boolean | undefined;
174
+ extra?: {
175
+ [x: string]: any;
176
+ } | undefined;
177
+ type: "record";
178
+ definition: JzodElement;
179
+ };
180
+ export type JzodReference = {
181
+ optional?: boolean | undefined;
182
+ nullable?: boolean | undefined;
183
+ extra?: {
184
+ [x: string]: any;
185
+ } | undefined;
186
+ type: "schemaReference";
187
+ context?: {
188
+ [x: string]: JzodElement;
189
+ } | undefined;
190
+ definition: {
191
+ eager?: boolean | undefined;
192
+ relativePath?: string | undefined;
193
+ absolutePath?: string | undefined;
194
+ };
195
+ };
196
+ export type JzodSet = {
197
+ optional?: boolean | undefined;
198
+ nullable?: boolean | undefined;
199
+ extra?: {
200
+ [x: string]: any;
201
+ } | undefined;
202
+ type: "set";
203
+ definition: JzodElement;
204
+ };
205
+ export type JzodTuple = {
206
+ optional?: boolean | undefined;
207
+ nullable?: boolean | undefined;
208
+ extra?: {
209
+ [x: string]: any;
210
+ } | undefined;
211
+ type: "tuple";
212
+ definition: JzodElement[];
213
+ };
214
+ export type JzodUnion = {
215
+ optional?: boolean | undefined;
216
+ nullable?: boolean | undefined;
217
+ extra?: {
218
+ [x: string]: any;
219
+ } | undefined;
220
+ type: "union";
221
+ discriminator?: string | undefined;
222
+ definition: JzodElement[];
223
+ };
224
+ export type JzodBootstrapElementSchema = JzodElement;
225
+
226
+ 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();
227
+ 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();
228
+ 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();
229
+ 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();
230
+ 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"), coerce:z.boolean().optional(), validations:z.array(z.lazy(() =>jzodAttributeDateValidations))}).strict();
231
+ 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();
232
+ 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"), coerce:z.boolean().optional(), validations:z.array(z.lazy(() =>jzodAttributeNumberValidations))}).strict();
233
+ 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();
234
+ 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"), coerce:z.boolean().optional(), validations:z.array(z.lazy(() =>jzodAttributeStringValidations))}).strict();
235
+ 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)]);
236
+ 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();
237
+ export const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes> = z.enum(["any","bigint","boolean","date","never","null","number","string","uuid","undefined","unknown","void"]);
238
+ export const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes> = z.enum(["array","enum","function","lazy","literal","intersection","map","object","promise","record","schemaReference","set","simpleType","tuple","union"]);
239
+ 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();
240
+ 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();
241
+ 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();
242
+ 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();
243
+ 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();
244
+ 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();
245
+ 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();
246
+ 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();
247
+ 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();
248
+ 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();
249
+ 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();
250
+ 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();
251
+ export const jzodBootstrapElementSchema = z.lazy(() =>jzodElement);
252
+
package/src/preBuild.ts CHANGED
@@ -1,19 +1,16 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from 'fs';
2
2
  import { jzodBootstrapElementSchema } from '@miroir-framework/jzod';
3
3
 
4
- import { jzodToTsCode } from './JzodToTs';
4
+ import { jzodToTsCode } from './JzodToTs.js';
5
5
 
6
6
  export function generateZodSchemaFileFromJzodSchema(
7
- // jzodElement,
8
- // targetFileName,
9
- // jzodSchemaVariableName,
10
7
  jzodElement: any, //JzodElement,
11
8
  targetFileName: string,
12
9
  jzodSchemaVariableName:string,
13
10
  ) {
14
11
  // console.log("generateZodSchemaFileFromJzodSchema called!");
15
12
 
16
- const newFileContentsNotFormated = jzodToTsCode(jzodElement, true, jzodSchemaVariableName,true)
13
+ const newFileContentsNotFormated = jzodToTsCode(jzodElement, true, jzodSchemaVariableName,Object.keys(jzodElement.context))
17
14
  // const newFileContents = `import { JzodObject, jzodObject } from "@miroir-framework/jzod-ts";
18
15
  const newFileContents = `${newFileContentsNotFormated}
19
16
  `;
@@ -54,5 +51,4 @@ try {
54
51
 
55
52
  } catch (error) {
56
53
  console.error("could not generate TS files from Jzod schemas", error);
57
-
58
54
  }
@@ -3,7 +3,6 @@ import * as path from "path";
3
3
 
4
4
  import { jzodBootstrapElementSchema } from "@miroir-framework/jzod";
5
5
  import { jzodToTsCode } from "../src/JzodToTs";
6
- import { JzodElement, jzodElement } from "../src/JzodTsInterface";
7
6
 
8
7
  const refsPath = "./tests/resources"
9
8
  const tmpPath = "./tests/tmp";
@@ -13,7 +12,7 @@ const testJzodToTs = (
13
12
  // testDirectory: string,
14
13
  referenceFileName: string,
15
14
  testFileName: string,
16
- testJzodSchema:JzodElement,
15
+ testJzodSchema: any, //JzodElement,
17
16
  exportPrefix: boolean,
18
17
  typeName: string
19
18
  ) => {
@@ -43,7 +42,7 @@ describe(
43
42
 
44
43
 
45
44
  // ########################################################################################
46
- const testJzodSchema1: JzodElement = { type: "simpleType", definition: "string" };
45
+ const testJzodSchema1: any /**JzodElement*/ = { type: "simpleType", definition: "string" };
47
46
 
48
47
  testJzodToTs(
49
48
  "tsTypeGeneration-testJzodSchema1 - reference.ts",
@@ -54,7 +53,7 @@ describe(
54
53
  );
55
54
 
56
55
  // ########################################################################################
57
- const testJzodSchema2: JzodElement = {
56
+ const testJzodSchema2: any /**JzodElement*/ = {
58
57
  type: "schemaReference",
59
58
  context: {
60
59
  a: { type: "simpleType", definition: "string" },
@@ -77,7 +76,7 @@ describe(
77
76
  );
78
77
 
79
78
  // ########################################################################################
80
- const testJzodSchema4:JzodElement =
79
+ const testJzodSchema4: any /**JzodElement*/ =
81
80
  {
82
81
  type: "schemaReference",
83
82
  context: {