import { MongoClient } from 'mongodb'; /** Manages a shared pool of MongoClient instances, reusing connections by URI and pool options. */ export declare class MongoClientWrapper { /** Global cache of wrapper instances keyed by URI and pool options. */ static readonly clients: Map; private readonly cacheKey; private readonly client; private readonly closeDelay; private closeTimer; private connected; private operationChain; private refCount; constructor(uri: string, maxPoolSize?: number, closeDelay?: number, cacheKey?: string); /** * Builds a cache key from connection URI and pool options. * @param URI - The MongoDB connection URI * @param poolSize - Maximum connection pool size * @param closeDelay - Delay in milliseconds before closing idle connections */ static cacheKey(uri: string, poolSize?: number, closeDelay?: number): string; /** * Gets or creates a cached MongoClientWrapper for the given URI and pool options. * @param URI - The MongoDB connection URI * @param poolSize - Maximum connection pool size * @param closeDelay - Delay in milliseconds before closing idle connections * @returns A cached or newly created wrapper instance */ static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper; /** Connects to MongoDB and returns the underlying MongoClient. */ connect(): Promise; /** * Releases a connection reference. The shared client is kept alive and only closed once it * has had no references for `closeDelay` ms, so back-to-back operations reuse a single pooled * client. A reconnect within that window cancels the pending close. Use `closeDelay: 0` for * the legacy behavior of closing immediately on the last release. */ disconnect(): Promise; /** Initiates a graceful close of the connection, regardless of outstanding references. */ initiateClose(): Promise; private cancelScheduledClose; private closeIfIdle; private enqueue; private removeFromCache; private scheduleClose; } //# sourceMappingURL=Wrapper.d.ts.map