From 9c00587b7fc0669c8b26e892a3c6d5f89b0e01e9 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 10 Dec 2024 18:16:47 -0330 Subject: [PATCH] Fix and simplify aliases --- packages/base-controller/src/Messenger.ts | 17 +---------- .../src/RestrictedMessenger.ts | 29 +------------------ 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/packages/base-controller/src/Messenger.ts b/packages/base-controller/src/Messenger.ts index fbc225efb9..4d10201913 100644 --- a/packages/base-controller/src/Messenger.ts +++ b/packages/base-controller/src/Messenger.ts @@ -459,19 +459,4 @@ export class Messenger< } } -/** - * A message broker for "actions" and "events". - * - * The messenger allows registering functions as 'actions' that can be called elsewhere, - * and it allows publishing and subscribing to events. Both actions and events are identified by - * unique strings. - * - * @template Action - A type union of all Action types. - * @template Event - A type union of all Event types. - * @deprecated This has been renamed to `Messenger`. - */ -export const ControllerMessenger = Messenger; -export type ControllerMessenger< - Action extends ActionConstraint, - Event extends EventConstraint, -> = Messenger; +export { Messenger as ControllerMessenger }; diff --git a/packages/base-controller/src/RestrictedMessenger.ts b/packages/base-controller/src/RestrictedMessenger.ts index f9976b2df7..c1cd62b6ad 100644 --- a/packages/base-controller/src/RestrictedMessenger.ts +++ b/packages/base-controller/src/RestrictedMessenger.ts @@ -430,31 +430,4 @@ export class RestrictedMessenger< } } -/** - * Constructs a restricted messenger - * - * The provided allowlists grant the ability to call the listed actions and subscribe to the - * listed events. The "name" provided grants ownership of any actions and events under that - * namespace. Ownership allows registering actions and publishing events, as well as - * unregistering actions and clearing event subscriptions. - * - * @param options - Options. - * @param options.controllerMessenger - The messenger instance that is being wrapped. (deprecated) - * @param options.messenger - The messenger instance that is being wrapped. - * @param options.name - The name of the thing this messenger will be handed to (e.g. the - * controller name). This grants "ownership" of actions and events under this namespace to the - * restricted messenger returned. - * @param options.allowedActions - The list of actions that this restricted messenger should be - * allowed to call. - * @param options.allowedEvents - The list of events that this restricted messenger should be - * allowed to subscribe to. - * @deprecated This has been renamed to `RestrictedMessenger`. - */ -export const RestrictedControllerMessenger = RestrictedMessenger; -export type RestrictedControllerMessenger< - Namespace extends string, - Action extends ActionConstraint, - Event extends EventConstraint, - AllowedAction extends string, - AllowedEvent extends string, -> = RestrictedMessenger; +export { RestrictedMessenger as RestrictedControllerMessenger };