@uppy/tus
Advanced tools
Comparing version 4.0.0-beta.5 to 4.0.0-beta.6
# @uppy/tus | ||
## 4.0.0-beta.6 | ||
Released: 2024-06-04 | ||
Included in: Uppy v4.0.0-beta.10 | ||
- @uppy/aws-s3,@uppy/tus,@uppy/utils,@uppy/xhr-upload: remove `uploader` from `upload-progress` event (Mikael Finstad / #5200) | ||
## 4.0.0-beta.4 | ||
@@ -4,0 +11,0 @@ |
@@ -45,3 +45,2 @@ import BasePlugin, { type DefinePluginOpts, type PluginOpts } from '@uppy/core/lib/BasePlugin.js'; | ||
constructor(uppy: Uppy<M, B>, opts: TusOpts<M, B>); | ||
handleResetProgress(): void; | ||
/** | ||
@@ -48,0 +47,0 @@ * Clean up all references for a file's upload: the tus.Upload instance, |
@@ -1,4 +0,4 @@ | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; } | ||
var id = 0; | ||
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; } | ||
function _classPrivateFieldLooseKey(e) { return "__private_" + id++ + "_" + e; } | ||
import BasePlugin from '@uppy/core/lib/BasePlugin.js'; | ||
@@ -20,3 +20,3 @@ import * as tus from 'tus-js-client'; | ||
const packageJson = { | ||
"version": "4.0.0-beta.5" | ||
"version": "4.0.0-beta.6" | ||
}; | ||
@@ -146,26 +146,3 @@ /** | ||
this.uploaderEvents = Object.create(null); | ||
this.handleResetProgress = this.handleResetProgress.bind(this); | ||
} | ||
handleResetProgress() { | ||
const files = { | ||
...this.uppy.getState().files | ||
}; | ||
Object.keys(files).forEach(fileID => { | ||
var _files$fileID; | ||
// Only clone the file object if it has a Tus `uploadUrl` attached. | ||
if ((_files$fileID = files[fileID]) != null && (_files$fileID = _files$fileID.tus) != null && _files$fileID.uploadUrl) { | ||
const tusState = { | ||
...files[fileID].tus | ||
}; | ||
delete tusState.uploadUrl; | ||
files[fileID] = { | ||
...files[fileID], | ||
tus: tusState | ||
}; | ||
} | ||
}); | ||
this.uppy.setState({ | ||
files | ||
}); | ||
} | ||
@@ -216,3 +193,2 @@ /** | ||
this.uppy.addUploader(_classPrivateFieldLooseBase(this, _handleUpload)[_handleUpload]); | ||
this.uppy.on('reset-progress', this.handleResetProgress); | ||
} | ||
@@ -230,3 +206,2 @@ uninstall() { | ||
function _uploadLocalFile2(file) { | ||
var _this = this; | ||
this.resetUploaderReferences(file.id); | ||
@@ -313,2 +288,3 @@ | ||
uploadOptions.onProgress = (bytesUploaded, bytesTotal) => { | ||
var _latestFile$progress$; | ||
this.onReceiveUploadUrl(file, upload.url); | ||
@@ -318,6 +294,5 @@ if (typeof opts.onProgress === 'function') { | ||
} | ||
this.uppy.emit('upload-progress', this.uppy.getFile(file.id), { | ||
// TODO: remove `uploader` in next major | ||
// @ts-expect-error untyped | ||
uploader: this, | ||
const latestFile = this.uppy.getFile(file.id); | ||
this.uppy.emit('upload-progress', latestFile, { | ||
uploadStarted: (_latestFile$progress$ = latestFile.progress.uploadStarted) != null ? _latestFile$progress$ : 0, | ||
bytesUploaded, | ||
@@ -470,12 +445,7 @@ bytesTotal | ||
}); | ||
eventManager.onCancelAll(file.id, function (_temp) { | ||
let { | ||
reason | ||
} = _temp === void 0 ? {} : _temp; | ||
if (reason === 'user') { | ||
queuedRequest.abort(); | ||
_this.resetUploaderReferences(file.id, { | ||
abort: !!upload.url | ||
}); | ||
} | ||
eventManager.onCancelAll(file.id, () => { | ||
queuedRequest.abort(); | ||
this.resetUploaderReferences(file.id, { | ||
abort: !!upload.url | ||
}); | ||
resolve(`upload ${file.id} was canceled`); | ||
@@ -482,0 +452,0 @@ }); |
{ | ||
"name": "@uppy/tus", | ||
"description": "Resumable uploads for Uppy using Tus.io", | ||
"version": "4.0.0-beta.5", | ||
"version": "4.0.0-beta.6", | ||
"license": "MIT", | ||
@@ -25,4 +25,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/companion-client": "^4.0.0-beta.6", | ||
"@uppy/utils": "^6.0.0-beta.7", | ||
"@uppy/companion-client": "^4.0.0-beta.7", | ||
"@uppy/utils": "^6.0.0-beta.8", | ||
"tus-js-client": "^4.1.0" | ||
@@ -34,5 +34,5 @@ }, | ||
"peerDependencies": { | ||
"@uppy/core": "^4.0.0-beta.8" | ||
"@uppy/core": "^4.0.0-beta.9" | ||
}, | ||
"stableVersion": "3.5.4" | ||
} |
@@ -150,20 +150,4 @@ import BasePlugin, { | ||
this.uploaderEvents = Object.create(null) | ||
this.handleResetProgress = this.handleResetProgress.bind(this) | ||
} | ||
handleResetProgress(): void { | ||
const files = { ...this.uppy.getState().files } | ||
Object.keys(files).forEach((fileID) => { | ||
// Only clone the file object if it has a Tus `uploadUrl` attached. | ||
if (files[fileID]?.tus?.uploadUrl) { | ||
const tusState = { ...files[fileID].tus } | ||
delete tusState.uploadUrl | ||
files[fileID] = { ...files[fileID], tus: tusState } | ||
} | ||
}) | ||
this.uppy.setState({ files }) | ||
} | ||
/** | ||
@@ -319,6 +303,5 @@ * Clean up all references for a file's upload: the tus.Upload instance, | ||
} | ||
this.uppy.emit('upload-progress', this.uppy.getFile(file.id), { | ||
// TODO: remove `uploader` in next major | ||
// @ts-expect-error untyped | ||
uploader: this, | ||
const latestFile = this.uppy.getFile(file.id) | ||
this.uppy.emit('upload-progress', latestFile, { | ||
uploadStarted: latestFile.progress.uploadStarted ?? 0, | ||
bytesUploaded, | ||
@@ -506,7 +489,5 @@ bytesTotal, | ||
eventManager.onCancelAll(file.id, ({ reason } = {}) => { | ||
if (reason === 'user') { | ||
queuedRequest.abort() | ||
this.resetUploaderReferences(file.id, { abort: !!upload.url }) | ||
} | ||
eventManager.onCancelAll(file.id, () => { | ||
queuedRequest.abort() | ||
this.resetUploaderReferences(file.id, { abort: !!upload.url }) | ||
resolve(`upload ${file.id} was canceled`) | ||
@@ -632,4 +613,2 @@ }) | ||
this.uppy.addUploader(this.#handleUpload) | ||
this.uppy.on('reset-progress', this.handleResetProgress) | ||
} | ||
@@ -636,0 +615,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101256
1202