UNPKG

supa-seed

Version:

A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support

212 lines 5.57 kB
/** * Configuration Backup Manager System * Phase 4, Checkpoint D2 - Advanced backup management with versioning and restoration */ export interface BackupMetadata { id: string; timestamp: Date; sourceFile: string; backupPath: string; checksum: string; size: number; compressed: boolean; tags: string[]; reason: 'manual' | 'pre_update' | 'scheduled' | 'rollback_point'; relatedUpdates: string[]; metadata: { version?: string; environment?: string; userId?: string; notes?: string; }; } export interface BackupSet { id: string; name: string; description: string; timestamp: Date; backups: BackupMetadata[]; status: 'complete' | 'partial' | 'corrupted'; totalSize: number; relatedChanges: string[]; } export interface BackupPolicy { id: string; name: string; description: string; triggers: BackupTrigger[]; retention: RetentionPolicy; compression: boolean; encryption: boolean; verification: boolean; excludePatterns: string[]; } export interface BackupTrigger { type: 'file_change' | 'time_interval' | 'before_update' | 'manual' | 'schema_change'; condition?: string; parameters: Record<string, any>; } export interface RetentionPolicy { maxCount?: number; maxAge?: number; keepDaily?: number; keepWeekly?: number; keepMonthly?: number; customRules?: RetentionRule[]; } export interface RetentionRule { condition: string; keepCount: number; description: string; } export interface RestoreResult { success: boolean; restoredFiles: string[]; errors: RestoreError[]; warnings: RestoreWarning[]; metadata: { backupSetId: string; restoreTime: Date; totalFiles: number; totalSize: number; }; } export interface RestoreError { code: string; message: string; filePath: string; severity: 'error' | 'critical'; } export interface RestoreWarning { code: string; message: string; filePath: string; impact: 'low' | 'medium' | 'high'; } export interface BackupVerificationResult { isValid: boolean; corruptedBackups: string[]; missingFiles: string[]; checksumMismatches: string[]; totalVerified: number; verificationTime: number; } export declare class ConfigurationBackupManager { private backupDirectory; private metadataFile; private backups; private backupSets; private policies; constructor(backupDirectory?: string); /** * Create a backup of a single file */ createBackup(sourceFile: string, reason?: BackupMetadata['reason'], tags?: string[], relatedUpdates?: string[]): Promise<BackupMetadata>; /** * Create a backup set for multiple files */ createBackupSet(files: string[], name: string, description: string, relatedChanges?: string[]): Promise<BackupSet>; /** * Restore a single backup */ restoreBackup(backupId: string, targetPath?: string, overwrite?: boolean): Promise<RestoreResult>; /** * Restore a backup set */ restoreBackupSet(backupSetId: string, targetDirectory?: string, overwrite?: boolean): Promise<RestoreResult>; /** * List all backups */ listBackups(filter?: { sourceFile?: string; reason?: BackupMetadata['reason']; tags?: string[]; afterDate?: Date; beforeDate?: Date; }): BackupMetadata[]; /** * List all backup sets */ listBackupSets(): BackupSet[]; /** * Verify backup integrity */ verifyBackups(backupIds?: string[]): Promise<BackupVerificationResult>; /** * Apply retention policies to clean up old backups */ applyRetentionPolicies(): Promise<{ deletedBackups: string[]; totalSpaceFreed: number; errors: string[]; }>; /** * Delete a backup */ deleteBackup(backupId: string): Promise<boolean>; /** * Get backup statistics */ getBackupStatistics(): { totalBackups: number; totalBackupSets: number; totalSize: number; oldestBackup?: Date; newestBackup?: Date; backupsByReason: Record<string, number>; compressionRatio: number; }; /** * Add backup policy */ addBackupPolicy(policy: BackupPolicy): void; /** * Remove backup policy */ removeBackupPolicy(policyId: string): boolean; /** * Private: Perform the actual restore operation */ private performRestore; /** * Private: Initialize backup directory structure */ private initializeDirectory; /** * Private: Load backup metadata from disk */ private loadMetadata; /** * Private: Save backup metadata to disk */ private saveMetadata; /** * Private: Initialize default backup policies */ private initializeDefaultPolicies; /** * Private: Generate unique backup ID */ private generateBackupId; /** * Private: Determine if file should be compressed */ private shouldCompress; /** * Private: Apply default retention policy */ private applyDefaultRetention; /** * Private: Apply retention policy to backups */ private applyRetentionPolicy; /** * Private: Get backups that match a policy */ private getBackupsForPolicy; /** * Private: Format file size for display */ private formatSize; } //# sourceMappingURL=backup-manager.d.ts.map