Commit graph

109 commits

Author SHA1 Message Date
Merlijn Vos
54a46db340
@uppy/tus: fix Node.js support (#6145)
Fixes #6119
2026-01-19 11:29:28 +01:00
Merlijn Vos
3c3034b408
Dedupe dependencies (#6085)
With `yarn dedupe`. New type error surfaced due to new types getting
loaded.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Dedupes dependencies and updates code: aligns S3 presign tests with
checksum behavior, narrows HMAC key type, tweaks AudioOscilloscope
buffer typing, and simplifies Tus success logging.
> 
> - **AWS S3**:
> - Tests: add `requestChecksumCalculation` (from
`@aws-sdk/middleware-flexible-checksums`) to `S3Client` options to match
presign behavior.
> - Impl: change `generateHmacKey` signature to accept `string |
ArrayBuffer` (remove `Uint8Array`).
> - **Audio**:
> - `AudioOscilloscope`: change `dataArray` type to
`Uint8Array<ArrayBuffer>`.
> - **Tus**:
> - Simplify success log to `Download <url>` (remove file name
extraction).
> - **Dependencies**:
>   - Deduplicate/upgrade various packages in lockfile.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5b95865a7c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-12-05 10:22:11 +01:00
Mikael Finstad
ac12f35f5b
Move completed uploads exclusion logic (#6058)
into uploader plugins

fixes #6051

also [fix deprecated usage of done
callback](2511142276)
2025-11-24 19:47:45 +07:00
Prakash
79e6460a6c
Make Generics Optional in uppy.getPlugin (#6057)
fixes #6024.

### Problem
- `getPlugin()` defaults to `UnknownPlugin`, so methods like `openModal`
are not visible , since core is not aware of that plugin type

### Proposed change
- Introduce a types-only registry in core:
- `export interface PluginTypeRegistry<M extends Meta, B extends Body>
{}`
- Overload `getPlugin` to return a precise type when the id is a known
key of the registry.
- add `Dashboard` to  PluginTypeRegistry through module augmentation:
  - `'Dashboard': Dashboard<M, B>`.
- When a project imports from `@uppy/dashboard`, its module augmentation
extends PluginTypeRegistry, adding the correct type into it
- I've added Tests , kept them in a separate file so it's easier to
review , once this approach gets approved I'll add them to
`Uppy.test.ts`

Once this PR gets a positive review I'll add this for other plugins ,
currently only added for `@uppy/dashboard`

**Build with Local tarball can be checked here** 


https://stackblitz.com/~/github.com/qxprakash/uppy-type-test?file=type_test.ts
2025-11-17 18:18:54 +05:30
Mikael Finstad
0c16fe44b9
Golden retriever refactor and UppyFile type improvements (#5978)
Probably best reviewed commit by commit.

I also split UppyFile into two intefaces distinguished by the `isRemote`
boolean:
- LocalUppyFile
- RemoteUppyFile

Also:
- Removed the TagFile type
- Don't re-upload completed files - fixes #5930
- Clean up stored files on `complete` event *only* if *all* files
succeeded (no failed files). this allows the user to retry failed files
if the browser & upload get interrupted - fixes #5927, closes #5955
- Only set `isGhost` for non-successful files. it doesn't make sense for
successfully uploaded files to be ghosted because they're already done.
#5930

fixes #6013

---------

Co-authored-by: Prakash <qxprakash@gmail.com>
2025-10-17 23:17:40 +08:00
Prakash
d301c01d6a
@uppy/utils: update export maps (#5900)
- cleanup `@uppy/utils ` removed unused / redundant modules .
- migrated modules and tests from `.js` to `.ts`
- removed all the nested export paths
- updated `@uppy/utils` import paths for all packages
- `@uppy/angular` is still failing while running`yarn build` , I'm
looking into it.

---------

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2025-08-19 12:25:27 +02:00
Prakash
c5b51f6158
Add Export Maps (#5830)
- added export maps to all the @uppy packages .
- imports remain unaffected except for peerDep packages in `@uppy/react`
`@uppy/svelte` and `@uppy/vue3`.
- export maps added for index files , css , and package.json. 
- Added side effects for all the packages.

---------

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2025-07-31 17:22:57 +02:00
Merlijn Vos
78299475ae
Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
Merlijn Vos
d408570373
From Babel to TS (#5792) 2025-06-30 16:12:26 +02:00
Merlijn Vos
e329bfa49f
@uppy/tus: fix resumeFromPreviousUpload race condition (#5616) 2025-01-22 16:22:02 +01:00
Merlijn Vos
6e65cd8c51
Import types consistently from @uppy/core (#5589)
* Import types consistently from @uppy/core

* Add new eslint rule

* Clean up exports
2025-01-09 11:03:43 +01:00
Merlijn Vos
3e2aa9f3c8
Use .js(x) for all imports instead .ts(x) (#5573) 2025-01-06 13:29:55 +01:00
Dominik Schmidt
982663a7d6
@uppy/tus: fix onBeforeRequest type (#5566)
fix(types): tus.onBeforeRequest handler may return a promise
2025-01-06 10:18:15 +01:00
ItsOnlyBinary
014f1da0e5
@uppy/tus: fix event upload-success response.body.xhr (#5503)
fix event upload-success payload.body.xhr
2024-11-11 10:33:17 +01:00
Marius
6b2fe32838
tus: Avoid duplicate upload-error event (#5485)
Fixes https://github.com/transloadit/uppy/issues/5473.
2024-10-15 09:36:08 +02:00
Merlijn Vos
f320a744dc
@uppy/tus: fix retry check for status code 400 (#5461) 2024-09-19 13:21:46 +02:00
Merlijn Vos
f665a5ab81
@uppy/tus: set response from tus-js-client (#5456)
* @uppy/tus: set response from tus-js-client

* Revert UppyFile comment

* Bump tus-js-client
2024-09-19 10:44:15 +02:00
Merlijn Vos
23bf2298d8
@uppy/tus: correctly type tus on UppyFile (#5454)
* @uppy/tus: correctly type tus on UppyFile

* Fix @uppy/transloadit
2024-09-09 10:53:33 +02:00
Antoine du Hamel
64bffd5363
export plugin options (#5433) 2024-08-28 15:49:03 +02:00
Trent Nadeau
9810cc86b4
@uppy/tus: Fix onShouldRetry type signature (#5387) 2024-08-05 10:43:23 +02:00
Mikael Finstad
b81b7fb9a3
remove resetProgress and reset-progress (#5221)
* remove resetProgress and reset-progress

* adjust no longer valid test

* fix lint
2024-06-04 12:22:53 +02:00
Mikael Finstad
71b4f0c8f7
remove uploader from upload-progress event (#5200) 2024-05-31 13:16:39 +02:00
Antoine du Hamel
f72138ff4b
@uppy/core: remove reason (#5159) 2024-05-23 18:52:48 +02:00
Antoine du Hamel
8090eacdf2
Merge stable branch 2024-05-22 09:46:29 +02:00
Murderlon
f3c30be245
fixup! @uppy/tus: fix no headers passed to companion if argument is a function (#5182) 2024-05-21 16:59:34 +02:00
netdown
a57bf8f358
@uppy/tus: fix no headers passed to companion if argument is a function (#5182)
Update index.ts
2024-05-21 16:17:19 +02:00
Merlijn Vos
1aac94df2c
Make allowedMetaFields consistent (#5011)
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2024-03-25 11:27:21 +01:00
Merlijn Vos
700944e25b
@uppy/transloadit: migrate to TS (#4987)
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2024-03-18 15:45:11 +01:00
Merlijn Vos
49bd8cb00e
@uppy/utils: migrate RateLimitedQueue to TS (#4981)
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2024-03-07 15:24:42 +01:00
Antoine du Hamel
9fb5162bd2
meta: disable @typescript-eslint/no-non-null-assertion lint rule (#4945) 2024-02-21 13:24:55 +01:00
Antoine du Hamel
a0b7d1654e
update UppyFile objects before emitting events (#4928) 2024-02-19 16:25:01 +01:00
Merlijn Vos
4d03bba8b2
@uppy/tus: migrate to TS (#4899)
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2024-02-05 15:37:00 +01:00
Mikael Finstad
eb8a806908
fix uploadRemoteFile undefined (#4814)
* fix uploadRemoteFile undefined

for some reason, only when testing locally using VITE_COMPANION_URL=https://api2.transloadit.com/companion only
we get this error...
i'm thinking for some reason, the remote file gets serialized into state and then de-serialized again
causing remote.requestClient to be gone
so I solve it by instead storing the request clients in Uppy

fixes #4791

* fix bugs

* remove unrelated space changes

* apply suggestions

* Update Uppy.js

* fix lint

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-12-12 19:51:06 +00:00
Mikael Finstad
17826da517
Companion+client stability fixes, error handling and retry (#4734)
* respond with 500 if unhandled upload error

400 seems inappropriate

* add todo

* fix companion download error

respond with correct response code when calling /get
and request to the upstream server fail

also add a unit test for this

* forward 429 from provider

allows us to retry it

* rename fn

* add a way to test refresh tokens

* fix race condtiion with refreshing token

* implement retry and fix socket

- Make sure we don't instantiate a new Provider for every file uploaded (reuse the original provider instead) - this caused the refresh token synchronization not to work
- Retry most errors when uploading (`/get`) using companion, but for HTTP, only retry certain HTTP status codes
- Reimplement the websocket code to be more stable and retry as well

* remove unused socket wrapper

* remove useFastRemoteRetry

because it isn't supported in Companion as far as I can tell

* fix error handling

* remove unneeded logic

* apply review suggestion

* retry awaiting for companion socket too

* retry whole operation instead of individually

or else we risk getting stuck retrying just half of the operation, which might never recover

* improvements

- rewrite so we can use p-retry for exponential backoff for socket reconnect too
- improve logging
- simplify/reuse code

* Update packages/@uppy/utils/src/fetchWithNetworkError.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

* Explain requestClient Symbol with comment

Co-authored-by: Mikael Finstad <finstaden@gmail.com>

* Update packages/@uppy/provider-views/src/View.js

* fixes

preventing socket.send when the socket is not in the connected state
catch errors in handlers

* log if trying to refresh with no token

* log whether we got a refresh token

* dont log retrying when in reality not

* always prompt: consent

for google drive

* add signal to post

* refactor away eventmanager

and event handler error catching

* don't fail with upload-error

if a file is canceled

* fix expect

* add capabilities support

* make requestClient non-enumerable

---------

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2023-11-02 21:31:34 +09:00
Antoine du Hamel
2c432b12cd
test: migrate to Vitest for Uppy core and Uppy plugins (#4700) 2023-09-26 17:23:17 +02:00
choi sung keun
e400d4ccbe
Fix: Utilize user-defined onSuccess, onError, and onProgress callbacks in @uppy/tus (#4674)
* @uppy/tus onSuccess, onError, and onProgress

* @uppy/tus Fix ESLint issues

* @uppy/tus Fix ESLint issues

* @uppy/tus Fix ESLint issues
2023-09-18 20:51:26 +01:00
Merlijn Vos
ef613e6a9f
Move remote file upload logic into companion-client (#4573) 2023-08-24 14:27:28 +02:00
Dominik Schmidt
54ad2e4419
Invoke headers function for remote uploads (#4596)
Invoke headers function for remote uploads
2023-07-31 16:37:41 +02:00
Mikael Finstad
2c75ddacfe
@uppy/companion: implement refresh for authentication tokens (#4448)
* allow storing multiple tokens

inside uppy auth token

* de-duplicate uploadRemote

by creating a new superclass UploaderPlugin

* pull out requestSocketToken

from MiniXHRUpload

* add class UploaderPlugin

* refactor

* refactor

* refactor/reuse

* refactor/make getAuthToken private

* fix bug

* implement refresh token

for dropbox and google drive

closes #2721

* fix test

* also update auth token cookie
when refreshing token

* fix build error on node 14

* increase auth token expiry

to workaround expiry

* Update packages/@uppy/companion-client/src/RequestClient.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

* make queueRequestSocketToken private

* rename arg

* fix lint

* log error message

* fix s3

* Update packages/@uppy/companion-client/src/Provider.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

---------

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-22 11:18:48 +02:00
Antoine du Hamel
2b9958c4f8
@uppy/tus: retry on 423 HTTP error code (#4512) 2023-06-20 11:17:56 +02:00
Artur Paikin
b521a40ebb
When file is removed (or all are canceled), controller.abort queued requests (#4504)
* When file is removed (or all are canceled), controller.abort queued requests

* add controller.abort to all other remote uploaders too

* fix the queue

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-06-19 11:28:23 +01:00
Artur Paikin
0c931e3e36
Don't close socket while upload is still in progress (#4479)
* Don't close socket while upload is still in progress

* Don't close sockets randomly in AWS S3 either, close on error/cancel

* First send the socket message, then call .abort()
2023-06-12 22:25:04 +01:00
Stephen Wooten
b4f3c178dc
@uppy/utils: rename EventTracker -> EventManager (#4481)
Co-authored-by: Stephen Wooten <stephen.wooten@super.mx>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-06-10 12:10:05 +02:00
Mikael Finstad
90f7fb9197
@uppy/core: improve performance of validating & uploading files (#4402)
* show how many files are added when loading

remake of https://github.com/transloadit/uppy/pull/4388

* add french (cherry pick)

* implement concurrent file listing

* refactor / fix lint

* refactor/reduce duplication

* pull out totals validation

don't do it for every file added, as it's very slow
instead do the check at the end when all files are added.
this allows us to easily work with 10k+ files
fixes #4389

* Update packages/@uppy/core/src/Uppy.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* make restricter.validate validate everything

instead make more specific methods for sub-validation
also rename validateTotals to validateAggregateRestrictions

* improve errors and user feedback

- handle errors centrally so that we can limit the amount of toasts (informers) sent to the users (prevent flooding hundreds/thousands of them)
- introduce FileRestrictionError which is a restriction error for a specific file
- introduce isUserFacing field for RestrictionError

* fix performance issue reintroduced

* improvements

- show "%{count} additional restrictions were not fulfilled" for any restriction errors more than 4
- refactor/rename methods
- improve ghost logic/comments

* improve performance when uploading

- introduce new event "upload-start"  that can contain multiple files
- make a new patchFilesState method to allow updating more files
- unify "upload-start" logic in all plugins (send it before files start uploading)
- defer slicing buffer until we need the data
- refactor to reuse code

* fix e2e build issue

* try to upgrade cypress

maybe it fixes the error

* Revert "fix e2e build issue"

This reverts commit ff3e580c0f.

* upgrade parcel

* move mutation logic to end

* remove FileRestrictionError

merge it with RestrictionError

* fix silly bug

looks like the e2e tests are doing its job 👏

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-15 23:50:19 +08:00
Mikael Finstad
643fd8d055
make sure that we reset serverToken when an upload fails (#4376)
also: sync duplicated code between all plugins

fixes #4356
2023-03-29 21:06:07 +09:00
Antoine du Hamel
b7fa0238be
@uppy/tus: do not auto-open sockets, clean them up on abort
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-03-22 12:58:57 +01:00
Antoine du Hamel
37d9717a51
@uppy/aws-s3-multipart,@uppy/tus: fix Timed out waiting for socket (#4177) 2022-10-28 01:06:52 +02:00
Artur Paikin
618cc69e61
replace this.getState().files with this.uppy.getState().files (#4167)
* replace this.getState().files with this.uppy.getState.files

* We actually want to check if the file is NOT present
2022-10-24 16:33:22 +01:00
Antoine du Hamel
33beeab901
@uppy/core: do not crash if a file is removed before the upload starts (#4148) 2022-10-19 21:00:06 +02:00
Merlijn Vos
d7180dbb3c
@uppy/tus, @uppy/xhr-upload, @uppy/aws-s3: metaFields -> allowedMetaFields (#4023) 2022-08-22 16:48:39 +02:00