import type { Ws } from "../../packages"; import type { UnknownObject } from "../utils"; import type { IIntegrationAgent } from "../../ba-communication"; export interface ISessionProvider { open(payload: T): Promise; getById(sessionId: string): Promise; getCount(sessionId: string): Promise; update>( sessionId: string, field: keyof T, value: T[keyof T] ): Promise; removeById(sessionId: string): Promise; } export namespace NSessionProvider { export type Agents = { integrationAgent: IIntegrationAgent; }; export type Config = { serverTag: string; }; export interface ConnectionDetails { userAgent?: string; acceptLanguage?: string; websocketKey?: string; ip?: string; } export interface BaseConnection extends ConnectionDetails { auth: boolean; localization?: string; clientTag?: string; applicationName?: string; deviceId?: string; fingerprint?: string; socket: Ws.WebSocket; connectionCount: number; } export interface AnonymousConnection extends BaseConnection { auth: false; } export interface AuthConnection extends BaseConnection { auth: true; userId: string; sessionId: string; sessionInfo: T; } export type Connection = | AnonymousConnection | AuthConnection; }