orchestrator-client 5.7.10 → 5.7.12
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/dist/index.cjs +28 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1780,6 +1780,11 @@ var RealtimeClient = class {
|
|
|
1780
1780
|
this._socket = null;
|
|
1781
1781
|
this._handlers = /* @__PURE__ */ new Map();
|
|
1782
1782
|
this._connected = false;
|
|
1783
|
+
// Every room joined through any API (subscribeTask, joinRooms, subscribe(),
|
|
1784
|
+
// subscribeEvents, etc.) is tracked here so it can be replayed on reconnect.
|
|
1785
|
+
// Server-side room membership is tied to the socket connection and is lost
|
|
1786
|
+
// on disconnect — the full set must be re-emitted on every reconnect.
|
|
1787
|
+
this._rooms = /* @__PURE__ */ new Set();
|
|
1783
1788
|
// Multi-subscriber room-diffing state (mirrors WebSocketProvider)
|
|
1784
1789
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1785
1790
|
this._currentRooms = /* @__PURE__ */ new Set();
|
|
@@ -1816,6 +1821,10 @@ var RealtimeClient = class {
|
|
|
1816
1821
|
this._socket.on("connect", () => {
|
|
1817
1822
|
this._connected = true;
|
|
1818
1823
|
this._currentRooms = /* @__PURE__ */ new Set();
|
|
1824
|
+
if (this._rooms.size > 0) {
|
|
1825
|
+
this._socket?.emit("join", { rooms: [...this._rooms] });
|
|
1826
|
+
this._currentRooms = new Set(this._rooms);
|
|
1827
|
+
}
|
|
1819
1828
|
this._syncRooms();
|
|
1820
1829
|
});
|
|
1821
1830
|
this._socket.on("disconnect", () => {
|
|
@@ -1873,7 +1882,9 @@ var RealtimeClient = class {
|
|
|
1873
1882
|
*/
|
|
1874
1883
|
subscribeTask(taskId) {
|
|
1875
1884
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1876
|
-
|
|
1885
|
+
const room = `task:${taskId}`;
|
|
1886
|
+
this._socket.emit("join", { rooms: [room] });
|
|
1887
|
+
this._rooms.add(room);
|
|
1877
1888
|
}
|
|
1878
1889
|
/**
|
|
1879
1890
|
* Unsubscribe from realtime events for a specific task.
|
|
@@ -1881,7 +1892,9 @@ var RealtimeClient = class {
|
|
|
1881
1892
|
*/
|
|
1882
1893
|
unsubscribeTask(taskId) {
|
|
1883
1894
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1884
|
-
|
|
1895
|
+
const room = `task:${taskId}`;
|
|
1896
|
+
this._socket.emit("leave", { rooms: [room] });
|
|
1897
|
+
this._rooms.delete(room);
|
|
1885
1898
|
}
|
|
1886
1899
|
/**
|
|
1887
1900
|
* Subscribe to event-type-scoped rooms.
|
|
@@ -1891,6 +1904,7 @@ var RealtimeClient = class {
|
|
|
1891
1904
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1892
1905
|
const rooms = eventTypes.map((t) => `event:${t}`);
|
|
1893
1906
|
this._socket.emit("join", { rooms });
|
|
1907
|
+
for (const r of rooms) this._rooms.add(r);
|
|
1894
1908
|
}
|
|
1895
1909
|
/**
|
|
1896
1910
|
* Unsubscribe from event-type-scoped rooms.
|
|
@@ -1899,6 +1913,7 @@ var RealtimeClient = class {
|
|
|
1899
1913
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1900
1914
|
const rooms = eventTypes.map((t) => `event:${t}`);
|
|
1901
1915
|
this._socket.emit("leave", { rooms });
|
|
1916
|
+
for (const r of rooms) this._rooms.delete(r);
|
|
1902
1917
|
}
|
|
1903
1918
|
/**
|
|
1904
1919
|
* Subscribe to the `all` broadcast room (receives all events).
|
|
@@ -1906,20 +1921,25 @@ var RealtimeClient = class {
|
|
|
1906
1921
|
subscribeAll() {
|
|
1907
1922
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1908
1923
|
this._socket.emit("join", { rooms: ["all"] });
|
|
1924
|
+
this._rooms.add("all");
|
|
1909
1925
|
}
|
|
1910
1926
|
/**
|
|
1911
1927
|
* Subscribe to a locale-specific room.
|
|
1912
1928
|
*/
|
|
1913
1929
|
subscribeLocale(locale) {
|
|
1914
1930
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1915
|
-
|
|
1931
|
+
const room = `locale:${locale}`;
|
|
1932
|
+
this._socket.emit("join", { rooms: [room] });
|
|
1933
|
+
this._rooms.add(room);
|
|
1916
1934
|
}
|
|
1917
1935
|
/**
|
|
1918
1936
|
* Unsubscribe from a locale-specific room.
|
|
1919
1937
|
*/
|
|
1920
1938
|
unsubscribeLocale(locale) {
|
|
1921
1939
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1922
|
-
|
|
1940
|
+
const room = `locale:${locale}`;
|
|
1941
|
+
this._socket.emit("leave", { rooms: [room] });
|
|
1942
|
+
this._rooms.delete(room);
|
|
1923
1943
|
}
|
|
1924
1944
|
/**
|
|
1925
1945
|
* Join arbitrary rooms by name.
|
|
@@ -1927,6 +1947,7 @@ var RealtimeClient = class {
|
|
|
1927
1947
|
joinRooms(rooms) {
|
|
1928
1948
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1929
1949
|
this._socket.emit("join", { rooms });
|
|
1950
|
+
for (const r of rooms) this._rooms.add(r);
|
|
1930
1951
|
}
|
|
1931
1952
|
/**
|
|
1932
1953
|
* Leave arbitrary rooms by name.
|
|
@@ -1934,6 +1955,7 @@ var RealtimeClient = class {
|
|
|
1934
1955
|
leaveRooms(rooms) {
|
|
1935
1956
|
if (!this._socket) throw new Error("RealtimeClient not connected");
|
|
1936
1957
|
this._socket.emit("leave", { rooms });
|
|
1958
|
+
for (const r of rooms) this._rooms.delete(r);
|
|
1937
1959
|
}
|
|
1938
1960
|
// ------------------------------------------------------------------
|
|
1939
1961
|
// Multi-subscriber API (mirrors WebSocketProvider room-diffing)
|
|
@@ -1991,6 +2013,8 @@ var RealtimeClient = class {
|
|
|
1991
2013
|
const toLeave = [...this._currentRooms].filter((r) => !needed.has(r));
|
|
1992
2014
|
if (toJoin.length) socket.emit("join", { rooms: toJoin });
|
|
1993
2015
|
if (toLeave.length) socket.emit("leave", { rooms: toLeave });
|
|
2016
|
+
for (const r of toJoin) this._rooms.add(r);
|
|
2017
|
+
for (const r of toLeave) this._rooms.delete(r);
|
|
1994
2018
|
this._currentRooms = needed;
|
|
1995
2019
|
}
|
|
1996
2020
|
/**
|