@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
89 lines • 2.76 kB
TypeScript
/**
* Update Template Handler
*
* Handles UPDATE operations that contain template-like structures (e.g., ab_test)
* and converts them into the correct sequence of API operations.
*
* This bridges the gap between:
* - EntityOrchestrator (CREATE with ab_test templates) ← WORKS
* - EntityRouter (UPDATE with ab_test structures) ← WAS FAILING
*
* @author Optimizely MCP Server
* @version 1.0.0
*/
import { EntityRouter } from '../tools/EntityRouter.js';
export interface UpdateTemplateResult {
success: boolean;
requiresTemplateHandling: boolean;
operations?: Array<{
step: number;
description: string;
operation: string;
entity_type: string;
data: any;
result?: any;
}>;
result?: any;
error?: string;
guidance?: string;
}
export declare class UpdateTemplateHandler {
private logger;
private entityRouter;
constructor(entityRouter: EntityRouter);
/**
* Check if an update operation requires template handling
*/
requiresTemplateHandling(entityType: string, operation: string, data: any): boolean;
/**
* Handle update operation with template-like structure
*/
handleTemplateUpdate(entityType: string, projectId: string, entityId: string, data: any, options?: any): Promise<UpdateTemplateResult>;
/**
* Handle flag update with ab_test structure
*/
private handleFlagAbTestUpdate;
/**
* Handle flag update with new_variation structure (flag_add_variation template)
*/
private handleFlagAddVariationUpdate;
/**
* Handle flag update with traffic_allocation structure (flag_update_traffic template)
*/
private handleFlagTrafficUpdate;
/**
* Handle variable definitions update for Feature Flags
*/
private handleFlagVariablesUpdate;
/**
* Handle audience conditions update for Feature Flags
*/
/**
* Generate a valid rule key based on audience conditions and timestamp
*/
private generateRuleKey;
private handleFlagAudienceUpdate;
/**
* Handle flag metrics update
* Updates metrics on existing flag rules
*/
private handleFlagMetricsUpdate;
/**
* Handle flag variations update
* Updates variation properties (name, percentage_included) on existing variations
*/
private handleFlagVariationsUpdate;
/**
* Handle experiment update with various structures (variations, metrics, etc.)
*/
private handleExperimentUpdate;
/**
* Handle page conditions update
*/
private handlePageConditionsUpdate;
/**
* Handle page activation update
*/
private handlePageActivationUpdate;
}
//# sourceMappingURL=UpdateTemplateHandler.d.ts.map