/** * Convex schema projection. * * Consumes Manifest IR + projection config and emits a `convex/schema.ts` * string (`defineSchema` / `defineTable` + `convex/values` validators) as a * single `ProjectionArtifact`. * * Boundary rules (mirrors the Prisma projection): * - Relational/document interpretation starts HERE. No Convex concept (table * name, validator, index, reference shape) lives in Manifest core grammar * or IR — all of it arrives via projection options. * - The projection carries NO knowledge of any specific application. Anything * resembling an app-specific string in this file is a bug. * - `computed` properties are derived and MUST NEVER become fields. We do this * structurally by iterating `entity.properties` only, never * `entity.computedProperties`. * - The IR `id` property maps to Convex's built-in document `_id` and is NOT * emitted as a field. * - Entities with `external: true` are skipped. Stores with target `memory` / * `localStorage` are skipped. Targets `durable` / `postgres` / `supabase` * are emission targets. Entities with no store entry are skipped (no * implicit ownership — this also naturally excludes mixin entities). * - Unknown `type.name` produces a hard error diagnostic. No fallback. */ import type { IR, IREntity, IRProperty } from '../../ir'; import type { ProjectionDiagnostic, ProjectionRequest, ProjectionResult, ProjectionTarget } from '../interface'; import { normalizeOptions, type IndexEntry } from './options.js'; export { isPersistentEntity } from './persist.js'; export { resolveConvexTableName } from './options.js'; export type NormalizedOptions = ReturnType; /** * Map FK column name → target Convex table for an entity's belongsTo/ref * relationships, REGARDLESS of `referenceMode`. The schema surface emits a * `by_` index for every reference whether the column is rendered as a * `v.id(...)` (convexId) or a `v.string()` (stringId), so index DERIVATION must * see all references in both modes. Shared by the schema generator (index * emission) and the functions generator (reference-query derivation) so the two * surfaces cannot disagree about which references are indexed. * * Contrast {@link collectFkTargets}, which is convexId-only because it drives * `v.id(...)` *typing* of the column / query arg, not index existence. */ export declare function collectReferenceFields(entity: IREntity, ir: IR, options: NormalizedOptions): Map; /** * Map FK column name → target Convex table for an entity's belongsTo/ref * relationships (convexId mode only; empty in stringId mode). Shared by the * schema generator (to retype FK-backing properties to `v.id`) and the functions * generator (to type create-mutation args / reference query args as `v.id`). */ export declare function collectFkTargets(entity: IREntity, ir: IR, options: NormalizedOptions): Map; /** * Resolve the system events-table name, guaranteed not to collide with any * persistent entity's table (a `defineSchema` key collision would silently * clobber the entity table). Deterministically suffixes `_` on collision. * Shared by the schema and functions generators so they always agree. */ export declare function resolveEventsTableName(ir: IR, options: NormalizedOptions): string; /** * Build a validator expression for a property, applying enum/array/nullable * wrapping. Returns `undefined` (with a diagnostic) for unmappable types. */ export declare function buildValidator(entity: IREntity, prop: IRProperty, ir: IR, options: NormalizedOptions, fkTargetTable: string | undefined): { validator: string | undefined; diagnostics: ProjectionDiagnostic[]; }; export interface IndexDef { name: string; fields: string[]; } export declare function indexEntryToDef(entry: IndexEntry): IndexDef; export declare class ConvexProjection implements ProjectionTarget { readonly name = "convex"; readonly description: string; readonly surfaces: readonly ["convex.schema", "convex.queries", "convex.mutations", "convex.crons", "convex.http", "convex.sagas", "convex.computed", "convex.react"]; readonly capabilities: import("..").ProjectionCapability[]; readonly descriptorMeta: import("..").ProjectionDescriptorMeta; generate(ir: IR, request: ProjectionRequest): ProjectionResult; } //# sourceMappingURL=generator.d.ts.map