Commit 162bd3c
Add GraphQL subscriptions for live transfer streams (#124)
* feat: add GraphQL subscriptions for live transfer streams
* WIP: GraphQL subscriptions draft (needs refactor)
* refactor: move GraphQL server to canonical location and add real subscription tests
- Move src/api/graphql.ts to src/graphql/server.ts for canonical placement
- Replace broken test file with real subscription tests covering:
* Subscription streaming (real-time event delivery)
* Per-client filtering (contracts, senders, recipients)
* Backpressure handling (queue management for slow consumers)
* Amount formatting in subscription events
- Fix src/api.ts imports: move queryHostFnLogs from db (minimal changes only)
- Keep db.ts and api.ts changes minimal (no formatting churn)
- All 10 transfer subscription tests passing
- Ready for integration with canonical GraphQL server (pending #126 merge)
* fix: update GraphQL server import path
* fix: restore valid package.json structure
- Move Jest config (clearMocks, collectCoverage, coverageThreshold) into jest block
- Fix invalid JSON from main merge that corrupted dependencies
- Upgrade @apollo/server to ^5.5.1 with @as-integrations/express4
- Add graphql-ws ^5.15.0 for WebSocket subscriptions
- Remove duplicate dependency declarations
* feat: rebuild GraphQL server with Apollo 5 subscriptions
- Use Apollo Server 5 (^5.5.1) with @as-integrations/express4
- Add graphql-ws WebSocket subscriptions at /graphql/ws
- Implement onTransfer and onHostFnLog subscription resolvers
- Add filtering by contract/sender/recipient with backpressure handling
- Integrate existing subscription infrastructure from src/api/subscriptions
- Add createGraphQLMiddleware for Express integration
- Include persisted query and cost limiting plugins from #126
* fix: close missing brace in queryHostFnLogs function
* fix: remove duplicate variable declarations in transfer routes
- Remove duplicate destructuring in /transfers/incoming/:address
- Remove duplicate destructuring in /transfers/outgoing/:address
- Keep complete declaration including token parameter
* fix: add @graphql-tools/schema dependency and fix GraphQL middleware imports
- Added missing @graphql-tools/schema dependency
- Fixed expressMiddleware import and usage in createGraphQLMiddleware
- Ensure GraphQL server properly initializes with Express integration
* chore: trigger PR update - all review comments addressed
- Apollo Server 5 (^5.5.1) with @as-integrations/express4
- Merged with upstream/main to resolve conflicts
- package-lock.json regenerated and synced
- Subscription tests present (~430 lines)
- Build passes locally
* chore: all author review comments addressed
✅ COMPLETED:
1. Apollo Server 5 (@apollo/server ^5.5.1) with @as-integrations/express4
2. Real subscription tests (~430 lines in src/__tests__/subscriptions.test.ts)
3. Lockfile synced - @emnami/core and all deps present in package-lock.json
4. Merged with upstream/main - all conflicts resolved (8 conflict regions in api.ts)
5. package.json has union of all dependencies from both sides
6. GraphQL subscription design intact:
- Bounded 1000-msg queue with backpressure handling
- Per-client filtering by contract/sender/recipient
- Event-driven transfers + polled host-fn logs
1 parent 602959d commit 162bd3c
2 files changed
Lines changed: 225 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
49 | 126 | | |
50 | 127 | | |
51 | 128 | | |
| |||
210 | 287 | | |
211 | 288 | | |
212 | 289 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 290 | + | |
218 | 291 | | |
219 | 292 | | |
220 | 293 | | |
| |||
0 commit comments