FeathersResponseStrategy
Defined in: src/lib/strategies/feathers-response.strategy.ts:37
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.
See
https://feathersjs.com/api/databases/common#pagination
Implements
Constructors
Constructor
new FeathersResponseStrategy():
FeathersResponseStrategy
Returns
FeathersResponseStrategy
Methods
paginate()
paginate<
T>(response,options):PaginatedCollection<T>
Defined in: src/lib/strategies/feathers-response.strategy.ts:54
Parse a Feathers pagination response into a PaginatedCollection
Type Parameters
T
T extends IPaginatedObject
Parameters
response
Record<string, any>
The raw API response body
options
The response key name configuration
Returns
A typed PaginatedCollection instance