@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
144 lines • 3.47 kB
TypeScript
/**
* Core Template Validator
*
* Validates orchestration templates against both OpenAPI schema requirements
* and orchestration-specific rules that extend beyond the base API.
*/
export interface ValidationError {
code: string;
severity: 'error' | 'warning' | 'fatal';
stepId?: string;
path: string;
message: string;
found?: any;
expected?: any;
fix?: {
description: string;
path: string;
value: any;
};
}
export interface ValidationResult {
valid: boolean;
errors: ValidationError[];
warnings: ValidationError[];
summary: {
totalSteps: number;
validSteps: number;
errorCount: number;
warningCount: number;
};
performance?: {
duration: number;
rulesChecked: number;
};
}
export interface ValidationContext {
platform: 'web' | 'feature' | 'both';
mode?: 'template' | 'direct';
projectId?: string;
currentStep?: any;
template?: any;
}
export interface ValidationRule {
id: string;
name: string;
description: string;
validate: (context: ValidationContext) => ValidationError | null | Promise<ValidationError | null>;
}
/**
* Main Template Validator Class
*/
export declare class TemplateValidator {
private rules;
private startTime;
private rulesChecked;
private orchestrationRules;
private referenceResolver;
constructor();
/**
* Initialize all validation rules
*/
private initializeRules;
/**
* Add a validation rule
*/
private addRule;
/**
* Main validation entry point
*/
validate(template: any): Promise<ValidationResult>;
/**
* Create validation result
*/
private createResult;
/**
* Validate template structure
*/
private validateTemplateStructure;
/**
* Rule Implementation: Metrics Scope
*/
private validateMetricsScope;
/**
* Rule Implementation: Audience Complexity
*/
private validateAudienceComplexity;
/**
* Rule Implementation: Reference Format
*/
private validateReferenceFormat;
/**
* Rule Implementation: Platform Compatibility
*/
private validatePlatformCompatibility;
/**
* Rule Implementation: Required Fields
*/
private validateRequiredFields;
/**
* Rule Implementation: Field Type Validation
*/
private validateFieldTypes;
/**
* Rule Implementation: Orchestration Rules Validation
*/
private validateOrchestrationRules;
/**
* Rule Implementation: Traffic Allocation Validation
*/
private validateTrafficAllocation;
/**
* Redistribute weights to sum to 10000
*/
private redistributeWeights;
/**
* Extract entity type from system template ID
*/
private extractEntityType;
/**
* Get actual type of a value
*/
private getActualType;
/**
* Check if value matches expected type
*/
private isTypeMatch;
/**
* Apply auto-fixes to a template
*/
applyAutoFixes(template: any): Promise<{
fixedTemplate: any;
fixes: Array<{
path: string;
oldValue: any;
newValue: any;
description: string;
}>;
}>;
/**
* Format validation results for display
*/
formatResults(result: ValidationResult): string;
}
//# sourceMappingURL=TemplateValidator.d.ts.map