Skip to content

find() now returns items with metadata and supports pagination

Choose a tag to compare

released this 30 Nov 00:09
· 22 commits to working since this release

This release focuses on the find() operation: results now include metadata and the API accepts pagination options. The PItemAPI find signature has been extended to forward locations and findOptions to the underlying AItemAPI.

API Changes

  • find() now returns an object with items and metadata instead of an array (commit 7261f10)
    • Returned shape: { items, metadata }
    • Metadata includes fields like total, returned, offset, and hasMore (as exercised in tests)
    • Update existing code to use result.items instead of assuming find() returns an array
  • PItemAPI.find signature extended to find(finder, finderParams?, locations?, findOptions?) and forwards both locations and findOptions to AItemAPI.find (commit 7261f10)

Improvements

  • Pagination support: pass findOptions.limit and findOptions.offset to add pagination parameters to the request query (commit 7261f10)
  • HTTP request handling updated to expect and process FindOperationResult<V> from the server, returning { items, metadata } after processing response.items (commit 7261f10)
  • Debug logging enhanced to include findOptions on request and metadata on response, alongside item counts and keys (commit 7261f10)

Testing Improvements

  • Tests updated to mock the new FindOperationResult shape and assert result.items and result.metadata.total for both AItemAPI and PItemAPI (commit 7261f10)

Dependencies

  • Bump @fjell/core from ^4.4.64 to ^4.4.65 (commit 406f42a)
  • Bump @fjell/http-api from ^4.4.54 to ^4.4.55 (commit 406f42a)
  • Bump @fjell/registry from ^4.4.70 to ^4.4.71 (commit 406f42a)