@zenstackhq/zod 3.7.0-beta.1 → 3.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/index.d.cts +7 -2
- package/dist/index.d.mts +7 -2
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -32,7 +32,12 @@ type FieldTypeZodMap = {
|
|
|
32
32
|
type MapModelFieldToZod<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FieldType = GetModelFieldType<Schema, Model, Field>> = MapFieldTypeToZod<Schema, FieldType>;
|
|
33
33
|
type MapTypeDefFieldToZod<Schema extends SchemaDef, Type extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, Type>, FieldType = GetTypeDefFieldType<Schema, Type, Field>> = MapFieldTypeToZod<Schema, FieldType>;
|
|
34
34
|
type MapFieldTypeToZod<Schema extends SchemaDef, FieldType> = FieldType extends keyof FieldTypeZodMap ? FieldTypeZodMap[FieldType] : FieldType extends GetEnums<Schema> ? EnumZodType<Schema, FieldType> : FieldType extends GetTypeDefs<Schema> ? z$1.ZodObject<GetTypeDefFieldsShape<Schema, FieldType>, z$1.core.$strict> : z$1.ZodUnknown;
|
|
35
|
-
type
|
|
35
|
+
type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
|
|
36
|
+
type JsonObject = {
|
|
37
|
+
[key: string]: JsonValue;
|
|
38
|
+
};
|
|
39
|
+
type JsonArray = Array<JsonValue>;
|
|
40
|
+
type JsonZodType = z$1.ZodType<JsonValue>;
|
|
36
41
|
type EnumZodType<Schema extends SchemaDef, EnumName extends GetEnums<Schema>> = z$1.ZodEnum<{ [Key in keyof GetEnum<Schema, EnumName>]: GetEnum<Schema, EnumName>[Key] }>;
|
|
37
42
|
type ZodOptionalAndNullableIf<T extends z$1.ZodType, Condition extends boolean> = Condition extends true ? z$1.ZodOptional<z$1.ZodNullable<T>> : T;
|
|
38
43
|
type ZodOptionalIf<T extends z$1.ZodType, Condition extends boolean> = Condition extends true ? z$1.ZodOptional<T> : T;
|
|
@@ -263,5 +268,5 @@ declare function collectFieldRefs(expr: Expression): Set<string>;
|
|
|
263
268
|
*/
|
|
264
269
|
declare function addCustomValidation(schema: z.ZodSchema, attributes: readonly AttributeApplication[] | undefined, presentFields?: ReadonlySet<string>): z.ZodSchema;
|
|
265
270
|
//#endregion
|
|
266
|
-
export { type GetModelSchemaShapeWithOptions, type ModelSchemaOptions, utils_d_exports as ZodUtils, createSchemaFactory };
|
|
271
|
+
export { type GetModelSchemaShapeWithOptions, type JsonValue, type ModelSchemaOptions, utils_d_exports as ZodUtils, createSchemaFactory };
|
|
267
272
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -30,7 +30,12 @@ type FieldTypeZodMap = {
|
|
|
30
30
|
type MapModelFieldToZod<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FieldType = GetModelFieldType<Schema, Model, Field>> = MapFieldTypeToZod<Schema, FieldType>;
|
|
31
31
|
type MapTypeDefFieldToZod<Schema extends SchemaDef, Type extends GetTypeDefs<Schema>, Field extends GetTypeDefFields<Schema, Type>, FieldType = GetTypeDefFieldType<Schema, Type, Field>> = MapFieldTypeToZod<Schema, FieldType>;
|
|
32
32
|
type MapFieldTypeToZod<Schema extends SchemaDef, FieldType> = FieldType extends keyof FieldTypeZodMap ? FieldTypeZodMap[FieldType] : FieldType extends GetEnums<Schema> ? EnumZodType<Schema, FieldType> : FieldType extends GetTypeDefs<Schema> ? z$1.ZodObject<GetTypeDefFieldsShape<Schema, FieldType>, z$1.core.$strict> : z$1.ZodUnknown;
|
|
33
|
-
type
|
|
33
|
+
type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
|
|
34
|
+
type JsonObject = {
|
|
35
|
+
[key: string]: JsonValue;
|
|
36
|
+
};
|
|
37
|
+
type JsonArray = Array<JsonValue>;
|
|
38
|
+
type JsonZodType = z$1.ZodType<JsonValue>;
|
|
34
39
|
type EnumZodType<Schema extends SchemaDef, EnumName extends GetEnums<Schema>> = z$1.ZodEnum<{ [Key in keyof GetEnum<Schema, EnumName>]: GetEnum<Schema, EnumName>[Key] }>;
|
|
35
40
|
type ZodOptionalAndNullableIf<T extends z$1.ZodType, Condition extends boolean> = Condition extends true ? z$1.ZodOptional<z$1.ZodNullable<T>> : T;
|
|
36
41
|
type ZodOptionalIf<T extends z$1.ZodType, Condition extends boolean> = Condition extends true ? z$1.ZodOptional<T> : T;
|
|
@@ -261,5 +266,5 @@ declare function collectFieldRefs(expr: Expression): Set<string>;
|
|
|
261
266
|
*/
|
|
262
267
|
declare function addCustomValidation(schema: z.ZodSchema, attributes: readonly AttributeApplication[] | undefined, presentFields?: ReadonlySet<string>): z.ZodSchema;
|
|
263
268
|
//#endregion
|
|
264
|
-
export { type GetModelSchemaShapeWithOptions, type ModelSchemaOptions, utils_d_exports as ZodUtils, createSchemaFactory };
|
|
269
|
+
export { type GetModelSchemaShapeWithOptions, type JsonValue, type ModelSchemaOptions, utils_d_exports as ZodUtils, createSchemaFactory };
|
|
265
270
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@zenstackhq/zod",
|
|
3
3
|
"displayName": "ZenStack Zod Integration",
|
|
4
4
|
"description": "Automatically deriving Zod schemas from ZModel schemas",
|
|
5
|
-
"version": "3.7.0
|
|
5
|
+
"version": "3.7.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "ZenStack Team",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"decimal.js": "^10.4.3",
|
|
38
|
-
"@zenstackhq/schema": "3.7.0
|
|
38
|
+
"@zenstackhq/schema": "3.7.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"zod": "^4.1.0",
|
|
42
|
-
"@zenstackhq/
|
|
43
|
-
"@zenstackhq/
|
|
44
|
-
"@zenstackhq/vitest-config": "3.7.0
|
|
45
|
-
"@zenstackhq/eslint-config": "3.7.0
|
|
42
|
+
"@zenstackhq/tsdown-config": "3.7.0",
|
|
43
|
+
"@zenstackhq/typescript-config": "3.7.0",
|
|
44
|
+
"@zenstackhq/vitest-config": "3.7.0",
|
|
45
|
+
"@zenstackhq/eslint-config": "3.7.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"zod": "^4.0.0"
|