strapi-content-sync-pro 1.0.2 → 1.0.4

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 (36) hide show
  1. package/README.md +67 -18
  2. package/admin/src/components/BulkTransferTab.jsx +880 -0
  3. package/admin/src/components/ConfigTab.jsx +25 -4
  4. package/admin/src/components/HelpTab.jsx +201 -15
  5. package/admin/src/components/MediaTab.jsx +7 -0
  6. package/admin/src/components/StatsTab.jsx +470 -0
  7. package/admin/src/components/SyncProfilesTab.jsx +63 -5
  8. package/admin/src/components/SyncTab.jsx +53 -7
  9. package/admin/src/pages/App/index.jsx +15 -1
  10. package/docs/clipchamp-screen-recording-script.md +0 -0
  11. package/docs/production-readiness-status.md +34 -0
  12. package/docs/production-readiness-test-matrix.md +151 -0
  13. package/docs/test-environments-setup-legacy.txt +60 -0
  14. package/package.json +13 -4
  15. package/server/src/content-types/index.js +2 -0
  16. package/server/src/content-types/sync-run-report/schema.json +26 -0
  17. package/server/src/controllers/bulk-transfer.js +141 -0
  18. package/server/src/controllers/config.js +48 -5
  19. package/server/src/controllers/index.js +4 -0
  20. package/server/src/controllers/sync-log.js +6 -0
  21. package/server/src/controllers/sync-media.js +19 -0
  22. package/server/src/controllers/sync-stats.js +51 -0
  23. package/server/src/controllers/sync.js +9 -3
  24. package/server/src/routes/index.js +28 -0
  25. package/server/src/services/bulk-transfer.js +837 -0
  26. package/server/src/services/config.js +18 -2
  27. package/server/src/services/index.js +4 -0
  28. package/server/src/services/sync-execution.js +102 -5
  29. package/server/src/services/sync-log.js +36 -0
  30. package/server/src/services/sync-media.js +224 -1
  31. package/server/src/services/sync-profiles.js +92 -4
  32. package/server/src/services/sync-stats.js +353 -0
  33. package/server/src/services/sync.js +323 -101
  34. package/server/src/utils/applier.js +120 -13
  35. package/server/src/utils/comparator.js +22 -6
  36. package/server/src/utils/fetcher.js +11 -2
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Content Sync Pro Plugin for Strapi
1
+ # Content Sync Pro Plugin for Strapi
2
2
 
3
3
  <p align="center">
4
4
  <img src="https://raw.githubusercontent.com/eharain/strapi-content-sync-pro/master/docs/logo-horizontal.svg" alt="Content Sync Pro" width="720" />
@@ -14,7 +14,7 @@ A powerful Strapi v5 plugin to copy, migrate, and live-sync content, media, and
14
14
  Plugin intro: https://youtu.be/hr3dD6dLgLQ
15
15
 
16
16
  <a href="https://youtu.be/hr3dD6dLgLQ" target="_blank" rel="noopener noreferrer">
17
- <img src="https://raw.githubusercontent.com/eharain/strapi-content-sync-pro/master/docs/Screenshot%202026-04-20%20160506.png" alt="Content Sync Pro watch the intro video" width="100%" />
17
+ <img src="https://raw.githubusercontent.com/eharain/strapi-content-sync-pro/master/docs/Screenshot%202026-04-20%20160506.png" alt="Content Sync Pro watch the intro video" width="100%" />
18
18
  </a>
19
19
 
20
20
  ## Screenshots
@@ -50,14 +50,19 @@ Plugin intro: https://youtu.be/hr3dD6dLgLQ
50
50
 
51
51
  ## Features
52
52
 
53
- - **Bi-directional Content Sync** - Push, pull, or sync both ways (Local wins, Remote wins, or Latest wins).
53
+ - **Deployment Modes** - Paired mode (plugin on both servers) or Single-side mode (plugin only on local server).
54
+ - **Bi-directional Content Sync** - Push, pull, or sync both ways (Local wins, Remote wins, or Latest wins) in paired mode.
54
55
  - **Media Sync** - Full media synchronization via HTTP (URL-based) or host-level file copy (`rsync`). Includes MIME type filtering and concurrency controls.
55
56
  - **Sync Profiles** - Define WHAT to sync with field-level control (Advanced mode) or preset modes.
56
- - **Execution Modes** - On-demand, Scheduled (interval, timeout, cron, or external scheduler), or Live (real-time) sync.
57
+ - **Execution Modes** - On-demand, Scheduled (interval, timeout, cron, or external scheduler), Live (real-time), with per-profile execution controls.
57
58
  - **Pagination & Large Dataset Support** - Built-in pagination ensures stable memory usage even when syncing thousands of records.
