MessagingHubModule · library/messaging/src/repos/messaging-conversations.ts:33

MessagingConversationsRepo

component

No JSDoc comment in source yet.

API

@Component()
export class MessagingConversationsRepo implements MessagingConversations {
  @Use() private readonly db!: Db;
  get(channel: string, accountId: string, chatId: string): Record<string, unknown> | null;
  list(channel: string, accountId: string): { chatId: string; state: Record<string, unknown> }[];
  put(channel: string, accountId: string, chatId: string, state: Record<string, unknown>): void;
}

Dependencies & Wiring

Extracted from class decorators
implementsinterfaces
@Userequires (1)
db: Db

Methods (3)

get

get(channel: string, accountId: string, chatId: string): Record<string, unknown> | null

One chat's stored state, or null when none is stored (or it does not parse).

@paramchannelstring
@paramaccountIdstring
@paramchatIdstring
@returnsRecord<string, unknown> | null

list

list(channel: string, accountId: string): { chatId: string; state: Record<string, unknown> }[]

Every stored chat of one bot, skipping documents that do not parse.

@paramchannelstring
@paramaccountIdstring
@returns{ chatId: string; state: Record<string, unknown> }[]

put

put(channel: string, accountId: string, chatId: string, state: Record<string, unknown>): void

Creates or replaces one chat's state — and does nothing for a bot no binding references. The lifetime rule is enforced at the write as well as at the delete: a send still in flight when the last binding went would otherwise write its bookkeeping back after the delete, and the bot's next binding would inherit it.

@paramchannelstring
@paramaccountIdstring
@paramchatIdstring
@paramstateRecord<string, unknown>
@returnsvoid