/** Supported alert channel providers */ export type AlertChannel = 'telegram' | 'slack' | 'discord' | 'webhook' | 'console'; /** Supported AI optimization providers */ export type AIProvider = 'openai' | 'anthropic' | 'gemini' | 'none'; /** Supported database adapters */ export type DatabaseAdapter = 'prisma' | 'pg' | 'mysql2' | 'mssql' | 'auto'; /** Log verbosity levels */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent'; /** Threshold comparison operator */ export type ThresholdOperator = '>' | '>=' | '<' | '<=' | '='; /** Severity of a slow query event */ export type Severity = 'critical' | 'warning' | 'info'; /** * Parsed threshold object. * Supports string notation such as ">500ms", ">=2s", ">1000" */ export interface Threshold { /** Raw original string e.g. ">500ms" */ raw: string; /** Comparison operator */ operator: ThresholdOperator; /** Value in milliseconds */ valueMs: number; } export interface TelegramConfig { /** Bot token from @BotFather */ botToken: string; /** Target chat / group / channel ID */ chatId: string; /** Optional custom message thread ID (Topics) */ messageThreadId?: number; /** Parse mode for messages (default: HTML) */ parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2'; } export interface SlackConfig { /** Incoming Webhook URL */ webhookUrl: string; /** Optional channel override */ channel?: string; /** Optional username override */ username?: string; /** Optional icon emoji */ iconEmoji?: string; } export interface DiscordConfig { /** Discord Webhook URL */ webhookUrl: string; /** Optional username override */ username?: string; /** Optional avatar URL */ avatarUrl?: string; } export interface WebhookConfig { /** Endpoint URL */ url: string; /** HTTP method (default: POST) */ method?: 'POST' | 'PUT'; /** Extra headers */ headers?: Record; /** Bearer / HMAC secret for signed requests */ secret?: string; } export interface AIConfig { /** AI provider to use */ provider: AIProvider; /** API key (falls back to env vars) */ apiKey?: string; /** Model name override */ model?: string; /** Max tokens for completion */ maxTokens?: number; /** Temperature (0-1) */ temperature?: number; /** Request timeout in ms (default: 30 000) */ timeoutMs?: number; /** * Whether to include the full query text in the AI prompt. * Disable for privacy-sensitive environments. * Default: true */ includeQueryInPrompt?: boolean; } export interface DashboardConfig { /** Enable the embedded Express dashboard (default: false) */ enabled: boolean; /** Port to listen on (default: 4001) */ port?: number; /** Bearer token to protect dashboard endpoints */ secret?: string; /** Hostname / IP to bind (default: 0.0.0.0) */ host?: string; /** Max entries kept in the in-memory store (default: 5000) */ maxStoredQueries?: number; } export interface SqlSlowConfig { /** * Alert threshold string. * Examples: ">500ms", ">=1s", ">2000" * Default: ">500ms" */ alert?: string; /** * Enable AI-powered query optimization suggestions. * Pass 'ai' to enable with default settings, or an AIConfig object for full control. */ fix?: 'ai' | AIConfig | false; /** Telegram alert configuration */ telegram?: TelegramConfig; /** Slack alert configuration */ slack?: SlackConfig; /** Discord alert configuration */ discord?: DiscordConfig; /** Generic HTTP webhook configuration */ webhook?: WebhookConfig; /** Always print alerts to console (default: true) */ consoleAlerts?: boolean; /** Real-time web dashboard configuration */ dashboard?: DashboardConfig | boolean; /** * Force a specific adapter. * 'auto' detects automatically from the client passed to SqlSlow. */ adapter?: DatabaseAdapter; /** * Sample rate (0.0 – 1.0). * Only analyse this fraction of all queries. Useful under extreme load. * Default: 1.0 (100%) */ sampleRate?: number; /** * Maximum concurrent AI requests in-flight. * Prevents rate-limit bursts. * Default: 3 */ maxConcurrentAI?: number; /** * Send a daily summary report at the given UTC hour (0-23). * Set to -1 to disable. * Default: -1 */ dailyReportHour?: number; /** Log verbosity (default: 'info') */ logLevel?: LogLevel; /** Human-readable application / server name shown in alerts */ appName?: string; } export interface ResolvedConfig { threshold: Threshold; ai: AIConfig | null; telegram: TelegramConfig | null; slack: SlackConfig | null; discord: DiscordConfig | null; webhook: WebhookConfig | null; consoleAlerts: boolean; dashboard: DashboardConfig; adapter: DatabaseAdapter; sampleRate: number; maxConcurrentAI: number; dailyReportHour: number; logLevel: LogLevel; appName: string; } //# sourceMappingURL=config.d.ts.map