mutano 3.0.14 → 3.0.15
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/main.js +3 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -252,7 +252,7 @@ function getType(op, desc, config, destination) {
|
|
|
252
252
|
finalType = `${zodOverrideType}.${nullableMethod}()`;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
if ((op === "table" || op === "insertable"
|
|
255
|
+
if ((op === "table" || op === "insertable") && hasDefaultValue && Default !== null && !isGenerated) {
|
|
256
256
|
let defaultValueFormatted = Default;
|
|
257
257
|
if (typeMappings.stringTypes.includes(type) || typeMappings.dateTypes.includes(type)) {
|
|
258
258
|
defaultValueFormatted = `'${Default}'`;
|
|
@@ -301,7 +301,7 @@ function getType(op, desc, config, destination) {
|
|
|
301
301
|
if (isZodDestination) {
|
|
302
302
|
const enumString = `z.enum([${enumValues.map((v) => `'${v}'`).join(",")}])`;
|
|
303
303
|
const nullishOption = destination.nullish;
|
|
304
|
-
if ((op === "table" || op === "insertable"
|
|
304
|
+
if ((op === "table" || op === "insertable") && hasDefaultValue && Default !== null && !isGenerated) {
|
|
305
305
|
if (shouldBeNullable) {
|
|
306
306
|
const nullableMethod = nullishOption ? "nullish" : "nullable";
|
|
307
307
|
return `${enumString}.${nullableMethod}().default('${Default}')`;
|
|
@@ -403,7 +403,7 @@ function generateStandardType(op, desc, config, destination, typeMappings) {
|
|
|
403
403
|
baseType = isZodDestination ? "z.string()" : "string";
|
|
404
404
|
}
|
|
405
405
|
if (isZodDestination) {
|
|
406
|
-
if ((op === "table" || op === "insertable"
|
|
406
|
+
if ((op === "table" || op === "insertable") && hasDefaultValue && Default !== null && !isGenerated) {
|
|
407
407
|
let defaultValueFormatted = Default;
|
|
408
408
|
if (typeMappings.stringTypes.includes(type) || typeMappings.dateTypes.includes(type)) {
|
|
409
409
|
defaultValueFormatted = `'${Default}'`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mutano",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.15",
|
|
5
5
|
"description": "Converts Prisma/MySQL/PostgreSQL/SQLite schemas to Zod/TS/Kysely interfaces",
|
|
6
6
|
"author": "Alisson Cavalcante Agiani <thelinuxlich@gmail.com>",
|
|
7
7
|
"license": "MIT",
|