import type { FilterAstNode, ProductAttribute } from '../types/product.js'; export type AttributeSelectionMap = Partial>; export declare function selectionMapToAst(selections: AttributeSelectionMap): FilterAstNode | null; export declare function astToExpression(ast: FilterAstNode | null): string; /** * Pretty FilterQL for docs/API samples: spaced operators and single-quoted literals * (avoids JSON-style `\"` noise when embedded in JSON bodies). */ export declare function filterAstToReadableQl(ast: FilterAstNode | null): string; /** * Parse if possible and return readable QL; otherwise return the original string trimmed. */ export declare function filterExpressionToReadableQl(expression: string): string; /** * Body field `filterExpression` for POST /product/search: prefer the stored FilterQL string; * if missing, serialize AST to readable FilterQL. Omits when there is no filter. */ export declare function toProductSearchFilterExpression(filterAst: FilterAstNode | null, filterExpression: string | null | undefined): string | undefined; export declare function equalsIgnoreCase(a: string, b: string): boolean; export declare function hasComparisonClause(ast: FilterAstNode | null, attribute: ProductAttribute, value: string): boolean; /** Flatten a tree of ANDs into top-level conjuncts; OR or single node stays one conjunct. */ export declare function flattenAndConjuncts(ast: FilterAstNode): FilterAstNode[]; export type AddComparisonClauseResult = { ast: FilterAstNode; error: null; } | { ast: null; error: string; }; /** * Add a comparison for an attribute by OR-ing with the existing subtree for that attribute * (same-attribute values are alternatives). Different attributes remain AND-ed at the top level. * Legacy shapes like (category = A AND category = B) OR category = C when adding a third category. * Returns an error for mixed-attribute conjuncts, non-contiguous attribute clauses, or non-= ops on the attribute. */ export declare function addComparisonClause(ast: FilterAstNode | null, attribute: ProductAttribute, value: string): AddComparisonClauseResult; export declare function pruneAst(ast: FilterAstNode | null, shouldRemove: (node: Extract) => boolean): FilterAstNode | null; //# sourceMappingURL=filterAstBuilder.d.ts.map