cross-tab-worker-databus 0.11.0 → 0.20.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 +209 -0
- package/dist/centrifuge.js +1 -1
- package/dist/centrifuge.shared.worker.js +4 -2
- package/dist/centrifuge.shared.worker.js.map +2 -2
- package/dist/centrifuge.worker.js +4 -2
- package/dist/centrifuge.worker.js.map +2 -2
- package/dist/{chunk-NX76TAV3.js → chunk-LPS4XOK4.js} +152 -20
- package/dist/{chunk-NX76TAV3.js.map → chunk-LPS4XOK4.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +151 -19
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/hooks.cjs +4 -1
- package/dist/cjs/hooks.cjs.map +2 -2
- package/dist/cjs/index.cjs +301 -68
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/vue.cjs +7 -1
- package/dist/cjs/vue.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +32 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/publication.d.ts.map +1 -1
- package/dist/core/replay-persistence.d.ts.map +1 -1
- package/dist/core/trace.d.ts +4 -1
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +4 -1
- package/dist/hooks.js.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +151 -50
- package/dist/index.js.map +2 -2
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +7 -1
- package/dist/vue.js.map +2 -2
- package/dist/websocket.d.ts.map +1 -1
- package/docs/README.md +1 -0
- package/docs/api.md +10 -3
- package/docs/configuration.md +21 -1
- package/docs/release-checklist.md +20 -0
- package/docs/roadmap.md +131 -3
- package/docs/zh/README.md +1 -0
- package/docs/zh/api.md +10 -3
- package/docs/zh/configuration.md +21 -1
- package/docs/zh/release-checklist.md +20 -0
- package/docs/zh/roadmap.md +132 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,215 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Semantic Versioning](https://semver.org/);变更记录格式参考 [Keep a Changelog](https://keepachangelog.com/)。
|
|
4
4
|
|
|
5
|
+
## [0.20.6] - 2026-09-02
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added a release checklist covering local gates, packed-consumer verification, tag creation, and manual npm publication.
|
|
10
|
+
- Added migration guidance for pre-0.20 consumers and clarified that historical npm versions are immutable and are not republished from the current tree.
|
|
11
|
+
|
|
12
|
+
## [0.20.5] - 2026-09-02
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Added public-consumer freeze coverage for root, hooks, Vue, and Centrifuge subpaths across ESM and CommonJS artifacts.
|
|
17
|
+
- Declaration checks now verify the shipped `.d.ts` files and key replay, deduplication, and publication metadata types.
|
|
18
|
+
|
|
19
|
+
## [0.20.4] - 2026-09-02
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Added a real Chromium multi-tab soak scenario covering repeated fan-out, owner migration, BFCache round trips, reload recovery, and duplicate-free delivery.
|
|
24
|
+
- Browser regression coverage now exercises lifecycle transitions as one continuous session instead of isolated one-shot checks.
|
|
25
|
+
|
|
26
|
+
## [0.20.3] - 2026-09-02
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Added React lifecycle coverage for dynamic topic changes.
|
|
31
|
+
- Topic replacement now verifies old subscriptions are removed before the new topic is delivered, including end-to-end WebSocket hook wiring.
|
|
32
|
+
|
|
33
|
+
## [0.20.2] - 2026-09-02
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Added protocol recovery coverage proving valid WebSocket publications continue after malformed binary and text frames.
|
|
38
|
+
- Binary truncation, JSON parse failures, nested envelopes, and error isolation are now exercised as one compatibility sequence.
|
|
39
|
+
|
|
40
|
+
## [0.20.1] - 2026-09-02
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- Added persistence mutation-sequence soak coverage spanning hydration, retry recovery, topic cleanup, subsequent append, and full cleanup.
|
|
45
|
+
- Recovery tests now verify that serialized persistence operations remain usable after transient failures.
|
|
46
|
+
|
|
47
|
+
## [0.20.0] - 2026-09-02
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
|
|
51
|
+
- Formalized publication-envelope compatibility coverage across legacy, nested, fallback-topic, primitive payload, metadata, and unknown-field frames.
|
|
52
|
+
- Empty or missing topics are rejected consistently while transport-supplied fallback channels remain supported.
|
|
53
|
+
|
|
54
|
+
## [0.19.9] - 2026-09-02
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- Added regression coverage for deduplication and replay/persistence composition.
|
|
59
|
+
- Duplicate publications are verified not to pollute replay history, while IDs can re-enter history after TTL expiry.
|
|
60
|
+
|
|
61
|
+
## [0.19.8] - 2026-09-02
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- IndexedDB replay persistence now invalidates cached connections after transaction creation or request failures.
|
|
66
|
+
- Closed or otherwise unusable connections can recover through the existing persistence retry path without recreating the adapter.
|
|
67
|
+
|
|
68
|
+
## [0.19.7] - 2026-09-02
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
- IndexedDB replay persistence no longer permanently caches a rejected `open()` promise after transient initialization failures.
|
|
73
|
+
- Subsequent persistence operations can reopen the database and recover without recreating the adapter.
|
|
74
|
+
|
|
75
|
+
## [0.19.6] - 2026-09-02
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- IndexedDB replay persistence now handles cross-tab `versionchange` events by closing stale connections and reopening on the next operation.
|
|
80
|
+
- Multi-tab schema changes no longer leave the adapter permanently bound to an invalid connection.
|
|
81
|
+
|
|
82
|
+
## [0.19.5] - 2026-09-02
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
- React `useCrossTabDataBus` now ignores stale effect generations during rapid dependency changes.
|
|
87
|
+
- Superseded asynchronous cleanup can no longer clear or overwrite the newest bus lifecycle.
|
|
88
|
+
|
|
89
|
+
## [0.19.4] - 2026-09-02
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- Vue `useCrossTabDataBus` now guards against stale asynchronous stop/start completions during rapid reactive dependency changes.
|
|
94
|
+
- A superseded lifecycle no longer resurrects an obsolete bus instance after a newer dependency update.
|
|
95
|
+
|
|
96
|
+
## [0.19.3] - 2026-09-02
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
|
|
100
|
+
- Added optional `dedup.sweepMs` for periodic expiry cleanup during quiet periods.
|
|
101
|
+
- Dedup sweep timers follow start/resume and pagehide/stop lifecycle boundaries.
|
|
102
|
+
|
|
103
|
+
## [0.19.2] - 2026-09-02
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- Pending persistence retries are cancelled across `stop()` and pagehide suspension boundaries.
|
|
108
|
+
- Lifecycle-cancelled retries no longer emit persistence errors or start another adapter attempt.
|
|
109
|
+
|
|
110
|
+
## [0.19.1] - 2026-09-01
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
|
|
114
|
+
- WebSocket transport now accepts browser `Blob` binary frames and decodes them through the existing ArrayBuffer protocol path.
|
|
115
|
+
- Blob conversion failures are isolated through the transport error handler without crashing the message callback.
|
|
116
|
+
|
|
117
|
+
## [0.19.0] - 2026-09-01
|
|
118
|
+
|
|
119
|
+
### Added
|
|
120
|
+
|
|
121
|
+
- Persistence retry now emits opt-in `reliability` trace events with the bounded operation name and retry attempt.
|
|
122
|
+
- Retry diagnostics cover `load`, `append`, `clear`, `clearTopic`, and `clearBefore` without exposing payloads or error bodies.
|
|
123
|
+
|
|
124
|
+
### Compatibility
|
|
125
|
+
|
|
126
|
+
- Tracing remains disabled by default; retry timing, adapter contracts, and final error behavior are unchanged.
|
|
127
|
+
|
|
128
|
+
## [0.18.0] - 2026-09-01
|
|
129
|
+
|
|
130
|
+
### Added
|
|
131
|
+
|
|
132
|
+
- Added opt-in `replay.persistenceRetry` with bounded attempts and exponential backoff for transient persistence failures.
|
|
133
|
+
- Replay append, hydrate, clear, topic cleanup, and retention cleanup now share the same retry policy.
|
|
134
|
+
- Exported `DataBusPersistenceRetryOptions` for typed configuration.
|
|
135
|
+
|
|
136
|
+
### Compatibility
|
|
137
|
+
|
|
138
|
+
- The default retry policy is one attempt, preserving existing persistence behavior and error timing.
|
|
139
|
+
- Persistence adapters remain unchanged; retry orchestration stays in `CrossTabDataBus`.
|
|
140
|
+
|
|
141
|
+
## [0.17.0] - 2026-09-01
|
|
142
|
+
|
|
143
|
+
### Added
|
|
144
|
+
|
|
145
|
+
- Added optional `replay.retentionSweepMs` for periodic durable replay retention cleanup when no new publications arrive.
|
|
146
|
+
- Retention sweeps follow the DataBus lifecycle: start/resume enables the timer, while pagehide/stop disables it.
|
|
147
|
+
- Added fake-clock lifecycle coverage for timer cleanup and invalid sweep intervals.
|
|
148
|
+
|
|
149
|
+
### Compatibility
|
|
150
|
+
|
|
151
|
+
- `retentionSweepMs` is opt-in and has no effect without both `retentionMs` and a persistence adapter implementing `clearBefore()`.
|
|
152
|
+
- Existing publication-triggered cleanup, manual cleanup, and replay persistence contracts remain unchanged.
|
|
153
|
+
|
|
154
|
+
## [0.16.0] - 2026-09-01
|
|
155
|
+
|
|
156
|
+
### Added
|
|
157
|
+
|
|
158
|
+
- Replay retention cleanup is coalesced during publication bursts; the newest cutoff wins while cleanup mutations remain serialized.
|
|
159
|
+
- WebSocket binary-frame compatibility coverage now verifies truncated, invalid-magic, and incomplete-header frames are ignored safely.
|
|
160
|
+
|
|
161
|
+
### Compatibility
|
|
162
|
+
|
|
163
|
+
- Retention cleanup remains opt-in through `replay.retentionMs`; manual `clearReplayBefore()` behavior is unchanged.
|
|
164
|
+
- Existing JSON, nested publication-envelope, and legacy binary payload formats remain supported.
|
|
165
|
+
|
|
166
|
+
## [0.15.0] - 2026-09-01
|
|
167
|
+
|
|
168
|
+
### Fixed
|
|
169
|
+
|
|
170
|
+
- Replay retention now preserves legacy messages that do not carry an explicit producer timestamp; only timestamped messages older than the cutoff are removed.
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
|
|
174
|
+
- Trace event timestamps accept an injectable `trace.now` clock for deterministic lifecycle and metrics tests.
|
|
175
|
+
- Added compatibility coverage for timestamp-less replay cleanup and injected trace clocks.
|
|
176
|
+
|
|
177
|
+
### Compatibility
|
|
178
|
+
|
|
179
|
+
- Existing `DataBusTraceOptions` and replay persistence adapters remain source-compatible; wall-clock behavior remains the default.
|
|
180
|
+
|
|
181
|
+
## [0.14.0] - 2026-09-01
|
|
182
|
+
|
|
183
|
+
### Fixed
|
|
184
|
+
|
|
185
|
+
- Vue `useCrossTabSubscription` now rebinds when a reactive topic changes on the same bus instance.
|
|
186
|
+
|
|
187
|
+
### Added
|
|
188
|
+
|
|
189
|
+
- Vue topic-switch lifecycle regression coverage.
|
|
190
|
+
- Release scope documents cross-page replay mutation ordering and adapter parity guarantees.
|
|
191
|
+
|
|
192
|
+
## [0.13.0] - 2026-09-01
|
|
193
|
+
|
|
194
|
+
### Added
|
|
195
|
+
|
|
196
|
+
- IndexedDB replay mutations are serialized per adapter instance, preventing concurrent append read-modify-write races from losing history.
|
|
197
|
+
- Dedup memory is reset as part of a full stop lifecycle, so a restarted bus begins with a clean delivery window.
|
|
198
|
+
- Added persistence-failure diagnostics and lifecycle regression coverage.
|
|
199
|
+
|
|
200
|
+
## [0.12.0] - 2026-09-01
|
|
201
|
+
|
|
202
|
+
### Added
|
|
203
|
+
|
|
204
|
+
- Deduplication TTL now accepts an injectable `dedup.now` clock for deterministic tests and host runtimes without a wall-clock dependency.
|
|
205
|
+
- Persistence failures in replay append/cleanup paths emit bounded `persistence_cleanup` reliability diagnostics before reaching error handlers.
|
|
206
|
+
- Publication parsing now accepts only non-empty message IDs and finite timestamps, while preserving legacy payload compatibility.
|
|
207
|
+
- Added protocol compatibility tests for legacy, nested, fallback-topic, and malformed metadata frames.
|
|
208
|
+
|
|
209
|
+
### Compatibility
|
|
210
|
+
|
|
211
|
+
- `dedup.now` is optional and existing configurations keep wall-clock behavior.
|
|
212
|
+
- Invalid metadata is ignored instead of poisoning a publication; the topic and payload remain deliverable.
|
|
213
|
+
|
|
5
214
|
## [0.11.0] - 2026-09-01
|
|
6
215
|
|
|
7
216
|
### Added
|
package/dist/centrifuge.js
CHANGED
|
@@ -4993,11 +4993,13 @@ function parseDataBusPublication(value, fallbackTopic) {
|
|
|
4993
4993
|
if (!topic) return null;
|
|
4994
4994
|
const hasMetadataEnvelope = fallbackTopic !== void 0 && Object.prototype.hasOwnProperty.call(publication, "data") && (typeof publication.messageId === "string" || typeof publication.timestamp === "number");
|
|
4995
4995
|
const data = nested || fallbackTopic === void 0 || hasMetadataEnvelope ? publication.data : value;
|
|
4996
|
+
const messageId = typeof publication.messageId === "string" && publication.messageId.length > 0 ? publication.messageId : void 0;
|
|
4997
|
+
const timestamp = typeof publication.timestamp === "number" && Number.isFinite(publication.timestamp) ? publication.timestamp : void 0;
|
|
4996
4998
|
return {
|
|
4997
4999
|
topic,
|
|
4998
5000
|
data,
|
|
4999
|
-
...
|
|
5000
|
-
...
|
|
5001
|
+
...messageId === void 0 ? {} : { messageId },
|
|
5002
|
+
...timestamp === void 0 ? {} : { timestamp }
|
|
5001
5003
|
};
|
|
5002
5004
|
}
|
|
5003
5005
|
|