// Generated by dts-bundle-generator v9.5.1 import NodeFormData from 'form-data'; // Generated by dts-bundle-generator v9.5.1 /** * Joins the segments of a separated string, capitalising every one after the * first — the type-level half of {@link camelizeString}. * * Covers the separators that appear in API keys (`_`, `-`, `.`, space). Any * other non-word character is a separator at runtime but not here, so a string * containing one keeps its own literal type rather than gaining a wrong one. */ export type JoinSegments = S extends `${infer Head}_${infer Tail}` ? `${Head}${Capitalize>}` : S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize>}` : S extends `${infer Head}.${infer Tail}` ? `${Head}${Capitalize>}` : S extends `${infer Head} ${infer Tail}` ? `${Head}${Capitalize>}` : S; /** What {@link camelizeString} turns `S` into. */ export type Camelize = Uncapitalize>; /** * Rewrite a separated string as camelCase: `non_field_errors` becomes * `nonFieldErrors`. * * The return type follows the value, so a literal in gives the camelCase * literal out and constants can be derived from the spelling they came from * instead of being written twice. */ export declare function camelizeString(text: S): Camelize; export type SnakeCase = S extends `${infer Head}${infer Tail}` ? Head extends Uppercase ? Head extends Lowercase ? `${Head}${SnakeCase}` : `_${Lowercase}${SnakeCase}` : `${Head}${SnakeCase}` : S; /** * Type-level inverse of {@link camelizeKeys}: recursively rewrite an object's * camelCase keys to snake_case. Lets a raw API frame be described as the * snake_case form of a camelCase type such as `FileInfo`. * * Arrays and tuples keep their own shape — length, labels and `readonly` — and * only their element types are rewritten. */ export type SnakeCasedPropertiesDeep = T extends readonly unknown[] ? { [K in keyof T]: SnakeCasedPropertiesDeep; } : T extends object ? { [K in keyof T as K extends string ? SnakeCase : K]: SnakeCasedPropertiesDeep; } : T; export type CamelizeKeysOptions = { ignoreKeys: string[]; }; /** * Recursively rewrite an object's snake_case keys to camelCase. * * The result is whatever the caller says it is: pass the camelCase type it * produces (`camelizeKeys(raw)`) instead of casting the return value. * Defaults to a plain record, so existing untyped calls keep compiling. * Non-objects pass through untouched. */ export declare function camelizeKeys>(source: unknown, { ignoreKeys }?: CamelizeKeysOptions): T; export type CustomUserAgentOptions = { publicKey: string; libraryName: string; libraryVersion: string; languageName: string; integration?: string; }; export type CustomUserAgentFn = (options: CustomUserAgentOptions) => string; export type CustomUserAgent = string | CustomUserAgentFn; export type GetUserAgentOptions = { libraryName: string; libraryVersion: string; publicKey?: string; integration?: string; userAgent?: CustomUserAgent | null; }; export declare function getUserAgent({ libraryName, libraryVersion, userAgent, publicKey, integration }: GetUserAgentOptions): string; export declare class UploadcareError extends Error { } export declare class NetworkError extends UploadcareError { originalProgressEvent: ProgressEvent; constructor(progressEvent: ProgressEvent); } export type GeoLocation = { latitude: number; longitude: number; }; export type ImageInfo = { height: number; width: number; geoLocation: GeoLocation | null; datetimeOriginal: string | null; format: string; colorMode: string; dpi: { "0": number; "1": number; } | null; orientation: number | null; sequence: boolean | null; }; export type AudioInfo = { bitrate: number | null; codec: string | null; sampleRate: number | null; channels: string | null; }; export type VideoInfo = { duration: number; format: string; bitrate: number; audio: AudioInfo | null; video: { height: number; width: number; frameRate: number; bitrate: number; codec: string; }; }; export type MimeInfo = { mime: string; type: string; subtype: string; }; export type ContentInfo = { mime?: MimeInfo; image?: ImageInfo; video?: VideoInfo; }; export type Metadata = Record; export type Tags = string[]; export type StoreValue = "auto" | boolean; export declare class CancelError extends UploadcareError { isCancel: boolean; constructor(message?: string); } export type PollCheckFunction = (signal?: AbortSignal) => Promise | false | T; /** * Call `check` until it returns something truthy, waiting `interval` * milliseconds between attempts, and resolve with that value. * * Rejects with a `CancelError` when `signal` aborts or `timeout` elapses, * whichever happens first. Either one ends the loop for good: no further * `check` runs, and the result of one already in flight is discarded. * * A `check` in flight is still awaited before that rejection surfaces, so pass * `signal` on to whatever the attempt does if cancellation should be prompt. * * @param check Runs one attempt; anything falsy means "not done yet". Receives * `signal` so the attempt itself can be aborted. * @param interval Milliseconds between attempts. Defaults to 500. * @param timeout Milliseconds to keep trying for. Unbounded when omitted. * @param signal Aborts the polling. */ export declare const poll: ({ check, interval, timeout, signal }: { check: PollCheckFunction; timeout?: number; interval?: number; signal?: AbortSignal; }) => Promise; /** Produces a token. Called before every authenticated request. */ export type AuthTokenResolver = () => string | Promise; /** * A resolver that can also be told the token it handed over is no longer good. * `AuthTokenCache` from `@uploadcare/signed-uploads/client` is one, so an * instance can be passed as `authToken` directly. * * `invalidate` is what lets this client recover from a token the Upload API * refuses: without it, asking a cache for a token again returns the same one it * just cached, and the retry fails identically. */ export type AuthTokenProvider = { getToken: AuthTokenResolver; /** Drop the cached token, so the next `getToken()` fetches a new one. */ invalidate?: () => void; }; /** * JWT for the Upload API `Authorization: Bearer ` scheme. Accepts a * plain token, a resolver function, or a provider. A resolver is called before * every request, so long-running uploads (e.g. multipart) can supply a fresh * token mid-flight. * * This client never stores a token between calls. Rather than fetching one per * request, pass an `AuthTokenCache` from `@uploadcare/signed-uploads/client`, * which holds the token and replaces it shortly before it expires: * * ```ts * const tokens = new AuthTokenCache({ fetchToken }) * uploadFile(file, { publicKey, authToken: tokens }) * ``` * * Passing `tokens.getToken` still works, and the cache still replaces the token * on expiry. What the provider form adds is recovery from a token the server * refuses: this client drops the cached one and retries once, which is what * saves an upload whose token ran out of operations. * * Mint tokens on your server with `generateAuthToken` from * `@uploadcare/signed-uploads` — it needs the project secret key. * * Takes precedence over legacy `secureSignature` / `secureExpire`: when both * are provided, only the Authorization header is sent. */ export type AuthToken = string | AuthTokenResolver | AuthTokenProvider; export interface DefaultSettings { baseCDN: string; /** * Base domain used to build per-project prefixed CDN URLs (default * `https://ucarecd.net`). */ prefixedBaseCDN: string; baseURL: string; maxContentLength: number; retryThrottledRequestMaxTimes: number; retryNetworkErrorMaxTimes: number; multipartMinFileSize: number; multipartChunkSize: number; multipartMinLastPartSize: number; maxConcurrentRequests: number; pollingTimeoutMilliseconds: number; pusherKey: string; } export interface Settings extends Partial { publicKey: string; fileName?: string; contentType?: string; store?: StoreValue; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; integration?: string; userAgent?: CustomUserAgent; checkForUrlDuplicates?: boolean; saveUrlForRecurrentUploads?: boolean; source?: string; jsonpCallback?: string; } export type BrowserFile = Blob | File; export type NodeFile = Buffer; export type ReactNativeAsset = { type: string; uri: string; name?: string; }; export type SupportedFileInput = BrowserFile | NodeFile | ReactNativeAsset; export type Sliceable = BrowserFile | NodeFile; export type FileInfo = { size: number; done: number; total: number; uuid: Uuid; fileId: Uuid; originalFilename: string; filename: string; mimeType: string; isImage: boolean; isStored: boolean; isReady: boolean; imageInfo: ImageInfo | null; videoInfo: VideoInfo | null; contentInfo: ContentInfo | null; s3Bucket?: string; metadata?: Metadata; tags?: Tags; }; export type GroupFileInfo = FileInfo & { defaultEffects: string; }; export type GroupInfo = { datetimeCreated: string; datetimeStored: string | null; filesCount: string; cdnUrl: string; files: (GroupFileInfo | null)[]; url: string; id: GroupId; }; export type Token = string; export type Uuid = string; export type GroupId = string; export type Url = string; export type ComputableProgressInfo = { isComputable: true; value: number; }; export type UnknownProgressInfo = { isComputable: false; }; export type ProgressCallback = (arg: T) => void; export type BaseResponse = { file: Uuid; }; export type BaseOptions = { publicKey: string; fileName?: string; baseURL?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; store?: StoreValue; contentType?: string; signal?: AbortSignal; onProgress?: ProgressCallback; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; metadata?: Metadata; tags?: Tags; }; /** * Performs file uploading request to Uploadcare Upload API. Can be canceled and * has progress. */ export function base(file: SupportedFileInput, { publicKey, fileName, contentType, baseURL, secureSignature, secureExpire, authToken, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata, tags }: BaseOptions): Promise; export declare enum TypeEnum { Token = "token", FileInfo = "file_info" } export type TokenResponse = { type: TypeEnum.Token; token: string; }; export type FileInfoResponse = { type: TypeEnum.FileInfo; } & FileInfo; export type FromUrlSuccessResponse = FileInfoResponse | TokenResponse; export type FromUrlResponse = FromUrlSuccessResponse; export type FromUrlOptions = { publicKey: string; baseURL?: string; store?: StoreValue; fileName?: string; checkForUrlDuplicates?: boolean; saveUrlForRecurrentUploads?: boolean; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; metadata?: Metadata; tags?: Tags; }; /** Uploading files from URL. */ export function fromUrl(sourceUrl: Url, { publicKey, baseURL, store, fileName, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, authToken, source, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata, tags }: FromUrlOptions): Promise; /** @see https://uploadcare.com/api-refs/upload-api/#tag/Errors */ export type ServerErrorCode = "AccountBlockedError" | "AccountLimitsExceededError" | "AccountUnpaidError" | "AutostoreDisabledError" | "BaseViewsError" | "FileMetadataKeyDuplicatedError" | "FileMetadataKeyEmptyError" | "FileMetadataKeyForbiddenError" | "FileMetadataKeyLengthTooBigError" | "FileMetadataKeysNumberTooBigError" | "FileMetadataValueEmptyError" | "FileMetadataValueForbiddenError" | "FileMetadataValueLengthTooBigError" | "FileSizeLimitExceededError" | "MethodNotAllowedError" | "NullCharactersForbiddenError" | "PostRequestParserFailedError" | "ProjectPublicKeyInvalidError" | "ProjectPublicKeyRemovedError" | "ProjectPublicKeyRequiredError" | "RequestFileNumberLimitExceededError" | "RequestFiledsNumberLimitExceededError" | "RequestSizeLimitExceededError" | "RequestThrottledError" | "SignatureExpirationError" | "SignatureExpirationInvalidError" | "SignatureExpirationRequiredError" | "SignatureInvalidError" | "SignatureRequiredError" | "UploadAPIError" | "UploadFailedError" | "DownloadFileError" | "DownloadFileHTTPClientError" | "DownloadFileHTTPNetworkError" | "DownloadFileHTTPServerError" | "DownloadFileHTTPURLValidationError" | "DownloadFileInternalServerError" | "DownloadFileNotFoundError" | "DownloadFileSizeLimitExceededError" | "DownloadFileTaskFailedError" | "DownloadFileTimeLimitExceededError" | "DownloadFileValidationFailedError" | "FileIdInvalidError" | "FileIdNotUniqueError" | "FileIdRequiredError" | "FileNotFoundError" | "FileRequiredError" | "FilesNumberLimitExceededError" | "FilesRequiredError" | "InternalRequestForbiddenError" | "InternalRequestInvalidError" | "MultipartFileAlreadyUploadedError" | "MultipartFileCompletionFailedError" | "MultipartFileIdRequiredError" | "MultipartFileNotFoundError" | "MultipartFileSizeLimitExceededError" | "MultipartFileSizeTooSmallError" | "MultipartPartSizeInvalidError" | "MultipartPartSizeTooBigError" | "MultipartPartSizeTooSmallError" | "MultipartSizeInvalidError" | "MultipartUploadSizeTooLargeError" | "MultipartUploadSizeTooSmallError" | "RequestParamRequiredError" | "SourceURLRequiredError" | "TokenRequiredError" | "UUIDInvalidError" | "UploadViewsError" | "UploadcareFileIdDuplicatedError" | "UploadcareFileIdInvalidError" | "UploadcareFileIdRequiredError" | "GroupFileURLParsingFailedError" | "GroupFilesInvalidError" | "GroupFilesNotFoundError" | "GroupIdRequiredError" | "GroupNotFoundError" | "GroupViewsError" | "FileInfectedError" | "FileTypeForbiddenError" | "HostnameNotFoundError" | "URLBlacklistedError" | "URLHostMalformedError" | "URLHostPrivateIPForbiddenError" | "URLHostRequiredError" | "URLParsingFailedError" | "URLRedirectsLimitExceededError" | "URLSchemeInvalidError" | "URLSchemeRequiredError" | "URLValidationError" | "AccessTokenExpiredError" | "OperationsLimitExceededError" | "ScopeForbiddenError" | "AccessTokenInvalidError"; export declare enum Status { Unknown = "unknown", Waiting = "waiting", Progress = "progress", Error = "error", Success = "success" } export type StatusUnknownResponse = { status: Status.Unknown; }; export type StatusWaitingResponse = { status: Status.Waiting; }; export type StatusProgressResponse = { status: Status.Progress; size: number; done: number; total: number | "unknown"; }; export type StatusErrorResponse = { status: Status.Error; error: string; errorCode: ServerErrorCode; }; export type StatusSuccessResponse = { status: Status.Success; } & FileInfo; export type FromUrlStatusResponse = StatusUnknownResponse | StatusWaitingResponse | StatusProgressResponse | StatusErrorResponse | StatusSuccessResponse; export type FromUrlStatusOptions = { publicKey?: string; baseURL?: string; authToken?: AuthToken; signal?: AbortSignal; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; /** Checking upload status and working with file tokens. */ export function fromUrlStatus(token: Token, { publicKey, baseURL, authToken, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }?: FromUrlStatusOptions): Promise; export type GroupOptions = { publicKey: string; baseURL?: string; jsonpCallback?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; /** Create files group. */ export function group(uuids: Uuid[], { publicKey, baseURL, jsonpCallback, secureSignature, secureExpire, authToken, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: GroupOptions): Promise; export type GroupInfoOptions = { publicKey: string; baseURL?: string; authToken?: AuthToken; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; /** Get info about group. */ export function groupInfo(id: GroupId, { publicKey, baseURL, authToken, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: GroupInfoOptions): Promise; export type InfoOptions = { publicKey: string; baseURL?: string; authToken?: AuthToken; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; /** Returns a JSON dictionary holding file info. */ export function info(uuid: Uuid, { publicKey, baseURL, authToken, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: InfoOptions): Promise; export type MultipartStartOptions = { publicKey: string; contentType?: string; fileName?: string; baseURL?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; store?: StoreValue; multipartChunkSize?: number; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; metadata?: Metadata; tags?: Tags; }; export type MultipartPart = string; export type MultipartStartResponse = { parts: MultipartPart[]; uuid: Uuid; }; /** Start multipart uploading. */ export function multipartStart(size: number, { publicKey, contentType, fileName, multipartChunkSize, baseURL, secureSignature, secureExpire, authToken, store, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata, tags }: MultipartStartOptions): Promise; export type MultipartUploadOptions = { publicKey?: string; contentType?: string; signal?: AbortSignal; onProgress?: ProgressCallback; integration?: string; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; export type MultipartUploadResponse = { code?: number; }; /** Complete multipart uploading. */ export function multipartUpload(part: SupportedFileInput, url: MultipartPart, { contentType, signal, onProgress, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: MultipartUploadOptions): Promise; export type MultipartCompleteOptions = { publicKey: string; baseURL?: string; authToken?: AuthToken; signal?: AbortSignal; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; }; /** Complete multipart uploading. */ export function multipartComplete(uuid: Uuid, { publicKey, baseURL, authToken, source, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: MultipartCompleteOptions): Promise; export declare class UploadcareFile { readonly uuid: Uuid; readonly name: string; readonly size: number; readonly isStored: boolean; readonly isImage: boolean; readonly mimeType: string; readonly cdnUrl: string; readonly s3Url: string | null; readonly originalFilename: string; readonly imageInfo: ImageInfo | null; readonly videoInfo: VideoInfo | null; readonly contentInfo: ContentInfo | null; readonly metadata: Metadata | null; readonly tags: Tags | null; readonly s3Bucket: string | null; readonly defaultEffects: null | string; constructor(fileInfo: FileInfo | GroupFileInfo, { baseCDN, fileName }?: { baseCDN?: string; fileName?: string; }); } export type FileFromOptions = { publicKey: string; fileName?: string; baseURL?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; store?: StoreValue; signal?: AbortSignal; onProgress?: ProgressCallback; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; contentType?: string; multipartMinFileSize?: number; multipartChunkSize?: number; maxConcurrentRequests?: number; baseCDN?: string; prefixedBaseCDN?: string; checkForUrlDuplicates?: boolean; saveUrlForRecurrentUploads?: boolean; pusherKey?: string; metadata?: Metadata; tags?: Tags; }; /** Uploads file from provided data. */ export declare function uploadFile(data: SupportedFileInput | Url | Uuid, { publicKey, fileName, baseURL, secureSignature, secureExpire, authToken, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartMinFileSize, multipartChunkSize, maxConcurrentRequests, baseCDN, prefixedBaseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, pusherKey, metadata, tags }: FileFromOptions): Promise; export type DirectOptions = { publicKey: string; fileName?: string; baseURL?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; store?: StoreValue; contentType?: string; signal?: AbortSignal; onProgress?: ProgressCallback; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; baseCDN?: string; prefixedBaseCDN?: string; metadata?: Metadata; tags?: Tags; }; export declare const uploadDirect: (file: SupportedFileInput, { publicKey, fileName, baseURL, secureSignature, secureExpire, authToken, store, contentType, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, baseCDN, prefixedBaseCDN, metadata, tags }: DirectOptions) => Promise; export type FromUploadedOptions = { publicKey: string; fileName?: string; baseURL?: string; authToken?: AuthToken; signal?: AbortSignal; onProgress?: ProgressCallback; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; baseCDN?: string; prefixedBaseCDN?: string; }; export declare const uploadFromUploaded: (uuid: Uuid, { publicKey, fileName, baseURL, authToken, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, baseCDN, prefixedBaseCDN }: FromUploadedOptions) => Promise; export type UploadFromUrlOptions = { baseCDN?: string; prefixedBaseCDN?: string; onProgress?: ProgressCallback; pusherKey?: string; } & FromUrlOptions; export declare const uploadFromUrl: (sourceUrl: string, { publicKey, fileName, baseURL, baseCDN, prefixedBaseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, authToken, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, pusherKey, metadata, tags }: UploadFromUrlOptions) => Promise; export type MultipartOptions = { publicKey: string; contentType?: string; multipartChunkSize?: number; fileName?: string; fileSize?: number; baseURL?: string; secureSignature?: string; secureExpire?: string; authToken?: AuthToken; store?: StoreValue; signal?: AbortSignal; onProgress?: ProgressCallback; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; maxConcurrentRequests?: number; baseCDN?: string; prefixedBaseCDN?: string; metadata?: Metadata; tags?: Tags; }; export declare const uploadMultipart: (file: SupportedFileInput, { publicKey, fileName, fileSize, baseURL, secureSignature, secureExpire, authToken, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartChunkSize, maxConcurrentRequests, baseCDN, prefixedBaseCDN, metadata, tags }: MultipartOptions) => Promise; export declare class UploadcareGroup { readonly uuid: GroupId; readonly filesCount: string; readonly totalSize: number; readonly isStored: boolean; readonly isImage: boolean; readonly cdnUrl: string; readonly files: UploadcareFile[]; readonly createdAt: string; readonly storedAt: string | null; constructor(groupInfo: GroupInfo, { baseCDN }?: { baseCDN?: string; }); } export type GroupFromOptions = { jsonpCallback?: string; }; export declare function uploadFileGroup(data: SupportedFileInput[] | Url[] | Uuid[], { publicKey, fileName, baseURL, secureSignature, secureExpire, authToken, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartChunkSize, baseCDN, prefixedBaseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, jsonpCallback }: FileFromOptions & GroupFromOptions): Promise; export type IsReadyPoolOptions = { publicKey: string; baseURL?: string; authToken?: AuthToken; source?: string; integration?: string; userAgent?: CustomUserAgent; retryThrottledRequestMaxTimes?: number; retryNetworkErrorMaxTimes?: number; onProgress?: ProgressCallback; signal?: AbortSignal; }; export declare function isReadyPoll(uuid: Uuid, { publicKey, baseURL, authToken, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, signal, onProgress }: IsReadyPoolOptions): Promise; export declare class UploadClient { private settings; constructor(settings: Settings); updateSettings(newSettings: Settings): void; getSettings(): Settings; base(file: SupportedFileInput, options?: Partial): Promise; info(uuid: Uuid, options?: Partial): Promise; fromUrl(sourceUrl: Url, options?: Partial): Promise; fromUrlStatus(token: Token, options?: Partial): Promise; group(uuids: Uuid[], options?: Partial): Promise; groupInfo(id: GroupId, options?: Partial): Promise; multipartStart(size: number, options?: Partial): Promise; multipartUpload(part: Sliceable, url: MultipartPart, options?: Partial): Promise; multipartComplete(uuid: Uuid, options?: Partial): Promise; uploadFile(data: SupportedFileInput | Url | Uuid, options?: Partial): Promise; uploadFileGroup(data: SupportedFileInput[] | Url[] | Uuid[], options?: Partial): Promise; isReadyPoll(uuid: Uuid, options?: Partial): Promise; } export type Task = () => Promise; export declare class Queue { private _concurrency; private _pending; private _running; private _resolvers; private _rejectors; constructor(concurrency: number); /** Run tasks from the queue up to the concurrency limit */ run(): void; /** * Add a task to the queue * * If you want to add a lot of tasks at once, consider setting `autoRun` to * false and calling `run()` manually after adding all tasks to avoid multiple * redundant calls to `run()`. * * @param task The task to add * @param autoRun Whether to automatically run the queue after adding the task * (default: true) * @returns A promise that resolves or rejects with the task's result */ add(task: Task, { autoRun }?: { autoRun?: boolean; }): Promise; get pending(): number; get running(): number; set concurrency(value: number); get concurrency(): number; } type Headers$1 = { [key: string]: string | string[] | undefined; }; export type ErrorRequestInfo = { method?: string; url: string; query?: string; data?: NodeFormData | FormData | SupportedFileInput; headers?: Headers$1; }; export type ErrorResponseInfo = { error?: { statusCode: number; content: string; errorCode: ServerErrorCode; }; }; export declare class UploadError extends UploadcareError { readonly code?: ServerErrorCode; readonly request?: ErrorRequestInfo; readonly response?: ErrorResponseInfo; readonly headers?: Headers$1; constructor(message: string, code?: ServerErrorCode, request?: ErrorRequestInfo, response?: ErrorResponseInfo, headers?: Headers$1); } declare const AUTH_ERROR_CODES: readonly [ "AccessTokenExpiredError", "OperationsLimitExceededError", "ScopeForbiddenError", "AccessTokenInvalidError" ]; export type AuthErrorCode = (typeof AUTH_ERROR_CODES)[number]; /** * A JWT (Bearer token) auth failure reported by the Upload API. `code` always * holds the raw server error code: `AccessTokenExpiredError` is the only one * worth refreshing the token and retrying for; the rest are final. */ export declare class AuthError extends UploadError { readonly code: AuthErrorCode; constructor(message: string, code: AuthErrorCode, request?: ErrorRequestInfo, response?: ErrorResponseInfo, headers?: Headers$1); } /** * Your token function threw, rejected, or returned no token, so there is no * token to send. For unsigned requests, leave `authToken` unset instead. * * This is the one auth failure that never reaches the Upload API: nothing was * requested, and retrying is pointless because the source of the token is your * own code. The original failure is kept on `cause`. */ export declare class AuthTokenResolverError extends Error { constructor(cause: unknown); } export type NormalizedAuthToken = { getToken: AuthTokenResolver; invalidate?: () => void; }; /** * Whether `authToken` can produce a fresh token rather than being one already. * * Only a resolver can, so this is what decides whether retrying an auth failure * is worth anything. */ export declare const isAuthTokenResolver: (authToken: AuthToken | null | undefined) => authToken is AuthTokenResolver | AuthTokenProvider; /** * The provider form of a resolver, so callers need not care which of the two * shapes they were given. * * Both members are bound. `AuthTokenCache.invalidate` is a prototype method, so * calling it off a detached reference would throw on `this`. */ export declare const normalizeAuthToken: (authToken: AuthTokenResolver | AuthTokenProvider) => NormalizedAuthToken; /** * Collapses the `authToken` forms into the token itself, calling the resolver * when there is one. */ export declare const resolveAuthToken: (authToken: AuthToken | undefined) => Promise; /** @deprecated Please use NetworkError instead. */ export declare const UploadcareNetworkError: typeof NetworkError; /** @deprecated Please use UploadError instead. */ export declare const UploadClientError: typeof UploadError; export { Headers$1 as Headers, }; export {};