@metamask/snaps-controllers 19.0.1 → 20.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/dist/snaps/SnapController-method-action-types.cjs.map +1 -1
- package/dist/snaps/SnapController-method-action-types.d.cts +1 -1
- package/dist/snaps/SnapController-method-action-types.d.mts +1 -1
- package/dist/snaps/SnapController-method-action-types.mjs.map +1 -1
- package/dist/snaps/SnapController.cjs +7 -7
- package/dist/snaps/SnapController.cjs.map +1 -1
- package/dist/snaps/SnapController.d.cts +3 -3
- package/dist/snaps/SnapController.d.cts.map +1 -1
- package/dist/snaps/SnapController.d.mts +3 -3
- package/dist/snaps/SnapController.d.mts.map +1 -1
- package/dist/snaps/SnapController.mjs +7 -7
- package/dist/snaps/SnapController.mjs.map +1 -1
- package/dist/snaps/registry/SnapRegistryController.cjs +5 -2
- package/dist/snaps/registry/SnapRegistryController.cjs.map +1 -1
- package/dist/snaps/registry/SnapRegistryController.d.cts +6 -2
- package/dist/snaps/registry/SnapRegistryController.d.cts.map +1 -1
- package/dist/snaps/registry/SnapRegistryController.d.mts +6 -2
- package/dist/snaps/registry/SnapRegistryController.d.mts.map +1 -1
- package/dist/snaps/registry/SnapRegistryController.mjs +5 -2
- package/dist/snaps/registry/SnapRegistryController.mjs.map +1 -1
- package/dist/snaps/registry/index.cjs.map +1 -1
- package/dist/snaps/registry/index.d.cts +1 -1
- package/dist/snaps/registry/index.d.cts.map +1 -1
- package/dist/snaps/registry/index.d.mts +1 -1
- package/dist/snaps/registry/index.d.mts.map +1 -1
- package/dist/snaps/registry/index.mjs.map +1 -1
- package/dist/utils.d.cts +31 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +31 -1
- package/dist/utils.d.mts.map +1 -1
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [20.0.1]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Skip refetching the registry in `handleRegistryUpdate` ([#3961](https://github.com/MetaMask/snaps/pull/3961))
|
|
15
|
+
|
|
16
|
+
## [20.0.0]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **BREAKING:** Always consume latest registry in `updateRegistry` ([#3948](https://github.com/MetaMask/snaps/pull/3948), [#3949](https://github.com/MetaMask/snaps/pull/3949))
|
|
21
|
+
- `SnapController` now listens for `SnapRegistryController:registryUpdated`.
|
|
22
|
+
- Bump `@metamask/messenger` from `^1.1.0` to `^1.1.1` ([#3944](https://github.com/MetaMask/snaps/pull/3944))
|
|
23
|
+
- Bump `@metamask/utils` from `^11.10.0` to `^11.11.0` ([#3935](https://github.com/MetaMask/snaps/pull/3935))
|
|
24
|
+
|
|
10
25
|
## [19.0.1]
|
|
11
26
|
|
|
12
27
|
### Changed
|
|
@@ -1180,7 +1195,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1180
1195
|
- The version of the package no longer needs to match the version of all other
|
|
1181
1196
|
MetaMask Snaps packages.
|
|
1182
1197
|
|
|
1183
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@
|
|
1198
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@20.0.1...HEAD
|
|
1199
|
+
[20.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@20.0.0...@metamask/snaps-controllers@20.0.1
|
|
1200
|
+
[20.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@19.0.1...@metamask/snaps-controllers@20.0.0
|
|
1184
1201
|
[19.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@19.0.0...@metamask/snaps-controllers@19.0.1
|
|
1185
1202
|
[19.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@18.0.4...@metamask/snaps-controllers@19.0.0
|
|
1186
1203
|
[18.0.4]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@18.0.3...@metamask/snaps-controllers@18.0.4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapController-method-action-types.cjs","sourceRoot":"","sources":["../../src/snaps/SnapController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapController } from './SnapController';\n\n/**\n * Initialise the SnapController.\n *\n * Currently this method sets up the controller and calls the `onStart` lifecycle hook for all\n * runnable Snaps.\n *\n * @param waitForPlatform - Whether to wait for the platform to be ready before returning.\n */\nexport type SnapControllerInitAction = {\n type: `SnapController:init`;\n handler: SnapController['init'];\n};\n\n/**\n * Trigger an update of the registry.\n *\n * As a side-effect of this, preinstalled Snaps may be updated and Snaps may be blocked/unblocked.\n */\nexport type SnapControllerUpdateRegistryAction = {\n type: `SnapController:updateRegistry`;\n handler: SnapController['updateRegistry'];\n};\n\n/**\n * Enables the given snap. A snap can only be started if it is enabled. A snap\n * can only be enabled if it isn't blocked.\n *\n * @param snapId - The id of the Snap to enable.\n */\nexport type SnapControllerEnableSnapAction = {\n type: `SnapController:enableSnap`;\n handler: SnapController['enableSnap'];\n};\n\n/**\n * Disables the given snap. A snap can only be started if it is enabled.\n *\n * @param snapId - The id of the Snap to disable.\n * @returns A promise that resolves once the snap has been disabled.\n */\nexport type SnapControllerDisableSnapAction = {\n type: `SnapController:disableSnap`;\n handler: SnapController['disableSnap'];\n};\n\n/**\n * Stops the given snap, removes all hooks, closes all connections, and\n * terminates its worker.\n *\n * @param snapId - The id of the Snap to stop.\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopSnapAction = {\n type: `SnapController:stopSnap`;\n handler: SnapController['stopSnap'];\n};\n\n/**\n * Stops all running snaps, removes all hooks, closes all connections, and\n * terminates their workers.\n *\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopAllSnapsAction = {\n type: `SnapController:stopAllSnaps`;\n handler: SnapController['stopAllSnaps'];\n};\n\n/**\n * Returns whether the given snap is running.\n * Throws an error if the snap doesn't exist.\n *\n * @param snapId - The id of the Snap to check.\n * @returns `true` if the snap is running, otherwise `false`.\n */\nexport type SnapControllerIsSnapRunningAction = {\n type: `SnapController:isSnapRunning`;\n handler: SnapController['isSnapRunning'];\n};\n\n/**\n * Returns whether the given snap has been added to state.\n *\n * @param snapId - The id of the Snap to check for.\n * @returns `true` if the snap exists in the controller state, otherwise `false`.\n */\nexport type SnapControllerHasSnapAction = {\n type: `SnapController:hasSnap`;\n handler: SnapController['hasSnap'];\n};\n\n/**\n * Gets the snap with the given id if it exists, including all data.\n * This should not be used if the snap is to be serializable, as e.g.\n * the snap sourceCode may be quite large.\n *\n * @param snapId - The id of the Snap to get.\n * @returns The entire snap object from the controller state.\n */\nexport type SnapControllerGetSnapAction = {\n type: `SnapController:getSnap`;\n handler: SnapController['getSnap'];\n};\n\n/**\n * Updates the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be updated.\n * @param newSnapState - The new state of the snap.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerUpdateSnapStateAction = {\n type: `SnapController:updateSnapState`;\n handler: SnapController['updateSnapState'];\n};\n\n/**\n * Clears the state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be cleared.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerClearSnapStateAction = {\n type: `SnapController:clearSnapState`;\n handler: SnapController['clearSnapState'];\n};\n\n/**\n * Gets the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n * @returns The requested snap state or null if no state exists.\n */\nexport type SnapControllerGetSnapStateAction = {\n type: `SnapController:getSnapState`;\n handler: SnapController['getSnapState'];\n};\n\n/**\n * Gets a static auxiliary snap file in a chosen file encoding.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param path - The path to the requested file.\n * @param encoding - An optional requested file encoding.\n * @returns The file requested in the chosen file encoding or null if the file is not found.\n */\nexport type SnapControllerGetSnapFileAction = {\n type: `SnapController:getSnapFile`;\n handler: SnapController['getSnapFile'];\n};\n\n/**\n * Determine if a given Snap ID supports a given minimum version of the Snaps platform\n * by inspecting the platformVersion in the Snap manifest.\n *\n * @param snapId - The Snap ID.\n * @param version - The version.\n * @returns True if the platform version is equal or greater to the passed version, false otherwise.\n */\nexport type SnapControllerIsMinimumPlatformVersionAction = {\n type: `SnapController:isMinimumPlatformVersion`;\n handler: SnapController['isMinimumPlatformVersion'];\n};\n\n/**\n * Completely clear the controller's state: delete all associated data,\n * handlers, event listeners, and permissions; tear down all snap providers.\n * Also re-initializes the controller after clearing the state.\n */\nexport type SnapControllerClearStateAction = {\n type: `SnapController:clearState`;\n handler: SnapController['clearState'];\n};\n\n/**\n * Removes the given snap from state, and clears all associated handlers\n * and listeners.\n *\n * @param snapId - The id of the Snap.\n * @returns A promise that resolves once the snap has been removed.\n */\nexport type SnapControllerRemoveSnapAction = {\n type: `SnapController:removeSnap`;\n handler: SnapController['removeSnap'];\n};\n\n/**\n * Stops the given snaps, removes them from state, and clears all associated\n * permissions, handlers, and listeners.\n *\n * @param snapIds - The ids of the Snaps.\n */\nexport type SnapControllerRemoveSnapsAction = {\n type: `SnapController:removeSnaps`;\n handler: SnapController['removeSnaps'];\n};\n\n/**\n * Disconnect the Snap from the given origin, meaning the origin can no longer\n * interact with the Snap until it is reconnected.\n *\n * @param origin - The origin from which to remove the Snap.\n * @param snapId - The id of the snap to remove.\n */\nexport type SnapControllerDisconnectOriginAction = {\n type: `SnapController:disconnectOrigin`;\n handler: SnapController['disconnectOrigin'];\n};\n\n/**\n * Checks if a list of permissions are dynamic and allowed to be revoked, if they are they will all be revoked.\n *\n * @param snapId - The snap ID.\n * @param permissionNames - The names of the permissions.\n * @throws If non-dynamic permissions are passed.\n */\nexport type SnapControllerRevokeDynamicSnapPermissionsAction = {\n type: `SnapController:revokeDynamicSnapPermissions`;\n handler: SnapController['revokeDynamicSnapPermissions'];\n};\n\n/**\n * Gets all snaps in their truncated format.\n *\n * @returns All installed snaps in their truncated format.\n */\nexport type SnapControllerGetAllSnapsAction = {\n type: `SnapController:getAllSnaps`;\n handler: SnapController['getAllSnaps'];\n};\n\n/**\n * Gets all runnable snaps.\n *\n * @returns All runnable snaps.\n */\nexport type SnapControllerGetRunnableSnapsAction = {\n type: `SnapController:getRunnableSnaps`;\n handler: SnapController['getRunnableSnaps'];\n};\n\n/**\n * Gets the serialized permitted snaps of the given origin, if any.\n *\n * @param origin - The origin whose permitted snaps to retrieve.\n * @returns The serialized permitted snaps for the origin.\n */\nexport type SnapControllerGetPermittedSnapsAction = {\n type: `SnapController:getPermittedSnaps`;\n handler: SnapController['getPermittedSnaps'];\n};\n\n/**\n * Installs the snaps requested by the given origin, returning the snap\n * object if the origin is permitted to install it, and an authorization error\n * otherwise.\n *\n * @param origin - The origin that requested to install the snaps.\n * @param requestedSnaps - The snaps to install.\n * @returns An object of snap ids and snap objects, or errors if a\n * snap couldn't be installed.\n */\nexport type SnapControllerInstallSnapsAction = {\n type: `SnapController:installSnaps`;\n handler: SnapController['installSnaps'];\n};\n\n/**\n * Passes a JSON-RPC request object to the RPC handler function of a snap.\n *\n * @param options - A bag of options.\n * @param options.snapId - The ID of the recipient snap.\n * @param options.origin - The origin of the RPC request.\n * @param options.handler - The handler to trigger on the snap for the request.\n * @param options.request - The JSON-RPC request object.\n * @returns The result of the JSON-RPC request.\n */\nexport type SnapControllerHandleRequestAction = {\n type: `SnapController:handleRequest`;\n handler: SnapController['handleRequest'];\n};\n\n/**\n * Set the active state of the client. This will trigger the `onActive` or\n * `onInactive` lifecycle hooks for all Snaps.\n *\n * @param active - A boolean indicating whether the client is active or not.\n */\nexport type SnapControllerSetClientActiveAction = {\n type: `SnapController:setClientActive`;\n handler: SnapController['setClientActive'];\n};\n\n/**\n * Union of all SnapController action types.\n */\nexport type SnapControllerMethodActions =\n | SnapControllerInitAction\n | SnapControllerUpdateRegistryAction\n | SnapControllerEnableSnapAction\n | SnapControllerDisableSnapAction\n | SnapControllerStopSnapAction\n | SnapControllerStopAllSnapsAction\n | SnapControllerIsSnapRunningAction\n | SnapControllerHasSnapAction\n | SnapControllerGetSnapAction\n | SnapControllerUpdateSnapStateAction\n | SnapControllerClearSnapStateAction\n | SnapControllerGetSnapStateAction\n | SnapControllerGetSnapFileAction\n | SnapControllerIsMinimumPlatformVersionAction\n | SnapControllerClearStateAction\n | SnapControllerRemoveSnapAction\n | SnapControllerRemoveSnapsAction\n | SnapControllerDisconnectOriginAction\n | SnapControllerRevokeDynamicSnapPermissionsAction\n | SnapControllerGetAllSnapsAction\n | SnapControllerGetRunnableSnapsAction\n | SnapControllerGetPermittedSnapsAction\n | SnapControllerInstallSnapsAction\n | SnapControllerHandleRequestAction\n | SnapControllerSetClientActiveAction;\n"]}
|
|
1
|
+
{"version":3,"file":"SnapController-method-action-types.cjs","sourceRoot":"","sources":["../../src/snaps/SnapController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapController } from './SnapController';\n\n/**\n * Initialise the SnapController.\n *\n * Currently this method sets up the controller and calls the `onStart` lifecycle hook for all\n * runnable Snaps.\n *\n * @param waitForPlatform - Whether to wait for the platform to be ready before returning.\n */\nexport type SnapControllerInitAction = {\n type: `SnapController:init`;\n handler: SnapController['init'];\n};\n\n/**\n * Trigger an update of the registry.\n *\n * As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.\n */\nexport type SnapControllerUpdateRegistryAction = {\n type: `SnapController:updateRegistry`;\n handler: SnapController['updateRegistry'];\n};\n\n/**\n * Enables the given snap. A snap can only be started if it is enabled. A snap\n * can only be enabled if it isn't blocked.\n *\n * @param snapId - The id of the Snap to enable.\n */\nexport type SnapControllerEnableSnapAction = {\n type: `SnapController:enableSnap`;\n handler: SnapController['enableSnap'];\n};\n\n/**\n * Disables the given snap. A snap can only be started if it is enabled.\n *\n * @param snapId - The id of the Snap to disable.\n * @returns A promise that resolves once the snap has been disabled.\n */\nexport type SnapControllerDisableSnapAction = {\n type: `SnapController:disableSnap`;\n handler: SnapController['disableSnap'];\n};\n\n/**\n * Stops the given snap, removes all hooks, closes all connections, and\n * terminates its worker.\n *\n * @param snapId - The id of the Snap to stop.\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopSnapAction = {\n type: `SnapController:stopSnap`;\n handler: SnapController['stopSnap'];\n};\n\n/**\n * Stops all running snaps, removes all hooks, closes all connections, and\n * terminates their workers.\n *\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopAllSnapsAction = {\n type: `SnapController:stopAllSnaps`;\n handler: SnapController['stopAllSnaps'];\n};\n\n/**\n * Returns whether the given snap is running.\n * Throws an error if the snap doesn't exist.\n *\n * @param snapId - The id of the Snap to check.\n * @returns `true` if the snap is running, otherwise `false`.\n */\nexport type SnapControllerIsSnapRunningAction = {\n type: `SnapController:isSnapRunning`;\n handler: SnapController['isSnapRunning'];\n};\n\n/**\n * Returns whether the given snap has been added to state.\n *\n * @param snapId - The id of the Snap to check for.\n * @returns `true` if the snap exists in the controller state, otherwise `false`.\n */\nexport type SnapControllerHasSnapAction = {\n type: `SnapController:hasSnap`;\n handler: SnapController['hasSnap'];\n};\n\n/**\n * Gets the snap with the given id if it exists, including all data.\n * This should not be used if the snap is to be serializable, as e.g.\n * the snap sourceCode may be quite large.\n *\n * @param snapId - The id of the Snap to get.\n * @returns The entire snap object from the controller state.\n */\nexport type SnapControllerGetSnapAction = {\n type: `SnapController:getSnap`;\n handler: SnapController['getSnap'];\n};\n\n/**\n * Updates the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be updated.\n * @param newSnapState - The new state of the snap.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerUpdateSnapStateAction = {\n type: `SnapController:updateSnapState`;\n handler: SnapController['updateSnapState'];\n};\n\n/**\n * Clears the state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be cleared.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerClearSnapStateAction = {\n type: `SnapController:clearSnapState`;\n handler: SnapController['clearSnapState'];\n};\n\n/**\n * Gets the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n * @returns The requested snap state or null if no state exists.\n */\nexport type SnapControllerGetSnapStateAction = {\n type: `SnapController:getSnapState`;\n handler: SnapController['getSnapState'];\n};\n\n/**\n * Gets a static auxiliary snap file in a chosen file encoding.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param path - The path to the requested file.\n * @param encoding - An optional requested file encoding.\n * @returns The file requested in the chosen file encoding or null if the file is not found.\n */\nexport type SnapControllerGetSnapFileAction = {\n type: `SnapController:getSnapFile`;\n handler: SnapController['getSnapFile'];\n};\n\n/**\n * Determine if a given Snap ID supports a given minimum version of the Snaps platform\n * by inspecting the platformVersion in the Snap manifest.\n *\n * @param snapId - The Snap ID.\n * @param version - The version.\n * @returns True if the platform version is equal or greater to the passed version, false otherwise.\n */\nexport type SnapControllerIsMinimumPlatformVersionAction = {\n type: `SnapController:isMinimumPlatformVersion`;\n handler: SnapController['isMinimumPlatformVersion'];\n};\n\n/**\n * Completely clear the controller's state: delete all associated data,\n * handlers, event listeners, and permissions; tear down all snap providers.\n * Also re-initializes the controller after clearing the state.\n */\nexport type SnapControllerClearStateAction = {\n type: `SnapController:clearState`;\n handler: SnapController['clearState'];\n};\n\n/**\n * Removes the given snap from state, and clears all associated handlers\n * and listeners.\n *\n * @param snapId - The id of the Snap.\n * @returns A promise that resolves once the snap has been removed.\n */\nexport type SnapControllerRemoveSnapAction = {\n type: `SnapController:removeSnap`;\n handler: SnapController['removeSnap'];\n};\n\n/**\n * Stops the given snaps, removes them from state, and clears all associated\n * permissions, handlers, and listeners.\n *\n * @param snapIds - The ids of the Snaps.\n */\nexport type SnapControllerRemoveSnapsAction = {\n type: `SnapController:removeSnaps`;\n handler: SnapController['removeSnaps'];\n};\n\n/**\n * Disconnect the Snap from the given origin, meaning the origin can no longer\n * interact with the Snap until it is reconnected.\n *\n * @param origin - The origin from which to remove the Snap.\n * @param snapId - The id of the snap to remove.\n */\nexport type SnapControllerDisconnectOriginAction = {\n type: `SnapController:disconnectOrigin`;\n handler: SnapController['disconnectOrigin'];\n};\n\n/**\n * Checks if a list of permissions are dynamic and allowed to be revoked, if they are they will all be revoked.\n *\n * @param snapId - The snap ID.\n * @param permissionNames - The names of the permissions.\n * @throws If non-dynamic permissions are passed.\n */\nexport type SnapControllerRevokeDynamicSnapPermissionsAction = {\n type: `SnapController:revokeDynamicSnapPermissions`;\n handler: SnapController['revokeDynamicSnapPermissions'];\n};\n\n/**\n * Gets all snaps in their truncated format.\n *\n * @returns All installed snaps in their truncated format.\n */\nexport type SnapControllerGetAllSnapsAction = {\n type: `SnapController:getAllSnaps`;\n handler: SnapController['getAllSnaps'];\n};\n\n/**\n * Gets all runnable snaps.\n *\n * @returns All runnable snaps.\n */\nexport type SnapControllerGetRunnableSnapsAction = {\n type: `SnapController:getRunnableSnaps`;\n handler: SnapController['getRunnableSnaps'];\n};\n\n/**\n * Gets the serialized permitted snaps of the given origin, if any.\n *\n * @param origin - The origin whose permitted snaps to retrieve.\n * @returns The serialized permitted snaps for the origin.\n */\nexport type SnapControllerGetPermittedSnapsAction = {\n type: `SnapController:getPermittedSnaps`;\n handler: SnapController['getPermittedSnaps'];\n};\n\n/**\n * Installs the snaps requested by the given origin, returning the snap\n * object if the origin is permitted to install it, and an authorization error\n * otherwise.\n *\n * @param origin - The origin that requested to install the snaps.\n * @param requestedSnaps - The snaps to install.\n * @returns An object of snap ids and snap objects, or errors if a\n * snap couldn't be installed.\n */\nexport type SnapControllerInstallSnapsAction = {\n type: `SnapController:installSnaps`;\n handler: SnapController['installSnaps'];\n};\n\n/**\n * Passes a JSON-RPC request object to the RPC handler function of a snap.\n *\n * @param options - A bag of options.\n * @param options.snapId - The ID of the recipient snap.\n * @param options.origin - The origin of the RPC request.\n * @param options.handler - The handler to trigger on the snap for the request.\n * @param options.request - The JSON-RPC request object.\n * @returns The result of the JSON-RPC request.\n */\nexport type SnapControllerHandleRequestAction = {\n type: `SnapController:handleRequest`;\n handler: SnapController['handleRequest'];\n};\n\n/**\n * Set the active state of the client. This will trigger the `onActive` or\n * `onInactive` lifecycle hooks for all Snaps.\n *\n * @param active - A boolean indicating whether the client is active or not.\n */\nexport type SnapControllerSetClientActiveAction = {\n type: `SnapController:setClientActive`;\n handler: SnapController['setClientActive'];\n};\n\n/**\n * Union of all SnapController action types.\n */\nexport type SnapControllerMethodActions =\n | SnapControllerInitAction\n | SnapControllerUpdateRegistryAction\n | SnapControllerEnableSnapAction\n | SnapControllerDisableSnapAction\n | SnapControllerStopSnapAction\n | SnapControllerStopAllSnapsAction\n | SnapControllerIsSnapRunningAction\n | SnapControllerHasSnapAction\n | SnapControllerGetSnapAction\n | SnapControllerUpdateSnapStateAction\n | SnapControllerClearSnapStateAction\n | SnapControllerGetSnapStateAction\n | SnapControllerGetSnapFileAction\n | SnapControllerIsMinimumPlatformVersionAction\n | SnapControllerClearStateAction\n | SnapControllerRemoveSnapAction\n | SnapControllerRemoveSnapsAction\n | SnapControllerDisconnectOriginAction\n | SnapControllerRevokeDynamicSnapPermissionsAction\n | SnapControllerGetAllSnapsAction\n | SnapControllerGetRunnableSnapsAction\n | SnapControllerGetPermittedSnapsAction\n | SnapControllerInstallSnapsAction\n | SnapControllerHandleRequestAction\n | SnapControllerSetClientActiveAction;\n"]}
|
|
@@ -18,7 +18,7 @@ export type SnapControllerInitAction = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Trigger an update of the registry.
|
|
20
20
|
*
|
|
21
|
-
* As a side-effect
|
|
21
|
+
* As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.
|
|
22
22
|
*/
|
|
23
23
|
export type SnapControllerUpdateRegistryAction = {
|
|
24
24
|
type: `SnapController:updateRegistry`;
|
|
@@ -18,7 +18,7 @@ export type SnapControllerInitAction = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Trigger an update of the registry.
|
|
20
20
|
*
|
|
21
|
-
* As a side-effect
|
|
21
|
+
* As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.
|
|
22
22
|
*/
|
|
23
23
|
export type SnapControllerUpdateRegistryAction = {
|
|
24
24
|
type: `SnapController:updateRegistry`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapController-method-action-types.mjs","sourceRoot":"","sources":["../../src/snaps/SnapController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapController } from './SnapController';\n\n/**\n * Initialise the SnapController.\n *\n * Currently this method sets up the controller and calls the `onStart` lifecycle hook for all\n * runnable Snaps.\n *\n * @param waitForPlatform - Whether to wait for the platform to be ready before returning.\n */\nexport type SnapControllerInitAction = {\n type: `SnapController:init`;\n handler: SnapController['init'];\n};\n\n/**\n * Trigger an update of the registry.\n *\n * As a side-effect of this, preinstalled Snaps may be updated and Snaps may be blocked/unblocked.\n */\nexport type SnapControllerUpdateRegistryAction = {\n type: `SnapController:updateRegistry`;\n handler: SnapController['updateRegistry'];\n};\n\n/**\n * Enables the given snap. A snap can only be started if it is enabled. A snap\n * can only be enabled if it isn't blocked.\n *\n * @param snapId - The id of the Snap to enable.\n */\nexport type SnapControllerEnableSnapAction = {\n type: `SnapController:enableSnap`;\n handler: SnapController['enableSnap'];\n};\n\n/**\n * Disables the given snap. A snap can only be started if it is enabled.\n *\n * @param snapId - The id of the Snap to disable.\n * @returns A promise that resolves once the snap has been disabled.\n */\nexport type SnapControllerDisableSnapAction = {\n type: `SnapController:disableSnap`;\n handler: SnapController['disableSnap'];\n};\n\n/**\n * Stops the given snap, removes all hooks, closes all connections, and\n * terminates its worker.\n *\n * @param snapId - The id of the Snap to stop.\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopSnapAction = {\n type: `SnapController:stopSnap`;\n handler: SnapController['stopSnap'];\n};\n\n/**\n * Stops all running snaps, removes all hooks, closes all connections, and\n * terminates their workers.\n *\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopAllSnapsAction = {\n type: `SnapController:stopAllSnaps`;\n handler: SnapController['stopAllSnaps'];\n};\n\n/**\n * Returns whether the given snap is running.\n * Throws an error if the snap doesn't exist.\n *\n * @param snapId - The id of the Snap to check.\n * @returns `true` if the snap is running, otherwise `false`.\n */\nexport type SnapControllerIsSnapRunningAction = {\n type: `SnapController:isSnapRunning`;\n handler: SnapController['isSnapRunning'];\n};\n\n/**\n * Returns whether the given snap has been added to state.\n *\n * @param snapId - The id of the Snap to check for.\n * @returns `true` if the snap exists in the controller state, otherwise `false`.\n */\nexport type SnapControllerHasSnapAction = {\n type: `SnapController:hasSnap`;\n handler: SnapController['hasSnap'];\n};\n\n/**\n * Gets the snap with the given id if it exists, including all data.\n * This should not be used if the snap is to be serializable, as e.g.\n * the snap sourceCode may be quite large.\n *\n * @param snapId - The id of the Snap to get.\n * @returns The entire snap object from the controller state.\n */\nexport type SnapControllerGetSnapAction = {\n type: `SnapController:getSnap`;\n handler: SnapController['getSnap'];\n};\n\n/**\n * Updates the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be updated.\n * @param newSnapState - The new state of the snap.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerUpdateSnapStateAction = {\n type: `SnapController:updateSnapState`;\n handler: SnapController['updateSnapState'];\n};\n\n/**\n * Clears the state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be cleared.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerClearSnapStateAction = {\n type: `SnapController:clearSnapState`;\n handler: SnapController['clearSnapState'];\n};\n\n/**\n * Gets the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n * @returns The requested snap state or null if no state exists.\n */\nexport type SnapControllerGetSnapStateAction = {\n type: `SnapController:getSnapState`;\n handler: SnapController['getSnapState'];\n};\n\n/**\n * Gets a static auxiliary snap file in a chosen file encoding.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param path - The path to the requested file.\n * @param encoding - An optional requested file encoding.\n * @returns The file requested in the chosen file encoding or null if the file is not found.\n */\nexport type SnapControllerGetSnapFileAction = {\n type: `SnapController:getSnapFile`;\n handler: SnapController['getSnapFile'];\n};\n\n/**\n * Determine if a given Snap ID supports a given minimum version of the Snaps platform\n * by inspecting the platformVersion in the Snap manifest.\n *\n * @param snapId - The Snap ID.\n * @param version - The version.\n * @returns True if the platform version is equal or greater to the passed version, false otherwise.\n */\nexport type SnapControllerIsMinimumPlatformVersionAction = {\n type: `SnapController:isMinimumPlatformVersion`;\n handler: SnapController['isMinimumPlatformVersion'];\n};\n\n/**\n * Completely clear the controller's state: delete all associated data,\n * handlers, event listeners, and permissions; tear down all snap providers.\n * Also re-initializes the controller after clearing the state.\n */\nexport type SnapControllerClearStateAction = {\n type: `SnapController:clearState`;\n handler: SnapController['clearState'];\n};\n\n/**\n * Removes the given snap from state, and clears all associated handlers\n * and listeners.\n *\n * @param snapId - The id of the Snap.\n * @returns A promise that resolves once the snap has been removed.\n */\nexport type SnapControllerRemoveSnapAction = {\n type: `SnapController:removeSnap`;\n handler: SnapController['removeSnap'];\n};\n\n/**\n * Stops the given snaps, removes them from state, and clears all associated\n * permissions, handlers, and listeners.\n *\n * @param snapIds - The ids of the Snaps.\n */\nexport type SnapControllerRemoveSnapsAction = {\n type: `SnapController:removeSnaps`;\n handler: SnapController['removeSnaps'];\n};\n\n/**\n * Disconnect the Snap from the given origin, meaning the origin can no longer\n * interact with the Snap until it is reconnected.\n *\n * @param origin - The origin from which to remove the Snap.\n * @param snapId - The id of the snap to remove.\n */\nexport type SnapControllerDisconnectOriginAction = {\n type: `SnapController:disconnectOrigin`;\n handler: SnapController['disconnectOrigin'];\n};\n\n/**\n * Checks if a list of permissions are dynamic and allowed to be revoked, if they are they will all be revoked.\n *\n * @param snapId - The snap ID.\n * @param permissionNames - The names of the permissions.\n * @throws If non-dynamic permissions are passed.\n */\nexport type SnapControllerRevokeDynamicSnapPermissionsAction = {\n type: `SnapController:revokeDynamicSnapPermissions`;\n handler: SnapController['revokeDynamicSnapPermissions'];\n};\n\n/**\n * Gets all snaps in their truncated format.\n *\n * @returns All installed snaps in their truncated format.\n */\nexport type SnapControllerGetAllSnapsAction = {\n type: `SnapController:getAllSnaps`;\n handler: SnapController['getAllSnaps'];\n};\n\n/**\n * Gets all runnable snaps.\n *\n * @returns All runnable snaps.\n */\nexport type SnapControllerGetRunnableSnapsAction = {\n type: `SnapController:getRunnableSnaps`;\n handler: SnapController['getRunnableSnaps'];\n};\n\n/**\n * Gets the serialized permitted snaps of the given origin, if any.\n *\n * @param origin - The origin whose permitted snaps to retrieve.\n * @returns The serialized permitted snaps for the origin.\n */\nexport type SnapControllerGetPermittedSnapsAction = {\n type: `SnapController:getPermittedSnaps`;\n handler: SnapController['getPermittedSnaps'];\n};\n\n/**\n * Installs the snaps requested by the given origin, returning the snap\n * object if the origin is permitted to install it, and an authorization error\n * otherwise.\n *\n * @param origin - The origin that requested to install the snaps.\n * @param requestedSnaps - The snaps to install.\n * @returns An object of snap ids and snap objects, or errors if a\n * snap couldn't be installed.\n */\nexport type SnapControllerInstallSnapsAction = {\n type: `SnapController:installSnaps`;\n handler: SnapController['installSnaps'];\n};\n\n/**\n * Passes a JSON-RPC request object to the RPC handler function of a snap.\n *\n * @param options - A bag of options.\n * @param options.snapId - The ID of the recipient snap.\n * @param options.origin - The origin of the RPC request.\n * @param options.handler - The handler to trigger on the snap for the request.\n * @param options.request - The JSON-RPC request object.\n * @returns The result of the JSON-RPC request.\n */\nexport type SnapControllerHandleRequestAction = {\n type: `SnapController:handleRequest`;\n handler: SnapController['handleRequest'];\n};\n\n/**\n * Set the active state of the client. This will trigger the `onActive` or\n * `onInactive` lifecycle hooks for all Snaps.\n *\n * @param active - A boolean indicating whether the client is active or not.\n */\nexport type SnapControllerSetClientActiveAction = {\n type: `SnapController:setClientActive`;\n handler: SnapController['setClientActive'];\n};\n\n/**\n * Union of all SnapController action types.\n */\nexport type SnapControllerMethodActions =\n | SnapControllerInitAction\n | SnapControllerUpdateRegistryAction\n | SnapControllerEnableSnapAction\n | SnapControllerDisableSnapAction\n | SnapControllerStopSnapAction\n | SnapControllerStopAllSnapsAction\n | SnapControllerIsSnapRunningAction\n | SnapControllerHasSnapAction\n | SnapControllerGetSnapAction\n | SnapControllerUpdateSnapStateAction\n | SnapControllerClearSnapStateAction\n | SnapControllerGetSnapStateAction\n | SnapControllerGetSnapFileAction\n | SnapControllerIsMinimumPlatformVersionAction\n | SnapControllerClearStateAction\n | SnapControllerRemoveSnapAction\n | SnapControllerRemoveSnapsAction\n | SnapControllerDisconnectOriginAction\n | SnapControllerRevokeDynamicSnapPermissionsAction\n | SnapControllerGetAllSnapsAction\n | SnapControllerGetRunnableSnapsAction\n | SnapControllerGetPermittedSnapsAction\n | SnapControllerInstallSnapsAction\n | SnapControllerHandleRequestAction\n | SnapControllerSetClientActiveAction;\n"]}
|
|
1
|
+
{"version":3,"file":"SnapController-method-action-types.mjs","sourceRoot":"","sources":["../../src/snaps/SnapController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapController } from './SnapController';\n\n/**\n * Initialise the SnapController.\n *\n * Currently this method sets up the controller and calls the `onStart` lifecycle hook for all\n * runnable Snaps.\n *\n * @param waitForPlatform - Whether to wait for the platform to be ready before returning.\n */\nexport type SnapControllerInitAction = {\n type: `SnapController:init`;\n handler: SnapController['init'];\n};\n\n/**\n * Trigger an update of the registry.\n *\n * As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.\n */\nexport type SnapControllerUpdateRegistryAction = {\n type: `SnapController:updateRegistry`;\n handler: SnapController['updateRegistry'];\n};\n\n/**\n * Enables the given snap. A snap can only be started if it is enabled. A snap\n * can only be enabled if it isn't blocked.\n *\n * @param snapId - The id of the Snap to enable.\n */\nexport type SnapControllerEnableSnapAction = {\n type: `SnapController:enableSnap`;\n handler: SnapController['enableSnap'];\n};\n\n/**\n * Disables the given snap. A snap can only be started if it is enabled.\n *\n * @param snapId - The id of the Snap to disable.\n * @returns A promise that resolves once the snap has been disabled.\n */\nexport type SnapControllerDisableSnapAction = {\n type: `SnapController:disableSnap`;\n handler: SnapController['disableSnap'];\n};\n\n/**\n * Stops the given snap, removes all hooks, closes all connections, and\n * terminates its worker.\n *\n * @param snapId - The id of the Snap to stop.\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopSnapAction = {\n type: `SnapController:stopSnap`;\n handler: SnapController['stopSnap'];\n};\n\n/**\n * Stops all running snaps, removes all hooks, closes all connections, and\n * terminates their workers.\n *\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopAllSnapsAction = {\n type: `SnapController:stopAllSnaps`;\n handler: SnapController['stopAllSnaps'];\n};\n\n/**\n * Returns whether the given snap is running.\n * Throws an error if the snap doesn't exist.\n *\n * @param snapId - The id of the Snap to check.\n * @returns `true` if the snap is running, otherwise `false`.\n */\nexport type SnapControllerIsSnapRunningAction = {\n type: `SnapController:isSnapRunning`;\n handler: SnapController['isSnapRunning'];\n};\n\n/**\n * Returns whether the given snap has been added to state.\n *\n * @param snapId - The id of the Snap to check for.\n * @returns `true` if the snap exists in the controller state, otherwise `false`.\n */\nexport type SnapControllerHasSnapAction = {\n type: `SnapController:hasSnap`;\n handler: SnapController['hasSnap'];\n};\n\n/**\n * Gets the snap with the given id if it exists, including all data.\n * This should not be used if the snap is to be serializable, as e.g.\n * the snap sourceCode may be quite large.\n *\n * @param snapId - The id of the Snap to get.\n * @returns The entire snap object from the controller state.\n */\nexport type SnapControllerGetSnapAction = {\n type: `SnapController:getSnap`;\n handler: SnapController['getSnap'];\n};\n\n/**\n * Updates the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be updated.\n * @param newSnapState - The new state of the snap.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerUpdateSnapStateAction = {\n type: `SnapController:updateSnapState`;\n handler: SnapController['updateSnapState'];\n};\n\n/**\n * Clears the state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be cleared.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerClearSnapStateAction = {\n type: `SnapController:clearSnapState`;\n handler: SnapController['clearSnapState'];\n};\n\n/**\n * Gets the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n * @returns The requested snap state or null if no state exists.\n */\nexport type SnapControllerGetSnapStateAction = {\n type: `SnapController:getSnapState`;\n handler: SnapController['getSnapState'];\n};\n\n/**\n * Gets a static auxiliary snap file in a chosen file encoding.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param path - The path to the requested file.\n * @param encoding - An optional requested file encoding.\n * @returns The file requested in the chosen file encoding or null if the file is not found.\n */\nexport type SnapControllerGetSnapFileAction = {\n type: `SnapController:getSnapFile`;\n handler: SnapController['getSnapFile'];\n};\n\n/**\n * Determine if a given Snap ID supports a given minimum version of the Snaps platform\n * by inspecting the platformVersion in the Snap manifest.\n *\n * @param snapId - The Snap ID.\n * @param version - The version.\n * @returns True if the platform version is equal or greater to the passed version, false otherwise.\n */\nexport type SnapControllerIsMinimumPlatformVersionAction = {\n type: `SnapController:isMinimumPlatformVersion`;\n handler: SnapController['isMinimumPlatformVersion'];\n};\n\n/**\n * Completely clear the controller's state: delete all associated data,\n * handlers, event listeners, and permissions; tear down all snap providers.\n * Also re-initializes the controller after clearing the state.\n */\nexport type SnapControllerClearStateAction = {\n type: `SnapController:clearState`;\n handler: SnapController['clearState'];\n};\n\n/**\n * Removes the given snap from state, and clears all associated handlers\n * and listeners.\n *\n * @param snapId - The id of the Snap.\n * @returns A promise that resolves once the snap has been removed.\n */\nexport type SnapControllerRemoveSnapAction = {\n type: `SnapController:removeSnap`;\n handler: SnapController['removeSnap'];\n};\n\n/**\n * Stops the given snaps, removes them from state, and clears all associated\n * permissions, handlers, and listeners.\n *\n * @param snapIds - The ids of the Snaps.\n */\nexport type SnapControllerRemoveSnapsAction = {\n type: `SnapController:removeSnaps`;\n handler: SnapController['removeSnaps'];\n};\n\n/**\n * Disconnect the Snap from the given origin, meaning the origin can no longer\n * interact with the Snap until it is reconnected.\n *\n * @param origin - The origin from which to remove the Snap.\n * @param snapId - The id of the snap to remove.\n */\nexport type SnapControllerDisconnectOriginAction = {\n type: `SnapController:disconnectOrigin`;\n handler: SnapController['disconnectOrigin'];\n};\n\n/**\n * Checks if a list of permissions are dynamic and allowed to be revoked, if they are they will all be revoked.\n *\n * @param snapId - The snap ID.\n * @param permissionNames - The names of the permissions.\n * @throws If non-dynamic permissions are passed.\n */\nexport type SnapControllerRevokeDynamicSnapPermissionsAction = {\n type: `SnapController:revokeDynamicSnapPermissions`;\n handler: SnapController['revokeDynamicSnapPermissions'];\n};\n\n/**\n * Gets all snaps in their truncated format.\n *\n * @returns All installed snaps in their truncated format.\n */\nexport type SnapControllerGetAllSnapsAction = {\n type: `SnapController:getAllSnaps`;\n handler: SnapController['getAllSnaps'];\n};\n\n/**\n * Gets all runnable snaps.\n *\n * @returns All runnable snaps.\n */\nexport type SnapControllerGetRunnableSnapsAction = {\n type: `SnapController:getRunnableSnaps`;\n handler: SnapController['getRunnableSnaps'];\n};\n\n/**\n * Gets the serialized permitted snaps of the given origin, if any.\n *\n * @param origin - The origin whose permitted snaps to retrieve.\n * @returns The serialized permitted snaps for the origin.\n */\nexport type SnapControllerGetPermittedSnapsAction = {\n type: `SnapController:getPermittedSnaps`;\n handler: SnapController['getPermittedSnaps'];\n};\n\n/**\n * Installs the snaps requested by the given origin, returning the snap\n * object if the origin is permitted to install it, and an authorization error\n * otherwise.\n *\n * @param origin - The origin that requested to install the snaps.\n * @param requestedSnaps - The snaps to install.\n * @returns An object of snap ids and snap objects, or errors if a\n * snap couldn't be installed.\n */\nexport type SnapControllerInstallSnapsAction = {\n type: `SnapController:installSnaps`;\n handler: SnapController['installSnaps'];\n};\n\n/**\n * Passes a JSON-RPC request object to the RPC handler function of a snap.\n *\n * @param options - A bag of options.\n * @param options.snapId - The ID of the recipient snap.\n * @param options.origin - The origin of the RPC request.\n * @param options.handler - The handler to trigger on the snap for the request.\n * @param options.request - The JSON-RPC request object.\n * @returns The result of the JSON-RPC request.\n */\nexport type SnapControllerHandleRequestAction = {\n type: `SnapController:handleRequest`;\n handler: SnapController['handleRequest'];\n};\n\n/**\n * Set the active state of the client. This will trigger the `onActive` or\n * `onInactive` lifecycle hooks for all Snaps.\n *\n * @param active - A boolean indicating whether the client is active or not.\n */\nexport type SnapControllerSetClientActiveAction = {\n type: `SnapController:setClientActive`;\n handler: SnapController['setClientActive'];\n};\n\n/**\n * Union of all SnapController action types.\n */\nexport type SnapControllerMethodActions =\n | SnapControllerInitAction\n | SnapControllerUpdateRegistryAction\n | SnapControllerEnableSnapAction\n | SnapControllerDisableSnapAction\n | SnapControllerStopSnapAction\n | SnapControllerStopAllSnapsAction\n | SnapControllerIsSnapRunningAction\n | SnapControllerHasSnapAction\n | SnapControllerGetSnapAction\n | SnapControllerUpdateSnapStateAction\n | SnapControllerClearSnapStateAction\n | SnapControllerGetSnapStateAction\n | SnapControllerGetSnapFileAction\n | SnapControllerIsMinimumPlatformVersionAction\n | SnapControllerClearStateAction\n | SnapControllerRemoveSnapAction\n | SnapControllerRemoveSnapsAction\n | SnapControllerDisconnectOriginAction\n | SnapControllerRevokeDynamicSnapPermissionsAction\n | SnapControllerGetAllSnapsAction\n | SnapControllerGetRunnableSnapsAction\n | SnapControllerGetPermittedSnapsAction\n | SnapControllerInstallSnapsAction\n | SnapControllerHandleRequestAction\n | SnapControllerSetClientActiveAction;\n"]}
|
|
@@ -216,11 +216,11 @@ class SnapController extends base_controller_1.BaseController {
|
|
|
216
216
|
});
|
|
217
217
|
});
|
|
218
218
|
this.messenger.subscribe('KeyringController:lock', this.#handleLock.bind(this));
|
|
219
|
-
this.messenger.subscribe('SnapRegistryController:
|
|
219
|
+
this.messenger.subscribe('SnapRegistryController:registryUpdated', () => {
|
|
220
220
|
this.#handleRegistryUpdate().catch((error) => {
|
|
221
221
|
(0, snaps_utils_1.logError)(`Error when processing Snaps registry update: ${(0, snaps_sdk_1.getErrorMessage)(error)}`);
|
|
222
222
|
});
|
|
223
|
-
}
|
|
223
|
+
});
|
|
224
224
|
this.#initializeStateMachine();
|
|
225
225
|
this.#registerMessageHandlers();
|
|
226
226
|
Object.values(this.state?.snaps ?? {}).forEach((snap) => this.#setupRuntime(snap.id));
|
|
@@ -479,7 +479,7 @@ class SnapController extends base_controller_1.BaseController {
|
|
|
479
479
|
/**
|
|
480
480
|
* Trigger an update of the registry.
|
|
481
481
|
*
|
|
482
|
-
* As a side-effect
|
|
482
|
+
* As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.
|
|
483
483
|
*/
|
|
484
484
|
async updateRegistry() {
|
|
485
485
|
await this.#ensureCanUsePlatform();
|
|
@@ -499,7 +499,7 @@ class SnapController extends base_controller_1.BaseController {
|
|
|
499
499
|
checksum: snap.manifest.source.shasum,
|
|
500
500
|
};
|
|
501
501
|
return blockListArg;
|
|
502
|
-
}, {}));
|
|
502
|
+
}, {}), true);
|
|
503
503
|
await Promise.all(Object.entries(blockedSnaps).map(async ([snapId, { status, reason }]) => {
|
|
504
504
|
if (status === registry_1.SnapRegistryStatus.Blocked) {
|
|
505
505
|
return this.#blockSnap(snapId, reason);
|
|
@@ -513,7 +513,7 @@ class SnapController extends base_controller_1.BaseController {
|
|
|
513
513
|
await Promise.allSettled(Object.values(this.state.snaps)
|
|
514
514
|
.filter((snap) => snap.preinstalled)
|
|
515
515
|
.map(async (snap) => {
|
|
516
|
-
const resolvedVersion = await this.#resolveAllowlistVersion(snap.id, preinstalledVersionRange);
|
|
516
|
+
const resolvedVersion = await this.#resolveAllowlistVersion(snap.id, preinstalledVersionRange, true);
|
|
517
517
|
if (resolvedVersion !== preinstalledVersionRange &&
|
|
518
518
|
(0, utils_1.gtVersion)(resolvedVersion, snap.version)) {
|
|
519
519
|
const location = this.#detectSnapLocation(snap.id, {
|
|
@@ -1640,8 +1640,8 @@ class SnapController extends base_controller_1.BaseController {
|
|
|
1640
1640
|
throw error;
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
async #resolveAllowlistVersion(snapId, versionRange) {
|
|
1644
|
-
return await this.messenger.call('SnapRegistryController:resolveVersion', snapId, versionRange);
|
|
1643
|
+
async #resolveAllowlistVersion(snapId, versionRange, skipRefetch = false) {
|
|
1644
|
+
return await this.messenger.call('SnapRegistryController:resolveVersion', snapId, versionRange, skipRefetch);
|
|
1645
1645
|
}
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Returns a promise representing the complete installation of the requested snap.
|