import type { EntityDatabaseAdapter } from '../EntityDatabaseAdapter.ts'; import type { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext.ts'; import type { EntityQueryContextProvider } from '../EntityQueryContextProvider.ts'; import type { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter.ts'; import type { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces.ts'; import type { ReadThroughEntityCache } from './ReadThroughEntityCache.ts'; /** * A data manager is responsible for orchestrating multiple sources of entity * data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter. * * It is also responsible for invalidating all sources of data when mutated using EntityMutator. * * @internal */ export declare class EntityDataManager, TIDField extends keyof TFields> { private readonly databaseAdapter; private readonly entityCache; private readonly queryContextProvider; private readonly metricsAdapter; private readonly entityClassName; private readonly dataLoaders; private readonly transactionalDataLoaders; constructor(databaseAdapter: EntityDatabaseAdapter, entityCache: ReadThroughEntityCache, queryContextProvider: EntityQueryContextProvider, metricsAdapter: IEntityMetricsAdapter, entityClassName: string); private getDataLoaderForLoadKey; private loadManyForNonTransactionalDataLoaderAsync; private getTransactionalDataLoaderForLoadKey; private loadManyForTransactionalDataLoaderAsync; /** * Load many objects through read-through dataloader (batcher) and cache (optional). * * @param queryContext - query context in which to perform the load * @param key - load key being queried * @param values - load values being queried for the key * @returns map from load value to objects that match the query for that load value */ loadManyEqualingAsync, TSerializedLoadValue, TLoadValue extends IEntityLoadValue>(queryContext: EntityQueryContext, key: TLoadKey, values: readonly TLoadValue[]): Promise[]>>; private loadManyEqualingInternalAsync; /** * Load one object matching load key and load value if at least one matching object exists. * Returned object is not guaranteed to be deterministic. * * Used when evaluating EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL. * * @param queryContext - query context in which to perform the load * @param key - load key being queried * @param values - load value being queried for the key * @returns at most one that match the query for that load value */ loadOneEqualingAsync, TSerializedLoadValue, TLoadValue extends IEntityLoadValue>(queryContext: EntityQueryContext, key: TLoadKey, value: TLoadValue): Promise | null>; private invalidateOneAsync; private invalidateOneForTransaction; /** * Invalidate all caches, in-memory or otherwise, for sets of key-value pairs. * @param pairs - key-value pairs to invalidate */ invalidateKeyValuePairsAsync(pairs: readonly LoadPair[]): Promise; /** * Invalidate all in-memory caches for sets of key-value pairs for all transactions and parent transactions. * @param pairs - key-value pairs to invalidate */ invalidateKeyValuePairsForTransaction(queryContext: EntityTransactionalQueryContext, pairs: readonly LoadPair[]): void; /** * Traverse to root of transactional query context tree. */ private static getOutermostTransactionalQueryContextIfInNestedTransaction; /** * Get a list of all child query contexts recursively for a given query context. */ private static getAllDescendantTransactionalQueryContexts; }