import { type SchemaManifest, type ViewManifest } from "@aotter/mantle-spec"; import type { ViewQueryOptions } from "../../domain/port/ViewQueryExecutor.js"; import { type LogicalViewPlan } from "../../domain/service/RuntimePlanCompiler.js"; /** * View → SQL compilation. Targets SQLite + JSON1 (D1's dialect). * Reserved metadata and Schema fields map directly to native columns. * SQL uses positional `?` parameters; identifiers come only from the * linked RuntimePlan. * * v0.1 filter AST supports comparison operators (`eq`, `gt`, `gte`, * `lt`, `lte`) plus `and` / `or`; comparison values may be literals or * `{ $param: }` sentinels substituted from `options.params`, plus * `{ "$ctx.user": "id" }` bound from the normalized site caller. Pagination * knobs `page` / `show` come in via * `options`; the runtime owns the LIMIT/OFFSET emission. */ export interface CompiledView { readonly sql: string; readonly params: readonly unknown[]; readonly effectivePage: number; readonly effectiveShow: number; } export type CompileViewOptions = ViewQueryOptions; export interface PreparedSqliteView { bind(options?: CompileViewOptions): CompiledView; normalizeRows(rows: readonly R[]): readonly R[]; } export declare function compileView(view: ViewManifest, options?: CompileViewOptions, schema?: SchemaManifest): CompiledView; /** Lower one logical View into a reusable SQLite query binder. */ export declare function prepareSqliteView(view: LogicalViewPlan, viewName: string, schema?: SchemaManifest): PreparedSqliteView; //# sourceMappingURL=SqliteViewCompiler.d.ts.map