feature:Status filter, shared token, live notification, contract depl…#388
Merged
Conversation
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.
Description
Resolves four tracked issues across the backend stream API, Redis client, SSE service, and test suite. The changes add status filtering, sorting, and pagination to the streams list endpoint; fix a Redis import incompatibility; export the SSE singleton correctly; fix a stray brace causing a syntax error in the Soroban event worker; and harden stream controller type safety and test mock fidelity.
Type of Change
Related Issues
Closes #338
Closes #339
Closes #341
Closes #345
Changes Made
GET /v1/streams— Status filtering, sorting, and pagination (#338)status,token,sort,order,limit, andoffsetquery parameters tolistStreamsstatusis validated against['active', 'cancelled', 'completed', 'paused']with a400response on invalid values; each status is mapped to the appropriateisActivedatabase conditionsortis validated against['createdAt', 'startTime', 'lastUpdateTime', 'depositedAmount']with safe fallback tocreatedAtlimitis capped at100and defaults to20;offsetdefaults to0{ data, total, hasMore, limit, offset }using aPromise.allcount + query pattern for efficiencyRedis client fix (#339)
import RedisClass from 'ioredis'withconst Redis = require('ioredis')to resolve the CommonJS/ESM interop issue that caused the Redis client to fail to instantiate in the deployed environmentRedistotypeof Redisthroughoutredis.tsto matchSSE service singleton export (#341)
sseServicesingleton export alongside the existingSSEServiceclass export insse.service.tssse.service.test.tsto import bothSSEServiceandsseServicefrom the corrected export path, unblocking theNotificationDropdownSSE consumerSoroban event worker syntax fix (#345)
soroban-event-worker.tsthat caused an unmatched block, producing a parse/runtime error on deploymentStream controller and test hardening
req.params.addressarray guard ingetUserStreamSummaryto handle cases where Express provides the param as an arrayanytype annotations on.map()and.filter()callbacks ingetUserStreamSummaryto resolve TypeScript strict-mode errorsstream.test.tsmock calls from bareprisma.stream.findMany.mockResolvedValueOncetovi.mocked(prisma.stream.findMany).mockResolvedValueOncefor correct Vitest typed mock usageTesting
Test Coverage
Test Steps
GET /v1/streams?status=active&sort=startTime&order=asc&limit=5&offset=0— verify paginated response shape withdata,total,hasMore,limit,offsetGET /v1/streams?status=invalid— verify400response with descriptive error messageTypeError: RedisClass is not a constructorerrors in logsNotificationDropdownconsumer receives it via the exportedsseServicesingletonpnpm test— all stream and SSE unit tests should passBreaking Changes
GET /v1/streamsresponse shape has changed.Previously returned a bare array. Now returns:
{ "data": [...], "total": 42, "hasMore": true, "limit": 20, "offset": 0 }Migration Guide: Any frontend or client consuming
GET /v1/streamsmust be updated to read fromresponse.data.data(or destructure accordingly) rather than treating the response body as a direct array.Checklist
Additional Notes
The
status→isActivemapping currently mapscancelled,completed, andpausedall toisActive: falsewith comments noting where event-log-based disambiguation could be added in a follow-up. This is intentional to keep the scope of this PR bounded — a separate issue should track enriching status resolution from on-chain event history once the event indexer is stable.