cross-tab-worker-databus 0.20.61 → 0.20.63

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.
@@ -798,9 +798,11 @@ var WorkerClusterRuntime = class {
798
798
  this.handlers.onEvent(message.eventType, message.payload, message.sourceWorkerId, message.originTabId);
799
799
  return;
800
800
  case "REGISTRY":
801
- default:
802
801
  this.reconcile();
803
802
  return;
803
+ default:
804
+ this.handlers.onUnknownMessage?.(message);
805
+ return;
804
806
  }
805
807
  };
806
808
  /** Handle a point-to-point CONTROL message (SUBSCRIBE / UNSUBSCRIBE / PUBLISH). */
@@ -1864,6 +1866,20 @@ var CrossTabDataBus = class {
1864
1866
  getClusterSnapshot() {
1865
1867
  return this.cluster.getSnapshot();
1866
1868
  }
1869
+ /** Return a single health snapshot combining lifecycle, recovery, dedup, replay, and cluster state. */
1870
+ getDiagnostics() {
1871
+ let messages = 0;
1872
+ if (this.replayBuffers) for (const buffer of this.replayBuffers.values()) messages += buffer.length;
1873
+ return {
1874
+ status: this.status,
1875
+ started: this.started,
1876
+ transportReady: this.transportReady,
1877
+ recovery: this.getRecoveryStats(),
1878
+ dedup: this.getDedupStats(),
1879
+ replay: { enabled: Boolean(this.replayBuffers), topics: this.replayBuffers?.size ?? 0, messages },
1880
+ cluster: this.cluster.getSnapshot()
1881
+ };
1882
+ }
1867
1883
  /**
1868
1884
  * Gracefully stop the DataBus: unsubscribe all topics, stop the cluster,
1869
1885
  * and close the transport. Idempotent.