Skip to content

Commit ce424cb

Browse files
authored
fix(json-rpc-engine): Export MiddlewareContext class (#6971)
## Explanation Export the `MiddlewareContext` class in addition to its type. ## References N/A ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Exports the MiddlewareContext class from json-rpc-engine/v2 and updates tests and changelog references. > > - **Exports (`packages/json-rpc-engine/src/v2/index.ts`)**: > - Add `MiddlewareContext` class to v2 public exports; keep `EmptyContext` as type-only export. > - **Tests (`packages/json-rpc-engine/src/v2/index.test.ts`)**: > - Update export snapshot (sorted) to include `MiddlewareContext`. > - **Changelog (`packages/json-rpc-engine/CHANGELOG.md`)**: > - Add PR reference `#6971` to `JsonRpcEngineV2` entry. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e8f2750. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 0715a3f commit ce424cb

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/json-rpc-engine/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- `JsonRpcEngineV2` ([#6176](https://github.com/MetaMask/core/pull/6176))
12+
- `JsonRpcEngineV2` ([#6176](https://github.com/MetaMask/core/pull/6176), [#6971](https://github.com/MetaMask/core/pull/6971))
1313
- This is a complete rewrite of `JsonRpcEngine`, intended to replace the original implementation.
1414
See the readme for details.
1515

packages/json-rpc-engine/src/v2/index.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import * as allExports from '.';
22

33
describe('@metamask/json-rpc-engine/v2', () => {
44
it('has expected JavaScript exports', () => {
5-
expect(Object.keys(allExports)).toMatchInlineSnapshot(`
5+
expect(Object.keys(allExports).sort()).toMatchInlineSnapshot(`
66
Array [
7+
"JsonRpcEngineError",
8+
"JsonRpcEngineV2",
9+
"JsonRpcServer",
10+
"MiddlewareContext",
711
"asLegacyMiddleware",
812
"getUniqueId",
9-
"JsonRpcServer",
1013
"isNotification",
1114
"isRequest",
12-
"JsonRpcEngineError",
13-
"JsonRpcEngineV2",
1415
]
1516
`);
1617
});

packages/json-rpc-engine/src/v2/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export { asLegacyMiddleware } from './asLegacyMiddleware';
22
export { getUniqueId } from '../getUniqueId';
33
export * from './JsonRpcEngineV2';
44
export { JsonRpcServer } from './JsonRpcServer';
5-
export type { MiddlewareContext, EmptyContext } from './MiddlewareContext';
5+
export { MiddlewareContext } from './MiddlewareContext';
6+
export type { EmptyContext } from './MiddlewareContext';
67
export { isNotification, isRequest, JsonRpcEngineError } from './utils';
78
export type {
89
Json,

0 commit comments

Comments
 (0)