@uploadcare/upload-client 2.0.0-alpha.8 → 2.2.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 +73 -42
- package/dist/index.browser.js +110 -86
- package/dist/index.cjs +85 -49
- package/dist/index.js +119 -95
- package/dist/types.d.ts +102 -5
- package/package.json +32 -26
- package/CHANGELOG.md +0 -243
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
|
|
5
|
+
import NodeFormData from 'form-data';
|
|
6
|
+
|
|
5
7
|
export declare type GeoLocation = {
|
|
6
8
|
latitude: number;
|
|
7
9
|
longitude: number;
|
|
@@ -92,6 +94,7 @@ export interface Settings extends Partial<DefaultSettings> {
|
|
|
92
94
|
secureSignature?: string;
|
|
93
95
|
secureExpire?: string;
|
|
94
96
|
integration?: string;
|
|
97
|
+
userAgent?: CustomUserAgent;
|
|
95
98
|
checkForUrlDuplicates?: boolean;
|
|
96
99
|
saveUrlForRecurrentUploads?: boolean;
|
|
97
100
|
source?: string;
|
|
@@ -104,7 +107,18 @@ export declare type CustomUserAgentOptions = {
|
|
|
104
107
|
languageName: string;
|
|
105
108
|
integration?: string;
|
|
106
109
|
};
|
|
107
|
-
export declare type
|
|
110
|
+
export declare type CustomUserAgentFn = (options: CustomUserAgentOptions) => string;
|
|
111
|
+
export declare type CustomUserAgent = string | CustomUserAgentFn;
|
|
112
|
+
export declare type Headers = {
|
|
113
|
+
[key: string]: string | string[] | undefined;
|
|
114
|
+
};
|
|
115
|
+
export declare type ErrorRequestInfo = {
|
|
116
|
+
method?: string;
|
|
117
|
+
url: string;
|
|
118
|
+
query?: string;
|
|
119
|
+
data?: NodeFormData | FormData | BrowserFile | NodeFile;
|
|
120
|
+
headers?: Headers;
|
|
121
|
+
};
|
|
108
122
|
export declare type BrowserFile = Blob | File;
|
|
109
123
|
export declare type NodeFile = Buffer;
|
|
110
124
|
export declare type BaseResponse = {
|
|
@@ -176,6 +190,7 @@ export declare type StatusProgressResponse = {
|
|
|
176
190
|
export declare type StatusErrorResponse = {
|
|
177
191
|
status: Status.Error;
|
|
178
192
|
error: string;
|
|
193
|
+
errorCode: string;
|
|
179
194
|
};
|
|
180
195
|
export declare type StatusSuccessResponse = {
|
|
181
196
|
status: Status.Success;
|
|
@@ -245,8 +260,10 @@ export declare type MultipartStartResponse = {
|
|
|
245
260
|
};
|
|
246
261
|
declare function multipartStart(size: number, { publicKey, contentType, fileName, multipartChunkSize, baseURL, secureSignature, secureExpire, store, signal, source, integration, userAgent, retryThrottledRequestMaxTimes }: MultipartStartOptions): Promise<MultipartStartResponse>;
|
|
247
262
|
export declare type MultipartUploadOptions = {
|
|
263
|
+
publicKey?: string;
|
|
248
264
|
signal?: AbortSignal;
|
|
249
265
|
onProgress?: ProgressCallback;
|
|
266
|
+
integration?: string;
|
|
250
267
|
retryThrottledRequestMaxTimes?: number;
|
|
251
268
|
};
|
|
252
269
|
export declare type MultipartUploadResponse = {
|
|
@@ -263,12 +280,13 @@ export declare type MultipartCompleteOptions = {
|
|
|
263
280
|
retryThrottledRequestMaxTimes?: number;
|
|
264
281
|
};
|
|
265
282
|
declare function multipartComplete(uuid: Uuid, { publicKey, baseURL, source, signal, integration, userAgent, retryThrottledRequestMaxTimes }: MultipartCompleteOptions): Promise<FileInfo>;
|
|
266
|
-
declare class UploadcareFile {
|
|
283
|
+
export declare class UploadcareFile {
|
|
267
284
|
readonly uuid: Uuid;
|
|
268
285
|
readonly name: null | string;
|
|
269
286
|
readonly size: null | number;
|
|
270
287
|
readonly isStored: null | boolean;
|
|
271
288
|
readonly isImage: null | boolean;
|
|
289
|
+
readonly mimeType: null | string;
|
|
272
290
|
readonly cdnUrl: null | string;
|
|
273
291
|
readonly cdnUrlModifiers: null | string;
|
|
274
292
|
readonly originalUrl: null | string;
|
|
@@ -281,6 +299,62 @@ declare class UploadcareFile {
|
|
|
281
299
|
fileName?: string;
|
|
282
300
|
});
|
|
283
301
|
}
|
|
302
|
+
export declare type FromObjectOptions = {
|
|
303
|
+
publicKey: string;
|
|
304
|
+
fileName?: string;
|
|
305
|
+
baseURL?: string;
|
|
306
|
+
secureSignature?: string;
|
|
307
|
+
secureExpire?: string;
|
|
308
|
+
store?: boolean;
|
|
309
|
+
signal?: AbortSignal;
|
|
310
|
+
onProgress?: ProgressCallback;
|
|
311
|
+
source?: string;
|
|
312
|
+
integration?: string;
|
|
313
|
+
userAgent?: CustomUserAgent;
|
|
314
|
+
retryThrottledRequestMaxTimes?: number;
|
|
315
|
+
baseCDN?: string;
|
|
316
|
+
};
|
|
317
|
+
declare const uploadFromObject: (file: NodeFile | BrowserFile, { publicKey, fileName, baseURL, secureSignature, secureExpire, store, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, baseCDN }: FromObjectOptions) => Promise<UploadcareFile>;
|
|
318
|
+
export declare type UploadFromUrlOptions = {
|
|
319
|
+
baseCDN?: string;
|
|
320
|
+
onProgress?: ProgressCallback;
|
|
321
|
+
pusherKey?: string;
|
|
322
|
+
} & FromUrlOptions;
|
|
323
|
+
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>;
|
|
324
|
+
export declare type FromUploadedOptions = {
|
|
325
|
+
publicKey: string;
|
|
326
|
+
fileName?: string;
|
|
327
|
+
baseURL?: string;
|
|
328
|
+
signal?: AbortSignal;
|
|
329
|
+
onProgress?: ProgressCallback;
|
|
330
|
+
source?: string;
|
|
331
|
+
integration?: string;
|
|
332
|
+
userAgent?: CustomUserAgent;
|
|
333
|
+
retryThrottledRequestMaxTimes?: number;
|
|
334
|
+
baseCDN?: string;
|
|
335
|
+
};
|
|
336
|
+
export declare const uploadFromUploaded: (uuid: Uuid, { publicKey, fileName, baseURL, signal, onProgress, source, integration, userAgent, retryThrottledRequestMaxTimes, baseCDN }: FromUploadedOptions) => Promise<UploadcareFile>;
|
|
337
|
+
export declare type MultipartOptions = {
|
|
338
|
+
publicKey: string;
|
|
339
|
+
contentType?: string;
|
|
340
|
+
multipartChunkSize?: number;
|
|
341
|
+
fileName?: string;
|
|
342
|
+
fileSize?: number;
|
|
343
|
+
baseURL?: string;
|
|
344
|
+
secureSignature?: string;
|
|
345
|
+
secureExpire?: string;
|
|
346
|
+
store?: boolean;
|
|
347
|
+
signal?: AbortSignal;
|
|
348
|
+
onProgress?: ProgressCallback;
|
|
349
|
+
source?: string;
|
|
350
|
+
integration?: string;
|
|
351
|
+
userAgent?: CustomUserAgent;
|
|
352
|
+
retryThrottledRequestMaxTimes?: number;
|
|
353
|
+
maxConcurrentRequests?: number;
|
|
354
|
+
multipartMaxAttempts?: number;
|
|
355
|
+
baseCDN?: string;
|
|
356
|
+
};
|
|
357
|
+
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>;
|
|
284
358
|
export declare type FileFromOptions = {
|
|
285
359
|
publicKey: string;
|
|
286
360
|
fileName?: string;
|
|
@@ -296,10 +370,18 @@ export declare type FileFromOptions = {
|
|
|
296
370
|
retryThrottledRequestMaxTimes?: number;
|
|
297
371
|
contentType?: string;
|
|
298
372
|
multipartChunkSize?: number;
|
|
373
|
+
multipartMaxAttempts?: number;
|
|
374
|
+
maxConcurrentRequests?: number;
|
|
299
375
|
baseCDN?: string;
|
|
376
|
+
checkForUrlDuplicates?: boolean;
|
|
377
|
+
saveUrlForRecurrentUploads?: boolean;
|
|
378
|
+
pusherKey?: string;
|
|
300
379
|
};
|
|
301
|
-
|
|
302
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Uploads file from provided data.
|
|
382
|
+
*/
|
|
383
|
+
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>;
|
|
384
|
+
export declare class UploadcareGroup {
|
|
303
385
|
readonly uuid: GroupId;
|
|
304
386
|
readonly filesCount: string;
|
|
305
387
|
readonly totalSize: number;
|
|
@@ -333,6 +415,21 @@ declare class UploadClient {
|
|
|
333
415
|
uploadFile(data: NodeFile | BrowserFile | Url | Uuid, options?: Partial<FileFromOptions>): Promise<UploadcareFile>;
|
|
334
416
|
uploadFileGroup(data: (NodeFile | BrowserFile)[] | Url[] | Uuid[], options?: Partial<FileFromOptions & GroupFromOptions>): Promise<UploadcareGroup>;
|
|
335
417
|
}
|
|
418
|
+
export declare type ErrorResponseInfo = {
|
|
419
|
+
error?: {
|
|
420
|
+
statusCode: number;
|
|
421
|
+
content: string;
|
|
422
|
+
errorCode: string;
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
export declare class UploadClientError extends Error {
|
|
426
|
+
isCancel?: boolean;
|
|
427
|
+
readonly code?: string;
|
|
428
|
+
readonly request?: ErrorRequestInfo;
|
|
429
|
+
readonly response?: ErrorResponseInfo;
|
|
430
|
+
readonly headers?: Headers;
|
|
431
|
+
constructor(message: string, code?: string, request?: ErrorRequestInfo, response?: ErrorResponseInfo, headers?: Headers);
|
|
432
|
+
}
|
|
336
433
|
export { AbortController } from "abort-controller";
|
|
337
434
|
|
|
338
435
|
export {
|
|
@@ -346,8 +443,8 @@ export {
|
|
|
346
443
|
multipartComplete as multipartComplete,
|
|
347
444
|
multipartStart as multipartStart,
|
|
348
445
|
multipartUpload as multipartUpload,
|
|
349
|
-
uploadFile as uploadFile,
|
|
350
446
|
uploadFileGroup as uploadFileGroup,
|
|
447
|
+
uploadFromObject as uploadBase,
|
|
351
448
|
};
|
|
352
449
|
|
|
353
450
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/upload-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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/
|