@mxraven/admin - v2.1.0
    Preparing search index...

    Class Page<T>

    One page of a v2 cursor-paginated collection.

    Pages returned by the SDK can fetch their neighbours, so a manual walk is a one-liner:

    let page = paged.firstPage;
    while (page.nextPageToken !== undefined) {
    page = await page.nextPage();
    }

    Cursors are opaque; never parse, construct, or persist them as a durable resource identifier.

    Type Parameters

    • T

      The item type.

    Index
    items: readonly T[]

    Items on this page.

    lastPageToken: string | undefined

    Opaque token for the last page, when known.

    nextPageToken: string | undefined

    Opaque token for the next page, when one exists.

    previousPageToken: string | undefined

    Opaque token for the previous page, when one exists.

    • get hasNext(): boolean

      Whether a next page is available.

      Returns boolean

    • get hasPrevious(): boolean

      Whether a previous page is available.

      Returns boolean

    • Transforms every item on this page, preserving its cursors.

      The returned page has no fetcher, so nextPage() and previousPage() on it throw. Use Paged.map to keep paging through a mapped collection.

      Type Parameters

      • R

        The mapped item type.

      Parameters

      • mapper: (item: T) => R

        The function applied to each item.

      Returns Page<R>

      A new page with mapped items and the same cursors.

    • Fetches the next page.

      Returns Promise<Page<T>>

      The next page.

      Error When there is no next page, or this page cannot fetch pages.

    • Fetches the previous page.

      Returns Promise<Page<T>>

      The previous page.

      Error When there is no previous page, or this page cannot fetch pages.