mongofire 6.5.3 → 6.5.5
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 +21 -67
- package/README.md +365 -136
- package/dist/bin/mongofire.cjs +1 -851
- package/dist/src/changetrack.js +1 -1
- package/dist/src/compactor.js +1 -0
- package/dist/src/connection.js +1 -1
- package/dist/src/device.js +1 -1
- package/dist/src/diff.js +1 -0
- package/dist/src/field-merge.js +1 -0
- package/dist/src/index.cjs +1 -1
- package/dist/src/plugin.js +1 -1
- package/dist/src/plugin.mjs +6 -0
- package/dist/src/rate-limiter.js +1 -0
- package/dist/src/reconcile.js +1 -1
- package/dist/src/schema-manager.js +1 -0
- package/dist/src/state.js +1 -1
- package/dist/src/sync.js +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/types/index.d.ts +134 -307
- package/index.cjs +0 -2
- package/index.mjs +0 -1
- package/package.json +20 -19
- package/bin/mongofire.cjs +0 -852
package/CHANGELOG.md
CHANGED
|
@@ -1,74 +1,25 @@
|
|
|
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
|
+
## [6.5.4] — 2026-03-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- 🚀 Improved CLI speed, fixed multi-instance & network issues, and many more enhancements
|
|
10
|
+
|
|
11
|
+
## [6.5.3] — 2026-03-10
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- CLI: `bin/` directory missing from npm package — CLI was absent after install
|
|
16
|
+
- CLI: `inquirer` version pinned to `^8.0.0` (v9+ is ESM-only, broke CJS CLI)
|
|
17
|
+
- CLI: `retryConflict()` was not resetting retry counter (no-op `$inc: 0`)
|
|
18
|
+
- CLI: Network errors in delete version check were silently swallowed
|
|
19
|
+
- CLI: `getSyncStatus()` now returns `realtime` field matching TypeScript types
|
|
20
|
+
- CLI: `reconcile.js` multi-instance connection fix completed
|
|
21
|
+
- CLI: Spurious "inquirer not found" hint removed from `npx mongofire init`
|
|
22
|
+
|
|
72
23
|
## [6.5.0] — 2026-03-08
|
|
73
24
|
|
|
74
25
|
### Fixed — Critical
|
|
@@ -131,16 +82,19 @@ All notable changes to MongoFire are documented here.
|
|
|
131
82
|
## [6.2.0] — 2026-03-08
|
|
132
83
|
|
|
133
84
|
### Fixed — Critical
|
|
85
|
+
|
|
134
86
|
- **`start()` concurrent safety** — multiple simultaneous `start()` calls now share one init promise instead of racing
|
|
135
87
|
- **Bootstrap re-trigger bug** — an empty collection no longer forces a full re-bootstrap of all collections
|
|
136
88
|
- **Silent change tracking errors** — errors in the Mongoose hooks are now logged instead of swallowed
|
|
137
89
|
- **Realtime sync not working** — change stream pipeline fix; was silently delivering zero events on most Atlas clusters
|
|
138
90
|
|
|
139
91
|
### Fixed — Medium
|
|
92
|
+
|
|
140
93
|
- **`deleteMany` OOM risk** — plugin now streams and batches docs before deletion; removes 10,000-doc silent cap
|
|
141
94
|
- **Session not forwarded in `updateOne` and `deleteOne` hooks** — reads now occur within the same transaction context
|
|
142
95
|
|
|
143
96
|
### Added
|
|
97
|
+
|
|
144
98
|
- Full TypeScript declarations (`types/index.d.ts`) with typed events, config, and result interfaces
|
|
145
99
|
- `require('mongofire/plugin')` subpath export
|
|
146
100
|
- Max retry limit (10 attempts) for permanently failing operations
|