strapi-relation-names 1.3.0 → 1.3.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.
- package/dist/server/index.js +10 -12
- package/dist/server/index.mjs +10 -12
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -623,20 +623,18 @@ const relationLabels = ({ strapi }) => {
|
|
|
623
623
|
const metadatas = { ...configuration.metadatas };
|
|
624
624
|
for (const [fieldName, metadata] of Object.entries(metadatas)) {
|
|
625
625
|
const relationName = relationNames[fieldName];
|
|
626
|
-
if (!isRecord(relationName) ||
|
|
626
|
+
if (!isRecord(relationName) || !isRecord(metadata)) {
|
|
627
627
|
continue;
|
|
628
628
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
};
|
|
629
|
+
const sanitizedMetadata = { ...metadata };
|
|
630
|
+
if (isRecord(metadata.list)) {
|
|
631
|
+
const { mainField: _mainField, ...sanitizedList } = metadata.list;
|
|
632
|
+
sanitizedMetadata.list = sanitizedList;
|
|
633
|
+
}
|
|
634
|
+
if (relationName.mainField === "label" && isRecord(metadata.edit) && metadata.edit.mainField === "label") {
|
|
635
|
+
sanitizedMetadata.edit = { ...metadata.edit, mainField: "id" };
|
|
636
|
+
}
|
|
637
|
+
metadatas[fieldName] = sanitizedMetadata;
|
|
640
638
|
}
|
|
641
639
|
return { ...configuration, settings: sanitizedSettings, metadatas };
|
|
642
640
|
};
|
package/dist/server/index.mjs
CHANGED
|
@@ -622,20 +622,18 @@ const relationLabels = ({ strapi }) => {
|
|
|
622
622
|
const metadatas = { ...configuration.metadatas };
|
|
623
623
|
for (const [fieldName, metadata] of Object.entries(metadatas)) {
|
|
624
624
|
const relationName = relationNames[fieldName];
|
|
625
|
-
if (!isRecord(relationName) ||
|
|
625
|
+
if (!isRecord(relationName) || !isRecord(metadata)) {
|
|
626
626
|
continue;
|
|
627
627
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
};
|
|
628
|
+
const sanitizedMetadata = { ...metadata };
|
|
629
|
+
if (isRecord(metadata.list)) {
|
|
630
|
+
const { mainField: _mainField, ...sanitizedList } = metadata.list;
|
|
631
|
+
sanitizedMetadata.list = sanitizedList;
|
|
632
|
+
}
|
|
633
|
+
if (relationName.mainField === "label" && isRecord(metadata.edit) && metadata.edit.mainField === "label") {
|
|
634
|
+
sanitizedMetadata.edit = { ...metadata.edit, mainField: "id" };
|
|
635
|
+
}
|
|
636
|
+
metadatas[fieldName] = sanitizedMetadata;
|
|
639
637
|
}
|
|
640
638
|
return { ...configuration, settings: sanitizedSettings, metadatas };
|
|
641
639
|
};
|