cross-tab-worker-databus 0.20.95 → 0.20.97
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 +29 -0
- package/dist/centrifuge.d.ts.map +1 -1
- package/dist/centrifuge.js +1 -7
- package/dist/centrifuge.js.map +2 -2
- package/dist/{chunk-7BPB2Y4E.js → chunk-IVTDQ2KD.js} +20 -2
- package/dist/{chunk-7BPB2Y4E.js.map → chunk-IVTDQ2KD.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +19 -7
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +19 -1
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +6 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/api.md +1 -0
- package/docs/architecture.md +3 -0
- package/docs/benchmarks.md +8 -8
- package/docs/getting-started.md +4 -0
- package/docs/roadmap.md +19 -1
- package/docs/transports.md +1 -0
- package/docs/zh/api.md +1 -0
- package/docs/zh/architecture.md +3 -0
- package/docs/zh/benchmarks.md +8 -8
- package/docs/zh/getting-started.md +4 -0
- package/docs/zh/roadmap.md +19 -1
- package/docs/zh/transports.md +1 -0
- package/package.json +4 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -2466,7 +2466,7 @@ var DedupManager = class {
|
|
|
2466
2466
|
};
|
|
2467
2467
|
|
|
2468
2468
|
// src/core/version.ts
|
|
2469
|
-
var SDK_VERSION = true ? "0.20.
|
|
2469
|
+
var SDK_VERSION = true ? "0.20.97" : "";
|
|
2470
2470
|
|
|
2471
2471
|
// src/core/data-bus.ts
|
|
2472
2472
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -2557,6 +2557,10 @@ var CrossTabDataBus = class {
|
|
|
2557
2557
|
// themselves demand: the failure path starts an on-demand reopen instead of
|
|
2558
2558
|
// stranding them until some unrelated future operation arrives.
|
|
2559
2559
|
recoveryWaiters = 0;
|
|
2560
|
+
// Latch for the empty-topic deprecation warning so a hot publish path cannot
|
|
2561
|
+
// fill the console. It is per-bus and never reset: the warning is about the
|
|
2562
|
+
// caller's code, not about a transient runtime condition.
|
|
2563
|
+
emptyTopicWarned = false;
|
|
2560
2564
|
/** Monotonic generation incremented on every successful transport open.
|
|
2561
2565
|
* Stays in lockstep with `lastSuccessAt` so callers can detect that the
|
|
2562
2566
|
* transport has been reopened even if the timestamp window is short. */
|
|
@@ -2961,6 +2965,7 @@ var CrossTabDataBus = class {
|
|
|
2961
2965
|
};
|
|
2962
2966
|
}
|
|
2963
2967
|
this.ensureStarted();
|
|
2968
|
+
if (topic === "") this.warnEmptyTopic("subscribe");
|
|
2964
2969
|
const handlers = this.topicHandlers.get(topic) ?? /* @__PURE__ */ new Set();
|
|
2965
2970
|
const wasUnused = handlers.size === 0;
|
|
2966
2971
|
handlers.add(handler);
|
|
@@ -3010,8 +3015,20 @@ var CrossTabDataBus = class {
|
|
|
3010
3015
|
resetDedup() {
|
|
3011
3016
|
this.dedupManager.reset();
|
|
3012
3017
|
}
|
|
3018
|
+
/** Warn (once per bus) that an empty topic is deprecated, without changing
|
|
3019
|
+
* behavior yet. `''` flows through routing as a literal channel, so the
|
|
3020
|
+
* subscription it creates can never be addressed by a transport: the message
|
|
3021
|
+
* silently goes nowhere. A future minor rejects it at this boundary. */
|
|
3022
|
+
warnEmptyTopic(operation) {
|
|
3023
|
+
if (this.emptyTopicWarned) return;
|
|
3024
|
+
this.emptyTopicWarned = true;
|
|
3025
|
+
console.warn(
|
|
3026
|
+
`cross-tab-worker-databus: ${operation}("") addresses a channel no transport can route. Use a non-empty topic; passing "" is planned to throw in a future minor.`
|
|
3027
|
+
);
|
|
3028
|
+
}
|
|
3013
3029
|
/** Publish a message to `topic`. The owning Worker delivers it to the transport. */
|
|
3014
3030
|
publish(topic, data, options) {
|
|
3031
|
+
if (topic === "") this.warnEmptyTopic("publish");
|
|
3015
3032
|
this.ensureStarted();
|
|
3016
3033
|
if (this.rejectPublishDuringStop("publish")) return;
|
|
3017
3034
|
if (!this.cluster.publish(topic, data, options)) {
|
|
@@ -3030,6 +3047,7 @@ var CrossTabDataBus = class {
|
|
|
3030
3047
|
publishBatch(topic, items) {
|
|
3031
3048
|
this.ensureStarted();
|
|
3032
3049
|
if (items.length === 0) return;
|
|
3050
|
+
if (topic === "") this.warnEmptyTopic("publishBatch");
|
|
3033
3051
|
if (this.rejectPublishDuringStop("publishBatch")) return;
|
|
3034
3052
|
if (items.length === 1) {
|
|
3035
3053
|
const first = items[0];
|