UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

109 lines 2.72 kB
/** * Query Normalizer for Intelligent Query Caching * * Converts natural language queries and variations into a standardized format * for consistent cache key generation and semantic understanding. */ export interface NormalizedQuery { entity: string; operation: string; filters: Record<string, any>; projections: string[]; joins: string[]; aggregations: string[]; groupBy?: string[]; orderBy?: Array<{ field: string; direction: 'asc' | 'desc'; }>; limit?: number; timeRange?: TimeRange; projectId?: string; } export interface TimeRange { type: 'relative' | 'absolute'; start?: string | Date; end?: string | Date; duration?: string; } export interface StructuredQuery { select?: string[]; from: string; where?: Record<string, any>; joins?: Array<{ entity: string; on: string; }>; groupBy?: string[]; orderBy?: Array<{ field: string; direction: 'asc' | 'desc'; }>; limit?: number; } export declare class QueryNormalizer { private readonly logger; private readonly queryPatterns; private readonly entitySynonyms; private readonly timePatterns; /** * Normalize a query from natural language or structured format */ normalize(query: string | StructuredQuery | any): NormalizedQuery; /** * Normalize a natural language query */ private normalizeNaturalLanguage; /** * Normalize a UniversalQuery format */ private normalizeUniversalQuery; /** * Normalize a structured query */ private normalizeStructuredQuery; /** * Extract entity type from query */ private extractEntity; /** * Extract operation type from query */ private extractOperation; /** * Extract filters from query */ private extractFilters; /** * Extract time range from query */ private extractTimeRange; /** * Extract aggregation functions */ private extractAggregations; /** * Extract aggregations from projection fields */ private extractAggregationsFromProjections; /** * Extract group by fields */ private extractGroupBy; /** * Extract implicit joins based on query context */ private extractImplicitJoins; /** * Extract limit from query */ private extractLimit; /** * Check if two normalized queries are semantically equivalent */ areEquivalent(query1: NormalizedQuery, query2: NormalizedQuery): boolean; private objectsEqual; private arraysEqual; private timeRangesEqual; } //# sourceMappingURL=QueryNormalizer.d.ts.map