import pMapFn from 'p-map'; /** * Create an iterable by the range * @param start - Stating index (inclusive) * @param end - Ending index (exclusive) * @param step - Step * @returns */ export declare function iterateByRange(start?: number, end?: number, step?: number): Iterable; /** * Create an iterable by the limit and offset * @param limit - Limit * @param offset - Offset * @returns */ export declare function iterateByLimit(limit: number, offset?: number): Iterable; /** * Options for paginated p-map */ export type PMapByPageOptions = pMapFn.Options & { pageSize?: number; }; /** * Map a large list asynchronously with pagination * @param input - A large list of items * @param mapper - Mapping function * @param options - Options for mapping, including `concurrency` and `pageSize` * @returns */ export declare function pMapByPage(input: Iterable, mapper: pMapFn.Mapper, options?: PMapByPageOptions): Promise; /** * Map a large collection asynchronously with pagination (start, end) * @param range - Size of the collection * @param mapper - Mapping function that handles a range (start, end) * @param options - Options for mapping, including `concurrency` and `pageSize` * @returns */ export declare function pMapByRange(range: number | [number, number], mapper: pMapFn.Mapper<{ start: number; end: number; }, N>, options?: PMapByPageOptions): Promise; /** * Map a large collection asynchronously with pagination (offset, limit) * @param size - Size of the collection * @param mapper - Mapping function that handles a page (offset, limit) * @param options - Options for mapping, including `concurrency` and `pageSize` * @returns */ export declare function pMapByPageOffsetAndLimit(size: number, mapper: pMapFn.Mapper<{ offset: number; limit: number; }, N>, options?: PMapByPageOptions): Promise; export declare function mapByKeyValue(items: T[], getKey: (item: T) => string | { key: string; value: V; }): Record; export declare function pMap(input: Iterable, mapper: pMapFn.Mapper, options?: pMapFn.Options): Promise; export declare namespace pMap { type Options = pMapFn.Options; type Mapper = pMapFn.Mapper; } export interface AsyncFetchOptions { next: (state?: STATE) => Promise<{ state?: STATE; value?: VALUE; done?: boolean; }>; initialState?: STATE; reduce?: (prev: SUMMARY | undefined, current: VALUE) => SUMMARY; initialSummary?: SUMMARY; } /** * Async iterator to fetch items from a collection asynchronously * @param options - Options to fetch next item * @returns */ export declare function fetchIterator(options: AsyncFetchOptions): AsyncGenerator>, Awaited | undefined, unknown>; export interface AsyncFetchByPageOptions { next: (state?: STATE) => Promise<{ state?: STATE; value?: VALUE[]; done?: boolean; }>; initialState?: STATE; } /** * Fetch items by page asynchronously and return items one by one * @param options - Options to fetch next page * @returns */ export declare function fetchIteratorByPage(options: AsyncFetchByPageOptions): AsyncGenerator, void, unknown>; /** * Fetch items by page asynchronously and return items by page * @param options - Options to fetch next page * @returns */ export declare function fetchIteratorByBatch(options: AsyncFetchByPageOptions): AsyncGenerator; /** * Process items from an async iterator by page * @param input - Async iterator * @param mapper - Mapping function * @param options - Options * @returns */ export declare function pMapByAsyncIterator(input: AsyncIterable, mapper: pMapFn.Mapper, options?: PMapByPageOptions): Promise;