import { MetaObject, type MetaRoot } from "@metaobjectsdev/metadata"; import type { ColumnNamingStrategy } from "../metaobjects-config.js"; import { type RenderContext } from "../render-context.js"; export interface ProjectionDeclOpts { readonly columnNamingStrategy: ColumnNamingStrategy; readonly dialect: "postgres" | "sqlite"; readonly apiPrefix?: string; /** Drives the timestamp column TS type (Date vs string) in the view declaration. */ readonly timestampMode?: "date" | "string"; /** * When false, omit the Fastify-flavored filter/sort allowlists (and their * `runtime-ts` import) — mirrors entity-file's `allowlists` option so a * dependency-free consumer (no runtime-ts) gets compilable output. */ readonly allowlists?: boolean; /** * Render context, when available — used to resolve value-object import MODULES * (`.$type()` + the VO Zod schema) in a layout/package/extStyle-aware way. * Absent in bare unit-test calls, which fall back to a flat same-dir import. */ readonly ctx?: RenderContext; /** * Whether to emit the Drizzle `.existing()` view declaration (and its * drizzle-orm import). Default true. Set false for a contract-only output * (Zod read schema + inferred type + constants, no runtime DB dependency) — * e.g. a shared types package consumed by a web client that has no Drizzle. */ readonly includeViewDecl?: boolean; } /** * Render a TypeScript module for a projection entity. Emits: * - `View` — Drizzle `pgView` / `sqliteView` with `.existing()` * - `Schema` — Zod read schema (no insert/update) * - `` — `z.infer` type alias * - `` const — constants block ($entity, $view, $path, per-field metadata) * * @param projection The projection entity (has a source[dbView] child). * @param root The loader's root (all top-level objects as direct children, * from `MetaDataLoader.load()` or `MetaDataLoader.fromDirectory()` as `result.root`). * @param opts Column naming strategy + dialect. */ export declare function renderProjectionDecl(projection: MetaObject, root: MetaRoot, opts: ProjectionDeclOpts): string; //# sourceMappingURL=projection-decl.d.ts.map