UNPKG

@ahmedhegazee/nestjs-telescope

Version:

Advanced observability and monitoring solution for NestJS applications with ML-powered analytics, enterprise features, and production-ready scaling

145 lines (144 loc) 4.12 kB
import { TelescopeService } from './telescope.service'; import { AnalyticsService } from './analytics.service'; import { PerformanceCorrelationService } from './performance-correlation.service'; export declare enum ExportFormat { JSON = "json", CSV = "csv", XLSX = "xlsx", PDF = "pdf" } export declare enum ReportFormat { HTML = "html", PDF = "pdf", MARKDOWN = "md" } export interface ExportOptions { format: 'json' | 'csv' | 'xlsx' | 'pdf'; type: 'raw' | 'analytics' | 'performance' | 'custom'; timeRange?: { start: Date; end: Date; }; filters?: { watchers?: string[]; components?: string[]; severities?: string[]; tags?: string[]; }; fields?: string[]; limit?: number; includeMetadata?: boolean; } export interface ReportOptions { type: 'performance' | 'error' | 'system' | 'custom'; template?: string; title?: string; description?: string; timeRange: { start: Date; end: Date; }; sections?: ReportSection[]; format: 'html' | 'pdf' | 'md'; includeCharts?: boolean; includeRawData?: boolean; } export interface ReportSection { title: string; type: 'overview' | 'metrics' | 'charts' | 'table' | 'analysis' | 'recommendations'; data?: any; config?: any; } export interface ExportResult { success: boolean; filePath?: string; data?: any; error?: string; metadata: { recordCount: number; timeRange: { start: Date; end: Date; }; exportedAt: Date; format: string; }; } export interface ReportResult { success: boolean; filePath?: string; content?: string; error?: string; metadata: { title: string; generatedAt: Date; timeRange: { start: Date; end: Date; }; format: string; sections: number; }; } export declare class ExportReportingService { private readonly telescopeService; private readonly analyticsService; private readonly performanceCorrelationService; private readonly logger; private readonly exportDir; constructor(telescopeService: TelescopeService, analyticsService: AnalyticsService, performanceCorrelationService: PerformanceCorrelationService); private ensureExportDirectory; exportData(options: ExportOptions): Promise<ExportResult>; generateReport(options: ReportOptions): Promise<ReportResult>; private collectRawData; private collectAnalyticsData; private collectPerformanceData; private collectCustomData; private applyFilters; private selectFields; private selectObjectFields; private setNestedValue; private generateFileName; private generateReportFileName; private exportToJson; private exportToCsv; private extractCsvHeaders; private getNestedValue; private escapeCsvValue; private exportToXlsx; private exportToPdf; private collectReportData; private generateReportContent; private getDefaultSections; private generateHtmlReport; private generateHtmlSection; private generateHtmlOverview; private generateHtmlMetrics; private generateHtmlCharts; private generateHtmlTable; private generateHtmlAnalysis; private generateHtmlRecommendations; private generateMarkdownReport; private generateMarkdownSection; private generateMarkdownOverview; private generateMarkdownMetrics; private generateMarkdownRecommendations; private generatePdfReport; private saveHtmlReport; private savePdfReport; private saveMarkdownReport; scheduleReport(options: ReportOptions, cronExpression: string): Promise<string>; getExportHistory(): Promise<Array<{ id: string; type: string; createdAt: Date; filePath: string; }>>; getReportTemplates(): Promise<Array<{ id: string; name: string; type: string; sections: ReportSection[]; }>>; deleteExport(filePath: string): Promise<boolean>; }