@miroir-framework/jzod-ts 0.6.2 → 0.7.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/LICENSE.md +21 -0
- package/dist/bundle.d.ts +43 -3
- package/dist/bundle.js +7 -3
- package/package.json +8 -3
- package/babel.config.cjs +0 -13
- package/dist/out-tsc/dts/src/JzodToTs.d.ts +0 -17
- package/dist/out-tsc/dts/src/generated_jzodBootstrapElementSchema.d.ts +0 -250
- package/dist/out-tsc/dts/src/index.d.ts +0 -3
- package/dist/out-tsc/dts/src/preBuild.d.ts +0 -1
- package/dist/out-tsc/dts/src/tools.d.ts +0 -4
- package/dist/src/JzodToTs.d.ts +0 -17
- package/dist/src/generated_jzodBootstrapElementSchema.d.ts +0 -250
- package/dist/src/index.d.ts +0 -3
- package/dist/src/preBuild.d.ts +0 -1
- package/dist/src/tools.d.ts +0 -4
- package/jest.config.js +0 -63
- package/rollup.config.js +0 -36
- package/src/JzodToTs.ts +0 -118
- package/src/generated_jzodBootstrapElementSchema.ts +0 -253
- package/src/index.ts +0 -60
- package/src/preBuild.ts +0 -59
- package/src/tools.ts +0 -25
- package/tests/jzod-ts.test.ts +0 -107
- package/tests/resources/tsTypeGeneration-testJzodSchema1 - reference.ts +0 -5
- package/tests/resources/tsTypeGeneration-testJzodSchema2 - reference.ts +0 -11
- package/tests/resources/tsTypeGeneration-testJzodSchema3 - reference.ts +0 -19
- package/tests/resources/tsTypeGeneration-testJzodSchema4 - reference.ts +0 -254
- package/tsconfig.json +0 -26
|
@@ -1,254 +0,0 @@
|
|
|
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 | number | bigint | boolean;
|
|
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
|
-
partial?: boolean | undefined;
|
|
159
|
-
definition: {
|
|
160
|
-
[x: string]: JzodElement;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
export type JzodPromise = {
|
|
164
|
-
optional?: boolean | undefined;
|
|
165
|
-
nullable?: boolean | undefined;
|
|
166
|
-
extra?: {
|
|
167
|
-
[x: string]: any;
|
|
168
|
-
} | undefined;
|
|
169
|
-
type: "promise";
|
|
170
|
-
definition: JzodElement;
|
|
171
|
-
};
|
|
172
|
-
export type JzodRecord = {
|
|
173
|
-
optional?: boolean | undefined;
|
|
174
|
-
nullable?: boolean | undefined;
|
|
175
|
-
extra?: {
|
|
176
|
-
[x: string]: any;
|
|
177
|
-
} | undefined;
|
|
178
|
-
type: "record";
|
|
179
|
-
definition: JzodElement;
|
|
180
|
-
};
|
|
181
|
-
export type JzodReference = {
|
|
182
|
-
optional?: boolean | undefined;
|
|
183
|
-
nullable?: boolean | undefined;
|
|
184
|
-
extra?: {
|
|
185
|
-
[x: string]: any;
|
|
186
|
-
} | undefined;
|
|
187
|
-
type: "schemaReference";
|
|
188
|
-
context?: {
|
|
189
|
-
[x: string]: JzodElement;
|
|
190
|
-
} | undefined;
|
|
191
|
-
definition: {
|
|
192
|
-
eager?: boolean | undefined;
|
|
193
|
-
relativePath?: string | undefined;
|
|
194
|
-
absolutePath?: string | undefined;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
export type JzodSet = {
|
|
198
|
-
optional?: boolean | undefined;
|
|
199
|
-
nullable?: boolean | undefined;
|
|
200
|
-
extra?: {
|
|
201
|
-
[x: string]: any;
|
|
202
|
-
} | undefined;
|
|
203
|
-
type: "set";
|
|
204
|
-
definition: JzodElement;
|
|
205
|
-
};
|
|
206
|
-
export type JzodTuple = {
|
|
207
|
-
optional?: boolean | undefined;
|
|
208
|
-
nullable?: boolean | undefined;
|
|
209
|
-
extra?: {
|
|
210
|
-
[x: string]: any;
|
|
211
|
-
} | undefined;
|
|
212
|
-
type: "tuple";
|
|
213
|
-
definition: JzodElement[];
|
|
214
|
-
};
|
|
215
|
-
export type JzodUnion = {
|
|
216
|
-
optional?: boolean | undefined;
|
|
217
|
-
nullable?: boolean | undefined;
|
|
218
|
-
extra?: {
|
|
219
|
-
[x: string]: any;
|
|
220
|
-
} | undefined;
|
|
221
|
-
type: "union";
|
|
222
|
-
discriminator?: string | undefined;
|
|
223
|
-
definition: JzodElement[];
|
|
224
|
-
};
|
|
225
|
-
export type A = JzodArray[];
|
|
226
|
-
export type TestJzodSchema4 = A;
|
|
227
|
-
|
|
228
|
-
export const jzodBaseObject = z.object({optional:z.boolean().optional(), nullable:z.boolean().optional(), extra:z.record(z.string(),z.any()).optional()}).strict();
|
|
229
|
-
export const 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();
|
|
230
|
-
export const 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();
|
|
231
|
-
export const jzodAttributeDateValidations = z.object({extra:z.record(z.string(),z.any()).optional(), type:z.enum(["min","max"]), parameter:z.any()}).strict();
|
|
232
|
-
export const 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();
|
|
233
|
-
export const 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();
|
|
234
|
-
export const 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();
|
|
235
|
-
export const 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();
|
|
236
|
-
export const 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();
|
|
237
|
-
export const 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)]);
|
|
238
|
-
export const 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();
|
|
239
|
-
export const jzodEnumAttributeTypes = z.enum(["any","bigint","boolean","date","never","null","number","string","uuid","undefined","unknown","void"]);
|
|
240
|
-
export const jzodEnumElementTypes = z.enum(["array","enum","function","lazy","literal","intersection","map","object","promise","record","schemaReference","set","simpleType","tuple","union"]);
|
|
241
|
-
export const 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();
|
|
242
|
-
export const 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();
|
|
243
|
-
export const 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.union([z.string(), z.number(), z.bigint(), z.boolean()])}).strict();
|
|
244
|
-
export const 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();
|
|
245
|
-
export const 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();
|
|
246
|
-
export const 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(), partial:z.boolean().optional(), definition:z.record(z.string(),z.lazy(() =>jzodElement))}).strict();
|
|
247
|
-
export const 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();
|
|
248
|
-
export const 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();
|
|
249
|
-
export const 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();
|
|
250
|
-
export const 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();
|
|
251
|
-
export const 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();
|
|
252
|
-
export const 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();
|
|
253
|
-
export const a = z.array(z.lazy(() =>jzodArray));
|
|
254
|
-
export const testJzodSchema4 = z.lazy(() =>a);
|
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "dist/out-tsc",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"declarationDir": "dist/out-tsc/dts",
|
|
6
|
-
"rootDir": "./",
|
|
7
|
-
"baseUrl": "./",
|
|
8
|
-
"types": ["node", "jest"],
|
|
9
|
-
"removeComments": true,
|
|
10
|
-
"module": "ESNext",
|
|
11
|
-
"target": "ES2017",
|
|
12
|
-
"jsx": "react-jsx",
|
|
13
|
-
"moduleResolution": "Node",
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"allowSyntheticDefaultImports":true,
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"lib": ["es6", "dom"],
|
|
18
|
-
"noImplicitAny": true,
|
|
19
|
-
"noImplicitThis": true,
|
|
20
|
-
"strictNullChecks": true,
|
|
21
|
-
"plugins": [
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
"exclude": ["./node_modules/**","./src/**/*.spec.js", "./src/**/*.spec.jsx", "./src/**/*.spec.ts", "./src/**/*.spec.tsx"],
|
|
25
|
-
"include": ["./src/**/*.json", "./src/**/*.js", "./src/**/*.jsx", "./src/**/*.ts", "./src/**/*.tsx", "src/preBuild.ts"]
|
|
26
|
-
}
|