kysely-gen 0.12.0 → 0.12.1
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/cli.js +12 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -111644,21 +111644,16 @@ function transformColumnToZod(column, enums, enumResolver, mode, options) {
|
|
|
111644
111644
|
}
|
|
111645
111645
|
} else if (column.checkConstraint) {
|
|
111646
111646
|
if (column.checkConstraint.type === "boolean") {
|
|
111647
|
-
const unionSchema = {
|
|
111648
|
-
kind: "zod-union",
|
|
111649
|
-
schemas: [
|
|
111650
|
-
{ kind: "zod-literal", value: 0 },
|
|
111651
|
-
{ kind: "zod-literal", value: 1 }
|
|
111652
|
-
]
|
|
111653
|
-
};
|
|
111654
111647
|
if (options?.noBooleanCoerce) {
|
|
111655
|
-
schema = unionSchema;
|
|
111656
|
-
} else {
|
|
111657
111648
|
schema = {
|
|
111658
|
-
kind: "zod-
|
|
111659
|
-
|
|
111660
|
-
|
|
111649
|
+
kind: "zod-union",
|
|
111650
|
+
schemas: [
|
|
111651
|
+
{ kind: "zod-literal", value: 0 },
|
|
111652
|
+
{ kind: "zod-literal", value: 1 }
|
|
111653
|
+
]
|
|
111661
111654
|
};
|
|
111655
|
+
} else {
|
|
111656
|
+
schema = { kind: "zod-coerce", method: "boolean" };
|
|
111662
111657
|
}
|
|
111663
111658
|
} else if (column.checkConstraint.type === "string") {
|
|
111664
111659
|
schema = { kind: "zod-enum", values: column.checkConstraint.values };
|
|
@@ -111820,6 +111815,8 @@ function serializeZodSchema(node) {
|
|
|
111820
111815
|
return serializeZodCustom(node);
|
|
111821
111816
|
case "zod-transform":
|
|
111822
111817
|
return serializeZodTransform(node);
|
|
111818
|
+
case "zod-coerce":
|
|
111819
|
+
return serializeZodCoerce(node);
|
|
111823
111820
|
}
|
|
111824
111821
|
}
|
|
111825
111822
|
function serializeZodPrimitive(node) {
|
|
@@ -111872,6 +111869,9 @@ function serializeZodCustom(node) {
|
|
|
111872
111869
|
function serializeZodTransform(node) {
|
|
111873
111870
|
return `${serializeZodSchema(node.schema)}.transform(${node.transformFn})`;
|
|
111874
111871
|
}
|
|
111872
|
+
function serializeZodCoerce(node) {
|
|
111873
|
+
return `z.coerce.${node.method}()`;
|
|
111874
|
+
}
|
|
111875
111875
|
function serializeZodDeclaration(node) {
|
|
111876
111876
|
switch (node.kind) {
|
|
111877
111877
|
case "zod-import":
|