Skip to content

Consistent { items, metadata } results for all/find across client APIs

Choose a tag to compare

released this 30 Nov 06:15
· 21 commits to working since this release

This release focuses on normalizing list and finder responses so client APIs consistently return a structured { items, metadata } result. It also updates Fjell dependencies.

Improvements

  • Normalize list query responses and wrap all/find to always return { items, metadata }
    • CItemAPI: Added ensureItemsExtracted() and wrapped all() and find() so they return extracted AllOperationResult/FindOperationResult; wired the wrapped methods into the returned API (src/CItemAPI.ts)
    • PItemAPI: Imported AllOperationResult/FindOperationResult, added ensureItemsExtracted(), and wrapped all() and find() to return typed { items, metadata } (src/PItemAPI.ts)
    • all() operation internals: Removed ad‑hoc result shape handling; process items via a normalized itemsArray and use optional chaining/defaults for metadata in the return value (src/ops/all.ts)
    • Default metadata when absent: { total: 0, returned: 0, offset: 0, hasMore: false } (src/ops/all.ts)

Developer Notes

  • If you previously consumed results from all() or find() as a raw array, update code to use result.items and result.metadata. Tests were updated to assert the structured result.

Testing Improvements

  • Updated CItemAPI tests to expect result.items and presence of metadata instead of a raw array return (tests/CItemAPI.test.ts)

Dependencies

  • Updated Fjell packages in package.json:
    • @fjell/core to ^4.4.66 (from ^4.4.65)
    • @fjell/http-api to ^4.4.56 (from ^4.4.55)
    • @fjell/registry to ^4.4.72 (from ^4.4.71)