Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d846424
feat: Add messenger `delegate` and `revoke` methods
Gudahtt Jul 17, 2025
fae22d6
Update clearActions to handle delegated actions
Gudahtt Jul 17, 2025
c1dca62
Fix typos
Gudahtt Jul 23, 2025
f0d8027
Update action/event constraints to require namespace
Gudahtt Aug 6, 2025
788736d
Add comment about widened delegated messenger types
Gudahtt Aug 6, 2025
362ff8d
Remove redundant type union entry, and fix type mismatch
Gudahtt Aug 6, 2025
60157bb
Add comment about why delegatedActionHandler type is wider
Gudahtt Aug 6, 2025
cf00dad
Clarify owned action/event restriction
Gudahtt Aug 6, 2025
d92e9c6
Improve ActionType template description
Gudahtt Aug 6, 2025
0aebd12
Add missing template directive
Gudahtt Aug 6, 2025
e0c6a94
Restrict publish to owned events
Gudahtt Aug 6, 2025
6206bb7
Categorize removed class under 'Removed' section
Gudahtt Aug 6, 2025
c9142b5
Rename internal delegation methods and improve descriptions
Gudahtt Aug 6, 2025
3c21bec
Expand description of delegate and revoke
Gudahtt Aug 6, 2025
2aabe88
Fix test fixture type error
Gudahtt Aug 6, 2025
efecaf0
Add changelog entry about constraint type change
Gudahtt Aug 7, 2025
dd6910d
Improve comment and fix typos
Gudahtt Aug 11, 2025
46d1e40
Remove generics from DelegatedMessenger and add capability validation
Gudahtt Aug 11, 2025
ea1f9fe
Add missing template directives
Gudahtt Aug 11, 2025
5544bb9
Fix delegatee type inference
Gudahtt Aug 11, 2025
6933a52
Fix changelog merge error
Gudahtt Aug 11, 2025
8cc055f
Prevent clearing delegation subscriptions
Gudahtt Aug 11, 2025
e0a709a
Add tests for clearing event subscriptions after delegating
Gudahtt Aug 12, 2025
f841de8
Add guard against double-delegation
Gudahtt Aug 12, 2025
19049ef
Improve method handler type safety
Gudahtt Aug 12, 2025
61f5053
Refactor generics to constraint actions/events in generic type, and t…
Gudahtt Aug 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/messenger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Migrate `Messenger` class from `@metamask/base-controller` package ([#6127](https://github.com/MetaMask/core/pull/6127))
- Add `delegate` and `revoke` methods ([#6132](https://github.com/MetaMask/core/pull/6132))
- These allow delegating or revoking capabilities (actions or events) from one `Messenger` instance to another.
- This allows passing capabilities through chains of messengers of arbitrary length
- See this ADR for details: https://github.com/MetaMask/decisions/blob/main/decisions/core/0012-messenger-delegation.md

### Changed

- **BREAKING:** Add `Namespace` type parameter and required `namespace` constructor parameter ([#6132](https://github.com/MetaMask/core/pull/6132))
- All published events and registered actions should fall under the given namespace. Typically the namespace is the controller or service name. This is the equivalent to the `Namespace` parameter from the old `RestrictedMessenger` class.
- **BREAKING:** The `type` property of `ActionConstraint` and `EventConstraint` is now a `NamespacedName` rather than a string ([#6132](https://github.com/MetaMask/core/pull/6132))
- Add default for `ReturnHandler` type parameter of `SelectorEventHandler` and `SelectorFunction` ([#6262](https://github.com/MetaMask/core/pull/6262), [#6264](https://github.com/MetaMask/core/pull/6264))

### Removed

- **BREAKING:** Remove `RestrictedMessenger` class ([#6132](https://github.com/MetaMask/core/pull/6132))
- Existing `RestrictedMessenger` instances should be replaced with a `Messenger`. We can now use the same class everywhere, passing capabilities using `delegate`.
- See this ADR for details: https://github.com/MetaMask/decisions/blob/main/decisions/core/0012-messenger-delegation.md

### Fixed

- Update `unsubscribe` type signature to support selector event handlers ([#6262](https://github.com/MetaMask/core/pull/6262))
Expand Down
Loading
Loading