@uppy/core
Advanced tools
Comparing version 1.18.1 to 1.19.0
@@ -243,3 +243,4 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
message: '' | ||
} | ||
}, | ||
recoveredState: null | ||
}); | ||
@@ -710,3 +711,3 @@ this._storeUnsubscribe = this.store.subscribe(function (prevState, nextState, patch) { | ||
if (files[fileID]) { | ||
if (files[fileID] && !files[fileID].isGhost) { | ||
this._showOrLogErrorAndThrow(new RestrictionError(this.i18n('noDuplicates', { | ||
@@ -794,4 +795,14 @@ fileName: fileName | ||
var newFile = this._checkAndCreateFileStateObject(files, file); | ||
var newFile = this._checkAndCreateFileStateObject(files, file); // Users are asked to re-select recovered files without data, | ||
// and to keep the progress, meta and everthing else, we only replace said data | ||
if (files[newFile.id] && files[newFile.id].isGhost) { | ||
newFile = _extends({}, files[newFile.id], { | ||
data: file.data, | ||
isGhost: false | ||
}); | ||
this.log("Replaced the blob in the restored ghost file: " + newFile.name + ", " + newFile.id); | ||
} | ||
this.setState({ | ||
@@ -811,3 +822,5 @@ files: _extends({}, files, (_extends3 = {}, _extends3[newFile.id] = newFile, _extends3)) | ||
* | ||
* If an error occurs while adding a file, it is logged and the user is notified. This is good for UI plugins, but not for programmatic use. Programmatic users should usually still use `addFile()` on individual files. | ||
* If an error occurs while adding a file, it is logged and the user is notified. | ||
* This is good for UI plugins, but not for programmatic use. | ||
* Programmatic users should usually still use `addFile()` on individual files. | ||
*/ | ||
@@ -829,6 +842,16 @@ ; | ||
try { | ||
var newFile = this._checkAndCreateFileStateObject(files, fileDescriptors[i]); | ||
var newFile = this._checkAndCreateFileStateObject(files, fileDescriptors[i]); // Users are asked to re-select recovered files without data, | ||
// and to keep the progress, meta and everthing else, we only replace said data | ||
if (files[newFile.id] && files[newFile.id].isGhost) { | ||
newFile = _extends({}, files[newFile.id], { | ||
data: fileDescriptors[i].data, | ||
isGhost: false | ||
}); | ||
this.log("Replaced blob in a ghost file: " + newFile.name + ", " + newFile.id); | ||
} | ||
files[newFile.id] = newFile; | ||
newFiles.push(newFile); | ||
files[newFile.id] = newFile; | ||
} catch (err) { | ||
@@ -906,3 +929,2 @@ if (!err.isRestriction) { | ||
var uploadsToRemove = []; | ||
Object.keys(updatedUploads).forEach(function (uploadID) { | ||
@@ -912,3 +934,3 @@ var newFileIDs = currentUploads[uploadID].fileIDs.filter(fileIsNotRemoved); // Remove the upload if no files are associated with it anymore. | ||
if (newFileIDs.length === 0) { | ||
uploadsToRemove.push(uploadID); | ||
delete updatedUploads[uploadID]; | ||
return; | ||
@@ -921,9 +943,7 @@ } | ||
}); | ||
uploadsToRemove.forEach(function (uploadID) { | ||
delete updatedUploads[uploadID]; | ||
}); | ||
var stateUpdate = { | ||
currentUploads: updatedUploads, | ||
files: updatedFiles | ||
}; // If all files were removed - allow new uploads! | ||
}; // If all files were removed - allow new uploads, | ||
// and clear recoveredState | ||
@@ -933,2 +953,3 @@ if (Object.keys(updatedFiles).length === 0) { | ||
stateUpdate.error = null; | ||
stateUpdate.recoveredState = null; | ||
} | ||
@@ -1062,3 +1083,4 @@ | ||
totalProgress: 0, | ||
error: null | ||
error: null, | ||
recoveredState: null | ||
}); | ||
@@ -1909,3 +1931,3 @@ }; | ||
Uppy.VERSION = "1.18.1"; | ||
Uppy.VERSION = "1.19.0"; | ||
@@ -1912,0 +1934,0 @@ module.exports = function (opts) { |
{ | ||
"name": "@uppy/core", | ||
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:", | ||
"version": "1.18.1", | ||
"version": "1.19.0", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"@uppy/store-default": "^1.2.6", | ||
"@uppy/utils": "^3.5.0", | ||
"@uppy/utils": "^3.6.0", | ||
"cuid": "^2.1.1", | ||
@@ -33,3 +33,3 @@ "lodash.throttle": "^4.1.1", | ||
}, | ||
"gitHead": "a87e8a8b80f9d1ef2b2082c0385e02f837505d3c" | ||
"gitHead": "12b7bd34e8f193e86561dd623024279103865a85" | ||
} |
@@ -207,2 +207,3 @@ /* global AggregateError */ | ||
}, | ||
recoveredState: null, | ||
}) | ||
@@ -618,3 +619,3 @@ | ||
if (files[fileID]) { | ||
if (files[fileID] && !files[fileID].isGhost) { | ||
this._showOrLogErrorAndThrow(new RestrictionError(this.i18n('noDuplicates', { fileName })), { file }) | ||
@@ -689,4 +690,15 @@ } | ||
const { files } = this.getState() | ||
const newFile = this._checkAndCreateFileStateObject(files, file) | ||
let newFile = this._checkAndCreateFileStateObject(files, file) | ||
// Users are asked to re-select recovered files without data, | ||
// and to keep the progress, meta and everthing else, we only replace said data | ||
if (files[newFile.id] && files[newFile.id].isGhost) { | ||
newFile = { | ||
...files[newFile.id], | ||
data: file.data, | ||
isGhost: false, | ||
} | ||
this.log(`Replaced the blob in the restored ghost file: ${newFile.name}, ${newFile.id}`) | ||
} | ||
this.setState({ | ||
@@ -711,3 +723,5 @@ files: { | ||
* | ||
* If an error occurs while adding a file, it is logged and the user is notified. This is good for UI plugins, but not for programmatic use. Programmatic users should usually still use `addFile()` on individual files. | ||
* If an error occurs while adding a file, it is logged and the user is notified. | ||
* This is good for UI plugins, but not for programmatic use. | ||
* Programmatic users should usually still use `addFile()` on individual files. | ||
*/ | ||
@@ -723,5 +737,15 @@ addFiles (fileDescriptors) { | ||
try { | ||
const newFile = this._checkAndCreateFileStateObject(files, fileDescriptors[i]) | ||
let newFile = this._checkAndCreateFileStateObject(files, fileDescriptors[i]) | ||
// Users are asked to re-select recovered files without data, | ||
// and to keep the progress, meta and everthing else, we only replace said data | ||
if (files[newFile.id] && files[newFile.id].isGhost) { | ||
newFile = { | ||
...files[newFile.id], | ||
data: fileDescriptors[i].data, | ||
isGhost: false, | ||
} | ||
this.log(`Replaced blob in a ghost file: ${newFile.name}, ${newFile.id}`) | ||
} | ||
files[newFile.id] = newFile | ||
newFiles.push(newFile) | ||
files[newFile.id] = newFile | ||
} catch (err) { | ||
@@ -792,3 +816,3 @@ if (!err.isRestriction) { | ||
} | ||
const uploadsToRemove = [] | ||
Object.keys(updatedUploads).forEach((uploadID) => { | ||
@@ -799,3 +823,3 @@ const newFileIDs = currentUploads[uploadID].fileIDs.filter(fileIsNotRemoved) | ||
if (newFileIDs.length === 0) { | ||
uploadsToRemove.push(uploadID) | ||
delete updatedUploads[uploadID] | ||
return | ||
@@ -810,6 +834,2 @@ } | ||
uploadsToRemove.forEach((uploadID) => { | ||
delete updatedUploads[uploadID] | ||
}) | ||
const stateUpdate = { | ||
@@ -820,6 +840,8 @@ currentUploads: updatedUploads, | ||
// If all files were removed - allow new uploads! | ||
// If all files were removed - allow new uploads, | ||
// and clear recoveredState | ||
if (Object.keys(updatedFiles).length === 0) { | ||
stateUpdate.allowNewUpload = true | ||
stateUpdate.error = null | ||
stateUpdate.recoveredState = null | ||
} | ||
@@ -947,2 +969,3 @@ | ||
error: null, | ||
recoveredState: null, | ||
}) | ||
@@ -949,0 +972,0 @@ } |
@@ -161,2 +161,3 @@ const fs = require('fs') | ||
totalProgress: 0, | ||
recoveredState: null, | ||
} | ||
@@ -186,2 +187,3 @@ | ||
totalProgress: 0, | ||
recoveredState: null, | ||
}) | ||
@@ -200,2 +202,3 @@ // new state | ||
totalProgress: 0, | ||
recoveredState: null, | ||
}) | ||
@@ -240,2 +243,3 @@ }) | ||
totalProgress: 0, | ||
recoveredState: null, | ||
}) | ||
@@ -301,2 +305,3 @@ }) | ||
totalProgress: 0, | ||
recoveredState: null, | ||
}) | ||
@@ -303,0 +308,0 @@ expect(plugin.mocks.uninstall.mock.calls.length).toEqual(1) |
@@ -223,2 +223,3 @@ import UppyUtils = require('@uppy/utils') | ||
close(): void | ||
logout(): void | ||
info( | ||
@@ -225,0 +226,0 @@ message: string | { message: string; details: string }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5901
339756
27
Updated@uppy/utils@^3.6.0