strapi-plugin-bulk-updater 1.6.8 → 1.6.10

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 (35) hide show
  1. package/dist/_chunks/{BulkUpdater-DXCcTat7.js → BulkUpdater-BY8IXT4R.js} +59 -31
  2. package/dist/_chunks/BulkUpdater-BY8IXT4R.js.map +1 -0
  3. package/dist/_chunks/{BulkUpdater-B5dJ1VBZ.mjs → BulkUpdater-DISkZC1Y.mjs} +59 -31
  4. package/dist/_chunks/BulkUpdater-DISkZC1Y.mjs.map +1 -0
  5. package/dist/_chunks/{ScopedQuotaSelectInput-BsBpmwun.js → ScopedQuotaSelectInput-BC2Ge-Iv.js} +9 -4
  6. package/dist/_chunks/ScopedQuotaSelectInput-BC2Ge-Iv.js.map +1 -0
  7. package/dist/_chunks/{ScopedQuotaSelectInput-YKdQgrPt.mjs → ScopedQuotaSelectInput-DPIIa3XO.mjs} +9 -4
  8. package/dist/_chunks/ScopedQuotaSelectInput-DPIIa3XO.mjs.map +1 -0
  9. package/dist/_chunks/{SettingsPage-QM4OwnDh.mjs → SettingsPage-D9vD1BKo.mjs} +2 -2
  10. package/dist/_chunks/{SettingsPage-QM4OwnDh.mjs.map → SettingsPage-D9vD1BKo.mjs.map} +1 -1
  11. package/dist/_chunks/{SettingsPage-Da2zJ0R4.js → SettingsPage-vH-eanBJ.js} +2 -2
  12. package/dist/_chunks/{SettingsPage-Da2zJ0R4.js.map → SettingsPage-vH-eanBJ.js.map} +1 -1
  13. package/dist/_chunks/{ValidationRulesTab-B2TuIPbe.mjs → ValidationRulesTab-DdwR3lWq.mjs} +159 -87
  14. package/dist/_chunks/ValidationRulesTab-DdwR3lWq.mjs.map +1 -0
  15. package/dist/_chunks/{ValidationRulesTab-Bxiqdovc.js → ValidationRulesTab-r6S-ZFDp.js} +158 -86
  16. package/dist/_chunks/ValidationRulesTab-r6S-ZFDp.js.map +1 -0
  17. package/dist/_chunks/index-AXTojFac.mjs +229 -0
  18. package/dist/_chunks/index-AXTojFac.mjs.map +1 -0
  19. package/dist/_chunks/index-aoOgZpZE.js +230 -0
  20. package/dist/_chunks/index-aoOgZpZE.js.map +1 -0
  21. package/dist/admin/index.js +4 -196
  22. package/dist/admin/index.js.map +1 -1
  23. package/dist/admin/index.mjs +4 -194
  24. package/dist/admin/index.mjs.map +1 -1
  25. package/dist/server/index.js +80 -9
  26. package/dist/server/index.js.map +1 -1
  27. package/dist/server/index.mjs +80 -9
  28. package/dist/server/index.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/_chunks/BulkUpdater-B5dJ1VBZ.mjs.map +0 -1
  31. package/dist/_chunks/BulkUpdater-DXCcTat7.js.map +0 -1
  32. package/dist/_chunks/ScopedQuotaSelectInput-BsBpmwun.js.map +0 -1
  33. package/dist/_chunks/ScopedQuotaSelectInput-YKdQgrPt.mjs.map +0 -1
  34. package/dist/_chunks/ValidationRulesTab-B2TuIPbe.mjs.map +0 -1
  35. package/dist/_chunks/ValidationRulesTab-Bxiqdovc.js.map +0 -1
