cross-tab-worker-databus 0.21.20 → 0.21.22
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 +41 -0
- package/dist/centrifuge-session.d.ts +2 -1
- package/dist/centrifuge-session.d.ts.map +1 -1
- package/dist/centrifuge.js +3 -2
- package/dist/centrifuge.js.map +2 -2
- package/dist/centrifuge.shared.worker.js +2 -1
- package/dist/centrifuge.shared.worker.js.map +2 -2
- package/dist/centrifuge.worker.js +2 -1
- package/dist/centrifuge.worker.js.map +2 -2
- package/dist/{chunk-VQZXIMXR.js → chunk-ISYP7LVP.js} +34 -18
- package/dist/chunk-ISYP7LVP.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +35 -18
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +33 -17
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/cluster.d.ts.map +1 -1
- package/dist/core/data-bus.d.ts +4 -2
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/environment.d.ts.map +1 -1
- package/dist/core/replay-manager.d.ts.map +1 -1
- package/dist/core/replay-persistence.d.ts.map +1 -1
- package/dist/core/trace.d.ts +19 -5
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/core/version.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/utils/validation.d.ts +6 -2
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/websocket.d.ts.map +1 -1
- package/docs/benchmarks.md +8 -8
- package/docs/roadmap.md +17 -1
- package/docs/zh/benchmarks.md +8 -8
- package/docs/zh/roadmap.md +17 -1
- package/package.json +1 -1
- package/dist/chunk-VQZXIMXR.js.map +0 -7
|
@@ -1735,10 +1735,11 @@ var DataBusTraceReporter = class {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
/** Synchronous snapshot of the current metrics window without resetting it.
|
|
1737
1737
|
* Returns the same derived counters as a periodic `message_metrics` event,
|
|
1738
|
-
* or null when metrics recording is inactive
|
|
1739
|
-
* The window keeps accumulating until the next
|
|
1738
|
+
* or null when metrics recording is inactive, which covers each of disabled,
|
|
1739
|
+
* stopped and events-only mode. The window keeps accumulating until the next
|
|
1740
|
+
* interval flush. */
|
|
1740
1741
|
getMetrics() {
|
|
1741
|
-
if (!this.metricsActive
|
|
1742
|
+
if (!this.metricsActive) return null;
|
|
1742
1743
|
const timestamp = this.now();
|
|
1743
1744
|
const samples = this.latencySamples;
|
|
1744
1745
|
return {
|
|
@@ -1814,15 +1815,28 @@ var DataBusTraceReporter = class {
|
|
|
1814
1815
|
}
|
|
1815
1816
|
/** True when metrics recording is active: enabled, not stopped, and the mode
|
|
1816
1817
|
* includes metrics. Extracted so the seven readers — `getMetrics`, the five
|
|
1817
|
-
* `record*` methods and `flush` — share one guard instead of repeating it
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1818
|
+
* `record*` methods and `flush` — share one guard instead of repeating it, which
|
|
1819
|
+
* leaves `stopped` read in exactly two places: this term, and `event()`, which
|
|
1820
|
+
* skips metrics entirely and so gates on the field itself.
|
|
1821
|
+
*
|
|
1822
|
+
* Do not add a `|| this.stopped` back at a call site. `getMetrics` and `flush`
|
|
1823
|
+
* each carried one, and the repetition is what made this term look untestable:
|
|
1824
|
+
* deleting the term left all 37 test files green, because a read of a field the
|
|
1825
|
+
* guard consulted one expression earlier can never be the decider. With both
|
|
1826
|
+
* repeats gone the same deletion dies twice in `tests/trace.test.ts` — to
|
|
1827
|
+
* "starts a fresh metrics window after pause and resume, and stop prevents later
|
|
1828
|
+
* flushes", and to "getMetrics returns null while metrics recording is inactive",
|
|
1829
|
+
* whose name promises all three inactive cases and which tested two of them until
|
|
1830
|
+
* this file stopped absorbing the third. What the term holds: `stop()` resets the
|
|
1831
|
+
* counters through `pause()` before any later call can reach them, so without it a
|
|
1832
|
+
* `record*` during a stopped window accumulates unreset and `start()` — which
|
|
1833
|
+
* clears `stopped` without resetting — hands it to the new session's window. */
|
|
1820
1834
|
get metricsActive() {
|
|
1821
1835
|
return this.enabled && !this.stopped && this.mode !== TRACE_MODE.EVENTS;
|
|
1822
1836
|
}
|
|
1823
1837
|
/** Emit the accumulated metrics snapshot if the interval is active. */
|
|
1824
1838
|
flush() {
|
|
1825
|
-
if (!this.metricsActive
|
|
1839
|
+
if (!this.metricsActive) return;
|
|
1826
1840
|
this.flushNow();
|
|
1827
1841
|
}
|
|
1828
1842
|
flushNow() {
|
|
@@ -2463,14 +2477,14 @@ var DedupManager = class {
|
|
|
2463
2477
|
var SDK_VERSION = (
|
|
2464
2478
|
// The `''` arm has zero counts in every coverage run and cannot be lit from a
|
|
2465
2479
|
// test: `vitest.config.ts` defines the global for the whole suite, and so does
|
|
2466
|
-
// each bundle `scripts/build.mjs` emits, so reaching this side needs a
|
|
2467
|
-
//
|
|
2468
|
-
//
|
|
2469
|
-
//
|
|
2470
|
-
// `string`
|
|
2471
|
-
//
|
|
2472
|
-
// exercised.
|
|
2473
|
-
true ? "0.21.
|
|
2480
|
+
// each bundle `scripts/build.mjs` emits, so reaching this side needs a tool that
|
|
2481
|
+
// consumes `src/` without passing the define — and this repository has none. The
|
|
2482
|
+
// two source-level readers are named in the header above, and only one of them
|
|
2483
|
+
// evaluates this expression. It cannot be deleted either, since the
|
|
2484
|
+
// declaration's type is `string | undefined` and the export's is `string`
|
|
2485
|
+
// (dropping the conditional is TS2322, measured). Recorded here so the leg reads
|
|
2486
|
+
// as a shape the harness cannot reach rather than as a case nobody exercised.
|
|
2487
|
+
true ? "0.21.22" : ""
|
|
2474
2488
|
);
|
|
2475
2489
|
|
|
2476
2490
|
// src/core/data-bus.ts
|
|
@@ -3406,8 +3420,10 @@ var CrossTabDataBus = class {
|
|
|
3406
3420
|
* wrong mechanism and was the shipped claim until it was measured: a snapshot
|
|
3407
3421
|
* taken with the opening still unresolved already listed the route, its
|
|
3408
3422
|
* confirmation and both tabs' worker records, because
|
|
3409
|
-
* `BatchingStorageWriter` serves pending writes on read
|
|
3410
|
-
*
|
|
3423
|
+
* `BatchingStorageWriter` serves pending writes on read — `getItem` returns the
|
|
3424
|
+
* pending value before touching the store, and the private `keys()` union of
|
|
3425
|
+
* persisted keys, pending writes minus pending deletes is what `readAllByPrefix`
|
|
3426
|
+
* walks. */
|
|
3411
3427
|
emitCoordinationTrace() {
|
|
3412
3428
|
const snapshot = this.cluster.getSnapshot();
|
|
3413
3429
|
this.trace.event({
|
|
@@ -3702,4 +3718,4 @@ export {
|
|
|
3702
3718
|
parseDataBusPublication,
|
|
3703
3719
|
selectWorkerBackend
|
|
3704
3720
|
};
|
|
3705
|
-
//# sourceMappingURL=chunk-
|
|
3721
|
+
//# sourceMappingURL=chunk-ISYP7LVP.js.map
|