UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

247 lines 5.85 kB
/** * Entity Migration Types * @description Type definitions for the entity migration system */ /** * Configuration for entity migration between projects */ export interface MigrationConfig { source: { projectId: string; token?: string; }; destination: { projectId: string; token?: string; }; entities?: EntitySelection; mappings?: MappingDictionary; options?: MigrationOptions; resumeFrom?: MigrationCheckpoint; } /** * Entity selection configuration */ export interface EntitySelection { types?: EntityType[]; ids?: Record<EntityType, string[]>; includeArchived?: boolean; filter?: Record<string, any>; } /** * Mapping dictionary for entity references */ export interface MappingDictionary { events?: Record<string, string>; audiences?: Record<string, string>; attributes?: Record<string, string>; flags?: Record<string, string>; experiments?: Record<string, string>; campaigns?: Record<string, string>; pages?: Record<string, string>; [entityType: string]: Record<string, string> | undefined; } /** * Migration options */ export interface MigrationOptions { rollbackStrategy: 'partial' | 'all-or-nothing'; conflictResolution: 'skip' | 'update' | 'create-copy' | 'ask'; dryRun?: boolean; validateOnly?: boolean; continueOnError?: boolean; maxRetries?: number; retryDelay?: number; interactiveMode?: boolean; } /** * Entity types supported for migration */ export type EntityType = 'event' | 'attribute' | 'audience' | 'flag' | 'experiment' | 'campaign' | 'page' | 'extension' | 'group' | 'webhook' | 'collaborator' | 'environment'; /** * Migration checkpoint for resume capability */ export interface MigrationCheckpoint { id: string; timestamp: string; phase: string; completedEntities: CompletedEntity[]; currentEntity?: { type: EntityType; id: string; operation: 'fetch' | 'transform' | 'create' | 'validate'; }; mappingState: Record<string, Record<string, string>>; } /** * Completed entity record */ export interface CompletedEntity { type: EntityType; sourceId: string; destinationId: string; name?: string; timestamp: string; } /** * Migration progress for real-time updates */ export interface MigrationProgress { phase: 'initializing' | 'analyzing' | 'validating' | 'migrating' | 'finalizing'; currentEntity?: { type: EntityType; id: string; name?: string; index: number; total: number; }; overall: { totalEntities: number; completedEntities: number; failedEntities: number; skippedEntities: number; }; performance: { startTime: number; elapsedTime: number; estimatedTimeRemaining?: number; entitiesPerSecond?: number; }; errors: MigrationError[]; checkpoint?: MigrationCheckpoint; } /** * Migration error details */ export interface MigrationError { timestamp: string; entityType: EntityType; entityId: string; operation: string; error: string; recoverable: boolean; retryCount?: number; } /** * Migration result */ export interface MigrationResult { id: string; success: boolean; startTime: string; endTime: string; duration: number; source: { projectId: string; projectName?: string; }; destination: { projectId: string; projectName?: string; }; summary: { totalEntities: number; successfulEntities: number; failedEntities: number; skippedEntities: number; }; entities: MigratedEntity[]; errors: MigrationError[]; checkpoint?: MigrationCheckpoint; report?: MigrationReport; } /** * Individual migrated entity record */ export interface MigratedEntity { type: EntityType; sourceId: string; destinationId: string; name?: string; status: 'success' | 'failed' | 'skipped'; error?: string; duration: number; retries?: number; } /** * Migration execution plan */ export interface ExecutionPlan { phases: ExecutionPhase[]; totalOperations: number; estimatedDuration?: number; dependencies: DependencyMap; } /** * Execution phase */ export interface ExecutionPhase { name: string; order: number; entities: EntityOperation[]; dependencies: string[]; } /** * Entity operation in execution plan */ export interface EntityOperation { type: EntityType; id: string; name?: string; dependencies: string[]; operation: 'create' | 'update' | 'skip'; } /** * Dependency mapping */ export interface DependencyMap { [entityId: string]: { type: EntityType; dependsOn: string[]; requiredBy: string[]; }; } /** * Migration report */ export interface MigrationReport { summary: { totalDuration: string; entitiesPerSecond: number; successRate: number; }; byEntityType: Record<EntityType, { total: number; successful: number; failed: number; skipped: number; averageDuration: number; }>; errors: Array<{ entityType: EntityType; entityId: string; error: string; suggestion?: string; }>; warnings: string[]; recommendations: string[]; } /** * Reference info for transformation */ export interface ReferenceInfo { fieldName: string; referenceType: 'id' | 'key' | 'array'; targetEntityType: EntityType; isRequired: boolean; } /** * Transformation context */ export interface TransformationContext { entityType: EntityType; sourceEntity: any; mappings: MappingDictionary; createdEntities: Map<string, string>; } //# sourceMappingURL=types.d.ts.map