@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
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
|
@@ -20,6 +20,15 @@ type JzodAttribute = {
|
|
|
20
20
|
coerce?: boolean | undefined;
|
|
21
21
|
definition: JzodEnumAttributeTypes;
|
|
22
22
|
};
|
|
23
|
+
type JzodPlainAttribute = {
|
|
24
|
+
optional?: boolean | undefined;
|
|
25
|
+
nullable?: boolean | undefined;
|
|
26
|
+
extra?: {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
} | undefined;
|
|
29
|
+
type: JzodEnumAttributeTypes;
|
|
30
|
+
coerce?: boolean | undefined;
|
|
31
|
+
};
|
|
23
32
|
type JzodAttributeDateValidations = {
|
|
24
33
|
extra?: {
|
|
25
34
|
[x: string]: any;
|
|
@@ -38,6 +47,16 @@ type JzodAttributeDateWithValidations = {
|
|
|
38
47
|
coerce?: boolean | undefined;
|
|
39
48
|
validations: JzodAttributeDateValidations[];
|
|
40
49
|
};
|
|
50
|
+
type JzodAttributePlainDateWithValidations = {
|
|
51
|
+
optional?: boolean | undefined;
|
|
52
|
+
nullable?: boolean | undefined;
|
|
53
|
+
extra?: {
|
|
54
|
+
[x: string]: any;
|
|
55
|
+
} | undefined;
|
|
56
|
+
type: "date";
|
|
57
|
+
coerce?: boolean | undefined;
|
|
58
|
+
validations: JzodAttributeDateValidations[];
|
|
59
|
+
};
|
|
41
60
|
type JzodAttributeNumberValidations = {
|
|
42
61
|
extra?: {
|
|
43
62
|
[x: string]: any;
|
|
@@ -56,6 +75,16 @@ type JzodAttributeNumberWithValidations = {
|
|
|
56
75
|
coerce?: boolean | undefined;
|
|
57
76
|
validations: JzodAttributeNumberValidations[];
|
|
58
77
|
};
|
|
78
|
+
type JzodAttributePlainNumberWithValidations = {
|
|
79
|
+
optional?: boolean | undefined;
|
|
80
|
+
nullable?: boolean | undefined;
|
|
81
|
+
extra?: {
|
|
82
|
+
[x: string]: any;
|
|
83
|
+
} | undefined;
|
|
84
|
+
type: "number";
|
|
85
|
+
coerce?: boolean | undefined;
|
|
86
|
+
validations: JzodAttributeNumberValidations[];
|
|
87
|
+
};
|
|
59
88
|
type JzodAttributeStringValidations = {
|
|
60
89
|
extra?: {
|
|
61
90
|
[x: string]: any;
|
|
@@ -74,7 +103,17 @@ type JzodAttributeStringWithValidations = {
|
|
|
74
103
|
coerce?: boolean | undefined;
|
|
75
104
|
validations: JzodAttributeStringValidations[];
|
|
76
105
|
};
|
|
77
|
-
type
|
|
106
|
+
type JzodAttributePlainStringWithValidations = {
|
|
107
|
+
optional?: boolean | undefined;
|
|
108
|
+
nullable?: boolean | undefined;
|
|
109
|
+
extra?: {
|
|
110
|
+
[x: string]: any;
|
|
111
|
+
} | undefined;
|
|
112
|
+
type: "string";
|
|
113
|
+
coerce?: boolean | undefined;
|
|
114
|
+
validations: JzodAttributeStringValidations[];
|
|
115
|
+
};
|
|
116
|
+
type JzodElement = JzodArray | JzodAttribute | JzodPlainAttribute | JzodAttributeDateWithValidations | JzodAttributePlainDateWithValidations | JzodAttributeNumberWithValidations | JzodAttributePlainNumberWithValidations | JzodAttributeStringWithValidations | JzodAttributePlainStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
|
|
78
117
|
type JzodEnum = {
|
|
79
118
|
optional?: boolean | undefined;
|
|
80
119
|
nullable?: boolean | undefined;
|
|
@@ -85,7 +124,7 @@ type JzodEnum = {
|
|
|
85
124
|
definition: string[];
|
|
86
125
|
};
|
|
87
126
|
type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
|
|
88
|
-
type JzodEnumElementTypes = "array" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "tuple" | "union";
|
|
127
|
+
type JzodEnumElementTypes = "array" | "date" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "number" | "object" | "promise" | "record" | "schemaReference" | "set" | "simpleType" | "string" | "tuple" | "union";
|
|
89
128
|
type JzodFunction = {
|
|
90
129
|
optional?: boolean | undefined;
|
|
91
130
|
nullable?: boolean | undefined;
|
|
@@ -184,6 +223,7 @@ type JzodReference = {
|
|
|
184
223
|
} | undefined;
|
|
185
224
|
definition: {
|
|
186
225
|
eager?: boolean | undefined;
|
|
226
|
+
partial?: boolean | undefined;
|
|
187
227
|
relativePath?: string | undefined;
|
|
188
228
|
absolutePath?: string | undefined;
|
|
189
229
|
};
|
|
@@ -260,4 +300,4 @@ declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean,
|
|
|
260
300
|
declare function printTsTypeAlias(typeAlias: ts.TypeAliasDeclaration, exportPrefix?: boolean): string;
|
|
261
301
|
declare function printTsTypeAliases(typeAliases: TsTypeAliases, exportPrefix?: boolean): string;
|
|
262
302
|
|
|
263
|
-
export { JzodArray, JzodAttribute, JzodAttributeDateValidations, JzodAttributeDateWithValidations, JzodAttributeNumberValidations, JzodAttributeNumberWithValidations, JzodAttributeStringValidations, JzodAttributeStringWithValidations, JzodElement, JzodEnum, JzodEnumAttributeTypes, JzodEnumElementTypes, JzodFunction, JzodIntersection, JzodLazy, JzodLiteral, JzodMap, JzodObject, JzodPromise, JzodRecord, JzodReference, JzodSet, JzodTuple, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, JzodUnion, TsTypeAliases, jzodArray, jzodAttribute, jzodAttributeDateValidations, jzodAttributeDateWithValidations, jzodAttributeNumberValidations, jzodAttributeNumberWithValidations, jzodAttributeStringValidations, jzodAttributeStringWithValidations, jzodElement, jzodEnum, jzodEnumAttributeTypes, jzodEnumElementTypes, jzodFunction, jzodIntersection, jzodLazy, jzodLiteral, jzodMap, jzodObject, jzodPromise, jzodRecord, jzodReference, jzodSet, jzodToTsCode, jzodToTsTypeAliasesAndZodText, jzodTuple, jzodUnion, printTsTypeAlias, printTsTypeAliases };
|
|
303
|
+
export { JzodArray, JzodAttribute, JzodAttributeDateValidations, JzodAttributeDateWithValidations, JzodAttributeNumberValidations, JzodAttributeNumberWithValidations, JzodAttributePlainDateWithValidations, JzodAttributePlainNumberWithValidations, JzodAttributePlainStringWithValidations, JzodAttributeStringValidations, JzodAttributeStringWithValidations, JzodElement, JzodEnum, JzodEnumAttributeTypes, JzodEnumElementTypes, JzodFunction, JzodIntersection, JzodLazy, JzodLiteral, JzodMap, JzodObject, JzodPlainAttribute, JzodPromise, JzodRecord, JzodReference, JzodSet, JzodTuple, TsTypeAliasesAndZodText as JzodTypeAliasesAndZodText, JzodUnion, TsTypeAliases, jzodArray, jzodAttribute, jzodAttributeDateValidations, jzodAttributeDateWithValidations, jzodAttributeNumberValidations, jzodAttributeNumberWithValidations, jzodAttributeStringValidations, jzodAttributeStringWithValidations, jzodElement, jzodEnum, jzodEnumAttributeTypes, jzodEnumElementTypes, jzodFunction, jzodIntersection, jzodLazy, jzodLiteral, jzodMap, jzodObject, jzodPromise, jzodRecord, jzodReference, jzodSet, jzodToTsCode, jzodToTsTypeAliasesAndZodText, jzodTuple, jzodUnion, printTsTypeAlias, printTsTypeAliases };
|
package/dist/bundle.js
CHANGED
|
@@ -66,16 +66,20 @@ ${bodyJsCode}
|
|
|
66
66
|
z.object({ optional: z.boolean().optional(), nullable: z.boolean().optional(), extra: z.record(z.string(), z.any()).optional() }).strict();
|
|
67
67
|
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();
|
|
68
68
|
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();
|
|
69
|
+
const jzodPlainAttribute = z.object({ optional: z.boolean().optional(), nullable: z.boolean().optional(), extra: z.record(z.string(), z.any()).optional() }).strict().extend({ type: z.lazy(() => jzodEnumAttributeTypes), coerce: z.boolean().optional() }).strict();
|
|
69
70
|
const jzodAttributeDateValidations = z.object({ extra: z.record(z.string(), z.any()).optional(), type: z.enum(["min", "max"]), parameter: z.any() }).strict();
|
|
70
71
|
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();
|
|
72
|
+
const jzodAttributePlainDateWithValidations = z.object({ optional: z.boolean().optional(), nullable: z.boolean().optional(), extra: z.record(z.string(), z.any()).optional() }).strict().extend({ type: z.literal("date"), coerce: z.boolean().optional(), validations: z.array(z.lazy(() => jzodAttributeDateValidations)) }).strict();
|
|
71
73
|
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();
|
|
72
74
|
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();
|
|
75
|
+
const jzodAttributePlainNumberWithValidations = z.object({ optional: z.boolean().optional(), nullable: z.boolean().optional(), extra: z.record(z.string(), z.any()).optional() }).strict().extend({ type: z.literal("number"), coerce: z.boolean().optional(), validations: z.array(z.lazy(() => jzodAttributeNumberValidations)) }).strict();
|
|
73
76
|
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();
|
|
74
77
|
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();
|
|
75
|
-
const
|
|
78
|
+
const jzodAttributePlainStringWithValidations = z.object({ optional: z.boolean().optional(), nullable: z.boolean().optional(), extra: z.record(z.string(), z.any()).optional() }).strict().extend({ type: z.literal("string"), coerce: z.boolean().optional(), validations: z.array(z.lazy(() => jzodAttributeStringValidations)) }).strict();
|
|
79
|
+
const jzodElement = z.union([z.lazy(() => jzodArray), z.lazy(() => jzodAttribute), z.lazy(() => jzodPlainAttribute), z.lazy(() => jzodAttributeDateWithValidations), z.lazy(() => jzodAttributePlainDateWithValidations), z.lazy(() => jzodAttributeNumberWithValidations), z.lazy(() => jzodAttributePlainNumberWithValidations), z.lazy(() => jzodAttributeStringWithValidations), z.lazy(() => jzodAttributePlainStringWithValidations), 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)]);
|
|
76
80
|
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();
|
|
77
81
|
const jzodEnumAttributeTypes = z.enum(["any", "bigint", "boolean", "date", "never", "null", "number", "string", "uuid", "undefined", "unknown", "void"]);
|
|
78
|
-
const jzodEnumElementTypes = z.enum(["array", "enum", "function", "lazy", "literal", "intersection", "map", "object", "promise", "record", "schemaReference", "set", "simpleType", "tuple", "union"]);
|
|
82
|
+
const jzodEnumElementTypes = z.enum(["array", "date", "enum", "function", "lazy", "literal", "intersection", "map", "number", "object", "promise", "record", "schemaReference", "set", "simpleType", "string", "tuple", "union"]);
|
|
79
83
|
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
84
|
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
85
|
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();
|
|
@@ -84,7 +88,7 @@ const jzodMap = z.object({ optional: z.boolean().optional(), nullable: z.boolean
|
|
|
84
88
|
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
89
|
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
90
|
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();
|
|
91
|
+
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
92
|
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
93
|
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
94
|
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miroir-framework/jzod-ts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "The Typescript-related functionalities of Jzod.",
|
|
6
6
|
"main": "dist/bundle.js",
|
|
7
7
|
"types": "dist/bundle.d.ts",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"preBuild": "tsc --rootDir . --baseUrl . --module ESnext --target ES2017 --moduleResolution node --allowSyntheticDefaultImports --outdir ./tmp/ && node ./tmp/src/preBuild.js",
|
|
11
11
|
"preBuildRun": "node ./tmp/src/preBuild.js",
|
|
12
|
-
"compile": "npx tsc",
|
|
13
12
|
"build": "rollup --config",
|
|
14
13
|
"test": "cross-env NODE_ENV=test jest --verbose --silent=false -t"
|
|
15
14
|
},
|
|
@@ -17,8 +16,14 @@
|
|
|
17
16
|
"homepage": "https://github.com/miroir-framework/jzod/#readme",
|
|
18
17
|
"bugs": "https://github.com/miroir-framework/jzod/issues",
|
|
19
18
|
"license": "MIT",
|
|
19
|
+
"files": [
|
|
20
|
+
"LICENSE.md",
|
|
21
|
+
"package.json",
|
|
22
|
+
"dist/bundle.js",
|
|
23
|
+
"dist/bundle.d.ts"
|
|
24
|
+
],
|
|
20
25
|
"dependencies": {
|
|
21
|
-
"@miroir-framework/jzod": "0.
|
|
26
|
+
"@miroir-framework/jzod": "0.7.0",
|
|
22
27
|
"zod": "^3.22.2",
|
|
23
28
|
"zod-to-ts": "^1.2.0"
|
|
24
29
|
},
|
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,250 +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 | number | bigint | boolean;
|
|
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
|
-
partial?: 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
|
-
export declare const jzodBaseObject: z.ZodType<JzodBaseObject>;
|
|
226
|
-
export declare const jzodArray: z.ZodType<JzodArray>;
|
|
227
|
-
export declare const jzodAttribute: z.ZodType<JzodAttribute>;
|
|
228
|
-
export declare const jzodAttributeDateValidations: z.ZodType<JzodAttributeDateValidations>;
|
|
229
|
-
export declare const jzodAttributeDateWithValidations: z.ZodType<JzodAttributeDateWithValidations>;
|
|
230
|
-
export declare const jzodAttributeNumberValidations: z.ZodType<JzodAttributeNumberValidations>;
|
|
231
|
-
export declare const jzodAttributeNumberWithValidations: z.ZodType<JzodAttributeNumberWithValidations>;
|
|
232
|
-
export declare const jzodAttributeStringValidations: z.ZodType<JzodAttributeStringValidations>;
|
|
233
|
-
export declare const jzodAttributeStringWithValidations: z.ZodType<JzodAttributeStringWithValidations>;
|
|
234
|
-
export declare const jzodElement: z.ZodType<JzodElement>;
|
|
235
|
-
export declare const jzodEnum: z.ZodType<JzodEnum>;
|
|
236
|
-
export declare const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes>;
|
|
237
|
-
export declare const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes>;
|
|
238
|
-
export declare const jzodFunction: z.ZodType<JzodFunction>;
|
|
239
|
-
export declare const jzodLazy: z.ZodType<JzodLazy>;
|
|
240
|
-
export declare const jzodLiteral: z.ZodType<JzodLiteral>;
|
|
241
|
-
export declare const jzodIntersection: z.ZodType<JzodIntersection>;
|
|
242
|
-
export declare const jzodMap: z.ZodType<JzodMap>;
|
|
243
|
-
export declare const jzodObject: z.ZodType<JzodObject>;
|
|
244
|
-
export declare const jzodPromise: z.ZodType<JzodPromise>;
|
|
245
|
-
export declare const jzodRecord: z.ZodType<JzodRecord>;
|
|
246
|
-
export declare const jzodReference: z.ZodType<JzodReference>;
|
|
247
|
-
export declare const jzodSet: z.ZodType<JzodSet>;
|
|
248
|
-
export declare const jzodTuple: z.ZodType<JzodTuple>;
|
|
249
|
-
export declare const jzodUnion: z.ZodType<JzodUnion>;
|
|
250
|
-
export declare const jzodBootstrapElementSchema: z.ZodLazy<ZodType<JzodElement, z.ZodTypeDef, JzodElement>>;
|
|
@@ -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;
|