From d7421f6e137b4349ce8e4b176d16b65e27105bc2 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Wed, 19 Jun 2024 13:30:15 +0100 Subject: [PATCH] refactor: update notification package exports it seems we were inconsistent and forgot to correctly handle default exports and controller exports --- .../NotificationServicesController.test.ts | 3 +-- .../NotificationServicesController.ts | 2 +- .../src/NotificationServicesController/index.ts | 3 +++ .../NotificationServicesPushController.test.ts | 2 +- .../NotificationServicesPushController.ts | 2 +- .../src/NotificationServicesPushController/index.ts | 3 +++ .../src/controllers/authentication/index.ts | 3 +++ .../src/controllers/user-storage/encryption/index.ts | 1 + .../src/controllers/user-storage/index.ts | 4 +++- packages/profile-sync-controller/src/sdk/encryption.ts | 4 ++-- 10 files changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts index ae3b18b9ee7..3a637e46629 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts @@ -25,8 +25,7 @@ import { mockMarkNotificationsAsRead, } from './__fixtures__/mockServices'; import { waitFor } from './__fixtures__/test-utils'; -import { - NotificationServicesController, +import NotificationServicesController, { defaultState, } from './NotificationServicesController'; import type { diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts index 308f434cc79..ef77e0b8741 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts @@ -236,7 +236,7 @@ type FeatureAnnouncementEnv = { /** * Controller that enables wallet notifications and feature announcements */ -export class NotificationServicesController extends BaseController< +export default class NotificationServicesController extends BaseController< typeof controllerName, NotificationServicesControllerState, NotificationServicesControllerMessenger diff --git a/packages/notification-services-controller/src/NotificationServicesController/index.ts b/packages/notification-services-controller/src/NotificationServicesController/index.ts index 1fd0ee9ba0c..163646e27ad 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/index.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/index.ts @@ -1,3 +1,6 @@ +import Controller from './NotificationServicesController'; + +export { Controller }; export * from './NotificationServicesController'; export * as Types from './types'; export * as Mocks from './__fixtures__'; diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts index 5ac2f0c9d6e..333a056d594 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.test.ts @@ -1,7 +1,7 @@ import { ControllerMessenger } from '@metamask/base-controller'; import type { AuthenticationController } from '@metamask/profile-sync-controller'; -import { NotificationServicesPushController } from './NotificationServicesPushController'; +import NotificationServicesPushController from './NotificationServicesPushController'; import type { AllowedActions, AllowedEvents, diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts index 018396ebb40..4c49aa93709 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts @@ -115,7 +115,7 @@ type ControllerConfig = { * * @augments {BaseController} */ -export class NotificationServicesPushController extends BaseController< +export default class NotificationServicesPushController extends BaseController< typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/index.ts b/packages/notification-services-controller/src/NotificationServicesPushController/index.ts index ecff150083e..012dd290255 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/index.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/index.ts @@ -1,3 +1,6 @@ +import Controller from './NotificationServicesPushController'; + +export { Controller }; export * from './NotificationServicesPushController'; export * as Types from './types'; export * as Utils from './utils'; diff --git a/packages/profile-sync-controller/src/controllers/authentication/index.ts b/packages/profile-sync-controller/src/controllers/authentication/index.ts index 8ce30b898d2..ece95fff72b 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/index.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/index.ts @@ -1,2 +1,5 @@ +import Controller from './AuthenticationController'; + +export { Controller }; export * from './AuthenticationController'; export * as Mocks from './__fixtures__'; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts b/packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts index 3582e3b9e2a..90cdb5f5f2e 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts @@ -1,4 +1,5 @@ import Encryption from './encryption'; +export { Encryption }; export * from './encryption'; export default Encryption; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/index.ts b/packages/profile-sync-controller/src/controllers/user-storage/index.ts index 69a3f0b2661..01c28fababb 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/index.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/index.ts @@ -1,4 +1,6 @@ +import Controller from './UserStorageController'; + +export { Controller }; export * from './UserStorageController'; export * from './encryption'; - export * as Mocks from './__fixtures__'; diff --git a/packages/profile-sync-controller/src/sdk/encryption.ts b/packages/profile-sync-controller/src/sdk/encryption.ts index 24c2d3043f8..4070e4f2532 100644 --- a/packages/profile-sync-controller/src/sdk/encryption.ts +++ b/packages/profile-sync-controller/src/sdk/encryption.ts @@ -162,8 +162,8 @@ class EncryptorDecryptor { } } -const encryption = new EncryptorDecryptor(); -export default encryption; +export const Encryption = new EncryptorDecryptor(); +export default Encryption; /** * Create a SHA-256 hash from a given string.