cross-tab-worker-databus 0.21.21 → 0.21.23
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 +47 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-37NTHK22.js → chunk-UT4ZYUW4.js} +30 -16
- package/dist/chunk-UT4ZYUW4.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +29 -15
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +29 -15
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/environment.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-37NTHK22.js.map +0 -7
package/dist/cjs/centrifuge.cjs
CHANGED
|
@@ -1864,10 +1864,11 @@ var DataBusTraceReporter = class {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
/** Synchronous snapshot of the current metrics window without resetting it.
|
|
1866
1866
|
* Returns the same derived counters as a periodic `message_metrics` event,
|
|
1867
|
-
* or null when metrics recording is inactive
|
|
1868
|
-
* The window keeps accumulating until the next
|
|
1867
|
+
* or null when metrics recording is inactive, which covers each of disabled,
|
|
1868
|
+
* stopped and events-only mode. The window keeps accumulating until the next
|
|
1869
|
+
* interval flush. */
|
|
1869
1870
|
getMetrics() {
|
|
1870
|
-
if (!this.metricsActive
|
|
1871
|
+
if (!this.metricsActive) return null;
|
|
1871
1872
|
const timestamp = this.now();
|
|
1872
1873
|
const samples = this.latencySamples;
|
|
1873
1874
|
return {
|
|
@@ -1943,15 +1944,28 @@ var DataBusTraceReporter = class {
|
|
|
1943
1944
|
}
|
|
1944
1945
|
/** True when metrics recording is active: enabled, not stopped, and the mode
|
|
1945
1946
|
* includes metrics. Extracted so the seven readers — `getMetrics`, the five
|
|
1946
|
-
* `record*` methods and `flush` — share one guard instead of repeating it
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1947
|
+
* `record*` methods and `flush` — share one guard instead of repeating it, which
|
|
1948
|
+
* leaves `stopped` read in exactly two places: this term, and `event()`, which
|
|
1949
|
+
* skips metrics entirely and so gates on the field itself.
|
|
1950
|
+
*
|
|
1951
|
+
* Do not add a `|| this.stopped` back at a call site. `getMetrics` and `flush`
|
|
1952
|
+
* each carried one, and the repetition is what made this term look untestable:
|
|
1953
|
+
* deleting the term left all 37 test files green, because a read of a field the
|
|
1954
|
+
* guard consulted one expression earlier can never be the decider. With both
|
|
1955
|
+
* repeats gone the same deletion dies twice in `tests/trace.test.ts` — to
|
|
1956
|
+
* "starts a fresh metrics window after pause and resume, and stop prevents later
|
|
1957
|
+
* flushes", and to "getMetrics returns null while metrics recording is inactive",
|
|
1958
|
+
* whose name promises all three inactive cases and which tested two of them until
|
|
1959
|
+
* this file stopped absorbing the third. What the term holds: `stop()` resets the
|
|
1960
|
+
* counters through `pause()` before any later call can reach them, so without it a
|
|
1961
|
+
* `record*` during a stopped window accumulates unreset and `start()` — which
|
|
1962
|
+
* clears `stopped` without resetting — hands it to the new session's window. */
|
|
1949
1963
|
get metricsActive() {
|
|
1950
1964
|
return this.enabled && !this.stopped && this.mode !== TRACE_MODE.EVENTS;
|
|
1951
1965
|
}
|
|
1952
1966
|
/** Emit the accumulated metrics snapshot if the interval is active. */
|
|
1953
1967
|
flush() {
|
|
1954
|
-
if (!this.metricsActive
|
|
1968
|
+
if (!this.metricsActive) return;
|
|
1955
1969
|
this.flushNow();
|
|
1956
1970
|
}
|
|
1957
1971
|
flushNow() {
|
|
@@ -2592,14 +2606,14 @@ var DedupManager = class {
|
|
|
2592
2606
|
var SDK_VERSION = (
|
|
2593
2607
|
// The `''` arm has zero counts in every coverage run and cannot be lit from a
|
|
2594
2608
|
// test: `vitest.config.ts` defines the global for the whole suite, and so does
|
|
2595
|
-
// each bundle `scripts/build.mjs` emits, so reaching this side needs a
|
|
2596
|
-
//
|
|
2597
|
-
//
|
|
2598
|
-
//
|
|
2599
|
-
// `string`
|
|
2600
|
-
//
|
|
2601
|
-
// exercised.
|
|
2602
|
-
true ? "0.21.
|
|
2609
|
+
// each bundle `scripts/build.mjs` emits, so reaching this side needs a tool that
|
|
2610
|
+
// consumes `src/` without passing the define — and this repository has none. The
|
|
2611
|
+
// two source-level readers are named in the header above, and only one of them
|
|
2612
|
+
// evaluates this expression. It cannot be deleted either, since the
|
|
2613
|
+
// declaration's type is `string | undefined` and the export's is `string`
|
|
2614
|
+
// (dropping the conditional is TS2322, measured). Recorded here so the leg reads
|
|
2615
|
+
// as a shape the harness cannot reach rather than as a case nobody exercised.
|
|
2616
|
+
true ? "0.21.23" : ""
|
|
2603
2617
|
);
|
|
2604
2618
|
|
|
2605
2619
|
// src/core/data-bus.ts
|