@uploadcare/upload-client 2.0.0-alpha.7 → 2.1.0
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/README.md +35 -10
- package/dist/index.browser.cjs +134 -73
- package/dist/index.browser.js +174 -119
- package/dist/index.cjs +147 -83
- package/dist/index.js +182 -127
- package/dist/types.d.ts +125 -40
- package/package.json +32 -26
- package/CHANGELOG.md +0 -243
package/dist/types.d.ts
CHANGED
|
@@ -71,6 +71,42 @@ export declare type Url = string;
|
|
|
71
71
|
export declare type ProgressCallback = (arg: {
|
|
72
72
|
value: number;
|
|
73
73
|
}) => void;
|
|
74
|
+
export interface DefaultSettings {
|
|
75
|
+
baseCDN: string;
|
|
76
|
+
baseURL: string;
|
|
77
|
+
maxContentLength: number;
|
|
78
|
+
retryThrottledRequestMaxTimes: number;
|
|
79
|
+
multipartMinFileSize: number;
|
|
80
|
+
multipartChunkSize: number;
|
|
81
|
+
multipartMinLastPartSize: number;
|
|
82
|
+
maxConcurrentRequests: number;
|
|
83
|
+
multipartMaxAttempts: number;
|
|
84
|
+
pollingTimeoutMilliseconds: number;
|
|
85
|
+
pusherKey: string;
|
|
86
|
+
}
|
|
87
|
+
export interface Settings extends Partial<DefaultSettings> {
|
|
88
|
+
publicKey: string;
|
|
89
|
+
fileName?: string;
|
|
90
|
+
contentType?: string;
|
|
91
|
+
store?: boolean;
|
|
92
|
+
secureSignature?: string;
|
|
93
|
+
secureExpire?: string;
|
|
94
|
+
integration?: string;
|
|
95
|
+
userAgent?: CustomUserAgent;
|
|
96
|
+
checkForUrlDuplicates?: boolean;
|
|
97
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
98
|
+
source?: string;
|
|
99
|
+
jsonpCallback?: string;
|
|
100
|
+
}
|
|
101
|
+
export declare type CustomUserAgentOptions = {
|
|
102
|
+
publicKey: string;
|
|
103
|
+
libraryName: string;
|
|
104
|
+
libraryVersion: string;
|
|
105
|
+
languageName: string;
|
|
106
|
+
integration?: string;
|
|
107
|
+
};
|
|
108
|
+
export declare type CustomUserAgentFn = (options: CustomUserAgentOptions) => string;
|
|
109
|
+
export declare type CustomUserAgent = string | CustomUserAgentFn;
|
|
74
110
|
export declare type BrowserFile = Blob | File;
|
|
75
111
|
export declare type NodeFile = Buffer;
|
|
76
112
|
export declare type BaseResponse = {
|
|
@@ -87,9 +123,10 @@ export declare type BaseOptions = {
|
|
|
87
123
|
onProgress?: ProgressCallback;
|
|
88
124
|
source?: string;
|
|
89
125
|
integration?: string;
|
|
126
|
+
userAgent?: CustomUserAgent;
|
|
90
127
|
retryThrottledRequestMaxTimes?: number;
|
|
91
128
|
};
|
|
92
|
-
declare function base(file: NodeFile | BrowserFile, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, retryThrottledRequestMaxTimes }: BaseOptions): Promise<BaseResponse>;
|
|
129
|
+
declare function base(file: NodeFile | BrowserFile, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes }: BaseOptions): Promise<BaseResponse>;
|
|
93
130
|
declare enum TypeEnum {
|
|
94
131
|
Token = "token",
|
|
95
132
|
FileInfo = "file_info"
|
|
@@ -115,9 +152,10 @@ export declare type FromUrlOptions = {
|
|
|
115
152
|
signal?: AbortSignal;
|
|
116
153
|
source?: string;
|
|
117
154
|
integration?: string;
|
|
155
|
+
userAgent?: CustomUserAgent;
|
|
118
156
|
retryThrottledRequestMaxTimes?: number;
|
|
119
157
|
};
|
|
120
|
-
declare function fromUrl(sourceUrl: Url, { publicKey, baseURL, store, fileName, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, source, signal, integration, retryThrottledRequestMaxTimes }: FromUrlOptions): Promise<FromUrlSuccessResponse>;
|
|
158
|
+
declare function fromUrl(sourceUrl: Url, { publicKey, baseURL, store, fileName, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, source, signal, integration, userAgent, retryThrottledRequestMaxTimes }: FromUrlOptions): Promise<FromUrlSuccessResponse>;
|
|
121
159
|
declare enum Status {
|
|
122
160
|
Unknown = "unknown",
|
|
123
161
|
Waiting = "waiting",
|
|
@@ -140,6 +178,7 @@ export declare type StatusProgressResponse = {
|
|
|
140
178
|
export declare type StatusErrorResponse = {
|
|
141
179
|
status: Status.Error;
|
|
142
180
|
error: string;
|
|
181
|
+
errorCode: string;
|
|
143
182
|
};
|
|
144
183
|
export declare type StatusSuccessResponse = {
|
|
145
184
|
status: Status.Success;
|
|
@@ -150,9 +189,10 @@ export declare type FromUrlStatusOptions = {
|
|
|
150
189
|
baseURL?: string;
|
|
151
190
|
signal?: AbortSignal;
|
|
152
191
|
integration?: string;
|
|
192
|
+
userAgent?: CustomUserAgent;
|
|
153
193
|
retryThrottledRequestMaxTimes?: number;
|
|
154
194
|
};
|
|
155
|
-
declare function fromUrlStatus(token: Token, { publicKey, baseURL, signal, integration, retryThrottledRequestMaxTimes }?: FromUrlStatusOptions): Promise<FromUrlStatusResponse>;
|
|
195
|
+
declare function fromUrlStatus(token: Token, { publicKey, baseURL, signal, integration, userAgent, retryThrottledRequestMaxTimes }?: FromUrlStatusOptions): Promise<FromUrlStatusResponse>;
|
|
156
196
|
export declare type GroupOptions = {
|
|
157
197
|
publicKey: string;
|
|
158
198
|
baseURL?: string;
|
|
@@ -162,27 +202,30 @@ export declare type GroupOptions = {
|
|
|
162
202
|
signal?: AbortSignal;
|
|
163
203
|
source?: string;
|
|
164
204
|
integration?: string;
|
|
205
|
+
userAgent?: CustomUserAgent;
|
|
165
206
|
retryThrottledRequestMaxTimes?: number;
|
|
166
207
|
};
|
|
167
|
-
declare function group(uuids: Uuid[], { publicKey, baseURL, jsonpCallback, secureSignature, secureExpire, signal, source, integration, retryThrottledRequestMaxTimes }: GroupOptions): Promise<GroupInfo>;
|
|
208
|
+
declare function group(uuids: Uuid[], { publicKey, baseURL, jsonpCallback, secureSignature, secureExpire, signal, source, integration, userAgent, retryThrottledRequestMaxTimes }: GroupOptions): Promise<GroupInfo>;
|
|
168
209
|
export declare type GroupInfoOptions = {
|
|
169
210
|
publicKey: string;
|
|
170
211
|
baseURL?: string;
|
|
171
212
|
signal?: AbortSignal;
|
|
172
213
|
source?: string;
|
|
173
214
|
integration?: string;
|
|
215
|
+
userAgent?: CustomUserAgent;
|
|
174
216
|
retryThrottledRequestMaxTimes?: number;
|
|
175
217
|
};
|
|
176
|
-
declare function groupInfo(id: GroupId, { publicKey, baseURL, signal, source, integration, retryThrottledRequestMaxTimes }: GroupInfoOptions): Promise<GroupInfo>;
|
|
218
|
+
declare function groupInfo(id: GroupId, { publicKey, baseURL, signal, source, integration, userAgent, retryThrottledRequestMaxTimes }: GroupInfoOptions): Promise<GroupInfo>;
|
|
177
219
|
export declare type InfoOptions = {
|
|
178
220
|
publicKey: string;
|
|
179
221
|
baseURL?: string;
|
|
180
222
|
signal?: AbortSignal;
|
|
181
223
|
source?: string;
|
|
182
224
|
integration?: string;
|
|
225
|
+
userAgent?: CustomUserAgent;
|
|
183
226
|
retryThrottledRequestMaxTimes?: number;
|
|
184
227
|
};
|
|
185
|
-
declare function info(uuid: Uuid, { publicKey, baseURL, signal, source, integration, retryThrottledRequestMaxTimes }: InfoOptions): Promise<FileInfo>;
|
|
228
|
+
declare function info(uuid: Uuid, { publicKey, baseURL, signal, source, integration, userAgent, retryThrottledRequestMaxTimes }: InfoOptions): Promise<FileInfo>;
|
|
186
229
|
export declare type MultipartStartOptions = {
|
|
187
230
|
publicKey: string;
|
|
188
231
|
contentType?: string;
|
|
@@ -195,6 +238,7 @@ export declare type MultipartStartOptions = {
|
|
|
195
238
|
signal?: AbortSignal;
|
|
196
239
|
source?: string;
|
|
197
240
|
integration?: string;
|
|
241
|
+
userAgent?: CustomUserAgent;
|
|
198
242
|
retryThrottledRequestMaxTimes?: number;
|
|
199
243
|
};
|
|
200
244
|
export declare type MultipartPart = string;
|
|
@@ -202,7 +246,7 @@ export declare type MultipartStartResponse = {
|
|
|
202
246
|
parts: MultipartPart[];
|
|
203
247
|
uuid: Uuid;
|
|
204
248
|
};
|
|
205
|
-
declare function multipartStart(size: number, { publicKey, contentType, fileName, multipartChunkSize, baseURL, secureSignature, secureExpire, store, signal, source, integration, retryThrottledRequestMaxTimes }: MultipartStartOptions): Promise<MultipartStartResponse>;
|
|
249
|
+
declare function multipartStart(size: number, { publicKey, contentType, fileName, multipartChunkSize, baseURL, secureSignature, secureExpire, store, signal, source, integration, userAgent, retryThrottledRequestMaxTimes }: MultipartStartOptions): Promise<MultipartStartResponse>;
|
|
206
250
|
export declare type MultipartUploadOptions = {
|
|
207
251
|
publicKey?: string;
|
|
208
252
|
signal?: AbortSignal;
|
|
@@ -213,22 +257,24 @@ export declare type MultipartUploadOptions = {
|
|
|
213
257
|
export declare type MultipartUploadResponse = {
|
|
214
258
|
code?: number;
|
|
215
259
|
};
|
|
216
|
-
declare function multipartUpload(part: NodeFile | BrowserFile, url: MultipartPart, {
|
|
260
|
+
declare function multipartUpload(part: NodeFile | BrowserFile, url: MultipartPart, { signal, onProgress }: MultipartUploadOptions): Promise<MultipartUploadResponse>;
|
|
217
261
|
export declare type MultipartCompleteOptions = {
|
|
218
262
|
publicKey: string;
|
|
219
263
|
baseURL?: string;
|
|
220
264
|
signal?: AbortSignal;
|
|
221
265
|
source?: string;
|
|
222
266
|
integration?: string;
|
|
267
|
+
userAgent?: CustomUserAgent;
|
|
223
268
|
retryThrottledRequestMaxTimes?: number;
|
|
224
269
|
};
|
|
225
|
-
declare function multipartComplete(uuid: Uuid, { publicKey, baseURL, source, signal, integration, retryThrottledRequestMaxTimes }: MultipartCompleteOptions): Promise<FileInfo>;
|
|
226
|
-
declare class UploadcareFile {
|
|
270
|
+
declare function multipartComplete(uuid: Uuid, { publicKey, baseURL, source, signal, integration, userAgent, retryThrottledRequestMaxTimes }: MultipartCompleteOptions): Promise<FileInfo>;
|
|
271
|
+
export declare class UploadcareFile {
|
|
227
272
|
readonly uuid: Uuid;
|
|
228
273
|
readonly name: null | string;
|
|
229
274
|
readonly size: null | number;
|
|
230
275
|
readonly isStored: null | boolean;
|
|
231
276
|
readonly isImage: null | boolean;
|
|
277
|
+
readonly mimeType: null | string;
|
|
232
278
|
readonly cdnUrl: null | string;
|
|
233
279
|
readonly cdnUrlModifiers: null | string;
|
|
234
280
|
readonly originalUrl: null | string;
|
|
@@ -241,6 +287,62 @@ declare class UploadcareFile {
|
|
|
241
287
|
fileName?: string;
|
|
242
288
|
});
|
|
243
289
|
}
|
|
290
|
+
export declare type FromObjectOptions = {
|
|
291
|
+
publicKey: string;
|
|
292
|
+
fileName?: string;
|
|
293
|
+
baseURL?: string;
|
|
294
|
+
secureSignature?: string;
|
|
295
|
+
secureExpire?: string;
|
|
296
|
+
store?: boolean;
|
|
297
|
+
signal?: AbortSignal;
|
|
298
|
+
onProgress?: ProgressCallback;
|
|
299
|
+
source?: string;
|
|
300
|
+
integration?: string;
|
|
301
|
+
userAgent?: CustomUserAgent;
|
|
302
|
+
retryThrottledRequestMaxTimes?: number;
|
|
303
|
+
baseCDN?: string;
|
|
304
|
+
};
|
|
305
|
+
declare const uploadFromObject: (file: NodeFile | BrowserFile, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, baseCDN }: FromObjectOptions) => Promise<UploadcareFile>;
|
|
306
|
+
export declare type UploadFromUrlOptions = {
|
|
307
|
+
baseCDN?: string;
|
|
308
|
+
onProgress?: ProgressCallback;
|
|
309
|
+
pusherKey?: string;
|
|
310
|
+
} & FromUrlOptions;
|
|
311
|
+
export declare const uploadFromUrl: (sourceUrl: string, { publicKey, fileName, baseURL, baseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, pusherKey }: UploadFromUrlOptions) => Promise<UploadcareFile>;
|
|
312
|
+
export declare type FromUploadedOptions = {
|
|
313
|
+
publicKey: string;
|
|
314
|
+
fileName?: string;
|
|
315
|
+
baseURL?: string;
|
|
316
|
+
signal?: AbortSignal;
|
|
317
|
+
onProgress?: ProgressCallback;
|
|
318
|
+
source?: string;
|
|
319
|
+
integration?: string;
|
|
320
|
+
userAgent?: CustomUserAgent;
|
|
321
|
+
retryThrottledRequestMaxTimes?: number;
|
|
322
|
+
baseCDN?: string;
|
|
323
|
+
};
|
|
324
|
+
export declare const uploadFromUploaded: (uuid: Uuid, { publicKey, fileName, baseURL, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, baseCDN }: FromUploadedOptions) => Promise<UploadcareFile>;
|
|
325
|
+
export declare type MultipartOptions = {
|
|
326
|
+
publicKey: string;
|
|
327
|
+
contentType?: string;
|
|
328
|
+
multipartChunkSize?: number;
|
|
329
|
+
fileName?: string;
|
|
330
|
+
fileSize?: number;
|
|
331
|
+
baseURL?: string;
|
|
332
|
+
secureSignature?: string;
|
|
333
|
+
secureExpire?: string;
|
|
334
|
+
store?: boolean;
|
|
335
|
+
signal?: AbortSignal;
|
|
336
|
+
onProgress?: ProgressCallback;
|
|
337
|
+
source?: string;
|
|
338
|
+
integration?: string;
|
|
339
|
+
userAgent?: CustomUserAgent;
|
|
340
|
+
retryThrottledRequestMaxTimes?: number;
|
|
341
|
+
maxConcurrentRequests?: number;
|
|
342
|
+
multipartMaxAttempts?: number;
|
|
343
|
+
baseCDN?: string;
|
|
344
|
+
};
|
|
345
|
+
export declare const uploadMultipart: (file: NodeFile | BrowserFile, { publicKey, fileName, fileSize, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, contentType, multipartChunkSize, maxConcurrentRequests, multipartMaxAttempts, baseCDN }: MultipartOptions) => Promise<UploadcareFile>;
|
|
244
346
|
export declare type FileFromOptions = {
|
|
245
347
|
publicKey: string;
|
|
246
348
|
fileName?: string;
|
|
@@ -252,13 +354,22 @@ export declare type FileFromOptions = {
|
|
|
252
354
|
onProgress?: ProgressCallback;
|
|
253
355
|
source?: string;
|
|
254
356
|
integration?: string;
|
|
357
|
+
userAgent?: CustomUserAgent;
|
|
255
358
|
retryThrottledRequestMaxTimes?: number;
|
|
256
359
|
contentType?: string;
|
|
257
360
|
multipartChunkSize?: number;
|
|
361
|
+
multipartMaxAttempts?: number;
|
|
362
|
+
maxConcurrentRequests?: number;
|
|
258
363
|
baseCDN?: string;
|
|
364
|
+
checkForUrlDuplicates?: boolean;
|
|
365
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
366
|
+
pusherKey?: string;
|
|
259
367
|
};
|
|
260
|
-
|
|
261
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Uploads file from provided data.
|
|
370
|
+
*/
|
|
371
|
+
export declare function uploadFile(data: NodeFile | BrowserFile | Url | Uuid, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, contentType, multipartChunkSize, multipartMaxAttempts, maxConcurrentRequests, baseCDN, checkForUrlDuplicates, saveUrlForRecurrentUploads, pusherKey }: FileFromOptions): Promise<UploadcareFile>;
|
|
372
|
+
export declare class UploadcareGroup {
|
|
262
373
|
readonly uuid: GroupId;
|
|
263
374
|
readonly filesCount: string;
|
|
264
375
|
readonly totalSize: number;
|
|
@@ -274,33 +385,7 @@ export declare type GroupFromOptions = {
|
|
|
274
385
|
defaultEffects?: string;
|
|
275
386
|
jsonpCallback?: string;
|
|
276
387
|
};
|
|
277
|
-
declare function uploadFileGroup(data: (NodeFile | BrowserFile)[] | Url[] | Uuid[], { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, retryThrottledRequestMaxTimes, contentType, multipartChunkSize, baseCDN, jsonpCallback, defaultEffects }: FileFromOptions & GroupFromOptions): Promise<UploadcareGroup>;
|
|
278
|
-
export interface DefaultSettings {
|
|
279
|
-
baseCDN: string;
|
|
280
|
-
baseURL: string;
|
|
281
|
-
maxContentLength: number;
|
|
282
|
-
retryThrottledRequestMaxTimes: number;
|
|
283
|
-
multipartMinFileSize: number;
|
|
284
|
-
multipartChunkSize: number;
|
|
285
|
-
multipartMinLastPartSize: number;
|
|
286
|
-
maxConcurrentRequests: number;
|
|
287
|
-
multipartMaxAttempts: number;
|
|
288
|
-
pollingTimeoutMilliseconds: number;
|
|
289
|
-
pusherKey: string;
|
|
290
|
-
}
|
|
291
|
-
export interface Settings extends Partial<DefaultSettings> {
|
|
292
|
-
publicKey: string;
|
|
293
|
-
fileName?: string;
|
|
294
|
-
contentType?: string;
|
|
295
|
-
store?: boolean;
|
|
296
|
-
secureSignature?: string;
|
|
297
|
-
secureExpire?: string;
|
|
298
|
-
integration?: string;
|
|
299
|
-
checkForUrlDuplicates?: boolean;
|
|
300
|
-
saveUrlForRecurrentUploads?: boolean;
|
|
301
|
-
source?: string;
|
|
302
|
-
jsonpCallback?: string;
|
|
303
|
-
}
|
|
388
|
+
declare function uploadFileGroup(data: (NodeFile | BrowserFile)[] | Url[] | Uuid[], { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, contentType, multipartChunkSize, baseCDN, jsonpCallback, defaultEffects }: FileFromOptions & GroupFromOptions): Promise<UploadcareGroup>;
|
|
304
389
|
declare class UploadClient {
|
|
305
390
|
private settings;
|
|
306
391
|
constructor(settings: Settings);
|
|
@@ -331,8 +416,8 @@ export {
|
|
|
331
416
|
multipartComplete as multipartComplete,
|
|
332
417
|
multipartStart as multipartStart,
|
|
333
418
|
multipartUpload as multipartUpload,
|
|
334
|
-
uploadFile as uploadFile,
|
|
335
419
|
uploadFileGroup as uploadFileGroup,
|
|
420
|
+
uploadFromObject as uploadBase,
|
|
336
421
|
};
|
|
337
422
|
|
|
338
423
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/upload-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Library for work with Uploadcare Upload API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"import": "./dist/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
"react-native": {
|
|
25
|
+
"./lib/request/request.node.js": "./lib/request/request.browser.js",
|
|
26
|
+
"./lib/tools/getFormData.node.js": "./lib/tools/getFormData.react-native.js",
|
|
27
|
+
"./lib/tools/sockets.node.js": "./lib/tools/sockets.browser.js",
|
|
28
|
+
"./lib/uploadFile/prepareChunks.node.js": "./lib/uploadFile/prepareChunks.react-native.js"
|
|
29
|
+
},
|
|
24
30
|
"scripts": {
|
|
25
31
|
"check-env-vars": "node ./checkvars.js",
|
|
26
32
|
"mock:start": "node --loader ts-node/esm.mjs ./mock-server/server.ts --silent",
|
|
@@ -56,47 +62,47 @@
|
|
|
56
62
|
"cdn"
|
|
57
63
|
],
|
|
58
64
|
"devDependencies": {
|
|
59
|
-
"@koa/cors": "3.1.0",
|
|
60
|
-
"@koa/router": "8.0.8",
|
|
61
65
|
"@rollup/plugin-alias": "^3.1.1",
|
|
62
66
|
"@rollup/plugin-node-resolve": "^8.4.0",
|
|
67
|
+
"@types/ws": "8.2.0",
|
|
68
|
+
"dts-bundle-generator": "5.4.0",
|
|
69
|
+
"prettier": "2.2.1",
|
|
70
|
+
"rollup": "^2.23.0",
|
|
71
|
+
"rollup-plugin-typescript2": "^0.27.1",
|
|
72
|
+
"typescript": "^3.9.7",
|
|
73
|
+
"@koa/cors": "3.1.0",
|
|
74
|
+
"@koa/router": "10.0.0",
|
|
63
75
|
"@types/form-data": "2.5.0",
|
|
64
|
-
"@types/jest": "26.0.
|
|
65
|
-
"@types/koa": "2.11.
|
|
66
|
-
"@types/node": "12.12.
|
|
76
|
+
"@types/jest": "26.0.14",
|
|
77
|
+
"@types/koa": "2.11.4",
|
|
78
|
+
"@types/node": "12.12.67",
|
|
67
79
|
"@types/promise": "7.1.30",
|
|
68
|
-
"@
|
|
69
|
-
"@typescript-eslint/
|
|
70
|
-
"@typescript-eslint/parser": "2.34.0",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "5.3.1",
|
|
81
|
+
"@typescript-eslint/parser": "5.3.1",
|
|
71
82
|
"chalk": "4.1.0",
|
|
72
83
|
"data-uri-to-buffer": "3.0.1",
|
|
73
84
|
"dataurl-to-blob": "0.0.1",
|
|
74
85
|
"dotenv": "8.2.0",
|
|
75
|
-
"
|
|
76
|
-
"eslint": "
|
|
77
|
-
"eslint-
|
|
78
|
-
"
|
|
79
|
-
"jest": "26.
|
|
80
|
-
"jest-
|
|
81
|
-
"jest-websocket-mock": "2.1.0",
|
|
86
|
+
"eslint": "8.2.0",
|
|
87
|
+
"eslint-config-prettier": "8.3.0",
|
|
88
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
89
|
+
"jest": "26.5.3",
|
|
90
|
+
"jest-environment-jsdom": "26.5.2",
|
|
91
|
+
"jest-websocket-mock": "2.2.0",
|
|
82
92
|
"koa": "2.13.0",
|
|
83
93
|
"koa-add-trailing-slashes": "2.0.1",
|
|
84
94
|
"koa-body": "4.2.0",
|
|
85
95
|
"mock-socket": "9.0.3",
|
|
86
|
-
"prettier": "
|
|
87
|
-
"prettier-config-standard": "1.0.1",
|
|
96
|
+
"prettier-config-standard": "4.0.0",
|
|
88
97
|
"rimraf": "3.0.2",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"ts-jest": "26.1.4",
|
|
94
|
-
"ts-node": "8.10.2",
|
|
95
|
-
"typescript": "^3.9.7"
|
|
98
|
+
"shipjs": "0.24.0",
|
|
99
|
+
"start-server-and-test": "1.11.7",
|
|
100
|
+
"ts-jest": "26.4.1",
|
|
101
|
+
"ts-node": "9.1.1"
|
|
96
102
|
},
|
|
97
103
|
"dependencies": {
|
|
98
104
|
"abort-controller": "^3.0.0",
|
|
99
105
|
"form-data": "^4.0.0",
|
|
100
|
-
"ws": "^
|
|
106
|
+
"ws": "^8.2.3"
|
|
101
107
|
}
|
|
102
108
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
## [1.1.2](https://github.com/uploadcare/uploadcare-upload-client/compare/v1.1.1...v1.1.2) (2020-04-20)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* **multipart:** implement retry for part uploading ([#253](https://github.com/uploadcare/uploadcare-upload-client/issues/253)) ([e2330bb](https://github.com/uploadcare/uploadcare-upload-client/commit/e2330bb37ea75b2d82c3258696b5d18cf719eae5))
|
|
7
|
-
* **multipart:** add is ready pool for mulipart upload ([#254](https://github.com/uploadcare/uploadcare-upload-client/issues/254)) ([fe7ca2a](https://github.com/uploadcare/uploadcare-upload-client/commit/fe7ca2a0bbee7b24de2a792669ec33691cb2fd0c))
|
|
8
|
-
* **multipart:** implement multipart progress for node ([#252](https://github.com/uploadcare/uploadcare-upload-client/issues/252)) ([b60eb83](https://github.com/uploadcare/uploadcare-upload-client/commit/b60eb831ff966a4c6a80f2ee9d72ce3b76659d56))
|
|
9
|
-
* **multipart:** use browser contentType if option is not passed ([#251](https://github.com/uploadcare/uploadcare-upload-client/issues/251)) ([f5ab80a](https://github.com/uploadcare/uploadcare-upload-client/commit/f5ab80a295cd6e4fc59e426d9d73086999bf4197))
|
|
10
|
-
* **multipart:** use browser filename if option is not passed ([#250](https://github.com/uploadcare/uploadcare-upload-client/issues/250)) ([749e4a9](https://github.com/uploadcare/uploadcare-upload-client/commit/749e4a988b7d10ee9368433a4ffa076471a4d3e3))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## [1.1.1](https://github.com/uploadcare/uploadcare-upload-client/compare/v1.1.0...v1.1.1) (2020-03-16)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
### Bug Fixes
|
|
17
|
-
|
|
18
|
-
* add is ready poll in `uploadFromUrl` ([#238](https://github.com/uploadcare/uploadcare-upload-client/issues/238)) ([dd0202d](https://github.com/uploadcare/uploadcare-upload-client/commit/dd0202d5ef2c787a63d345731ea2ccc39ecca70e))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [1.1.0](https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.1...v1.1.0) (2020-03-03)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* implement push strategy with sockets for `uploadFromUrl` ([#222](https://github.com/uploadcare/uploadcare-upload-client/issues/222)) ([4cafe97](https://github.com/uploadcare/uploadcare-upload-client/commit/4cafe9759ebfe1f54b0e6d2f9cf2cffa36ec3283))
|
|
28
|
-
* add deferred disconnect for push strategy ([#229](https://github.com/uploadcare/uploadcare-upload-client/issues/229)) ([a9901f7](https://github.com/uploadcare/uploadcare-upload-client/commit/a9901f74aa1512471b3f4bd470ccc794eb31dac0))
|
|
29
|
-
* add strong typed event emitter ([#217](https://github.com/uploadcare/uploadcare-upload-client/issues/217)) ([35b9eef](https://github.com/uploadcare/uploadcare-upload-client/commit/35b9eef22ae0638d52915a2338e3c3978e3d6f2b))
|
|
30
|
-
* add custom race function ([#177](https://github.com/uploadcare/uploadcare-upload-client/issues/177)) ([219c02a](https://github.com/uploadcare/uploadcare-upload-client/commit/219c02aceb233886383e6d66c5ecdfbd5a1626ea))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Bug Fixes
|
|
34
|
-
|
|
35
|
-
* make `fileName` optional and remove it from default settings ([#233](https://github.com/uploadcare/uploadcare-upload-client/issues/233)) ([a28d181](https://github.com/uploadcare/uploadcare-upload-client/commit/a28d181e5c412f6ff2aeee2e7ae02a7ae848c8a2))
|
|
36
|
-
* remove timeout from `uploadFromUrl` function ([#226](https://github.com/uploadcare/uploadcare-upload-client/issues/226)) ([76db2e4](https://github.com/uploadcare/uploadcare-upload-client/commit/76db2e4c607164afcaf07132789348927ea65577))
|
|
37
|
-
* use direct import for CancelController and rename callback to stopRace ([#216](https://github.com/uploadcare/uploadcare-upload-client/issues/216)) ([ea4ef7a](https://github.com/uploadcare/uploadcare-upload-client/commit/ea4ef7ac291ed1503e359901a315239563b53e83))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## [1.0.1](https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0...v1.0.1) (2020-01-13)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Bug Fixes
|
|
44
|
-
|
|
45
|
-
* **deps:** update dependency form-data to v3 ([#130](https://github.com/uploadcare/uploadcare-upload-client/issues/130)) ([1ece271](https://github.com/uploadcare/uploadcare-upload-client/commit/1ece271d8583ba257011d16b3f1930ad29329a96))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# [1.0.0](https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha.5...v1.0.0) (2019-12-23)
|
|
50
|
-
|
|
51
|
-
### Changed
|
|
52
|
-
|
|
53
|
-
- All methods return a `Promise` now instead of `ThenableInterface`
|
|
54
|
-
- `SettingsInterface` was renamed to `Settings`
|
|
55
|
-
- `fileFrom` was renamed to `uploadFile`.
|
|
56
|
-
- `groupFrom` was renamed to `uploadFileGroup`.
|
|
57
|
-
- `request` low-level API method is not exported outside now.
|
|
58
|
-
- Method `setSettings` of `UploadClient` was renamed to `updateSettings`.
|
|
59
|
-
- Methods (`base`, `fromUrl`, `fromUrlStatus`, `group`,
|
|
60
|
-
`groupInfo`, `info`, `multipartStart`, `multipartUpload`,
|
|
61
|
-
`multipartComplete`, `multipart`, `uploadFile`, `uploadGroup`) were exported
|
|
62
|
-
from `index.ts` to make the tree shaking better.
|
|
63
|
-
- Methods (`base`, `fromUrl`, `fromUrlStatus`, `group`,
|
|
64
|
-
`groupInfo`, `info`, `multipartStart`, `multipartUpload`,
|
|
65
|
-
`multipartComplete`, `multipart`, `uploadFile`, `uploadGroup`) accept
|
|
66
|
-
`options` instead of `settings` as a second argument.
|
|
67
|
-
- `UploadClient` now contains all low-level API methods (`base`,
|
|
68
|
-
`fromUrl`, `fromUrlStatus`, `group`, `groupInfo`, `info`,
|
|
69
|
-
`multipartStart`, `multipartUpload`, `multipartComplete`, `multipart`,
|
|
70
|
-
`fileFrom`, `groupFrom`).
|
|
71
|
-
- `UploadcareGroup` files now contain `UploadcareFile[]`, but not `FileInfo[]`.
|
|
72
|
-
- `README.md` was updated according to library API.
|
|
73
|
-
- `FileData` became `NodeFile` and `BrowserFile`.
|
|
74
|
-
|
|
75
|
-
### Removed
|
|
76
|
-
|
|
77
|
-
- `UploadAPI` class.
|
|
78
|
-
- `Thenable`, `CancelableThenable`, `BaseThenable`, `Upload` classes
|
|
79
|
-
implementing respective interfaces.
|
|
80
|
-
- `onReady`, `onUploaded` callbacks.
|
|
81
|
-
- `addUpdateSettingsListener` and `removeUpdateSettingsListener` from
|
|
82
|
-
`UploadClientInterface`.
|
|
83
|
-
- `from` param of `uploadFile` and `uploadFileGroup`.
|
|
84
|
-
- `FileFromEnum` and `GroupFromEnum`.
|
|
85
|
-
|
|
86
|
-
### Added
|
|
87
|
-
|
|
88
|
-
- `CancelController` to make API calls cancellable. See README for how
|
|
89
|
-
to use this feature. ([#77](https://github.com/uploadcare/uploadcare-upload-client/issues/77))
|
|
90
|
-
|
|
91
|
-
## [1.0.0-alpha.5]
|
|
92
|
-
|
|
93
|
-
### Added
|
|
94
|
-
|
|
95
|
-
- Support of multipart and big files uploading: `multipartStart`,
|
|
96
|
-
`multipartUpload`, and `multipartComplete` methods to `UploadAPI`.
|
|
97
|
-
- Support of canceling uploads and handling them for all API methods
|
|
98
|
-
(`info`, `fromUrl`, `fromUrlStatus`, `group`, `groupInfo`).
|
|
99
|
-
- `DefaultSettingsInterface` with required properties.
|
|
100
|
-
- `pollingTimeoutMilliseconds` to `SettingsInterface`.
|
|
101
|
-
Now you can adjust the timeout for checking is file ready,
|
|
102
|
-
and checking is file being uploaded from URL.
|
|
103
|
-
- `maxConcurrentRequests` setting that allows you to specify the number
|
|
104
|
-
of concurrent requests.
|
|
105
|
-
|
|
106
|
-
### Changed
|
|
107
|
-
|
|
108
|
-
- `FileFrom` enum was renamed to `FileFromEnum`.
|
|
109
|
-
- `GroupFrom` enum was renamed to `GroupFromEnum`.
|
|
110
|
-
- `Settings` was renamed to `SettingsInterface`.
|
|
111
|
-
- `FileInfo` was renamed to `FileInfoInterface`.
|
|
112
|
-
- `GroupInfo` was renamed to `GroupInfoInfoInterface`.
|
|
113
|
-
- `OriginalImageInfo` was renamed to `OriginalImageInfoInterface`.
|
|
114
|
-
- `RequestOptions` was renamed to `RequestOptionsInterface`.
|
|
115
|
-
- `ProgressStatus` was renamed to `ProgressStatusInterface`.
|
|
116
|
-
- `Audio` type was renamed to `AudioInterface`.
|
|
117
|
-
- `Video` type was renamed to `VideoInterface`.
|
|
118
|
-
- `ErrorRequestInfo` type was renamed to `ErrorRequestInfoInterface`.
|
|
119
|
-
- `ErrorResponseInfoInfo` type was renamed to `ErrorResponseInfoInterface`.
|
|
120
|
-
- `ProgressState` was renamed to `ProgressStateEnum`.
|
|
121
|
-
- `ProgressParams` was renamed to `ProgressParamsInterface`.
|
|
122
|
-
- `base` method of Upload API now returns `BaseThenableInterface<BaseResponse>`
|
|
123
|
-
instead of `DirectUploadInterface`.
|
|
124
|
-
- `info`, `fromUrl`, `fromUrlStatus`, `group`, `groupInfo` now returns
|
|
125
|
-
`CancelableThenableInterface`.
|
|
126
|
-
- Progress is now calculated from 0 to 1 instead of 0 to 100
|
|
127
|
-
|
|
128
|
-
### Fixed
|
|
129
|
-
|
|
130
|
-
- Example with `directUpload.onProgress` in `README.md`.
|
|
131
|
-
- All tests are passing now.
|
|
132
|
-
- Mock server tests are passing now.
|
|
133
|
-
|
|
134
|
-
### Removed
|
|
135
|
-
|
|
136
|
-
- `DirectUploadInterface` was removed in favor of `BaseThenableInterface<BaseResponse>`.
|
|
137
|
-
- `BaseProgress` was removed in favor of native `ProgressEvent`.
|
|
138
|
-
- `InfoResponse` was removed in favor of `FileInfoInterface`.
|
|
139
|
-
- Old code in folder `./.back`.
|
|
140
|
-
|
|
141
|
-
[1.0.0-alpha.5]: https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha.4...v1.0.0-alpha.5
|
|
142
|
-
|
|
143
|
-
## [1.0.0-alpha.4]
|
|
144
|
-
|
|
145
|
-
### Added
|
|
146
|
-
|
|
147
|
-
- Wrappers for group paths of Upload API (`group`, `groupInfo`).
|
|
148
|
-
- The high-level function for group uploading, aka filesGroupFrom.
|
|
149
|
-
- Uploading progress for Node.js in the `base` method.
|
|
150
|
-
|
|
151
|
-
### Changed
|
|
152
|
-
|
|
153
|
-
- `UploadFromInterface` was renamed to `FileUploadInterface`.
|
|
154
|
-
- `FileProgress` was renamed to `ProgressParams`.
|
|
155
|
-
- `UploadcareFile` was renamed to `UploadcareFileInterface`.
|
|
156
|
-
|
|
157
|
-
[1.0.0-alpha.4]: https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
|
|
158
|
-
|
|
159
|
-
## [1.0.0-alpha.3]
|
|
160
|
-
|
|
161
|
-
### Added
|
|
162
|
-
|
|
163
|
-
- Support `fileFrom` 'uploaded' file (`uuid`).
|
|
164
|
-
- Support of `waiting` status from `/from_url/status/` endpoint.
|
|
165
|
-
- Export some main types from the `index.ts` file.
|
|
166
|
-
So you can import them now directly from `@uploadcare/upload-client`.
|
|
167
|
-
- Throttling for `request`.
|
|
168
|
-
- `retryThrottledMaxTimes` param to set count of max retries after
|
|
169
|
-
throttled request (1 by default).
|
|
170
|
-
- `Uuid` type.
|
|
171
|
-
- Mock server for local testing.
|
|
172
|
-
|
|
173
|
-
### Fixed
|
|
174
|
-
|
|
175
|
-
- The default timeout for polling functions increased from 3s to 10s.
|
|
176
|
-
- Removed restrictions for timeout and interval.
|
|
177
|
-
|
|
178
|
-
[1.0.0-alpha.3]: https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
|
|
179
|
-
|
|
180
|
-
## [1.0.0-alpha.2]
|
|
181
|
-
|
|
182
|
-
### Changed
|
|
183
|
-
|
|
184
|
-
- The project was moved from Flow notations to TypeScript.
|
|
185
|
-
- The `base` function now returns an object that implements
|
|
186
|
-
`DirectUploadInterface`.
|
|
187
|
-
- The `fileFrom` function now returns an object that implements
|
|
188
|
-
`UploadFromInterface`.
|
|
189
|
-
- The `UCFile` type renamed to `UploadcareFile`.
|
|
190
|
-
- The progress of `fileFrom` now based on the `UploadingProgress` type.
|
|
191
|
-
|
|
192
|
-
### Added
|
|
193
|
-
|
|
194
|
-
- Low-level request wrappers for `/from_url/` and `/from_url/status/`
|
|
195
|
-
paths of Upload API.
|
|
196
|
-
- Settings: the support of setting `baseCDN`, `checkForUrlDuplicates`,
|
|
197
|
-
`saveUrlForRecurrentUploads`.
|
|
198
|
-
|
|
199
|
-
[1.0.0-alpha.2]: https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha.1...v1.0.0-alpha.2
|
|
200
|
-
|
|
201
|
-
## [1.0.0-alpha.1]
|
|
202
|
-
|
|
203
|
-
### Fixed
|
|
204
|
-
|
|
205
|
-
- Use the version from the `package.json` file to create Uploadcare User
|
|
206
|
-
Agent.
|
|
207
|
-
|
|
208
|
-
### Changed
|
|
209
|
-
|
|
210
|
-
- The `base` function returns `thenable` object called `DirectUpload`
|
|
211
|
-
instead of using the `promise` property.
|
|
212
|
-
- The `fileFrom` function returns `thenable` object called `FilePromise`
|
|
213
|
-
instead of using the `promise` property.
|
|
214
|
-
- The `FileInfo` type renamed to `UCFile` and updated.
|
|
215
|
-
- The `FilePromise` resolved with an object of the `UploadcareFile` type.
|
|
216
|
-
- The progress of `fileFrom` now based on the `FilePromiseProgress` type.
|
|
217
|
-
- Updated the `InfoResponse` type.
|
|
218
|
-
|
|
219
|
-
### Added
|
|
220
|
-
|
|
221
|
-
- The `checkFileIsReady` function to check if the file is ready on the CDN.
|
|
222
|
-
- New properties for the object that the `fileFrom` function returns:
|
|
223
|
-
`onUploaded`, `onReady`.
|
|
224
|
-
- The `camelizeKeys` function for inner usage.
|
|
225
|
-
- The `baseCDN` default setting
|
|
226
|
-
|
|
227
|
-
[1.0.0-alpha.1]: https://github.com/uploadcare/uploadcare-upload-client/compare/v1.0.0-alpha...v1.0.0-alpha.1
|
|
228
|
-
|
|
229
|
-
## 1.0.0-alpha
|
|
230
|
-
|
|
231
|
-
The first public alpha release.
|
|
232
|
-
|
|
233
|
-
### Added
|
|
234
|
-
|
|
235
|
-
- The `request` function to request to any path of [Upload API][upload-api].
|
|
236
|
-
- Low-level request wrappers for `/base/` and `/info/` paths of Upload API.
|
|
237
|
-
- `UploadClient` class with settings and `fileFrom` method that supports
|
|
238
|
-
only direct uploads now.
|
|
239
|
-
- Support of following Uploadcare Settings: `publicKey`, `baseUrl`,
|
|
240
|
-
`doNotStore`, `integration`, `secureExpire`, `secureSignature`.
|
|
241
|
-
- Test environment for both Node.js and browsers
|
|
242
|
-
|
|
243
|
-
[upload-api]: https://uploadcare.com/docs/api_reference/upload/
|