UNPKG

@ajaltech/monitrace

Version:

Librería de monitoreo de errores frontend creada por Ajal Technology

53 lines (48 loc) 1.83 kB
type MonitraceClient = 'axios' | 'fetch' | 'xhr'; interface MonitraceConfig { client: MonitraceClient; endpoint: string; appName: string; version?: string; localFallback?: boolean; count?: number; userContext?: () => Record<string, any>; } /** * Inicializa Monitrace para captura de errores frontend. */ declare function initMonitrace(userConfig: MonitraceConfig): void; declare function setUserContext(contextOrFn: Record<string, any> | (() => Record<string, any>)): void; declare function getCurrentUserContext(): Record<string, any> | null; declare function isMonitraceInitialized(): boolean; declare function getMonitraceStatus(): { isInitialized: boolean; hasEndpoint: boolean; hasAppName: boolean; }; interface ErrorPayload { message: string; stack?: string; route: string; appName?: string; version?: string; type: 'global' | 'http' | 'promise' | 'manual' | 'global-onerror'; timestamp: string; userContext?: Record<string, any>; count?: number; metadata?: Record<string, any>; } type ErrorInput = { message: string; stack?: string; route: string; type: 'global' | 'http' | 'promise' | 'manual' | 'global-onerror'; metadata?: Record<string, any>; appName?: string; version?: string; }; declare function sendError(error: ErrorInput, config: MonitraceConfig): void; declare function flushAllPendingErrors(config: MonitraceConfig): void; declare function flushStoredErrors(config: MonitraceConfig): void; declare function startErrorFlusher(config: MonitraceConfig, interval?: number): void; export { type ErrorPayload, type MonitraceConfig, flushAllPendingErrors, flushStoredErrors, getCurrentUserContext, getMonitraceStatus, initMonitrace, isMonitraceInitialized, sendError, setUserContext, startErrorFlusher };