Type of the items.
Readonlycantrue when page is not the last one.
Readonlycantrue when page is not the first one.
ReadonlyitemsSize of a page, a positive integer.
Optional ReadonlyitemsAllowed values of itemsPerPage, when restricted.
ReadonlylastNumber of pages, at least 1: ceil(totalItemsCount / itemsPerPage).
ReadonlypageCurrent page, from 1 to lastPage.
ReadonlytotalTotal count of the last read, 0 before the first.
OptionalbuildAdds the contribution of the extension to the payload. Build phase, run in the order of the keys and completed before any item is read.
Payload built by the previous extensions.
Optionalsignal: AbortSignal
Signal of the read, aborted when the read is superseded.
the payload for the next extension.
Releases the held resource. Implementations should be safe to call more than once.
a promise that settles once the resource has been released.
Goes to page 1.
Goes to lastPage.
Goes to the next page, staying on the last one if already there.
Goes to a page. Raises page only when the (clamped) target differs from
the current page.
Target page, truncated to an integer and clamped to [1, lastPage].
Goes to the previous page, staying on the first one if already there.
Registers a handler for an event.
Name of the event to listen to.
Event to subscribe to.
Callback invoked on every trigger of event.
a subscription; dispose it to remove this single handler.
OptionalreadWraps the reading of the items. Read phase: the extension is a layer of
the onion around the reader, next the layers inside it (the inner
extensions, then the reader of the data source). The payload is the
whole query, whatever the position of the extension.
next may be called zero times (e.g. a cache hit: the reader is never
invoked), once, with this or another payload, or several times (e.g. a
payload split into several reads whose results are merged); every call
runs the inner layers and the reader again, so the hooks and the events
of the inner extensions may fire as many times. The result may be
transformed before being returned, and flows outward: the outermost
extension transforms last.
The whole query, built by the build phase.
Reads the items through the inner layers and the reader; the signal of the read is bound already.
Optionalsignal: AbortSignal
Signal of the read, aborted when the read is superseded, for the reads of the extension itself.
the items for the outer extension, or the data source.
Changes the page size, then clamps the current page to the new
lastPage (raising page if it changes).
Positive integer, one of itemsPerPageOptions when they are set; otherwise an error is thrown.
Extension that adds a Pagination to the payload and keeps the total count up to date. Pages are 1-based and always clamped to
[1, lastPage]. By default a change of the query built by the previous extensions (filters, sorts, ...) between two reads brings the page back to 1 (PaginationExtensionOptions.resetPageOnQueryChange). Every event is raised only when the value actually changes (see PaginationExtensionEvents).