UNPKG

histoire

Version:

A fast story book powered by Vite

22 lines • 1.1 kB
/** * Decodes the offset of a cursor this module issued. * @param cursor Opaque value from the previous page, absent for the first page. * @param total Items in the filtered list. */ export declare function readOffset(cursor: string | undefined, total: number): number; /** * Takes the next page under both the item and the byte bound, projecting only the items it * returns. An entry that alone exceeds the byte bound cannot be represented, so the read * fails explicitly instead of looping on an empty page. * @param items Complete filtered list of one revision. * @param offset Start offset. * @param limit Requested items, at most the protocol page size. * @param project Maps a canonical item to its DTO. * @param overheadBytes Serialized size of the page envelope without items. * @returns The page items and the cursor of the next page, if any. */ export declare function takePage<S, T>(items: readonly S[], offset: number, limit: number | undefined, project: (item: S) => T, overheadBytes?: number): { page: T[]; next?: string; }; //# sourceMappingURL=paging.d.ts.map