mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
@uppy/aws-s3,@uppy/aws-s3-multipart: update types (#4576)
Co-authored-by: Merlijn Vos <merlijn@soverin.net> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
aa3f03f033
commit
f3ce884e43
26 changed files with 77 additions and 60 deletions
4
packages/@uppy/audio/types/index.d.ts
vendored
4
packages/@uppy/audio/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type AudioLocale from './generatedLocale'
|
||||
|
||||
export interface AudioOptions extends PluginOptions {
|
||||
export interface AudioOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
showAudioSourceDropdown?: boolean
|
||||
locale?: AudioLocale
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core'
|
||||
import type { BasePlugin, PluginOptions, UppyFile } from '@uppy/core'
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>
|
||||
|
||||
|
|
@ -35,16 +35,15 @@ export interface AwsS3MultipartOptions extends PluginOptions {
|
|||
file: UppyFile,
|
||||
opts: { uploadId: string; key: string; signal: AbortSignal }
|
||||
) => MaybePromise<AwsS3Part[]>
|
||||
getTemporarySecurityCredentials?: boolean | (() => MaybePromise<AwsS3STSResponse>)
|
||||
signPart?: (
|
||||
file: UppyFile,
|
||||
opts: { uploadId: string; key: string; partNumber: number; body: Blob, signal: AbortSignal }
|
||||
opts: { uploadId: string; key: string; partNumber: number; body: Blob; signal: AbortSignal }
|
||||
) => MaybePromise<AwsS3SignedPart>
|
||||
/** @deprecated Use signPart instead */
|
||||
prepareUploadParts?: (
|
||||
file: UppyFile,
|
||||
partData: { uploadId: string; key: string; parts: [{ number: number, chunk: Blob }], signal: AbortSignal }
|
||||
) => MaybePromise<{ presignedUrls: { [k: number]: string }, headers?: { [k: string]: string } }>
|
||||
partData: { uploadId: string; key: string; parts: [{ number: number, chunk: Blob }] }
|
||||
) => MaybePromise<{ presignedUrls: Record<number, string>, headers?: Record<number, Record<string, string>> }>
|
||||
abortMultipartUpload?: (
|
||||
file: UppyFile,
|
||||
opts: { uploadId: string; key: string; signal: AbortSignal }
|
||||
|
|
|
|||
24
packages/@uppy/aws-s3/types/index.d.ts
vendored
24
packages/@uppy/aws-s3/types/index.d.ts
vendored
|
|
@ -1,5 +1,4 @@
|
|||
import { AwsS3MultipartOptions } from '@uppy/aws-s3-multipart'
|
||||
import type { BasePlugin } from '@uppy/core'
|
||||
import type { BasePlugin, Locale, PluginOptions, UppyFile } from '@uppy/core'
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>
|
||||
|
||||
|
|
@ -10,8 +9,25 @@ export interface AwsS3UploadParameters {
|
|||
headers?: { [type: string]: string }
|
||||
}
|
||||
|
||||
export interface AwsS3Options extends AwsS3MultipartOptions {
|
||||
/** @deprecated future versions of this plugin will use the Expires value from the backend */
|
||||
export interface AwsS3Options extends PluginOptions {
|
||||
companionUrl?: string | null
|
||||
companionHeaders?: Record<string, string>
|
||||
allowedMetaFields?: Array<string> | null
|
||||
getUploadParameters?: (file: UppyFile) => MaybePromise<{
|
||||
method?: 'POST'
|
||||
url: string
|
||||
fields?: Record<string, string>
|
||||
headers?: Record<string, string>
|
||||
} | {
|
||||
method: 'PUT'
|
||||
url: string
|
||||
fields: never
|
||||
headers?: Record<string, string>
|
||||
}>
|
||||
limit?: number
|
||||
/** @deprecated this option will not be supported in future versions of this plugin */
|
||||
getResponseData?: (responseText: string, response: XMLHttpRequest) => void
|
||||
locale?: Locale,
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Uppy, UppyFile } from '@uppy/core'
|
||||
import { expectType } from 'tsd'
|
||||
import Uppy from '@uppy/core'
|
||||
import type { UppyFile } from '@uppy/core'
|
||||
import AwsS3 from '..'
|
||||
|
||||
{
|
||||
|
|
@ -8,7 +7,7 @@ import AwsS3 from '..'
|
|||
uppy.use(AwsS3, {
|
||||
getUploadParameters (file) {
|
||||
expectType<UppyFile>(file)
|
||||
return { url: '' }
|
||||
return { method: 'POST', url: '', fields: {}, headers: {} }
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
4
packages/@uppy/box/types/index.d.ts
vendored
4
packages/@uppy/box/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, PluginTarget, UIPlugin } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
interface BoxOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface BoxOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
|
|
|
|||
5
packages/@uppy/core/types/index.d.ts
vendored
5
packages/@uppy/core/types/index.d.ts
vendored
|
|
@ -63,6 +63,9 @@ export interface AddFileOptions<
|
|||
|
||||
export interface PluginOptions {
|
||||
id?: string
|
||||
}
|
||||
|
||||
export interface UIPluginOptions extends PluginOptions {
|
||||
replaceTargetContent?: boolean
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +95,7 @@ export class BasePlugin<TOptions extends PluginOptions = DefaultPluginOptions> {
|
|||
uninstall(): void
|
||||
}
|
||||
|
||||
export class UIPlugin<TOptions extends PluginOptions = DefaultPluginOptions> extends BasePlugin<TOptions> {
|
||||
export class UIPlugin<TOptions extends UIPluginOptions = DefaultPluginOptions> extends BasePlugin<TOptions> {
|
||||
id: string
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
|
|
|||
4
packages/@uppy/dashboard/types/index.d.ts
vendored
4
packages/@uppy/dashboard/types/index.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget, UppyFile, IndexedObject } from '@uppy/core'
|
||||
import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core'
|
||||
import type { StatusBarLocale } from '@uppy/status-bar'
|
||||
import type { ThumbnailOptions } from '@uppy/thumbnail-generator'
|
||||
import DashboardLocale from './generatedLocale'
|
||||
|
|
@ -20,7 +20,7 @@ interface MetaField {
|
|||
render?: (field: FieldRenderOptions, h: PreactRender) => any
|
||||
}
|
||||
|
||||
type Options = PluginOptions & ThumbnailOptions
|
||||
type Options = UIPluginOptions & ThumbnailOptions
|
||||
|
||||
export interface DashboardOptions extends Options {
|
||||
animateOpenClose?: boolean
|
||||
|
|
|
|||
4
packages/@uppy/drag-drop/types/index.d.ts
vendored
4
packages/@uppy/drag-drop/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import DragDropLocale from './generatedLocale'
|
||||
|
||||
export interface DragDropOptions extends PluginOptions {
|
||||
export interface DragDropOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
inputName?: string
|
||||
allowMultipleFiles?: boolean
|
||||
|
|
|
|||
4
packages/@uppy/dropbox/types/index.d.ts
vendored
4
packages/@uppy/dropbox/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
export interface DropboxOptions extends PluginOptions, PublicProviderOptions {
|
||||
export interface DropboxOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
|
|
|
|||
6
packages/@uppy/facebook/types/index.d.ts
vendored
6
packages/@uppy/facebook/types/index.d.ts
vendored
|
|
@ -1,12 +1,12 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
export interface FacebookOptions extends PluginOptions, PublicProviderOptions {
|
||||
export interface FacebookOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
|
||||
declare class Facebook extends UIPlugin<FacebookOptions> {}
|
||||
declare class Facebook extends UIPlugin<FacebookOptions> { }
|
||||
|
||||
export default Facebook
|
||||
|
|
|
|||
4
packages/@uppy/file-input/types/index.d.ts
vendored
4
packages/@uppy/file-input/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import FileInputLocale from './generatedLocale'
|
||||
|
||||
export interface FileInputOptions extends PluginOptions {
|
||||
export interface FileInputOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
pretty?: boolean
|
||||
inputName?: string
|
||||
|
|
|
|||
6
packages/@uppy/google-drive/types/index.d.ts
vendored
6
packages/@uppy/google-drive/types/index.d.ts
vendored
|
|
@ -1,12 +1,12 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
export interface GoogleDriveOptions extends PluginOptions, PublicProviderOptions {
|
||||
export interface GoogleDriveOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
}
|
||||
|
||||
declare class GoogleDrive extends UIPlugin<GoogleDriveOptions> {}
|
||||
declare class GoogleDrive extends UIPlugin<GoogleDriveOptions> { }
|
||||
|
||||
export default GoogleDrive
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Uppy, { UIPlugin, PluginOptions } from '@uppy/core'
|
||||
import Uppy, { UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import GoogleDrive from '..'
|
||||
|
||||
class SomePlugin extends UIPlugin<PluginOptions> {}
|
||||
class SomePlugin extends UIPlugin<UIPluginOptions> {}
|
||||
|
||||
const uppy = new Uppy()
|
||||
uppy.use(GoogleDrive, { companionUrl: '' })
|
||||
|
|
|
|||
4
packages/@uppy/image-editor/types/index.d.ts
vendored
4
packages/@uppy/image-editor/types/index.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget, UppyFile, IndexedObject } from '@uppy/core'
|
||||
import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core'
|
||||
import type Cropper from 'cropperjs'
|
||||
import ImageEditorLocale from './generatedLocale'
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ interface UppyCropperOptions extends Cropper.Options {
|
|||
croppedCanvasOptions: Cropper.GetCroppedCanvasOptions
|
||||
}
|
||||
|
||||
export interface ImageEditorOptions extends PluginOptions {
|
||||
export interface ImageEditorOptions extends UIPluginOptions {
|
||||
cropperOptions?: UppyCropperOptions
|
||||
actions?: Actions
|
||||
quality?: number
|
||||
|
|
|
|||
4
packages/@uppy/informer/types/index.d.ts
vendored
4
packages/@uppy/informer/types/index.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
|
||||
interface InformerOptions extends PluginOptions {
|
||||
interface InformerOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
}
|
||||
|
||||
|
|
|
|||
4
packages/@uppy/instagram/types/index.d.ts
vendored
4
packages/@uppy/instagram/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
export interface InstagramOptions extends PluginOptions, PublicProviderOptions {
|
||||
export interface InstagramOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
|
|
|
|||
4
packages/@uppy/onedrive/types/index.d.ts
vendored
4
packages/@uppy/onedrive/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client'
|
||||
|
||||
export interface OneDriveOptions extends PluginOptions, PublicProviderOptions {
|
||||
export interface OneDriveOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
|
|
|
|||
4
packages/@uppy/progress-bar/types/index.d.ts
vendored
4
packages/@uppy/progress-bar/types/index.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
|
||||
export interface ProgressBarOptions extends PluginOptions {
|
||||
export interface ProgressBarOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
hideAfterFinish?: boolean
|
||||
fixed?: boolean
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { PluginOptions, UIPlugin } from '@uppy/core'
|
||||
import type { UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
|
||||
type ReduxDevToolsOptions = PluginOptions
|
||||
type ReduxDevToolsOptions = UIPluginOptions
|
||||
|
||||
declare class ReduxDevTools extends UIPlugin<ReduxDevToolsOptions> {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_shared_screen_tracks
|
||||
// TODO: use the global DisplayMediaStreamConstraints once typescript includes it by default
|
||||
|
|
@ -11,7 +11,7 @@ import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
|||
});
|
||||
}
|
||||
|
||||
export interface ScreenCaptureOptions extends PluginOptions {
|
||||
export interface ScreenCaptureOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
displayMediaConstraints?: DisplayMediaStreamConstraints,
|
||||
userMediaConstraints?: MediaStreamConstraints,
|
||||
|
|
|
|||
4
packages/@uppy/status-bar/types/index.d.ts
vendored
4
packages/@uppy/status-bar/types/index.d.ts
vendored
|
|
@ -1,9 +1,9 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import GeneratedLocale from './generatedLocale'
|
||||
|
||||
export type StatusBarLocale = GeneratedLocale
|
||||
|
||||
export interface StatusBarOptions extends PluginOptions {
|
||||
export interface StatusBarOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
showProgressDetails?: boolean
|
||||
hideUploadButton?: boolean
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { IndexedObject, PluginOptions, UIPlugin, UppyFile } from '@uppy/core'
|
||||
import type { IndexedObject, UIPlugin, UIPluginOptions, UppyFile } from '@uppy/core'
|
||||
|
||||
import ThumbnailGeneratorLocale from './generatedLocale'
|
||||
|
||||
export interface ThumbnailOptions {
|
||||
export interface ThumbnailOptions extends UIPluginOptions {
|
||||
thumbnailWidth?: number
|
||||
thumbnailHeight?: number
|
||||
thumbnailType?: string
|
||||
|
|
@ -14,7 +14,7 @@ interface Options extends ThumbnailOptions {
|
|||
locale?: ThumbnailGeneratorLocale
|
||||
}
|
||||
|
||||
declare class ThumbnailGenerator extends UIPlugin<PluginOptions & Options> {}
|
||||
declare class ThumbnailGenerator extends UIPlugin<Options> {}
|
||||
|
||||
export default ThumbnailGenerator
|
||||
|
||||
|
|
|
|||
4
packages/@uppy/unsplash/types/index.d.ts
vendored
4
packages/@uppy/unsplash/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { RequestClientOptions } from '@uppy/companion-client'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
|
||||
interface UnsplashOptions extends PluginOptions, RequestClientOptions {
|
||||
interface UnsplashOptions extends UIPluginOptions, RequestClientOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
}
|
||||
|
|
|
|||
4
packages/@uppy/url/types/index.d.ts
vendored
4
packages/@uppy/url/types/index.d.ts
vendored
|
|
@ -1,8 +1,8 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget, IndexedObject } from '@uppy/core'
|
||||
import type { RequestClientOptions } from '@uppy/companion-client'
|
||||
import type { IndexedObject, PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import UrlLocale from './generatedLocale'
|
||||
|
||||
export interface UrlOptions extends PluginOptions, RequestClientOptions {
|
||||
export interface UrlOptions extends UIPluginOptions, RequestClientOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
locale?: UrlLocale
|
||||
|
|
|
|||
4
packages/@uppy/webcam/types/index.d.ts
vendored
4
packages/@uppy/webcam/types/index.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import WebcamLocale from './generatedLocale'
|
||||
|
||||
export type WebcamMode =
|
||||
|
|
@ -7,7 +7,7 @@ export type WebcamMode =
|
|||
| 'audio-only'
|
||||
| 'picture'
|
||||
|
||||
export interface WebcamOptions extends PluginOptions {
|
||||
export interface WebcamOptions extends UIPluginOptions {
|
||||
target?: PluginTarget
|
||||
onBeforeSnapshot?: () => Promise<void>
|
||||
countdown?: number | boolean
|
||||
|
|
|
|||
4
packages/@uppy/zoom/types/index.d.ts
vendored
4
packages/@uppy/zoom/types/index.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core'
|
||||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core'
|
||||
import type { TokenStorage, PublicProviderOptions } from '@uppy/companion-client'
|
||||
|
||||
interface ZoomOptions extends PluginOptions, PublicProviderOptions {
|
||||
interface ZoomOptions extends UIPluginOptions, PublicProviderOptions {
|
||||
target?: PluginTarget
|
||||
title?: string
|
||||
storage?: TokenStorage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue