UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

117 lines 3.44 kB
/** * Orchestration Rules Layer * * This layer adds orchestration-specific validation and transformation rules * on top of the base OpenAPI fields from fields.generated.ts */ export interface ValidationContext { platform: 'web' | 'feature' | 'both'; mode: 'template' | 'direct'; operation: string; entityType: string; step?: any; template?: any; variables?: any; rules?: any; flag?: any; } export interface OrchestrationRule { override?: any; validation?: (value: any, context?: ValidationContext) => boolean; error?: string; modes?: { template?: { fieldName: string; format: string; }; direct?: { fieldName: string; format: string; }; }; customValidation?: (value: any, context: ValidationContext) => boolean; autoFix?: (value: any, context?: ValidationContext) => any; conditional?: (context: ValidationContext) => boolean; } export interface EnhancedFieldRequirements { required: string[]; optional: string[]; defaults: Record<string, any>; enums: Record<string, any[]>; fieldTypes: Record<string, string>; fieldDescriptions: Record<string, string>; fieldExamples: Record<string, any>; orchestrationRules: Record<string, OrchestrationRule>; getField: (fieldName: string) => EnhancedField; } export interface EnhancedField { name: string; type: string; required: boolean; description?: string; enum?: any[]; example?: any; default?: any; orchestrationRule?: OrchestrationRule; platformOverride?: any; customValidation?: (value: any, context: ValidationContext) => boolean; modeVariations?: { template?: { fieldName: string; format: string; }; direct?: { fieldName: string; format: string; }; }; } export interface ValidationContext { platform: 'web' | 'feature' | 'both'; mode: 'template' | 'direct'; operation: string; entityType: string; actualFieldName?: string; step?: any; template?: any; } export interface ValidationResult { valid: boolean; error?: string; fix?: { value: any; description?: string; }; } export declare class OrchestrationRulesLayer { private baseFields; private orchestrationRules; constructor(); /** * Get fields with orchestration rules applied */ getFieldsWithRules(entityType: string, operation?: string, platform?: string, mode?: string): EnhancedFieldRequirements; /** * Validate a value against both OpenAPI and orchestration rules */ validateField(entityType: string, fieldName: string, value: any, context: ValidationContext): Promise<ValidationResult>; /** * Get all orchestration rules for an entity */ getAllRulesForEntity(entityType: string, operation?: string, platform?: string): Record<string, OrchestrationRule>; /** * Apply auto-fixes to a template step */ applyAutoFixes(step: any, entityType: string, platform?: string, mode?: string): { fixed: boolean; changes: Array<{ field: string; oldValue: any; newValue: any; }>; }; private matchesType; private validateTypeMatch; private getOrchestrationRules; } //# sourceMappingURL=OrchestrationRulesLayer.d.ts.map