strapi-plugin-bulk-updater 1.7.1 → 1.7.2

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 (25) hide show
  1. package/dist/_chunks/{BulkUpdater-BrBWtCjS.js → BulkUpdater-BdsfPqoX.js} +56 -18
  2. package/dist/_chunks/BulkUpdater-BdsfPqoX.js.map +1 -0
  3. package/dist/_chunks/{BulkUpdater-BQnhVw0j.mjs → BulkUpdater-KWmfElh6.mjs} +56 -18
  4. package/dist/_chunks/BulkUpdater-KWmfElh6.mjs.map +1 -0
  5. package/dist/_chunks/{SettingsPage-DYD6M988.mjs → SettingsPage-BdwchEyi.mjs} +2 -2
  6. package/dist/_chunks/{SettingsPage-DYD6M988.mjs.map → SettingsPage-BdwchEyi.mjs.map} +1 -1
  7. package/dist/_chunks/{SettingsPage-DsKfbhNd.js → SettingsPage-DqJ_zBde.js} +2 -2
  8. package/dist/_chunks/{SettingsPage-DsKfbhNd.js.map → SettingsPage-DqJ_zBde.js.map} +1 -1
  9. package/dist/_chunks/{ValidationRulesTab-BzS4_gcN.mjs → ValidationRulesTab-DUtycMm1.mjs} +2 -2
  10. package/dist/_chunks/{ValidationRulesTab-BzS4_gcN.mjs.map → ValidationRulesTab-DUtycMm1.mjs.map} +1 -1
  11. package/dist/_chunks/{ValidationRulesTab-DZw6CujQ.js → ValidationRulesTab-DVvVevbW.js} +2 -2
  12. package/dist/_chunks/{ValidationRulesTab-DZw6CujQ.js.map → ValidationRulesTab-DVvVevbW.js.map} +1 -1
  13. package/dist/_chunks/{index-BCOsNd1S.js → index-BZ5NTSJQ.js} +3 -3
  14. package/dist/_chunks/{index-BCOsNd1S.js.map → index-BZ5NTSJQ.js.map} +1 -1
  15. package/dist/_chunks/{index-CjbxZZjb.mjs → index-C9zsPQim.mjs} +3 -3
  16. package/dist/_chunks/{index-CjbxZZjb.mjs.map → index-C9zsPQim.mjs.map} +1 -1
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/server/index.js +425 -71
  20. package/dist/server/index.js.map +1 -1
  21. package/dist/server/index.mjs +425 -71
  22. package/dist/server/index.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/dist/_chunks/BulkUpdater-BQnhVw0j.mjs.map +0 -1
  25. package/dist/_chunks/BulkUpdater-BrBWtCjS.js.map +0 -1
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
- const ValidationRulesTab = require("./ValidationRulesTab-DZw6CujQ.js");
8
+ const ValidationRulesTab = require("./ValidationRulesTab-DVvVevbW.js");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
11
11
  function parseCsvRows(csvText) {
@@ -2164,7 +2164,8 @@ function CsvManagerTab() {
2164
2164
  const res = await post("/bulk-updater/csv/validate-preflight", {
2165
2165
  uid: selectedUid,
2166
2166
  rows: enrichedRecords,
2167
- mode: importMode
2167
+ mode: importMode,
2168
+ ...originalHeaders.length > 0 ? { originalHeaders } : {}
2168
2169
  });
2169
2170
  if (res.data && res.data.success) {
2170
2171
  setPreflightReport(res.data);
@@ -2701,7 +2702,7 @@ function CsvManagerTab() {
2701
2702
  )
2702
2703
  ] })
2703
2704
  ] }),
