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

dice-mist

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dice-mist - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

dist/290bdadb5e13fef4b42a.worker.js.map

1

dist/src/MistThreaded.d.ts

@@ -10,2 +10,3 @@ import MistBase from './MistBase';

private checkCompletion;
updateConfig: (config: any) => any;
}

5

dist/src/types.d.ts

@@ -5,3 +5,6 @@ export declare enum WorkerMessages {

START = "start",
ERROR = "error"
UPLOAD = "upload",
CANCEL = "cancel",
ERROR = "error",
CONFIG = "config"
}

@@ -8,0 +11,0 @@ export interface IConfig {

declare class Worker {
evaporate: any;
signHeaders: any;
constructor();

@@ -4,0 +5,0 @@ private listenToEvents;

{
"name": "dice-mist",
"version": "0.0.6",
"version": "0.0.7",
"description": "A wrapper for the evaporate library allowing use in a web worker.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -20,3 +20,3 @@ import MistBase from './MistBase';

this.worker.postMessage({
type: 'upload',
type: WorkerMessages.UPLOAD,
config,

@@ -64,3 +64,3 @@ files,

this.checkCompletion();
this.worker.postMessage({id, type: 'cancel' });
this.worker.postMessage({id, type: WorkerMessages.CANCEL });
})

@@ -73,2 +73,4 @@

}
public updateConfig = config => this.worker.postMessage({ type: WorkerMessages.CONFIG, config });
}

@@ -5,3 +5,6 @@ export enum WorkerMessages {

START = 'start',
ERROR = 'error'
UPLOAD = 'upload',
CANCEL = 'cancel',
ERROR = 'error',
CONFIG = 'config'
}

@@ -8,0 +11,0 @@

import * as Evaporate from 'evaporate';
import * as SparkMD5 from 'spark-md5';
import { sha256 } from 'js-sha256';
import { WorkerMessages } from './types';
class Worker {
evaporate: any;
signHeaders: any;
constructor() {

@@ -18,3 +21,3 @@ this.evaporate = null;

switch (type) {
case 'cancel':
case WorkerMessages.CANCEL:
if (this.evaporate) this.evaporate.cancel(id);

@@ -24,3 +27,5 @@ // @ts-ignore

break;
case 'upload':
case WorkerMessages.UPLOAD:
// Save initial values
this.signHeaders = { ...config.signHeaders };
const augmentedConfig = this.augmentConfig(config);

@@ -30,2 +35,6 @@ this.evaporate = await Evaporate.create(augmentedConfig);

break;
case WorkerMessages.CONFIG:
// Save updated values
this.signHeaders = { ...config.signHeaders };
break;
}

@@ -43,12 +52,12 @@ };

bucket,
progress: progress => postMessage({ type: 'progress', progress, id })
progress: progress => postMessage({ type: WorkerMessages.PROGRESS, progress, id })
};
postMessage({type: 'start', id, cancelId});
postMessage({type: WorkerMessages.START, id, cancelId});
try {
const awsObjectKey = await this.evaporate.add(formattedConfig);
postMessage({type: 'success', id, data, awsObjectKey});
postMessage({type: WorkerMessages.SUCCESS, id, data, awsObjectKey});
} catch (reason) {
postMessage({type: 'error', reason, id });
postMessage({type: WorkerMessages.ERROR, reason, id });
}

@@ -66,3 +75,11 @@ });

return hash.hex();
}
},
// Transform values into getters
signHeaders: Object.keys(config.signHeaders)
.reduce((headers, key) => {
return {
...headers,
[key]: () => this.signHeaders[key]
};
}, {})
})

@@ -69,0 +86,0 @@ }

Sorry, the diff of this file is too big to display

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