find() now returns items with metadata and supports pagination
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, andhasMore(as exercised in tests) - Update existing code to use
result.itemsinstead of assumingfind()returns an array
- Returned shape:
- PItemAPI.find signature extended to
find(finder, finderParams?, locations?, findOptions?)and forwards bothlocationsandfindOptionsto AItemAPI.find (commit 7261f10)
Improvements
- Pagination support: pass
findOptions.limitandfindOptions.offsetto 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 processingresponse.items(commit 7261f10) - Debug logging enhanced to include
findOptionson request andmetadataon response, alongside item counts and keys (commit 7261f10)
Testing Improvements
- Tests updated to mock the new
FindOperationResultshape and assertresult.itemsandresult.metadata.totalfor both AItemAPI and PItemAPI (commit 7261f10)
Dependencies