Add .streamedOptions and .liveOptions for SSE / async-generator routes#3
Add .streamedOptions and .liveOptions for SSE / async-generator routes#3NeilTheFisher wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6c350d8. Configure here.
| "elysia": "^1.4.28", | ||
| "expect-type": "^1.3.0", | ||
| "typescript": "^6.0.2", | ||
| "typescript": "^6.0.3", |
There was a problem hiding this comment.
Peer dependency too loose for new API requirements
High Severity
The peerDependencies for @tanstack/query-core is ">=5.0.0", but the new code has a top-level import { experimental_streamedQuery } which was only added in v5.86.0, and liveQuery uses context.client on QueryFunctionContext which was added around v5.62.0. Any user with a @tanstack/query-core version between 5.0.0 and 5.85.x will hit a runtime import failure when loading the library, even if they never use the streaming features.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 6c350d8. Configure here.
* feat: add .streamedOptions and .liveOptions for SSE/async-generator routes - streamedOptions accumulates yielded chunks into TChunk[] via TanStack experimental_streamedQuery (refetchMode passthrough). - liveOptions writes each chunk to setQueryData and resolves to the latest chunk; mirrors orpc's liveQuery semantics. - Added type signatures on EdenTQMethod and EdenTQUtilsMethod, with chunk inference via AsyncIterableElement<ExtractData<Res>>. - Renamed package to @neilthefisher/eden-tanstack-query, bumped to 0.2.0. - Added tests covering accumulation, last-chunk replacement, and the non-iterable-route guard. - Documented the new helpers in README. * test: cover Elysia sse() helper for streamed and live options --------- Co-authored-by: Neil Fisher <nfisher@summit-tech.ca>
…en-tanstack-query@0.2.1
6c350d8 to
fab2e04
Compare
|
You have used all of your free Bugbot PR reviews. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |


Adds two helpers for Elysia routes that return an async generator (or use
sse()):.streamedOptions()— built on TanStack'sexperimental_streamedQuery. Chunks accumulate asTChunk[]. SupportsrefetchMode("append" | "reset" | "replace")..liveOptions()— writes each chunk to cache viasetQueryData; resolves to the latest chunk.Both are also exposed on
createEdenTQUtils.TChunkinferred viaAsyncIterableElement<ExtractData<Res>>.Continues from #2 (closed due to branch recreation).
Note
Medium Risk
Adds new query helpers built on TanStack Query’s experimental streaming API and introduces cache-writing behavior for live streams, which could affect client query lifecycle/refetch semantics. Also renames/repackages the library as a scoped fork, which may impact consumers’ import paths and publishing.
Overview
Adds SSE/async-generator route support via new
.streamedOptions()and.liveOptions()helpers on both the Eden method decorators andcreateEdenTQUtils, enabling TanStack Query queries to consumeAsyncIterableresponses (including Elysiasse()payloads).Implements streamed accumulation using
experimental_streamedQuerywith a configurablerefetchMode, and implements live streaming by writing each chunk to cache withsetQueryDataand resolving to the final chunk (erroring if nothing is yielded).Updates types/exports and documentation accordingly, adds coverage for streamed/live behavior, and adjusts package metadata (scoped rename, version bump) plus dependency/lockfile updates (including removal of
bun.lock).Reviewed by Cursor Bugbot for commit 6c350d8. Bugbot is set up for automated code reviews on this repo. Configure here.