import { SqlSlowConfig } from './types/config'; import { QueryStats } from './types/query'; import { OptimizationResult } from './types/ai'; export declare class SqlSlow { private cfg; private monitor; private aiOptimizer; private alertService; private dashboard; private started; /** * Create a new SqlSlow instance. * * @param dbClient Your database client (Prisma / pg Pool / mysql2 Connection). * Pass `null` to skip auto-adapter attachment and ingest events manually. * @param config SqlSlowConfig options (all optional — sensible defaults apply). */ constructor(dbClient: any, config?: SqlSlowConfig); /** * Start monitoring. * Idempotent – calling multiple times is safe. */ start(): this; /** * Stop monitoring and shut down the dashboard server (if running). */ stop(): void; /** * Return a snapshot of all collected performance stats. */ getStats(): QueryStats; /** * Clear all stored metrics. */ clearMetrics(): void; /** * Manually ingest a query event (useful for custom adapters / testing). */ ingest(query: string, durationMs: number, startedAt?: Date): void; /** * Run a one-off AI analysis on any SQL string. * Returns null if AI is not configured. */ analyzeQuery(sql: string, durationMs?: number, table?: string): Promise; /** * Test all configured alert channels (sends a test message to each). */ testAlerts(): Promise>; /** * Send a daily report now (bypasses the scheduled timer). */ sendDailyReport(): Promise; /** * Subscribe to raw monitor events. * @example sqlSlow.on('slow-query', ({ metrics }) => console.log(metrics)); */ on(event: K, listener: import('./types/query').MonitorEvents[K]): this; /** * One-liner factory – creates and starts the monitor immediately. * * @example * const sq = SqlSlow.create(prisma, { alert: '>500ms', fix: 'ai' }); */ static create(dbClient: any, config?: SqlSlowConfig): SqlSlow; } export default SqlSlow; export type { SqlSlowConfig, TelegramConfig, SlackConfig, DiscordConfig, WebhookConfig, AIConfig, DashboardConfig, AIProvider, DatabaseAdapter, LogLevel, AlertChannel, Severity, Threshold, } from './types/config'; export type { QueryMetrics, QueryStats, RawQueryEvent, SqlOperation, MonitorEvents, SlowQueryEvent, OperationBreakdown, PercentileBuckets, } from './types/query'; export type { OptimizationResult, IndexRecommendation, QueryRewrite, } from './types/ai'; export type { AlertPayload, AlertSendResult, DailyReportPayload, } from './types/alert'; export { attachPrismaAdapter, attachPgAdapter, attachMysql2Adapter, attachMssqlAdapter } from './adapters'; //# sourceMappingURL=index.d.ts.map