2704
- selectedCol && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, background: selectedDataAttrs.length > 0 ? "primary100" : "neutral100", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: selectedDataAttrs.length > 0 ? "primary700" : "neutral700", children: selectedDataAttrs.length > 0 ? `Selective Export: Exports Document ID, Slug, and only the selected columns (${selectedDataAttrs.length} selected). Unselected fields and sibling nested properties remain completely protected during CSV import.` : "Full Collection Export: No specific columns selected. All fields will be exported with complete deep nesting preserved in JSON format." }) }) }),
2705
+ selectedCol && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, background: selectedDataAttrs.length > 0 ? "primary100" : "neutral100", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: selectedDataAttrs.length > 0 ? "primary700" : "neutral700", children: selectedDataAttrs.length > 0 ? `Selective Export: Exports Document ID, Slug, and paired _before / _target columns for the selected fields (${selectedDataAttrs.length} field${selectedDataAttrs.length > 1 ? "s" : ""}). Edit only _target columns; _before columns, unselected fields, and sibling nested properties remain protected during CSV import.` : "Full Collection Export: No specific columns selected. All fields will be exported with complete deep nesting preserved in JSON format." }) }) }),
2705
2706
  false
2706
2707
  ] }),
2707
2708
  canAnyCsvImportSection && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
@@ -8354,12 +8355,22 @@ const BulkUpdater = () => {
8354
8355
  }
8355
8356
  };