58
59
  - **Dependency Analytics** - Automatically detects and syncs related entities and components in the correct order.
59
60
  - **Enforcement Checks** - Pre-sync schema compatibility validation, version checks, and server time drift checks.
60
61
  - **Alerts & Logging** - Detailed sync logs. Receive success/failure alerts via Email (using Strapi's email provider) or Webhooks.
62
+ - **Stats & Run Reports** - Local/remote counts and newest timestamps per content type, with before/after snapshots for each sync run.
63
+ - **Bulk Transfer** - Dedicated top-level tab for one-click full pull or full push across selectable scopes (content, media, Strapi users, admin users). Expands into per-content-type and per-media-profile chunks with page-level progress, selectable chunks, optional deletion sync, and auto-continue or manual chunk-by-chunk stepping.
64
+ - **Pause / Resume / Cancel & Persisted History** - Bulk Transfer jobs can be paused after the current page (cursor, page number, and counters preserved), cancelled without losing progress, and resumed later from the exact saved state. Every run is stored in a persistent history so you can inspect per-chunk results and **restart** or **resume** any previous run — even after a Strapi restart.
65
+ - **Retention Controls** - Manual clear and automatic retention limits for logs and run reports.
61
66
  - **Secure Communication** - API token authentication combined with HMAC-SHA256 request signing using a shared secret.
62
67
 
63
68
  ## Prerequisites
@@ -110,14 +115,23 @@ npm run develop
110
115
 
111
116
  ## Quick Start
112
117
 
113
- ### Step 1: Configure Connection
114
- In the **Configuration** tab, set up the remote server connection.
118
+ ### Step 1: Choose Deployment Mode and Configure Connection
119
+ In **Configuration**, choose one mode:
120
+ - **Paired**: install and enable plugin on both local and remote servers.
121
+ - **Single-side**: install plugin only on local server (remote plugin routes not required).
122
+
123
+ Then configure Base URL, API Token, Instance ID, and Shared Secret.
115
124
 
116
125
  ### Step 2: Enable Content Types
117
126
  In the **Content Types** tab, toggle on the content types you want to sync. Default profiles are auto-generated.
118
127
 
119
- ### Step 3: Run Sync
120
- In the **Sync** tab, click "Sync All Active Profiles" or run individual profiles.
128
+ ### Step 3: Align Sync Settings on Both Servers
129
+ In **Content Types**, enable matching content types on both servers.
130
+ In **Sync Profiles**, set compatible direction/conflict strategy.
131
+ Then in **Sync**, configure execution mode and global page size.
132
+
133
+ ### Step 4: Run Sync
134
+ In the **Sync** tab, click **Sync All Active Profiles** or run individual profiles.
121
135
 
122
136
  ## Sync Profiles
123
137
 
@@ -135,6 +149,20 @@ Configure individual field policies:
135
149
  - **Pull** - Field only pulls from remote
136
150
  - **Exclude** - Field is never synced
137
151
 
152
+ ## Deployment Modes
153
+
154
+ ### Paired mode
155
+ - Plugin installed on both local and remote servers.
156
+ - Supports push, pull, and bidirectional profiles.
157
+ - Supports on-demand, scheduled, and live execution modes.
158
+ - Connection test validates remote plugin endpoints.
159
+
160
+ ### Single-side mode
161
+ - Plugin installed on local server only.
162
+ - Pull-only profiles are enforced.
163
+ - Live execution is disabled (use on-demand or scheduled).
164
+ - Connection test validates remote reachability and API token access without requiring remote plugin routes.
165
+
138
166
  ## Execution Modes
139
167
 
140
168
  Configure **when** sync runs in the Sync tab:
@@ -158,14 +186,15 @@ Configure **when** sync runs in the Sync tab:
158
186
 
159
187
  Full media synchronization between Strapi instances:
160
188
 
161
- - **URL Strategy** (HTTP) Works with any upload provider (local, S3, Cloudinary). Downloads and re-uploads via the Upload API.
162
- - **rsync Strategy** Host-level file copy using the `rsync` binary. Fastest for local-provider setups with SSH access.
163
- - **Profile-based** Create media sync profiles with direction, conflict strategy, MIME filters, filename patterns, and execution settings.
164
- - **DB + File Sync** Syncs both the `plugin::upload.file` database rows and the actual file bytes.
189
+ - **URL Strategy** (HTTP) Works with any upload provider (local, S3, Cloudinary). Downloads and re-uploads via the Upload API.
190
+ - **rsync Strategy** Host-level file copy using the `rsync` binary. Fastest for local-provider setups with SSH access.
191
+ - **Profile-based** Create media sync profiles with direction, conflict strategy, MIME filters, filename patterns, and execution settings.
192
+ - **DB + File Sync** Syncs both the `plugin::upload.file` database rows and the actual file bytes.
193
+ - **Morph Link Remapping** — Syncs `files_related_morphs` links by mapping file + related entities through documentId, then remapping to local numeric ids before insert.
165
194
 
166
195
  ## Enforcement
167
196
 
168
- Pre-sync validation (Configuration ? Enforcement):
197
+ Pre-sync validation (Configuration Enforcement):
169
198
 
170
199
  - **Schema Match** - Verify content type schemas match (strict/compatible/none)
171
200
  - **Version Check** - Verify Strapi versions (exact/minor/major/none)
@@ -173,7 +202,7 @@ Pre-sync validation (Configuration ? Enforcement):
173
202
 
174
203
  ## Alerts
175
204
 
176
- Get notified of sync events (Configuration ? Alerts):
205
+ Get notified of sync events (Configuration Alerts):
177
206
 
178
207
  - **Strapi Logs** - Logs to sync log and server console
179
208
  - **Email** - Requires Strapi email plugin configured
@@ -215,6 +244,24 @@ Sync products from a central catalog to multiple storefronts:
215
244
  - Create "Full Pull" profile for `api::product.product`
216
245
  - Set execution mode to "Scheduled" (every 5 minutes)
217
246
 
247
+ ## Stats & Data Management
248
+
249
+ The **Stats** tab is split into two sub-tabs:
250
+
251
+ **Current Snapshot** — live local vs remote state per content type:
252
+ - Local vs remote record count
253
+ - Media files and media morph stats (local, plus remote where available)
254
+ - Newest record timestamp on each side and which side is newest (local, remote, equal)
255
+ - Search by UID, filter by type (content / media / media morph) or newest side, and paginate large result sets
256
+
257
+ **Run Reports** — before/after snapshots captured for each sync run:
258
+ - Filter by status (all / success / failed) and paginate server-side
259
+ - Expand any report to see the before and after row tables
260
+
261
+ A top action row (shared by both sub-tabs) provides:
262
+ - **Refresh Stats**, **Clear Logs**, **Clear Stats Reports**
263
+ - **Max Logs** / **Max Reports** retention limits with **Save & Apply Retention** (also enforced automatically after each sync run)
264
+
218
265
  ## Troubleshooting
219
266
 
220
267
  ### Common Issues
@@ -222,8 +269,10 @@ Sync products from a central catalog to multiple storefronts:
222
269
  | Error | Solution |
223
270
  |-------|----------|
224
271
  | "Remote server not configured" | Add Base URL and API Token in Configuration |
225
- | "401 Unauthorized" | Regenerate API token on remote server |
226
- | "HMAC verification failed" | Ensure shared secret matches on both instances |
272
+ | "401 Unauthorized / 403 Forbidden" | Regenerate API token and verify required permissions for synced content types (and Upload permissions for media) |
273
+ | "HMAC verification failed" | Ensure shared secret matches on both instances in paired mode |
274
+ | "Content type endpoint not found" | In paired mode, ensure matching content-type definitions and enabled API routes on both instances |
275
+ | "Live mode not available" | Switch to paired mode, or use on-demand/scheduled in single-side mode |
227
276
  | "Schema mismatch" | Sync content type schemas or set enforcement to "compatible" |
228
277
 
229
278
  ### Viewing Logs
@@ -240,7 +289,7 @@ Check the **Logs** tab for detailed sync history including:
240
289
  - **Credential handling.** The optional "Generate Token" feature lets you authenticate to **your own** remote Strapi server to create an API token. Credentials are sent directly from your browser to your server via the plugin's backend proxy, used once, and **never stored** on disk, in the database, or in memory after the request completes.
241
290
  - **API Tokens** are encrypted at rest using Strapi's built-in store.
242
291
  - **HMAC-SHA256** signatures protect all inter-instance requests from tampering.
243
- - **Masked secrets** API tokens and shared secrets are masked (`��������`) in all API responses.
292
+ - **Masked secrets** API tokens and shared secrets are masked (`••••••••`) in all API responses.
244
293
 
245
294
  ## Contributing
246
295
 
@@ -254,4 +303,4 @@ MIT License - see [LICENSE](LICENSE) for details.
254
303
 
255
304
  **Ejaz Husain Arain**
256
305
  - GitHub: [@eharain](https://github.com/eharain)
257
- - Email: eharain@yahoo.com
306
+ - Email: eharain@yahoo.com