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/centrifuge.cjs
CHANGED
|
@@ -2468,7 +2468,7 @@ var DedupManager = class {
|
|
|
2468
2468
|
};
|
|
2469
2469
|
|
|
2470
2470
|
// src/core/version.ts
|
|
2471
|
-
var SDK_VERSION = true ? "0.20.
|
|
2471
|
+
var SDK_VERSION = true ? "0.20.97" : "";
|
|
2472
2472
|
|
|
2473
2473
|
// src/core/data-bus.ts
|
|
2474
2474
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
@@ -2559,6 +2559,10 @@ var CrossTabDataBus = class {
|
|
|
2559
2559
|
// themselves demand: the failure path starts an on-demand reopen instead of
|
|
2560
2560
|
// stranding them until some unrelated future operation arrives.
|
|
2561
2561
|
recoveryWaiters = 0;
|
|
2562
|
+
// Latch for the empty-topic deprecation warning so a hot publish path cannot
|
|
2563
|
+
// fill the console. It is per-bus and never reset: the warning is about the
|
|
2564
|
+
// caller's code, not about a transient runtime condition.
|
|
2565
|
+
emptyTopicWarned = false;
|
|
2562
2566
|
/** Monotonic generation incremented on every successful transport open.
|
|
2563
2567
|
* Stays in lockstep with `lastSuccessAt` so callers can detect that the
|
|
2564
2568
|
* transport has been reopened even if the timestamp window is short. */
|
|
@@ -2963,6 +2967,7 @@ var CrossTabDataBus = class {
|
|
|
2963
2967
|
};
|
|
2964
2968
|
}
|
|
2965
2969
|
this.ensureStarted();
|
|
2970
|
+
if (topic === "") this.warnEmptyTopic("subscribe");
|
|
2966
2971
|
const handlers = this.topicHandlers.get(topic) ?? /* @__PURE__ */ new Set();
|
|
2967
2972
|
const wasUnused = handlers.size === 0;
|
|
2968
2973
|
handlers.add(handler);
|
|
@@ -3012,8 +3017,20 @@ var CrossTabDataBus = class {
|
|
|
3012
3017
|
resetDedup() {
|
|
3013
3018
|
this.dedupManager.reset();
|
|
3014
3019
|
}
|
|
3020
|
+
/** Warn (once per bus) that an empty topic is deprecated, without changing
|
|
3021
|
+
* behavior yet. `''` flows through routing as a literal channel, so the
|
|
3022
|
+
* subscription it creates can never be addressed by a transport: the message
|
|
3023
|
+
* silently goes nowhere. A future minor rejects it at this boundary. */
|
|
3024
|
+
warnEmptyTopic(operation) {
|
|
3025
|
+
if (this.emptyTopicWarned) return;
|
|
3026
|
+
this.emptyTopicWarned = true;
|
|
3027
|
+
console.warn(
|
|
3028
|
+
`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.`
|
|
3029
|
+
);
|
|
3030
|
+
}
|
|
3015
3031
|
/** Publish a message to `topic`. The owning Worker delivers it to the transport. */
|
|
3016
3032
|
publish(topic, data, options) {
|
|
3033
|
+
if (topic === "") this.warnEmptyTopic("publish");
|
|
3017
3034
|
this.ensureStarted();
|
|
3018
3035
|
if (this.rejectPublishDuringStop("publish")) return;
|
|
3019
3036
|
if (!this.cluster.publish(topic, data, options)) {
|
|
@@ -3032,6 +3049,7 @@ var CrossTabDataBus = class {
|
|
|
3032
3049
|
publishBatch(topic, items) {
|
|
3033
3050
|
this.ensureStarted();
|
|
3034
3051
|
if (items.length === 0) return;
|
|
3052
|
+
if (topic === "") this.warnEmptyTopic("publishBatch");
|
|
3035
3053
|
if (this.rejectPublishDuringStop("publishBatch")) return;
|
|
3036
3054
|
if (items.length === 1) {
|
|
3037
3055
|
const first = items[0];
|
|
@@ -4200,9 +4218,6 @@ function createCentrifugeDataBus(options) {
|
|
|
4200
4218
|
});
|
|
4201
4219
|
}
|
|
4202
4220
|
function createDefaultWorker() {
|
|
4203
|
-
if (typeof Worker === "undefined") {
|
|
4204
|
-
throw new Error("CentrifugeWorkerTransport requires a browser Worker implementation.");
|
|
4205
|
-
}
|
|
4206
4221
|
let workerUrl;
|
|
4207
4222
|
try {
|
|
4208
4223
|
workerUrl = new URL("./centrifuge.worker.js", import_meta.url);
|
|
@@ -4217,9 +4232,6 @@ function createDefaultWorker() {
|
|
|
4217
4232
|
});
|
|
4218
4233
|
}
|
|
4219
4234
|
function createDefaultSharedWorker() {
|
|
4220
|
-
if (typeof SharedWorker === "undefined") {
|
|
4221
|
-
throw new Error("CentrifugeWorkerTransport requires a browser SharedWorker implementation.");
|
|
4222
|
-
}
|
|
4223
4235
|
let workerUrl;
|
|
4224
4236
|
try {
|
|
4225
4237
|
workerUrl = new URL("./centrifuge.shared.worker.js", import_meta.url);
|