@miroir-framework/jzod-ts 0.6.1 → 0.6.3
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 +3 -1
- package/dist/bundle.js +3 -3
- package/package.json +10 -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 -246
- 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 -249
- 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 -252
- package/src/index.ts +0 -60
- package/src/preBuild.ts +0 -54
- 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 -253
- package/tsconfig.json +0 -26
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Mark Erikson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/bundle.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ type JzodLiteral = {
|
|
|
114
114
|
[x: string]: any;
|
|
115
115
|
} | undefined;
|
|
116
116
|
type: "literal";
|
|
117
|
-
definition: string;
|
|
117
|
+
definition: string | number | bigint | boolean;
|
|
118
118
|
};
|
|
119
119
|
type JzodIntersection = {
|
|
120
120
|
optional?: boolean | undefined;
|
|
@@ -149,6 +149,7 @@ type JzodObject = {
|
|
|
149
149
|
extend?: (JzodReference | JzodObject) | undefined;
|
|
150
150
|
type: "object";
|
|
151
151
|
nonStrict?: boolean | undefined;
|
|
152
|
+
partial?: boolean | undefined;
|
|
152
153
|
definition: {
|
|
153
154
|
[x: string]: JzodElement;
|
|
154
155
|
};
|
|
@@ -183,6 +184,7 @@ type JzodReference = {
|
|
|
183
184
|
} | undefined;
|
|
184
185
|
definition: {
|
|
185
186
|
eager?: boolean | undefined;
|
|
187
|
+
partial?: boolean | undefined;
|
|
186
188
|
relativePath?: string | undefined;
|
|
187
189
|
absolutePath?: string | undefined;
|
|
188
190
|
};
|
package/dist/bundle.js
CHANGED
|
@@ -78,13 +78,13 @@ const jzodEnumAttributeTypes = z.enum(["any", "bigint", "boolean", "date", "neve
|
|
|
78
78
|
const jzodEnumElementTypes = z.enum(["array", "enum", "function", "lazy", "literal", "intersection", "map", "object", "promise", "record", "schemaReference", "set", "simpleType", "tuple", "union"]);
|
|
79
79
|
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();
|
|
80
80
|
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();
|
|
81
|
-
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.string() }).strict();
|
|
81
|
+
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();
|
|
82
82
|
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();
|
|
83
83
|
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();
|
|
84
|
-
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(), definition: z.record(z.string(), z.lazy(() => jzodElement)) }).strict();
|
|
84
|
+
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();
|
|
85
85
|
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();
|
|
86
86
|
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();
|
|
87
|
-
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();
|
|
87
|
+
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(), partial: z.boolean().optional(), relativePath: z.string().optional(), absolutePath: z.string().optional() }).strict() }).strict();
|
|
88
88
|
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();
|
|
89
89
|
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();
|
|
90
90
|
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();
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miroir-framework/jzod-ts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"description": "The Typescript-related functionalities of Jzod.",
|
|
6
6
|
"main": "dist/bundle.js",
|
|
7
7
|
"types": "dist/bundle.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"preBuild": "tsc --rootDir . --baseUrl . --module ESnext --target ES2017 --moduleResolution node --allowSyntheticDefaultImports --outdir ./tmp/
|
|
10
|
+
"preBuild": "tsc --rootDir . --baseUrl . --module ESnext --target ES2017 --moduleResolution node --allowSyntheticDefaultImports --outdir ./tmp/ && node ./tmp/src/preBuild.js",
|
|
11
|
+
"preBuildRun": "node ./tmp/src/preBuild.js",
|
|
11
12
|
"compile": "npx tsc",
|
|
12
13
|
"build": "rollup --config",
|
|
13
14
|
"test": "cross-env NODE_ENV=test jest --verbose --silent=false -t"
|
|
@@ -16,8 +17,14 @@
|
|
|
16
17
|
"homepage": "https://github.com/miroir-framework/jzod/#readme",
|
|
17
18
|
"bugs": "https://github.com/miroir-framework/jzod/issues",
|
|
18
19
|
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"LICENSE.md",
|
|
22
|
+
"package.json",
|
|
23
|
+
"dist/bundle.js",
|
|
24
|
+
"dist/bundle.d.ts"
|
|
25
|
+
],
|
|
19
26
|
"dependencies": {
|
|
20
|
-
"@miroir-framework/jzod": "0.6.
|
|
27
|
+
"@miroir-framework/jzod": "0.6.3",
|
|
21
28
|
"zod": "^3.22.2",
|
|
22
29
|
"zod-to-ts": "^1.2.0"
|
|
23
30
|
},
|
package/babel.config.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { JzodElement } from "./generated_jzodBootstrapElementSchema";
|
|
3
|
-
export type TsTypeAliases = {
|
|
4
|
-
[k: string]: ts.TypeAliasDeclaration;
|
|
5
|
-
};
|
|
6
|
-
export interface TsTypeAliasesAndZodText {
|
|
7
|
-
contextTsTypeAliases: {
|
|
8
|
-
[k: string]: ts.TypeAliasDeclaration;
|
|
9
|
-
};
|
|
10
|
-
contextZodText: {
|
|
11
|
-
[k: string]: string;
|
|
12
|
-
};
|
|
13
|
-
mainTsTypeAlias: ts.TypeAliasDeclaration;
|
|
14
|
-
mainZodText: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function jzodToTsTypeAliasesAndZodText(element: JzodElement, typeName?: string): TsTypeAliasesAndZodText;
|
|
17
|
-
export declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean, typeName?: string, typeAnotationForSchema?: string[]): string;
|
|
@@ -1,246 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export { jzodToTsCode, jzodToTsTypeAliasesAndZodText, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, TsTypeAliases, } from "./JzodToTs";
|
|
2
|
-
export { printTsTypeAlias, printTsTypeAliases } from "./tools";
|
|
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";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateZodSchemaFileFromJzodSchema(jzodElement: any, targetFileName: string, jzodSchemaVariableName: string): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { TsTypeAliases } from "./JzodToTs";
|
|
3
|
-
export declare function printTsTypeAlias(typeAlias: ts.TypeAliasDeclaration, exportPrefix?: boolean): string;
|
|
4
|
-
export declare function printTsTypeAliases(typeAliases: TsTypeAliases, exportPrefix?: boolean): string;
|
package/dist/src/JzodToTs.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { JzodElement } from "./generated_jzodBootstrapElementSchema";
|
|
3
|
-
export type TsTypeAliases = {
|
|
4
|
-
[k: string]: ts.TypeAliasDeclaration;
|
|
5
|
-
};
|
|
6
|
-
export interface TsTypeAliasesAndZodText {
|
|
7
|
-
contextTsTypeAliases: {
|
|
8
|
-
[k: string]: ts.TypeAliasDeclaration;
|
|
9
|
-
};
|
|
10
|
-
contextZodText: {
|
|
11
|
-
[k: string]: string;
|
|
12
|
-
};
|
|
13
|
-
mainTsTypeAlias: ts.TypeAliasDeclaration;
|
|
14
|
-
mainZodText: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function jzodToTsTypeAliasesAndZodText(element: JzodElement, typeName?: string): TsTypeAliasesAndZodText;
|
|
17
|
-
export declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean, typeName?: string, typeAnotationForSchema?: string[]): string;
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { ZodType, 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
|
-
coerce?: boolean | undefined;
|
|
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
|
-
coerce?: boolean | undefined;
|
|
62
|
-
validations: JzodAttributeNumberValidations[];
|
|
63
|
-
};
|
|
64
|
-
export type JzodAttributeStringValidations = {
|
|
65
|
-
extra?: {
|
|
66
|
-
[x: string]: any;
|
|
67
|
-
} | undefined;
|
|
68
|
-
type: "max" | "min" | "length" | "email" | "url" | "emoji" | "uuid" | "cuid" | "cuid2" | "ulid" | "regex" | "includes" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
69
|
-
parameter?: any;
|
|
70
|
-
};
|
|
71
|
-
export type JzodAttributeStringWithValidations = {
|
|
72
|
-
optional?: boolean | undefined;
|
|
73
|
-
nullable?: boolean | undefined;
|
|
74
|
-
extra?: {
|
|
75
|
-
[x: string]: any;
|
|
76
|
-
} | undefined;
|
|
77
|
-
type: "simpleType";
|
|
78
|
-
definition: "string";
|
|
79
|
-
coerce?: boolean | undefined;
|
|
80
|
-
validations: JzodAttributeStringValidations[];
|
|
81
|
-
};
|
|
82
|
-
export type JzodElement = JzodArray | JzodAttribute | JzodAttributeDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributeStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
|
|
83
|
-
export type JzodEnum = {
|
|
84
|
-
optional?: boolean | undefined;
|
|
85
|
-
nullable?: boolean | undefined;
|
|
86
|
-
extra?: {
|
|
87
|
-
[x: string]: any;
|
|
88
|
-
} | undefined;
|
|
89
|
-
type: "enum";
|
|
90
|
-
definition: string[];
|
|
91
|
-
};
|
|
92
|
-
export type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
|
|
93
|
-
export type JzodEnumElementTypes = "array" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "tuple" | "union";
|
|
94
|
-
export type JzodFunction = {
|
|
95
|
-
optional?: boolean | undefined;
|
|
96
|
-
nullable?: boolean | undefined;
|
|
97
|
-
extra?: {
|
|
98
|
-
[x: string]: any;
|
|
99
|
-
} | undefined;
|
|
100
|
-
type: "function";
|
|
101
|
-
definition: {
|
|
102
|
-
args: JzodElement[];
|
|
103
|
-
returns?: JzodElement | undefined;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
export type JzodLazy = {
|
|
107
|
-
optional?: boolean | undefined;
|
|
108
|
-
nullable?: boolean | undefined;
|
|
109
|
-
extra?: {
|
|
110
|
-
[x: string]: any;
|
|
111
|
-
} | undefined;
|
|
112
|
-
type: "lazy";
|
|
113
|
-
definition: JzodFunction;
|
|
114
|
-
};
|
|
115
|
-
export type JzodLiteral = {
|
|
116
|
-
optional?: boolean | undefined;
|
|
117
|
-
nullable?: boolean | undefined;
|
|
118
|
-
extra?: {
|
|
119
|
-
[x: string]: any;
|
|
120
|
-
} | undefined;
|
|
121
|
-
type: "literal";
|
|
122
|
-
definition: string;
|
|
123
|
-
};
|
|
124
|
-
export type JzodIntersection = {
|
|
125
|
-
optional?: boolean | undefined;
|
|
126
|
-
nullable?: boolean | undefined;
|
|
127
|
-
extra?: {
|
|
128
|
-
[x: string]: any;
|
|
129
|
-
} | undefined;
|
|
130
|
-
type: "intersection";
|
|
131
|
-
definition: {
|
|
132
|
-
left: JzodElement;
|
|
133
|
-
right: JzodElement;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
export type JzodMap = {
|
|
137
|
-
optional?: boolean | undefined;
|
|
138
|
-
nullable?: boolean | undefined;
|
|
139
|
-
extra?: {
|
|
140
|
-
[x: string]: any;
|
|
141
|
-
} | undefined;
|
|
142
|
-
type: "map";
|
|
143
|
-
definition: [
|
|
144
|
-
JzodElement,
|
|
145
|
-
JzodElement
|
|
146
|
-
];
|
|
147
|
-
};
|
|
148
|
-
export type JzodObject = {
|
|
149
|
-
optional?: boolean | undefined;
|
|
150
|
-
nullable?: boolean | undefined;
|
|
151
|
-
extra?: {
|
|
152
|
-
[x: string]: any;
|
|
153
|
-
} | undefined;
|
|
154
|
-
extend?: (JzodReference | JzodObject) | undefined;
|
|
155
|
-
type: "object";
|
|
156
|
-
nonStrict?: boolean | undefined;
|
|
157
|
-
definition: {
|
|
158
|
-
[x: string]: JzodElement;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
export type JzodPromise = {
|
|
162
|
-
optional?: boolean | undefined;
|
|
163
|
-
nullable?: boolean | undefined;
|
|
164
|
-
extra?: {
|
|
165
|
-
[x: string]: any;
|
|
166
|
-
} | undefined;
|
|
167
|
-
type: "promise";
|
|
168
|
-
definition: JzodElement;
|
|
169
|
-
};
|
|
170
|
-
export type JzodRecord = {
|
|
171
|
-
optional?: boolean | undefined;
|
|
172
|
-
nullable?: boolean | undefined;
|
|
173
|
-
extra?: {
|
|
174
|
-
[x: string]: any;
|
|
175
|
-
} | undefined;
|
|
176
|
-
type: "record";
|
|
177
|
-
definition: JzodElement;
|
|
178
|
-
};
|
|
179
|
-
export type JzodReference = {
|
|
180
|
-
optional?: boolean | undefined;
|
|
181
|
-
nullable?: boolean | undefined;
|
|
182
|
-
extra?: {
|
|
183
|
-
[x: string]: any;
|
|
184
|
-
} | undefined;
|
|
185
|
-
type: "schemaReference";
|
|
186
|
-
context?: {
|
|
187
|
-
[x: string]: JzodElement;
|
|
188
|
-
} | undefined;
|
|
189
|
-
definition: {
|
|
190
|
-
eager?: boolean | undefined;
|
|
191
|
-
relativePath?: string | undefined;
|
|
192
|
-
absolutePath?: string | undefined;
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
export type JzodSet = {
|
|
196
|
-
optional?: boolean | undefined;
|
|
197
|
-
nullable?: boolean | undefined;
|
|
198
|
-
extra?: {
|
|
199
|
-
[x: string]: any;
|
|
200
|
-
} | undefined;
|
|
201
|
-
type: "set";
|
|
202
|
-
definition: JzodElement;
|
|
203
|
-
};
|
|
204
|
-
export type JzodTuple = {
|
|
205
|
-
optional?: boolean | undefined;
|
|
206
|
-
nullable?: boolean | undefined;
|
|
207
|
-
extra?: {
|
|
208
|
-
[x: string]: any;
|
|
209
|
-
} | undefined;
|
|
210
|
-
type: "tuple";
|
|
211
|
-
definition: JzodElement[];
|
|
212
|
-
};
|
|
213
|
-
export type JzodUnion = {
|
|
214
|
-
optional?: boolean | undefined;
|
|
215
|
-
nullable?: boolean | undefined;
|
|
216
|
-
extra?: {
|
|
217
|
-
[x: string]: any;
|
|
218
|
-
} | undefined;
|
|
219
|
-
type: "union";
|
|
220
|
-
discriminator?: string | undefined;
|
|
221
|
-
definition: JzodElement[];
|
|
222
|
-
};
|
|
223
|
-
export type JzodBootstrapElementSchema = JzodElement;
|
|
224
|
-
export declare const jzodBaseObject: z.ZodType<JzodBaseObject>;
|
|
225
|
-
export declare const jzodArray: z.ZodType<JzodArray>;
|
|
226
|
-
export declare const jzodAttribute: z.ZodType<JzodAttribute>;
|
|
227
|
-
export declare const jzodAttributeDateValidations: z.ZodType<JzodAttributeDateValidations>;
|
|
228
|
-
export declare const jzodAttributeDateWithValidations: z.ZodType<JzodAttributeDateWithValidations>;
|
|
229
|
-
export declare const jzodAttributeNumberValidations: z.ZodType<JzodAttributeNumberValidations>;
|
|
230
|
-
export declare const jzodAttributeNumberWithValidations: z.ZodType<JzodAttributeNumberWithValidations>;
|
|
231
|
-
export declare const jzodAttributeStringValidations: z.ZodType<JzodAttributeStringValidations>;
|
|
232
|
-
export declare const jzodAttributeStringWithValidations: z.ZodType<JzodAttributeStringWithValidations>;
|
|
233
|
-
export declare const jzodElement: z.ZodType<JzodElement>;
|
|
234
|
-
export declare const jzodEnum: z.ZodType<JzodEnum>;
|
|
235
|
-
export declare const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes>;
|
|
236
|
-
export declare const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes>;
|
|
237
|
-
export declare const jzodFunction: z.ZodType<JzodFunction>;
|
|
238
|
-
export declare const jzodLazy: z.ZodType<JzodLazy>;
|
|
239
|
-
export declare const jzodLiteral: z.ZodType<JzodLiteral>;
|
|
240
|
-
export declare const jzodIntersection: z.ZodType<JzodIntersection>;
|
|
241
|
-
export declare const jzodMap: z.ZodType<JzodMap>;
|
|
242
|
-
export declare const jzodObject: z.ZodType<JzodObject>;
|
|
243
|
-
export declare const jzodPromise: z.ZodType<JzodPromise>;
|
|
244
|
-
export declare const jzodRecord: z.ZodType<JzodRecord>;
|
|
245
|
-
export declare const jzodReference: z.ZodType<JzodReference>;
|
|
246
|
-
export declare const jzodSet: z.ZodType<JzodSet>;
|
|
247
|
-
export declare const jzodTuple: z.ZodType<JzodTuple>;
|
|
248
|
-
export declare const jzodUnion: z.ZodType<JzodUnion>;
|
|
249
|
-
export declare const jzodBootstrapElementSchema: z.ZodLazy<ZodType<JzodElement, z.ZodTypeDef, JzodElement>>;
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { jzodToTsCode, jzodToTsTypeAliasesAndZodText, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, TsTypeAliases, } from "./JzodToTs";
|
|
2
|
-
export { printTsTypeAlias, printTsTypeAliases } from "./tools";
|
|
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";
|
package/dist/src/preBuild.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateZodSchemaFileFromJzodSchema(jzodElement: any, targetFileName: string, jzodSchemaVariableName: string): void;
|