API/FeathersResponseStrategy
FeathersResponseStrategy
src/strategies/feathers-response.strategy.ts1 public methodsclass
Response strategy for the FeathersJS driver
Parses the paginated envelope emitted by Feathers database adapters:
{ "total": 48, "limit": 10, "skip": 10, "data": [...]}The envelope is offset-based — no page number, no navigation URLs — so position derives arithmetically:
currentPageisskip / limit + 1(integer division; a zero or missinglimitfalls back to page 1).perPagecomes straight fromlimit;lastPageisceil(total / limit).from/toare 1-indexed offsets derived fromskipand the item count of the current page (from = skip + 1,to = skip + data.length); both stayundefinedon an empty page.
The data / total / limit key names are configurable through
FeathersResponseOptions; the skip key is fixed by the Feathers
envelope and lives as a private static.
Constructor
Section titled “Constructor”new FeathersResponseStrategy()Methods
Section titled “Methods”paginate()
Section titled “paginate()”paginate(response: RawResponse, options: ResponseOptions): PaginatedCollection<T>Parse a Feathers pagination response into a PaginatedCollection
| Parameter | Type | Description |
|---|---|---|
response |
RawResponse |
The raw API response body |
options |
ResponseOptions |
The response key name configuration |
Returns — A typed PaginatedCollection instance
