UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

212 lines 6.41 kB
/** * RobustIntentParser Type Definitions * * IMPLEMENTATION STATUS: * COMPLETE: Core types defined * 🚧 IN PROGRESS: Adding more specific types as needed * * Last Updated: July 3, 2025 */ import type { QueryIntent as EnhancedQueryIntent, FieldLocalityInfo, JoinHints, AggregationContext as EnhancedAggregationContext, DecomposedQuery } from './enhanced-types'; export type { QueryIntent as EnhancedQueryIntent, FieldLocalityInfo, JoinHints, AggregationContext as EnhancedAggregationContext, AtomicIntent, DecomposedQuery } from './enhanced-types'; export type QueryAction = 'find' | 'list' | 'show' | 'count' | 'group' | 'trend' | 'compare' | 'analyze' | 'summarize' | 'aggregate' | 'error'; export type EntityType = 'flags' | 'flag' | 'experiments' | 'experiment' | 'audiences' | 'audience' | 'variations' | 'variation' | 'rules' | 'rule' | 'rulesets' | 'ruleset' | 'events' | 'event' | 'attributes' | 'attribute' | 'pages' | 'page' | 'projects' | 'project' | 'environments' | 'environment' | 'flag_environments' | 'flag_environment' | 'groups' | 'group' | 'extensions' | 'extension' | 'campaigns' | 'campaign' | 'webhooks' | 'webhook' | 'collaborators' | 'collaborator' | 'accounts' | 'account' | 'list_attributes' | 'list_attribute' | 'web_environments' | 'web_environment' | 'archive_logs' | 'archive_log' | 'results' | 'result' | 'integrations' | 'integration' | 'experiment_results'; export type OperatorType = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'LIKE' | 'NOT LIKE' | 'IN' | 'NOT IN' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL'; export type AggregationType = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'DISTINCT' | 'GROUP_CONCAT'; export type JoinType = 'INNER' | 'LEFT' | 'RIGHT' | 'FULL'; export interface ParsedFilter { field: string; operator: OperatorType; value: any; isJsonPath?: boolean; confidence?: number; } export interface ParsedAggregation { field: string; function: AggregationType; alias?: string; havingCondition?: { operator: OperatorType; value: string | number; }; } export interface OrderByClause { field: string; direction: 'ASC' | 'DESC'; } export interface TimeRange { start?: Date | string; end?: Date | string; relative?: string; } export interface JoinCondition { leftField: string; rightField: string; operator?: OperatorType; } export interface ParsedJoin { type: JoinType; entity: EntityType; on: JoinCondition; alias?: string; } export interface PatternMatch { pattern: string; matched: string; confidence: number; type: 'entity' | 'action' | 'field' | 'filter' | 'aggregation'; } export interface Transformation { type: 'normalize' | 'expand' | 'infer' | 'correct'; from: string; to: string; reason: string; } /** * Main parse result interface */ export interface ParseResult { action: QueryAction; primaryEntity: EntityType; relatedEntities: EntityType[]; fields: string[]; filters: ParsedFilter[]; groupBy: string[]; orderBy: OrderByClause[]; aggregations: ParsedAggregation[]; joins: ParsedJoin[]; confidence: number; platform: 'web' | 'feature' | 'both'; timeRange?: TimeRange; limit?: number; offset?: number; error?: string; normalizedQuery: string; originalQuery: string; transformations: Transformation[]; matchedPatterns: PatternMatch[]; alternatives?: ParseResult[]; queryIntent?: EnhancedQueryIntent; fieldLocality?: Map<string, FieldLocalityInfo>; joinHints?: JoinHints; aggregationContext?: EnhancedAggregationContext; decomposedQuery?: DecomposedQuery; } /** * QueryIntent format (for compatibility with existing system) */ export interface QueryIntent { action: QueryAction; primaryEntity: EntityType; relatedEntities?: EntityType[]; metrics?: string[]; filters?: QueryFilter[]; groupBy?: string[]; orderBy?: OrderBy[]; timeRange?: TimeRange; limit?: number; aggregations?: Array<{ field: string; type: AggregationType; alias?: string; }>; } export interface QueryFilter { field: string; operator: string; value: any; type?: 'property' | 'json' | 'computed'; } export interface OrderBy { field: string; direction: 'asc' | 'desc'; } /** * UniversalQuery format (for IntelligentQueryEngine) */ export interface UniversalQuery { find: EntityType; select?: string[]; where?: WhereCondition[]; joins?: JoinClause[]; groupBy?: string[]; orderBy?: OrderByClause[]; aggregations?: AggregationClause[]; limit?: number; offset?: number; platform?: 'web' | 'feature' | 'both'; error?: string; hints?: { enhancedHints?: { queryIntent?: EnhancedQueryIntent; fieldLocality?: Map<string, FieldLocalityInfo>; joinHints?: JoinHints; aggregationContext?: EnhancedAggregationContext; decomposedQuery?: DecomposedQuery; }; }; } export interface WhereCondition { field: string; operator: OperatorType; value: any; type?: 'AND' | 'OR'; } export interface JoinClause { type: JoinType; entity: EntityType; on: { leftField: string; rightField: string; }; } export interface AggregationClause { field: string; function: AggregationType; alias: string; } /** * Pattern definition interfaces */ export interface EntityPattern { primary: RegExp; synonyms: RegExp[]; aiAgentTerms: RegExp[]; contextClues?: RegExp[]; platform?: 'web' | 'feature' | 'both'; } export interface FieldPattern { canonical: string; patterns: RegExp[]; entity?: EntityType; jsonPath?: string; dataType?: 'string' | 'number' | 'boolean' | 'json' | 'date'; } export interface ActionPattern { action: QueryAction; patterns: RegExp[]; defaultFields?: string[]; impliesAggregation?: boolean; } /** * Cache interfaces */ export interface CacheEntry { query: string; result: ParseResult; timestamp: number; hits: number; } /** * Configuration */ export interface ParserConfig { enableCache?: boolean; cacheSize?: number; confidenceThreshold?: number; fuzzyMatchThreshold?: number; maxAlternatives?: number; timeout?: number; fieldMapper?: any; } //# sourceMappingURL=index.d.ts.map