mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
apply feedback
This commit is contained in:
parent
439787021b
commit
1f4b8e187c
3 changed files with 34 additions and 10 deletions
|
|
@ -177,7 +177,19 @@ export type UnknownProviderPlugin<
|
|||
BaseProviderPlugin & {
|
||||
rootFolderId: string | null
|
||||
files: UppyFile<M, B>[]
|
||||
provider: Provider<M, B>
|
||||
// Structural subset of the real `Provider` class,structural rather than the nominal class type so custom
|
||||
// providers matching the public surface aren't forced to inherit from `Provider`.
|
||||
provider: Pick<
|
||||
Provider<M, B>,
|
||||
| 'name'
|
||||
| 'provider'
|
||||
| 'login'
|
||||
| 'logout'
|
||||
| 'fetchPreAuthToken'
|
||||
| 'fileUrl'
|
||||
| 'list'
|
||||
| 'search'
|
||||
>
|
||||
view: ProviderView<M, B>
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +211,11 @@ export type UnknownSearchProviderPlugin<
|
|||
B extends Body,
|
||||
> = UnknownPlugin<M, B, UnknownSearchProviderPluginState> &
|
||||
BaseProviderPlugin & {
|
||||
provider: SearchProvider<M, B>
|
||||
// Structural subset of the real `SearchProvider` class (see note above).
|
||||
provider: Pick<
|
||||
SearchProvider<M, B>,
|
||||
'name' | 'provider' | 'fileUrl' | 'search'
|
||||
>
|
||||
}
|
||||
|
||||
// for better readability
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import type Provider from '../../companion-client/Provider.js'
|
||||
import type SearchProvider from '../../companion-client/SearchProvider.js'
|
||||
import type { UnknownPlugin } from '../../index.js'
|
||||
import type {
|
||||
UnknownPlugin,
|
||||
UnknownProviderPlugin,
|
||||
UnknownSearchProviderPlugin,
|
||||
} from '../../index.js'
|
||||
import type {
|
||||
Body,
|
||||
CompanionFile,
|
||||
|
|
@ -13,7 +15,9 @@ import companionFileToUppyFile from './companionFileToUppyFile.js'
|
|||
const addFiles = <M extends Meta, B extends Body>(
|
||||
companionFiles: CompanionFile[],
|
||||
plugin: UnknownPlugin<M, B>,
|
||||
provider: Provider<M, B> | SearchProvider<M, B>,
|
||||
provider:
|
||||
| UnknownProviderPlugin<M, B>['provider']
|
||||
| UnknownSearchProviderPlugin<M, B>['provider'],
|
||||
): void => {
|
||||
const uppyFiles = companionFiles.map((f) =>
|
||||
companionFileToUppyFile<M, B>(f, plugin, provider),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import type Provider from '../../companion-client/Provider.js'
|
||||
import type SearchProvider from '../../companion-client/SearchProvider.js'
|
||||
import type { UnknownPlugin } from '../../index.js'
|
||||
import type {
|
||||
UnknownPlugin,
|
||||
UnknownProviderPlugin,
|
||||
UnknownSearchProviderPlugin,
|
||||
} from '../../index.js'
|
||||
import type {
|
||||
Body,
|
||||
CompanionFile,
|
||||
|
|
@ -11,7 +13,9 @@ import type {
|
|||
const companionFileToUppyFile = <M extends Meta, B extends Body>(
|
||||
file: CompanionFile,
|
||||
plugin: UnknownPlugin<M, B>,
|
||||
provider: Provider<M, B> | SearchProvider<M, B>,
|
||||
provider:
|
||||
| UnknownProviderPlugin<M, B>['provider']
|
||||
| UnknownSearchProviderPlugin<M, B>['provider'],
|
||||
): RemoteUppyFile<M, B> => {
|
||||
const name = file.name || file.id
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue