mutano 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/dist/main.js +3 -3
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -74,7 +74,7 @@ function getType(op, desc, config) {
74
74
  return;
75
75
  const isRequiredString = config.requiredString && config.requiredString === true && op !== "selectable";
76
76
  const isUseDateType = config.useDateType && config.useDateType === true;
77
- const type = Type.split("(")[0].split(" ")[0];
77
+ const type = schemaType === "mysql" ? Type.split("(")[0].split(" ")[0] : Type;
78
78
  const zDate = [
79
79
  "z.union([z.number(), z.string(), z.date()]).pipe(z.coerce.date())"
80
80
  ];
@@ -235,19 +235,19 @@ async function generate(config) {
235
235
  const parsedDefaultValue = !!defaultValue && typeof defaultValue !== "object" ? defaultValue.toString() : null;
236
236
  let fieldType = field.fieldType.toString();
237
237
  if (!prismaValidTypes.includes(fieldType)) {
238
- fieldType = "Enum";
239
238
  enumOptions = schema.findAllByType("enum", {
240
239
  name: fieldType
241
240
  })[0]?.enumerators.filter(
242
241
  (e) => e.type === "enumerator"
243
242
  ).map((e) => e.name);
243
+ fieldType = "Enum";
244
244
  }
245
245
  return {
246
246
  Field: field.name,
247
247
  Default: parsedDefaultValue,
248
248
  EnumOptions: enumOptions,
249
249
  Extra: defaultValue ? "DEFAULT_GENERATED" : "",
250
- Type: field.fieldType.toString(),
250
+ Type: fieldType,
251
251
  Null: field.optional ? "YES" : "NO",
252
252
  Comment: field.comment ?? ""
253
253
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mutano",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "Converts Prisma/MySQL schemas to Zod interfaces",
6
6
  "author": "Alisson Cavalcante Agiani <thelinuxlich@gmail.com>",
7
7
  "license": "MIT",