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.d.cts CHANGED
@@ -1012,6 +1012,7 @@ declare class RealtimeClient {
1012
1012
  private _socket;
1013
1013
  private _handlers;
1014
1014
  private _connected;
1015
+ private _rooms;
1015
1016
  private _subscriptions;
1016
1017
  private _currentRooms;
1017
1018
  private _subIdCounter;
package/dist/index.d.ts CHANGED
@@ -1012,6 +1012,7 @@ declare class RealtimeClient {
1012
1012
  private _socket;
1013
1013
  private _handlers;
1014
1014
  private _connected;
1015
+ private _rooms;
1015
1016
  private _subscriptions;
1016
1017
  private _currentRooms;
1017
1018
  private _subIdCounter;
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
- this._socket.emit("join", { rooms: [`task:${taskId}`] });
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
- this._socket.emit("leave", { rooms: [`task:${taskId}`] });
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
- this._socket.emit("join", { rooms: [`locale:${locale}`] });
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
- this._socket.emit("leave", { rooms: [`locale:${locale}`] });
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
  /**