@miroir-framework/jzod-ts 0.6.3 → 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/dist/bundle.d.ts +42 -3
- package/dist/bundle.js +6 -2
- package/package.json +2 -3
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;
|
|
@@ -261,4 +300,4 @@ declare function jzodToTsCode(jzodElement: JzodElement, exportPrefix?: boolean,
|
|
|
261
300
|
declare function printTsTypeAlias(typeAlias: ts.TypeAliasDeclaration, exportPrefix?: boolean): string;
|
|
262
301
|
declare function printTsTypeAliases(typeAliases: TsTypeAliases, exportPrefix?: boolean): string;
|
|
263
302
|
|
|
264
|
-
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();
|
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
|
},
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"dist/bundle.d.ts"
|
|
25
24
|
],
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@miroir-framework/jzod": "0.
|
|
26
|
+
"@miroir-framework/jzod": "0.7.0",
|
|
28
27
|
"zod": "^3.22.2",
|
|
29
28
|
"zod-to-ts": "^1.2.0"
|
|
30
29
|
},
|