Member Junction
    Preparing search index...

    Function LoadOwnedRealtimeSession

    • Loads a session under the caller's identity and enforces ownership: UserID === contextUser.ID, then the scope rule of AuthorizeSessionAccess (every anonymous visitor shares one Anonymous user, so the session's conversation ExternalID must equal the caller's scope identity). It deliberately does NOT reject Closed sessions: the final channel-state flush and the recording terminal signal legitimately arrive after the session closed. Loading as the caller also applies the entity's row-level security.

      Parameters

      Returns Promise<MJAIAgentSessionEntity>

      RealtimeSessionNotFoundError when the row does not load

      RealtimeSessionOwnershipError when another user owns the session (logged with both user ids) or the scope rule refuses the caller (logged with the refusal reason)