/** * Preview Service * * Generates operation previews for dry-run mode. * * @since v1.32.0 */ import { ESTIMATED_TIME_PER_FILE, type FileChange, type OperationPreview, type PluginUpdateInfo, type PreviewOptions, type PreviewSummary, type SyncDirection } from './preview-types.js'; /** * Scanned file info for comparison */ export interface ScannedFile { name: string; filename: string; version?: string; size: number; path: string; } /** * Data provider for preview generation */ export interface PreviewDataProvider { /** Scan a directory for plugin files */ scanDirectory?: (path: string) => Promise; /** Get available disk space in bytes */ getAvailableSpace?: () => Promise; /** Get production plugins path */ getProductionPath?: () => string | null; /** Get test plugins path */ getTestPath?: () => string | null; /** Get backup directory path */ getBackupPath?: () => string | null; } /** * Preview service for generating operation previews */ export declare class PreviewService { private provider; constructor(provider?: PreviewDataProvider); /** * Set the data provider */ setProvider(provider: PreviewDataProvider): void; /** * Preview a sync operation */ previewSync(direction: SyncDirection, options?: PreviewOptions): Promise; /** * Preview a batch update operation */ previewUpdate(plugins: PluginUpdateInfo[], options?: PreviewOptions): OperationPreview; /** * Preview a single download */ previewDownload(plugin: PluginUpdateInfo, options?: PreviewOptions): OperationPreview; /** * Preview a backup operation */ previewBackup(serverPath: string, options?: PreviewOptions): Promise; /** * Preview a restore operation */ previewRestore(backupPath: string, targetPath: string, options?: PreviewOptions): Promise; /** * Preview a migrate operation (test to production with extra caution) */ previewMigrate(options?: PreviewOptions): Promise; /** * Calculate summary from changes */ calculateSummary(changes: FileChange[]): PreviewSummary; /** * Estimate operation duration */ estimateDuration(changes: FileChange[], type: keyof typeof ESTIMATED_TIME_PER_FILE): number; /** * Calculate space required for changes */ calculateSpaceRequired(changes: FileChange[]): number; /** * Generate warnings based on changes */ generateWarnings(changes: FileChange[]): string[]; /** * Check if version change is a downgrade */ private isDowngrade; /** * Format size for display */ formatSize(bytes: number): string; /** * Format duration for display */ formatDuration(ms: number): string; /** * Get a human-readable summary string */ getSummaryString(summary: PreviewSummary): string; } /** * Get the singleton preview service */ export declare function getPreviewService(): PreviewService; /** * Reset the singleton */ export declare function resetPreviewService(): void; //# sourceMappingURL=preview-service.d.ts.map