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
@@ -3,7 +3,7 @@ import React__default, { useRef, useState, useEffect, useCallback, useMemo } fro
3
3
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
4
4
  import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Checkbox, Alert, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
5
5
  import { ArrowClockwise, Download, Search, Cog, Upload, ChevronLeft, ChevronRight, Eye, Check, Play } from "@strapi/icons";
6
- import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-BzS4_gcN.mjs";
6
+ import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-DUtycMm1.mjs";
7
7
  function parseCsvRows(csvText) {
8
8
  if (!csvText) return [];
9
9
  let text = csvText;
@@ -2160,7 +2160,8 @@ function CsvManagerTab() {
2160
2160
  const res = await post("/bulk-updater/csv/validate-preflight", {
2161
2161
  uid: selectedUid,
2162
2162
  rows: enrichedRecords,
2163
- mode: importMode
2163
+ mode: importMode,
2164
+ ...originalHeaders.length > 0 ? { originalHeaders } : {}
2164
2165
  });
2165
2166
  if (res.data && res.data.success) {
2166
2167
  setPreflightReport(res.data);
@@ -2697,7 +2698,7 @@ function CsvManagerTab() {
2697
2698
  )
2698
2699
  ] })
2699
2700
  ] }),
2700
- selectedCol && /* @__PURE__ */ jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsx(Box, { padding: 3, background: selectedDataAttrs.length > 0 ? "primary100" : "neutral100", hasRadius: true, children: /* @__PURE__ */ jsx(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." }) }) }),
2701
+ selectedCol && /* @__PURE__ */ jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsx(Box, { padding: 3, background: selectedDataAttrs.length > 0 ? "primary100" : "neutral100", hasRadius: true, children: /* @__PURE__ */ jsx(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." }) }) }),
2701
2702
  false
2702
2703
  ] }),
2703
2704
  canAnyCsvImportSection && /* @__PURE__ */ jsxs(Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
@@ -8350,12 +8351,22 @@ const BulkUpdater = () => {
8350
8351
  }
8351
8352
  };
8352
8353
  const handleRollback = async (batchId) => {
8353
- if (!window.confirm(`Are you sure you want to roll back all changes made in batch "${batchId}"?`)) {
8354
+ const targetRec = auditHistory.find((r) => r.batchId === batchId);
8355
+ const overlap = targetRec?.overlapWarning;
8356
+ const confirmMessage = overlap?.hasOverlap ? `WARNING: Batch "${batchId}" touches ${overlap.affectedEntryCount} entry/entries that were also modified by newer active batch(es): ${overlap.newerActiveBatchIds.join(", ")}.
8357
+
8358
+ Rolling back will restore pre-batch data and previous publishing status from before "${batchId}", overwriting newer changes on those entries.
8359
+
8360
+ Are you sure you want to proceed?` : `Are you sure you want to roll back all changes made in batch "${batchId}"?`;
8361
+ if (!window.confirm(confirmMessage)) {
8354
8362
  return;
8355
8363
  }
8356
8364
  try {
8357
8365
  setRollingBackBatchId(batchId);
8358
- const res = await post(`/bulk-updater/audit/${batchId}/rollback`);
8366
+ const res = await post(
8367
+ `/bulk-updater/audit/${batchId}/rollback`,
8368
+ overlap?.hasOverlap ? { confirmOverwrite: true } : void 0
8369
+ );
8359
8370
  if (res.data && res.data.success) {
8360
8371
  toggleNotification({
8361
8372
  type: "success",
@@ -8370,9 +8381,13 @@ const BulkUpdater = () => {
8370
8381
  });
8371
8382
  }
8372
8383
  } catch (err) {
8384
+ const errMsg = err.response?.data?.error || err.message || "Rollback encountered an error.";
8385
+ if (typeof errMsg === "string" && errMsg.includes("confirmOverwrite")) {
8386
+ await fetchAuditHistory();
8387
+ }
8373
8388
  toggleNotification({
8374
8389
  type: "danger",
8375
- message: err.response?.data?.error || err.message || "Rollback encountered an error."
8390
+ message: errMsg
8376
8391
  });
8377
8392
  } finally {
8378
8393
  setRollingBackBatchId(null);
@@ -10143,9 +10158,12 @@ const BulkUpdater = () => {
10143
10158
  /* @__PURE__ */ jsx(Tbody, { children: sortedAuditHistory.map((rec) => {
10144
10159
  const isExpanded = expandedDiffBatchId === rec.batchId;
10145
10160
  const dateStr = new Date(rec.executedAt).toLocaleString();
10146
- const isLatestEligible = Boolean(
10147
- rec.isLatestEligible ?? (latestCompletedBatch && rec.batchId === latestCompletedBatch.batchId && !latestCompletedBatch.isRolledBack)
10161
+ const canRollbackRow = Boolean(
10162
+ rec.isRollbackEligible ?? (!rec.isRolledBack && (!Array.isArray(rec.diffs) || rec.diffs.length === 0 || rec.diffs.some(
10163
+ (d) => d?.status === "updated" && d?.uid && d?.documentId && d?.attribute
10164
+ )))
10148
10165
  );
10166
+ const hasOverlapWarning = Boolean(!rec.isRolledBack && rec.overlapWarning?.hasOverlap);
10149
10167
  return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
10150
10168
  /* @__PURE__ */ jsxs(
10151
10169
  Tr,
@@ -10223,7 +10241,20 @@ const BulkUpdater = () => {
10223
10241
  " by ",
10224
10242
  rec.rolledBackBy || "Admin"
10225
10243
  ] })
10226
- ] }) : /* @__PURE__ */ jsx(Badge, { backgroundColor: "success100", textColor: "success700", children: "ACTIVE (APPLIED)" }) }),
10244
+ ] }) : /* @__PURE__ */ jsxs(Box, { children: [
10245
+ /* @__PURE__ */ jsx(Badge, { backgroundColor: "success100", textColor: "success700", children: "ACTIVE (APPLIED)" }),
10246
+ hasOverlapWarning && /* @__PURE__ */ jsx(
10247
+ Typography,
10248
+ {
10249
+ variant: "pi",
10250
+ textColor: "warning600",
10251
+ display: "block",
10252
+ style: { wordBreak: "break-word", marginTop: 2 },
10253
+ title: `Newer active batch(es) modified overlapping entries: ${rec.overlapWarning?.newerActiveBatchIds.join(", ")}`,
10254
+ children: "Newer edits exist on shared entries"
10255
+ }
10256
+ )
10257
+ ] }) }),
10227
10258
  /* @__PURE__ */ jsx(Td, { style: { minWidth: 160, textAlign: "right", whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, justifyContent: "flex-end", children: [
10228
10259
  permissions.canAuditDetails && /* @__PURE__ */ jsx(
10229
10260
  Button,
@@ -10247,19 +10278,26 @@ const BulkUpdater = () => {
10247
10278
  children: isExpanded ? "Hide Diffs" : "View Diffs"
10248
10279
  }
10249
10280
  ),
10250
- !rec.isRolledBack && permissions.canAuditRollback && (isLatestEligible ? /* @__PURE__ */ jsx(
10251
- Button,
10281
+ !rec.isRolledBack && permissions.canAuditRollback && (canRollbackRow ? /* @__PURE__ */ jsx(
10282
+ "span",
10252
10283
  {
10253
- variant: "danger",
10254
- size: "S",
10255
- loading: rollingBackBatchId === rec.batchId,
10256
- onClick: () => handleRollback(rec.batchId),
10257
- children: "Rollback"
10284
+ title: hasOverlapWarning ? `Historical rollback will overwrite newer edits from: ${rec.overlapWarning?.newerActiveBatchIds.join(", ")}` : "Roll back changes made by this batch",
10285
+ style: { display: "inline-flex" },
10286
+ children: /* @__PURE__ */ jsx(
10287
+ Button,
10288
+ {
10289
+ variant: "danger",
10290
+ size: "S",
10291
+ loading: rollingBackBatchId === rec.batchId,
10292
+ onClick: () => handleRollback(rec.batchId),
10293
+ children: "Rollback"
10294
+ }
10295
+ )
10258
10296
  }
10259
10297
  ) : /* @__PURE__ */ jsx(
10260
10298
  "span",
10261
10299
  {
10262
- title: "Only the latest completed update can be rolled back.",
10300
+ title: "This batch has no revertible field updates.",
10263
10301
  style: { display: "inline-flex", cursor: "not-allowed" },
10264
10302
  children: /* @__PURE__ */ jsx(
10265
10303
  Button,
@@ -11092,4 +11130,4 @@ export {
11092
11130
  resolveEffectiveRelationMeta,
11093
11131
  resolveEntityLabel
11094
11132
  };
11095
- //# sourceMappingURL=BulkUpdater-BQnhVw0j.mjs.map
11133
+ //# sourceMappingURL=BulkUpdater-KWmfElh6.mjs.map