@uppy/core
Advanced tools
Comparing version 1.16.2 to 1.17.0
@@ -7,3 +7,3 @@ 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); } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
@@ -14,3 +14,3 @@ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
@@ -636,3 +636,3 @@ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } | ||
if (details) { | ||
logMessageWithDetails += ' ' + details; | ||
logMessageWithDetails += " " + details; | ||
} | ||
@@ -702,3 +702,3 @@ | ||
} else if (fileType.split('/')[0] === 'image') { | ||
fileName = fileType.split('/')[0] + '.' + fileType.split('/')[1]; | ||
fileName = fileType.split('/')[0] + "." + fileType.split('/')[1]; | ||
} else { | ||
@@ -1175,3 +1175,3 @@ fileName = 'noname'; | ||
if (error.details) { | ||
errorMsg += ' ' + error.details; | ||
errorMsg += " " + error.details; | ||
} | ||
@@ -1191,3 +1191,3 @@ | ||
if (error.details) { | ||
errorMsg += ' ' + error.details; | ||
errorMsg += " " + error.details; | ||
} | ||
@@ -1209,3 +1209,3 @@ | ||
if (error.details) { | ||
newError.details += ' ' + error.details; | ||
newError.details += " " + error.details; | ||
} | ||
@@ -1894,3 +1894,3 @@ | ||
Uppy.VERSION = "1.16.2"; | ||
Uppy.VERSION = "1.17.0"; | ||
@@ -1897,0 +1897,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.16.2", | ||
"version": "1.17.0", | ||
"license": "MIT", | ||
@@ -24,4 +24,4 @@ "main": "lib/index.js", | ||
"@transloadit/prettier-bytes": "0.0.7", | ||
"@uppy/store-default": "^1.2.5", | ||
"@uppy/utils": "^3.4.2", | ||
"@uppy/store-default": "^1.2.6", | ||
"@uppy/utils": "^3.5.0", | ||
"cuid": "^2.1.1", | ||
@@ -33,3 +33,3 @@ "lodash.throttle": "^4.1.1", | ||
}, | ||
"gitHead": "4bf107236340dc98f8584f15a06e13ffa9fc31f4" | ||
"gitHead": "1751241362692202ed626f752fc740d4db0f2a9a" | ||
} |
284
src/index.js
@@ -14,3 +14,4 @@ const Translator = require('@uppy/utils/lib/Translator') | ||
const { justErrorsLogger, debugLogger } = require('./loggers') | ||
const Plugin = require('./Plugin') // Exported from here. | ||
const Plugin = require('./Plugin') | ||
// Exported from here. | ||
class RestrictionError extends Error { | ||
@@ -41,11 +42,11 @@ constructor (...args) { | ||
0: 'Failed to add %{smart_count} file due to an internal error', | ||
1: 'Failed to add %{smart_count} files due to internal errors' | ||
1: 'Failed to add %{smart_count} files due to internal errors', | ||
}, | ||
youCanOnlyUploadX: { | ||
0: 'You can only upload %{smart_count} file', | ||
1: 'You can only upload %{smart_count} files' | ||
1: 'You can only upload %{smart_count} files', | ||
}, | ||
youHaveToAtLeastSelectX: { | ||
0: 'You have to select at least %{smart_count} file', | ||
1: 'You have to select at least %{smart_count} files' | ||
1: 'You have to select at least %{smart_count} files', | ||
}, | ||
@@ -72,3 +73,3 @@ // The default `exceedsSize2` string only combines the `exceedsSize` string (%{backwardsCompat}) with the size. | ||
0: 'Select %{smart_count}', | ||
1: 'Select %{smart_count}' | ||
1: 'Select %{smart_count}', | ||
}, | ||
@@ -93,5 +94,5 @@ selectAllFilesFromFolderNamed: 'Select all files from folder %{name}', | ||
0: 'Added %{smart_count} file from %{folder}', | ||
1: 'Added %{smart_count} files from %{folder}' | ||
} | ||
} | ||
1: 'Added %{smart_count} files from %{folder}', | ||
}, | ||
}, | ||
} | ||
@@ -110,3 +111,3 @@ | ||
minNumberOfFiles: null, | ||
allowedFileTypes: null | ||
allowedFileTypes: null, | ||
}, | ||
@@ -118,3 +119,3 @@ meta: {}, | ||
logger: justErrorsLogger, | ||
infoTimeout: 5000 | ||
infoTimeout: 5000, | ||
} | ||
@@ -129,4 +130,4 @@ | ||
...defaultOptions.restrictions, | ||
...(opts && opts.restrictions) | ||
} | ||
...(opts && opts.restrictions), | ||
}, | ||
} | ||
@@ -144,5 +145,5 @@ | ||
if (this.opts.restrictions.allowedFileTypes && | ||
this.opts.restrictions.allowedFileTypes !== null && | ||
!Array.isArray(this.opts.restrictions.allowedFileTypes)) { | ||
if (this.opts.restrictions.allowedFileTypes | ||
&& this.opts.restrictions.allowedFileTypes !== null | ||
&& !Array.isArray(this.opts.restrictions.allowedFileTypes)) { | ||
throw new TypeError('`restrictions.allowedFileTypes` must be an array') | ||
@@ -204,3 +205,3 @@ } | ||
individualCancellation: true, | ||
resumableUploads: false | ||
resumableUploads: false, | ||
}, | ||
@@ -212,4 +213,4 @@ totalProgress: 0, | ||
type: 'info', | ||
message: '' | ||
} | ||
message: '', | ||
}, | ||
}) | ||
@@ -299,5 +300,3 @@ | ||
this.setState({ | ||
files: Object.assign({}, this.getState().files, { | ||
[fileID]: Object.assign({}, this.getState().files[fileID], state) | ||
}) | ||
files: { ...this.getState().files, [fileID]: { ...this.getState().files[fileID], ...state } }, | ||
}) | ||
@@ -319,4 +318,4 @@ } | ||
...this.opts.restrictions, | ||
...(newOpts && newOpts.restrictions) | ||
} | ||
...(newOpts && newOpts.restrictions), | ||
}, | ||
} | ||
@@ -344,9 +343,9 @@ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
} | ||
const files = Object.assign({}, this.getState().files) | ||
const files = { ...this.getState().files } | ||
const updatedFiles = {} | ||
Object.keys(files).forEach(fileID => { | ||
const updatedFile = Object.assign({}, files[fileID]) | ||
updatedFile.progress = Object.assign({}, updatedFile.progress, defaultProgress) | ||
const updatedFile = { ...files[fileID] } | ||
updatedFile.progress = { ...updatedFile.progress, ...defaultProgress } | ||
updatedFiles[fileID] = updatedFile | ||
@@ -357,3 +356,3 @@ }) | ||
files: updatedFiles, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
}) | ||
@@ -398,9 +397,7 @@ | ||
setMeta (data) { | ||
const updatedMeta = Object.assign({}, this.getState().meta, data) | ||
const updatedFiles = Object.assign({}, this.getState().files) | ||
const updatedMeta = { ...this.getState().meta, ...data } | ||
const updatedFiles = { ...this.getState().files } | ||
Object.keys(updatedFiles).forEach((fileID) => { | ||
updatedFiles[fileID] = Object.assign({}, updatedFiles[fileID], { | ||
meta: Object.assign({}, updatedFiles[fileID].meta, data) | ||
}) | ||
updatedFiles[fileID] = { ...updatedFiles[fileID], meta: { ...updatedFiles[fileID].meta, ...data } } | ||
}) | ||
@@ -413,3 +410,3 @@ | ||
meta: updatedMeta, | ||
files: updatedFiles | ||
files: updatedFiles, | ||
}) | ||
@@ -419,3 +416,3 @@ } | ||
setFileMeta (fileID, data) { | ||
const updatedFiles = Object.assign({}, this.getState().files) | ||
const updatedFiles = { ...this.getState().files } | ||
if (!updatedFiles[fileID]) { | ||
@@ -425,6 +422,4 @@ this.log('Was trying to set metadata for a file that has been removed: ', fileID) | ||
} | ||
const newMeta = Object.assign({}, updatedFiles[fileID].meta, data) | ||
updatedFiles[fileID] = Object.assign({}, updatedFiles[fileID], { | ||
meta: newMeta | ||
}) | ||
const newMeta = { ...updatedFiles[fileID].meta, ...data } | ||
updatedFiles[fileID] = { ...updatedFiles[fileID], meta: newMeta } | ||
this.setState({ files: updatedFiles }) | ||
@@ -462,3 +457,3 @@ } | ||
return { | ||
result: true | ||
result: true, | ||
} | ||
@@ -468,3 +463,3 @@ } catch (err) { | ||
result: false, | ||
reason: err.message | ||
reason: err.message, | ||
} | ||
@@ -522,3 +517,3 @@ } | ||
backwardsCompat: this.i18n('exceedsSize'), | ||
size: prettierBytes(maxTotalFileSize) | ||
size: prettierBytes(maxTotalFileSize), | ||
})) | ||
@@ -533,3 +528,3 @@ } | ||
backwardsCompat: this.i18n('exceedsSize'), | ||
size: prettierBytes(maxFileSize) | ||
size: prettierBytes(maxFileSize), | ||
})) | ||
@@ -543,3 +538,3 @@ } | ||
throw new RestrictionError(this.i18n('inferiorSize', { | ||
size: prettierBytes(minFileSize) | ||
size: prettierBytes(minFileSize), | ||
})) | ||
@@ -581,3 +576,3 @@ } | ||
if (details) { | ||
logMessageWithDetails += ' ' + details | ||
logMessageWithDetails += ` ${details}` | ||
} | ||
@@ -594,3 +589,3 @@ if (err.isRestriction) { | ||
if (showInformer) { | ||
this.info({ message: message, details: details }, 'error', this.opts.infoTimeout) | ||
this.info({ message, details }, 'error', this.opts.infoTimeout) | ||
} | ||
@@ -637,3 +632,3 @@ | ||
} else if (fileType.split('/')[0] === 'image') { | ||
fileName = fileType.split('/')[0] + '.' + fileType.split('/')[1] | ||
fileName = `${fileType.split('/')[0]}.${fileType.split('/')[1]}` | ||
} else { | ||
@@ -664,3 +659,3 @@ fileName = 'noname' | ||
...this.getState().meta, | ||
...meta | ||
...meta, | ||
}, | ||
@@ -674,8 +669,8 @@ type: fileType, | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}, | ||
size: size, | ||
isRemote: isRemote, | ||
size, | ||
isRemote, | ||
remote: file.remote || '', | ||
preview: file.preview | ||
preview: file.preview, | ||
} | ||
@@ -724,4 +719,4 @@ | ||
...files, | ||
[newFile.id]: newFile | ||
} | ||
[newFile.id]: newFile, | ||
}, | ||
}) | ||
@@ -792,3 +787,3 @@ | ||
message: this.i18n('addBulkFilesFailed', { smart_count: errors.length }), | ||
details: message | ||
details: message, | ||
}, 'error', this.opts.infoTimeout) | ||
@@ -831,3 +826,3 @@ | ||
...currentUploads[uploadID], | ||
fileIDs: newFileIDs | ||
fileIDs: newFileIDs, | ||
} | ||
@@ -842,3 +837,3 @@ }) | ||
currentUploads: updatedUploads, | ||
files: updatedFiles | ||
files: updatedFiles, | ||
} | ||
@@ -872,4 +867,4 @@ | ||
pauseResume (fileID) { | ||
if (!this.getState().capabilities.resumableUploads || | ||
this.getFile(fileID).uploadComplete) { | ||
if (!this.getState().capabilities.resumableUploads | ||
|| this.getFile(fileID).uploadComplete) { | ||
return | ||
@@ -882,3 +877,3 @@ } | ||
this.setFileState(fileID, { | ||
isPaused: isPaused | ||
isPaused, | ||
}) | ||
@@ -892,12 +887,10 @@ | ||
pauseAll () { | ||
const updatedFiles = Object.assign({}, this.getState().files) | ||
const updatedFiles = { ...this.getState().files } | ||
const inProgressUpdatedFiles = Object.keys(updatedFiles).filter((file) => { | ||
return !updatedFiles[file].progress.uploadComplete && | ||
updatedFiles[file].progress.uploadStarted | ||
return !updatedFiles[file].progress.uploadComplete | ||
&& updatedFiles[file].progress.uploadStarted | ||
}) | ||
inProgressUpdatedFiles.forEach((file) => { | ||
const updatedFile = Object.assign({}, updatedFiles[file], { | ||
isPaused: true | ||
}) | ||
const updatedFile = { ...updatedFiles[file], isPaused: true } | ||
updatedFiles[file] = updatedFile | ||
@@ -911,13 +904,14 @@ }) | ||
resumeAll () { | ||
const updatedFiles = Object.assign({}, this.getState().files) | ||
const updatedFiles = { ...this.getState().files } | ||
const inProgressUpdatedFiles = Object.keys(updatedFiles).filter((file) => { | ||
return !updatedFiles[file].progress.uploadComplete && | ||
updatedFiles[file].progress.uploadStarted | ||
return !updatedFiles[file].progress.uploadComplete | ||
&& updatedFiles[file].progress.uploadStarted | ||
}) | ||
inProgressUpdatedFiles.forEach((file) => { | ||
const updatedFile = Object.assign({}, updatedFiles[file], { | ||
const updatedFile = { | ||
...updatedFiles[file], | ||
isPaused: false, | ||
error: null | ||
}) | ||
error: null, | ||
} | ||
updatedFiles[file] = updatedFile | ||
@@ -931,3 +925,3 @@ }) | ||
retryAll () { | ||
const updatedFiles = Object.assign({}, this.getState().files) | ||
const updatedFiles = { ...this.getState().files } | ||
const filesToRetry = Object.keys(updatedFiles).filter(file => { | ||
@@ -938,6 +932,7 @@ return updatedFiles[file].error | ||
filesToRetry.forEach((file) => { | ||
const updatedFile = Object.assign({}, updatedFiles[file], { | ||
const updatedFile = { | ||
...updatedFiles[file], | ||
isPaused: false, | ||
error: null | ||
}) | ||
error: null, | ||
} | ||
updatedFiles[file] = updatedFile | ||
@@ -947,3 +942,3 @@ }) | ||
files: updatedFiles, | ||
error: null | ||
error: null, | ||
}) | ||
@@ -956,3 +951,3 @@ | ||
successful: [], | ||
failed: [] | ||
failed: [], | ||
}) | ||
@@ -962,3 +957,3 @@ } | ||
const uploadID = this._createUpload(filesToRetry, { | ||
forceAllowNewUpload: true // create new upload even if allowNewUpload: false | ||
forceAllowNewUpload: true, // create new upload even if allowNewUpload: false | ||
}) | ||
@@ -980,3 +975,3 @@ return this._runUpload(uploadID) | ||
totalProgress: 0, | ||
error: null | ||
error: null, | ||
}) | ||
@@ -988,3 +983,3 @@ } | ||
error: null, | ||
isPaused: false | ||
isPaused: false, | ||
}) | ||
@@ -995,3 +990,3 @@ | ||
const uploadID = this._createUpload([fileID], { | ||
forceAllowNewUpload: true // create new upload even if allowNewUpload: false | ||
forceAllowNewUpload: true, // create new upload even if allowNewUpload: false | ||
}) | ||
@@ -1022,4 +1017,4 @@ return this._runUpload(uploadID) | ||
? Math.round(data.bytesUploaded / data.bytesTotal * 100) | ||
: 0 | ||
} | ||
: 0, | ||
}, | ||
}) | ||
@@ -1036,5 +1031,5 @@ | ||
const inProgress = files.filter((file) => { | ||
return file.progress.uploadStarted || | ||
file.progress.preprocess || | ||
file.progress.postprocess | ||
return file.progress.uploadStarted | ||
|| file.progress.preprocess | ||
|| file.progress.postprocess | ||
}) | ||
@@ -1101,3 +1096,3 @@ | ||
if (error.details) { | ||
errorMsg += ' ' + error.details | ||
errorMsg += ` ${error.details}` | ||
} | ||
@@ -1115,3 +1110,3 @@ | ||
if (error.details) { | ||
errorMsg += ' ' + error.details | ||
errorMsg += ` ${error.details}` | ||
} | ||
@@ -1121,3 +1116,3 @@ | ||
error: errorMsg, | ||
response | ||
response, | ||
}) | ||
@@ -1131,11 +1126,11 @@ | ||
if (error.details) { | ||
newError.details += ' ' + error.details | ||
newError.details += ` ${error.details}` | ||
} | ||
newError.message = this.i18n('failedToUpload', { file: file.name }) | ||
this._showOrLogErrorAndThrow(newError, { | ||
throwErr: false | ||
throwErr: false, | ||
}) | ||
} else { | ||
this._showOrLogErrorAndThrow(error, { | ||
throwErr: false | ||
throwErr: false, | ||
}) | ||
@@ -1160,4 +1155,4 @@ } | ||
bytesUploaded: 0, | ||
bytesTotal: file.size | ||
} | ||
bytesTotal: file.size, | ||
}, | ||
}) | ||
@@ -1176,13 +1171,14 @@ }) | ||
this.setFileState(file.id, { | ||
progress: Object.assign({}, currentProgress, { | ||
progress: { | ||
...currentProgress, | ||
postprocess: this.postProcessors.length > 0 ? { | ||
mode: 'indeterminate' | ||
mode: 'indeterminate', | ||
} : null, | ||
uploadComplete: true, | ||
percentage: 100, | ||
bytesUploaded: currentProgress.bytesTotal | ||
}), | ||
bytesUploaded: currentProgress.bytesTotal, | ||
}, | ||
response: uploadResp, | ||
uploadURL: uploadResp.uploadURL, | ||
isPaused: false | ||
isPaused: false, | ||
}) | ||
@@ -1199,5 +1195,3 @@ | ||
this.setFileState(file.id, { | ||
progress: Object.assign({}, this.getFile(file.id).progress, { | ||
preprocess: progress | ||
}) | ||
progress: { ...this.getFile(file.id).progress, preprocess: progress }, | ||
}) | ||
@@ -1211,9 +1205,7 @@ }) | ||
} | ||
const files = Object.assign({}, this.getState().files) | ||
files[file.id] = Object.assign({}, files[file.id], { | ||
progress: Object.assign({}, files[file.id].progress) | ||
}) | ||
const files = { ...this.getState().files } | ||
files[file.id] = { ...files[file.id], progress: { ...files[file.id].progress } } | ||
delete files[file.id].progress.preprocess | ||
this.setState({ files: files }) | ||
this.setState({ files }) | ||
}) | ||
@@ -1227,5 +1219,3 @@ | ||
this.setFileState(file.id, { | ||
progress: Object.assign({}, this.getState().files[file.id].progress, { | ||
postprocess: progress | ||
}) | ||
progress: { ...this.getState().files[file.id].progress, postprocess: progress }, | ||
}) | ||
@@ -1240,3 +1230,3 @@ }) | ||
const files = { | ||
...this.getState().files | ||
...this.getState().files, | ||
} | ||
@@ -1246,4 +1236,4 @@ files[file.id] = { | ||
progress: { | ||
...files[file.id].progress | ||
} | ||
...files[file.id].progress, | ||
}, | ||
} | ||
@@ -1255,3 +1245,3 @@ delete files[file.id].progress.postprocess | ||
this.setState({ files: files }) | ||
this.setState({ files }) | ||
}) | ||
@@ -1273,4 +1263,4 @@ | ||
updateOnlineStatus () { | ||
const online = | ||
typeof window.navigator.onLine !== 'undefined' | ||
const online | ||
= typeof window.navigator.onLine !== 'undefined' | ||
? window.navigator.onLine | ||
@@ -1305,4 +1295,4 @@ : true | ||
if (typeof Plugin !== 'function') { | ||
const msg = `Expected a plugin class, but got ${Plugin === null ? 'null' : typeof Plugin}.` + | ||
' Please verify that the plugin was imported and spelled correctly.' | ||
const msg = `Expected a plugin class, but got ${Plugin === null ? 'null' : typeof Plugin}.` | ||
+ ' Please verify that the plugin was imported and spelled correctly.' | ||
throw new TypeError(msg) | ||
@@ -1326,5 +1316,5 @@ } | ||
if (existsPluginAlready) { | ||
const msg = `Already found a plugin named '${existsPluginAlready.id}'. ` + | ||
`Tried to use: '${pluginId}'.\n` + | ||
'Uppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.' | ||
const msg = `Already found a plugin named '${existsPluginAlready.id}'. ` | ||
+ `Tried to use: '${pluginId}'.\n` | ||
+ 'Uppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.' | ||
throw new Error(msg) | ||
@@ -1398,4 +1388,4 @@ } | ||
...state.plugins, | ||
[instance.id]: undefined | ||
} | ||
[instance.id]: undefined, | ||
}, | ||
} | ||
@@ -1435,6 +1425,6 @@ this.setState(updatedState) | ||
isHidden: false, | ||
type: type, | ||
type, | ||
message: isComplexMessage ? message.message : message, | ||
details: isComplexMessage ? message.details : null | ||
} | ||
details: isComplexMessage ? message.details : null, | ||
}, | ||
}) | ||
@@ -1455,7 +1445,5 @@ | ||
hideInfo () { | ||
const newInfo = Object.assign({}, this.getState().info, { | ||
isHidden: true | ||
}) | ||
const newInfo = { ...this.getState().info, isHidden: true } | ||
this.setState({ | ||
info: newInfo | ||
info: newInfo, | ||
}) | ||
@@ -1511,3 +1499,3 @@ this.emit('info-hidden') | ||
const { | ||
forceAllowNewUpload = false // uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false` | ||
forceAllowNewUpload = false, // uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false` | ||
} = opts | ||
@@ -1524,3 +1512,3 @@ | ||
id: uploadID, | ||
fileIDs: fileIDs | ||
fileIDs, | ||
}) | ||
@@ -1534,7 +1522,7 @@ | ||
[uploadID]: { | ||
fileIDs: fileIDs, | ||
fileIDs, | ||
step: 0, | ||
result: {} | ||
} | ||
} | ||
result: {}, | ||
}, | ||
}, | ||
}) | ||
@@ -1563,9 +1551,5 @@ | ||
const currentUploads = this.getState().currentUploads | ||
const currentUpload = Object.assign({}, currentUploads[uploadID], { | ||
result: Object.assign({}, currentUploads[uploadID].result, data) | ||
}) | ||
const currentUpload = { ...currentUploads[uploadID], result: { ...currentUploads[uploadID].result, ...data } } | ||
this.setState({ | ||
currentUploads: Object.assign({}, currentUploads, { | ||
[uploadID]: currentUpload | ||
}) | ||
currentUploads: { ...currentUploads, [uploadID]: currentUpload }, | ||
}) | ||
@@ -1584,3 +1568,3 @@ } | ||
this.setState({ | ||
currentUploads: currentUploads | ||
currentUploads, | ||
}) | ||
@@ -1601,3 +1585,3 @@ } | ||
...this.uploaders, | ||
...this.postProcessors | ||
...this.postProcessors, | ||
] | ||
@@ -1620,3 +1604,3 @@ let lastStep = Promise.resolve() | ||
...currentUpload, | ||
step | ||
step, | ||
} | ||
@@ -1627,4 +1611,4 @@ | ||
...currentUploads, | ||
[uploadID]: updatedUpload | ||
} | ||
[uploadID]: updatedUpload, | ||
}, | ||
}) | ||
@@ -1723,3 +1707,3 @@ | ||
this.setState({ | ||
files: files | ||
files, | ||
}) | ||
@@ -1752,3 +1736,3 @@ } | ||
this._showOrLogErrorAndThrow(err, { | ||
showInformer: false | ||
showInformer: false, | ||
}) | ||
@@ -1755,0 +1739,0 @@ }) |
@@ -73,4 +73,3 @@ const fs = require('fs') | ||
expect(() => | ||
core.use(InvalidPluginWithoutId) | ||
).toThrowErrorMatchingSnapshot() | ||
core.use(InvalidPluginWithoutId)).toThrowErrorMatchingSnapshot() | ||
}) | ||
@@ -82,4 +81,3 @@ | ||
expect(() => | ||
core.use(InvalidPluginWithoutType) | ||
).toThrowErrorMatchingSnapshot() | ||
core.use(InvalidPluginWithoutType)).toThrowErrorMatchingSnapshot() | ||
}) | ||
@@ -106,7 +104,7 @@ | ||
expect(core.plugins.acquirer[0].mocks.run.mock.calls[0]).toEqual([ | ||
'hello' | ||
'hello', | ||
]) | ||
expect(core.plugins.acquirer[1].mocks.run.mock.calls.length).toEqual(1) | ||
expect(core.plugins.acquirer[1].mocks.run.mock.calls[0]).toEqual([ | ||
'hello' | ||
'hello', | ||
]) | ||
@@ -137,7 +135,7 @@ }) | ||
expect(core.plugins.acquirer[0].mocks.update.mock.calls[0]).toEqual([ | ||
{ foo: 'bar' } | ||
{ foo: 'bar' }, | ||
]) | ||
expect(core.plugins.acquirer[1].mocks.update.mock.calls.length).toEqual(1) | ||
expect(core.plugins.acquirer[1].mocks.update.mock.calls[0]).toEqual([ | ||
{ foo: 'bar' } | ||
{ foo: 'bar' }, | ||
]) | ||
@@ -166,3 +164,3 @@ }) | ||
plugins: {}, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
} | ||
@@ -173,6 +171,6 @@ | ||
expect(core.plugins.acquirer[0].mocks.update.mock.calls[1]).toEqual([ | ||
newState | ||
newState, | ||
]) | ||
expect(core.plugins.acquirer[1].mocks.update.mock.calls[1]).toEqual([ | ||
newState | ||
newState, | ||
]) | ||
@@ -192,3 +190,3 @@ | ||
plugins: {}, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
}) | ||
@@ -206,3 +204,3 @@ // new state | ||
plugins: {}, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
}) | ||
@@ -223,3 +221,3 @@ }) | ||
const core = new Core({ | ||
store: DeepFrozenStore() | ||
store: DeepFrozenStore(), | ||
}) | ||
@@ -247,3 +245,3 @@ // const corePauseEventMock = jest.fn() | ||
plugins: {}, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
}) | ||
@@ -259,3 +257,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -267,3 +265,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -286,3 +284,3 @@ | ||
const core = new Core({ | ||
store: DeepFrozenStore() | ||
store: DeepFrozenStore(), | ||
}) | ||
@@ -311,3 +309,3 @@ core.use(AcquirerPlugin1) | ||
plugins: {}, | ||
totalProgress: 0 | ||
totalProgress: 0, | ||
}) | ||
@@ -370,3 +368,3 @@ expect(plugin.mocks.uninstall.mock.calls.length).toEqual(1) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -399,3 +397,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -406,3 +404,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -423,3 +421,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -432,3 +430,3 @@ | ||
message: 'something', | ||
value: 0 | ||
value: 0, | ||
}) | ||
@@ -441,3 +439,3 @@ expect(core.getFile(fileId).progress).toEqual({ | ||
uploadStarted: null, | ||
preprocess: { mode: 'determinate', message: 'something', value: 0 } | ||
preprocess: { mode: 'determinate', message: 'something', value: 0 }, | ||
}) | ||
@@ -453,3 +451,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -462,3 +460,3 @@ | ||
message: 'something', | ||
value: 0 | ||
value: 0, | ||
}) | ||
@@ -470,3 +468,3 @@ expect(core.getFile(fileID).progress).toEqual({ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -508,3 +506,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -537,3 +535,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -546,3 +544,3 @@ | ||
message: 'something', | ||
value: 0 | ||
value: 0, | ||
}) | ||
@@ -555,3 +553,3 @@ expect(core.getFile(fileId).progress).toEqual({ | ||
uploadStarted: null, | ||
postprocess: { mode: 'determinate', message: 'something', value: 0 } | ||
postprocess: { mode: 'determinate', message: 'something', value: 0 }, | ||
}) | ||
@@ -567,3 +565,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -576,3 +574,3 @@ | ||
message: 'something', | ||
value: 0 | ||
value: 0, | ||
}) | ||
@@ -584,3 +582,3 @@ expect(core.getFile(fileId).progress).toEqual({ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -616,3 +614,3 @@ }) | ||
const core = new Core({ | ||
onBeforeFileAdded | ||
onBeforeFileAdded, | ||
}) | ||
@@ -624,3 +622,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -643,3 +641,3 @@ | ||
type: 'image/jpeg', | ||
data: fileData | ||
data: fileData, | ||
}) | ||
@@ -659,3 +657,3 @@ const newFile = { | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}, | ||
@@ -665,3 +663,3 @@ remote: '', | ||
source: 'jest', | ||
type: 'image/jpeg' | ||
type: 'image/jpeg', | ||
} | ||
@@ -675,4 +673,4 @@ expect(core.getFile(fileId)).toEqual(newFile) | ||
restrictions: { | ||
allowedFileTypes: ['image/gif', 'video/webm'] | ||
} | ||
allowedFileTypes: ['image/gif', 'video/webm'], | ||
}, | ||
}) | ||
@@ -685,3 +683,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -695,3 +693,3 @@ }).toThrow('You can only upload: image/gif, video/webm') | ||
type: 'video/webm; codecs="vp8, opus"', | ||
data: new File([sampleImage], { type: 'video/webm; codecs="vp8, opus"' }) | ||
data: new File([sampleImage], { type: 'video/webm; codecs="vp8, opus"' }), | ||
}) | ||
@@ -708,3 +706,3 @@ }).not.toThrow() | ||
type: 'image/jpeg', | ||
data: sameFileBlob | ||
data: sameFileBlob, | ||
}) | ||
@@ -718,4 +716,4 @@ expect(() => { | ||
meta: { | ||
notARelativePath: 'folder/a' | ||
} | ||
notARelativePath: 'folder/a', | ||
}, | ||
}) | ||
@@ -734,3 +732,3 @@ }).toThrow( | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -743,4 +741,4 @@ core.addFile({ | ||
meta: { | ||
relativePath: 'folder/a' | ||
} | ||
relativePath: 'folder/a', | ||
}, | ||
}) | ||
@@ -756,3 +754,3 @@ expect(core.getFiles().length).toEqual(2) | ||
} | ||
} | ||
}, | ||
}) | ||
@@ -764,3 +762,3 @@ expect(() => { | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -780,3 +778,3 @@ }).toThrow( | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -791,3 +789,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -807,3 +805,3 @@ }).toThrow( | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -814,3 +812,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -832,3 +830,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -839,3 +837,3 @@ const fileId2 = core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -860,3 +858,3 @@ | ||
type: 'image/jpeg', | ||
data | ||
data, | ||
}) | ||
@@ -867,3 +865,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data | ||
data, | ||
}) | ||
@@ -888,5 +886,5 @@ | ||
{ name: 'foo.jpg' }, | ||
{ name: 'bar.jpg' } | ||
{ name: 'bar.jpg' }, | ||
], | ||
failed: [] | ||
failed: [], | ||
}) | ||
@@ -898,3 +896,3 @@ }) | ||
const core = new Core({ | ||
store: DeepFrozenStore() | ||
store: DeepFrozenStore(), | ||
}) | ||
@@ -916,7 +914,7 @@ core.addUploader((fileIDs) => { | ||
successful: [ | ||
{ name: 'foo.jpg' } | ||
{ name: 'foo.jpg' }, | ||
], | ||
failed: [ | ||
{ name: 'bar.jpg', error: 'This is bar and I do not like bar' } | ||
] | ||
{ name: 'bar.jpg', error: 'This is bar and I do not like bar' }, | ||
], | ||
}) | ||
@@ -929,7 +927,7 @@ }) | ||
upload1: { | ||
fileIDs: ['uppy-file1/jpg-1e-image/jpeg', 'uppy-file2/jpg-1e-image/jpeg', 'uppy-file3/jpg-1e-image/jpeg'] | ||
fileIDs: ['uppy-file1/jpg-1e-image/jpeg', 'uppy-file2/jpg-1e-image/jpeg', 'uppy-file3/jpg-1e-image/jpeg'], | ||
}, | ||
upload2: { | ||
fileIDs: ['uppy-file4/jpg-1e-image/jpeg', 'uppy-file5/jpg-1e-image/jpeg', 'uppy-file6/jpg-1e-image/jpeg'] | ||
} | ||
fileIDs: ['uppy-file4/jpg-1e-image/jpeg', 'uppy-file5/jpg-1e-image/jpeg', 'uppy-file6/jpg-1e-image/jpeg'], | ||
}, | ||
} | ||
@@ -953,3 +951,3 @@ core.addUploader((fileIDs) => Promise.resolve()) | ||
} | ||
} | ||
}, | ||
}) | ||
@@ -960,3 +958,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -967,3 +965,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -974,3 +972,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -988,3 +986,3 @@ return core.upload().catch((err) => { | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -995,3 +993,3 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1012,3 +1010,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1023,3 +1021,3 @@ await expect(core.upload()).resolves.toBeDefined() | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1041,3 +1039,3 @@ await expect(core.upload()).resolves.toBeDefined() | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1048,3 +1046,3 @@ | ||
core.setState({ | ||
totalProgress: 50 | ||
totalProgress: 50, | ||
}) | ||
@@ -1074,6 +1072,6 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
core.setFileState(id, { | ||
error: 'something went wrong' | ||
error: 'something went wrong', | ||
}) | ||
@@ -1096,3 +1094,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1119,3 +1117,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1144,3 +1142,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1151,3 +1149,3 @@ core.addFile({ | ||
type: 'application/octet-stream', | ||
data: new File([Buffer.alloc(1000)], { type: 'application/octet-stream' }) | ||
data: new File([Buffer.alloc(1000)], { type: 'application/octet-stream' }), | ||
}) | ||
@@ -1166,3 +1164,3 @@ | ||
autoProceed: true, | ||
allowMultipleUploads: true | ||
allowMultipleUploads: true, | ||
}) | ||
@@ -1182,5 +1180,5 @@ | ||
strings: { | ||
cancel: 'Отмена' | ||
} | ||
} | ||
cancel: 'Отмена', | ||
}, | ||
}, | ||
}) | ||
@@ -1195,7 +1193,7 @@ | ||
meta: { | ||
foo: 'bar' | ||
} | ||
foo: 'bar', | ||
}, | ||
}) | ||
expect(core.state.meta).toMatchObject({ | ||
foo: 'bar' | ||
foo: 'bar', | ||
}) | ||
@@ -1205,4 +1203,4 @@ | ||
meta: { | ||
beep: 'boop' | ||
} | ||
beep: 'boop', | ||
}, | ||
}) | ||
@@ -1212,3 +1210,3 @@ | ||
foo: 'bar', | ||
beep: 'boop' | ||
beep: 'boop', | ||
}) | ||
@@ -1221,4 +1219,4 @@ }) | ||
allowedFileTypes: ['image/jpeg'], | ||
maxNumberOfFiles: 2 | ||
} | ||
maxNumberOfFiles: 2, | ||
}, | ||
}) | ||
@@ -1231,3 +1229,3 @@ | ||
type: 'image/png', | ||
data: new File([sampleImage], { type: 'image/png' }) | ||
data: new File([sampleImage], { type: 'image/png' }), | ||
}) | ||
@@ -1240,4 +1238,4 @@ } catch (err) { | ||
restrictions: { | ||
allowedFileTypes: ['image/png'] | ||
} | ||
allowedFileTypes: ['image/png'], | ||
}, | ||
}) | ||
@@ -1252,3 +1250,3 @@ | ||
type: 'image/png', | ||
data: new File([sampleImage], { type: 'image/png' }) | ||
data: new File([sampleImage], { type: 'image/png' }), | ||
}) | ||
@@ -1266,3 +1264,3 @@ }).not.toThrow() | ||
store: DeepFrozenStore(), | ||
meta: { foo2: 'bar2' } | ||
meta: { foo2: 'bar2' }, | ||
}) | ||
@@ -1275,3 +1273,3 @@ core.setMeta({ foo: 'bar', bur: 'mur' }) | ||
boo: 'moo', | ||
bur: 'fur' | ||
bur: 'fur', | ||
}) | ||
@@ -1287,3 +1285,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1299,3 +1297,3 @@ | ||
bur: 'fur', | ||
boo: 'moo' | ||
boo: 'moo', | ||
}) | ||
@@ -1306,3 +1304,3 @@ }) | ||
const core = new Core({ | ||
meta: { foo2: 'bar2' } | ||
meta: { foo2: 'bar2' }, | ||
}) | ||
@@ -1314,5 +1312,5 @@ core.addFile({ | ||
meta: { | ||
resize: 5000 | ||
resize: 5000, | ||
}, | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1324,3 +1322,3 @@ const fileId = Object.keys(core.getState().files)[0] | ||
foo2: 'bar2', | ||
resize: 5000 | ||
resize: 5000, | ||
}) | ||
@@ -1338,3 +1336,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1346,3 +1344,3 @@ | ||
bytesUploaded: 12345, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1354,3 +1352,3 @@ expect(core.getFile(fileId).progress).toEqual({ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -1360,3 +1358,3 @@ | ||
bytesUploaded: 17175, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1371,3 +1369,3 @@ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -1387,3 +1385,3 @@ }) | ||
bytesTotal: 3456, | ||
bytesUploaded: 1234 | ||
bytesUploaded: 1234, | ||
}) | ||
@@ -1398,3 +1396,3 @@ await finishPromise | ||
type: 'image/jpeg', | ||
data: {} | ||
data: {}, | ||
}) | ||
@@ -1412,3 +1410,3 @@ | ||
bytesTotal: null, | ||
percentage: 0 | ||
percentage: 0, | ||
}) | ||
@@ -1424,3 +1422,3 @@ | ||
bytesTotal: 3456, | ||
percentage: 36 | ||
percentage: 36, | ||
}) | ||
@@ -1438,3 +1436,3 @@ | ||
bytesTotal: 3456, | ||
percentage: 100 | ||
percentage: 100, | ||
}) | ||
@@ -1454,3 +1452,3 @@ | ||
bytesTotal: 3456, | ||
bytesUploaded: 1234 | ||
bytesUploaded: 1234, | ||
}) | ||
@@ -1462,3 +1460,3 @@ }) | ||
type: 'image/jpeg', | ||
data: {} | ||
data: {}, | ||
}) | ||
@@ -1470,3 +1468,3 @@ | ||
bytesTotal: null, | ||
bytesUploaded: null | ||
bytesUploaded: null, | ||
}) | ||
@@ -1478,3 +1476,3 @@ }) | ||
type: 'image/jpeg', | ||
data: {} | ||
data: {}, | ||
}) | ||
@@ -1493,3 +1491,3 @@ | ||
const core = new Core({ | ||
store: DeepFrozenStore() | ||
store: DeepFrozenStore(), | ||
}) | ||
@@ -1501,3 +1499,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1508,12 +1506,12 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
const [file1, file2] = core.getFiles() | ||
core.setFileState(file1.id, { progress: Object.assign({}, file1.progress, { uploadStarted: new Date() }) }) | ||
core.setFileState(file2.id, { progress: Object.assign({}, file2.progress, { uploadStarted: new Date() }) }) | ||
core.setFileState(file1.id, { progress: { ...file1.progress, uploadStarted: new Date() } }) | ||
core.setFileState(file2.id, { progress: { ...file2.progress, uploadStarted: new Date() } }) | ||
core.emit('upload-progress', core.getFile(file1.id), { | ||
bytesUploaded: 12345, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1523,3 +1521,3 @@ | ||
bytesUploaded: 10201, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1542,3 +1540,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1549,12 +1547,12 @@ core.addFile({ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
const [file1, file2] = core.getFiles() | ||
core.setFileState(file1.id, { progress: Object.assign({}, file1.progress, { uploadStarted: new Date() }) }) | ||
core.setFileState(file2.id, { progress: Object.assign({}, file2.progress, { uploadStarted: new Date() }) }) | ||
core.setFileState(file1.id, { progress: { ...file1.progress, uploadStarted: new Date() } }) | ||
core.setFileState(file2.id, { progress: { ...file2.progress, uploadStarted: new Date() } }) | ||
core.emit('upload-progress', core.getFile(file1.id), { | ||
bytesUploaded: 12345, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1564,3 +1562,3 @@ | ||
bytesUploaded: 10201, | ||
bytesTotal: 17175 | ||
bytesTotal: 17175, | ||
}) | ||
@@ -1580,3 +1578,3 @@ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -1588,3 +1586,3 @@ expect(core.getFile(file2.id).progress).toEqual({ | ||
uploadComplete: false, | ||
uploadStarted: null | ||
uploadStarted: null, | ||
}) | ||
@@ -1600,4 +1598,4 @@ expect(core.getState().totalProgress).toEqual(0) | ||
restrictions: { | ||
maxNumberOfFiles: 1 | ||
} | ||
maxNumberOfFiles: 1, | ||
}, | ||
}) | ||
@@ -1610,3 +1608,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1618,3 +1616,3 @@ try { | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1633,4 +1631,4 @@ throw new Error('should have thrown') | ||
restrictions: { | ||
allowedFileTypes: ['image/gif', 'image/png'] | ||
} | ||
allowedFileTypes: ['image/gif', 'image/png'], | ||
}, | ||
}) | ||
@@ -1643,3 +1641,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1657,4 +1655,4 @@ throw new Error('should have thrown') | ||
restrictions: { | ||
allowedFileTypes: 'image/gif' | ||
} | ||
allowedFileTypes: 'image/gif', | ||
}, | ||
}) | ||
@@ -1670,4 +1668,4 @@ core.log('hi') | ||
restrictions: { | ||
allowedFileTypes: ['.gif', '.jpg', '.jpeg'] | ||
} | ||
allowedFileTypes: ['.gif', '.jpg', '.jpeg'], | ||
}, | ||
}) | ||
@@ -1680,3 +1678,3 @@ | ||
type: '', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1693,3 +1691,3 @@ throw new Error('should have thrown') | ||
type: '', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}).not.toThrow()) | ||
@@ -1701,4 +1699,4 @@ }) | ||
restrictions: { | ||
maxFileSize: 1234 | ||
} | ||
maxFileSize: 1234, | ||
}, | ||
}) | ||
@@ -1711,3 +1709,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1724,4 +1722,4 @@ throw new Error('should have thrown') | ||
restrictions: { | ||
minFileSize: 1073741824 | ||
} | ||
minFileSize: 1073741824, | ||
}, | ||
}) | ||
@@ -1734,3 +1732,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1747,4 +1745,4 @@ throw new Error('should have thrown') | ||
restrictions: { | ||
maxTotalFileSize: 34000 | ||
} | ||
maxTotalFileSize: 34000, | ||
}, | ||
}) | ||
@@ -1756,3 +1754,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1765,3 +1763,3 @@ | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -1776,4 +1774,4 @@ }).toThrowError( | ||
restrictions: { | ||
minFileSize: 300000 | ||
} | ||
minFileSize: 300000, | ||
}, | ||
}) | ||
@@ -1783,4 +1781,4 @@ | ||
restrictions: { | ||
allowedFileTypes: ['image/png'] | ||
} | ||
allowedFileTypes: ['image/png'], | ||
}, | ||
}) | ||
@@ -1797,3 +1795,3 @@ | ||
modifiedDate: '2016-04-13T15:11:31.204Z', | ||
size: 270733 | ||
size: 270733, | ||
} | ||
@@ -1807,3 +1805,3 @@ | ||
result: false, | ||
reason: 'This file is smaller than the allowed size of 293 KB' | ||
reason: 'This file is smaller than the allowed size of 293 KB', | ||
} | ||
@@ -1814,3 +1812,3 @@ ) | ||
result: false, | ||
reason: 'You can only upload: image/png' | ||
reason: 'You can only upload: image/png', | ||
} | ||
@@ -1824,4 +1822,4 @@ ) | ||
restrictions: { | ||
maxFileSize | ||
} | ||
maxFileSize, | ||
}, | ||
}) | ||
@@ -1831,3 +1829,3 @@ const restrictionsViolatedEventMock = jest.fn() | ||
name: 'test.jpg', | ||
data: new Blob([Buffer.alloc(2 * maxFileSize)]) | ||
data: new Blob([Buffer.alloc(2 * maxFileSize)]), | ||
} | ||
@@ -1859,5 +1857,5 @@ const errorMessage = `${core.i18n('exceedsSize')} ${prettierBytes(maxFileSize)}` | ||
id: 'fileId', | ||
name: 'filename' | ||
} | ||
} | ||
name: 'filename', | ||
}, | ||
}, | ||
}) | ||
@@ -1869,3 +1867,3 @@ core.emit('upload-error', core.getFile('fileId'), new Error('this is the error')) | ||
isHidden: false, | ||
type: 'error' | ||
type: 'error', | ||
}) | ||
@@ -1891,3 +1889,3 @@ }) | ||
value: status, | ||
writable: true | ||
writable: true, | ||
} | ||
@@ -1941,3 +1939,3 @@ ) | ||
message: 'This is the message', | ||
details: null | ||
details: null, | ||
}) | ||
@@ -1956,4 +1954,4 @@ expect(infoVisibleEvent.mock.calls.length).toEqual(1) | ||
details: { | ||
foo: 'bar' | ||
} | ||
foo: 'bar', | ||
}, | ||
}, 'warning', 0) | ||
@@ -1965,4 +1963,4 @@ expect(core.getState().info).toEqual({ | ||
details: { | ||
foo: 'bar' | ||
} | ||
foo: 'bar', | ||
}, | ||
}) | ||
@@ -1989,3 +1987,3 @@ expect(infoVisibleEvent.mock.calls.length).toEqual(1) | ||
message: 'This is the message', | ||
details: null | ||
details: null, | ||
}) | ||
@@ -2012,3 +2010,3 @@ done() | ||
message: 'This is the message', | ||
details: null | ||
details: null, | ||
}) | ||
@@ -2025,3 +2023,3 @@ }) | ||
type: 'image/jpeg', | ||
data: new File([sampleImage], { type: 'image/jpeg' }) | ||
data: new File([sampleImage], { type: 'image/jpeg' }), | ||
}) | ||
@@ -2035,3 +2033,3 @@ | ||
step: 0, | ||
result: {} | ||
result: {}, | ||
} | ||
@@ -2047,5 +2045,5 @@ expect(core.getState().currentUploads).toEqual(currentUploadsState) | ||
strings: { | ||
test: 'beep boop' | ||
} | ||
} | ||
test: 'beep boop', | ||
}, | ||
}, | ||
}) | ||
@@ -2062,4 +2060,4 @@ | ||
restrictions: { | ||
maxNumberOfFiles: 3 | ||
} | ||
maxNumberOfFiles: 3, | ||
}, | ||
}) | ||
@@ -2077,7 +2075,7 @@ | ||
warn: jest.fn(), | ||
error: jest.fn() | ||
error: jest.fn(), | ||
} | ||
const core = new Core({ | ||
logger: myTestLogger | ||
logger: myTestLogger, | ||
}) | ||
@@ -2101,3 +2099,3 @@ | ||
warn: jest.fn(), | ||
error: jest.fn() | ||
error: jest.fn(), | ||
} | ||
@@ -2107,3 +2105,3 @@ | ||
logger: myTestLogger, | ||
debug: true | ||
debug: true, | ||
}) | ||
@@ -2130,3 +2128,3 @@ | ||
const core = new Core({ | ||
logger: Core.debugLogger | ||
logger: Core.debugLogger, | ||
}) | ||
@@ -2147,3 +2145,3 @@ | ||
const core2 = new Core({ | ||
debug: true | ||
debug: true, | ||
}) | ||
@@ -2150,0 +2148,0 @@ |
@@ -8,3 +8,3 @@ const getTimeStamp = require('@uppy/utils/lib/getTimeStamp') | ||
warn: (...args) => {}, | ||
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args) | ||
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args), | ||
} | ||
@@ -21,3 +21,3 @@ | ||
warn: (...args) => console.warn(`[Uppy] [${getTimeStamp()}]`, ...args), | ||
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args) | ||
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args), | ||
} | ||
@@ -27,3 +27,3 @@ | ||
justErrorsLogger, | ||
debugLogger | ||
debugLogger, | ||
} |
@@ -59,5 +59,5 @@ const preact = require('preact') | ||
...plugins[this.id], | ||
...update | ||
} | ||
} | ||
...update, | ||
}, | ||
}, | ||
}) | ||
@@ -165,11 +165,11 @@ } | ||
if (typeof target === 'function') { | ||
message += ' The given target is not a Plugin class. ' + | ||
'Please check that you\'re not specifying a React Component instead of a plugin. ' + | ||
'If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: ' + | ||
'run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.' | ||
message += ' The given target is not a Plugin class. ' | ||
+ 'Please check that you\'re not specifying a React Component instead of a plugin. ' | ||
+ 'If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: ' | ||
+ 'run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.' | ||
} else { | ||
message += 'If you meant to target an HTML element, please make sure that the element exists. ' + | ||
'Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. ' + | ||
'(see https://github.com/transloadit/uppy/issues/1042)\n\n' + | ||
'If you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.' | ||
message += 'If you meant to target an HTML element, please make sure that the element exists. ' | ||
+ 'Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. ' | ||
+ '(see https://github.com/transloadit/uppy/issues/1042)\n\n' | ||
+ 'If you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.' | ||
} | ||
@@ -176,0 +176,0 @@ throw new Error(message) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
338890
5835
Updated@uppy/store-default@^1.2.6
Updated@uppy/utils@^3.5.0