cross-tab-worker-databus 0.21.12 → 0.21.14

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +2 -2
  3. package/README.zh.md +2 -2
  4. package/dist/centrifuge-protocol.d.ts.map +1 -1
  5. package/dist/centrifuge-session.d.ts +10 -3
  6. package/dist/centrifuge-session.d.ts.map +1 -1
  7. package/dist/centrifuge.d.ts +10 -4
  8. package/dist/centrifuge.d.ts.map +1 -1
  9. package/dist/centrifuge.js +25 -11
  10. package/dist/centrifuge.js.map +2 -2
  11. package/dist/centrifuge.shared.worker.js +28 -11
  12. package/dist/centrifuge.shared.worker.js.map +2 -2
  13. package/dist/centrifuge.worker.js +10 -3
  14. package/dist/centrifuge.worker.js.map +2 -2
  15. package/dist/{chunk-TSTV3SDC.js → chunk-3XBN7FFJ.js} +67 -33
  16. package/dist/chunk-3XBN7FFJ.js.map +7 -0
  17. package/dist/{chunk-2TTJ7LGZ.js → chunk-NPFTD7YE.js} +1 -1
  18. package/dist/chunk-NPFTD7YE.js.map +7 -0
  19. package/dist/cjs/centrifuge.cjs +88 -40
  20. package/dist/cjs/centrifuge.cjs.map +2 -2
  21. package/dist/cjs/hooks.cjs.map +2 -2
  22. package/dist/cjs/index.cjs +80 -36
  23. package/dist/cjs/index.cjs.map +2 -2
  24. package/dist/cjs/vue.cjs.map +2 -2
  25. package/dist/core/cluster.d.ts +33 -16
  26. package/dist/core/cluster.d.ts.map +1 -1
  27. package/dist/core/data-bus.d.ts +19 -5
  28. package/dist/core/data-bus.d.ts.map +1 -1
  29. package/dist/core/dedup-manager.d.ts +6 -3
  30. package/dist/core/dedup-manager.d.ts.map +1 -1
  31. package/dist/core/environment.d.ts +14 -5
  32. package/dist/core/environment.d.ts.map +1 -1
  33. package/dist/core/hash.d.ts +10 -4
  34. package/dist/core/hash.d.ts.map +1 -1
  35. package/dist/core/replay-manager.d.ts +2 -1
  36. package/dist/core/replay-manager.d.ts.map +1 -1
  37. package/dist/core/routing.d.ts +18 -9
  38. package/dist/core/routing.d.ts.map +1 -1
  39. package/dist/core/storage-batch.d.ts +2 -2
  40. package/dist/core/storage-batch.d.ts.map +1 -1
  41. package/dist/core/trace.d.ts +21 -9
  42. package/dist/core/trace.d.ts.map +1 -1
  43. package/dist/core/types.d.ts +13 -5
  44. package/dist/core/types.d.ts.map +1 -1
  45. package/dist/hooks.d.ts.map +1 -1
  46. package/dist/hooks.js +1 -1
  47. package/dist/hooks.js.map +2 -2
  48. package/dist/index.d.ts +2 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +17 -7
  51. package/dist/index.js.map +2 -2
  52. package/dist/utils/constants.d.ts +7 -4
  53. package/dist/utils/constants.d.ts.map +1 -1
  54. package/dist/utils/validation.d.ts +12 -4
  55. package/dist/utils/validation.d.ts.map +1 -1
  56. package/dist/vue.js +1 -1
  57. package/dist/websocket.d.ts +24 -6
  58. package/dist/websocket.d.ts.map +1 -1
  59. package/dist/workers/port-reaper.d.ts +18 -8
  60. package/dist/workers/port-reaper.d.ts.map +1 -1
  61. package/docs/api.md +9 -8
  62. package/docs/architecture.md +12 -9
  63. package/docs/benchmarks.md +9 -9
  64. package/docs/configuration.md +14 -9
  65. package/docs/getting-started.md +1 -1
  66. package/docs/release-checklist.md +4 -4
  67. package/docs/roadmap.md +64 -1
  68. package/docs/transports.md +11 -8
  69. package/docs/zh/api.md +10 -9
  70. package/docs/zh/architecture.md +13 -10
  71. package/docs/zh/benchmarks.md +9 -9
  72. package/docs/zh/capabilities.md +1 -1
  73. package/docs/zh/configuration.md +14 -9
  74. package/docs/zh/getting-started.md +1 -1
  75. package/docs/zh/release-checklist.md +4 -4
  76. package/docs/zh/roadmap.md +50 -1
  77. package/docs/zh/transports.md +3 -2
  78. package/package.json +2 -1
  79. package/dist/chunk-2TTJ7LGZ.js.map +0 -7
  80. package/dist/chunk-TSTV3SDC.js.map +0 -7
