@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
89 lines • 2.49 kB
TypeScript
/**
* Fields Schema Resolver
* @description Resolves field paths from FIELDS generated structure
*
* Purpose: Parse and traverse the FIELDS object to build queryable field paths
* for the Dynamic JSON Query Engine. This adapts to the actual structure of
* fields.generated.ts which contains field definitions rather than full schemas.
*
* Key Features:
* - Loads and parses FIELDS from fields.generated.ts
* - Builds queryable paths from field definitions
* - Handles nested objects and arrays based on field types
* - Generates dot-notation paths for all queryable fields
* - Caches results for performance
*
* @author Optimizely MCP Server
* @version 1.0.0
*/
interface ResolvedPath {
fullPath: string;
sqlPath: string;
jsonataPath: string;
type: string;
nullable: boolean;
description?: string;
enum?: string[];
example?: any;
entityType: string;
fieldName: string;
depth: number;
}
export declare class FieldsSchemaResolver {
private logger;
private pathCache;
private fields;
private fieldsPath;
constructor(fieldsPath?: string);
/**
* Initialize by loading the generated fields file
*/
initialize(): Promise<void>;
/**
* Get all queryable paths for an entity type
*/
getQueryablePaths(entityType: string): Promise<ResolvedPath[]>;
/**
* Normalize field type to standard types
*/
private normalizeFieldType;
/**
* Add common nested paths based on entity and field
*/
private addCommonNestedPaths;
/**
* Add known nested structures based on entity type
*/
private addKnownNestedStructures;
private addFlagPaths;
private addExperimentPaths;
private addVariationPaths;
private addAudiencePaths;
/**
* Build SQL path for JSON_EXTRACT
*/
private buildSqlPath;
/**
* Build JSONata path
*/
private buildJsonataPath;
/**
* Get field type information
*/
getFieldType(entityType: string, fieldPath: string): Promise<any | null>;
/**
* Search for fields matching a pattern
*/
searchFields(entityType: string, pattern: string): Promise<ResolvedPath[]>;
/**
* Get all entity types with fields
*/
getAvailableEntityTypes(): string[];
/**
* Clear all caches
*/
clearCache(): void;
}
export declare const fieldsSchemaResolver: FieldsSchemaResolver;
export {};
//# sourceMappingURL=FieldsSchemaResolver.d.ts.map