@nkhang1902/strapi-plugin-export-import-clsx 1.2.1 → 1.2.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkhang1902/strapi-plugin-export-import-clsx",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
|
|
5
5
|
"main": "./strapi-server.js",
|
|
6
6
|
"scripts": {
|
|
@@ -80,15 +80,12 @@ module.exports = ({ strapi }) => ({
|
|
|
80
80
|
|
|
81
81
|
const mapSheetNameToContentType = (sheetName) => {
|
|
82
82
|
// If targetContentType is provided, use it instead of guessing from sheet name
|
|
83
|
-
if (targetContentType) {
|
|
84
|
-
return targetContentType;
|
|
85
|
-
}
|
|
86
83
|
return "api::" + sheetName + "." + sheetName;
|
|
87
84
|
};
|
|
88
85
|
|
|
89
86
|
workbook.SheetNames.forEach((sheetName) => {
|
|
90
87
|
if (targetContentType && mapSheetNameToContentType(sheetName) !== targetContentType) {
|
|
91
|
-
throw new Error(`Sheet name "${sheetName}" does not match target content type "${targetContentType.split(".")[1]}"`);
|
|
88
|
+
throw new Error(`Sheet name "${sheetName}" does not match the target content type "${targetContentType.split(".")[1]}"`);
|
|
92
89
|
}
|
|
93
90
|
const worksheet = workbook.Sheets[sheetName];
|
|
94
91
|
const rows = XLSX.utils.sheet_to_json(worksheet);
|
|
@@ -159,7 +156,8 @@ module.exports = ({ strapi }) => ({
|
|
|
159
156
|
filters: { [field]: { $eq: value } },
|
|
160
157
|
});
|
|
161
158
|
if (existing) return { id: existing.id };
|
|
162
|
-
throw new Error(`Not found.`);
|
|
159
|
+
// throw new Error(`Not found.`);
|
|
160
|
+
return null;
|
|
163
161
|
}
|
|
164
162
|
return null;
|
|
165
163
|
};
|
|
@@ -418,7 +416,7 @@ module.exports = ({ strapi }) => ({
|
|
|
418
416
|
{ filters: { id }, populate: "*" },
|
|
419
417
|
{ transaction: trx }
|
|
420
418
|
);
|
|
421
|
-
if (!existing) throw new Error(`Document with id ${id} not found`);
|
|
419
|
+
// if (!existing) throw new Error(`Document with id ${id} not found`);
|
|
422
420
|
}
|
|
423
421
|
|
|
424
422
|
if (event && !data.event) data.event = event.name;
|