@altostra/core
Version:
Core library for shared types and logic
9 lines (8 loc) • 497 B
TypeScript
import type { Maybe } from "../Maybe";
export interface GetAllPagesOptions<TPage, TCursor, TResult> {
getPage: (cursor: Maybe<TCursor>) => Promise<TPage>;
getCursor: (page: TPage) => Maybe<TCursor>;
appendPage: (result: Maybe<TResult>, page: TPage) => TResult;
hasNext?: (cursor: Maybe<TCursor>) => boolean;
}
export declare function getAllPages<TPage, TCursor, TResult>({ getPage, getCursor, appendPage, hasNext, }: GetAllPagesOptions<TPage, TCursor, TResult>): Promise<TResult>;