interface HasManyRelation { type: "hasMany"; name: string; localKey: LocalKey; foreignKey: ForeignKey; } interface HasOneRelation { type: "hasOne"; name: string; localKey: LocalKey; foreignKey: ForeignKey; } interface BelongsToRelation { type: "belongsTo"; name: string; foreignKey: ForeignKey; ownerKey: OwnerKey; } interface BelongsToManyRelation { type: "belongsToMany"; name: string; pivotTable: string; parentKey: ParentKey; relatedKey: RelatedKey; foreignPivotKey: ForeignPivotKey; relatedPivotKey: RelatedPivotKey; } interface HasManyThroughRelation { type: "hasManyThrough"; name: string; throughTable: string; localKey: LocalKey; firstKey: FirstKey; secondLocalKey: SecondLocalKey; secondKey: SecondKey; throughParentKey?: string; } declare function hasMany(definition: { name: string; localKey: LocalKey; foreignKey: ForeignKey; }): HasManyRelation; declare function hasOne(definition: { name: string; localKey: LocalKey; foreignKey: ForeignKey; }): HasOneRelation; declare function belongsTo(definition: { name: string; foreignKey: ForeignKey; ownerKey: OwnerKey; }): BelongsToRelation; declare function hasManyThrough(definition: { name: string; throughTable: string; localKey: LocalKey; firstKey: FirstKey; secondLocalKey: SecondLocalKey; secondKey: SecondKey; throughParentKey?: string; }): HasManyThroughRelation; declare function belongsToMany(definition: { name: string; pivotTable: string; parentKey: ParentKey; relatedKey: RelatedKey; foreignPivotKey: ForeignPivotKey; relatedPivotKey: RelatedPivotKey; }): BelongsToManyRelation; declare function relationMatchKey(value: unknown): string; declare function getByRelationKey(map: ReadonlyMap, key: unknown): V | undefined; declare function indexHasManyRelation(parents: readonly TParent[], children: readonly TChild[], relation: HasManyRelation): Map; declare function indexHasOneRelation(parents: readonly TParent[], children: readonly TChild[], relation: HasOneRelation): Map; declare function indexBelongsToRelation(children: readonly TChild[], parents: readonly TParent[], relation: BelongsToRelation): Map; declare function indexBelongsToManyRelation(parents: readonly TParent[], pivotRows: readonly Pivot[], relatedRows: readonly TRelated[], relation: BelongsToManyRelation): Map; interface MorphManyRelation { type: "morphMany"; name: string; localKey: LocalKey; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; morphType: string; } interface MorphOneRelation { type: "morphOne"; name: string; localKey: LocalKey; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; morphType: string; } interface MorphToRelation { type: "morphTo"; name: string; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; } declare function morphMany(definition: { name: string; localKey: LocalKey; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; morphType: string; }): MorphManyRelation; declare function morphOne(definition: { name: string; localKey: LocalKey; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; morphType: string; }): MorphOneRelation; declare function morphTo(definition: { name: string; morphTypeKey: MorphTypeKey; morphIdKey: MorphIdKey; }): MorphToRelation; declare function indexMorphManyRelation(parents: readonly TParent[], children: readonly TChild[], relation: MorphManyRelation): Map; declare function indexMorphOneRelation(parents: readonly TParent[], children: readonly TChild[], relation: MorphOneRelation): Map; declare function indexHasManyThroughRelation(parents: readonly TParent[], children: readonly (TFar & Record)[], relation: HasManyThroughRelation): Map; declare function indexMorphToRelation(children: readonly TChild[], parentsByType: ReadonlyMap>, relation: MorphToRelation): Map; export type { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, MorphManyRelation, MorphOneRelation, MorphToRelation, }; export { belongsTo, belongsToMany, getByRelationKey, hasMany, hasManyThrough, hasOne, indexBelongsToManyRelation, indexBelongsToRelation, indexHasManyRelation, indexHasManyThroughRelation, indexHasOneRelation, indexMorphManyRelation, indexMorphOneRelation, indexMorphToRelation, morphMany, morphOne, morphTo, relationMatchKey, };