@famgia/omnify-laravel 0.0.171 → 2.0.0
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/{chunk-IXQNWFFZ.js → chunk-TSGLY4IZ.js} +13 -2
- package/dist/chunk-TSGLY4IZ.js.map +1 -0
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +12 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-IXQNWFFZ.js.map +0 -1
|
@@ -699,13 +699,21 @@ function extractManyToManyRelations(schema, allSchemas) {
|
|
|
699
699
|
const pivotFields = [];
|
|
700
700
|
if (assocProp.pivotFields) {
|
|
701
701
|
for (const [fieldName, fieldDef] of Object.entries(assocProp.pivotFields)) {
|
|
702
|
+
let enumValues;
|
|
703
|
+
if (fieldDef.type === "Enum") {
|
|
704
|
+
const rawEnum = fieldDef.enum;
|
|
705
|
+
if (rawEnum && Array.isArray(rawEnum)) {
|
|
706
|
+
enumValues = rawEnum.map((v) => typeof v === "string" ? v : v.value);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
702
709
|
pivotFields.push({
|
|
703
710
|
name: toColumnName(fieldName),
|
|
704
711
|
type: fieldDef.type,
|
|
705
712
|
nullable: fieldDef.nullable,
|
|
706
713
|
default: fieldDef.default,
|
|
707
714
|
length: fieldDef.length,
|
|
708
|
-
unsigned: fieldDef.unsigned
|
|
715
|
+
unsigned: fieldDef.unsigned,
|
|
716
|
+
enum: enumValues
|
|
709
717
|
});
|
|
710
718
|
}
|
|
711
719
|
}
|
|
@@ -731,6 +739,9 @@ function pivotFieldToColumn(field) {
|
|
|
731
739
|
if (method === "string" && field.length) {
|
|
732
740
|
args.push(field.length);
|
|
733
741
|
}
|
|
742
|
+
if (field.type === "Enum" && field.enum && field.enum.length > 0) {
|
|
743
|
+
args.push(field.enum);
|
|
744
|
+
}
|
|
734
745
|
if (field.nullable) {
|
|
735
746
|
modifiers.push({ method: "nullable" });
|
|
736
747
|
}
|
|
@@ -5358,4 +5369,4 @@ export {
|
|
|
5358
5369
|
shouldGenerateAIGuides,
|
|
5359
5370
|
laravelPlugin
|
|
5360
5371
|
};
|
|
5361
|
-
//# sourceMappingURL=chunk-
|
|
5372
|
+
//# sourceMappingURL=chunk-TSGLY4IZ.js.map
|