UNPKG

trojanhorse-js

Version:

A comprehensive JavaScript library for fetching, managing, and analyzing global threat intelligence from multiple open-source feeds and security news sources. Unlike its mythological namesake, this Trojan protects your digital fortress.

92 lines 2.88 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; export interface MetricPoint { timestamp: Date; metric: string; value: number; labels: Record<string, string>; unit: 'count' | 'rate' | 'gauge' | 'histogram' | 'bytes' | 'milliseconds'; metadata?: Record<string, any>; } export interface Alert { id: string; title: string; description: string; severity: 'info' | 'warning' | 'critical' | 'emergency'; category: 'performance' | 'security' | 'system' | 'business'; source: string; timestamp: Date; resolved: boolean; metadata?: Record<string, any>; } export interface NotificationChannel { type: 'email' | 'slack' | 'webhook' | 'pagerduty'; config: any; enabled: boolean; } export interface AnalyticsConfig { retention: { metrics: number; alerts: number; logs: number; }; notifications: NotificationChannel[]; aggregation: { intervals: string[]; defaultInterval: string; }; } declare class MetricsCollector extends EventEmitter { private metrics; private config; constructor(config: AnalyticsConfig); recordMetric(point: MetricPoint): void; queryMetrics(query: { metric: string; from: Date; to: Date; aggregation?: 'sum' | 'avg' | 'min' | 'max' | 'count'; groupBy?: string[]; filters?: Record<string, string>; }): MetricPoint[]; getMetrics(): Map<string, MetricPoint[]>; } declare class AlertingEngine extends EventEmitter { private alerts; private config; constructor(config: AnalyticsConfig); createAlert(alert: Omit<Alert, 'id' | 'timestamp' | 'resolved'>): string; resolveAlert(alertId: string): boolean; getAlerts(): Alert[]; private sendNotifications; private sendEmailNotification; private generateAlertEmailHTML; private generateAlertEmailText; private getSeverityColor; private sendSlackNotification; private sendWebhookNotification; private sendPagerDutyNotification; private mapSeverityToPagerDuty; } export declare class AnalyticsManager extends EventEmitter { private config; private metricsCollector; private alertingEngine; constructor(config: AnalyticsConfig); private setupEventHandlers; recordMetric(metric: MetricPoint): void; createAlert(alert: Omit<Alert, 'id' | 'timestamp' | 'resolved'>): string; queryMetrics(query: { metric: string; from: Date; to: Date; aggregation?: 'sum' | 'avg' | 'min' | 'max' | 'count'; groupBy?: string[]; filters?: Record<string, string>; }): MetricPoint[]; getAlerts(): Alert[]; getMetricsCollector(): MetricsCollector; getAlertingEngine(): AlertingEngine; } export { MetricsCollector, AlertingEngine }; //# sourceMappingURL=RealTimeAnalytics.d.ts.map