8356
8357
  const handleRollback = async (batchId) => {
8357
- if (!window.confirm(`Are you sure you want to roll back all changes made in batch "${batchId}"?`)) {
8358
+ const targetRec = auditHistory.find((r) => r.batchId === batchId);
8359
+ const overlap = targetRec?.overlapWarning;
8360
+ const confirmMessage = overlap?.hasOverlap ? `WARNING: Batch "${batchId}" touches ${overlap.affectedEntryCount} entry/entries that were also modified by newer active batch(es): ${overlap.newerActiveBatchIds.join(", ")}.
8361
+
8362
+ Rolling back will restore pre-batch data and previous publishing status from before "${batchId}", overwriting newer changes on those entries.
8363
+
8364
+ Are you sure you want to proceed?` : `Are you sure you want to roll back all changes made in batch "${batchId}"?`;
8365
+ if (!window.confirm(confirmMessage)) {
8358
8366
  return;
8359
8367
  }
8360
8368
  try {
8361
8369
  setRollingBackBatchId(batchId);
8362
- const res = await post(`/bulk-updater/audit/${batchId}/rollback`);
8370
+ const res = await post(
8371
+ `/bulk-updater/audit/${batchId}/rollback`,
8372
+ overlap?.hasOverlap ? { confirmOverwrite: true } : void 0
8373
+ );
8363
8374
  if (res.data && res.data.success) {
8364
8375
  toggleNotification({
8365
8376
  type: "success",
@@ -8374,9 +8385,13 @@ const BulkUpdater = () => {
8374
8385
  });
8375
8386
  }
8376
8387
  } catch (err) {
8388
+ const errMsg = err.response?.data?.error || err.message || "Rollback encountered an error.";
8389
+ if (typeof errMsg === "string" && errMsg.includes("confirmOverwrite")) {
8390
+ await fetchAuditHistory();
8391
+ }
8377
8392
  toggleNotification({
8378
8393
  type: "danger",
8379
- message: err.response?.data?.error || err.message || "Rollback encountered an error."
8394
+ message: errMsg
8380
8395
  });
8381
8396
  } finally {
8382
8397
  setRollingBackBatchId(null);
@@ -10147,9 +10162,12 @@ const BulkUpdater = () => {
10147
10162
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: sortedAuditHistory.map((rec) => {
10148
10163
  const isExpanded = expandedDiffBatchId === rec.batchId;
10149
10164
  const dateStr = new Date(rec.executedAt).toLocaleString();
10150
- const isLatestEligible = Boolean(
10151
- rec.isLatestEligible ?? (latestCompletedBatch && rec.batchId === latestCompletedBatch.batchId && !latestCompletedBatch.isRolledBack)
10165
+ const canRollbackRow = Boolean(
10166
+ rec.isRollbackEligible ?? (!rec.isRolledBack && (!Array.isArray(rec.diffs) || rec.diffs.length === 0 || rec.diffs.some(
10167
+ (d) => d?.status === "updated" && d?.uid && d?.documentId && d?.attribute
10168
+ )))
10152
10169
  );
10170
+ const hasOverlapWarning = Boolean(!rec.isRolledBack && rec.overlapWarning?.hasOverlap);
10153
10171
  return /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
10154
10172
  /* @__PURE__ */ jsxRuntime.jsxs(
10155
10173
  designSystem.Tr,
@@ -10227,7 +10245,20 @@ const BulkUpdater = () => {
10227
10245
  " by ",
10228
10246
  rec.rolledBackBy || "Admin"
10229
10247
  ] })
10230
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", children: "ACTIVE (APPLIED)" }) }),
10248
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
10249
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", children: "ACTIVE (APPLIED)" }),
10250
+ hasOverlapWarning && /* @__PURE__ */ jsxRuntime.jsx(
10251
+ designSystem.Typography,
10252
+ {
10253
+ variant: "pi",
10254
+ textColor: "warning600",
10255
+ display: "block",
10256
+ style: { wordBreak: "break-word", marginTop: 2 },
10257
+ title: `Newer active batch(es) modified overlapping entries: ${rec.overlapWarning?.newerActiveBatchIds.join(", ")}`,
10258
+ children: "Newer edits exist on shared entries"
10259
+ }
10260
+ )
10261
+ ] }) }),
10231
10262
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { minWidth: 160, textAlign: "right", whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, justifyContent: "flex-end", children: [
10232
10263
  permissions.canAuditDetails && /* @__PURE__ */ jsxRuntime.jsx(
10233
10264
  designSystem.Button,
@@ -10251,19 +10282,26 @@ const BulkUpdater = () => {
10251
10282
  children: isExpanded ? "Hide Diffs" : "View Diffs"
10252
10283
  }
10253
10284
  ),
10254
- !rec.isRolledBack && permissions.canAuditRollback && (isLatestEligible ? /* @__PURE__ */ jsxRuntime.jsx(
10255
- designSystem.Button,
10285
+ !rec.isRolledBack && permissions.canAuditRollback && (canRollbackRow ? /* @__PURE__ */ jsxRuntime.jsx(
10286
+ "span",
10256
10287
  {
10257
- variant: "danger",
10258
- size: "S",
10259
- loading: rollingBackBatchId === rec.batchId,
10260
- onClick: () => handleRollback(rec.batchId),
10261
- children: "Rollback"
10288
+ title: hasOverlapWarning ? `Historical rollback will overwrite newer edits from: ${rec.overlapWarning?.newerActiveBatchIds.join(", ")}` : "Roll back changes made by this batch",
10289
+ style: { display: "inline-flex" },
10290
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10291
+ designSystem.Button,
10292
+ {
10293
+ variant: "danger",
10294
+ size: "S",
10295
+ loading: rollingBackBatchId === rec.batchId,
10296
+ onClick: () => handleRollback(rec.batchId),
10297
+ children: "Rollback"
10298
+ }
10299
+ )
10262
10300
  }
10263
10301
  ) : /* @__PURE__ */ jsxRuntime.jsx(
10264
10302
  "span",
10265
10303
  {
10266
- title: "Only the latest completed update can be rolled back.",
10304
+ title: "This batch has no revertible field updates.",
10267
10305
  style: { display: "inline-flex", cursor: "not-allowed" },
10268
10306
  children: /* @__PURE__ */ jsxRuntime.jsx(
10269
10307
  designSystem.Button,
@@ -11094,4 +11132,4 @@ exports.parseDynamicZonePath = parseDynamicZonePath;
11094
11132
  exports.registerRelationOptions = registerRelationOptions;
11095
11133
  exports.resolveEffectiveRelationMeta = resolveEffectiveRelationMeta;
11096
11134
  exports.resolveEntityLabel = resolveEntityLabel;
11097
- //# sourceMappingURL=BulkUpdater-BrBWtCjS.js.map
11135
+ //# sourceMappingURL=BulkUpdater-BdsfPqoX.js.map