@miroir-framework/jzod-ts 0.7.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +226 -0
- package/dist/index.d.ts +405 -0
- package/dist/index.js +182 -0
- package/package.json +32 -24
- package/dist/bundle.d.ts +0 -303
- package/dist/bundle.js +0 -97
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Jzod-ts
|
|
2
|
-
|
|
1
|
+
# Jzod-ts
|
|
2
|
+
|
|
3
3
|
see [Jzod](https://github.com/miroir-framework/jzod) for usage information.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
jzodArray: () => jzodArray,
|
|
24
|
+
jzodAttributeDateValidations: () => jzodAttributeDateValidations,
|
|
25
|
+
jzodAttributeNumberValidations: () => jzodAttributeNumberValidations,
|
|
26
|
+
jzodAttributePlainDateWithValidations: () => jzodAttributePlainDateWithValidations,
|
|
27
|
+
jzodAttributePlainNumberWithValidations: () => jzodAttributePlainNumberWithValidations,
|
|
28
|
+
jzodAttributePlainStringWithValidations: () => jzodAttributePlainStringWithValidations,
|
|
29
|
+
jzodAttributeStringValidations: () => jzodAttributeStringValidations,
|
|
30
|
+
jzodElement: () => jzodElement,
|
|
31
|
+
jzodEnum: () => jzodEnum,
|
|
32
|
+
jzodEnumAttributeTypes: () => jzodEnumAttributeTypes,
|
|
33
|
+
jzodEnumElementTypes: () => jzodEnumElementTypes,
|
|
34
|
+
jzodFunction: () => jzodFunction,
|
|
35
|
+
jzodIntersection: () => jzodIntersection,
|
|
36
|
+
jzodLazy: () => jzodLazy,
|
|
37
|
+
jzodLiteral: () => jzodLiteral,
|
|
38
|
+
jzodMap: () => jzodMap,
|
|
39
|
+
jzodObject: () => jzodObject,
|
|
40
|
+
jzodPlainAttribute: () => jzodPlainAttribute,
|
|
41
|
+
jzodPromise: () => jzodPromise,
|
|
42
|
+
jzodRecord: () => jzodRecord,
|
|
43
|
+
jzodReference: () => jzodReference,
|
|
44
|
+
jzodSet: () => jzodSet,
|
|
45
|
+
jzodToTsCode: () => jzodToTsCode,
|
|
46
|
+
jzodToZodTextAndTsTypeAliases: () => jzodToZodTextAndTsTypeAliases,
|
|
47
|
+
jzodToZodTextAndZodSchemaForTsGeneration: () => jzodToZodTextAndZodSchemaForTsGeneration,
|
|
48
|
+
jzodTuple: () => jzodTuple,
|
|
49
|
+
jzodUnion: () => jzodUnion
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(index_exports);
|
|
52
|
+
|
|
53
|
+
// src/JzodToTs.ts
|
|
54
|
+
var import_zod_to_ts = require("zod-to-ts");
|
|
55
|
+
var import_jzod = require("@miroir-framework/jzod");
|
|
56
|
+
function jzodToZodTextAndZodSchemaForTsGeneration(element, context = {}) {
|
|
57
|
+
const contextFunction = () => context;
|
|
58
|
+
const elementZodSchemaAndDescription = (0, import_jzod.jzodToZodTextAndZodSchema)(
|
|
59
|
+
element,
|
|
60
|
+
contextFunction,
|
|
61
|
+
contextFunction,
|
|
62
|
+
{ typeScriptGeneration: true }
|
|
63
|
+
// typeScriptGeneration
|
|
64
|
+
);
|
|
65
|
+
return elementZodSchemaAndDescription;
|
|
66
|
+
}
|
|
67
|
+
function jzodToZodTextAndTsTypeText(element, context = {}, typeName) {
|
|
68
|
+
const elementZodSchemaAndDescription = jzodToZodTextAndZodSchemaForTsGeneration(
|
|
69
|
+
element,
|
|
70
|
+
context
|
|
71
|
+
);
|
|
72
|
+
const contextTsTypesStringObject = Object.fromEntries(
|
|
73
|
+
Object.entries(elementZodSchemaAndDescription.contextZodSchema ?? {}).map((curr) => {
|
|
74
|
+
const actualTypeName2 = curr[0] ? curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c) : "";
|
|
75
|
+
const tsNode = (0, import_zod_to_ts.zodToTs)(curr[1], typeName).node;
|
|
76
|
+
const typeAlias = (0, import_zod_to_ts.createTypeAlias)(tsNode, actualTypeName2);
|
|
77
|
+
const tsTypeString2 = (0, import_zod_to_ts.printNode)(typeAlias);
|
|
78
|
+
return [curr[0], tsTypeString2];
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
const actualTypeName = typeName ? typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c) : "";
|
|
82
|
+
const tsTypeStringNode = (0, import_zod_to_ts.zodToTs)(elementZodSchemaAndDescription.zodSchema, typeName).node;
|
|
83
|
+
const tsTypeAlias = (0, import_zod_to_ts.createTypeAlias)(tsTypeStringNode, actualTypeName);
|
|
84
|
+
const tsTypeString = (0, import_zod_to_ts.printNode)(tsTypeAlias);
|
|
85
|
+
return {
|
|
86
|
+
contextTsTypeText: contextTsTypesStringObject,
|
|
87
|
+
contextZodText: elementZodSchemaAndDescription.contextZodText ?? {},
|
|
88
|
+
zodText: elementZodSchemaAndDescription.zodText,
|
|
89
|
+
tsTypeText: tsTypeString
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function jzodToZodTextAndTsTypeAliases(element, context = {}, typeName) {
|
|
93
|
+
const jzodToTsTypeAliasesAndZodTextStartTime = Date.now();
|
|
94
|
+
console.log("@@@@@@@@@@@@@@@@@ jzodToZodTextAndTsTypeAliases start!", Object.keys(context).length);
|
|
95
|
+
console.log("jzodToZodTextAndTsTypeAliases context:", JSON.stringify(Object.keys(context)));
|
|
96
|
+
const elementZodSchemaAndDescription = jzodToZodTextAndZodSchemaForTsGeneration(
|
|
97
|
+
element,
|
|
98
|
+
context
|
|
99
|
+
);
|
|
100
|
+
console.log(
|
|
101
|
+
"jzodToZodTextAndTsTypeAliases jzodToZodTextAndZodSchemaForTsGeneration duration",
|
|
102
|
+
Date.now() - jzodToTsTypeAliasesAndZodTextStartTime,
|
|
103
|
+
"ms"
|
|
104
|
+
);
|
|
105
|
+
const contextTsTypesStringStartTime = Date.now();
|
|
106
|
+
const contextTsTypesString = Object.fromEntries(
|
|
107
|
+
Object.entries(elementZodSchemaAndDescription.contextZodSchema ?? {}).map((curr) => {
|
|
108
|
+
console.log("jzodToZodTextAndTsTypeAliases converting elementZodSchemaAndDescription entry", curr[0]);
|
|
109
|
+
const actualTypeName = curr[0] ? curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c) : "";
|
|
110
|
+
const tsNode = (0, import_zod_to_ts.zodToTs)(curr[1], typeName).node;
|
|
111
|
+
const typeAlias = (0, import_zod_to_ts.createTypeAlias)(tsNode, actualTypeName);
|
|
112
|
+
return [curr[0], typeAlias];
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
console.log(
|
|
116
|
+
"jzodToZodTextAndTsTypeAliases contextTsTypesString duration",
|
|
117
|
+
Date.now() - contextTsTypesStringStartTime,
|
|
118
|
+
"ms"
|
|
119
|
+
);
|
|
120
|
+
const tsTypeStringNodeStartTime = Date.now();
|
|
121
|
+
const tsTypeStringNode = (0, import_zod_to_ts.zodToTs)(elementZodSchemaAndDescription.zodSchema, typeName).node;
|
|
122
|
+
const tsTypeStringTypeAlias = (0, import_zod_to_ts.createTypeAlias)(tsTypeStringNode, typeName ?? "");
|
|
123
|
+
console.log(
|
|
124
|
+
"jzodToZodTextAndTsTypeAliases tsTypeStringNode duration",
|
|
125
|
+
Date.now() - tsTypeStringNodeStartTime,
|
|
126
|
+
"ms"
|
|
127
|
+
);
|
|
128
|
+
console.log("@@@@@@@@@@@@@@@@@ jzodToZodTextAndTsTypeAliases end in:", Date.now() - jzodToTsTypeAliasesAndZodTextStartTime, "ms");
|
|
129
|
+
return {
|
|
130
|
+
contextTsTypeAliases: contextTsTypesString,
|
|
131
|
+
contextZodText: elementZodSchemaAndDescription.contextZodText ?? {},
|
|
132
|
+
zodText: elementZodSchemaAndDescription.zodText,
|
|
133
|
+
mainTsTypeAlias: tsTypeStringTypeAlias
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function jzodToTsCode(typeName, jzodElement2, context = {}, exportPrefix = true, headerForZodImports = true, typeAnotationForSchema = [], extendedTsTypesText = "") {
|
|
137
|
+
console.log(
|
|
138
|
+
"################################### jzodToTsCode typeName",
|
|
139
|
+
typeName,
|
|
140
|
+
"jzodElement",
|
|
141
|
+
jzodElement2 && jzodElement2.context ? JSON.stringify(Object.keys(jzodElement2.context), null, 2) : void 0
|
|
142
|
+
);
|
|
143
|
+
const schemaName = typeName ? typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toLowerCase() + c) : "";
|
|
144
|
+
const actualTypeName = typeName ? typeName.replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c) : "";
|
|
145
|
+
const header = typeof headerForZodImports == "string" ? headerForZodImports : headerForZodImports ? `import { ZodType, ZodTypeAny, z } from "zod";` : "";
|
|
146
|
+
const tsTypeStringsAndZodText = jzodToZodTextAndTsTypeText(jzodElement2, context, actualTypeName);
|
|
147
|
+
const contextTsTypesString = tsTypeStringsAndZodText.contextTsTypeText ? Object.entries(tsTypeStringsAndZodText.contextTsTypeText).reduce((acc, curr) => {
|
|
148
|
+
return exportPrefix ? `${acc}
|
|
149
|
+
export ${curr[1]}` : `${acc}
|
|
150
|
+
${curr[1]}`;
|
|
151
|
+
}, "") : "";
|
|
152
|
+
const contextJsCode = tsTypeStringsAndZodText.contextZodText ? Object.entries(tsTypeStringsAndZodText.contextZodText).reduce((acc, curr) => {
|
|
153
|
+
const contextTypeName = curr[0] ? curr[0].replace(/^(.)(.*)$/, (a, b, c) => b.toUpperCase() + c) : "";
|
|
154
|
+
return typeAnotationForSchema.includes(curr[0]) ? `${acc}
|
|
155
|
+
export const ${curr[0]}: z.ZodType<${contextTypeName}> = ${curr[1]};` : `${acc}
|
|
156
|
+
export const ${curr[0]} = ${curr[1]};`;
|
|
157
|
+
}, "") : "";
|
|
158
|
+
const bodyTsCode = (exportPrefix ? "export " : "") + tsTypeStringsAndZodText.tsTypeText;
|
|
159
|
+
const bodyJsCode = typeAnotationForSchema.includes(schemaName ?? "") ? `export const ${schemaName}: z.ZodType<${actualTypeName}> = ${tsTypeStringsAndZodText.zodText};` : `export const ${schemaName} = ${tsTypeStringsAndZodText.zodText};`;
|
|
160
|
+
return `${header}
|
|
161
|
+
${extendedTsTypesText ?? ""}
|
|
162
|
+
${contextTsTypesString}
|
|
163
|
+
${bodyTsCode}
|
|
164
|
+
${contextJsCode}
|
|
165
|
+
${bodyJsCode}
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/generated_jzodBootstrapElementSchema.ts
|
|
170
|
+
var import_zod = require("zod");
|
|
171
|
+
var jzodBaseObject = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional() }).strict();
|
|
172
|
+
var jzodArray = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("array"), definition: import_zod.z.lazy(() => jzodElement) }).strict();
|
|
173
|
+
var jzodPlainAttribute = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.lazy(() => jzodEnumAttributeTypes), coerce: import_zod.z.boolean().optional() }).strict();
|
|
174
|
+
var jzodAttributeDateValidations = import_zod.z.object({ extra: import_zod.z.record(import_zod.z.string(), import_zod.z.any()).optional(), type: import_zod.z.enum(["min", "max"]), parameter: import_zod.z.any() }).strict();
|
|
175
|
+
var jzodAttributePlainDateWithValidations = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("date"), coerce: import_zod.z.boolean().optional(), validations: import_zod.z.array(import_zod.z.lazy(() => jzodAttributeDateValidations)) }).strict();
|
|
176
|
+
var jzodAttributeNumberValidations = import_zod.z.object({ extra: import_zod.z.record(import_zod.z.string(), import_zod.z.any()).optional(), type: import_zod.z.enum(["gt", "gte", "lt", "lte", "int", "positive", "nonpositive", "negative", "nonnegative", "multipleOf", "finite", "safe"]), parameter: import_zod.z.any() }).strict();
|
|
177
|
+
var jzodAttributePlainNumberWithValidations = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("number"), coerce: import_zod.z.boolean().optional(), validations: import_zod.z.array(import_zod.z.lazy(() => jzodAttributeNumberValidations)) }).strict();
|
|
178
|
+
var jzodAttributeStringValidations = import_zod.z.object({ extra: import_zod.z.record(import_zod.z.string(), import_zod.z.any()).optional(), type: import_zod.z.enum(["max", "min", "length", "email", "url", "emoji", "uuid", "cuid", "cuid2", "ulid", "regex", "includes", "startsWith", "endsWith", "datetime", "ip"]), parameter: import_zod.z.any() }).strict();
|
|
179
|
+
var jzodAttributePlainStringWithValidations = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("string"), coerce: import_zod.z.boolean().optional(), validations: import_zod.z.array(import_zod.z.lazy(() => jzodAttributeStringValidations)) }).strict();
|
|
180
|
+
var jzodElement = import_zod.z.union([import_zod.z.lazy(() => jzodArray), import_zod.z.lazy(() => jzodPlainAttribute), import_zod.z.lazy(() => jzodAttributePlainDateWithValidations), import_zod.z.lazy(() => jzodAttributePlainNumberWithValidations), import_zod.z.lazy(() => jzodAttributePlainStringWithValidations), import_zod.z.lazy(() => jzodEnum), import_zod.z.lazy(() => jzodFunction), import_zod.z.lazy(() => jzodLazy), import_zod.z.lazy(() => jzodLiteral), import_zod.z.lazy(() => jzodIntersection), import_zod.z.lazy(() => jzodMap), import_zod.z.lazy(() => jzodObject), import_zod.z.lazy(() => jzodPromise), import_zod.z.lazy(() => jzodRecord), import_zod.z.lazy(() => jzodReference), import_zod.z.lazy(() => jzodSet), import_zod.z.lazy(() => jzodTuple), import_zod.z.lazy(() => jzodUnion)]);
|
|
181
|
+
var jzodEnum = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("enum"), definition: import_zod.z.array(import_zod.z.string()) }).strict();
|
|
182
|
+
var jzodEnumAttributeTypes = import_zod.z.enum(["any", "bigint", "boolean", "date", "never", "null", "number", "string", "uuid", "undefined", "unknown", "void"]);
|
|
183
|
+
var jzodEnumElementTypes = import_zod.z.enum(["array", "date", "enum", "function", "lazy", "literal", "intersection", "map", "number", "object", "promise", "record", "schemaReference", "set", "string", "tuple", "union"]);
|
|
184
|
+
var jzodFunction = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("function"), definition: import_zod.z.object({ args: import_zod.z.array(import_zod.z.lazy(() => jzodElement)), returns: import_zod.z.lazy(() => jzodElement).optional() }).strict() }).strict();
|
|
185
|
+
var jzodLazy = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("lazy"), definition: import_zod.z.lazy(() => jzodReference) }).strict();
|
|
186
|
+
var jzodLiteral = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("literal"), definition: import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.bigint(), import_zod.z.boolean()]) }).strict();
|
|
187
|
+
var jzodIntersection = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("intersection"), definition: import_zod.z.object({ left: import_zod.z.lazy(() => jzodElement), right: import_zod.z.lazy(() => jzodElement) }).strict() }).strict();
|
|
188
|
+
var jzodMap = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("map"), definition: import_zod.z.tuple([import_zod.z.lazy(() => jzodElement), import_zod.z.lazy(() => jzodElement)]) }).strict();
|
|
189
|
+
var jzodObject = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), extend: import_zod.z.union([import_zod.z.union([import_zod.z.lazy(() => jzodReference), import_zod.z.lazy(() => jzodObject)]).optional(), import_zod.z.array(import_zod.z.union([import_zod.z.lazy(() => jzodReference), import_zod.z.lazy(() => jzodObject)]).optional())]).optional(), type: import_zod.z.literal("object"), nonStrict: import_zod.z.boolean().optional(), partial: import_zod.z.boolean().optional(), carryOn: import_zod.z.union([import_zod.z.lazy(() => jzodObject), import_zod.z.lazy(() => jzodUnion)]).optional(), definition: import_zod.z.record(import_zod.z.string(), import_zod.z.lazy(() => jzodElement)) }).strict();
|
|
190
|
+
var jzodPromise = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("promise"), definition: import_zod.z.lazy(() => jzodElement) }).strict();
|
|
191
|
+
var jzodRecord = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("record"), definition: import_zod.z.lazy(() => jzodElement) }).strict();
|
|
192
|
+
var jzodReference = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("schemaReference"), context: import_zod.z.record(import_zod.z.string(), import_zod.z.lazy(() => jzodElement)).optional(), carryOn: import_zod.z.union([import_zod.z.lazy(() => jzodObject), import_zod.z.lazy(() => jzodUnion)]).optional(), definition: import_zod.z.object({ eager: import_zod.z.boolean().optional(), partial: import_zod.z.boolean().optional(), relativePath: import_zod.z.string().optional(), absolutePath: import_zod.z.string().optional() }).strict() }).strict();
|
|
193
|
+
var jzodSet = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("set"), definition: import_zod.z.lazy(() => jzodElement) }).strict();
|
|
194
|
+
var jzodTuple = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("tuple"), definition: import_zod.z.array(import_zod.z.lazy(() => jzodElement)) }).strict();
|
|
195
|
+
var jzodUnion = import_zod.z.object({ optional: import_zod.z.boolean().optional(), nullable: import_zod.z.boolean().optional(), extra: import_zod.z.any().optional(), tag: import_zod.z.object({ value: import_zod.z.any(), schema: import_zod.z.object({ optional: import_zod.z.boolean().optional(), metaSchema: import_zod.z.lazy(() => jzodElement).optional(), valueSchema: import_zod.z.lazy(() => jzodElement).optional() }).strict().optional(), optional: import_zod.z.boolean().optional() }).strict().optional(), type: import_zod.z.literal("union"), optInDiscriminator: import_zod.z.boolean().optional(), discriminator: import_zod.z.union([import_zod.z.object({ discriminatorType: import_zod.z.literal("string"), value: import_zod.z.string() }).strict(), import_zod.z.object({ discriminatorType: import_zod.z.literal("array"), value: import_zod.z.array(import_zod.z.string()) }).strict()]).optional(), carryOn: import_zod.z.union([import_zod.z.lazy(() => jzodObject), import_zod.z.lazy(() => jzodUnion)]).optional(), definition: import_zod.z.array(import_zod.z.lazy(() => jzodElement)) }).strict();
|
|
196
|
+
var jzodBootstrapElementSchema = import_zod.z.lazy(() => jzodElement);
|
|
197
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
198
|
+
0 && (module.exports = {
|
|
199
|
+
jzodArray,
|
|
200
|
+
jzodAttributeDateValidations,
|
|
201
|
+
jzodAttributeNumberValidations,
|
|
202
|
+
jzodAttributePlainDateWithValidations,
|
|
203
|
+
jzodAttributePlainNumberWithValidations,
|
|
204
|
+
jzodAttributePlainStringWithValidations,
|
|
205
|
+
jzodAttributeStringValidations,
|
|
206
|
+
jzodElement,
|
|
207
|
+
jzodEnum,
|
|
208
|
+
jzodEnumAttributeTypes,
|
|
209
|
+
jzodEnumElementTypes,
|
|
210
|
+
jzodFunction,
|
|
211
|
+
jzodIntersection,
|
|
212
|
+
jzodLazy,
|
|
213
|
+
jzodLiteral,
|
|
214
|
+
jzodMap,
|
|
215
|
+
jzodObject,
|
|
216
|
+
jzodPlainAttribute,
|
|
217
|
+
jzodPromise,
|
|
218
|
+
jzodRecord,
|
|
219
|
+
jzodReference,
|
|
220
|
+
jzodSet,
|
|
221
|
+
jzodToTsCode,
|
|
222
|
+
jzodToZodTextAndTsTypeAliases,
|
|
223
|
+
jzodToZodTextAndZodSchemaForTsGeneration,
|
|
224
|
+
jzodTuple,
|
|
225
|
+
jzodUnion
|
|
226
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { ZodTextAndZodSchemaRecord, ZodTextAndZodSchema } from '@miroir-framework/jzod';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
interface TsTypeAliasesAndZodText {
|
|
6
|
+
contextTsTypeAliases: {
|
|
7
|
+
[k: string]: ts.TypeAliasDeclaration;
|
|
8
|
+
};
|
|
9
|
+
contextZodText: {
|
|
10
|
+
[k: string]: string;
|
|
11
|
+
};
|
|
12
|
+
mainTsTypeAlias: ts.TypeAliasDeclaration;
|
|
13
|
+
zodText: string;
|
|
14
|
+
}
|
|
15
|
+
declare function jzodToZodTextAndZodSchemaForTsGeneration(element: any, // to avoid circularity on JzodElement
|
|
16
|
+
context?: ZodTextAndZodSchemaRecord): ZodTextAndZodSchema;
|
|
17
|
+
declare function jzodToZodTextAndTsTypeAliases(element: any, // to avoid circularity on JzodElement
|
|
18
|
+
context?: ZodTextAndZodSchemaRecord, typeName?: string): TsTypeAliasesAndZodText;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param typeName the name given to the resulting TS type definition
|
|
22
|
+
* @param jzodElement the JzodElement to convert to TS code
|
|
23
|
+
* @param context the context of the JzodElement, to be used for recursive types, for example.
|
|
24
|
+
* @param exportPrefix true if the resulting TS code should be prefixed with "export "
|
|
25
|
+
* @param typeAnotationForSchema adds a type annotation for the resulting TS type definition, in the form of ZodType<typeName>. This is useful for the linter, to precisely define the type, instead of relying on potentially coarser type inference mechanism. Recursive types cannot use this feature.
|
|
26
|
+
* @param extendedTsTypesText a string containing additional TS types to be included in the resulting TS code, for example, types that are used in the context of the JzodElement, but are not defined in the JzodElement itself.
|
|
27
|
+
* @returns a string containing the resulting TS code
|
|
28
|
+
*/
|
|
29
|
+
declare function jzodToTsCode(typeName: string, jzodElement: any, // to avoid circulatity on JzodElement
|
|
30
|
+
context?: ZodTextAndZodSchemaRecord, exportPrefix?: boolean, headerForZodImports?: boolean | string, typeAnotationForSchema?: string[], extendedTsTypesText?: string): string;
|
|
31
|
+
|
|
32
|
+
type JzodArray = {
|
|
33
|
+
optional?: boolean | undefined;
|
|
34
|
+
nullable?: boolean | undefined;
|
|
35
|
+
extra?: any | undefined;
|
|
36
|
+
tag?: {
|
|
37
|
+
value?: any;
|
|
38
|
+
schema?: {
|
|
39
|
+
optional?: boolean | undefined;
|
|
40
|
+
metaSchema?: JzodElement | undefined;
|
|
41
|
+
valueSchema?: JzodElement | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
optional?: boolean | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
type: "array";
|
|
46
|
+
definition: JzodElement;
|
|
47
|
+
};
|
|
48
|
+
type JzodPlainAttribute = {
|
|
49
|
+
optional?: boolean | undefined;
|
|
50
|
+
nullable?: boolean | undefined;
|
|
51
|
+
extra?: any | undefined;
|
|
52
|
+
tag?: {
|
|
53
|
+
value?: any;
|
|
54
|
+
schema?: {
|
|
55
|
+
optional?: boolean | undefined;
|
|
56
|
+
metaSchema?: JzodElement | undefined;
|
|
57
|
+
valueSchema?: JzodElement | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
optional?: boolean | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
type: JzodEnumAttributeTypes;
|
|
62
|
+
coerce?: boolean | undefined;
|
|
63
|
+
};
|
|
64
|
+
type JzodAttributeDateValidations = {
|
|
65
|
+
extra?: {
|
|
66
|
+
[x: string]: any;
|
|
67
|
+
} | undefined;
|
|
68
|
+
type: "min" | "max";
|
|
69
|
+
parameter?: any;
|
|
70
|
+
};
|
|
71
|
+
type JzodAttributePlainDateWithValidations = {
|
|
72
|
+
optional?: boolean | undefined;
|
|
73
|
+
nullable?: boolean | undefined;
|
|
74
|
+
extra?: any | undefined;
|
|
75
|
+
tag?: {
|
|
76
|
+
value?: any;
|
|
77
|
+
schema?: {
|
|
78
|
+
optional?: boolean | undefined;
|
|
79
|
+
metaSchema?: JzodElement | undefined;
|
|
80
|
+
valueSchema?: JzodElement | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
optional?: boolean | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
type: "date";
|
|
85
|
+
coerce?: boolean | undefined;
|
|
86
|
+
validations: JzodAttributeDateValidations[];
|
|
87
|
+
};
|
|
88
|
+
type JzodAttributeNumberValidations = {
|
|
89
|
+
extra?: {
|
|
90
|
+
[x: string]: any;
|
|
91
|
+
} | undefined;
|
|
92
|
+
type: "gt" | "gte" | "lt" | "lte" | "int" | "positive" | "nonpositive" | "negative" | "nonnegative" | "multipleOf" | "finite" | "safe";
|
|
93
|
+
parameter?: any;
|
|
94
|
+
};
|
|
95
|
+
type JzodAttributePlainNumberWithValidations = {
|
|
96
|
+
optional?: boolean | undefined;
|
|
97
|
+
nullable?: boolean | undefined;
|
|
98
|
+
extra?: any | undefined;
|
|
99
|
+
tag?: {
|
|
100
|
+
value?: any;
|
|
101
|
+
schema?: {
|
|
102
|
+
optional?: boolean | undefined;
|
|
103
|
+
metaSchema?: JzodElement | undefined;
|
|
104
|
+
valueSchema?: JzodElement | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
optional?: boolean | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
type: "number";
|
|
109
|
+
coerce?: boolean | undefined;
|
|
110
|
+
validations: JzodAttributeNumberValidations[];
|
|
111
|
+
};
|
|
112
|
+
type JzodAttributeStringValidations = {
|
|
113
|
+
extra?: {
|
|
114
|
+
[x: string]: any;
|
|
115
|
+
} | undefined;
|
|
116
|
+
type: "max" | "min" | "length" | "email" | "url" | "emoji" | "uuid" | "cuid" | "cuid2" | "ulid" | "regex" | "includes" | "startsWith" | "endsWith" | "datetime" | "ip";
|
|
117
|
+
parameter?: any;
|
|
118
|
+
};
|
|
119
|
+
type JzodAttributePlainStringWithValidations = {
|
|
120
|
+
optional?: boolean | undefined;
|
|
121
|
+
nullable?: boolean | undefined;
|
|
122
|
+
extra?: any | undefined;
|
|
123
|
+
tag?: {
|
|
124
|
+
value?: any;
|
|
125
|
+
schema?: {
|
|
126
|
+
optional?: boolean | undefined;
|
|
127
|
+
metaSchema?: JzodElement | undefined;
|
|
128
|
+
valueSchema?: JzodElement | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
optional?: boolean | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
type: "string";
|
|
133
|
+
coerce?: boolean | undefined;
|
|
134
|
+
validations: JzodAttributeStringValidations[];
|
|
135
|
+
};
|
|
136
|
+
type JzodElement = JzodArray | JzodPlainAttribute | JzodAttributePlainDateWithValidations | JzodAttributePlainNumberWithValidations | JzodAttributePlainStringWithValidations | JzodEnum | JzodFunction | JzodLazy | JzodLiteral | JzodIntersection | JzodMap | JzodObject | JzodPromise | JzodRecord | JzodReference | JzodSet | JzodTuple | JzodUnion;
|
|
137
|
+
type JzodEnum = {
|
|
138
|
+
optional?: boolean | undefined;
|
|
139
|
+
nullable?: boolean | undefined;
|
|
140
|
+
extra?: any | undefined;
|
|
141
|
+
tag?: {
|
|
142
|
+
value?: any;
|
|
143
|
+
schema?: {
|
|
144
|
+
optional?: boolean | undefined;
|
|
145
|
+
metaSchema?: JzodElement | undefined;
|
|
146
|
+
valueSchema?: JzodElement | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
optional?: boolean | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
type: "enum";
|
|
151
|
+
definition: string[];
|
|
152
|
+
};
|
|
153
|
+
type JzodEnumAttributeTypes = "any" | "bigint" | "boolean" | "date" | "never" | "null" | "number" | "string" | "uuid" | "undefined" | "unknown" | "void";
|
|
154
|
+
type JzodEnumElementTypes = "array" | "date" | "enum" | "function" | "lazy" | "literal" | "intersection" | "map" | "number" | "object" | "promise" | "record" | "schemaReference" | "set" | "string" | "tuple" | "union";
|
|
155
|
+
type JzodFunction = {
|
|
156
|
+
optional?: boolean | undefined;
|
|
157
|
+
nullable?: boolean | undefined;
|
|
158
|
+
extra?: any | undefined;
|
|
159
|
+
tag?: {
|
|
160
|
+
value?: any;
|
|
161
|
+
schema?: {
|
|
162
|
+
optional?: boolean | undefined;
|
|
163
|
+
metaSchema?: JzodElement | undefined;
|
|
164
|
+
valueSchema?: JzodElement | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
optional?: boolean | undefined;
|
|
167
|
+
} | undefined;
|
|
168
|
+
type: "function";
|
|
169
|
+
definition: {
|
|
170
|
+
args: JzodElement[];
|
|
171
|
+
returns?: JzodElement | undefined;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
type JzodLazy = {
|
|
175
|
+
optional?: boolean | undefined;
|
|
176
|
+
nullable?: boolean | undefined;
|
|
177
|
+
extra?: any | undefined;
|
|
178
|
+
tag?: {
|
|
179
|
+
value?: any;
|
|
180
|
+
schema?: {
|
|
181
|
+
optional?: boolean | undefined;
|
|
182
|
+
metaSchema?: JzodElement | undefined;
|
|
183
|
+
valueSchema?: JzodElement | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
optional?: boolean | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
type: "lazy";
|
|
188
|
+
definition: JzodReference;
|
|
189
|
+
};
|
|
190
|
+
type JzodLiteral = {
|
|
191
|
+
optional?: boolean | undefined;
|
|
192
|
+
nullable?: boolean | undefined;
|
|
193
|
+
extra?: any | undefined;
|
|
194
|
+
tag?: {
|
|
195
|
+
value?: any;
|
|
196
|
+
schema?: {
|
|
197
|
+
optional?: boolean | undefined;
|
|
198
|
+
metaSchema?: JzodElement | undefined;
|
|
199
|
+
valueSchema?: JzodElement | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
optional?: boolean | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
type: "literal";
|
|
204
|
+
definition: string | number | bigint | boolean;
|
|
205
|
+
};
|
|
206
|
+
type JzodIntersection = {
|
|
207
|
+
optional?: boolean | undefined;
|
|
208
|
+
nullable?: boolean | undefined;
|
|
209
|
+
extra?: any | undefined;
|
|
210
|
+
tag?: {
|
|
211
|
+
value?: any;
|
|
212
|
+
schema?: {
|
|
213
|
+
optional?: boolean | undefined;
|
|
214
|
+
metaSchema?: JzodElement | undefined;
|
|
215
|
+
valueSchema?: JzodElement | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
optional?: boolean | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
type: "intersection";
|
|
220
|
+
definition: {
|
|
221
|
+
left: JzodElement;
|
|
222
|
+
right: JzodElement;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
type JzodMap = {
|
|
226
|
+
optional?: boolean | undefined;
|
|
227
|
+
nullable?: boolean | undefined;
|
|
228
|
+
extra?: any | undefined;
|
|
229
|
+
tag?: {
|
|
230
|
+
value?: any;
|
|
231
|
+
schema?: {
|
|
232
|
+
optional?: boolean | undefined;
|
|
233
|
+
metaSchema?: JzodElement | undefined;
|
|
234
|
+
valueSchema?: JzodElement | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
optional?: boolean | undefined;
|
|
237
|
+
} | undefined;
|
|
238
|
+
type: "map";
|
|
239
|
+
definition: [
|
|
240
|
+
JzodElement,
|
|
241
|
+
JzodElement
|
|
242
|
+
];
|
|
243
|
+
};
|
|
244
|
+
type JzodObject = {
|
|
245
|
+
optional?: boolean | undefined;
|
|
246
|
+
nullable?: boolean | undefined;
|
|
247
|
+
extra?: any | undefined;
|
|
248
|
+
tag?: {
|
|
249
|
+
value?: any;
|
|
250
|
+
schema?: {
|
|
251
|
+
optional?: boolean | undefined;
|
|
252
|
+
metaSchema?: JzodElement | undefined;
|
|
253
|
+
valueSchema?: JzodElement | undefined;
|
|
254
|
+
} | undefined;
|
|
255
|
+
optional?: boolean | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
extend?: (((JzodReference | JzodObject) | undefined) | ((JzodReference | JzodObject) | undefined)[]) | undefined;
|
|
258
|
+
type: "object";
|
|
259
|
+
nonStrict?: boolean | undefined;
|
|
260
|
+
partial?: boolean | undefined;
|
|
261
|
+
carryOn?: (JzodObject | JzodUnion) | undefined;
|
|
262
|
+
definition: {
|
|
263
|
+
[x: string]: JzodElement;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
type JzodPromise = {
|
|
267
|
+
optional?: boolean | undefined;
|
|
268
|
+
nullable?: boolean | undefined;
|
|
269
|
+
extra?: any | undefined;
|
|
270
|
+
tag?: {
|
|
271
|
+
value?: any;
|
|
272
|
+
schema?: {
|
|
273
|
+
optional?: boolean | undefined;
|
|
274
|
+
metaSchema?: JzodElement | undefined;
|
|
275
|
+
valueSchema?: JzodElement | undefined;
|
|
276
|
+
} | undefined;
|
|
277
|
+
optional?: boolean | undefined;
|
|
278
|
+
} | undefined;
|
|
279
|
+
type: "promise";
|
|
280
|
+
definition: JzodElement;
|
|
281
|
+
};
|
|
282
|
+
type JzodRecord = {
|
|
283
|
+
optional?: boolean | undefined;
|
|
284
|
+
nullable?: boolean | undefined;
|
|
285
|
+
extra?: any | undefined;
|
|
286
|
+
tag?: {
|
|
287
|
+
value?: any;
|
|
288
|
+
schema?: {
|
|
289
|
+
optional?: boolean | undefined;
|
|
290
|
+
metaSchema?: JzodElement | undefined;
|
|
291
|
+
valueSchema?: JzodElement | undefined;
|
|
292
|
+
} | undefined;
|
|
293
|
+
optional?: boolean | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
type: "record";
|
|
296
|
+
definition: JzodElement;
|
|
297
|
+
};
|
|
298
|
+
type JzodReference = {
|
|
299
|
+
optional?: boolean | undefined;
|
|
300
|
+
nullable?: boolean | undefined;
|
|
301
|
+
extra?: any | undefined;
|
|
302
|
+
tag?: {
|
|
303
|
+
value?: any;
|
|
304
|
+
schema?: {
|
|
305
|
+
optional?: boolean | undefined;
|
|
306
|
+
metaSchema?: JzodElement | undefined;
|
|
307
|
+
valueSchema?: JzodElement | undefined;
|
|
308
|
+
} | undefined;
|
|
309
|
+
optional?: boolean | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
type: "schemaReference";
|
|
312
|
+
context?: {
|
|
313
|
+
[x: string]: JzodElement;
|
|
314
|
+
} | undefined;
|
|
315
|
+
carryOn?: (JzodObject | JzodUnion) | undefined;
|
|
316
|
+
definition: {
|
|
317
|
+
eager?: boolean | undefined;
|
|
318
|
+
partial?: boolean | undefined;
|
|
319
|
+
relativePath?: string | undefined;
|
|
320
|
+
absolutePath?: string | undefined;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
type JzodSet = {
|
|
324
|
+
optional?: boolean | undefined;
|
|
325
|
+
nullable?: boolean | undefined;
|
|
326
|
+
extra?: any | undefined;
|
|
327
|
+
tag?: {
|
|
328
|
+
value?: any;
|
|
329
|
+
schema?: {
|
|
330
|
+
optional?: boolean | undefined;
|
|
331
|
+
metaSchema?: JzodElement | undefined;
|
|
332
|
+
valueSchema?: JzodElement | undefined;
|
|
333
|
+
} | undefined;
|
|
334
|
+
optional?: boolean | undefined;
|
|
335
|
+
} | undefined;
|
|
336
|
+
type: "set";
|
|
337
|
+
definition: JzodElement;
|
|
338
|
+
};
|
|
339
|
+
type JzodTuple = {
|
|
340
|
+
optional?: boolean | undefined;
|
|
341
|
+
nullable?: boolean | undefined;
|
|
342
|
+
extra?: any | undefined;
|
|
343
|
+
tag?: {
|
|
344
|
+
value?: any;
|
|
345
|
+
schema?: {
|
|
346
|
+
optional?: boolean | undefined;
|
|
347
|
+
metaSchema?: JzodElement | undefined;
|
|
348
|
+
valueSchema?: JzodElement | undefined;
|
|
349
|
+
} | undefined;
|
|
350
|
+
optional?: boolean | undefined;
|
|
351
|
+
} | undefined;
|
|
352
|
+
type: "tuple";
|
|
353
|
+
definition: JzodElement[];
|
|
354
|
+
};
|
|
355
|
+
type JzodUnion = {
|
|
356
|
+
optional?: boolean | undefined;
|
|
357
|
+
nullable?: boolean | undefined;
|
|
358
|
+
extra?: any | undefined;
|
|
359
|
+
tag?: {
|
|
360
|
+
value?: any;
|
|
361
|
+
schema?: {
|
|
362
|
+
optional?: boolean | undefined;
|
|
363
|
+
metaSchema?: JzodElement | undefined;
|
|
364
|
+
valueSchema?: JzodElement | undefined;
|
|
365
|
+
} | undefined;
|
|
366
|
+
optional?: boolean | undefined;
|
|
367
|
+
} | undefined;
|
|
368
|
+
type: "union";
|
|
369
|
+
optInDiscriminator?: boolean | undefined;
|
|
370
|
+
discriminator?: ({
|
|
371
|
+
discriminatorType: "string";
|
|
372
|
+
value: string;
|
|
373
|
+
} | {
|
|
374
|
+
discriminatorType: "array";
|
|
375
|
+
value: string[];
|
|
376
|
+
}) | undefined;
|
|
377
|
+
carryOn?: (JzodObject | JzodUnion) | undefined;
|
|
378
|
+
definition: JzodElement[];
|
|
379
|
+
};
|
|
380
|
+
declare const jzodArray: z.ZodType<JzodArray>;
|
|
381
|
+
declare const jzodPlainAttribute: z.ZodType<JzodPlainAttribute>;
|
|
382
|
+
declare const jzodAttributeDateValidations: z.ZodType<JzodAttributeDateValidations>;
|
|
383
|
+
declare const jzodAttributePlainDateWithValidations: z.ZodType<JzodAttributePlainDateWithValidations>;
|
|
384
|
+
declare const jzodAttributeNumberValidations: z.ZodType<JzodAttributeNumberValidations>;
|
|
385
|
+
declare const jzodAttributePlainNumberWithValidations: z.ZodType<JzodAttributePlainNumberWithValidations>;
|
|
386
|
+
declare const jzodAttributeStringValidations: z.ZodType<JzodAttributeStringValidations>;
|
|
387
|
+
declare const jzodAttributePlainStringWithValidations: z.ZodType<JzodAttributePlainStringWithValidations>;
|
|
388
|
+
declare const jzodElement: z.ZodType<JzodElement>;
|
|
389
|
+
declare const jzodEnum: z.ZodType<JzodEnum>;
|
|
390
|
+
declare const jzodEnumAttributeTypes: z.ZodType<JzodEnumAttributeTypes>;
|
|
391
|
+
declare const jzodEnumElementTypes: z.ZodType<JzodEnumElementTypes>;
|
|
392
|
+
declare const jzodFunction: z.ZodType<JzodFunction>;
|
|
393
|
+
declare const jzodLazy: z.ZodType<JzodLazy>;
|
|
394
|
+
declare const jzodLiteral: z.ZodType<JzodLiteral>;
|
|
395
|
+
declare const jzodIntersection: z.ZodType<JzodIntersection>;
|
|
396
|
+
declare const jzodMap: z.ZodType<JzodMap>;
|
|
397
|
+
declare const jzodObject: z.ZodType<JzodObject>;
|
|
398
|
+
declare const jzodPromise: z.ZodType<JzodPromise>;
|
|
399
|
+
declare const jzodRecord: z.ZodType<JzodRecord>;
|
|
400
|
+
declare const jzodReference: z.ZodType<JzodReference>;
|
|
401
|
+
declare const jzodSet: z.ZodType<JzodSet>;
|
|
402
|
+
declare const jzodTuple: z.ZodType<JzodTuple>;
|
|
403
|
+
declare const jzodUnion: z.ZodType<JzodUnion>;
|
|
404
|
+
|
|
405
|
+
export { type JzodArray, type JzodAttributeDateValidations, type JzodAttributeNumberValidations, type JzodAttributePlainDateWithValidations, type JzodAttributePlainNumberWithValidations, type JzodAttributePlainStringWithValidations, type JzodAttributeStringValidations, type JzodElement, type JzodEnum, type JzodEnumAttributeTypes, type JzodEnumElementTypes, type JzodFunction, type JzodIntersection, type JzodLazy, type JzodLiteral, type JzodMap, type JzodObject, type JzodPlainAttribute, type JzodPromise, type JzodRecord, type JzodReference, type JzodSet, type JzodTuple, type JzodUnion, jzodArray, jzodAttributeDateValidations, jzodAttributeNumberValidations, jzodAttributePlainDateWithValidations, jzodAttributePlainNumberWithValidations, jzodAttributePlainStringWithValidations, jzodAttributeStringValidations, jzodElement, jzodEnum, jzodEnumAttributeTypes, jzodEnumElementTypes, jzodFunction, jzodIntersection, jzodLazy, jzodLiteral, jzodMap, jzodObject, jzodPlainAttribute, jzodPromise, jzodRecord, jzodReference, jzodSet, jzodToTsCode, jzodToZodTextAndTsTypeAliases, jzodToZodTextAndZodSchemaForTsGeneration, jzodTuple, jzodUnion };
|