Skip to content

Conversation

@rekmarks
Copy link
Member

@rekmarks rekmarks commented Oct 29, 2025

Explanation

As a convenience, permit passing one or more middleware functions or an engine to asV2Middleware and asLegacyMiddleware.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Enable asV2Middleware and asLegacyMiddleware to accept one or more middleware functions (in addition to engines), with docs, tests, and changelog updates.

  • API:
    • asV2Middleware() now accepts a legacy JsonRpcEngine or one/more legacy middleware via rest params; composes multiple via mergeMiddleware and preserves error/result forwarding and context propagation.
    • asLegacyMiddleware() now accepts a JsonRpcEngineV2 or one/more V2 middleware via rest params; internally builds a V2 engine when given middleware and preserves request/context propagation.
  • Docs:
    • Update README.md and src/README.md to document converting engines and middleware for both directions, with context propagation notes and examples.
  • Tests:
    • Add/expand tests for single/multiple middleware inputs, error forwarding, and continuation behavior in asV2Middleware.test.ts and v2/asLegacyMiddleware.test.ts.
  • Changelog:
    • Add PR link #6991 to JsonRpcEngineV2 entry in CHANGELOG.md.

Written by Cursor Bugbot for commit 8c7d13b. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Oct 29, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@rekmarks
Copy link
Member Author

@cursor lint the package from root via yarn eslint --fix packages/json-rpc-engine, make changes, and repeat until linting passes.

@cursor

This comment was marked as resolved.

@rekmarks rekmarks force-pushed the cursor/allow-asv2middleware-to-accept-legacy-middleware-1c74 branch 2 times, most recently from 1acb896 to 5441a81 Compare October 29, 2025 17:38
@rekmarks rekmarks changed the title Allow asV2Middleware to accept legacy middleware feat(json-rpc-engine): Permit passing middleware functions to compatibility adapters Oct 29, 2025
@rekmarks rekmarks marked this pull request as ready for review October 30, 2025 01:05
@rekmarks rekmarks requested review from a team as code owners October 30, 2025 01:05
@rekmarks rekmarks force-pushed the cursor/allow-asv2middleware-to-accept-legacy-middleware-1c74 branch from d08c390 to d1fe897 Compare October 30, 2025 17:01
@rekmarks rekmarks enabled auto-merge (squash) October 31, 2025 16:16
@rekmarks rekmarks merged commit e5897c7 into main Oct 31, 2025
260 checks passed
@rekmarks rekmarks deleted the cursor/allow-asv2middleware-to-accept-legacy-middleware-1c74 branch October 31, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants