import { BaseService, ServiceConfig, ServiceResponse } from "./base-service.js"; export interface DatabaseConfig extends ServiceConfig { uri: string; dbName: string; connectionOptions?: { maxPoolSize?: number; minPoolSize?: number; maxIdleTimeMS?: number; serverSelectionTimeoutMS?: number; }; } export interface QueryOptions { sanitize?: boolean; allowedFields?: string[]; limit?: number; skip?: number; sort?: Record; } export interface AggregationOptions { sanitize?: boolean; allowedStages?: string[]; maxPipelineLength?: number; } export declare class DatabaseService extends BaseService { private dbConfig; private client?; private db?; private isConnected; constructor(dbConfig: DatabaseConfig); /** * Connect to database */ connect(): Promise>; /** * Disconnect from database */ disconnect(): Promise>; /** * Find documents in collection */ find(collectionName: string, query: any, options?: QueryOptions): Promise>; /** * Find one document in collection */ findOne(collectionName: string, query: any, options?: QueryOptions): Promise>; /** * Aggregate documents in collection */ aggregate(collectionName: string, pipeline: any[], options?: AggregationOptions): Promise>; /** * Count documents in collection */ count(collectionName: string, query?: any, options?: QueryOptions): Promise>; /** * Insert document into collection */ insertOne(collectionName: string, document: T): Promise>; /** * Update document in collection */ updateOne(collectionName: string, filter: any, update: any, options?: QueryOptions): Promise>; /** * Delete document from collection */ deleteOne(collectionName: string, filter: any, options?: QueryOptions): Promise>; /** * Ensure database connection */ private ensureConnected; /** * Get collection instance */ private getCollection; /** * Sanitize MongoDB query */ private sanitizeQuery; /** * Sanitize update operations */ private sanitizeUpdate; /** * Sanitize aggregation pipeline */ private sanitizeAggregationPipeline; /** * Build find options */ private buildFindOptions; /** * Sanitize URI for logging */ private sanitizeUri; /** * Health check implementation */ healthCheck(): Promise; /** * Get database statistics */ getStats(): Promise>; /** * List collections */ listCollections(): Promise>; }