import type { AuthorizationResultBasedEntityAssociationLoader, EntityLoadThroughDirective } from './AuthorizationResultBasedEntityAssociationLoader.ts'; import type { IEntityClass } from './Entity.ts'; import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts'; import type { ReadonlyEntity } from './ReadonlyEntity.ts'; import type { ViewerContext } from './ViewerContext.ts'; /** * An association loader is a set of convenience methods for loading entities * associated with an entity. In relational databases, these entities are often referenced * by foreign keys. */ export declare class EnforcingEntityAssociationLoader, TIDField extends keyof NonNullable>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity, TSelectedFields extends keyof TFields> { private readonly authorizationResultBasedEntityAssociationLoader; constructor(authorizationResultBasedEntityAssociationLoader: AuthorizationResultBasedEntityAssociationLoader); /** * Load an associated entity identified by a field value of this entity. In a relational database, * the field in this entity is a foreign key to the ID of the associated entity. * @param fieldIdentifyingAssociatedEntity - field of this entity containing the ID of the associated entity * @param associatedEntityClass - class of the associated entity */ loadAssociatedEntityAsync, TAssociatedFields extends object, TAssociatedIDField extends keyof NonNullable>, TAssociatedEntity extends ReadonlyEntity, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: TIdentifyingField, associatedEntityClass: IEntityClass): Promise; /** * Load many entities associated with this entity, often referred to as entites belonging * to this entity. In a relational database, the field in the foreign entity is a * foreign key to the ID of this entity. Also commonly referred to as a has many relationship, * where this entity has many associated entities. * @param associatedEntityClass - class of the associated entities * @param associatedEntityFieldContainingThisID - field of associated entity which contains the ID of this entity */ loadManyAssociatedEntitiesAsync>, TAssociatedEntity extends ReadonlyEntity, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(associatedEntityClass: IEntityClass, associatedEntityFieldContainingThisID: keyof Pick): Promise; /** * Load an associated entity identified by a field value of this entity. In a relational database, * the field in this entity is a foreign key to a unique field of the associated entity. * @param fieldIdentifyingAssociatedEntity - field of this entity containing the value with which to look up associated entity * @param associatedEntityClass - class of the associated entity * @param associatedEntityLookupByField - field of associated entity with which to look up the associated entity */ loadAssociatedEntityByFieldEqualingAsync>, TAssociatedEntity extends ReadonlyEntity, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick, associatedEntityClass: IEntityClass, associatedEntityLookupByField: keyof Pick): Promise; /** * Load many associated entities identified by a field value of this entity. In a relational database, * the field in this entity refers to a field of the associated entity. * @param fieldIdentifyingAssociatedEntity - field of this entity containing the value with which to look up associated entities * @param associatedEntityClass - class of the associated entities * @param associatedEntityLookupByField - field of associated entities with which to look up the associated entities */ loadManyAssociatedEntitiesByFieldEqualingAsync>, TAssociatedEntity extends ReadonlyEntity, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick, associatedEntityClass: IEntityClass, associatedEntityLookupByField: keyof Pick): Promise; /** * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each * fold step, load an associated entity identified by a field value of the current fold value. * @param loadDirectives - associated entity load directives instructing each step of the folds */ loadAssociatedEntityThroughAsync>, TEntity2 extends ReadonlyEntity, TPrivacyPolicy2 extends EntityPrivacyPolicy, TSelectedFields2 extends keyof TFields2 = keyof TFields2>(loadDirectives: [ EntityLoadThroughDirective ]): Promise; /** * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each * fold step, load an associated entity identified by a field value of the current fold value. * @param loadDirectives - associated entity load directives instructing each step of the folds */ loadAssociatedEntityThroughAsync>, TEntity2 extends ReadonlyEntity, TPrivacyPolicy2 extends EntityPrivacyPolicy, TFields3 extends object, TIDField3 extends keyof NonNullable>, TEntity3 extends ReadonlyEntity, TPrivacyPolicy3 extends EntityPrivacyPolicy, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3>(loadDirectives: [ EntityLoadThroughDirective, EntityLoadThroughDirective ]): Promise; /** * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each * fold step, load an associated entity identified by a field value of the current fold value. * @param loadDirectives - associated entity load directives instructing each step of the folds */ loadAssociatedEntityThroughAsync>, TEntity2 extends ReadonlyEntity, TPrivacyPolicy2 extends EntityPrivacyPolicy, TFields3 extends object, TIDField3 extends keyof NonNullable>, TEntity3 extends ReadonlyEntity, TPrivacyPolicy3 extends EntityPrivacyPolicy, TFields4 extends object, TIDField4 extends keyof NonNullable>, TEntity4 extends ReadonlyEntity, TPrivacyPolicy4 extends EntityPrivacyPolicy, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3, TSelectedFields4 extends keyof TFields4 = keyof TFields4>(loadDirectives: [ EntityLoadThroughDirective, EntityLoadThroughDirective, EntityLoadThroughDirective ]): Promise; /** * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each * fold step, load an associated entity identified by a field value of the current fold value. * @param loadDirectives - associated entity load directives instructing each step of the folds */ loadAssociatedEntityThroughAsync(loadDirectives: EntityLoadThroughDirective[]): Promise | null>; }