UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

63 lines 1.91 kB
/** * JSON Path Handler for Intelligent Query Engine * * Handles complex JSON path resolution for nested object queries * Supports paths like $.environments.production.rules[0].variations */ export interface JSONPathSegment { type: 'property' | 'index' | 'wildcard' | 'recursive' | 'filter'; value: string | number | null; filter?: string; } export interface JSONPathParseResult { isValid: boolean; segments: JSONPathSegment[]; sqliteExpression?: string; error?: string; } export declare class JSONPathHandler { private readonly pathCache; /** * Parse a JSON path into segments * Supports: * - $.field.subfield - property access * - $.field[0] - array index * - $.field[*] - wildcard (all array elements) * - $.field..subfield - recursive descent * - $.field[?(@.price > 10)] - filter expressions */ parseJSONPath(path: string): JSONPathParseResult; /** * Find the matching closing bracket */ private findMatchingBracket; /** * Convert parsed segments to SQLite JSON expression */ private convertToSQLiteExpression; /** * Generate SQLite JSON extraction SQL */ generateJSONExtractSQL(columnName: string, jsonPath: string, alias?: string): string; /** * Convert segments to simple SQLite JSON path */ private convertToSimpleSQLitePath; /** * Generate SQL for complex JSON paths (wildcards, filters, etc.) */ private generateComplexJSONSQL; /** * Check if a field path references JSON data */ isJSONPath(fieldPath: string): boolean; /** * Extract the base field name from a JSON path */ getBaseFieldName(jsonPath: string): string; /** * Validate if a JSON path can be used in SQLite */ canUseSQLiteJSONFunctions(jsonPath: string): boolean; } //# sourceMappingURL=JSONPathHandler.d.ts.map