import type { Body, DefinePluginOpts, Meta, PluginOpts, Uppy, UppyFile } from '@uppy/core'; import { BasePlugin, EventManager } from '@uppy/core'; import { RateLimitedQueue } from '@uppy/utils'; import * as tus from 'tus-js-client'; type RestTusUploadOptions = Omit; export type TusDetailedError = tus.DetailedError; export type TusBody = { xhr: XMLHttpRequest; }; export interface TusOpts extends PluginOpts, RestTusUploadOptions { endpoint?: string; headers?: Record | ((file: UppyFile) => Record); limit?: number; chunkSize?: number; onBeforeRequest?: (req: tus.HttpRequest, file: UppyFile) => void | Promise; onShouldRetry?: (err: tus.DetailedError, retryAttempt: number, options: TusOpts, next: (e: tus.DetailedError) => boolean) => boolean; retryDelays?: number[]; withCredentials?: boolean; allowedMetaFields?: boolean | string[]; rateLimitedQueue?: RateLimitedQueue; } export type { TusOpts as TusOptions }; declare const defaultOptions: { limit: number; retryDelays: number[]; withCredentials: false; allowedMetaFields: true; }; type Opts = DefinePluginOpts, keyof typeof defaultOptions>; declare module '@uppy/utils' { interface LocalUppyFile { tus?: TusOpts; } interface RemoteUppyFile { tus?: TusOpts; } } declare module '@uppy/core' { interface PluginTypeRegistry { Tus: Tus; } } /** * Tus resumable file uploader */ export default class Tus extends BasePlugin, M, B> { #private; static VERSION: string; requests: RateLimitedQueue; uploaders: Record; uploaderEvents: Record | null>; constructor(uppy: Uppy, opts: TusOpts); /** * Clean up all references for a file's upload: the tus.Upload instance, * any events related to the file, and the Companion WebSocket connection. */ resetUploaderReferences(fileID: string, opts?: { abort: boolean; }): void; /** * Store the uploadUrl on the file options, so that when Golden Retriever * restores state, we will continue uploading to the correct URL. */ onReceiveUploadUrl(file: UppyFile, uploadURL: string | null): void; install(): void; uninstall(): void; } //# sourceMappingURL=index.d.ts.map