From 6c113ee03699e979c3718d357df1d3b5a9037a24 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 17 Oct 2024 14:56:28 -0400 Subject: [PATCH 1/5] remove NotificationController --- packages/notification-controller/CHANGELOG.md | 175 -------------- packages/notification-controller/LICENSE | 20 -- packages/notification-controller/README.md | 15 -- .../notification-controller/jest.config.js | 26 --- packages/notification-controller/package.json | 2 +- .../src/NotificationController.test.ts | 159 ------------- .../src/NotificationController.ts | 219 ------------------ packages/notification-controller/src/index.ts | 1 - .../tsconfig.build.json | 10 - .../notification-controller/tsconfig.json | 8 - packages/notification-controller/typedoc.json | 7 - tsconfig.json | 1 - 12 files changed, 1 insertion(+), 642 deletions(-) delete mode 100644 packages/notification-controller/CHANGELOG.md delete mode 100644 packages/notification-controller/LICENSE delete mode 100644 packages/notification-controller/README.md delete mode 100644 packages/notification-controller/jest.config.js delete mode 100644 packages/notification-controller/src/NotificationController.test.ts delete mode 100644 packages/notification-controller/src/NotificationController.ts delete mode 100644 packages/notification-controller/src/index.ts delete mode 100644 packages/notification-controller/tsconfig.build.json delete mode 100644 packages/notification-controller/tsconfig.json delete mode 100644 packages/notification-controller/typedoc.json diff --git a/packages/notification-controller/CHANGELOG.md b/packages/notification-controller/CHANGELOG.md deleted file mode 100644 index 7ece224cc1..0000000000 --- a/packages/notification-controller/CHANGELOG.md +++ /dev/null @@ -1,175 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [7.0.0] - -### Changed - -- **BREAKING**: The `show` function now uses an option bag rather than a single `string` ([#4682](https://github.com/MetaMask/core/pull/4682)) - - This will be used to persist the extra properties needed to show JSX content in Snap notifications. - -## [6.0.1] - -### Changed - -- Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#4516](https://github.com/MetaMask/core/pull/4516), [#4529](https://github.com/MetaMask/core/pull/4529)) -- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#4516](https://github.com/MetaMask/core/pull/4516)) -- Bump TypeScript from `~4.9.5` to `~5.2.2` and set `moduleResolution` option to `Node16` ([#3645](https://github.com/MetaMask/core/pull/3645), [#4576](https://github.com/MetaMask/core/pull/4576), [#4584](https://github.com/MetaMask/core/pull/4584)) - -### Fixed - -- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files ([#4648](https://github.com/MetaMask/core/pull/4648)) - - Previously, this package shipped with only one variant of type declaration - files, and these files were only CommonJS-compatible, and the `exports` - field in `package.json` linked to these files. This is an anti-pattern and - was rightfully flagged by the - ["Are the Types Wrong?"](https://arethetypeswrong.github.io/) tool as - ["masquerading as CJS"](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md). - All of the ATTW checks now pass. -- Remove chunk files ([#4648](https://github.com/MetaMask/core/pull/4648)). - - Previously, the build tool we used to generate JavaScript files extracted - common code to "chunk" files. While this was intended to make this package - more tree-shakeable, it also made debugging more difficult for our - development teams. These chunk files are no longer present. - -## [6.0.0] - -### Changed - -- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) -- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) - -## [5.0.2] - -### Changed - -- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) - -## [5.0.1] - -### Fixed - -- Fix `types` field in `package.json` ([#4047](https://github.com/MetaMask/core/pull/4047)) - -## [5.0.0] - -### Added - -- **BREAKING**: Add ESM build ([#3998](https://github.com/MetaMask/core/pull/3998)) - - It's no longer possible to import files from `./dist` directly. - -### Changed - -- **BREAKING:** Bump `@metamask/base-controller` to `^5.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039)) - - This version has a number of breaking changes. See the changelog for more. - -## [4.0.2] - -### Changed - -- Bump `@metamask/utils` to `^8.3.0` ([#3769](https://github.com/MetaMask/core/pull/3769)) -- Bump `@metamask/base-controller` to `^4.1.1` ([#3760](https://github.com/MetaMask/core/pull/3760), [#3821](https://github.com/MetaMask/core/pull/3821)) - -## [4.0.1] - -### Changed - -- Bump `@metamask/base-controller` to `^4.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695)) - -## [4.0.0] - -### Changed - -- **BREAKING:** Bump `@metamask/base-controller` to ^4.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063)) - - This is breaking because the type of the `messenger` has backward-incompatible changes. See the changelog for this package for more. -- Bump `@metamask/utils` to ^8.2.0 ([#1957](https://github.com/MetaMask/core/pull/1957)) - -## [3.1.3] - -### Changed - -- Bump dependency on `@metamask/utils` to ^8.1.0 ([#1639](https://github.com/MetaMask/core/pull/1639)) -- Bump dependency on `@metamask/base-controller` to ^3.2.3 - -## [3.1.2] - -### Changed - -- Update TypeScript to v4.8.x ([#1718](https://github.com/MetaMask/core/pull/1718)) - -## [3.1.1] - -### Changed - -- Bump dependency on `@metamask/base-controller` to ^3.2.1 - -## [3.1.0] - -### Changed - -- Update `@metamask/utils` to `^6.2.0` ([#1514](https://github.com/MetaMask/core/pull/1514)) - -## [3.0.0] - -### Changed - -- **BREAKING:** Bump to Node 16 ([#1262](https://github.com/MetaMask/core/pull/1262)) -- Add `@metamask/utils` dependency ([#1275](https://github.com/MetaMask/core/pull/1275)) - -## [2.0.0] - -### Removed - -- **BREAKING:** Remove `isomorphic-fetch` ([#1106](https://github.com/MetaMask/controllers/pull/1106)) - - Consumers must now import `isomorphic-fetch` or another polyfill themselves if they are running in an environment without `fetch` - -## [1.0.2] - -### Changed - -- Rename this repository to `core` ([#1031](https://github.com/MetaMask/controllers/pull/1031)) -- Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041)) - -## [1.0.1] - -### Changed - -- Relax dependencies on `@metamask/base-controller` and `@metamask/controller-utils` (use `^` instead of `~`) ([#998](https://github.com/MetaMask/core/pull/998)) - -## [1.0.0] - -### Added - -- Initial release - - - As a result of converting our shared controllers repo into a monorepo ([#831](https://github.com/MetaMask/core/pull/831)), we've created this package from select parts of [`@metamask/controllers` v33.0.0](https://github.com/MetaMask/core/tree/v33.0.0), namely: - - - Everything in `src/notification` - - All changes listed after this point were applied to this package following the monorepo conversion. - -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@7.0.0...HEAD -[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@6.0.1...@metamask/notification-controller@7.0.0 -[6.0.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@6.0.0...@metamask/notification-controller@6.0.1 -[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.2...@metamask/notification-controller@6.0.0 -[5.0.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.1...@metamask/notification-controller@5.0.2 -[5.0.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.0...@metamask/notification-controller@5.0.1 -[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@4.0.2...@metamask/notification-controller@5.0.0 -[4.0.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@4.0.1...@metamask/notification-controller@4.0.2 -[4.0.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@4.0.0...@metamask/notification-controller@4.0.1 -[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@3.1.3...@metamask/notification-controller@4.0.0 -[3.1.3]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@3.1.2...@metamask/notification-controller@3.1.3 -[3.1.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@3.1.1...@metamask/notification-controller@3.1.2 -[3.1.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@3.1.0...@metamask/notification-controller@3.1.1 -[3.1.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@3.0.0...@metamask/notification-controller@3.1.0 -[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@2.0.0...@metamask/notification-controller@3.0.0 -[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@1.0.2...@metamask/notification-controller@2.0.0 -[1.0.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@1.0.1...@metamask/notification-controller@1.0.2 -[1.0.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@1.0.0...@metamask/notification-controller@1.0.1 -[1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/notification-controller@1.0.0 diff --git a/packages/notification-controller/LICENSE b/packages/notification-controller/LICENSE deleted file mode 100644 index ddfbecf902..0000000000 --- a/packages/notification-controller/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -MIT License - -Copyright (c) 2018 MetaMask - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE diff --git a/packages/notification-controller/README.md b/packages/notification-controller/README.md deleted file mode 100644 index fd07ff253b..0000000000 --- a/packages/notification-controller/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# `@metamask/notification-controller` - -Manages display of notifications within MetaMask. - -## Installation - -`yarn add @metamask/notification-controller` - -or - -`npm install @metamask/notification-controller` - -## Contributing - -This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme). diff --git a/packages/notification-controller/jest.config.js b/packages/notification-controller/jest.config.js deleted file mode 100644 index ca08413339..0000000000 --- a/packages/notification-controller/jest.config.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * For a detailed explanation regarding each configuration property and type check, visit: - * https://jestjs.io/docs/configuration - */ - -const merge = require('deepmerge'); -const path = require('path'); - -const baseConfig = require('../../jest.config.packages'); - -const displayName = path.basename(__dirname); - -module.exports = merge(baseConfig, { - // The display name when running multiple projects - displayName, - - // An object that configures minimum threshold enforcement for coverage results - coverageThreshold: { - global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100, - }, - }, -}); diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index 93446b71d3..003e07918f 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -48,7 +48,7 @@ }, "dependencies": { "@metamask/base-controller": "^7.0.1", - "@metamask/utils": "^9.1.0", + "@metamask/utils": "^9.3.0", "nanoid": "^3.1.31" }, "devDependencies": { diff --git a/packages/notification-controller/src/NotificationController.test.ts b/packages/notification-controller/src/NotificationController.test.ts deleted file mode 100644 index ac1638be2e..0000000000 --- a/packages/notification-controller/src/NotificationController.test.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { ControllerMessenger } from '@metamask/base-controller'; - -import type { - NotificationControllerActions, - NotificationControllerStateChange, -} from './NotificationController'; -import { NotificationController } from './NotificationController'; - -const name = 'NotificationController'; - -/** - * Constructs a unrestricted controller messenger. - * - * @returns A unrestricted controller messenger. - */ -function getUnrestrictedMessenger() { - return new ControllerMessenger< - NotificationControllerActions, - NotificationControllerStateChange - >(); -} - -/** - * Constructs a restricted controller messenger. - * - * @param controllerMessenger - An optional unrestricted messenger - * @returns A restricted controller messenger. - */ -function getRestrictedMessenger( - controllerMessenger = getUnrestrictedMessenger(), -) { - return controllerMessenger.getRestricted({ - name, - allowedActions: [], - allowedEvents: [], - }); -} - -const origin = 'snap_test'; -const message = 'foo'; - -describe('NotificationController', () => { - it('action: NotificationController:show', () => { - const unrestricted = getUnrestrictedMessenger(); - const messenger = getRestrictedMessenger(unrestricted); - - const controller = new NotificationController({ - messenger, - }); - - expect( - unrestricted.call('NotificationController:show', origin, { - message, - }), - ).toBeUndefined(); - - expect( - unrestricted.call('NotificationController:show', origin, { - message, - title: 'title', - interfaceId: '1', - }), - ).toBeUndefined(); - const notifications = Object.values(controller.state.notifications); - expect(notifications).toHaveLength(2); - expect(notifications[0]).toStrictEqual({ - createdDate: expect.any(Number), - id: expect.any(String), - message, - origin, - readDate: null, - expandedView: null, - }); - expect(notifications[1]).toStrictEqual({ - createdDate: expect.any(Number), - id: expect.any(String), - message, - origin, - readDate: null, - expandedView: { title: 'title', interfaceId: '1' }, - }); - }); - - it('action: NotificationController:markViewed', () => { - const unrestricted = getUnrestrictedMessenger(); - const messenger = getRestrictedMessenger(unrestricted); - - const controller = new NotificationController({ - messenger, - }); - - expect( - unrestricted.call('NotificationController:show', origin, { - message, - }), - ).toBeUndefined(); - const notifications = Object.values(controller.state.notifications); - expect(notifications).toHaveLength(1); - expect( - unrestricted.call('NotificationController:markRead', [ - notifications[0].id, - 'foo', - ]), - ).toBeUndefined(); - - const newNotifications = Object.values(controller.state.notifications); - expect(newNotifications).toContainEqual({ - ...notifications[0], - readDate: expect.any(Number), - }); - - expect(newNotifications).toHaveLength(1); - }); - - it('action: NotificationController:dismiss', () => { - const unrestricted = getUnrestrictedMessenger(); - const messenger = getRestrictedMessenger(unrestricted); - - const controller = new NotificationController({ - messenger, - }); - - expect( - unrestricted.call('NotificationController:show', origin, { - message, - }), - ).toBeUndefined(); - const notifications = Object.values(controller.state.notifications); - expect(notifications).toHaveLength(1); - expect( - unrestricted.call('NotificationController:dismiss', [ - notifications[0].id, - 'foo', - ]), - ).toBeUndefined(); - - expect(Object.values(controller.state.notifications)).toHaveLength(0); - }); - - it('action: NotificationController:clear', () => { - const unrestricted = getUnrestrictedMessenger(); - const messenger = getRestrictedMessenger(unrestricted); - - const controller = new NotificationController({ - messenger, - }); - - expect( - unrestricted.call('NotificationController:show', origin, { - message, - }), - ).toBeUndefined(); - const notifications = Object.values(controller.state.notifications); - expect(notifications).toHaveLength(1); - expect(unrestricted.call('NotificationController:clear')).toBeUndefined(); - - expect(Object.values(controller.state.notifications)).toHaveLength(0); - }); -}); diff --git a/packages/notification-controller/src/NotificationController.ts b/packages/notification-controller/src/NotificationController.ts deleted file mode 100644 index 31fb22eca9..0000000000 --- a/packages/notification-controller/src/NotificationController.ts +++ /dev/null @@ -1,219 +0,0 @@ -import type { - ControllerGetStateAction, - ControllerStateChangeEvent, - RestrictedControllerMessenger, -} from '@metamask/base-controller'; -import { BaseController } from '@metamask/base-controller'; -import { hasProperty } from '@metamask/utils'; -import { nanoid } from 'nanoid'; - -/** - * @typedef NotificationControllerState - * @property notifications - Stores existing notifications to be shown in the UI - */ -export type NotificationControllerState = { - notifications: Record; -}; - -/** - * @typedef Notification - Stores information about in-app notifications, to be shown in the UI - * @property id - A UUID that identifies the notification - * @property origin - The origin that requested the notification - * @property createdDate - The notification creation date in milliseconds elapsed since the UNIX epoch - * @property readDate - The notification read date in milliseconds elapsed since the UNIX epoch or null if unread - * @property message - The notification message - */ -export type Notification = { - id: string; - origin: string; - createdDate: number; - readDate: number | null; - message: string; -}; - -/** - * @typedef NotificationOptions - Notification data to be used to display in the UI - * @property message - The notification message - * @property title - The notification's title displayed in expanded view - * @property interfaceId - The interface id of the content to be displayed in expanded view - * @property footerLink - An object holding link information to be used in the expanded view - */ -export type NotificationOptions = { - message: string; - title?: string; - interfaceId?: string; - footerLink?: { href: string; text: string }; -}; - -const name = 'NotificationController'; - -export type NotificationControllerStateChange = ControllerStateChangeEvent< - typeof name, - NotificationControllerState ->; - -export type GetNotificationControllerState = ControllerGetStateAction< - typeof name, - NotificationControllerState ->; - -export type ShowNotification = { - type: `${typeof name}:show`; - handler: NotificationController['show']; -}; - -export type DismissNotification = { - type: `${typeof name}:dismiss`; - handler: NotificationController['dismiss']; -}; - -export type MarkNotificationRead = { - type: `${typeof name}:markRead`; - handler: NotificationController['markRead']; -}; - -export type ClearNotifications = { - type: `${typeof name}:clear`; - handler: NotificationController['clear']; -}; - -export type NotificationControllerActions = - | GetNotificationControllerState - | ShowNotification - | DismissNotification - | MarkNotificationRead - | ClearNotifications; - -export type NotificationControllerMessenger = RestrictedControllerMessenger< - typeof name, - NotificationControllerActions, - NotificationControllerStateChange, - never, - never ->; - -const metadata = { - notifications: { persist: true, anonymous: false }, -}; - -const defaultState = { - notifications: {}, -}; - -/** - * Controller that handles storing notifications and showing them to the user - */ -export class NotificationController extends BaseController< - typeof name, - NotificationControllerState, - NotificationControllerMessenger -> { - /** - * Creates a NotificationController instance. - * - * @param options - Constructor options. - * @param options.messenger - A reference to the messaging system. - * @param options.state - Initial state to set on this controller. - */ - constructor({ - messenger, - state, - }: { - messenger: NotificationControllerMessenger; - state?: Partial; - }) { - super({ - name, - metadata, - messenger, - state: { ...defaultState, ...state }, - }); - - this.messagingSystem.registerActionHandler( - `${name}:show` as const, - (origin: string, options: NotificationOptions) => - this.show(origin, options), - ); - - this.messagingSystem.registerActionHandler( - `${name}:dismiss` as const, - (ids: string[]) => this.dismiss(ids), - ); - - this.messagingSystem.registerActionHandler( - `${name}:markRead` as const, - (ids: string[]) => this.markRead(ids), - ); - - this.messagingSystem.registerActionHandler(`${name}:clear` as const, () => - this.clear(), - ); - } - - /** - * Shows a notification. - * - * @param origin - The origin trying to send a notification - * @param options - Notification args object - * @param options.title - The title to show in an expanded view - * @param options.interfaceId - A interface id for snap content - * @param options.footerLink - Footer object - * @param options.footerLink.href - Footer href - * @param options.footerLink.text - Link text - */ - show(origin: string, options: NotificationOptions) { - const id = nanoid(); - const { message, ...expandedView } = options; - const notification = { - id, - origin, - createdDate: Date.now(), - readDate: null, - message, - expandedView: Object.keys(expandedView).length > 0 ? expandedView : null, - }; - this.update((state) => { - state.notifications[id] = notification; - }); - } - - /** - * Dimisses a list of notifications. - * - * @param ids - A list of notification IDs - */ - dismiss(ids: string[]) { - this.update((state) => { - for (const id of ids) { - if (hasProperty(state.notifications, id)) { - delete state.notifications[id]; - } - } - }); - } - - /** - * Marks a list of notifications as read. - * - * @param ids - A list of notification IDs - */ - markRead(ids: string[]) { - this.update((state) => { - for (const id of ids) { - if (hasProperty(state.notifications, id)) { - state.notifications[id].readDate = Date.now(); - } - } - }); - } - - /** - * Clears the state of the controller, removing all notifications. - * - */ - clear() { - this.update(() => { - return { ...defaultState }; - }); - } -} diff --git a/packages/notification-controller/src/index.ts b/packages/notification-controller/src/index.ts deleted file mode 100644 index 6c896d4826..0000000000 --- a/packages/notification-controller/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './NotificationController'; diff --git a/packages/notification-controller/tsconfig.build.json b/packages/notification-controller/tsconfig.build.json deleted file mode 100644 index e5fd7422b9..0000000000 --- a/packages/notification-controller/tsconfig.build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.packages.build.json", - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist", - "rootDir": "./src" - }, - "references": [{ "path": "../base-controller/tsconfig.build.json" }], - "include": ["../../types", "./src"] -} diff --git a/packages/notification-controller/tsconfig.json b/packages/notification-controller/tsconfig.json deleted file mode 100644 index 34354c4b09..0000000000 --- a/packages/notification-controller/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.packages.json", - "compilerOptions": { - "baseUrl": "./" - }, - "references": [{ "path": "../base-controller" }], - "include": ["../../types", "./src"] -} diff --git a/packages/notification-controller/typedoc.json b/packages/notification-controller/typedoc.json deleted file mode 100644 index c9da015dbf..0000000000 --- a/packages/notification-controller/typedoc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "entryPoints": ["./src/index.ts"], - "excludePrivate": true, - "hideGenerator": true, - "out": "docs", - "tsconfig": "./tsconfig.build.json" -} diff --git a/tsconfig.json b/tsconfig.json index f886671a63..8a188ea3f2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,7 +20,6 @@ { "path": "./packages/message-manager" }, { "path": "./packages/name-controller" }, { "path": "./packages/network-controller" }, - { "path": "./packages/notification-controller" }, { "path": "./packages/notification-services-controller" }, { "path": "./packages/permission-controller" }, { "path": "./packages/permission-log-controller" }, From fcbdb455ff93cffcb66ec2353325e62c7c390775 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 17 Oct 2024 15:07:08 -0400 Subject: [PATCH 2/5] update tsconfig --- tsconfig.build.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.build.json b/tsconfig.build.json index 4e485ea189..8d57b067bf 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -20,7 +20,6 @@ { "path": "./packages/message-manager/tsconfig.build.json" }, { "path": "./packages/name-controller/tsconfig.build.json" }, { "path": "./packages/network-controller/tsconfig.build.json" }, - { "path": "./packages/notification-controller/tsconfig.build.json" }, { "path": "./packages/notification-services-controller/tsconfig.build.json" }, From f1b72278f0882cf2706ea364a64ec5b55ff0cce4 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 17 Oct 2024 17:15:33 -0400 Subject: [PATCH 3/5] another fix --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index ed66bdca2d..733dba2478 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3097,7 +3097,7 @@ __metadata: dependencies: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^7.0.1" - "@metamask/utils": "npm:^9.1.0" + "@metamask/utils": "npm:^9.3.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -3773,9 +3773,9 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^9.0.0, @metamask/utils@npm:^9.1.0, @metamask/utils@npm:^9.2.1": - version: 9.2.1 - resolution: "@metamask/utils@npm:9.2.1" +"@metamask/utils@npm:^9.0.0, @metamask/utils@npm:^9.1.0, @metamask/utils@npm:^9.2.1, @metamask/utils@npm:^9.3.0": + version: 9.3.0 + resolution: "@metamask/utils@npm:9.3.0" dependencies: "@ethereumjs/tx": "npm:^4.2.0" "@metamask/superstruct": "npm:^3.1.0" @@ -3786,7 +3786,7 @@ __metadata: pony-cause: "npm:^2.1.10" semver: "npm:^7.5.4" uuid: "npm:^9.0.1" - checksum: 10/2192797afd91af19898e107afeaf63e89b61dc7285e0a75d0cc814b5b288e4cdfc856781b01904034c4d2c1efd9bdab512af24c7e4dfe7b77a03f1f3d9dec7e8 + checksum: 10/ed6648cd973bbf3b4eb0e862903b795a99d27784c820e19f62f0bc0ddf353e98c2858d7e9aaebc0249a586391b344e35b9249d13c08e3ea0c74b23dc1c6b1558 languageName: node linkType: hard From efc32309a556ed5b426c8e9e8d665f5600b2c65b Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 17 Oct 2024 17:24:20 -0400 Subject: [PATCH 4/5] more fixes --- .github/CODEOWNERS | 3 - README.md | 1 - packages/notification-controller/package.json | 71 ------------------- yarn.lock | 20 +----- 4 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 packages/notification-controller/package.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3fd483ab14..5173d7f19d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -32,7 +32,6 @@ /packages/phishing-controller @MetaMask/product-safety ## Snaps Team -/packages/notification-controller @MetaMask/snaps-devs /packages/rate-limit-controller @MetaMask/snaps-devs ## Wallet API Platform Team @@ -81,8 +80,6 @@ /packages/message-manager/CHANGELOG.md @MetaMask/confirmations @MetaMask/wallet-framework-engineers /packages/name-controller/package.json @MetaMask/confirmations @MetaMask/wallet-framework-engineers /packages/name-controller/CHANGELOG.md @MetaMask/confirmations @MetaMask/wallet-framework-engineers -/packages/notification-controller/package.json @MetaMask/snaps-devs @MetaMask/wallet-framework-engineers -/packages/notification-controller/CHANGELOG.md @MetaMask/snaps-devs @MetaMask/wallet-framework-engineers /packages/notification-services-controller/package.json @MetaMask/notifications @MetaMask/wallet-framework-engineers /packages/notification-services-controller/CHANGELOG.md @MetaMask/notifications @MetaMask/wallet-framework-engineers /packages/profile-sync-controller/package.json @MetaMask/notifications @MetaMask/wallet-framework-engineers diff --git a/README.md b/README.md index e5961edab2..c0d0c21755 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ This repository contains the following packages [^fn1]: - [`@metamask/message-manager`](packages/message-manager) - [`@metamask/name-controller`](packages/name-controller) - [`@metamask/network-controller`](packages/network-controller) -- [`@metamask/notification-controller`](packages/notification-controller) - [`@metamask/notification-services-controller`](packages/notification-services-controller) - [`@metamask/permission-controller`](packages/permission-controller) - [`@metamask/permission-log-controller`](packages/permission-log-controller) diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json deleted file mode 100644 index 003e07918f..0000000000 --- a/packages/notification-controller/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@metamask/notification-controller", - "version": "7.0.0", - "description": "Manages display of notifications within MetaMask", - "keywords": [ - "MetaMask", - "Ethereum" - ], - "homepage": "https://github.com/MetaMask/core/tree/main/packages/notification-controller#readme", - "bugs": { - "url": "https://github.com/MetaMask/core/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/MetaMask/core.git" - }, - "license": "MIT", - "sideEffects": false, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - }, - "./package.json": "./package.json" - }, - "main": "./dist/index.cjs", - "types": "./dist/index.d.cts", - "files": [ - "dist/" - ], - "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", - "build:docs": "typedoc", - "changelog:update": "../../scripts/update-changelog.sh @metamask/notification-controller", - "changelog:validate": "../../scripts/validate-changelog.sh @metamask/notification-controller", - "publish:preview": "yarn npm publish --tag preview", - "since-latest-release": "../../scripts/since-latest-release.sh", - "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", - "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", - "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", - "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" - }, - "dependencies": { - "@metamask/base-controller": "^7.0.1", - "@metamask/utils": "^9.3.0", - "nanoid": "^3.1.31" - }, - "devDependencies": { - "@metamask/auto-changelog": "^3.4.4", - "@types/jest": "^27.4.1", - "deepmerge": "^4.2.2", - "jest": "^27.5.1", - "ts-jest": "^27.1.4", - "typedoc": "^0.24.8", - "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~5.2.2" - }, - "engines": { - "node": "^18.18 || >=20" - }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - } -} diff --git a/yarn.lock b/yarn.lock index 733dba2478..22ecffcb37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3091,24 +3091,6 @@ __metadata: languageName: node linkType: hard -"@metamask/notification-controller@workspace:packages/notification-controller": - version: 0.0.0-use.local - resolution: "@metamask/notification-controller@workspace:packages/notification-controller" - dependencies: - "@metamask/auto-changelog": "npm:^3.4.4" - "@metamask/base-controller": "npm:^7.0.1" - "@metamask/utils": "npm:^9.3.0" - "@types/jest": "npm:^27.4.1" - deepmerge: "npm:^4.2.2" - jest: "npm:^27.5.1" - nanoid: "npm:^3.1.31" - ts-jest: "npm:^27.1.4" - typedoc: "npm:^0.24.8" - typedoc-plugin-missing-exports: "npm:^2.0.0" - typescript: "npm:~5.2.2" - languageName: unknown - linkType: soft - "@metamask/notification-services-controller@workspace:packages/notification-services-controller": version: 0.0.0-use.local resolution: "@metamask/notification-services-controller@workspace:packages/notification-services-controller" @@ -3773,7 +3755,7 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^9.0.0, @metamask/utils@npm:^9.1.0, @metamask/utils@npm:^9.2.1, @metamask/utils@npm:^9.3.0": +"@metamask/utils@npm:^9.0.0, @metamask/utils@npm:^9.1.0, @metamask/utils@npm:^9.2.1": version: 9.3.0 resolution: "@metamask/utils@npm:9.3.0" dependencies: From c6a7d833bbc985f45916838301116c33bd4b1b68 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 17 Oct 2024 17:33:17 -0400 Subject: [PATCH 5/5] update README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c0d0c21755..7f208e8b95 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ linkStyle default opacity:0.5 message_manager(["@metamask/message-manager"]); name_controller(["@metamask/name-controller"]); network_controller(["@metamask/network-controller"]); - notification_controller(["@metamask/notification-controller"]); notification_services_controller(["@metamask/notification-services-controller"]); permission_controller(["@metamask/permission-controller"]); permission_log_controller(["@metamask/permission-log-controller"]); @@ -124,7 +123,6 @@ linkStyle default opacity:0.5 network_controller --> controller_utils; network_controller --> eth_json_rpc_provider; network_controller --> json_rpc_engine; - notification_controller --> base_controller; notification_services_controller --> base_controller; notification_services_controller --> controller_utils; notification_services_controller --> keyring_controller;