/** * Reference-runtime enforcement of IR referential actions (`onDelete` / `onUpdate`). * * Declared on `belongsTo` / `ref` relationships (child → parent). When the parent * is deleted or its referenced identity columns change, the action applies to * matching child rows. Absent action = `noAction` (orphans remain). * * See docs/spec/semantics.md § Referential Actions (runtime). */ import type { IREntity, IRForeignKey } from './ir'; export type EntityInstance = Record & { id: string; }; /** Thrown when `onDelete`/`onUpdate: restrict` finds dependent children. */ export declare class ManifestReferentialRestrictError extends Error { readonly parentEntity: string; readonly parentId: string; readonly childEntity: string; readonly relationshipName: string; readonly action: 'onDelete' | 'onUpdate'; constructor(args: { parentEntity: string; parentId: string; childEntity: string; relationshipName: string; action: 'onDelete' | 'onUpdate'; }); } /** Thrown when `setNull` targets a non-nullable / required FK property. */ export declare class ManifestReferentialSetNullError extends Error { readonly childEntity: string; readonly property: string; constructor(childEntity: string, property: string); } export interface ReferentialActionHost { getEntity(name: string): IREntity | undefined; getAllEntities(): IREntity[]; getAllInstancesRaw(entityName: string): Promise; getInstanceRaw(entityName: string, id: string): Promise; deleteInstanceRaw(entityName: string, id: string): Promise; updateInstanceRaw(entityName: string, id: string, data: Partial): Promise; /** Resolve property default for setDefault (IR default or type default). */ defaultForProperty(entityName: string, propertyName: string): unknown; compositeId(entity: IREntity | undefined, instance: Record): string; fkColumnPairs(fk: IRForeignKey, referencedEntity?: IREntity): Array<[string, string]>; } /** * Applies onDelete/onUpdate semantics against in-memory (and other) stores so IR * meaning holds even when the store has no native FK engine. */ export declare class ReferentialActionApplier { private readonly host; constructor(host: ReferentialActionHost); /** * Run before the parent row is removed. Cascade deletes children recursively; * restrict throws; setNull/setDefault mutate children; noAction is a no-op. */ applyOnDelete(parentEntityName: string, parentId: string): Promise; /** * Run when referenced identity columns on the parent change. Same action * vocabulary as onDelete, applied to children whose FK matched the old values. */ applyOnUpdate(parentEntityName: string, parentId: string, before: EntityInstance, after: EntityInstance): Promise; private changedReferencedColumns; private inboundRelationships; private pairsFor; private childMatchesParent; private applyAction; private assertNullable; } //# sourceMappingURL=runtime-referential-actions.d.ts.map