@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
71 lines • 2.36 kB
TypeScript
/**
* Schema-Aware Entity Builder
*
* This class builds entities with intelligent defaults and validation before sending to the API.
* It solves the jQuery 1.11.3 problem by applying modern defaults that override Optimizely's legacy settings.
*/
import { EntityName } from '../generated/fields.generated.js';
import { ConfigurableDefaultsManager } from '../defaults/ConfigurableDefaultsManager.js';
interface EntityContext {
platform?: string;
projectId?: string;
parentEntity?: string;
operation?: string;
options?: Record<string, any>;
}
export declare class SchemaAwareEntityBuilder {
private defaultsManager;
private logger;
private prescriptiveValidator;
constructor(defaultsManager: ConfigurableDefaultsManager);
/**
* Detect platform based on entity type and context
*/
private detectPlatform;
/**
* Build an entity with intelligent defaults and validation
* This is the main method that solves the jQuery problem
*/
buildEntity<T extends EntityName>(entityType: T, userInput: Record<string, any>, context?: EntityContext): Record<string, any>;
/**
* Apply context-aware adjustments (e.g., platform-specific defaults)
*/
private applyContextAdjustments;
/**
* Convert field types based on schema field types
*/
private convertTypes;
/**
* Add entity-specific validation rules not captured in the schema
*/
private addEntitySpecificValidation;
/**
* Try to build audience conditions from natural language description
*/
private tryBuildConditionsFromDescription;
/**
* Validate entity against schema requirements
*/
private validateEntity;
/**
* Get current defaults for an entity type (for guidance/documentation)
*/
getCurrentDefaults<T extends EntityName>(entityType: T, context?: {
platform?: 'web' | 'feature';
projectId?: string;
}): any;
/**
* Get available templates for an entity type
*/
getAvailableTemplates(): string[];
/**
* Log what defaults were applied for debugging and transparency
*/
private logDefaultsApplied;
/**
* Deep merge multiple objects with proper array and object handling
*/
private deepMerge;
}
export {};
//# sourceMappingURL=SchemaAwareEntityBuilder.d.ts.map