import type { ColumnNamingStrategy, MetaData } from "@metaobjectsdev/metadata"; import { CARDINALITY_ONE, CARDINALITY_MANY } from "@metaobjectsdev/metadata"; import type { SelectSpec, Row } from "./persistence-driver.js"; export interface RelationDescriptor { /** "one" = source holds the FK pointing at target. "many" = target holds the FK pointing back at source. */ cardinality: typeof CARDINALITY_ONE | typeof CARDINALITY_MANY; /** Entity name we're loading rows OF. */ targetEntityName: string; /** Field on the source record to read the lookup value from (one-side: FK column; many-side: source PK). */ sourceField: string; /** Field on the target table to filter by (one-side: target PK; many-side: back-pointing FK). */ targetField: string; } /** * Walks one-side (relationship children of `sourceEntity`) then many-side (relationship * children of any OTHER entity pointing to `sourceEntity`). The inverse-side relation name * is computed via the same convention as SP2's relation-resolver: variableNameFromEntity * (lower-camel + plural) of the declaring source. * * FK direction is sourced from identity.reference declarations, not relationship attrs. */ export declare function resolveRelationDescriptor(sourceEntity: MetaData, relationName: string, root: MetaData): RelationDescriptor; /** Returns null when the source-side lookup value is null — caller returns null/[]. */ export declare function buildLazyRelateSpec(desc: RelationDescriptor, sourceRecord: Row, root: MetaData, strategy?: ColumnNamingStrategy): SelectSpec | null; /** Builds one batched IN(...) lookup. Returns null when there are no non-null source values. */ export declare function buildIncludeBatchSpec(desc: RelationDescriptor, sourceRecords: Row[], root: MetaData, strategy?: ColumnNamingStrategy): SelectSpec | null; //# sourceMappingURL=relation-resolver.d.ts.map