import { type Code } from "ts-poet"; import type { MetaObject, MetaField } from "@metaobjectsdev/metadata"; import { type RenderContext } from "../render-context.js"; /** * Emit Drizzle's InferSelectModel / InferInsertModel aliases for an entity. * * `tphBase` (FR-017): when this entity is a TPH discriminator base, the * discriminated-union type (emitted by the tph-discriminator template) owns the * bare `` name, so the raw single-table row type is emitted as `Row` * to avoid a duplicate `export type `. Insert/Update keep their names * (no collision); they describe the physical TPH table row shape. */ export declare function renderInferredTypes(entity: MetaObject, tphBase?: boolean, ctx?: RenderContext, skipRow?: boolean): Code; /** * The string-literal-union type-alias name for a `field.enum` field — the SINGLE * source of truth for enum-union naming (reused by the entity inferred-types * emitter AND the payload-VO emitter so both agree byte-for-byte). * * - If the field extends an abstract field.enum (super), use the super field's * PascalCase name (so multiple fields sharing one abstract enum collapse to a * single alias). * - Otherwise use `` for inline enums, where `` is the * owning object's name (entity OR payload value-object). */ export declare function enumUnionAliasName(ownerName: string, field: MetaField): string; /** The `"A" | "B"` union string for a set of enum member values. */ export declare function enumUnionString(values: string[]): string; /** * Emit the enum type-alias section for an entity file. Three cases per field: * * • inline enum (members declared directly on the field; no root-abstract super) * → `export type = "A" | "B";` — UNCHANGED (byte-identical). * • shared materialized enum (extends a NON-@provided root-level abstract * field.enum) → re-export the materialized type from the shared `./enums` * module (`export { type E } from "./enums"`) instead of redeclaring it. The * type is materialized ONCE in enums.ts (FR-019). * • provided enum (extends a @provided root-level abstract field.enum) → * re-export the type from the configured external module * (`export { type E } from ""`); metaobjects emits no * declaration for it. A missing config is a codegen-time error. * * `ctx` is required to compute the shared/provided import specifiers. Returns * null when the entity has no enum-alias lines to emit. */ export declare function renderEnumTypeAliases(entity: MetaObject, ctx?: RenderContext): Code | null; /** * The PLAIN-STRING TS type expression for a field — the SINGLE source of truth * for "what TS type does the codegen give this field". `valueObjectFieldType` * (which returns a `Code` so cross-module `field.object` refs hoist via * `imp(...)`) makes the SAME per-branch decisions; this string form exists for * consumers (the api-docs field-shape builder) that need the type name as text, * not a hoisting `Code`. The branch logic MUST stay in lock-step with * `valueObjectFieldType` below. * * • field.object → the referenced object's bare (package-stripped) name, `[]` * when an array; `unknown` / `unknown[]` when the @objectRef is missing. * • field.enum → the same enum-union alias `enumUnionAliasName` emits * (`` or the abstract super's PascalCase), `string` fallback. * • scalar → SCALAR_TS_BY_SUBTYPE (else `unknown`), `[]` when an array. */ export declare function fieldTsTypeString(ownerName: string, field: MetaField): string; /** * Emit a structural `interface { ... }` for a value-only object. * * Optional fields use `name?: T` (matching the Zod `.optional()` inference * `T | undefined`) instead of `name?: T | null`. Value objects never round- * trip through Drizzle nullable columns, so the null-bridge is unnecessary * here — and forces consumers into a residual cast at the call site. */ export declare function renderValueObjectInterface(entity: MetaObject, ctx?: RenderContext): Code; //# sourceMappingURL=inferred-types.d.ts.map