import type { Conversation, ConversationRecord, Message, Reaction, Invite, ParticipantActivity, Alias } from "../shared/shared-types.js"; export type ServerDispatch = (participantId: string, data: unknown) => void | Promise; export type RateLimitOptions = { inviteLimitPerParticipantPerHour?: number; inviteLimitPerParticipant?: number; messageLimitPerParticipantPerSecond?: number; messageMaxLength?: number; conversationParticipantLimit?: number; conversationLimitPerParticipant?: number; sweepIntervalSeconds?: number; }; export type CleanupOptions = { indicatorTtlSeconds?: number; indicatorCleanupIntervalSeconds?: number; cacheEntryTtlMinutes?: number; cacheCleanupIntervalSeconds?: number; messageAfterDays?: number | null; conversationAfterInactiveDays?: number | null; inviteAfterDays?: number | null; timeoutBetweenDailyCleanupsSeconds?: number; }; export type ResolvedRateLimits = { inviteLimitPerParticipantPerHour: number; inviteLimitPerParticipant: number; messageLimitPerParticipantPerSecond: number; messageMaxLength: number; conversationParticipantLimit: number; conversationLimitPerParticipant: number; sweepIntervalSeconds: number; }; export type ResolvedCleanup = { indicatorTtlSeconds: number; indicatorCleanupIntervalSeconds: number; cacheEntryTtlMinutes: number; cacheCleanupIntervalSeconds: number; messageAfterDays: number | null; conversationAfterInactiveDays: number | null; inviteAfterDays: number | null; timeoutBetweenDailyCleanupsSeconds: number; }; export type Handler = (...args: Args) => R | Promise; export type Handlers = { createConversation?: Handler<[ConversationRecord, string, number], void>; createMessage?: Handler<[Message], void>; createMessagesSystemRemoved?: Handler<[Message[]], { oldestMessagesByConversationId: Map; updatedParticipantActivities: ParticipantActivity[]; }>; createReaction?: Handler<[Reaction], void>; createInvite?: Handler<[Invite, number], { inserted: boolean; }>; createConversationParticipant?: Handler<[string, string, number, number], void>; createConversationParticipantActivity?: Handler<[ParticipantActivity], void>; readConversations?: Handler<[string], Conversation[]>; readMessages?: Handler<[string, string | null, boolean, number], { messages: Message[]; remainingInDirection: number; }>; readInvitesInvolvingParticipant?: Handler<[string], Invite[]>; readInvitesForRecipient?: Handler<[string, string], Invite[]>; readAliases?: Handler<[string[]], Alias[]>; readConversationParticipantActivity?: Handler<[string, string], ParticipantActivity | null>; readParticipantActivities?: Handler<[string], ParticipantActivity[]>; readMessage?: Handler<[string], Message | null>; readMessagesByIds?: Handler<[string[]], Message[]>; readConversationLastMessageMetadata?: Handler<[string], { messageId: string; createdAt: Date; } | null>; readConversation?: Handler<[string], Conversation | null>; readInvite?: Handler<[string, string, string], Invite | null>; readReaction?: Handler<[string], Reaction | null>; readHasNew?: Handler<[string], { hasNewMessages: boolean; hasNewInvites: boolean; }>; updateMessage?: Handler<[Message], void>; updateConversationParticipantActivity?: Handler<[ParticipantActivity], void>; deleteReaction?: Handler<[string], void>; deleteConversationParticipantAndParticipantActivity?: Handler<[string, string], void>; deleteAllConversationParticipantsAndParticipantActivitiesForParticipant?: Handler<[string], { deletedConversations: { conversationId: string; formerParticipantIds: string[]; deletedInvites: { fromParticipantId: string; toParticipantId: string; }[]; }[]; remainingConversations: { conversationId: string; conversationRecord: ConversationRecord; remainingParticipantIds: string[]; lastMessage: Message | null; }[]; }>; deleteConversationWithMessagesReactionsInvitesAndActivities?: Handler<[string], { deletedInvites: { fromParticipantId: string; toParticipantId: string; }[]; }>; deleteInvites?: Handler<[{ conversationId: string; fromParticipantId: string; toParticipantId: string; }[]], void>; deleteMessagesBefore?: Handler<[Date], { affectedConversationIds: string[]; }>; deleteConversationsWithMessagesReactionsInvitesAndActivitiesBefore?: Handler<[Date], { deletedConversations: { conversationId: string; formerParticipantIds: string[]; deletedInvites: { fromParticipantId: string; toParticipantId: string; }[]; }[]; }>; deleteInvitesBefore?: Handler<[Date], { deletedInvites: { conversationId: string; fromParticipantId: string; toParticipantId: string; }[]; }>; participantAuth?: Handler<[string, unknown], boolean>; inviteAuth?: Handler<[string, string], boolean>; profanityCheckCensor?: Handler<[string], string>; profanityCheckBlock?: Handler<[string], boolean>; afterMessageCreated?: Handler<[Message], void>; afterMessageDeleted?: Handler<[Message], void>; afterParticipantJoined?: Handler<[string, string], void>; afterParticipantLeft?: Handler<[string, string], void>; afterInviteCreated?: Handler<[Invite], void>; afterInviteDeleted?: Handler<[string, string, string], void>; afterConversationCreated?: Handler<[Conversation], void>; afterConversationDeleted?: Handler<[string], void>; }; export declare function getHandler(handlers: Handlers, name: K): NonNullable; //# sourceMappingURL=server-types.d.ts.map