Skip to content
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:

  • currentPage is skip / limit + 1 (integer division; a zero or missing limit falls back to page 1).
  • perPage comes straight from limit; lastPage is ceil(total / limit).
  • from/to are 1-indexed offsets derived from skip and the item count of the current page (from = skip + 1, to = skip + data.length); both stay undefined on 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.

new FeathersResponseStrategy()
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