Socket
Socket
Sign inDemoInstall

@metamask/base-controller

Package Overview
Dependencies
Maintainers
9
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/base-controller - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

10

CHANGELOG.md

@@ -9,2 +9,9 @@ # Changelog

## [3.2.0]
### Changed
- When deriving state, skip properties with invalid metadata ([#1529](https://github.com/MetaMask/core/pull/1529))
- The previous behavior was to throw an error
- An error is thrown in a timeout handler so that it can still be captured in the console, and by global unhandled error handlers.
- Update `@metamask/utils` to `^6.2.0` ([#1514](https://github.com/MetaMask/core/pull/1514))
## [3.1.0]

@@ -58,3 +65,4 @@ ### Changed

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/base-controller@3.1.0...HEAD
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/base-controller@3.2.0...HEAD
[3.2.0]: https://github.com/MetaMask/core/compare/@metamask/base-controller@3.1.0...@metamask/base-controller@3.2.0
[3.1.0]: https://github.com/MetaMask/core/compare/@metamask/base-controller@3.0.0...@metamask/base-controller@3.1.0

@@ -61,0 +69,0 @@ [3.0.0]: https://github.com/MetaMask/core/compare/@metamask/base-controller@2.0.0...@metamask/base-controller@3.0.0

2

dist/BaseController.d.ts

@@ -51,3 +51,3 @@ /**

private internalState;
private internalListeners;
private readonly internalListeners;
/**

@@ -54,0 +54,0 @@ * Creates a BaseController instance. Both initial state and initial

@@ -0,3 +1,3 @@

import type { Json } from '@metamask/utils';
import type { Draft, Patch } from 'immer';
import type { Json } from '@metamask/utils';
import type { RestrictedControllerMessenger } from './ControllerMessenger';

@@ -4,0 +4,0 @@ /**

@@ -119,13 +119,27 @@ "use strict";

return Object.keys(state).reduce((persistedState, key) => {
const propertyMetadata = metadata[key][metadataProperty];
const stateProperty = state[key];
if (typeof propertyMetadata === 'function') {
persistedState[key] = propertyMetadata(stateProperty);
try {
const stateMetadata = metadata[key];
if (!stateMetadata) {
throw new Error(`No metadata found for '${key}'`);
}
const propertyMetadata = stateMetadata[metadataProperty];
const stateProperty = state[key];
if (typeof propertyMetadata === 'function') {
persistedState[key] = propertyMetadata(stateProperty);
}
else if (propertyMetadata) {
persistedState[key] = stateProperty;
}
return persistedState;
}
else if (propertyMetadata) {
persistedState[key] = stateProperty;
catch (error) {
// Throw error after timeout so that it is captured as a console error
// (and by Sentry) without interrupting state-related operations
setTimeout(() => {
throw error;
});
return persistedState;
}
return persistedState;
}, {});
}
//# sourceMappingURL=BaseControllerV2.js.map

@@ -59,6 +59,6 @@ export declare type ActionHandler<Action, ActionType> = (...args: ExtractActionParameters<Action, ActionType>) => ExtractActionResponse<Action, ActionType>;

export declare class RestrictedControllerMessenger<N extends string, Action extends ActionConstraint, Event extends EventConstraint, AllowedAction extends string, AllowedEvent extends string> {
private controllerMessenger;
private controllerName;
private allowedActions;
private allowedEvents;
private readonly controllerMessenger;
private readonly controllerName;
private readonly allowedActions;
private readonly allowedEvents;
/**

@@ -211,8 +211,8 @@ * Constructs a restricted controller messenger

export declare class ControllerMessenger<Action extends ActionConstraint, Event extends EventConstraint> {
private actions;
private events;
private readonly actions;
private readonly events;
/**
* A cache of selector return values for their respective handlers.
*/
private eventPayloadCache;
private readonly eventPayloadCache;
/**

@@ -219,0 +219,0 @@ * Register an action handler.

@@ -1,4 +0,6 @@

export { BaseConfig, BaseController, BaseState, Listener, } from './BaseController';
export { BaseController as BaseControllerV2, Listener as ListenerV2, StateDeriver, StateMetadata, StatePropertyMetadata, getAnonymizedState, getPersistentState, } from './BaseControllerV2';
export type { BaseConfig, BaseState, Listener } from './BaseController';
export { BaseController } from './BaseController';
export type { Listener as ListenerV2, StateDeriver, StateMetadata, StatePropertyMetadata, } from './BaseControllerV2';
export { BaseController as BaseControllerV2, getAnonymizedState, getPersistentState, } from './BaseControllerV2';
export * from './ControllerMessenger';
//# sourceMappingURL=index.d.ts.map
{
"name": "@metamask/base-controller",
"version": "3.1.0",
"version": "3.2.0",
"description": "Provides scaffolding for controllers as well a communication system for all controllers",

@@ -32,3 +32,3 @@ "keywords": [

"dependencies": {
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"immer": "^9.0.6"

@@ -35,0 +35,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc