import { type Code } from "ts-poet"; import { type MetaObject } from "@metaobjectsdev/metadata"; import type { RenderContext } from "../render-context.js"; /** Get the PK field name and its TS type for a given entity. */ export declare function getPkInfo(entity: MetaObject, ctx: RenderContext): { fieldName: string; tsType: string; }; /** All primary-key field names, in order. `getPkInfo` exposes only the first (the * query layer's single-PK finder/update signatures key on it); #214's write-through * create re-read keys on ALL of them so a composite PK re-reads the exact written row * (via the insert's returning() values), not any row sharing the first key component. */ export declare function getPkFields(entity: MetaObject): string[]; export declare function renderFindByIdFn(entity: MetaObject, ctx: RenderContext, readVar?: string): Code; export declare function renderListFn(entity: MetaObject, ctx: RenderContext, readVar?: string): Code; export declare function renderCreateFn(entity: MetaObject, ctx: RenderContext): Code; /** * #203 — the `insertPreserving` escape hatch. Cross-port with the Java / * Kotlin / C# / Python ports: emitted ONLY for an entity that declares @autoSet * fields, it persists the row WITHOUT the create-time now() stamp — the @autoSet * columns are written verbatim from the caller's data — for import / restore / * replication paths that must keep the original timestamps. It validates through * `InsertPreservingSchema` (the preserving-shape schema whose @autoSet * columns carry no transform); the normal `create` always stamps now(). */ export declare function renderInsertPreservingFn(entity: MetaObject, ctx: RenderContext): Code; export declare function renderUpdateFn(entity: MetaObject, ctx: RenderContext): Code; export declare function renderDeleteByIdFn(entity: MetaObject, ctx: RenderContext): Code; /** * One reverse FK finder pair (ADR-0038): the entity holding this FK (`E`) gains * `findBy(value)` (single, `WHERE fk = ?`) and * `findByIn(values)` (batched, `WHERE fk IN (…)`, anti-N+1) so * the referenced entity `T` can navigate to its referencing `E` rows by calling * the finder with a `T` id. Both are plain, framework-free, single-query reads. */ interface ReverseFk { /** FK FIELD name on this entity (logical), e.g. `currentSceneId`. */ fkField: string; /** Target entity (the `T` referenced), e.g. `Scene`. Drives the value TS type. */ targetEntity: string; } /** Collect this entity's OWN reverse FK targets, in declaration order. */ export declare function reverseFksFor(entity: MetaObject): ReverseFk[]; /** Render the single + batched reverse finders for one FK on `entity`. `readVar` * (#214) routes the SELECT to a write-through entity's replica view; absent, it * reads the entity's own table (vanilla, byte-identical). */ export declare function renderReverseFinderFns(entity: MetaObject, fk: ReverseFk, ctx: RenderContext, readVar?: string): Code; export {}; //# sourceMappingURL=queries.d.ts.map