/** * ServerService — manages server lifecycle, membership, and channel organization. * * Uses the IChatStorageProvider collections as the primary data store. * An in-memory cache is maintained for fast synchronous lookups (e.g. * getMemberRole) and is kept in sync with the collection on every write. * * Requirements: 1.1, 1.3, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 */ import { ChannelVisibility, DefaultRole } from '../../enumerations/communication'; import { IChannel, IPaginatedResult } from '../../interfaces/communication'; import { IChatStorageProvider } from '../../interfaces/communication/chatStorageProvider'; import { IServer, IServerInviteToken, IServerUpdate } from '../../interfaces/communication/server'; import { ICommunicationEventEmitter } from '../../interfaces/events'; import { ChannelService } from './channelService'; export declare class ServerNotFoundError extends Error { constructor(serverId: string); } export declare class ServerPermissionError extends Error { constructor(message?: string); } export declare class NotServerMemberError extends Error { constructor(); } export declare class ServerNameValidationError extends Error { constructor(message?: string); } export declare class MemberAlreadyInServerError extends Error { constructor(memberId: string); } export declare class ServerInviteNotFoundError extends Error { constructor(token: string); } export declare class ServerInviteExpiredError extends Error { constructor(); } export interface CreateServerParams { name: string; iconUrl?: string; } export interface CreateServerInviteParams { maxUses?: number; expiresInMs?: number; } export interface CreateChannelInServerParams { name: string; topic?: string; visibility: ChannelVisibility; } export declare class ServerService { /** In-memory cache for fast synchronous lookups (getMemberRole). */ private readonly cache; private readonly inviteCache; private readonly channelService; private readonly eventEmitter; /** Persistent collection — source of truth. */ private readonly serverCollection; private readonly serverInviteCollection; private initialized; constructor(options: { channelService: ChannelService; storageProvider: IChatStorageProvider; eventEmitter?: ICommunicationEventEmitter; }); /** Load persisted data into the cache. Must be called before use. */ init(): Promise; private validateServerName; private resolveServer; private persistServer; private resolveInvite; getMemberRole(serverId: string, memberId: string): DefaultRole | null; private assertCanUpdate; private assertCanDelete; createServer(ownerId: string, params: CreateServerParams): Promise; getServer(serverId: string): Promise; updateServer(serverId: string, userId: string, update: IServerUpdate): Promise; deleteServer(serverId: string, userId: string): Promise; listServersForMember(memberId: string, pagination?: { cursor?: string; limit?: number; }): Promise>; addMembers(serverId: string, userId: string, memberIds: string[]): Promise; removeMember(serverId: string, userId: string, memberId: string): Promise; createInvite(serverId: string, userId: string, params: CreateServerInviteParams): Promise; redeemInvite(serverId: string, token: string, userId: string): Promise; createChannelInServer(serverId: string, userId: string, params: CreateChannelInServerParams, categoryId?: string): Promise; removeChannelFromServer(serverId: string, channelId: string, userId: string): Promise; getServerById(serverId: string): IServer | undefined; getInviteToken(token: string): IServerInviteToken | undefined; } //# sourceMappingURL=serverService.d.ts.map