@@ -1,197 +1,7 @@
1
- import React__default from "react";
2
- import { ClockCounterClockwise, Pencil } from "@strapi/icons";
3
- const PLUGIN_ID = "bulk-updater";
4
- function escapeHtml(str) {
5
- return (str || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
6
- }
7
- function showQuotaErrorToast(message) {
8
- if (typeof document === "undefined") return;
9
- const existing = document.getElementById("strapi-quota-validation-banner");
10
- if (existing) existing.remove();
11
- let title = "Validation Error";
12
- let detail = message;
13
- const match = message.match(/^(Validation Error \([^)]+\)):\s*(.+)$/s);
14
- if (match) {
15
- title = match[1];
16
- detail = match[2];
17
- }
18
- const banner = document.createElement("div");
19
- banner.id = "strapi-quota-validation-banner";
20
- banner.style.position = "fixed";
21
- banner.style.top = "24px";
22
- banner.style.left = "50%";
23
- banner.style.transform = "translateX(-50%)";
24
- banner.style.zIndex = "999999";
25
- banner.style.minWidth = "420px";
26
- banner.style.maxWidth = "720px";
27
- banner.style.backgroundColor = "#D02B20";
28
- banner.style.color = "#FFFFFF";
29
- banner.style.padding = "14px 20px";
30
- banner.style.borderRadius = "6px";
31
- banner.style.boxShadow = "0 10px 25px rgba(0,0,0,0.35)";
32
- banner.style.display = "flex";
33
- banner.style.alignItems = "flex-start";
34
- banner.style.gap = "12px";
35
- banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
36
- banner.style.fontSize = "14px";
37
- banner.style.lineHeight = "1.45";
38
- banner.style.transition = "opacity 0.2s ease-in-out";
39
- banner.innerHTML = `
40
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink: 0; margin-top: 1px;">
41
- <circle cx="12" cy="12" r="10"></circle>
42
- <line x1="12" y1="8" x2="12" y2="12"></line>
43
- <line x1="12" y1="16" x2="12.01" y2="16"></line>
44
- </svg>
45
- <div style="flex: 1;">
46
- <div style="font-weight: 700; margin-bottom: 2px;">${escapeHtml(title)}</div>
47
- <div style="opacity: 0.95;">${escapeHtml(detail)}</div>
48
- </div>
49
- <button style="background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;" onclick="this.parentElement.remove()">×</button>
50
- `;
51
- document.body.appendChild(banner);
52
- setTimeout(() => {
53
- if (banner.parentElement) {
54
- banner.style.opacity = "0";
55
- setTimeout(() => banner.remove(), 250);
56
- }
57
- }, 1e4);
58
- }
59
- const index = {
60
- register(app) {
61
- app.addMenuLink({
62
- to: `plugins/${PLUGIN_ID}`,
63
- icon: Pencil,
64
- intlLabel: {
65
- id: `${PLUGIN_ID}.plugin.name`,
66
- defaultMessage: "Bulk Attribute Updater"
67
- },
68
- Component: () => import("../_chunks/BulkUpdater-B5dJ1VBZ.mjs"),
69
- permissions: [
70
- {
71
- action: `plugin::${PLUGIN_ID}.read`,
72
- subject: null
73
- }
74
- ],
75
- position: 3
76
- });
77
- app.addSettingsLink("global", {
78
- id: `${PLUGIN_ID}-settings`,
79
- intlLabel: {
80
- id: `${PLUGIN_ID}.settings.name`,
81
- defaultMessage: "Bulk Updater Settings"
82
- },
83
- to: `${PLUGIN_ID}`,
84
- Component: () => import("../_chunks/SettingsPage-QM4OwnDh.mjs"),
85
- permissions: [
86
- {
87
- action: `plugin::${PLUGIN_ID}.settings.view`,
88
- subject: null
89
- }
90
- ]
91
- });
92
- app.registerPlugin({
93
- id: PLUGIN_ID,
94
- name: PLUGIN_ID
95
- });
96
- app.customFields.register({
97
- name: "scoped-select",
98
- pluginId: PLUGIN_ID,
99
- type: "string",
100
- intlLabel: {
101
- id: `${PLUGIN_ID}.scoped-select.label`,
102
- defaultMessage: "Scoped Quota Select"
103
- },
104
- intlDescription: {
105
- id: `${PLUGIN_ID}.scoped-select.description`,
106
- defaultMessage: "Dropdown with dynamic cross-component usage quota enforcement"
107
- },
108
- components: {
109
- Input: async () => import("../_chunks/ScopedQuotaSelectInput-YKdQgrPt.mjs")
110
- }
111
- });
112
- },
113
- bootstrap(app) {
114
- if (typeof window !== "undefined" && !window.__bulk_updater_interceptor_installed) {
115
- window.__bulk_updater_interceptor_installed = true;
116
- if (window.fetch) {
117
- const origFetch = window.fetch;
118
- window.fetch = async function(...args) {
119
- const response = await origFetch.apply(this, args);
120
- if (response.status === 400 || response.status === 422 || response.status === 500) {
121
- try {
122
- const clone = response.clone();
123
- const data = await clone.json();
124
- const errMsg = data?.error?.message || data?.message;
125
- if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
126
- showQuotaErrorToast(errMsg);
127
- }
128
- } catch {
129
- }
130
- }
131
- return response;
132
- };
133
- }
134
- if (window.XMLHttpRequest) {
135
- const origOpen = XMLHttpRequest.prototype.open;
136
- XMLHttpRequest.prototype.open = function(...args) {
137
- this.addEventListener("load", function() {
138
- if (this.status === 400 || this.status === 422 || this.status === 500) {
139
- try {
140
- const data = JSON.parse(this.responseText);
141
- const errMsg = data?.error?.message || data?.message;
142
- if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
143
- showQuotaErrorToast(errMsg);
144
- }
145
- } catch {
146
- }
147
- }
148
- });
149
- return origOpen.apply(this, args);
150
- };
151
- }
152
- }
153
- try {
154
- const contentManagerPlugin = app.getPlugin("content-manager");
155
- if (contentManagerPlugin?.apis?.addDocumentAction) {
156
- contentManagerPlugin.apis.addDocumentAction((actions) => {
157
- if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
158
- return actions;
159
- }
160
- const hasHistory = actions.some((a) => a.type === "history" || a.id === "content-history");
161
- if (hasHistory) return actions;
162
- const customHistoryAction = ({ model, document: document2 }) => {
163
- if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
164
- return null;
165
- }
166
- return {
167
- icon: React__default.createElement(ClockCounterClockwise, {}),
168
- label: "Content History",
169
- onClick: () => {
170
- const currentPath = window.location.pathname.replace(/\/$/, "");
171
- if (!currentPath.endsWith("/history")) {
172
- window.location.href = `${currentPath}/history${window.location.search}`;
173
- }
174
- },
175
- disabled: !document2 || !document2.id || !model?.startsWith("api::"),
176
- position: "header"
177
- };
178
- };
179
- customHistoryAction.type = "history";
180
- customHistoryAction.position = "header";
181
- const deleteIndex = actions.findIndex((a) => a.type === "delete");
182
- if (deleteIndex !== -1) {
183
- actions.splice(deleteIndex, 0, customHistoryAction);
184
- } else {
185
- actions.push(customHistoryAction);
186
- }
187
- return actions;
188
- });
189
- }
190
- } catch {
191
- }
192
- }
193
- };
1
+ import "react";
2
+ import { i } from "../_chunks/index-AXTojFac.mjs";
3
+ import "@strapi/icons";
194
4
  export {
195
- index as default
5
+ i as default
196
6
  };
