Skip to content

Latest commit

 

History

History
127 lines (81 loc) · 6.82 KB

File metadata and controls

127 lines (81 loc) · 6.82 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Added

  • Add Messenger.getRegisteredActionTypes method, which returns the action types the messenger can call directly (#9271)
  • Add a buildChild utility method to Messenger (#9338)

Changed

  • Bump @metamask/utils from ^11.9.0 to ^11.11.0 (#9074)

Removed

  • BREAKING: Remove deprecated generate-action-types CLI tool (#9367)
    • The CLI has been extracted to @metamask/messenger-cli. Use messenger-action-types from that package instead.

Fixed

  • Fix Messenger.delegate and Messenger.revoke to reduce the chance of TS2590 errors when delegatee has large number of actions/events or a large number of actions/events are being delegated (#8748)

Added

  • Allow overriding action handler in subclass (#8617)
    • The Messenger class now has a protected getAction method which returns the action handler for a given action name.
  • Add subscribeOnce and waitUntil utility methods to Messenger (#8575)

Deprecated

  • Deprecate generate-action-types CLI tool and messenger-generate-action-types binary (#8378)
    • The CLI has been extracted to @metamask/messenger-cli. Use messenger-action-types from this package instead.

Fixed

  • Throw different error for missing delegated actions (#8557)

Fixed

  • Drop peer dependency on eslint to prevent audit failures on consumers using ESLint 8.x (#8371)

Added

  • Add generate-action-types CLI tool (#8264)
    • Generates TypeScript action type files for controllers and services that define MESSENGER_EXPOSED_METHODS.
    • Available as a CLI binary (messenger-generate-action-types).
      • typescript and eslint are peer dependencies.

Changed

  • This package is now considered stable (#8317)

Added

  • Add captureException constructor parameter (#6605)
    • This function will be used to capture any errors thrown from subscribers.
    • If this is unset but a parent is provided, captureException is inherited from the parent.

Changed

  • Stop re-throwing subscriber errors in a setTimeout (#6605)
    • Instead errors are captured with captureException, or logged to the console.

Added

  • Allow disabling namespace checks in unit tests using the new MOCK_ANY_NAMESPACE constant and MockAnyNamespace type (#6420)
    • To disable namespace checks, use MockAnyNamespace as the Namespace type parameter, and use MOCK_ANY_NAMESPACE as the namespace constructor parameter.

Changed

  • Keep delegated handlers when unregistering actions (#6395)

Added

  • Migrate Messenger class from @metamask/base-controller package (#6127)
  • Add delegate and revoke methods (#6132)
  • Add parent constructor parameter and type parameter to Messenger (#6142)
    • All capabilities registered under this messenger's namespace are delegated to the parent automatically. This is similar to how the RestrictedMessenger would automatically delegate all capabilities to the messenger it was created from.
  • Add MessengerActions and MessengerEvents utility types for extracting actions/events from a Messenger type (#6317)

Changed

  • BREAKING: Add Namespace type parameter and required namespace constructor parameter (#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)
  • Add default for ReturnHandler type parameter of SelectorEventHandler and SelectorFunction (#6262, #6264)
  • Add default of never to action and event type parameters of Messenger (#6311)

Removed