/** * Simplified Mongoose adapter with app discovery and tenant middleware * @module @voilajsx/appkit/database * @file src/database/adapters/mongoose.ts * * @llm-rule WHEN: Using Mongoose ODM with MongoDB databases in VoilaJSX framework * @llm-rule AVOID: Using with SQL databases - use prisma adapter instead * @llm-rule NOTE: Auto-discovers apps from /apps directory structure, applies tenant filtering */ interface MongooseClientConfig { url: string; appName?: string; maxPoolSize?: number; timeout?: number; connectionOptions?: Record; } interface DiscoveredApp { name: string; modelsPath: string; } interface TenantMiddlewareOptions { fieldName?: string; orgId?: string; } interface MongooseConnection { db: any; close: () => Promise; model: (name: string, schema?: any, collection?: string) => any; models: Record; on: (event: string, callback: (...args: any[]) => void) => void; _appKit?: boolean; _appName?: string; _url?: string; _tenantId?: string; _tenantFiltered?: boolean; [key: string]: any; } /** * Simplified Mongoose adapter with VoilaJSX app discovery */ export declare class MongooseAdapter { private options; private connections; private discoveredApps; private isDevelopment; private mongoose; constructor(options?: Record); /** * Creates Mongoose connection with app discovery and automatic connection management */ createClient(config: MongooseClientConfig): Promise; /** * Apply tenant filtering middleware to Mongoose connection */ applyTenantMiddleware(connection: MongooseConnection, tenantId: string, options?: TenantMiddlewareOptions): Promise; /** * Auto-discover VoilaJSX apps with Mongoose models */ discoverApps(): Promise; /** * Check if tenant registry collection exists */ hasTenantRegistry(connection: MongooseConnection): Promise; /** * Create tenant registry entry */ createTenantRegistryEntry(connection: MongooseConnection, tenantId: string): Promise; /** * Delete tenant registry entry */ deleteTenantRegistryEntry(connection: MongooseConnection, tenantId: string): Promise; /** * Check if tenant exists in registry */ tenantExistsInRegistry(connection: MongooseConnection, tenantId: string): Promise; /** * Get all tenants from registry */ getTenantsFromRegistry(connection: MongooseConnection): Promise; /** * Disconnect all cached connections */ disconnect(): Promise; /** * Detect current app from file path (VoilaJSX structure) */ private _detectCurrentApp; /** * Find apps directory in project structure */ private _findAppsDirectory; /** * Load models for specific app */ private _loadModelsForApp; /** * Setup connection event handlers */ private _setupConnectionEvents; /** * Mask URL for logging (hide credentials) */ private _maskUrl; } export {}; //# sourceMappingURL=mongoose.d.ts.map