UNPKG

layered-loader

Version:

Data loader with support for caching and fallback data sources

19 lines (18 loc) 1.4 kB
import { AbstractGroupCache } from './AbstractGroupCache'; import type { LoaderConfig } from './Loader'; import type { InMemoryGroupCache, InMemoryGroupCacheConfiguration } from './memory/InMemoryGroupCache'; import type { GroupNotificationPublisher } from './notifications/GroupNotificationPublisher'; import type { GroupCache, GroupDataSource } from './types/DataSources'; import type { GetManyResult } from './types/SyncDataSources'; export type GroupLoaderConfig<LoadedValue, LoadParams = string> = LoaderConfig<LoadedValue, LoadParams, GroupCache<LoadedValue>, GroupDataSource<LoadedValue, LoadParams>, InMemoryGroupCacheConfiguration, InMemoryGroupCache<LoadedValue>, GroupNotificationPublisher<LoadedValue>>; export declare class GroupLoader<LoadedValue, LoadParams = string> extends AbstractGroupCache<LoadedValue, LoadParams> { private readonly dataSources; private readonly groupRefreshFlags; protected readonly throwIfLoadError: boolean; protected readonly throwIfUnresolved: boolean; constructor(config: GroupLoaderConfig<LoadedValue, LoadParams>); protected resolveGroupValue(key: string, group: string, loadParams: LoadParams): Promise<LoadedValue | undefined | null>; protected resolveManyGroupValues(keys: string[], group: string, loadParams?: LoadParams): Promise<GetManyResult<LoadedValue>>; private loadFromLoaders; private loadManyFromLoaders; }