@metamask/composable-controller
Advanced tools
Comparing version
@@ -9,2 +9,7 @@ # Changelog | ||
## [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. | ||
## [3.0.3] | ||
@@ -49,3 +54,4 @@ ### Changed | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@3.0.3...HEAD | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@4.0.0...HEAD | ||
[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@3.0.3...@metamask/composable-controller@4.0.0 | ||
[3.0.3]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@3.0.2...@metamask/composable-controller@3.0.3 | ||
@@ -52,0 +58,0 @@ [3.0.2]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@3.0.1...@metamask/composable-controller@3.0.2 |
import type { RestrictedControllerMessenger } from '@metamask/base-controller'; | ||
import { BaseController } from '@metamask/base-controller'; | ||
import { BaseControllerV1 } from '@metamask/base-controller'; | ||
/** | ||
* List of child controller instances | ||
* | ||
* This type encompasses controllers based up either BaseController or | ||
* BaseControllerV2. The BaseControllerV2 type can't be included directly | ||
* This type encompasses controllers based up either BaseControllerV1 or | ||
* BaseController. The BaseController type can't be included directly | ||
* because the generic parameters it expects require knowing the exact state | ||
* shape, so instead we look for an object with the BaseControllerV2 properties | ||
* shape, so instead we look for an object with the BaseController properties | ||
* that we use in the ComposableController (name and state). | ||
*/ | ||
export declare type ControllerList = (BaseController<any, any> | { | ||
export declare type ControllerList = (BaseControllerV1<any, any> | { | ||
name: string; | ||
@@ -20,3 +20,3 @@ state: Record<string, unknown>; | ||
*/ | ||
export declare class ComposableController extends BaseController<never, any> { | ||
export declare class ComposableController extends BaseControllerV1<never, any> { | ||
private readonly controllers; | ||
@@ -32,3 +32,3 @@ private readonly messagingSystem?; | ||
* @param controllers - Map of names to controller instances. | ||
* @param messenger - The controller messaging system, used for communicating with BaseControllerV2 controllers. | ||
* @param messenger - The controller messaging system, used for communicating with BaseController controllers. | ||
*/ | ||
@@ -35,0 +35,0 @@ constructor(controllers: ControllerList, messenger?: ComposableControllerRestrictedMessenger); |
@@ -8,3 +8,3 @@ "use strict"; | ||
*/ | ||
class ComposableController extends base_controller_1.BaseController { | ||
class ComposableController extends base_controller_1.BaseControllerV1 { | ||
/** | ||
@@ -14,3 +14,3 @@ * Creates a ComposableController instance. | ||
* @param controllers - Map of names to controller instances. | ||
* @param messenger - The controller messaging system, used for communicating with BaseControllerV2 controllers. | ||
* @param messenger - The controller messaging system, used for communicating with BaseController controllers. | ||
*/ | ||
@@ -43,3 +43,3 @@ constructor(controllers, messenger) { | ||
else { | ||
throw new Error(`Messaging system required if any BaseControllerV2 controllers are used`); | ||
throw new Error(`Messaging system required if any BaseController controllers are used`); | ||
} | ||
@@ -46,0 +46,0 @@ }); |
{ | ||
"name": "@metamask/composable-controller", | ||
"version": "3.0.3", | ||
"version": "4.0.0", | ||
"description": "Consolidates the state from multiple controllers into one", | ||
@@ -27,11 +27,12 @@ "keywords": [ | ||
"publish:preview": "yarn npm publish --tag preview", | ||
"test": "jest", | ||
"test": "jest --reporters=jest-silent-reporter", | ||
"test:clean": "jest --clearCache", | ||
"test:verbose": "jest --verbose", | ||
"test:watch": "jest --watch" | ||
}, | ||
"dependencies": { | ||
"@metamask/base-controller": "^3.2.3" | ||
"@metamask/base-controller": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@metamask/auto-changelog": "^3.1.0", | ||
"@metamask/auto-changelog": "^3.4.3", | ||
"@types/jest": "^27.4.1", | ||
@@ -38,0 +39,0 @@ "deepmerge": "^4.2.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16976
2.9%+ Added
- Removed