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

@rpldy/uploader

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/uploader - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

lib/batch.js.flow

6

lib/batchItemsSender.js

@@ -8,4 +8,2 @@ "use strict";

var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
var _shared = require("@rpldy/shared");

@@ -54,5 +52,5 @@

var throttledProgress = (0, _throttle2["default"])(function (e) {
var throttledProgress = (0, _shared.throttle)(function (e) {
return onItemUploadProgress(items, batch, e, trigger);
}, _consts.PROGRESS_DELAY);
}, _consts.PROGRESS_DELAY, true);
var send = (0, _shared.isFunction)(batchOptions.send) ? batchOptions.send : _sender["default"];

@@ -59,0 +57,0 @@ return send(items, url, {

@@ -7,2 +7,5 @@ "use strict";

exports.DEFAULT_OPTIONS = exports.DEFAULT_FILTER = exports.DEFAULT_PARAM_NAME = void 0;
var _shared = require("@rpldy/shared");
var DEFAULT_PARAM_NAME = "file";

@@ -16,5 +19,4 @@ exports.DEFAULT_PARAM_NAME = DEFAULT_PARAM_NAME;

exports.DEFAULT_FILTER = DEFAULT_FILTER;
var DEFAULT_OPTIONS = Object.freeze({
var DEFAULT_OPTIONS = (0, _shared.devFreeze)({
autoUpload: true,
// multiple: true,
inputFieldName: "file",

@@ -25,3 +27,2 @@ concurrent: false,

maxGroupSize: 5,
// encoding: "multipart/form-data",
method: "POST",

@@ -28,0 +29,0 @@ params: {},

@@ -6,2 +6,20 @@ "use strict";

});
var _exportNames = {
createUploader: true,
composeEnhancers: true,
UPLOADER_EVENTS: true,
DEFAULT_OPTIONS: true
};
Object.defineProperty(exports, "createUploader", {
enumerable: true,
get: function get() {
return _uploader["default"];
}
});
Object.defineProperty(exports, "composeEnhancers", {
enumerable: true,
get: function get() {
return _composeEnhancers["default"];
}
});
Object.defineProperty(exports, "UPLOADER_EVENTS", {

@@ -23,2 +41,4 @@ enumerable: true,

var _composeEnhancers = _interopRequireDefault(require("./composeEnhancers"));
var _consts = require("./consts");

@@ -28,2 +48,15 @@

var _sender = require("@rpldy/sender");
Object.keys(_sender).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _sender[key];
}
});
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -30,0 +63,0 @@

@@ -8,4 +8,2 @@ "use strict";

var _merge2 = _interopRequireDefault(require("lodash/merge"));
var _shared = require("@rpldy/shared");

@@ -58,3 +56,3 @@

if (updated.options) {
options = (0, _merge2["default"])({}, options, updated.options);
options = (0, _shared.merge)({}, options, updated.options);
}

@@ -61,0 +59,0 @@

@@ -8,6 +8,2 @@ "use strict";

var _merge2 = _interopRequireDefault(require("lodash/merge"));
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
var _lifeEvents = _interopRequireDefault(require("@rpldy/life-events"));

@@ -28,2 +24,4 @@

var EVENT_NAMES = Object.values(_consts.UPLOADER_EVENTS);
var EXT_OUTSIDE_ENHANCER_TIME = "Uploady - uploader extensions can only be registered by enhancers",
EXT_ALREADY_EXISTS = "Uploady - uploader extension by this name [%s] already exists";
var counter = 0;

@@ -33,3 +31,5 @@

counter += 1;
var pendingBatches = [];
var enhancerTime = false;
var pendingBatches = [],
extensions = {};

@@ -45,3 +45,3 @@ _shared.logger.debugLog("uploady.uploader: creating new instance", {

//TODO: updating concurrent and maxConcurrent means we need to update the processor - not supported yet!
uploaderOptions = (0, _merge2["default"])({}, uploaderOptions, updateOptions); //need deep merge for destination
uploaderOptions = (0, _shared.merge)({}, uploaderOptions, updateOptions); //need deep merge for destination

@@ -57,3 +57,3 @@ return uploader;

case 0:
processOptions = (0, _merge2["default"])({}, uploaderOptions, addOptions);
processOptions = (0, _shared.merge)({}, uploaderOptions, addOptions);
batch = (0, _batch["default"])(files, uploader.id, processOptions);

@@ -131,5 +131,18 @@

var getOptions = function getOptions() {
return (0, _cloneDeep2["default"])(uploaderOptions);
return (0, _shared.clone)(uploaderOptions);
};
var registerExtension = function registerExtension(name, methods) {
(0, _shared.invariant)(enhancerTime, EXT_OUTSIDE_ENHANCER_TIME);
(0, _shared.invariant)(!extensions[name], EXT_ALREADY_EXISTS, name);
_shared.logger.debugLog("uploady.uploader: registering extension: ".concat(name.toString()), methods);
extensions[name] = methods;
};
var getExtension = function getExtension(name) {
return extensions[name];
};
var _addLife = (0, _lifeEvents["default"])({

@@ -144,3 +157,5 @@ id: "uploader-".concat(counter),

getPending: getPending,
clearPending: clearPending
clearPending: clearPending,
registerExtension: registerExtension,
getExtension: getExtension
}, EVENT_NAMES, {

@@ -156,3 +171,5 @@ canAddEvents: false,

if (uploaderOptions.enhancer) {
var enhanced = uploaderOptions.enhancer(uploader, trigger); //graceful handling for enhancer forgetting to return uploader
enhancerTime = true;
var enhanced = uploaderOptions.enhancer(uploader, trigger);
enhancerTime = false; //graceful handling for enhancer forgetting to return uploader

@@ -163,5 +180,5 @@ uploader = enhanced || uploader;

var processor = (0, _processor["default"])(trigger, uploaderOptions, uploader.id);
return uploader;
return (0, _shared.devFreeze)(uploader);
};
exports["default"] = _default;
{
"version": "0.1.6",
"version": "0.1.7",
"name": "@rpldy/uploader",

@@ -19,10 +19,9 @@ "description": "",

"dependencies": {
"@rpldy/life-events": "^0.1.6",
"@rpldy/sender": "^0.1.6",
"@rpldy/shared": "^0.1.6",
"immer": "^5.1.0",
"lodash": "^4.17.15"
"@rpldy/life-events": "^0.1.7",
"@rpldy/sender": "^0.1.7",
"@rpldy/shared": "^0.1.7",
"immer": "^6.0.3"
},
"devDependencies": {
"flow-bin": "^0.119.1"
"flow-bin": "^0.121.0"
},

@@ -32,3 +31,3 @@ "publishConfig": {

},
"gitHead": "45d0ec79b4858dea8022c8971f1f16e61a38c027"
"gitHead": "0ac67a2893ef3a684b8cf1834590035065340366"
}
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