import type { Body, DefinePluginOpts, Meta, PluginOpts, State, Uppy, UppyFile } from '@uppy/core'; import { BasePlugin, EventManager } from '@uppy/core'; import { type FetcherOptions, type LocalUppyFile } from '@uppy/utils'; export interface XhrUploadOpts extends PluginOpts { endpoint: string | ((fileOrBundle: UppyFile | UppyFile[]) => string | Promise); method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH' | 'delete' | 'get' | 'head' | 'options' | 'post' | 'put' | string; formData?: boolean; fieldName?: string; headers?: Record | ((file: UppyFile) => Record); timeout?: number; limit?: number; responseType?: XMLHttpRequestResponseType; withCredentials?: boolean; onBeforeRequest?: (xhr: XMLHttpRequest, retryCount: number, /** The files to be uploaded. When `bundle` is `false` only one file is in the array. */ files: UppyFile[]) => void | Promise; shouldRetry?: FetcherOptions['shouldRetry']; onAfterResponse?: FetcherOptions['onAfterResponse']; getResponseData?: (xhr: XMLHttpRequest) => B | Promise; allowedMetaFields?: boolean | string[]; bundle?: boolean; } export type { XhrUploadOpts as XHRUploadOptions }; declare module '@uppy/utils' { interface LocalUppyFile { xhrUpload?: XhrUploadOpts; } interface RemoteUppyFile { xhrUpload?: XhrUploadOpts; } } declare module '@uppy/core' { interface State { xhrUpload?: XhrUploadOpts; } } declare module '@uppy/core' { interface PluginTypeRegistry { XHRUpload: XHRUpload; } } declare const defaultOptions: { formData: true; fieldName: string; method: string; allowedMetaFields: true; bundle: false; headers: {}; timeout: number; limit: number; withCredentials: false; responseType: ""; }; type Opts = DefinePluginOpts, keyof typeof defaultOptions>; interface OptsWithHeaders extends Opts { headers: Record; } export default class XHRUpload extends BasePlugin, M, B> { #private; static VERSION: string; uploaderEvents: Record | null>; constructor(uppy: Uppy, opts: XhrUploadOpts); getOptions(file: UppyFile): OptsWithHeaders; addMetadata(formData: FormData, meta: State['meta'], opts: Opts): void; createFormDataUpload(file: LocalUppyFile, opts: Opts): FormData; createBundledUpload(files: LocalUppyFile[], opts: Opts): FormData; install(): void; uninstall(): void; } //# sourceMappingURL=index.d.ts.map