Chore/make streams list cursor paginated with #193
Merged
Jagadeeshftw merged 2 commits intoApr 23, 2026
Merged
Conversation
…dexed filters
- src/routes/streams.ts
- Add missing imports: parseBody, CreateStreamSchema, formatZodIssues,
assertValidApiTransition, ApiStreamStatus
- Fix all response shapes to flat JSON (tests expect flat, not successResponse
envelope)
- Fix normalizeCreateStreamInput error handling to use ApiError correctly
- Add status, sender, recipient filter query params to GET /api/streams
- src/db/repositories/streamRepository.ts
- Add findWithCursor(filter, limit, cursor?) method
- Keyset pagination: id > cursor with stable id ASC ordering
- Fetches limit+1 rows to detect hasMore without a separate COUNT query
- Supports status, sender_address, recipient_address, contract_id filters
- Decimal-string amounts pass through TEXT columns untouched
- openapi.yaml
- Replace offset pagination with cursor pagination params
- Add status, sender, recipient filter params
- Inline response schema with streams/has_more/next_cursor/total
- docs/STREAMS.md
- Replace offset pagination docs with cursor pagination model
- Document all filter params and their backing indexes
- Add pagination example showing two-page traversal
|
@abrak01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the implicit offset-based listing with keyset cursor pagination, adds
indexed filter params, and fixes pre-existing import and response-shape bugs that
were preventing the route from compiling.
Changes
src/routes/streams.ts
assertValidApiTransition, ApiStreamStatus
directly, not a successResponse envelope
src/db/repositories/streamRepository.ts
backed by existing indexes)
openapi.yaml
docs/STREAMS.md
Pagination model
Streams are ordered by id ASC. The cursor encodes the last seen id as a base64url
token. Each subsequent page fetches id > cursor, so results are stable even when
new streams are inserted between requests. total is a point-in-time snapshot, not
a cursor-consistent count.
Decimal-string guarantee
No numeric coercion occurs at any layer — amount fields are stored as TEXT and
returned as strings throughout.
closes #123