Repository navigation
Paginated queries with count metadata and base-query builder
This release introduces a paginated query flow that returns count metadata and separates base-query construction from pagination. It also widens QueryBuilder helper input types, simplifies reference handling, updates tests, adjusts CI triggers, and bumps dependencies.
Breaking Changes
- Change return type of all operations to include metadata (commit 9ad302f):
- Top-level all (src/ops/all.ts) and contained all (src/contained/ops/all.ts) now return AllOperationResult with shape
{ items, metadata: { total, returned, limit, offset, hasMore } }instead of just an array of items. - one operations (top-level and contained) continue to return a single item or null, but now consume the new AllOperationResult internally and support forwarding options.
- Top-level all (src/ops/all.ts) and contained all (src/contained/ops/all.ts) now return AllOperationResult with shape
New Features
- Introduce buildQueryWithoutPagination (src/QueryBuilder.ts) to construct a Firestore query with filters and ordering but without limit/offset, enabling accurate count queries before pagination (commit 9ad302f).
- Support AllOptions for pagination in all operations (contained and top-level). Options can override limit/offset from the ItemQuery (commit 9ad302f).
- Execute count() on the base query to provide total matching documents in metadata prior to applying pagination (commit 9ad302f).
Improvements
- QueryBuilder updates (commit 9ad302f):
- Widen helper function parameters (addDeleteQuery, addEventQueries, addReferenceQueries, applyAndConditions) to accept CollectionReference | CollectionGroup | Query.
- Simplify addDeleteQuery by removing defensive where checks and directly applying the soft-delete filter.
- Update buildQuery to apply only limit/offset on top of buildQueryWithoutPagination (filters and ordering are part of the base query).
- Reference handling (src/ReferenceFinder.ts): remove special-case collection return and mock validations; always resolve via addReference (commit 9ad302f).
- Contained all (src/contained/ops/all.ts) and top-level all (src/ops/all.ts) now follow a consistent flow: build base query via buildQueryWithoutPagination, run count(), then apply offset/limit and fetch (commit 9ad302f).
- one operations (src/contained/ops/one.ts, src/ops/one.ts) accept and forward allOptions to all operations (commit 9ad302f).
Testing Improvements
- Update tests across tests/** to reflect:
- New AllOperationResult return type and pagination/count behavior.
- Usage of buildQueryWithoutPagination in query building paths.
- ReferenceFinder test updated to use a CollectionReference-like mock class (commit 9ad302f).
CI
- Stop running CI on pull_request events; keep push triggers for main, working, and feature/** branches (.github/workflows/test.yml) (commit 686d423).
Dependencies
- Bump dependencies (commit 9ad302f):
- @fjell/core to ^4.4.64
- @fjell/lib to ^4.4.73
- @fjell/logging to ^4.4.59
- @fjell/registry to ^4.4.70
- Dev: @fjell/common-config to ^1.1.31
Version
- Set release version to 4.4.68 in package.json (commit afc5659).
Upgrade Notes
- Code consuming all operations must switch from handling an array to handling AllOperationResult:
- Before:
const items = await all(query, locs) - After:
const { items, metadata } = await all(query, locs, { limit, offset })
- Before:
- If you relied on direct collection returns from ReferenceFinder when no keys were provided, note that resolution now consistently goes through addReference.