/** * Authoritative IR-derived relation dependencies for command evaluation. * * The plan is intentionally not serialized into IR: relationships and command * expressions already contain the complete contract. Runtime and projections * derive this immutable view so they cannot drift into separate expression * scanners or foreign-key fallback rules. */ import type { IR, IRCommand, IREntity, IRRelationship } from './ir.js'; export type RelationEvaluationPhase = 'policy' | 'guard' | 'commandConstraint' | 'entityConstraint' | 'action' | 'emit'; export type RelationAccessMode = 'value' | 'countOf'; export interface RelationReferenceMapping { localFields: readonly string[]; targetFields: readonly string[]; } export interface RelationDependency extends RelationReferenceMapping { relationName: string; sourceEntity: string; targetEntity: string; kind: IRRelationship['kind']; through?: string; optional: boolean; tenantOwnershipRequired: boolean; tenantProperty?: string; phases: readonly RelationEvaluationPhase[]; accessModes: readonly RelationAccessMode[]; /** Direct target fields read after the relation root (e.g. `status`). */ targetFieldsRead: readonly string[]; } export interface RelationDependencyPlan { entityName: string; commandName: string; relations: readonly RelationDependency[]; } /** * Normalize a forward relationship's local/target columns once for every * consumer. Single-column references default to target identity; composite * references fall back to the target key when arity matches, then same-name * columns, matching the reference runtime's existing composite semantics. */ export declare function relationReferenceMapping(_entity: IREntity, relationship: IRRelationship, targetEntity?: IREntity): RelationReferenceMapping; /** Build the authoritative relation dependency plan for one entity command. */ export declare function buildRelationDependencyPlan(ir: IR, entity: IREntity, command: IRCommand): RelationDependencyPlan; //# sourceMappingURL=relation-plan.d.ts.map