cross-tab-worker-databus 0.21.3 → 0.21.4
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 +16 -0
- package/dist/centrifuge.js +4 -37
- package/dist/centrifuge.js.map +3 -3
- package/dist/centrifuge.shared.worker.js.map +1 -1
- package/dist/centrifuge.worker.js.map +1 -1
- package/dist/{chunk-CFFSSIUO.js → chunk-WFVM7HPE.js} +50 -7
- package/dist/chunk-WFVM7HPE.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +47 -39
- package/dist/cjs/centrifuge.cjs.map +3 -3
- package/dist/cjs/index.cjs +15 -5
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/error-utils.d.ts +13 -0
- package/dist/utils/error-utils.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +4 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/docs/roadmap.md +9 -1
- package/docs/zh/roadmap.md +9 -1
- package/package.json +1 -1
- package/dist/chunk-CFFSSIUO.js.map +0 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -614,10 +614,20 @@ function readAllByPrefix(storage, prefix) {
|
|
|
614
614
|
return listKeys(storage, prefix).map((key) => ({ key, value: readJson(storage, key) })).filter((entry) => entry.value !== null);
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
+
// src/utils/error-utils.ts
|
|
618
|
+
function describeFailure(error) {
|
|
619
|
+
try {
|
|
620
|
+
if (error instanceof Error) return error.message;
|
|
621
|
+
return String(error);
|
|
622
|
+
} catch {
|
|
623
|
+
return `[unstringifiable ${typeof error}]`;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
617
627
|
// src/utils/validation.ts
|
|
618
628
|
function assertPositiveSafeInteger(value, name) {
|
|
619
629
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
|
|
620
|
-
throw new TypeError(`${name} must be a positive safe integer, got ${
|
|
630
|
+
throw new TypeError(`${name} must be a positive safe integer, got ${describeFailure(value)}.`);
|
|
621
631
|
}
|
|
622
632
|
}
|
|
623
633
|
function assertPositiveFiniteNumber(value, name) {
|
|
@@ -632,7 +642,7 @@ function assertNonNegativeFiniteNumber(value, name) {
|
|
|
632
642
|
}
|
|
633
643
|
function assertPruneStrategy(value) {
|
|
634
644
|
const allowed = [PRUNE_STRATEGY.COUNT, PRUNE_STRATEGY.AGE, PRUNE_STRATEGY.BOTH];
|
|
635
|
-
if (!allowed.includes(
|
|
645
|
+
if (!allowed.includes(describeFailure(value))) {
|
|
636
646
|
throw new TypeError("pruneStrategy must be count, age, or both.");
|
|
637
647
|
}
|
|
638
648
|
}
|
|
@@ -2472,7 +2482,7 @@ var DedupManager = class {
|
|
|
2472
2482
|
};
|
|
2473
2483
|
|
|
2474
2484
|
// src/core/version.ts
|
|
2475
|
-
var SDK_VERSION = true ? "0.21.
|
|
2485
|
+
var SDK_VERSION = true ? "0.21.4" : "";
|
|
2476
2486
|
|
|
2477
2487
|
// src/core/data-bus.ts
|
|
2478
2488
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -3090,7 +3100,7 @@ var CrossTabDataBus = class {
|
|
|
3090
3100
|
* the most recent successful open, or `null` until the transport reaches
|
|
3091
3101
|
* `ready`. */
|
|
3092
3102
|
getRecoveryStats() {
|
|
3093
|
-
const errorMessage = this.lastError
|
|
3103
|
+
const errorMessage = this.lastError === null ? null : describeFailure(this.lastError);
|
|
3094
3104
|
return {
|
|
3095
3105
|
attempt: this.recoveryAttempt,
|
|
3096
3106
|
exhausted: this.recoveryExhausted,
|
|
@@ -3361,7 +3371,7 @@ var CrossTabDataBus = class {
|
|
|
3361
3371
|
}
|
|
3362
3372
|
this.lastFailure = {
|
|
3363
3373
|
source,
|
|
3364
|
-
message:
|
|
3374
|
+
message: describeFailure(error),
|
|
3365
3375
|
at
|
|
3366
3376
|
};
|
|
3367
3377
|
if (source === FAILURE_SOURCE.PERSISTENCE) {
|