@uploadcare/upload-client 6.4.1 → 6.5.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.cjs +1679 -0
- package/dist/cjs/index.browser.d.cts +501 -0
- package/dist/cjs/index.node.cjs +1708 -0
- package/dist/cjs/index.node.d.cts +501 -0
- package/dist/cjs/index.react-native.cjs +1707 -0
- package/dist/cjs/index.react-native.d.cts +501 -0
- package/dist/esm/index.browser.d.mts +501 -0
- package/dist/{index.browser.js → esm/index.browser.mjs} +42 -26
- package/dist/esm/index.node.d.mts +501 -0
- package/dist/{index.node.js → esm/index.node.mjs} +49 -30
- package/dist/esm/index.react-native.d.mts +501 -0
- package/dist/{index.react-native.js → esm/index.react-native.mjs} +42 -26
- package/dist/index.d.ts +58 -58
- package/package.json +26 -14
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v6.12.0
|
|
2
|
+
|
|
3
|
+
import NodeFormData from 'form-data';
|
|
4
|
+
|
|
5
|
+
export type CustomUserAgentOptions = {
|
|
6
|
+
publicKey: string;
|
|
7
|
+
libraryName: string;
|
|
8
|
+
libraryVersion: string;
|
|
9
|
+
languageName: string;
|
|
10
|
+
integration?: string;
|
|
11
|
+
};
|
|
12
|
+
export type CustomUserAgentFn = (options: CustomUserAgentOptions) => string;
|
|
13
|
+
export type CustomUserAgent = string | CustomUserAgentFn;
|
|
14
|
+
export type GetUserAgentOptions = {
|
|
15
|
+
libraryName: string;
|
|
16
|
+
libraryVersion: string;
|
|
17
|
+
publicKey?: string;
|
|
18
|
+
integration?: string;
|
|
19
|
+
userAgent?: CustomUserAgent | null;
|
|
20
|
+
};
|
|
21
|
+
export declare function getUserAgent({ libraryName, libraryVersion, userAgent, publicKey, integration }: GetUserAgentOptions): string;
|
|
22
|
+
export declare class UploadcareNetworkError extends Error {
|
|
23
|
+
originalProgressEvent: ProgressEvent;
|
|
24
|
+
constructor(progressEvent: ProgressEvent);
|
|
25
|
+
}
|
|
26
|
+
export type GeoLocation = {
|
|
27
|
+
latitude: number;
|
|
28
|
+
longitude: number;
|
|
29
|
+
};
|
|
30
|
+
export type ImageInfo = {
|
|
31
|
+
height: number;
|
|
32
|
+
width: number;
|
|
33
|
+
geoLocation: GeoLocation | null;
|
|
34
|
+
datetimeOriginal: string;
|
|
35
|
+
format: string;
|
|
36
|
+
colorMode: string;
|
|
37
|
+
dpi: {
|
|
38
|
+
"0": number;
|
|
39
|
+
"1": number;
|
|
40
|
+
} | null;
|
|
41
|
+
orientation: number | null;
|
|
42
|
+
sequence: boolean | null;
|
|
43
|
+
};
|
|
44
|
+
export type AudioInfo = {
|
|
45
|
+
bitrate: number | null;
|
|
46
|
+
codec: string | null;
|
|
47
|
+
sampleRate: number | null;
|
|
48
|
+
channels: string | null;
|
|
49
|
+
};
|
|
50
|
+
export type VideoInfo = {
|
|
51
|
+
duration: number;
|
|
52
|
+
format: string;
|
|
53
|
+
bitrate: number;
|
|
54
|
+
audio: AudioInfo | null;
|
|
55
|
+
video: {
|
|
56
|
+
height: number;
|
|
57
|
+
width: number;
|
|
58
|
+
frameRate: number;
|
|
59
|
+
bitrate: number;
|
|
60
|
+
codec: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export type MimeInfo = {
|
|
64
|
+
mime: string;
|
|
65
|
+
type: string;
|
|
66
|
+
subtype: string;
|
|
67
|
+
};
|
|
68
|
+
export type ContentInfo = {
|
|
69
|
+
mime?: MimeInfo;
|
|
70
|
+
image?: ImageInfo;
|
|
71
|
+
video?: VideoInfo;
|
|
72
|
+
};
|
|
73
|
+
export type Metadata = Record<string, string>;
|
|
74
|
+
export type StoreValue = "auto" | boolean;
|
|
75
|
+
export interface DefaultSettings {
|
|
76
|
+
baseCDN: string;
|
|
77
|
+
baseURL: string;
|
|
78
|
+
maxContentLength: number;
|
|
79
|
+
retryThrottledRequestMaxTimes: number;
|
|
80
|
+
retryNetworkErrorMaxTimes: number;
|
|
81
|
+
multipartMinFileSize: number;
|
|
82
|
+
multipartChunkSize: number;
|
|
83
|
+
multipartMinLastPartSize: number;
|
|
84
|
+
maxConcurrentRequests: number;
|
|
85
|
+
pollingTimeoutMilliseconds: number;
|
|
86
|
+
pusherKey: string;
|
|
87
|
+
}
|
|
88
|
+
export interface Settings extends Partial<DefaultSettings> {
|
|
89
|
+
publicKey: string;
|
|
90
|
+
fileName?: string;
|
|
91
|
+
contentType?: string;
|
|
92
|
+
store?: StoreValue;
|
|
93
|
+
secureSignature?: string;
|
|
94
|
+
secureExpire?: string;
|
|
95
|
+
integration?: string;
|
|
96
|
+
userAgent?: CustomUserAgent;
|
|
97
|
+
checkForUrlDuplicates?: boolean;
|
|
98
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
99
|
+
source?: string;
|
|
100
|
+
jsonpCallback?: string;
|
|
101
|
+
}
|
|
102
|
+
export type BrowserFile = Blob | File;
|
|
103
|
+
export type NodeFile = Buffer;
|
|
104
|
+
export type ReactNativeAsset = {
|
|
105
|
+
type: string;
|
|
106
|
+
uri: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
};
|
|
109
|
+
export type SupportedFileInput = BrowserFile | NodeFile | ReactNativeAsset;
|
|
110
|
+
export type Sliceable = BrowserFile | NodeFile;
|
|
111
|
+
export type FileInfo = {
|
|
112
|
+
size: number;
|
|
113
|
+
done: number;
|
|
114
|
+
total: number;
|
|
115
|
+
uuid: Uuid;
|
|
116
|
+
fileId: Uuid;
|
|
117
|
+
originalFilename: string;
|
|
118
|
+
filename: string;
|
|
119
|
+
mimeType: string;
|
|
120
|
+
isImage: boolean;
|
|
121
|
+
isStored: boolean;
|
|
122
|
+
isReady: string;
|
|
123
|
+
imageInfo: ImageInfo | null;
|
|
124
|
+
videoInfo: VideoInfo | null;
|
|
125
|
+
contentInfo: ContentInfo | null;
|
|
126
|
+
s3Bucket?: string;
|
|
127
|
+
metadata?: Metadata;
|
|
128
|
+
};
|
|
129
|
+
export type GroupInfo = {
|
|
130
|
+
datetimeCreated: string;
|
|
131
|
+
datetimeStored: string | null;
|
|
132
|
+
filesCount: string;
|
|
133
|
+
cdnUrl: string;
|
|
134
|
+
files: FileInfo[];
|
|
135
|
+
url: string;
|
|
136
|
+
id: GroupId;
|
|
137
|
+
};
|
|
138
|
+
export type Token = string;
|
|
139
|
+
export type Uuid = string;
|
|
140
|
+
export type GroupId = string;
|
|
141
|
+
export type Url = string;
|
|
142
|
+
export type ComputableProgressInfo = {
|
|
143
|
+
isComputable: true;
|
|
144
|
+
value: number;
|
|
145
|
+
};
|
|
146
|
+
export type UnknownProgressInfo = {
|
|
147
|
+
isComputable: false;
|
|
148
|
+
};
|
|
149
|
+
export type ProgressCallback<T = ComputableProgressInfo | UnknownProgressInfo> = (arg: T) => void;
|
|
150
|
+
export type BaseResponse = {
|
|
151
|
+
file: Uuid;
|
|
152
|
+
};
|
|
153
|
+
export type BaseOptions = {
|
|
154
|
+
publicKey: string;
|
|
155
|
+
fileName?: string;
|
|
156
|
+
baseURL?: string;
|
|
157
|
+
secureSignature?: string;
|
|
158
|
+
secureExpire?: string;
|
|
159
|
+
store?: StoreValue;
|
|
160
|
+
contentType?: string;
|
|
161
|
+
signal?: AbortSignal;
|
|
162
|
+
onProgress?: ProgressCallback;
|
|
163
|
+
source?: string;
|
|
164
|
+
integration?: string;
|
|
165
|
+
userAgent?: CustomUserAgent;
|
|
166
|
+
retryThrottledRequestMaxTimes?: number;
|
|
167
|
+
retryNetworkErrorMaxTimes?: number;
|
|
168
|
+
metadata?: Metadata;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Performs file uploading request to Uploadcare Upload API. Can be canceled and
|
|
172
|
+
* has progress.
|
|
173
|
+
*/
|
|
174
|
+
export function base(file: SupportedFileInput, { publicKey, fileName, contentType, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata }: BaseOptions): Promise<BaseResponse>;
|
|
175
|
+
export declare enum TypeEnum {
|
|
176
|
+
Token = "token",
|
|
177
|
+
FileInfo = "file_info"
|
|
178
|
+
}
|
|
179
|
+
export type TokenResponse = {
|
|
180
|
+
type: TypeEnum.Token;
|
|
181
|
+
token: string;
|
|
182
|
+
};
|
|
183
|
+
export type FileInfoResponse = {
|
|
184
|
+
type: TypeEnum.FileInfo;
|
|
185
|
+
} & FileInfo;
|
|
186
|
+
export type FromUrlSuccessResponse = FileInfoResponse | TokenResponse;
|
|
187
|
+
export type FromUrlResponse = FromUrlSuccessResponse;
|
|
188
|
+
export type FromUrlOptions = {
|
|
189
|
+
publicKey: string;
|
|
190
|
+
baseURL?: string;
|
|
191
|
+
store?: StoreValue;
|
|
192
|
+
fileName?: string;
|
|
193
|
+
checkForUrlDuplicates?: boolean;
|
|
194
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
195
|
+
secureSignature?: string;
|
|
196
|
+
secureExpire?: string;
|
|
197
|
+
signal?: AbortSignal;
|
|
198
|
+
source?: string;
|
|
199
|
+
integration?: string;
|
|
200
|
+
userAgent?: CustomUserAgent;
|
|
201
|
+
retryThrottledRequestMaxTimes?: number;
|
|
202
|
+
retryNetworkErrorMaxTimes?: number;
|
|
203
|
+
metadata?: Metadata;
|
|
204
|
+
};
|
|
205
|
+
/** Uploading files from URL. */
|
|
206
|
+
export function fromUrl(sourceUrl: Url, { publicKey, baseURL, store, fileName, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, source, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata }: FromUrlOptions): Promise<FromUrlSuccessResponse>;
|
|
207
|
+
export declare enum Status {
|
|
208
|
+
Unknown = "unknown",
|
|
209
|
+
Waiting = "waiting",
|
|
210
|
+
Progress = "progress",
|
|
211
|
+
Error = "error",
|
|
212
|
+
Success = "success"
|
|
213
|
+
}
|
|
214
|
+
export type StatusUnknownResponse = {
|
|
215
|
+
status: Status.Unknown;
|
|
216
|
+
};
|
|
217
|
+
export type StatusWaitingResponse = {
|
|
218
|
+
status: Status.Waiting;
|
|
219
|
+
};
|
|
220
|
+
export type StatusProgressResponse = {
|
|
221
|
+
status: Status.Progress;
|
|
222
|
+
size: number;
|
|
223
|
+
done: number;
|
|
224
|
+
total: number | "unknown";
|
|
225
|
+
};
|
|
226
|
+
export type StatusErrorResponse = {
|
|
227
|
+
status: Status.Error;
|
|
228
|
+
error: string;
|
|
229
|
+
errorCode: string;
|
|
230
|
+
};
|
|
231
|
+
export type StatusSuccessResponse = {
|
|
232
|
+
status: Status.Success;
|
|
233
|
+
} & FileInfo;
|
|
234
|
+
export type FromUrlStatusResponse = StatusUnknownResponse | StatusWaitingResponse | StatusProgressResponse | StatusErrorResponse | StatusSuccessResponse;
|
|
235
|
+
export type FromUrlStatusOptions = {
|
|
236
|
+
publicKey?: string;
|
|
237
|
+
baseURL?: string;
|
|
238
|
+
signal?: AbortSignal;
|
|
239
|
+
integration?: string;
|
|
240
|
+
userAgent?: CustomUserAgent;
|
|
241
|
+
retryThrottledRequestMaxTimes?: number;
|
|
242
|
+
retryNetworkErrorMaxTimes?: number;
|
|
243
|
+
};
|
|
244
|
+
/** Checking upload status and working with file tokens. */
|
|
245
|
+
export function fromUrlStatus(token: Token, { publicKey, baseURL, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }?: FromUrlStatusOptions): Promise<FromUrlStatusResponse>;
|
|
246
|
+
export type GroupOptions = {
|
|
247
|
+
publicKey: string;
|
|
248
|
+
baseURL?: string;
|
|
249
|
+
jsonpCallback?: string;
|
|
250
|
+
secureSignature?: string;
|
|
251
|
+
secureExpire?: string;
|
|
252
|
+
signal?: AbortSignal;
|
|
253
|
+
source?: string;
|
|
254
|
+
integration?: string;
|
|
255
|
+
userAgent?: CustomUserAgent;
|
|
256
|
+
retryThrottledRequestMaxTimes?: number;
|
|
257
|
+
retryNetworkErrorMaxTimes?: number;
|
|
258
|
+
};
|
|
259
|
+
/** Create files group. */
|
|
260
|
+
export function group(uuids: Uuid[], { publicKey, baseURL, jsonpCallback, secureSignature, secureExpire, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: GroupOptions): Promise<GroupInfo>;
|
|
261
|
+
export type GroupInfoOptions = {
|
|
262
|
+
publicKey: string;
|
|
263
|
+
baseURL?: string;
|
|
264
|
+
signal?: AbortSignal;
|
|
265
|
+
source?: string;
|
|
266
|
+
integration?: string;
|
|
267
|
+
userAgent?: CustomUserAgent;
|
|
268
|
+
retryThrottledRequestMaxTimes?: number;
|
|
269
|
+
retryNetworkErrorMaxTimes?: number;
|
|
270
|
+
};
|
|
271
|
+
/** Get info about group. */
|
|
272
|
+
export function groupInfo(id: GroupId, { publicKey, baseURL, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: GroupInfoOptions): Promise<GroupInfo>;
|
|
273
|
+
export type InfoOptions = {
|
|
274
|
+
publicKey: string;
|
|
275
|
+
baseURL?: string;
|
|
276
|
+
signal?: AbortSignal;
|
|
277
|
+
source?: string;
|
|
278
|
+
integration?: string;
|
|
279
|
+
userAgent?: CustomUserAgent;
|
|
280
|
+
retryThrottledRequestMaxTimes?: number;
|
|
281
|
+
retryNetworkErrorMaxTimes?: number;
|
|
282
|
+
};
|
|
283
|
+
/** Returns a JSON dictionary holding file info. */
|
|
284
|
+
export function info(uuid: Uuid, { publicKey, baseURL, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: InfoOptions): Promise<FileInfo>;
|
|
285
|
+
export type MultipartStartOptions = {
|
|
286
|
+
publicKey: string;
|
|
287
|
+
contentType?: string;
|
|
288
|
+
fileName?: string;
|
|
289
|
+
baseURL?: string;
|
|
290
|
+
secureSignature?: string;
|
|
291
|
+
secureExpire?: string;
|
|
292
|
+
store?: StoreValue;
|
|
293
|
+
multipartChunkSize?: number;
|
|
294
|
+
signal?: AbortSignal;
|
|
295
|
+
source?: string;
|
|
296
|
+
integration?: string;
|
|
297
|
+
userAgent?: CustomUserAgent;
|
|
298
|
+
retryThrottledRequestMaxTimes?: number;
|
|
299
|
+
retryNetworkErrorMaxTimes?: number;
|
|
300
|
+
metadata?: Metadata;
|
|
301
|
+
};
|
|
302
|
+
export type MultipartPart = string;
|
|
303
|
+
export type MultipartStartResponse = {
|
|
304
|
+
parts: MultipartPart[];
|
|
305
|
+
uuid: Uuid;
|
|
306
|
+
};
|
|
307
|
+
/** Start multipart uploading. */
|
|
308
|
+
export function multipartStart(size: number, { publicKey, contentType, fileName, multipartChunkSize, baseURL, secureSignature, secureExpire, store, signal, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, metadata }: MultipartStartOptions): Promise<MultipartStartResponse>;
|
|
309
|
+
export type MultipartUploadOptions = {
|
|
310
|
+
publicKey?: string;
|
|
311
|
+
contentType?: string;
|
|
312
|
+
signal?: AbortSignal;
|
|
313
|
+
onProgress?: ProgressCallback<ComputableProgressInfo>;
|
|
314
|
+
integration?: string;
|
|
315
|
+
retryThrottledRequestMaxTimes?: number;
|
|
316
|
+
retryNetworkErrorMaxTimes?: number;
|
|
317
|
+
};
|
|
318
|
+
export type MultipartUploadResponse = {
|
|
319
|
+
code?: number;
|
|
320
|
+
};
|
|
321
|
+
/** Complete multipart uploading. */
|
|
322
|
+
export function multipartUpload(part: SupportedFileInput, url: MultipartPart, { contentType, signal, onProgress, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: MultipartUploadOptions): Promise<MultipartUploadResponse>;
|
|
323
|
+
export type MultipartCompleteOptions = {
|
|
324
|
+
publicKey: string;
|
|
325
|
+
baseURL?: string;
|
|
326
|
+
signal?: AbortSignal;
|
|
327
|
+
source?: string;
|
|
328
|
+
integration?: string;
|
|
329
|
+
userAgent?: CustomUserAgent;
|
|
330
|
+
retryThrottledRequestMaxTimes?: number;
|
|
331
|
+
retryNetworkErrorMaxTimes?: number;
|
|
332
|
+
};
|
|
333
|
+
/** Complete multipart uploading. */
|
|
334
|
+
export function multipartComplete(uuid: Uuid, { publicKey, baseURL, source, signal, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes }: MultipartCompleteOptions): Promise<FileInfo>;
|
|
335
|
+
export declare class UploadcareFile {
|
|
336
|
+
readonly uuid: Uuid;
|
|
337
|
+
readonly name: null | string;
|
|
338
|
+
readonly size: null | number;
|
|
339
|
+
readonly isStored: null | boolean;
|
|
340
|
+
readonly isImage: null | boolean;
|
|
341
|
+
readonly mimeType: null | string;
|
|
342
|
+
readonly cdnUrl: null | string;
|
|
343
|
+
readonly s3Url: null | string;
|
|
344
|
+
readonly originalFilename: null | string;
|
|
345
|
+
readonly imageInfo: null | ImageInfo;
|
|
346
|
+
readonly videoInfo: null | VideoInfo;
|
|
347
|
+
readonly contentInfo: null | ContentInfo;
|
|
348
|
+
readonly metadata: null | Metadata;
|
|
349
|
+
readonly s3Bucket: null | string;
|
|
350
|
+
constructor(fileInfo: FileInfo, { baseCDN, fileName }?: {
|
|
351
|
+
baseCDN?: string;
|
|
352
|
+
fileName?: string;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
export type FileFromOptions = {
|
|
356
|
+
publicKey: string;
|
|
357
|
+
fileName?: string;
|
|
358
|
+
baseURL?: string;
|
|
359
|
+
secureSignature?: string;
|
|
360
|
+
secureExpire?: string;
|
|
361
|
+
store?: StoreValue;
|
|
362
|
+
signal?: AbortSignal;
|
|
363
|
+
onProgress?: ProgressCallback;
|
|
364
|
+
source?: string;
|
|
365
|
+
integration?: string;
|
|
366
|
+
userAgent?: CustomUserAgent;
|
|
367
|
+
retryThrottledRequestMaxTimes?: number;
|
|
368
|
+
retryNetworkErrorMaxTimes?: number;
|
|
369
|
+
contentType?: string;
|
|
370
|
+
multipartMinFileSize?: number;
|
|
371
|
+
multipartChunkSize?: number;
|
|
372
|
+
maxConcurrentRequests?: number;
|
|
373
|
+
baseCDN?: string;
|
|
374
|
+
checkForUrlDuplicates?: boolean;
|
|
375
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
376
|
+
pusherKey?: string;
|
|
377
|
+
metadata?: Metadata;
|
|
378
|
+
};
|
|
379
|
+
/** Uploads file from provided data. */
|
|
380
|
+
export declare function uploadFile(data: SupportedFileInput | Url | Uuid, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartMinFileSize, multipartChunkSize, maxConcurrentRequests, baseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, pusherKey, metadata }: FileFromOptions): Promise<UploadcareFile>;
|
|
381
|
+
export type DirectOptions = {
|
|
382
|
+
publicKey: string;
|
|
383
|
+
fileName?: string;
|
|
384
|
+
baseURL?: string;
|
|
385
|
+
secureSignature?: string;
|
|
386
|
+
secureExpire?: string;
|
|
387
|
+
store?: StoreValue;
|
|
388
|
+
contentType?: string;
|
|
389
|
+
signal?: AbortSignal;
|
|
390
|
+
onProgress?: ProgressCallback;
|
|
391
|
+
source?: string;
|
|
392
|
+
integration?: string;
|
|
393
|
+
userAgent?: CustomUserAgent;
|
|
394
|
+
retryThrottledRequestMaxTimes?: number;
|
|
395
|
+
retryNetworkErrorMaxTimes?: number;
|
|
396
|
+
baseCDN?: string;
|
|
397
|
+
metadata?: Metadata;
|
|
398
|
+
};
|
|
399
|
+
export declare const uploadDirect: (file: SupportedFileInput, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, contentType, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, baseCDN, metadata }: DirectOptions) => Promise<UploadcareFile>;
|
|
400
|
+
export type FromUploadedOptions = {
|
|
401
|
+
publicKey: string;
|
|
402
|
+
fileName?: string;
|
|
403
|
+
baseURL?: string;
|
|
404
|
+
signal?: AbortSignal;
|
|
405
|
+
onProgress?: ProgressCallback;
|
|
406
|
+
source?: string;
|
|
407
|
+
integration?: string;
|
|
408
|
+
userAgent?: CustomUserAgent;
|
|
409
|
+
retryThrottledRequestMaxTimes?: number;
|
|
410
|
+
retryNetworkErrorMaxTimes?: number;
|
|
411
|
+
baseCDN?: string;
|
|
412
|
+
};
|
|
413
|
+
export declare const uploadFromUploaded: (uuid: Uuid, { publicKey, fileName, baseURL, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, baseCDN }: FromUploadedOptions) => Promise<UploadcareFile>;
|
|
414
|
+
export type UploadFromUrlOptions = {
|
|
415
|
+
baseCDN?: string;
|
|
416
|
+
onProgress?: ProgressCallback;
|
|
417
|
+
pusherKey?: string;
|
|
418
|
+
} & FromUrlOptions;
|
|
419
|
+
export declare const uploadFromUrl: (sourceUrl: string, { publicKey, fileName, baseURL, baseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, pusherKey, metadata }: UploadFromUrlOptions) => Promise<UploadcareFile>;
|
|
420
|
+
export type MultipartOptions = {
|
|
421
|
+
publicKey: string;
|
|
422
|
+
contentType?: string;
|
|
423
|
+
multipartChunkSize?: number;
|
|
424
|
+
fileName?: string;
|
|
425
|
+
fileSize?: number;
|
|
426
|
+
baseURL?: string;
|
|
427
|
+
secureSignature?: string;
|
|
428
|
+
secureExpire?: string;
|
|
429
|
+
store?: StoreValue;
|
|
430
|
+
signal?: AbortSignal;
|
|
431
|
+
onProgress?: ProgressCallback<ComputableProgressInfo>;
|
|
432
|
+
source?: string;
|
|
433
|
+
integration?: string;
|
|
434
|
+
userAgent?: CustomUserAgent;
|
|
435
|
+
retryThrottledRequestMaxTimes?: number;
|
|
436
|
+
retryNetworkErrorMaxTimes?: number;
|
|
437
|
+
maxConcurrentRequests?: number;
|
|
438
|
+
baseCDN?: string;
|
|
439
|
+
metadata?: Metadata;
|
|
440
|
+
};
|
|
441
|
+
export declare const uploadMultipart: (file: SupportedFileInput, { publicKey, fileName, fileSize, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartChunkSize, maxConcurrentRequests, baseCDN, metadata }: MultipartOptions) => Promise<UploadcareFile>;
|
|
442
|
+
export declare class UploadcareGroup {
|
|
443
|
+
readonly uuid: GroupId;
|
|
444
|
+
readonly filesCount: string;
|
|
445
|
+
readonly totalSize: number;
|
|
446
|
+
readonly isStored: boolean;
|
|
447
|
+
readonly isImage: boolean;
|
|
448
|
+
readonly cdnUrl: string;
|
|
449
|
+
readonly files: UploadcareFile[];
|
|
450
|
+
readonly createdAt: string;
|
|
451
|
+
readonly storedAt: string | null;
|
|
452
|
+
constructor(groupInfo: GroupInfo, files: UploadcareFile[]);
|
|
453
|
+
}
|
|
454
|
+
export type GroupFromOptions = {
|
|
455
|
+
jsonpCallback?: string;
|
|
456
|
+
};
|
|
457
|
+
export declare function uploadFileGroup(data: SupportedFileInput[] | Url[] | Uuid[], { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes, contentType, multipartChunkSize, baseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, jsonpCallback }: FileFromOptions & GroupFromOptions): Promise<UploadcareGroup>;
|
|
458
|
+
export declare class UploadClient {
|
|
459
|
+
private settings;
|
|
460
|
+
constructor(settings: Settings);
|
|
461
|
+
updateSettings(newSettings: Settings): void;
|
|
462
|
+
getSettings(): Settings;
|
|
463
|
+
base(file: SupportedFileInput, options?: Partial<BaseOptions>): Promise<BaseResponse>;
|
|
464
|
+
info(uuid: Uuid, options?: Partial<InfoOptions>): Promise<FileInfo>;
|
|
465
|
+
fromUrl(sourceUrl: Url, options?: Partial<FromUrlOptions>): Promise<FromUrlResponse>;
|
|
466
|
+
fromUrlStatus(token: Token, options?: Partial<FromUrlStatusOptions>): Promise<FromUrlStatusResponse>;
|
|
467
|
+
group(uuids: Uuid[], options?: Partial<GroupOptions>): Promise<GroupInfo>;
|
|
468
|
+
groupInfo(id: GroupId, options?: Partial<GroupInfoOptions>): Promise<GroupInfo>;
|
|
469
|
+
multipartStart(size: number, options?: Partial<MultipartStartOptions>): Promise<MultipartStartResponse>;
|
|
470
|
+
multipartUpload(part: Sliceable, url: MultipartPart, options?: Partial<MultipartUploadOptions>): Promise<MultipartUploadResponse>;
|
|
471
|
+
multipartComplete(uuid: Uuid, options?: Partial<MultipartCompleteOptions>): Promise<FileInfo>;
|
|
472
|
+
uploadFile(data: SupportedFileInput | Url | Uuid, options?: Partial<FileFromOptions>): Promise<UploadcareFile>;
|
|
473
|
+
uploadFileGroup(data: SupportedFileInput[] | Url[] | Uuid[], options?: Partial<FileFromOptions & GroupFromOptions>): Promise<UploadcareGroup>;
|
|
474
|
+
}
|
|
475
|
+
export type Headers = {
|
|
476
|
+
[key: string]: string | string[] | undefined;
|
|
477
|
+
};
|
|
478
|
+
export type ErrorRequestInfo = {
|
|
479
|
+
method?: string;
|
|
480
|
+
url: string;
|
|
481
|
+
query?: string;
|
|
482
|
+
data?: NodeFormData | FormData | SupportedFileInput;
|
|
483
|
+
headers?: Headers;
|
|
484
|
+
};
|
|
485
|
+
export type ErrorResponseInfo = {
|
|
486
|
+
error?: {
|
|
487
|
+
statusCode: number;
|
|
488
|
+
content: string;
|
|
489
|
+
errorCode: string;
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
export declare class UploadClientError extends Error {
|
|
493
|
+
isCancel?: boolean;
|
|
494
|
+
readonly code?: string;
|
|
495
|
+
readonly request?: ErrorRequestInfo;
|
|
496
|
+
readonly response?: ErrorResponseInfo;
|
|
497
|
+
readonly headers?: Headers;
|
|
498
|
+
constructor(message: string, code?: string, request?: ErrorRequestInfo, response?: ErrorResponseInfo, headers?: Headers);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export {};
|