mutano 3.0.17 → 3.0.19
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 +20 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -892,7 +892,24 @@ function extractPrismaEntities(config) {
|
|
|
892
892
|
if (prismaEnum && "name" in prismaEnum && "enumerators" in prismaEnum) {
|
|
893
893
|
const enumName = prismaEnum.name;
|
|
894
894
|
const enumerators = prismaEnum.enumerators;
|
|
895
|
-
enumDeclarations[enumName] = enumerators.map((e) =>
|
|
895
|
+
enumDeclarations[enumName] = enumerators.map((e) => {
|
|
896
|
+
if ("attributes" in e && e.attributes) {
|
|
897
|
+
const mapAttr = e.attributes.find((attr) => attr.name === "map");
|
|
898
|
+
if (mapAttr && mapAttr.args && mapAttr.args.length > 0) {
|
|
899
|
+
const mapValue = mapAttr.args[0];
|
|
900
|
+
if (typeof mapValue === "object" && "value" in mapValue) {
|
|
901
|
+
let cleanValue = String(mapValue.value);
|
|
902
|
+
if (cleanValue.startsWith('"') && cleanValue.endsWith('"')) {
|
|
903
|
+
cleanValue = cleanValue.slice(1, -1);
|
|
904
|
+
}
|
|
905
|
+
return cleanValue;
|
|
906
|
+
} else if (typeof mapValue === "string") {
|
|
907
|
+
return mapValue;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return e.name;
|
|
912
|
+
});
|
|
896
913
|
}
|
|
897
914
|
}
|
|
898
915
|
return { tables, views, enumDeclarations };
|
|
@@ -957,8 +974,8 @@ function extractPrismaColumnDescriptions(config, entityName, enumDeclarations) {
|
|
|
957
974
|
Extra: defaultGenerated ? "auto_increment" : "",
|
|
958
975
|
Null: isOptional ? "YES" : "NO",
|
|
959
976
|
Type: fieldType,
|
|
960
|
-
Comment: "",
|
|
961
|
-
//
|
|
977
|
+
Comment: field.comment || "",
|
|
978
|
+
// Extract comment from Prisma field
|
|
962
979
|
EnumOptions: enumOptions
|
|
963
980
|
};
|
|
964
981
|
});
|
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.19",
|
|
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",
|