1 | import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, PaginationQueryOptions } from '../common-types';
|
2 | export type OffsetBasedParams = {
|
3 | query?: PaginationQueryOptions;
|
4 | };
|
5 | export type CursorBasedParams = {
|
6 | query?: BasicCursorPaginationOptions;
|
7 | };
|
8 | type ExpectedParams = OffsetBasedParams | CursorBasedParams;
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | type IterableCollection<T> = Omit<CollectionProp<T> | CursorPaginatedCollectionProp<T>, 'sys'>;
|
14 | export type FetchFn<P extends ExpectedParams, T = unknown> = (params: P) => Promise<IterableCollection<T>>;
|
15 | type ParamsType<P extends ExpectedParams, T extends FetchFn<P>> = T extends (params: infer P) => unknown ? P : never;
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export declare function fetchAll<Params extends ExpectedParams, Entity, F extends FetchFn<Params, Entity>>(fetchFn: FetchFn<Params, Entity>, params: ParamsType<Params, F>): Promise<Entity[]>;
|
22 | export {};
|