@@ -5251,9 +5251,16 @@ var CentrifugeSession = class {
5251
5251
  * same emptiness before calling, and the subscription-level caller reads the
5252
5252
  * topic out of a key this session only ever populates from a SUBSCRIBE frame.
5253
5253
  * Measured — deleting this line leaves all 37 test files green, and the frame
5254
- * it withholds could not be delivered anyway, because `topicMatchesPattern`
5255
- * answers false for an empty topic against both `*` and `prefix.*` (so no
5256
- * wildcard handler sees it either) and `subscribe('')` throws. Kept as the
5254
+ * it withholds has nowhere to land anyway: the only handler registry is the
5255
+ * DataBus's `topicHandlers`, and every write to it sits behind
5256
+ * `assertPublicTopic` (`data-bus.ts:929`, `:1009`, `:1033`), so no `''` key can
5257
+ * exist — while `topicMatchesPattern` answers false for an empty topic against
5258
+ * both `*` and `prefix.*`, so a wildcard handler cannot see it either. Neither
5259
+ * of those is a reason to delete this guard: it is the only one *at this layer*,
5260
+ * because neither the session nor the transport calls `assertPublicTopic` — a
5261
+ * SUBSCRIBE frame naming `''` creates a real Centrifuge subscription
5262
+ * (`newSubscription` does not validate a channel), so the undeliverable
5263
+ * publication would otherwise be posted back to the main thread. Kept as the
5257
5264
  * boundary statement, not counted as a closed leg. */
5258
5265
  postPublication(topic, data) {
5259
5266
  if (!topic) return;
@@ -5384,12 +5391,19 @@ var PortReaper = class {
5384
5391
  * `Infinity` is the documented way to disable the PING heartbeat, and it means
5385
5392
  * this port can never be judged silent: `startHeartbeat()` sends nothing at all
5386
5393
  * once configured that way, so a timeout would be a death sentence with no
5387
- * possible appeal. A non-finite-or-non-positive *other* value falls back to the
5388
- * default so a bad payload cannot degenerate the reaper into a busy loop or
5389
- * silence it — those three (NaN, 0, negative) are rejected by
5390
- * `assertHeartbeatInterval` at the transport constructor and so can only arrive
5391
- * from a main thread that is not this library. No-op for untracked ports (e.g.
5392
- * setTimeout arrives after remove/STOP). */
5394
+ * possible appeal. A non-finite-or-non-positive *other* value falls back to
5395
+ * the default, which keeps the timeout comparison from degenerating into
5396
+ * "always expired" — a NaN timeout reaps every port on the first tick. Read
5397
+ * that narrowly, because it is not a busy-loop guard: the busy-loop vector is
5398
+ * a tiny *positive* interval, which the ternary passes through untouched
5399
+ * (0.0001 → a 0.0003 ms timeout → every tick reaps everything), and the
5400
+ * reaper's own cadence is bounded elsewhere — `computeMinHeartbeat` starts
5401
+ * from DEFAULT_HEARTBEAT_INTERVAL_MS and only takes a minimum, so a payload
5402
+ * can shorten the sweep but never stretch it past 10 s. The three values
5403
+ * rejected here (NaN, 0, negative) are also rejected by
5404
+ * `assertHeartbeatInterval` at the transport constructor and so can only
5405
+ * arrive from a main thread that is not this library. No-op for untracked
5406
+ * ports (e.g. setTimeout arrives after remove/STOP). */
5393
5407
  setTimeout(port, heartbeatIntervalMs) {
5394
5408
  if (!this.targets.has(port)) return;
5395
5409
  const safe = heartbeatIntervalMs === Infinity ? Infinity : Number.isFinite(heartbeatIntervalMs) && heartbeatIntervalMs > 0 ? heartbeatIntervalMs : DEFAULT_HEARTBEAT_INTERVAL_MS;
@@ -5439,8 +5453,11 @@ var PortReaper = class {
5439
5453
  this.handle = this.setTimer(() => this.reap(), minHeartbeat);
5440
5454
  }
5441
5455
  /** Smallest heartbeat interval among active ports, derived from each port's
5442
- * configured session timeout. Exposed as a method so the cadence logic can
5443
- * be unit-tested in isolation from the timer plumbing. */
5456
+ * configured session timeout. Extracted because `schedule()` derives its delay
5457
+ * from it on every re-arm. Not a test seam: nothing in `tests/` calls it
5458
+ * (grep: zero hits), and the cadence is asserted through the injected
5459
+ * `setTimer` — i.e. through the same plumbing this note used to claim it was
5460
+ * isolated from. */
5444
5461
  computeMinHeartbeat() {
5445
5462
  let minHeartbeat = DEFAULT_HEARTBEAT_INTERVAL_MS;
5446
5463
  for (const timeout of this.sessionTimeoutMs.values()) {