import { Connection, Model, Document, Schema } from 'mongoose'; import { MemCacheConnections } from '../../cacheConnections'; import { ILogger } from '../../definitions'; export interface ConnectionManagerConfig { name: string; schema: Schema; collection: string | null; isDiscriminator: boolean; discriminator?: { baseName: string; baseSchema: Schema; baseCollection: string; }; logger?: ILogger; } /** * Manages connections and models for a repository */ export declare class ConnectionManager { private readonly config; private readonly memCacheConnections; private readonly defaultModel; private readonly modelCache; private readonly connectionValidationCache; private connectionListeners; constructor(config: ConnectionManagerConfig, memCacheConnections: MemCacheConnections, defaultModel: Model); /** * Sets up connection state change listeners to invalidate model cache */ setupConnectionListeners(): void; /** * Clears model cache for a specific domain */ clearModelCacheForDomain(domain: string): void; /** * Cleanup all resources */ cleanup(): { connectionsProcessed: number; }; /** * Gets the connection for a specific domain */ getConnection(domain: string): Connection | undefined; /** * Gets connection state name for logging */ getConnectionStateName(readyState: number): string; /** * Gets a ready connection for a specific domain, waiting if necessary */ getReadyConnection(domain: string, maxWaitMs?: number): Promise; /** * Gets the model for a specific domain, with caching (sync version) */ getModel(domain?: string): Model; /** * Gets the model for a specific domain with async connection readiness check */ getModelAsync(domain?: string): Promise>; }