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 multiple middleware functions (in addition to engines), with docs, tests, and changelog updates.

  • API (compatibility adapters)
    • asV2Middleware(...): add overloads to accept single/multiple legacy JsonRpcEngine middlewares; composes via mergeMiddleware; existing engine support unchanged.
    • asLegacyMiddleware(...): add overloads to accept single/multiple V2 JsonRpcMiddleware; wraps them in a temporary V2 engine internally.
  • Behavior & Tests
    • Verify composing multiple middlewares, forwarding results/errors, and continuing pipeline when middleware doesn’t end.
    • Confirm context/request propagation between legacy and V2 paths.
  • Docs
    • Update README.md and src/README.md with new usage examples (engine vs. middleware conversion) and context propagation notes.
  • Changelog
    • Append PR reference to JsonRpcEngineV2 entry in CHANGELOG.md.

Written by Cursor Bugbot for commit d1fe897. 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
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