@uploadcare/upload-client 4.2.1 → 4.3.1
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/index.browser.js +10 -4
- package/dist/index.node.js +3 -3
- package/dist/index.react-native.js +10 -4
- package/dist/types.d.ts +8 -0
- package/package.json +4 -4
package/dist/index.browser.js
CHANGED
|
@@ -31,7 +31,13 @@ const request = ({ method, url, data, headers = {}, signal, onProgress }) => new
|
|
|
31
31
|
const xhr = new XMLHttpRequest();
|
|
32
32
|
const requestMethod = method?.toUpperCase() || 'GET';
|
|
33
33
|
let aborted = false;
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Force synchronous flag to be off
|
|
36
|
+
* Some chrome versions gets `InvalidAccessError` error when we set `responseType`
|
|
37
|
+
* See https://xhr.spec.whatwg.org/#synchronous-flag
|
|
38
|
+
* and https://bugs.chromium.org/p/chromium/issues/detail?id=1346628
|
|
39
|
+
*/
|
|
40
|
+
xhr.open(requestMethod, url, true);
|
|
35
41
|
if (headers) {
|
|
36
42
|
Object.entries(headers).forEach((entry) => {
|
|
37
43
|
const [key, value] = entry;
|
|
@@ -221,7 +227,7 @@ const buildSearchParams = (query) => {
|
|
|
221
227
|
};
|
|
222
228
|
const getUrl = (base, path, query) => {
|
|
223
229
|
const url = new URL(base);
|
|
224
|
-
url.pathname = path;
|
|
230
|
+
url.pathname = (url.pathname + path).replace('//', '/');
|
|
225
231
|
if (query) {
|
|
226
232
|
url.search = buildSearchParams(query);
|
|
227
233
|
}
|
|
@@ -248,7 +254,7 @@ const defaultSettings = {
|
|
|
248
254
|
const defaultContentType = 'application/octet-stream';
|
|
249
255
|
const defaultFilename = 'original';
|
|
250
256
|
|
|
251
|
-
var version = '4.
|
|
257
|
+
var version = '4.3.1';
|
|
252
258
|
|
|
253
259
|
function isObject(o) {
|
|
254
260
|
return Object.prototype.toString.call(o) === '[object Object]';
|
|
@@ -1548,4 +1554,4 @@ class UploadClient {
|
|
|
1548
1554
|
}
|
|
1549
1555
|
}
|
|
1550
1556
|
|
|
1551
|
-
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
|
1557
|
+
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, getUserAgent$1 as getUserAgent, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
package/dist/index.node.js
CHANGED
|
@@ -255,7 +255,7 @@ const buildSearchParams = (query) => {
|
|
|
255
255
|
};
|
|
256
256
|
const getUrl = (base, path, query) => {
|
|
257
257
|
const url = new URL(base);
|
|
258
|
-
url.pathname = path;
|
|
258
|
+
url.pathname = (url.pathname + path).replace('//', '/');
|
|
259
259
|
if (query) {
|
|
260
260
|
url.search = buildSearchParams(query);
|
|
261
261
|
}
|
|
@@ -282,7 +282,7 @@ const defaultSettings = {
|
|
|
282
282
|
const defaultContentType = 'application/octet-stream';
|
|
283
283
|
const defaultFilename = 'original';
|
|
284
284
|
|
|
285
|
-
var version = '4.
|
|
285
|
+
var version = '4.3.1';
|
|
286
286
|
|
|
287
287
|
function isObject(o) {
|
|
288
288
|
return Object.prototype.toString.call(o) === '[object Object]';
|
|
@@ -1580,4 +1580,4 @@ class UploadClient {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
1582
|
|
|
1583
|
-
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
|
1583
|
+
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, getUserAgent$1 as getUserAgent, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
|
@@ -31,7 +31,13 @@ const request = ({ method, url, data, headers = {}, signal, onProgress }) => new
|
|
|
31
31
|
const xhr = new XMLHttpRequest();
|
|
32
32
|
const requestMethod = method?.toUpperCase() || 'GET';
|
|
33
33
|
let aborted = false;
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Force synchronous flag to be off
|
|
36
|
+
* Some chrome versions gets `InvalidAccessError` error when we set `responseType`
|
|
37
|
+
* See https://xhr.spec.whatwg.org/#synchronous-flag
|
|
38
|
+
* and https://bugs.chromium.org/p/chromium/issues/detail?id=1346628
|
|
39
|
+
*/
|
|
40
|
+
xhr.open(requestMethod, url, true);
|
|
35
41
|
if (headers) {
|
|
36
42
|
Object.entries(headers).forEach((entry) => {
|
|
37
43
|
const [key, value] = entry;
|
|
@@ -224,7 +230,7 @@ const buildSearchParams = (query) => {
|
|
|
224
230
|
};
|
|
225
231
|
const getUrl = (base, path, query) => {
|
|
226
232
|
const url = new URL(base);
|
|
227
|
-
url.pathname = path;
|
|
233
|
+
url.pathname = (url.pathname + path).replace('//', '/');
|
|
228
234
|
if (query) {
|
|
229
235
|
url.search = buildSearchParams(query);
|
|
230
236
|
}
|
|
@@ -251,7 +257,7 @@ const defaultSettings = {
|
|
|
251
257
|
const defaultContentType = 'application/octet-stream';
|
|
252
258
|
const defaultFilename = 'original';
|
|
253
259
|
|
|
254
|
-
var version = '4.
|
|
260
|
+
var version = '4.3.1';
|
|
255
261
|
|
|
256
262
|
function isObject(o) {
|
|
257
263
|
return Object.prototype.toString.call(o) === '[object Object]';
|
|
@@ -1564,4 +1570,4 @@ class UploadClient {
|
|
|
1564
1570
|
}
|
|
1565
1571
|
}
|
|
1566
1572
|
|
|
1567
|
-
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
|
1573
|
+
export { UploadClient, UploadClientError, UploadcareFile, UploadcareGroup, base, fromUrl, fromUrlStatus, getUserAgent$1 as getUserAgent, group, groupInfo, info, multipartComplete, multipartStart, multipartUpload, uploadDirect, uploadFile, uploadFileGroup, uploadFromUploaded, uploadFromUrl, uploadMultipart };
|
package/dist/types.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export declare type CustomUserAgentOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare type CustomUserAgentFn = (options: CustomUserAgentOptions) => string;
|
|
13
13
|
export declare type CustomUserAgent = string | CustomUserAgentFn;
|
|
14
|
+
export declare 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;
|
|
14
22
|
export declare type GeoLocation = {
|
|
15
23
|
latitude: number;
|
|
16
24
|
longitude: number;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/upload-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Library for work with Uploadcare Upload API",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.node.js",
|
|
7
6
|
"module": "./dist/index.node.js",
|
|
8
7
|
"browser": "./dist/index.browser.js",
|
|
9
8
|
"react-native": "./dist/index.react-native.js",
|
|
@@ -11,7 +10,8 @@
|
|
|
11
10
|
"exports": {
|
|
12
11
|
".": {
|
|
13
12
|
"node": "./dist/index.node.js",
|
|
14
|
-
"browser": "./dist/index.browser.js"
|
|
13
|
+
"browser": "./dist/index.browser.js",
|
|
14
|
+
"default": "./dist/index.browser.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"sideEffects": false,
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"koa-body": "5.0.0",
|
|
66
66
|
"mock-socket": "9.0.3",
|
|
67
67
|
"start-server-and-test": "1.14.0",
|
|
68
|
-
"@uploadcare/api-client-utils": "^4.
|
|
68
|
+
"@uploadcare/api-client-utils": "^4.3.1",
|
|
69
69
|
"chalk": "^4.1.2"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|