/** * MigrationEngine - Account Migration Orchestrator * * Key Insight: Migration is just `pull(source) + transform + push(dest)` using the SyncEngine. * * This engine: * - Uses the same SyncEngine for all operations (no duplicate code) * - Handles data transformation between accounts * - Verifies migration success * * Benefits: * - No duplicate migration code for each resource type * - Migration inherits all sync improvements automatically * - Easy to add selective migration * - Transformation logic isolated in TransformService */ import { SyncEngine } from '../sync/SyncEngine.js'; import type { CustomerConfig, ILogger } from '../../domain/resources/common/types.js'; import type { AxiosInstance } from 'axios'; /** * Migration options */ export interface MigrationOptions { /** * Resource types to migrate (default: all) */ resourceTypes?: string[]; /** * Skip transformation (direct copy) */ skipTransform?: boolean; /** * Enable verbose logging */ verbose?: boolean; /** * Skip verification step */ skipVerification?: boolean; /** * Dry run mode (don't actually migrate) */ dryRun?: boolean; } /** * Migration result */ export interface MigrationResult { success: boolean; sourceCustomer: string; destCustomer: string; steps: MigrationStep[]; resourceCounts: ResourceCounts; errors: string[]; duration: number; } /** * Individual migration step result */ export interface MigrationStep { name: string; status: 'success' | 'failed' | 'skipped'; message: string; duration: number; } /** * Resource counts for verification */ export interface ResourceCounts { projects: number; agents: number; flows: number; skills: number; attributes: number; integrations: number; connectors: number; akbArticles: number; webhooks: number; } /** * Transform service interface for data transformation */ export interface ITransformService { transformForMigration(sourceDir: string, destDir: string, destCustomerIdn: string): Promise; } export interface TransformResult { filesCopied: number; idsCleared: number; referencesUpdated: number; } /** * Default transform service implementation */ export declare class TransformService implements ITransformService { private logger; constructor(logger: ILogger); transformForMigration(sourceDir: string, destDir: string, _destCustomerIdn: string): Promise; private countFiles; private clearEntityIds; } /** * MigrationEngine - Orchestrates account migration using SyncEngine */ export declare class MigrationEngine { private syncEngine; private transformService; private logger; constructor(syncEngine: SyncEngine, transformService: ITransformService, logger: ILogger); /** * Migrate complete account from source to destination * * This is the main entry point for account migration. * It uses the SyncEngine for pull/push operations. */ migrateAccount(sourceCustomer: CustomerConfig, destCustomer: CustomerConfig, sourceClient: AxiosInstance, destClient: AxiosInstance, options?: MigrationOptions): Promise; /** * Execute the pull step */ private executePullStep; /** * Execute the transform step */ private executeTransformStep; /** * Execute the push step */ private executePushStep; /** * Execute the verify step */ private executeVerifyStep; /** * Empty resource counts for initialization */ private emptyResourceCounts; } /** * Factory function for creating MigrationEngine */ export declare function createMigrationEngine(syncEngine: SyncEngine, logger: ILogger): MigrationEngine; //# sourceMappingURL=MigrationEngine.d.ts.map