/** * postgres-mcp - JSONB Schema Utilities * * Path normalization, preprocessing, and helper functions for JSONB operations. * * PATH FORMAT NORMALIZATION: * All tools now accept BOTH formats for paths: * - STRING: 'a.b[0]' or 'a.b.0' (dot notation) * - ARRAY: ['a', 'b', '0'] */ /** * Convert a string path to array format * 'a.b[0].c' → ['a', 'b', '0', 'c'] * 'a.b.0' → ['a', 'b', '0'] * '[-1]' → ['-1'] (supports negative indices) */ export declare function stringPathToArray(path: string): string[]; /** * Convert array path to string format for extract * ['a', 'b', '0'] → 'a.b.0' */ export declare function arrayPathToString(path: string[]): string; /** * Normalize path to array format (for set/insert handlers) * Accepts both string paths and arrays with mixed string/number elements */ export declare function normalizePathToArray(path: string | number | (string | number)[]): string[]; /** * Normalize path for jsonb_insert - converts numeric path segments to numbers * PostgreSQL jsonb_insert requires integer indices for array access * 'tags.0' → ['tags', 0] (number, not string) * 0 → [0] (bare number wrapped in array) */ export declare function normalizePathForInsert(path: string | number | (string | number)[]): (string | number)[]; /** * Normalize path to string format (for extract handler) * Accepts both string paths and arrays with mixed string/number elements */ export declare function normalizePathToString(path: string | number | (string | number)[]): string; /** * Parse JSON string values for JSONB value parameters * MCP clients may send objects as JSON strings */ export declare function parseJsonbValue(value: unknown): unknown; /** * Preprocess JSONB tool parameters to normalize common input patterns. * Handles aliases and schema.table format parsing. * Exported so tools can apply it in their handlers. * * SPLIT SCHEMA PATTERN: * - Base schemas use optional table/tableName with .refine() for MCP visibility * - Handlers use z.preprocess(preprocessJsonbParams, BaseSchema) for alias resolution */ export declare function preprocessJsonbParams(input: unknown): unknown; //# sourceMappingURL=utils.d.ts.map