cross-tab-worker-databus 0.20.68 → 0.20.70
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 +11 -0
- package/dist/centrifuge.d.ts +2 -0
- package/dist/centrifuge.d.ts.map +1 -1
- package/dist/centrifuge.js +5 -1
- package/dist/centrifuge.js.map +2 -2
- package/dist/{chunk-X6JTPZYW.js → chunk-IKBJIREH.js} +13 -4
- package/dist/chunk-IKBJIREH.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +16 -3
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +14 -3
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/cluster.d.ts +2 -0
- package/dist/core/cluster.d.ts.map +1 -1
- package/dist/core/data-bus.d.ts +6 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +2 -2
- package/dist/websocket.d.ts +2 -0
- package/dist/websocket.d.ts.map +1 -1
- package/docs/roadmap.md +9 -1
- package/docs/zh/roadmap.md +9 -1
- package/package.json +1 -1
- package/dist/chunk-X6JTPZYW.js.map +0 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -425,6 +425,7 @@ var WorkerClusterRuntime = class {
|
|
|
425
425
|
this.workerId = options.workerId ?? `worker-${this.tabId}-${this.environment.randomId()}`;
|
|
426
426
|
const now = this.environment.now();
|
|
427
427
|
this.currentRecord = {
|
|
428
|
+
protocolVersion: CLUSTER_PROTOCOL_VERSION,
|
|
428
429
|
workerId: this.workerId,
|
|
429
430
|
tabId: this.tabId,
|
|
430
431
|
load: 0,
|
|
@@ -746,16 +747,18 @@ var WorkerClusterRuntime = class {
|
|
|
746
747
|
}
|
|
747
748
|
/** Read-only snapshot of the cluster state (workers, routes, assignments). */
|
|
748
749
|
getSnapshot() {
|
|
750
|
+
const workers = this.storage ? this.readWorkers() : [{ ...this.currentRecord }];
|
|
749
751
|
const routes = this.storage ? readAllByPrefix(this.storage, this.routePrefix).map(({ value }) => ({
|
|
750
752
|
...value,
|
|
751
753
|
topic: this.knownTopics.get(value.topicKey) ?? null
|
|
752
754
|
})) : [];
|
|
753
755
|
return {
|
|
754
756
|
protocolVersion: CLUSTER_PROTOCOL_VERSION,
|
|
757
|
+
peerProtocolVersions: Object.fromEntries(workers.map((worker) => [worker.workerId, worker.protocolVersion ?? null])),
|
|
755
758
|
coordinated: Boolean(this.storage && this.channel),
|
|
756
759
|
suspended: this.suspended,
|
|
757
760
|
currentWorker: { ...this.currentRecord },
|
|
758
|
-
workers:
|
|
761
|
+
workers: workers.map((worker) => ({ ...worker })),
|
|
759
762
|
routes,
|
|
760
763
|
subscribedTopics: Array.from(this.subscribedTopics),
|
|
761
764
|
assignedTopics: Array.from(this.assignedTopics.values()),
|
|
@@ -1410,6 +1413,7 @@ function roundMs(value) {
|
|
|
1410
1413
|
|
|
1411
1414
|
// src/core/data-bus.ts
|
|
1412
1415
|
var PUBLICATION_EVENT = "DATABUS_PUBLICATION";
|
|
1416
|
+
var SDK_VERSION = "0.20.69";
|
|
1413
1417
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|
|
1414
1418
|
var PersistenceRetryCancelledError = class extends Error {
|
|
1415
1419
|
constructor() {
|
|
@@ -1913,15 +1917,20 @@ var CrossTabDataBus = class {
|
|
|
1913
1917
|
getDiagnostics() {
|
|
1914
1918
|
let messages = 0;
|
|
1915
1919
|
if (this.replayBuffers) for (const buffer of this.replayBuffers.values()) messages += buffer.length;
|
|
1920
|
+
const cluster = this.cluster.getSnapshot();
|
|
1921
|
+
const unknownMessages = this.cluster.getUnknownMessageStats();
|
|
1922
|
+
const transport = this.transport;
|
|
1916
1923
|
return {
|
|
1917
1924
|
status: this.status,
|
|
1925
|
+
sdkVersion: SDK_VERSION,
|
|
1918
1926
|
started: this.started,
|
|
1919
1927
|
transportReady: this.transportReady,
|
|
1920
1928
|
recovery: this.getRecoveryStats(),
|
|
1921
1929
|
dedup: this.getDedupStats(),
|
|
1922
1930
|
replay: { enabled: Boolean(this.replayBuffers), topics: this.replayBuffers?.size ?? 0, messages },
|
|
1923
|
-
protocol: { version:
|
|
1924
|
-
|
|
1931
|
+
protocol: { version: cluster.protocolVersion, unknownMessages: unknownMessages.count, lastUnknownMessageType: unknownMessages.lastType, peers: cluster.peerProtocolVersions },
|
|
1932
|
+
transport: { name: transport.diagnosticsName ?? transport.constructor.name, backend: transport.diagnosticsBackend ?? null },
|
|
1933
|
+
cluster
|
|
1925
1934
|
};
|
|
1926
1935
|
}
|
|
1927
1936
|
/**
|
|
@@ -2582,6 +2591,8 @@ var WebSocketTransport = class {
|
|
|
2582
2591
|
constructor(connection) {
|
|
2583
2592
|
this.connection = connection;
|
|
2584
2593
|
}
|
|
2594
|
+
diagnosticsName = "websocket";
|
|
2595
|
+
diagnosticsBackend = "native-websocket";
|
|
2585
2596
|
socket = null;
|
|
2586
2597
|
handlers = null;
|
|
2587
2598
|
subscribedTopics = /* @__PURE__ */ new Set();
|