Skip to content
qubeejs/angular
API/QubeePaginator

QubeePaginator

class@qubeejs/angular1 public methodssrc/lib/services/qubee-paginator.ts

Parses backend responses into typed PaginatedCollections and syncs the page metadata back into the shared QubeeSignalStore

Thin Angular wrapper over the core Paginator: DI supplies the store, the response strategy and the response options for the active driver. It performs no I/O — fetch however you like and hand the body back.

paginate<T extends object>(response: RawResponse, headers?: HeaderBag): PaginatedCollection<T>

Transform a raw API response into a typed PaginatedCollection

Delegates to the active driver’s response strategy for parsing, then auto-syncs the parsed page and lastPage back into the store so the pagination signals on QubeeQueryBuilder (totalPages, isLastPage, hasNextPage, …) reflect the live server-reported bounds without consumer bookkeeping.

Parameter Type Description
response RawResponse The raw API response body. For drivers that emit a bare array (PostgREST, WordPress, Ransack), pass the array.
headers? HeaderBag Optional HTTP response headers. Required by the drivers that report pagination in headers: PostgREST (reads Content-Range), WordPress (reads X-WP-Total / X-WP-TotalPages and Link) and Ransack (reads Pagy’s or Kaminari’s headers and Link); body-only drivers ignore it. Accepts Angular’s HttpHeaders, the native Headers class, or a plain Record<string, string>.

lastPage is only synced when the response yields a positive integer. Server-emitted 0 (empty collection edge case) and absent fields are treated as “no useful info” and leave isLastPageKnown: false.

Returns — A typed PaginatedCollection instance