import { PackageManager } from '@tinkoff/package-manager-wrapper'; import { Logger } from './logger'; import { createMemoryMonitor } from '../utils/memoryUsage'; declare global { var __TRAMVAI_EXIT_HANDLERS__: Array<() => Promise>; } export type LEVEL = 'INFO' | 'WARN' | 'ERROR'; export type COMMANDS = 'start' | 'build' | 'start-prod' | 'static' | 'analyze' | 'new' | 'add' | 'update'; export type Event = { /** * @description ISO-8601 + timezone */ timestamp: string; /** * @description Unique identifier for the current cli execution */ 'x-command-id': string; level: LEVEL; event: string; message: string; system: string; tramvai: TramvaiProperties; os: SystemProperties; vcs?: VcsProperties; }; export type ProjectProperties = { name: string; type?: 'application' | 'child-app' | 'module' | 'package' | 'unknown'; }; export type TramvaiProperties = { name: '@tramvai/cli'; version: string; }; export type DependenciesProperties = { react?: string; webpack?: string; babel?: string; swc?: string; }; export type SystemProperties = { nodeVersion: string; packageManager: { name: string; }; platform: string; arch: string; cpus: { model: string; count: number; }; }; export type TranspilationType = 'custom' | 'all' | 'none' | 'only-modern'; export type FeaturesProperties = { swc?: boolean; fileSystemRouting?: boolean; lightningCss?: boolean; selectiveTranspilation?: TranspilationType; reactCompiler?: boolean; devTools?: boolean; moduleImage?: boolean; modulePwa?: boolean; viewTransitions?: boolean; transitionsRouterProvider?: boolean; experimentalWebpackWorkerThreads?: boolean; experimentalRspack?: boolean; }; export type VcsProperties = { tenant?: string; repository?: string; pipelineUrl?: string; jobUrl?: string; }; export type MemoryUsageProperties = { maxHeapTotal: number; maxHeapUsed: number; maxRss: number; }; export type AnalyticsEvents = { 'cli:init': { event: 'cli:init'; level: 'INFO'; message: string; arguments: string[]; /** * @description CLI uptime in milliseconds before the AnalyticsService was initialized */ uptime: number; dependencies: DependenciesProperties; }; 'cli:error': { event: 'cli:error'; level: 'ERROR'; message: string; arguments: string[]; error: Error; /** * @description CLI uptime in milliseconds before the AnalyticsService was initialized */ uptime: number; }; 'cli:command:start': { event: 'cli:command:start'; level: 'INFO'; message: string; command: COMMANDS; parameters: Record; project?: ProjectProperties; features?: FeaturesProperties; }; 'cli:command:end': { event: 'cli:command:end'; level: 'INFO'; message: string; command: COMMANDS; /** * @description duration in milliseconds */ duration: number; memoryUsage?: MemoryUsageProperties; parameters: Record; project: ProjectProperties; }; 'cli:command:build:stats': { event: 'cli:command:build:stats'; level: 'INFO'; message: string; command: 'build'; parameters: Record; project: ProjectProperties; }; 'cli:command:error': { event: 'cli:command:error'; level: 'ERROR'; message: string; command: COMMANDS; /** * @description duration in milliseconds */ duration: number; memoryUsage?: MemoryUsageProperties; error: Error; parameters: Record; project?: ProjectProperties; }; }; export declare class AnalyticsService { #private; memoryMonitor: ReturnType | null; constructor({ enabled, endpoint, system, logger, packageManager, }: { enabled?: boolean; endpoint?: string; system?: string; logger: Logger; packageManager: PackageManager; }); init(): Promise; send(event: AnalyticsEvents[E]): Promise; sendRawEvent(rawEvent: Pick & Record): Promise; } export declare function resolveDependenciesProperties(): DependenciesProperties; //# sourceMappingURL=analytics.d.ts.map