mutano 3.0.6 → 3.0.7
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.d.ts +1 -0
- package/dist/main.js +5 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -263,7 +263,8 @@ function getType(op, desc, config, destination) {
|
|
|
263
263
|
}
|
|
264
264
|
const enumTypesForSchema = typeMappings.enumTypes[schemaType] || [];
|
|
265
265
|
const isEnum = enumTypesForSchema.includes(type);
|
|
266
|
-
|
|
266
|
+
const isPrismaEnum = schemaType === "prisma" && config.enumDeclarations && config.enumDeclarations[type];
|
|
267
|
+
if (isEnum || isPrismaEnum) {
|
|
267
268
|
let enumValues = [];
|
|
268
269
|
if (schemaType === "mysql" && type === "enum") {
|
|
269
270
|
const match = Type.match(enumRegex);
|
|
@@ -272,6 +273,8 @@ function getType(op, desc, config, destination) {
|
|
|
272
273
|
}
|
|
273
274
|
} else if (schemaType === "postgres" && EnumOptions) {
|
|
274
275
|
enumValues = EnumOptions;
|
|
276
|
+
} else if (isPrismaEnum && config.enumDeclarations) {
|
|
277
|
+
enumValues = config.enumDeclarations[type];
|
|
275
278
|
}
|
|
276
279
|
if (enumValues.length > 0) {
|
|
277
280
|
const shouldBeNullable = isNull || ["insertable", "updateable"].includes(op) && (hasDefaultValue || isGenerated) || op === "updateable" && !isNull && !hasDefaultValue;
|
|
@@ -896,6 +899,7 @@ async function generate(config) {
|
|
|
896
899
|
tables = prismaEntities.tables;
|
|
897
900
|
views = prismaEntities.views;
|
|
898
901
|
enumDeclarations = prismaEntities.enumDeclarations;
|
|
902
|
+
config.enumDeclarations = enumDeclarations;
|
|
899
903
|
} else {
|
|
900
904
|
db = createDatabaseConnection(config);
|
|
901
905
|
tables = await extractTables(db, config);
|
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.7",
|
|
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",
|