* meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type`
It seems to better align with what we are after: stability of public API types. We likely don't need explicit types for all functions, and it's a bit tedious to have when converting an existing plugin.
* 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>
New concept "simple auth" - authentication that happens immediately (in one http request) without redirecting to any third party.
uppyAuthToken initially used to simply contain an encrypted & json encoded OAuth2 access_token for a specific provider. Then we added refresh tokens as well inside uppyAuthToken #4448. Now we also allow storing other state or parameters needed for that specific provider, like username, password, host name, webdav URL etc... This is needed for providers like webdav, ftp etc, where the user needs to give some more input data while authenticating
Companion:
- `providerTokens` has been renamed to `providerUserSession` because it now includes not only tokens, but a user's session with a provider.
Companion `Provider` class:
- New `hasSimpleAuth` static boolean property - whether this provider uses simple auth
- uppyAuthToken expiry default 24hr again for providers that don't support refresh tokens
- make uppyAuthToken expiry configurable per provider - new `authStateExpiry` static property (defaults to 24hr)
- new static property `grantDynamicToUserSession`, allows providers to specify which state from Grant `dynamic` to include into the provider's `providerUserSession`.
* don't cancel assembly when clicking "done"
* Reset state to default when Done button is pressed
* reuse code
* Apply suggestions from code review
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
---------
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
* Dashboard: auto discover plugins no matter when they were installed
* Remove target from RemoteSoruces, making it compatible with @uppy/react
* Update packages/@uppy/dashboard/src/Dashboard.jsx
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
* Removed comments, added comments
* better comment
* Change type — otherwise gets listed on Dashboard sources
* Add RemoteSources to React test
* Add RemoteSources to React example
* Add tests
* Refactor for less iteration for each plugin, rename functions
* Prevent error when opts are undefined
* remove console.logs
* prettier
---------
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Fixes: https://github.com/transloadit/uppy/issues/4272
Co-authored-by: R <r@r.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
* 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>
* Only enable singleFile mode when Dashboard tall enough + add centerSingleFile option
* Shorten file name when Dashboard is short 📏
* Center and flex single file, prevent overflows, contain img instead of cover
* White image background looks better
* Fix broken file type icons (shown when no image preview)
* Don't stretch images smaller than container / background
* uppy-c-textInput font-family inherit
* No shadow, retain cover when non-single-file, add paddings
* if preview is available, set white background, otherwise keep violet
* add transparency to the white background
* centerSingleFile --> singleFileFullScreen
* fix race condtion when adding files
don't call addFolder from listAllFiles
because that would call addFile before all folders were loaded
also remove unused selectedFolders state
* fix also the case of adding multiple folders
* fix todo: remove SharedHandler
* remove loaderWrapper
* fix logic
* fix the last race condition
* fix broken duplicate file check
* fix logic
* prettiyfy loop
* add user feedback
so they know that something is happening
* run corepack yarn run build:locale-pack
* Revert "run corepack yarn run build:locale-pack"
This reverts commit 85548ce2fc.
* Revert "add user feedback"
This reverts commit 4060019c35.
* use async generator instead of p-map
* re-fix race-condition
* remove providerFileToId
as suggested by @arturi
* use addFiles instead of addFile
* rename function
* use provider-supplied file ID
instead of generating an ID, for providers that we whitelsit
this allows adding the same time many times (with a different path)
* call core directly
* improve dev dashboard
* disable experimental getAsFileSystemHandle
it seems to be causing problems when dropping folders with subfolders in newest chrome
e.g a folder with 50 files and a subfolder which in turn has another 50 files
also refactor and document the code more
* Update packages/@uppy/provider-views/src/ProviderView/ProviderView.jsx
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* mov eto utils
---------
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* Use form attribite with a form in doc root to prevent outer form submit
* Fix Unsplash a11y bug — don't focus on hidden links
* Combine search and filter into one SearchFilterInput component for Unsplash
* Refactor Browser and ProviderView
* Refactor FileCard to hooks
* Finish SearchFilterInput, add reset labels and no results copy, better styles
* don't use debounce for now
* combine useEffects, named export, extract RenderMetaFields component
* inputCSSClassName --> inputClassName
* Remove typo
* 🤦
* Patch Preact to work with Jest
* tabs vs spaces
---------
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* If non-remote file has no .data, it’s a File object from the browser, convert it to Uppy format
* Add test
* Update packages/@uppy/core/src/Uppy.js
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* Check for instanceof File
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* Refactor uppy-u-reset: all: initial is now well-supported
* Utilize system-ui font-family, it should be provided by browsers now for multi-platform consistency
* Make Dashboard UI a little smaller by default
* Add uppy-c-btn to uppy-Dashboard-browse
* hide uploadNewlyAdded button when preprecessing
* Make “drop files here” tagline more even
* core validateRestrictions: return error directly vs the result/reason obj
* Refacrtor to actually use restrictionError instead of {reason, message}
* Return error instead of throwing
- `@uppy/aws/s3-multipart`: remove `client` getter and setter.
- reason: internal usage only
- migrate: use exposed options only
- `@uppy/core`: remove `AggregateError` polyfill
- reason: [should be polyfilled by the user](https://github.com/transloadit/uppy/pull/3532#discussion_r818602636)
- migrate: install `AggregateError` polyfill or use `core-js`
- `@uppy/core`: remove `reset()` method
- reason: it's a duplicate of `cancelAll`, but with a less intention revealing name
- migrate: use `cancelAll`
- `@uppy/core`: remove backwards compatible exports (static properties on `Uppy`)
- reason: transition to ESM
- migrate: import the `Uppy` class by default and/or use named exports for everything else.
- `@uppy/react`: don't expose `validProps`
- reason: internal only
- migrate: do not depend on this
- `@uppy/store-redux`: remove backwards compatible exports (static properties on `ReduxStore`)
- reason: transition to ESM
- migrate: use named imports
- `@uppy/thumbnail-generator`: remove `rotateImage`, `protect`, and `canvasToBlob` from prototype.
- reason: internal only
- migrate: don't depend on this
When starting an upload and removing it right away, it creates a race
condition when the assembly is created with no files and is never
closed. This commit ensures that the assembly is closed if all files
have been removed, or updated with the new expected number of
files otherwise.
Co-authored-by: Aaron Heimlich <aaron.heimlich@gmail.com>
* meta: disable ESM to CJS transorm in dist files
This commit removes all the hacks that needed to happen in order to ship
working CJS code. Onwards, we plan to distribute Uppy packages as ESM.
* No mocking with Jest and ESM