import type { AnyEntity, AutoPath, ConnectionType, EntityName, EntityProperty, FilterQuery, PopulateOptions } from '../typings.js'; import type { EntityManager } from '../EntityManager.js'; import { LoadStrategy, type LockMode, type PopulateHint, PopulatePath, type QueryOrderMap } from '../enums.js'; import type { FilterOptions } from '../drivers/IDatabaseDriver.js'; import type { LoggingOptions } from '../logging/Logger.js'; /** Options for controlling how relations are loaded by the EntityLoader. */ export interface EntityLoaderOptions { /** Select specific fields to load (partial loading). */ fields?: readonly AutoPath[]; /** Fields to exclude from loading. */ exclude?: readonly AutoPath[]; /** Additional filtering conditions applied to populated relations. */ where?: FilterQuery; /** Controls how `where` conditions are applied to populated relations. */ populateWhere?: PopulateHint | `${PopulateHint}`; /** Ordering for populated relations. */ orderBy?: QueryOrderMap | QueryOrderMap[]; /** Whether to reload already loaded entities. */ refresh?: boolean; /** Whether to validate the populate hint against the entity metadata. */ validate?: boolean; /** Whether to look up eager-loaded relationships automatically. */ lookup?: boolean; /** Whether to convert custom types during hydration. */ convertCustomTypes?: boolean; /** Whether to skip loading lazy scalar properties. */ ignoreLazyScalarProperties?: boolean; /** Filter options to apply when loading relations. */ filters?: FilterOptions; /** Loading strategy to use (select-in, joined, or balanced). */ strategy?: LoadStrategy | `${LoadStrategy}`; /** Lock mode for the query (pessimistic locking). */ lockMode?: Exclude; /** Database schema override. */ schema?: string; /** Connection type (read or write replica). */ connectionType?: ConnectionType; /** Logging options for the query. */ logging?: LoggingOptions; } /** Responsible for batch-loading entity relations using either select-in or joined loading strategies. */ export declare class EntityLoader { #private; constructor(em: EntityManager); /** * Loads specified relations in batch. * This will execute one query for each relation, that will populate it on all the specified entities. */ populate(entityName: EntityName, entities: Entity[], populate: PopulateOptions[] | boolean, options: EntityLoaderOptions): Promise; /** Normalizes populate hints into a structured array of PopulateOptions, expanding dot paths and eager relations. */ normalizePopulate(entityName: EntityName, populate: (PopulateOptions | boolean)[] | PopulateOptions | boolean, strategy?: LoadStrategy, lookup?: boolean, exclude?: string[]): PopulateOptions[]; private setSerializationContext; /** * Merge multiple populates for the same entity with different children. Also skips `*` fields, those can come from * partial loading hints (`fields`) that are used to infer the `populate` hint if missing. */ private mergeNestedPopulate; /** * preload everything in one call (this will update already existing references in IM) */ private populateMany; private populateScalar; private populatePolymorphic; private initializeCollections; private initializeOneToMany; private initializeManyToMany; private findChildren; private mergePrimaryCondition; private populateField; /** @internal */ findChildrenFromPivotTable(filtered: Entity[], prop: EntityProperty, options: Required>, orderBy?: QueryOrderMap[], populate?: PopulateOptions, pivotJoin?: boolean): Promise; private extractChildCondition; private buildFields; private getChildReferences; private filterCollections; private isPropertyLoaded; private filterReferences; private filterByReferences; private lookupAllRelationships; private getRelationName; private lookupEagerLoadedRelationships; }