197
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'bulk-updater';\n","import React from 'react';\nimport { PLUGIN_ID } from './pluginId';\nimport { Pencil, ClockCounterClockwise } from '@strapi/icons';\n\nfunction escapeHtml(str: string): string {\n return (str || '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n\nfunction showQuotaErrorToast(message: string) {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById('strapi-quota-validation-banner');\n if (existing) existing.remove();\n\n let title = 'Validation Error';\n let detail = message;\n const match = message.match(/^(Validation Error \\([^)]+\\)):\\s*(.+)$/s);\n if (match) {\n title = match[1];\n detail = match[2];\n }\n\n const banner = document.createElement('div');\n banner.id = 'strapi-quota-validation-banner';\n banner.style.position = 'fixed';\n banner.style.top = '24px';\n banner.style.left = '50%';\n banner.style.transform = 'translateX(-50%)';\n banner.style.zIndex = '999999';\n banner.style.minWidth = '420px';\n banner.style.maxWidth = '720px';\n banner.style.backgroundColor = '#D02B20';\n banner.style.color = '#FFFFFF';\n banner.style.padding = '14px 20px';\n banner.style.borderRadius = '6px';\n banner.style.boxShadow = '0 10px 25px rgba(0,0,0,0.35)';\n banner.style.display = 'flex';\n banner.style.alignItems = 'flex-start';\n banner.style.gap = '12px';\n banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif';\n banner.style.fontSize = '14px';\n banner.style.lineHeight = '1.45';\n banner.style.transition = 'opacity 0.2s ease-in-out';\n\n banner.innerHTML = `\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"flex-shrink: 0; margin-top: 1px;\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>\n </svg>\n <div style=\"flex: 1;\">\n <div style=\"font-weight: 700; margin-bottom: 2px;\">${escapeHtml(title)}</div>\n <div style=\"opacity: 0.95;\">${escapeHtml(detail)}</div>\n </div>\n <button style=\"background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;\" onclick=\"this.parentElement.remove()\">×</button>\n `;\n\n document.body.appendChild(banner);\n\n setTimeout(() => {\n if (banner.parentElement) {\n banner.style.opacity = '0';\n setTimeout(() => banner.remove(), 250);\n }\n }, 10000);\n}\n\nexport default {\n register(app: any) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: Pencil,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Bulk Attribute Updater',\n },\n Component: () => import('./pages/BulkUpdater'),\n permissions: [\n {\n action: `plugin::${PLUGIN_ID}.read`,\n subject: null,\n },\n ],\n position: 3,\n });\n\n app.addSettingsLink('global', {\n id: `${PLUGIN_ID}-settings`,\n intlLabel: {\n id: `${PLUGIN_ID}.settings.name`,\n defaultMessage: 'Bulk Updater Settings',\n },\n to: `${PLUGIN_ID}`,\n Component: () => import('./pages/SettingsPage'),\n permissions: [\n {\n action: `plugin::${PLUGIN_ID}.settings.view`,\n subject: null,\n },\n ],\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n name: PLUGIN_ID,\n });\n\n app.customFields.register({\n name: 'scoped-select',\n pluginId: PLUGIN_ID,\n type: 'string',\n intlLabel: {\n id: `${PLUGIN_ID}.scoped-select.label`,\n defaultMessage: 'Scoped Quota Select',\n },\n intlDescription: {\n id: `${PLUGIN_ID}.scoped-select.description`,\n defaultMessage: 'Dropdown with dynamic cross-component usage quota enforcement',\n },\n components: {\n Input: async () => import('./components/ScopedQuotaSelectInput'),\n },\n });\n },\n bootstrap(app: any) {\n // Install global response interceptor for quota validation rule error banners\n if (typeof window !== 'undefined' && !(window as any).__bulk_updater_interceptor_installed) {\n (window as any).__bulk_updater_interceptor_installed = true;\n\n if (window.fetch) {\n const origFetch = window.fetch;\n window.fetch = async function (...args) {\n const response = await origFetch.apply(this, args);\n if (response.status === 400 || response.status === 422 || response.status === 500) {\n try {\n const clone = response.clone();\n const data = await clone.json();\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n return response;\n };\n }\n\n if ((window as any).XMLHttpRequest) {\n const origOpen = XMLHttpRequest.prototype.open;\n XMLHttpRequest.prototype.open = function (...args: any[]) {\n this.addEventListener('load', function () {\n if (this.status === 400 || this.status === 422 || this.status === 500) {\n try {\n const data = JSON.parse(this.responseText);\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n });\n return origOpen.apply(this, args as any);\n };\n }\n }\n try {\n const contentManagerPlugin = app.getPlugin('content-manager');\n if (contentManagerPlugin?.apis?.addDocumentAction) {\n contentManagerPlugin.apis.addDocumentAction((actions: any[]) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return actions;\n }\n\n const hasHistory = actions.some((a: any) => a.type === 'history' || a.id === 'content-history');\n if (hasHistory) return actions;\n\n const customHistoryAction = ({ model, document }: any) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return null;\n }\n\n return {\n icon: React.createElement(ClockCounterClockwise, {}),\n label: 'Content History',\n onClick: () => {\n const currentPath = window.location.pathname.replace(/\\/$/, '');\n if (!currentPath.endsWith('/history')) {\n window.location.href = `${currentPath}/history${window.location.search}`;\n }\n },\n disabled: !document || !document.id || !model?.startsWith('api::'),\n position: 'header',\n };\n };\n customHistoryAction.type = 'history';\n customHistoryAction.position = 'header';\n\n const deleteIndex = actions.findIndex((a: any) => a.type === 'delete');\n if (deleteIndex !== -1) {\n actions.splice(deleteIndex, 0, customHistoryAction);\n } else {\n actions.push(customHistoryAction);\n }\n return actions;\n });\n }\n } catch {}\n },\n};\n"],"names":["document","React"],"mappings":";;AAAO,MAAM,YAAY;ACIzB,SAAS,WAAW,KAAqB;AACvC,UAAQ,OAAO,IACZ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ,EACtB,QAAQ,MAAM,OAAO;AAC1B;AAEA,SAAS,oBAAoB,SAAiB;AAC5C,MAAI,OAAO,aAAa,YAAa;AACrC,QAAM,WAAW,SAAS,eAAe,gCAAgC;AACzE,MAAI,mBAAmB,OAAA;AAEvB,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,QAAM,QAAQ,QAAQ,MAAM,yCAAyC;AACrE,MAAI,OAAO;AACT,YAAQ,MAAM,CAAC;AACf,aAAS,MAAM,CAAC;AAAA,EAAA;AAGlB,QAAM,SAAS,SAAS,cAAc,KAAK;AAC3C,SAAO,KAAK;AACZ,SAAO,MAAM,WAAW;AACxB,SAAO,MAAM,MAAM;AACnB,SAAO,MAAM,OAAO;AACpB,SAAO,MAAM,YAAY;AACzB,SAAO,MAAM,SAAS;AACtB,SAAO,MAAM,WAAW;AACxB,SAAO,MAAM,WAAW;AACxB,SAAO,MAAM,kBAAkB;AAC/B,SAAO,MAAM,QAAQ;AACrB,SAAO,MAAM,UAAU;AACvB,SAAO,MAAM,eAAe;AAC5B,SAAO,MAAM,YAAY;AACzB,SAAO,MAAM,UAAU;AACvB,SAAO,MAAM,aAAa;AAC1B,SAAO,MAAM,MAAM;AACnB,SAAO,MAAM,aAAa;AAC1B,SAAO,MAAM,WAAW;AACxB,SAAO,MAAM,aAAa;AAC1B,SAAO,MAAM,aAAa;AAE1B,SAAO,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -6,8 +6,9 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
6
  const crypto__default = /* @__PURE__ */ _interopDefault(crypto);
7
7
  const PLUGIN_ID = "bulk-updater";
8
8
  const PERMISSIONS = {
9
- // General
9
+ // General (support both .read and .access aliases)
10
10
  read: `plugin::${PLUGIN_ID}.read`,
11
+ access: `plugin::${PLUGIN_ID}.access`,
11
12
  // Workspace
12
13
  workspaceView: `plugin::${PLUGIN_ID}.workspace.view`,
13
14
  workspaceExecute: `plugin::${PLUGIN_ID}.workspace.execute`,
@@ -466,10 +467,16 @@ const hasPermissions = (policyContext, config, { strapi } = {}) => {
466
467
  }
467
468
  const user = ctx?.state?.user;
468
469
  const userAbility = ctx?.state?.userAbility;
469
- if (user?.isSuperAdmin === true) {
470
+ const isSuperAdmin = Boolean(
471
+ user?.isSuperAdmin === true || Array.isArray(user?.roles) && user.roles.some((r) => r?.code === "strapi-super-admin" || r?.name === "Super Admin")
472
+ );
473
+ if (isSuperAdmin) {
470
474
  return true;
471
475
  }
472
476
  if (userAbility && typeof userAbility.can === "function") {
477
+ if (userAbility.can("manage", "all") || userAbility.can("*")) {
478
+ return true;
479
+ }
473
480
  const isAllowed2 = mode === "any" ? actions.some((act) => userAbility.can(act)) : actions.every((act) => userAbility.can(act));
474
481
  if (isAllowed2) {
475
482
  return true;
@@ -488,7 +495,7 @@ const hasPermissions = (policyContext, config, { strapi } = {}) => {
488
495
  return false;
489
496
  }
490
497
  const permissions = Array.isArray(ctx?.state?.permissions) ? ctx.state.permissions : Array.isArray(user?.permissions) ? user.permissions.map((p) => typeof p === "string" ? p : p?.action).filter(Boolean) : [];
491
- if (permissions.includes("*")) {
498
+ if (permissions.includes("*") || permissions.includes("admin::all")) {
492
499
  return true;
493
500
  }
494
501
  const isAllowed = mode === "any" ? actions.some((act) => permissions.includes(act)) : actions.every((act) => permissions.includes(act));
@@ -1594,6 +1601,37 @@ function filterAndEnrichRules(strapi, collectionUid, activeRules) {
1594
1601
  }
1595
1602
  return effectiveRules;
1596
1603
  }
1604
+ function normalizeRuleQuotas(quotas) {
1605
+ const result = {};
1606
+ if (!quotas) return result;
1607
+ if (Array.isArray(quotas)) {
1608
+ for (const item of quotas) {
1609
+ if (item && typeof item === "object") {
1610
+ const key = item.key || item.option || item.name || item.val || item.value;
1611
+ const max = item.maxAllowed ?? item.max ?? item.quota ?? item.limit ?? item.value;
1612
+ if (key && max !== void 0) {
1613
+ result[String(key).trim().toLowerCase()] = Math.max(1, parseInt(String(max), 10) || 1);
1614
+ }
1615
+ } else if (typeof item === "string" && item.trim()) {
1616
+ result[item.trim().toLowerCase()] = 1;
1617
+ }
1618
+ }
1619
+ } else if (typeof quotas === "object") {
1620
+ for (const [k, v] of Object.entries(quotas)) {
1621
+ if (v && typeof v === "object" && ("key" in v || "maxAllowed" in v || "value" in v)) {
1622
+ const item = v;
1623
+ const key = item.key || item.option || item.name || k;
1624
+ const max = item.maxAllowed ?? item.max ?? item.quota ?? item.value;
1625
+ if (key && max !== void 0) {
1626
+ result[String(key).trim().toLowerCase()] = Math.max(1, parseInt(String(max), 10) || 1);
1627
+ }
1628
+ } else {
1629
+ result[String(k).trim().toLowerCase()] = Math.max(1, parseInt(String(v), 10) || 1);
1630
+ }
1631
+ }
1632
+ }
1633
+ return result;
1634
+ }
1597
1635
  async function validateEntityQuotas(strapi, collectionUid, entity, customRules) {
1598
1636
  if (!entity || typeof entity !== "object") {
1599
1637
  return { isValid: true };
@@ -1678,7 +1716,8 @@ async function validateEntityQuotas(strapi, collectionUid, entity, customRules)
1678
1716
  for (const rule of effectiveRules) {
1679
1717
  const ruleCounts = structuredCounts[rule.id] || {};
1680
1718
  const rtRuleCounts = richTextCounts[rule.id] || {};
1681
- for (const [quotaKey, maxAllowed] of Object.entries(rule.quotas || {})) {
1719
+ const effectiveQuotas = normalizeRuleQuotas(rule.quotas);
1720
+ for (const [quotaKey, maxAllowed] of Object.entries(effectiveQuotas)) {
1682
1721
  const lowerVal = quotaKey.toLowerCase().trim();
1683
1722
  const structCount = ruleCounts[lowerVal] || 0;
1684
1723
  const rtCount = rule.includeRichTextHtml ? rtRuleCounts[lowerVal] || 0 : 0;
@@ -1725,19 +1764,38 @@ const validationRulesService = ({ strapi }) => ({
1725
1764
  await store.set({ value: { rules: DEFAULT_RULES } });
1726
1765
  return DEFAULT_RULES;
1727
1766
  }
1728
- return stored.rules;
1767
+ let needsResave = false;
1768
+ const sanitizedRules = stored.rules.map((rule) => {
1769
+ const normalizedQuotas = normalizeRuleQuotas(rule.quotas);
1770
+ if (Array.isArray(rule.quotas)) {
1771
+ needsResave = true;
1772
+ }
1773
+ return {
1774
+ ...rule,
1775
+ quotas: normalizedQuotas
1776
+ };
1777
+ });
1778
+ if (needsResave) {
1779
+ try {
1780
+ await store.set({ value: { rules: sanitizedRules } });
1781
+ } catch (err) {
1782
+ }
1783
+ }
1784
+ return sanitizedRules;
1729
1785
  },
1730
1786
  async saveRule(ruleData) {
1731
1787
  const store = await this.getStore();
1732
1788
  const rules = await this.getRules();
1733
1789
  const now = (/* @__PURE__ */ new Date()).toISOString();
1734
1790
  let savedRule;
1791
+ const normalizedQuotas = normalizeRuleQuotas(ruleData.quotas || { h1: 1 });
1735
1792
  if (ruleData.id) {
1736
1793
  const index2 = rules.findIndex((r) => r.id === ruleData.id);
1737
1794
  if (index2 !== -1) {
1738
1795
  savedRule = {
1739
1796
  ...rules[index2],
1740
1797
  ...ruleData,
1798
+ quotas: normalizedQuotas,
1741
1799
  collectionUid: ruleData.collectionUid !== void 0 ? ruleData.collectionUid : rules[index2].collectionUid || "*",
1742
1800
  includeRichTextHtml: ruleData.includeRichTextHtml !== void 0 ? Boolean(ruleData.includeRichTextHtml) : Boolean(rules[index2].includeRichTextHtml),
1743
1801
  richTextFields: Array.isArray(ruleData.richTextFields) ? ruleData.richTextFields : rules[index2].richTextFields || [],
@@ -1751,7 +1809,7 @@ const validationRulesService = ({ strapi }) => ({
1751
1809
  description: ruleData.description || "",
1752
1810
  collectionUid: ruleData.collectionUid || "*",
1753
1811
  targetField: ruleData.targetField || "headingLevel",
1754
- quotas: ruleData.quotas || { h1: 1 },
1812
+ quotas: normalizedQuotas,
1755
1813
  exceededAction: ruleData.exceededAction || "disable",
1756
1814
  enabled: ruleData.enabled ?? true,
1757
1815
  scope: ruleData.scope || "entry",
@@ -1770,7 +1828,7 @@ const validationRulesService = ({ strapi }) => ({
1770
1828
  description: ruleData.description || "",
1771
1829
  collectionUid: ruleData.collectionUid || "*",
1772
1830
  targetField: ruleData.targetField || "headingLevel",
1773
- quotas: ruleData.quotas || { h1: 1 },
1831
+ quotas: normalizedQuotas,
1774
1832
  exceededAction: ruleData.exceededAction || "disable",
1775
1833
  enabled: ruleData.enabled ?? true,
1776
1834
  scope: ruleData.scope || "entry",
@@ -1814,7 +1872,7 @@ const validationRulesService = ({ strapi }) => ({
1814
1872
  throw new Error(`Validation rule ${ruleId} not found`);
1815
1873
  }
1816
1874
  const targetField = rule.targetField;
1817
- const quotas = rule.quotas || {};
1875
+ const quotas = normalizeRuleQuotas(rule.quotas);
1818
1876
  const violations = [];
1819
1877
  let totalScanned = 0;
1820
1878
  const allContentTypes = strapi.contentTypes || {};
@@ -12346,11 +12404,23 @@ const index = {
12346
12404
  plugin: "bulk-updater",
12347
12405
  type: "string"
12348
12406
  });
12407
+ try {
12408
+ const actionProvider = strapi.service?.("admin::permission")?.actionProvider || strapi.admin?.services?.permission?.actionProvider;
12409
+ if (actionProvider?.registerMany) {
12410
+ actionProvider.registerMany(BULK_UPDATER_PERMISSION_ACTIONS);
12411
+ } else if (actionProvider?.register) {
12412
+ for (const action of BULK_UPDATER_PERMISSION_ACTIONS) {
12413
+ actionProvider.register(action);
12414
+ }
12415
+ }
12416
+ } catch (err) {
12417
+ strapi.log?.warn?.(`[bulk-updater] Early permission registration: ${err?.message || err}`);
12418
+ }
12349
12419
  },
12350
12420
  bootstrap({ strapi }) {
12351
12421
  installUndiciCrashGuard(strapi);
12352
12422
  try {
12353
- const actionProvider = strapi.admin?.services?.permission?.actionProvider;
12423
+ const actionProvider = strapi.service?.("admin::permission")?.actionProvider || strapi.admin?.services?.permission?.actionProvider;
12354
12424
  if (actionProvider?.registerMany) {
12355
12425
  actionProvider.registerMany(BULK_UPDATER_PERMISSION_ACTIONS);
12356
12426
  } else if (actionProvider?.register) {
@@ -12582,6 +12652,7 @@ exports.isFetchFailedError = isFetchFailedError;
12582
12652
  exports.isPlainObject = isPlainObject;
12583
12653
  exports.isValidDocumentId = isValidDocumentId;
12584
12654
  exports.normalizeExportMode = normalizeExportMode;
12655
+ exports.normalizeRuleQuotas = normalizeRuleQuotas;
12585
12656
  exports.parseBoolean = parseBoolean;
12586
12657
  exports.parseCsvToMatrix = parseCsvToMatrix;
12587
12658
  exports.parseCsvToRecords = parseCsvToRecords;