strapi-plugin-bulk-updater 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 strapi-utills
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # Strapi Plugin: Bulk Attribute & Relation Updater
2
+
3
+ <div align="center">
4
+
5
+ # ⚡ Bulk Attribute & Relation Updater for Strapi v5
6
+
7
+ **Cross-Collection Mass Attribute & Relationship Updates with Schema Safety, Enterprise Maker-Checker Governance, Off-Peak Scheduling, and 3-Tier Audit Rollback.**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/strapi-plugin-bulk-updater.svg?style=flat-square)](https://www.npmjs.com/package/strapi-plugin-bulk-updater)
10
+ [![Strapi v5 Compatible](https://img.shields.io/badge/Strapi-v5.x-4945ff.svg?style=flat-square)](https://strapi.io)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
12
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/Prateeks91/strapi-bulk-update/pulls)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🚀 Why Bulk Updater?
19
+
20
+ Strapi allows editing entries individually or applying bulk actions within a single collection type. However, real-world content teams, enterprise marketing ops, and compliance managers often need to:
21
+
22
+ 1. **Update attributes across multiple collection types simultaneously** (e.g. updating a brand tagline, SEO meta description, department name, or compliance disclaimer).
23
+ 2. **Bulk-assign or update entity relationships** across content types (e.g. re-assigning articles to a new author, or associating multiple products with a promotion category).
24
+ 3. **Enforce enterprise Maker-Checker approval governance** so junior editors can propose changes that senior compliance officers review and approve.
25
+ 4. **Prevent database strain during peak traffic** by scheduling bulk operations for off-peak hours in a server-enforced business timezone.
26
+ 5. **Decide whether updates should auto-publish or remain as drafts** in Strapi v5 Draft & Publish collections.
27
+ 6. **Safely undo changes with one-click reversible rollback** backed by before/after audit snapshots.
28
+
29
+ ---
30
+
31
+ ## ✨ Features at a Glance
32
+
33
+ - 🔍 **Dynamic Cross-Collection Discovery**: Introspects all registered content types and attributes in your Strapi v5 instance.
34
+ - 🔗 **Full Relational Field Support**:
35
+ - Supports `manyToOne`, `oneToOne`, `oneToMany`, and `manyToMany` relations.
36
+ - Interactive target entity dropdown populated directly from target collection records.
37
+ - Relational update modes: **Set / Overwrite**, **Add / Connect**, **Remove / Disconnect**, and **Clear / Unlink**.
38
+ - Human-readable relation labels (`formatDisplayValue`) throughout the UI, confirmation modal, queue, and audit diffs.
39
+ - 👥 **Enterprise Maker-Checker Governance**:
40
+ - Two-person rule: Makers propose bulk changes; authorized Checkers review detailed diffs before approval and execution.
41
+ - Interactive Approvals Queue tab with status tracking (`PENDING`, `APPROVED`, `REJECTED`, `EXECUTED`).
42
+ - 🕒 **Timezone-Aware Off-Peak Scheduling**:
43
+ - Configured at server init time via `config/plugins.ts`.
44
+ - Server strictly enforces timezone evaluation via native `Intl.DateTimeFormat`.
45
+ - Blocks high-load batch updates during business hours and queues them for off-peak execution window with auto-wake processing.
46
+ - 📝 **Draft & Publish Granular Control**:
47
+ - Dedicated publishing mode toggle: **"Publish immediately upon execution"** vs **"Keep as draft"**.
48
+ - Transparent queue badging (`AUTO-PUBLISH` vs `DRAFT ONLY`).
49
+ - 👁️ **Per-Collection Dynamic Column Visibility**:
50
+ - Customizable visible columns per collection type with zero deep nesting architecture.
51
+ - Independent column selections, responsive horizontal scrolling, and accessible table headers.
52
+ - 🛡️ **Flexible 3-Tier Audit Architecture & One-Click Rollback**:
53
+ - **Tier 1 (Zero-Config)**: Auto-detects standard audit collections (`api::audit-log.audit-log`).
54
+ - **Tier 2 (Strapi Enterprise Bridge)**: Bridges events directly to native Strapi Enterprise Audit Logs (`admin::audit-logs`).
55
+ - **Tier 3 (Custom Declarative Schema)**: Custom collection types and declarative column mappings.
56
+ - **Deterministic Rollback**: Restores exact prior values and relationship links using Strapi v5 Document Service.
57
+ - 🌓 **Adaptive Light & Dark Theme Design**: Built with native `@strapi/design-system` tokens with high-contrast text and sticky viewport-constrained modals.
58
+ - ⚡ **Zero-Infra Strapi Cloud Ready**: In-memory caching, pod-level high-watermark ETags, zero external Redis/SQL requirements.
59
+ - 💎 **Pro Monetization Tier**: License key activation, Regex Find & Replace within attributes, and priority SLA.
60
+
61
+ ---
62
+
63
+ ## 📦 Installation
64
+
65
+ ```bash
66
+ # Using npm
67
+ npm install strapi-plugin-bulk-updater
68
+
69
+ # Using yarn
70
+ yarn add strapi-plugin-bulk-updater
71
+
72
+ # Using pnpm
73
+ pnpm add strapi-plugin-bulk-updater
74
+ ```
75
+
76
+ ---
77
+
78
+ ## ⚙️ Configuration
79
+
80
+ Enable the plugin in your Strapi project's `config/plugins.ts` (or `config/plugins.js`):
81
+
82
+ ### 1. Basic Setup (Zero-Config)
83
+
84
+ ```typescript
85
+ // config/plugins.ts
86
+ export default () => ({
87
+ 'bulk-updater': {
88
+ enabled: true,
89
+ },
90
+ });
91
+ ```
92
+
93
+ ### 2. Full Enterprise Configuration
94
+
95
+ ```typescript
96
+ // config/plugins.ts
97
+ export default () => ({
98
+ 'bulk-updater': {
99
+ enabled: true,
100
+ config: {
101
+ // Allowed collections for bulk updates
102
+ collections: [
103
+ 'api::article.article',
104
+ 'api::employee.employee',
105
+ 'api::job.job',
106
+ 'api::product.product',
107
+ ],
108
+
109
+ // Timezone-aware off-peak execution guardrails
110
+ executionTime: {
111
+ businessHours: {
112
+ start: '09:00',
113
+ end: '18:00',
114
+ timezone: 'America/New_York', // Any valid IANA timezone string
115
+ },
116
+ offPeakOnly: true, // Block direct execution during business hours
117
+ },
118
+
119
+ // Enterprise governance
120
+ makerChecker: {
121
+ enabled: true, // Requires checker approval before batch execution
122
+ },
123
+
124
+ // 3-Tier Audit Logging Configuration
125
+ audit: {
126
+ enabled: true,
127
+ // Optional: Custom collection type. If omitted, Tier 1 auto-discovers 'api::audit-log.audit-log'
128
+ contentType: 'api::audit-log.audit-log',
129
+ fields: {
130
+ batchId: 'batchId',
131
+ attribute: 'attribute',
132
+ value: 'value',
133
+ userEmail: 'userEmail',
134
+ userName: 'userName',
135
+ diffs: 'diffs',
136
+ isRolledBack: 'isRolledBack',
137
+ rolledBackAt: 'rolledBackAt',
138
+ rolledBackBy: 'rolledBackBy',
139
+ executedAt: 'executedAt',
140
+ },
141
+ },
142
+ },
143
+ },
144
+ });
145
+ ```
146
+
147
+ Rebuild your Strapi admin panel and start the server:
148
+
149
+ ```bash
150
+ npm run build
151
+ npm run develop
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🖥️ How It Works
157
+
158
+ ### 1. Workspace & Dynamic Attribute Selection
159
+ 1. Navigate to **Plugins > Bulk Attribute Updater** in your Strapi Admin Panel.
160
+ 2. Select your target **Collection Type** (e.g. `Article`, `Employee`).
161
+ 3. Choose the **Attribute to Update** from the dynamic dropdown:
162
+ - **Scalar attributes**: String, Text, Number, Boolean, Enumeration, etc.
163
+ - **Relation attributes**: Displayed with badges such as `author (relation ➔ Author)` or `categories (relation ➔ Category)`.
164
+ 4. Enter the new value or select a target entity from the relation combobox.
165
+ 5. Filter, sort, or customize visible columns with the **Columns** dropdown.
166
+ 6. Select target records using individual checkboxes or the select-all header.
167
+
168
+ ### 2. Confirmation Modal with Sticky Controls
169
+ - Inspect the update summary, target entity details, and before/after previews.
170
+ - Toggle **"Publish immediately upon execution"** (checked by default for Draft & Publish content types).
171
+ - If operating during business hours under an off-peak policy, click **Queue for Off-Peak** or **Submit for Checker Approval**.
172
+
173
+ ### 3. Maker-Checker Approvals Queue
174
+ - Switch to the **Pending Approvals & Queued Batches** tab.
175
+ - Makers can review their queued proposals.
176
+ - Authorized Checkers can review detailed before/after diffs, approve, reject, or trigger execution.
177
+
178
+ ### 4. Audit Trail & Deterministic Version Rollback
179
+ - Switch to the **Audit Trail & Rollback History** tab.
180
+ - View chronological execution history with admin authorship and timestamps.
181
+ - Click **View Diffs** to inspect previous vs applied values.
182
+ - Click **Rollback Batch** to revert documents and relationship links back to their exact prior state.
183
+
184
+ ---
185
+
186
+ ## 💎 Monetization & License Tiers
187
+
188
+ | Feature | Community (Free) | Pro / Enterprise Tier |
189
+ | :--- | :---: | :---: |
190
+ | Dynamic schema & attribute introspection | ✅ | ✅ |
191
+ | Cross-collection selection | ✅ | ✅ |
192
+ | Conditional schema validation & skip safety | ✅ | ✅ |
193
+ | Live execution report | ✅ | ✅ |
194
+ | Draft & Publish control | ✅ | ✅ |
195
+ | Per-collection column visibility | ✅ | ✅ |
196
+ | Relational field bulk updates | ✅ | ✅ |
197
+ | 3-Tier Audit Trail & Rollback | ✅ | ✅ |
198
+ | Enterprise Maker-Checker flow | ✅ | ✅ |
199
+ | Timezone-aware off-peak scheduling | ✅ | ✅ |
200
+ | **Regex Find & Replace within attributes** | ❌ | ✅ |
201
+ | **Audit log export (CSV / JSON)** | ❌ | ✅ |
202
+ | **Commercial License & Priority SLA** | ❌ | ✅ |
203
+
204
+ ### License Activation
205
+ Enter your license key in **Settings > Bulk Updater License** to unlock Pro features.
206
+
207
+ ---
208
+
209
+ ## 🛠️ API Reference
210
+
211
+ All routes are mounted under `/bulk-updater` and protected by Strapi Admin authentication:
212
+
213
+ | Method | Endpoint | Description |
214
+ | :--- | :--- | :--- |
215
+ | `GET` | `/bulk-updater/models` | Returns collections, attributes, and entries with schema introspection. |
216
+ | `GET` | `/bulk-updater/relation-options?targetUid=...` | Fetches relation candidate records for target content types. |
217
+ | `POST` | `/bulk-updater/batch-update` | Submits or queues a bulk update payload. |
218
+ | `GET` | `/bulk-updater/pending-batches` | Returns list of pending maker-checker batches and off-peak queues. |
219
+ | `POST` | `/bulk-updater/pending-batches/:id/approve` | Approves a pending batch (Checker action). |
220
+ | `POST` | `/bulk-updater/pending-batches/:id/reject` | Rejects a pending batch with reason notes. |
221
+ | `POST` | `/bulk-updater/pending-batches/:id/execute` | Executes an approved or off-peak queued batch. |
222
+ | `GET` | `/bulk-updater/audit/history` | Fetches audit log history and diffs. |
223
+ | `POST` | `/bulk-updater/audit/:batchId/rollback` | Rolls back a batch to its prior state. |
224
+ | `GET` | `/bulk-updater/license` | Checks current license status. |
225
+ | `POST` | `/bulk-updater/license/verify` | Activates and verifies a Pro license key. |
226
+ | `POST` | `/bulk-updater/license/deactivate` | Deactivates an active Pro license key. |
227
+
228
+ ---
229
+
230
+ ## 🤝 Contributing
231
+
232
+ Contributions are welcome! Please feel free to submit issues and pull requests:
233
+
234
+ 1. Fork the repository: [https://github.com/Prateeks91/strapi-bulk-update](https://github.com/Prateeks91/strapi-bulk-update)
235
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
236
+ 3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
237
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
238
+ 5. Open a Pull Request
239
+
240
+ ---
241
+
242
+ ## 📄 License
243
+
244
+ Distributed under the MIT License. See [LICENSE](LICENSE) for more details.
245
+
246
+ ---
247
+
248
+ <div align="center">
249
+ Maintained by <b><a href="https://github.com/Prateeks91">Prateek Srivastava</a></b> (strapi-utills)
250
+ </div>