Implement paginateAndSort(fetch, url, sortKey)
Combine two things you've already built: cursor pagination (like fetchAllPages) and a client-side sort. Write paginateAndSort(fetch, url, sortKey) that follows nextCursor to collect every item across all pages, then returns them sorted ascending by sortKey, the server may return pages in whatever order it likes; the combined result must be fully sorted.
await paginateAndSort(fetch, "/items", "score");
// fetches every page, then returns all items sorted ascending by .score