UNPKG

@agility/cli

Version:

Agility CLI for working with your content. (Public Beta)

97 lines (96 loc) 2.98 kB
export interface ProgressStats { processed: number; total: number; percentage: number; startTime: Date; currentTime: Date; elapsedTime: number; estimatedTotalTime?: number; estimatedRemainingTime?: number; itemsPerSecond?: number; } export interface ProgressWindow { timestamp: number; processed: number; } export declare class ProgressCalculator { private progressHistory; private windowSize; private startTime; constructor(windowSize?: number); /** * Calculate progress percentage */ static calculatePercentage(processed: number, total: number): number; /** * Calculate progress stats with timing information */ calculateProgress(processed: number, total: number): ProgressStats; /** * Add a measurement to the progress history */ private addMeasurement; /** * Calculate items per second using moving average */ private calculateItemsPerSecond; /** * Format time duration */ static formatDuration(milliseconds: number): string; /** * Format items per second */ static formatRate(itemsPerSecond: number): string; /** * Create a progress summary string */ static formatProgressSummary(stats: ProgressStats): string; /** * Calculate completion percentage for multiple steps */ static calculateOverallProgress(stepProgresses: number[]): number; /** * Calculate weighted progress for steps with different importance */ static calculateWeightedProgress(stepProgresses: number[], weights: number[]): number; /** * Estimate time until completion */ getEstimatedTimeRemaining(processed: number, total: number): number | null; /** * Get current processing rate */ getCurrentRate(): number; /** * Reset calculator for new operation */ reset(): void; /** * Create a throttled progress reporter */ static createThrottledReporter(reportCallback: (stats: ProgressStats) => void, intervalMs?: number): (processed: number, total: number) => void; /** * Create batch progress calculator for large operations */ static createBatchProgressCalculator(batchSize: number): { reportProgress: (batchIndex: number, totalBatches: number, batchProgress: number) => ProgressStats; reset: () => void; }; /** * Smooth progress updates to prevent UI jitter */ static createSmoothProgressReporter(updateCallback: (percentage: number) => void, smoothingFactor?: number): (processed: number, total: number) => void; /** * Calculate conservative progress for Content Sync SDK operations */ static calculateConservativeProgress(totalItems: number, divisor?: number): number; /** * Get progress statistics for debugging */ getStats(): { historySize: number; currentRate: number; elapsedTime: number; }; }