import type { Expr } from "./ast.ts"; import type { GenerateCtx } from "./codegen.ts"; export type MatchTranslation = { /** The translated query-language fragment. Empty when nothing translated. */ query: Record; /** Remaining expression that couldn't be translated. Null when fully translated. */ residual: Expr | null; }; /** * Merge a `MatchTranslation` into a single query document: the index-friendly * `query` conjuncts plus, when present, the untranslatable `residual` lowered * through codegen and wrapped in `$expr`. Returns `null` for a vacuous predicate * (empty query, no residual) so callers can skip emitting a `$match` entirely. * * This is the one place the four-way query / `$expr` emission lives — vacuous → * `null`; pure query → `query`; pure residual → `{ $expr }`; both → merged. Every * consumer of `translateMatchBody` (the top-level Filter in index.ts, the * `$match` stage body in pipeline.ts, and `matchStagesFromTranslation` for the * sub-pipeline translators) routes through it so the emitted shape can't drift. */ export declare function mergeTranslatedQuery(t: MatchTranslation, ctx: GenerateCtx): Record | null; /** * Optional context passed in by the pipeline lowerer. `bindings` lets the * translator treat function-form parameter references as literals — the * `ParamRef` node still says "param x", but its value at this codegen call * is a compile-time constant from `jsmql.compile(fn)(params)`. Without this * hook the index-friendly path can't see across the binding and would emit * `$expr` for every comparison that touches a parameter. */ export type TranslateCtx = { bindings?: ReadonlyMap; }; export declare function translateMatchBody(body: Expr, ctx?: TranslateCtx): MatchTranslation; //# sourceMappingURL=match-translation.d.ts.map