import type * as renraku from "renraku"; import { Id } from "dbmage"; import * as dbmage from "dbmage"; import type { Await } from "../../../../types/await.js"; import type { AccessPayload } from "../../../auth/types/auth-tokens.js"; import type { makeChatServerside } from "../../api/services/chat-serverside.js"; import type { makeChatClientside } from "../../api/services/chat-clientside.js"; import type { mockChatPersistence } from "../../api/cores/persistence/mock-chat-persistence.js"; export interface ChatMeta { accessToken: string; } export interface ChatAuth { access: AccessPayload; } export type ChatPolicy = (meta: ChatMeta, headers: renraku.HttpHeaders) => Promise; export type ChatDraft = { content: string; }; export type ChatPost = { room: string; nickname: string; postId: string; userId: string; time: number; } & ChatDraft; export type ChatPostRow = { room: string; postId: Id; userId: Id; time: number; nickname: string; } & ChatDraft; export type ChatMute = { userId: string; }; export type ChatMuteRow = { userId: Id; }; export type ChatRoomStatusRow = { room: string; status: ChatStatus; }; export type ChatSchema = dbmage.AsSchema<{ posts: ChatPostRow; mutes: ChatMuteRow; roomStatuses: ChatRoomStatusRow; roomUsers: { room: string; user?: Id; participant: boolean; }; }>; export type ChatShape = dbmage.SchemaToShape; export declare const chatShape: ChatShape; export type ChatPersistence = Await>; export type ChatPersistenceActions = ReturnType; export type ChatServersideApi = ReturnType; export type ChatClientsideApi = ReturnType; export type ChatServerside = renraku.Remote; export type ChatClientside = renraku.Remote; export interface ClientRecord { rooms: Set; auth: undefined | ChatAuth; clientside: ChatClientside; controls: renraku.ConnectionControls; } export interface ChatConnection { serverside: ChatServerside; disconnect(): void; } export type ChatConnect = ({ clientsideApi }: { clientsideApi: ChatClientsideApi; handleDisconnect(): void; }) => Promise; export declare enum ChatStatus { Offline = 0, Online = 1 } export interface ChatRoomStats { totalUsers: number; viewers: number; participants: number; moderators: number; } export interface StatsForChatRoom { [roomName: string]: ChatRoomStats; } export interface ChatStats { numberOfConnections: number; statsForRooms: StatsForChatRoom; }