UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

102 lines 3.37 kB
/** * Change History Tracker for Optimizely MCP Server * @description Manages change history tracking and deduplication for incremental sync */ import { SQLiteEngine } from '../storage/SQLiteEngine.js'; import { OptimizelyAPIHelper } from '../api/OptimizelyAPIHelper.js'; export interface ChangeEvent { project_id: string; entity_type: 'flag' | 'experiment' | 'campaign' | 'audience' | 'page' | 'event' | 'attribute'; entity_id: string; entity_name?: string; action: 'created' | 'updated' | 'deleted' | 'archived'; timestamp: string; changed_by?: string; change_summary?: string; } export interface SyncState { project_id: string; last_sync_time: string; last_successful_sync?: string; sync_in_progress: boolean; error_count: number; last_error?: string; } /** * Tracks and manages change history for incremental synchronization */ export declare class ChangeHistoryTracker { private storage; private api; constructor(storage: SQLiteEngine, api: OptimizelyAPIHelper); /** * Gets the last sync state for a project */ getSyncState(projectId: string): Promise<SyncState | null>; /** * Updates the sync state for a project */ updateSyncState(projectId: string, state: Partial<SyncState>): Promise<void>; /** * Gets the project type information from the database */ private getProjectType; /** * Gets changes since a specific timestamp for a project */ getChangesSince(projectId: string, since: Date): Promise<ChangeEvent[]>; /** * Gets changes for Feature Experimentation projects */ private getFeatureExperimentationChanges; /** * Gets changes for Web Experimentation projects using direct API call */ private getWebExperimentationChanges; /** * Transforms Feature Experimentation API responses to ChangeEvent format */ private transformFeatureExperimentationChanges; /** * Transforms Web Experimentation API responses to ChangeEvent format * NOTE: Both Web and Feature Experimentation use the same change history API format */ private transformWebExperimentationChanges; /** * Deduplicates changes to unique entities */ deduplicateChanges(changes: ChangeEvent[]): Promise<Map<string, Set<string>>>; /** * Records a change event in the database */ recordChange(change: ChangeEvent): Promise<void>; /** * Records multiple change events in a batch */ recordChanges(changes: ChangeEvent[]): Promise<void>; /** * Maps Optimizely's entity.type to our entity_type */ private mapEntityType; /** * Maps Optimizely's change_type to our action type */ private mapChangeType; /** * Maps Optimizely's target_type to our entity_type (legacy method for backward compatibility) */ private mapTargetType; /** * Maps Optimizely's action to our action type (legacy method for backward compatibility) */ private mapAction; /** * Gets the count of unsynced changes */ getUnsyncedChangeCount(projectId: string): Promise<number>; /** * Marks changes as synced */ markChangesSynced(projectId: string, entityType: string, entityId: string): Promise<void>; } //# sourceMappingURL=ChangeHistoryTracker.d.ts.map