Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-dcp-worker

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-dcp-worker - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

29

lib/useDCPWorker.js

@@ -12,3 +12,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.useDCPWorker = exports.WorkerProvider = void 0;
exports.useDCPWorker = void 0;
exports.WorkerProvider = WorkerProvider;
const jsx_runtime_1 = require("react/jsx-runtime");

@@ -174,3 +175,2 @@ /**

}
exports.WorkerProvider = WorkerProvider;
/**

@@ -195,3 +195,3 @@ * Get the key under which to save/load the workerOptions

*
* @returns {WorkerOptions?} The worker options, or null if they weren't found.
* @returns The worker options, or null if they weren't found.
*/

@@ -201,24 +201,8 @@ function loadWorkerOptions() {

const storage = options === null ? {} : JSON.parse(options);
let loadedOptions;
let loadedOptions = null;
if (Object.hasOwn(storage, getWorkerOptionsKey())) {
loadedOptions = storage[getWorkerOptionsKey()];
}
else if (Object.hasOwn(storage, 'defaultMaxWorkers')) {
loadedOptions = storage;
}
if (!loadedOptions)
return null;
if (Object.hasOwn(loadedOptions, 'paymentAddress')) {
if (loadedOptions.paymentAddress instanceof window.dcp.wallet.Keystore) {
loadedOptions.paymentAddress = new window.dcp.wallet.Address(loadedOptions.paymentAddress.address);
}
else if (!(loadedOptions.paymentAddress instanceof window.dcp.wallet.Address)) {
loadedOptions.paymentAddress = new window.dcp.wallet.Address(loadedOptions.paymentAddress);
}
}
// If the saved options have `defaultMaxWorkers`, change that to `defaultMaxSliceCount`
if (Object.hasOwn(loadedOptions, 'defaultMaxWorkers')) {
loadedOptions.defaultMaxSliceCount = loadedOptions.defaultMaxWorkers;
delete loadedOptions.defaultMaxWorkers;
}
return loadedOptions;

@@ -296,3 +280,3 @@ }

if (storageOptions)
applyWorkerOptions(storageOptions); // paymentAddress and maxWorkingSandboxes from localStorage applied onto workerOptions
applyWorkerOptions(storageOptions);
}, [userWorkerOptions]);

@@ -302,3 +286,3 @@ /**

*
* Saves the current cores and paymentAddress configuration
* Saves the current cores configuration
* under dcp-worker-options in local storage to be loaded in next time.

@@ -314,3 +298,2 @@ */

cores: workerOptions.cores,
paymentAddress: workerOptions.paymentAddress,
};

@@ -317,0 +300,0 @@ localStorage.setItem('dcp-worker-options', JSON.stringify(storage));

{
"name": "use-dcp-worker",
"version": "3.0.2",
"version": "4.0.0",
"description": "Embed the DCP Worker in a React app",

@@ -20,4 +20,10 @@ "keywords": [

"author": "Kirill Kirnichansky <kirill@distributive.network>",
"maintainers": [
"Bryan Hoang <bryan@distributive.network>"
],
"contributors": [
"Robert Mirandola <robert@distributive.network>"
"Robert Mirandola <robert@distributive.network>",
"Eddie Roosenmallen <eddie@distributive.network>",
"Ryan Saweczko <ryansaweczko@distributive.network>",
"David Courtis <david@distributive.network>"
],

@@ -39,10 +45,10 @@ "main": "lib/useDCPWorker.js",

"devDependencies": {
"@types/react": "^18.2.30",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.51.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"typescript": "^5.2.2"
"@types/react": "18.3.4",
"@typescript-eslint/eslint-plugin": "8.3.0",
"@typescript-eslint/parser": "8.3.0",
"eslint": "8.57.0",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.11",
"typescript": "5.5.4"
},

@@ -54,7 +60,6 @@ "peerDependencies": {

},
"packageManager": "npm@9.6.7",
"packageManager": "npm@10.8.2+sha512.c7f0088c520a46596b85c6f8f1da943400199748a0f7ea8cb8df75469668dc26f6fb3ba26df87e2884a5ebe91557292d0f3db7d0929cdb4f14910c3032ac81fb",
"engines": {
"node": ">=18",
"npm": ">=7"
"node": ">=18"
}
}

@@ -219,3 +219,3 @@ # use-dcp-worker

MIT © 2023 Distributive Corp.
MIT © 2024 Distributive Corp.

@@ -222,0 +222,0 @@ [npm-version-badge]: https://img.shields.io/npm/v/use-dcp-worker

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