import { Entity, EntityCollection } from './entity'; export interface Relationship { readonly from: From; readonly to: To; readonly attr: Attributes; } type FromGetter> = (id: string) => R['from']; type ToGetter> = (id: string) => R['to']; export interface RelationshipCollection> { readonly type: 'rel'; readonly fromColl: FromGetter; readonly toColl: ToGetter; readonly forward: Map[]>; readonly backward: Map[]>; add(from: R['from'], to: R['to'], attributes: R['attr']): void; dehydrate(): any; hydrateFrom(x: any): void; } export type Rel = { readonly $id: string; } & Attributes; export type KeyForEntityCollection = { [K in keyof S]: S[K] extends EntityCollection ? K : never; }[keyof S]; export declare const NO_RELATIONSHIPS: () => {}; export declare function relationshipCollection>(fromField: FromGetter, toField: ToGetter): RelationshipCollection; export declare function isRelationshipCollection(x: unknown): x is RelationshipCollection; export {};