/** * Alert System * * Manages alert channels (logger, Sentry, console) and alert delivery. * Provides configurable thresholds and aggregation for production. */ import type { Alert } from './types.js'; /** * Sentry interface for dependency injection and testing */ interface SentryClient { captureMessage: (message: string, context?: unknown) => void; setUser: (user: unknown) => void; } /** * Alert channel type */ type AlertChannel = 'logger' | 'sentry' | 'console'; /** * Alert configuration */ interface AlertConfig { /** Enabled channels */ channels: AlertChannel[]; /** Aggregate alerts in production (log every N minutes instead of immediately) */ aggregateInProduction: boolean; /** Aggregation interval in milliseconds */ aggregationInterval: number; /** Enable Sentry in production only */ sentryProductionOnly: boolean; } /** * Alert manager class */ declare class AlertManager { private config; private alertQueue; private aggregationTimer; private lastAggregationTime; private sentryClient; constructor(config?: Partial, sentryClient?: SentryClient | null); /** * Send an alert through configured channels */ sendAlert(alert: Alert): void; /** * Send multiple alerts */ sendAlerts(alerts: Alert[]): void; /** * Deliver an alert to configured channels */ private deliverAlert; /** * Send alert to logger */ private sendToLogger; /** * Send alert to console (uses logger for structured output) */ private sendToConsole; /** * Send alert to Sentry */ private sendToSentry; /** * Start aggregation timer */ private startAggregation; /** * Flush aggregated alerts */ private flushAlerts; /** * Stop aggregation timer */ stopAggregation(): void; /** * Check if running in production */ private isProduction; /** * Get alert queue stats */ getStats(): { queueSize: number; lastAggregationTime: number; aggregationEnabled: boolean; }; /** * Configure alert channels */ setChannels(channels: AlertChannel[]): void; /** * Cleanup resources */ dispose(): void; } /** * Singleton instance */ export declare const alertManager: AlertManager; /** * Export types for testing */ export type { AlertChannel, SentryClient }; /** * Export AlertManager class for testing */ export { AlertManager }; /** * Convenience functions */ export declare function sendAlert(alert: Alert): void; export declare function sendAlerts(alerts: Alert[]): void; export declare function getAlertStats(): ReturnType; export declare function setAlertChannels(channels: AlertChannel[]): void; //# sourceMappingURL=alerts.d.ts.map