@threadbase-sh/streamer 1.66.0 → 1.67.0

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/cli.cjs CHANGED
@@ -151283,6 +151283,13 @@ function createApiDeps(deps) {
151283
151283
  );
151284
151284
  }
151285
151285
  }
151286
+ if (msg.type === "unsubscribe_session" && typeof msg.sessionId === "string") {
151287
+ if (!wsAllows(principal, "history:read")) {
151288
+ deny(msg.type, "history:read");
151289
+ return;
151290
+ }
151291
+ deps.removeSessionSubscriber(msg.sessionId, ws2);
151292
+ }
151286
151293
  if (msg.type === "hold_session" && typeof msg.sessionId === "string") {
151287
151294
  if (!wsAllows(principal, "session:control")) {
151288
151295
  deny(msg.type, "session:control");
@@ -154512,6 +154519,7 @@ var StreamerServer = class {
154512
154519
  withReconciledLifecycle: (sessions) => this.withReconciledLifecycle(sessions),
154513
154520
  currentWarmupState: () => this.currentWarmupState(),
154514
154521
  addSessionSubscriber: (sessionId, ws2) => this.addSessionSubscriber(sessionId, ws2),
154522
+ removeSessionSubscriber: (sessionId, ws2) => this.removeSessionSubscriber(sessionId, ws2),
154515
154523
  startGraceTimer: (sessionId, delayMs) => this.startGraceTimer(sessionId, delayMs),
154516
154524
  armHoldWhenIdle: (sessionId) => this.armHoldWhenIdle(sessionId),
154517
154525
  handleSessionsCount: (res) => this.handleSessionsCount(res),
@@ -154641,6 +154649,12 @@ var StreamerServer = class {
154641
154649
  );
154642
154650
  }
154643
154651
  }
154652
+ removeSessionSubscriber(sessionId, ws2) {
154653
+ const subs = this.sessionSubscribers.get(sessionId);
154654
+ if (!subs) return;
154655
+ subs.delete(ws2);
154656
+ if (subs.size === 0) this.sessionSubscribers.delete(sessionId);
154657
+ }
154644
154658
  /**
154645
154659
  * Bring up Live Activity push, if credentials are present (Feature 12).
154646
154660
  *