mongofire 6.5.3 → 6.5.6

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/CHANGELOG.md CHANGED
@@ -1,74 +1,39 @@
1
- ## [6.6.0] - 2025-03-10
2
-
3
- ### 🐛 Critical Bug Fixes
4
-
5
- #### BUG-1 — Delta cursor `$or` overwrite (data loss on every sync after first)
6
- **File:** `src/sync.js` — `_downloadCollection()` delta section
7
- When `cursor.id` was set (every delta sync after the first), spreading `tsFilter`
8
- and `applyCondition` into the same object silently discarded the timestamp `$or`
9
- because JavaScript objects cannot have two `$or` keys. MongoDB received no
10
- timestamp constraint and re-fetched the entire changetrack collection on every
11
- delta sync. Fixed by using `$and: [tsCondition, applyCondition]` when both
12
- conditions contain a top-level `$or`.
13
-
14
- #### BUG-2 — Per-instance connection never wired (CRIT-3 was incomplete)
15
- **Files:** `src/index.cjs`, `src/sync.js`, `src/changetrack.js`, `src/state.js`, `src/reconcile.js`
16
- `MongoFire` constructor created a new `Connection` instance (`this._conn`) but
17
- `sync.js`, `changetrack.js`, `state.js`, and `reconcile.js` all used the
18
- module-level singleton. `this._conn.local` was never `null.collection(...)` —
19
- it threw `TypeError` on every operation. Added `setConnection(conn)` to all four
20
- modules; `MongoFire._doStart()` now calls each after `connectLocal()`.
21
-
22
- #### BUG-3 — Bulk path non-idempotent on replica-set transaction retries
23
- **File:** `src/changetrack.js` — `_doRecordChangeBulk()`
24
- `_doRecordChangeBulk()` used `insertOne` in its `bulkWrite` array. When a
25
- replica-set transaction was retried by `withTransaction()`, the same `opId` was
26
- re-inserted, hitting the unique sparse index and throwing `E11000 duplicate key`.
27
- Fixed by switching to `updateOne / $setOnInsert` (same pattern as the single
28
- `recordChange` path) — idempotent by design.
29
-
30
- #### BUG-4 — Bootstrap resume cursor silently lost on crash-resume
31
- **Files:** `src/sync.js`, `src/state.js`
32
- Bootstrap resume was saved as `setCursor(..., new Date(0))` plus a separate raw
33
- `updateOne` writing a plain ObjectId string. `_normalizeCursor()` tried to parse
34
- the ObjectId string as a `Date`, got `Invalid Date`, and returned `null` —
35
- so resume always restarted from scratch. Fixed: `setCursor()` now accepts
36
- `{ ts: null, id: ObjectId-string }`; `_normalizeCursor()` recognises 24-char hex
37
- strings as ObjectId cursors and returns `{ ts: null, id }` correctly.
38
-
39
- ### 🐛 Medium Bug Fixes
40
-
41
- #### BUG-5 — `conflictResolved` event declared but never emitted
42
- **File:** `src/index.cjs`
43
- TypeScript types declared `conflictResolved` in `MongoFireEvents` but
44
- `retryConflict()` and `dismissConflict()` never called `this.emit(...)`. Any
45
- listener registered with `mongofire.on('conflictResolved', ...)` never fired.
46
- Both methods now emit `conflictResolved` with `{ opId, resolution }`.
47
-
48
- #### BUG-6 — Module-level `_deviceId` shared across multiple instances
49
- **File:** `src/device.js`
50
- The module-level `_deviceId` singleton meant multiple `MongoFire` instances
51
- in the same process shared the same deviceId. The download de-dup filter
52
- (`op.deviceId === deviceId`) then skipped ops from sibling instances.
53
- Introduced `DeviceManager` class; each `MongoFire` instance creates its own
54
- via `newDeviceManager()`. Module-level singleton retained for backward compat.
55
-
56
- ### ✨ New Features
57
-
58
- #### Interactive CLI (Inquirer.js)
59
- All `mongofire` CLI commands now run in interactive prompt mode when no flags
60
- are passed. Uses `inquirer` when available, falls back to `readline` so the
61
- CLI always works without extra deps.
62
-
63
- - `npx mongofire init` — Setup wizard: module system, collections, realtime, sync interval
64
- - `npx mongofire clean` — Interactive days selector with confirmation prompt
65
- - `npx mongofire conflicts` *(new)* — View, retry, or dismiss unresolved conflicts interactively
66
- - `npx mongofire reconcile` *(new)* — Run recovery scan and view per-collection results
67
-
68
1
  # Changelog
69
2
 
70
3
  All notable changes to MongoFire are documented here.
71
4
 
5
+ - 🚀 fixed bugs
6
+
7
+ ## [6.5.6] — 2026-03-10
8
+
9
+ ### Fixed
10
+
11
+ - 🚀 New Features Added and fixed bugs
12
+
13
+ ## [6.5.5] — 2026-03-12
14
+
15
+ ### Fixed
16
+
17
+ - 🚀 Improved CLI speed, fixed multi-instance & network issues, and many more enhancements
18
+
19
+ ## [6.5.4] — 2026-03-10
20
+
21
+ ### Fixed
22
+
23
+ - 🚀 Improved CLI speed, fixed multi-instance & network issues, and many more enhancements
24
+
25
+ ## [6.5.3] — 2026-03-10
26
+
27
+ ### Fixed
28
+
29
+ - CLI: `bin/` directory missing from npm package — CLI was absent after install
30
+ - CLI: `inquirer` version pinned to `^8.0.0` (v9+ is ESM-only, broke CJS CLI)
31
+ - CLI: `retryConflict()` was not resetting retry counter (no-op `$inc: 0`)
32
+ - CLI: Network errors in delete version check were silently swallowed
33
+ - CLI: `getSyncStatus()` now returns `realtime` field matching TypeScript types
34
+ - CLI: `reconcile.js` multi-instance connection fix completed
35
+ - CLI: Spurious "inquirer not found" hint removed from `npx mongofire init`
36
+
72
37
  ## [6.5.0] — 2026-03-08
73
38
 
74
39
  ### Fixed — Critical
@@ -131,16 +96,19 @@ All notable changes to MongoFire are documented here.
131
96
  ## [6.2.0] — 2026-03-08
132
97
 
133
98
  ### Fixed — Critical
99
+
134
100
  - **`start()` concurrent safety** — multiple simultaneous `start()` calls now share one init promise instead of racing
135
101
  - **Bootstrap re-trigger bug** — an empty collection no longer forces a full re-bootstrap of all collections
136
102
  - **Silent change tracking errors** — errors in the Mongoose hooks are now logged instead of swallowed
137
103
  - **Realtime sync not working** — change stream pipeline fix; was silently delivering zero events on most Atlas clusters
138
104
 
139
105
  ### Fixed — Medium
106
+
140
107
  - **`deleteMany` OOM risk** — plugin now streams and batches docs before deletion; removes 10,000-doc silent cap
141
108
  - **Session not forwarded in `updateOne` and `deleteOne` hooks** — reads now occur within the same transaction context
142
109
 
143
110
  ### Added
111
+
144
112
  - Full TypeScript declarations (`types/index.d.ts`) with typed events, config, and result interfaces
145
113
  - `require('mongofire/plugin')` subpath export
146
114
  - Max retry limit (10 attempts) for permanently failing operations