cross-tab-worker-databus 0.21.3 → 0.21.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 +53 -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-RWUDSL24.js} +51 -8
- package/dist/chunk-RWUDSL24.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +48 -40
- package/dist/cjs/centrifuge.cjs.map +3 -3
- package/dist/cjs/index.cjs +16 -6
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/core/cluster.d.ts.map +1 -1
- 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 +18 -1
- package/docs/zh/roadmap.md +18 -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
|
}
|
|
@@ -1256,6 +1266,7 @@ var WorkerClusterRuntime = class {
|
|
|
1256
1266
|
/** Handle a point-to-point CONTROL message (SUBSCRIBE / UNSUBSCRIBE / PUBLISH). */
|
|
1257
1267
|
handleControlMessage(message) {
|
|
1258
1268
|
if (message.targetWorkerId !== this.workerId) return;
|
|
1269
|
+
if (message.topicKey !== void 0 && createOpaqueKey(message.topic) !== message.topicKey) return;
|
|
1259
1270
|
this.rememberTopic(message.topic);
|
|
1260
1271
|
switch (message.action) {
|
|
1261
1272
|
case CONTROL_ACTION.SUBSCRIBE: {
|
|
@@ -2472,7 +2483,7 @@ var DedupManager = class {
|
|
|
2472
2483
|
};
|
|
2473
2484
|
|
|
2474
2485
|
// src/core/version.ts
|
|
2475
|
-
var SDK_VERSION = true ? "0.21.
|
|
2486
|
+
var SDK_VERSION = true ? "0.21.5" : "";
|
|
2476
2487
|
|
|
2477
2488
|
// src/core/data-bus.ts
|
|
2478
2489
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -3090,7 +3101,7 @@ var CrossTabDataBus = class {
|
|
|
3090
3101
|
* the most recent successful open, or `null` until the transport reaches
|
|
3091
3102
|
* `ready`. */
|
|
3092
3103
|
getRecoveryStats() {
|
|
3093
|
-
const errorMessage = this.lastError
|
|
3104
|
+
const errorMessage = this.lastError === null ? null : describeFailure(this.lastError);
|
|
3094
3105
|
return {
|
|
3095
3106
|
attempt: this.recoveryAttempt,
|
|
3096
3107
|
exhausted: this.recoveryExhausted,
|
|
@@ -3361,7 +3372,7 @@ var CrossTabDataBus = class {
|
|
|
3361
3372
|
}
|
|
3362
3373
|
this.lastFailure = {
|
|
3363
3374
|
source,
|
|
3364
|
-
message:
|
|
3375
|
+
message: describeFailure(error),
|
|
3365
3376
|
at
|
|
3366
3377
|
};
|
|
3367
3378
|
if (source === FAILURE_SOURCE.PERSISTENCE) {
|
|
@@ -3532,7 +3543,6 @@ var CrossTabDataBus = class {
|
|
|
3532
3543
|
}
|
|
3533
3544
|
}
|
|
3534
3545
|
);
|
|
3535
|
-
void opening.catch(() => void 0);
|
|
3536
3546
|
return opening;
|
|
3537
3547
|
}
|
|
3538
3548
|
/**
|