@uploadcare/upload-client 6.6.1 → 6.7.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/dist/cjs/index.browser.cjs +68 -52
- package/dist/cjs/index.browser.d.cts +15 -4
- package/dist/cjs/index.node.cjs +68 -52
- package/dist/cjs/index.node.d.cts +15 -4
- package/dist/cjs/index.react-native.cjs +68 -52
- package/dist/cjs/index.react-native.d.cts +15 -4
- package/dist/esm/index.browser.d.mts +15 -4
- package/dist/esm/index.browser.mjs +68 -52
- package/dist/esm/index.node.d.mts +15 -4
- package/dist/esm/index.node.mjs +68 -52
- package/dist/esm/index.react-native.d.mts +15 -4
- package/dist/esm/index.react-native.mjs +68 -52
- package/dist/index.d.ts +15 -4
- package/package.json +3 -3
package/dist/esm/index.node.mjs
CHANGED
|
@@ -426,7 +426,7 @@ const getUrl = (base, path, query) => {
|
|
|
426
426
|
return url.toString();
|
|
427
427
|
};
|
|
428
428
|
|
|
429
|
-
var version = '6.
|
|
429
|
+
var version = '6.7.0';
|
|
430
430
|
|
|
431
431
|
const LIBRARY_NAME = 'UploadcareUploadClient';
|
|
432
432
|
const LIBRARY_VERSION = version;
|
|
@@ -800,6 +800,9 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
|
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
+
function isGroupFileInfo(fileInfo) {
|
|
804
|
+
return 'defaultEffects' in fileInfo;
|
|
805
|
+
}
|
|
803
806
|
class UploadcareFile {
|
|
804
807
|
uuid;
|
|
805
808
|
name = null;
|
|
@@ -815,6 +818,7 @@ class UploadcareFile {
|
|
|
815
818
|
contentInfo = null;
|
|
816
819
|
metadata = null;
|
|
817
820
|
s3Bucket = null;
|
|
821
|
+
defaultEffects = null;
|
|
818
822
|
constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
|
|
819
823
|
const { uuid, s3Bucket } = fileInfo;
|
|
820
824
|
const cdnUrl = getUrl(baseCDN, `${uuid}/`);
|
|
@@ -835,6 +839,9 @@ class UploadcareFile {
|
|
|
835
839
|
this.metadata = fileInfo.metadata || null;
|
|
836
840
|
this.s3Bucket = s3Bucket || null;
|
|
837
841
|
this.s3Url = s3Url;
|
|
842
|
+
if (isGroupFileInfo(fileInfo)) {
|
|
843
|
+
this.defaultEffects = fileInfo.defaultEffects;
|
|
844
|
+
}
|
|
838
845
|
}
|
|
839
846
|
}
|
|
840
847
|
|
|
@@ -1513,14 +1520,16 @@ class UploadcareGroup {
|
|
|
1513
1520
|
files;
|
|
1514
1521
|
createdAt;
|
|
1515
1522
|
storedAt = null;
|
|
1516
|
-
constructor(groupInfo,
|
|
1523
|
+
constructor(groupInfo, { baseCDN = defaultSettings.baseCDN } = {}) {
|
|
1517
1524
|
this.uuid = groupInfo.id;
|
|
1518
1525
|
this.filesCount = groupInfo.filesCount;
|
|
1519
|
-
|
|
1526
|
+
const groupFiles = groupInfo.files.filter(Boolean);
|
|
1527
|
+
this.totalSize = Object.values(groupFiles).reduce((acc, file) => acc + file.size, 0);
|
|
1520
1528
|
this.isStored = !!groupInfo.datetimeStored;
|
|
1521
|
-
this.isImage = !!Object.values(
|
|
1529
|
+
this.isImage = !!Object.values(groupFiles).filter((file) => file.isImage)
|
|
1530
|
+
.length;
|
|
1522
1531
|
this.cdnUrl = groupInfo.cdnUrl;
|
|
1523
|
-
this.files =
|
|
1532
|
+
this.files = groupFiles.map((fileInfo) => new UploadcareFile(fileInfo, { baseCDN }));
|
|
1524
1533
|
this.createdAt = groupInfo.datetimeCreated;
|
|
1525
1534
|
this.storedAt = groupInfo.datetimeStored;
|
|
1526
1535
|
}
|
|
@@ -1578,27 +1587,34 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
|
|
|
1578
1587
|
onProgress({ isComputable: true, value: normalize(progressValues) });
|
|
1579
1588
|
};
|
|
1580
1589
|
};
|
|
1581
|
-
return Promise.all(data.map((file, index) =>
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1590
|
+
return Promise.all(data.map((file, index) => {
|
|
1591
|
+
if (isFileData(file) || isUrl(file)) {
|
|
1592
|
+
return uploadFile(file, {
|
|
1593
|
+
publicKey,
|
|
1594
|
+
fileName,
|
|
1595
|
+
baseURL,
|
|
1596
|
+
secureSignature,
|
|
1597
|
+
secureExpire,
|
|
1598
|
+
store,
|
|
1599
|
+
signal,
|
|
1600
|
+
onProgress: createProgressHandler(filesCount, index),
|
|
1601
|
+
source,
|
|
1602
|
+
integration,
|
|
1603
|
+
userAgent,
|
|
1604
|
+
retryThrottledRequestMaxTimes,
|
|
1605
|
+
retryNetworkErrorMaxTimes,
|
|
1606
|
+
contentType,
|
|
1607
|
+
multipartChunkSize,
|
|
1608
|
+
baseCDN,
|
|
1609
|
+
checkForUrlDuplicates,
|
|
1610
|
+
saveUrlForRecurrentUploads
|
|
1611
|
+
}).then((fileInfo) => fileInfo.uuid);
|
|
1612
|
+
}
|
|
1613
|
+
else {
|
|
1614
|
+
// Do not request file info by uuid before creating group because this isn't necessary
|
|
1615
|
+
return file;
|
|
1616
|
+
}
|
|
1617
|
+
})).then((uuids) => {
|
|
1602
1618
|
return group(uuids, {
|
|
1603
1619
|
publicKey,
|
|
1604
1620
|
baseURL,
|
|
@@ -1612,7 +1628,7 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
|
|
|
1612
1628
|
retryThrottledRequestMaxTimes,
|
|
1613
1629
|
retryNetworkErrorMaxTimes
|
|
1614
1630
|
})
|
|
1615
|
-
.then((groupInfo) => new UploadcareGroup(groupInfo,
|
|
1631
|
+
.then((groupInfo) => new UploadcareGroup(groupInfo, { baseCDN }))
|
|
1616
1632
|
.then((group) => {
|
|
1617
1633
|
onProgress && onProgress({ isComputable: true, value: 1 });
|
|
1618
1634
|
return group;
|
|
@@ -1683,32 +1699,32 @@ class UploadClient {
|
|
|
1683
1699
|
}
|
|
1684
1700
|
|
|
1685
1701
|
class Queue {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1702
|
+
_concurrency = 1;
|
|
1703
|
+
_pending = [];
|
|
1704
|
+
_running = 0;
|
|
1705
|
+
_resolvers = new Map();
|
|
1706
|
+
_rejectors = new Map();
|
|
1691
1707
|
constructor(concurrency) {
|
|
1692
|
-
this
|
|
1708
|
+
this._concurrency = concurrency;
|
|
1693
1709
|
}
|
|
1694
|
-
|
|
1695
|
-
const tasksLeft = this
|
|
1710
|
+
_run() {
|
|
1711
|
+
const tasksLeft = this._concurrency - this._running;
|
|
1696
1712
|
for (let i = 0; i < tasksLeft; i++) {
|
|
1697
|
-
const task = this
|
|
1713
|
+
const task = this._pending.shift();
|
|
1698
1714
|
if (!task) {
|
|
1699
1715
|
return;
|
|
1700
1716
|
}
|
|
1701
|
-
const resolver = this
|
|
1702
|
-
const rejector = this
|
|
1717
|
+
const resolver = this._resolvers.get(task);
|
|
1718
|
+
const rejector = this._rejectors.get(task);
|
|
1703
1719
|
if (!resolver || !rejector)
|
|
1704
1720
|
throw new Error('Unexpected behavior: resolver or rejector is undefined');
|
|
1705
|
-
this
|
|
1721
|
+
this._running += 1;
|
|
1706
1722
|
task()
|
|
1707
1723
|
.finally(() => {
|
|
1708
|
-
this
|
|
1709
|
-
this
|
|
1710
|
-
this
|
|
1711
|
-
this
|
|
1724
|
+
this._resolvers.delete(task);
|
|
1725
|
+
this._rejectors.delete(task);
|
|
1726
|
+
this._running -= 1;
|
|
1727
|
+
this._run();
|
|
1712
1728
|
})
|
|
1713
1729
|
.then((value) => resolver(value))
|
|
1714
1730
|
.catch((error) => rejector(error));
|
|
@@ -1716,24 +1732,24 @@ class Queue {
|
|
|
1716
1732
|
}
|
|
1717
1733
|
add(task) {
|
|
1718
1734
|
return new Promise((resolve, reject) => {
|
|
1719
|
-
this
|
|
1720
|
-
this
|
|
1721
|
-
this
|
|
1722
|
-
this
|
|
1735
|
+
this._resolvers.set(task, resolve);
|
|
1736
|
+
this._rejectors.set(task, reject);
|
|
1737
|
+
this._pending.push(task);
|
|
1738
|
+
this._run();
|
|
1723
1739
|
});
|
|
1724
1740
|
}
|
|
1725
1741
|
get pending() {
|
|
1726
|
-
return this
|
|
1742
|
+
return this._pending.length;
|
|
1727
1743
|
}
|
|
1728
1744
|
get running() {
|
|
1729
|
-
return this
|
|
1745
|
+
return this._running;
|
|
1730
1746
|
}
|
|
1731
1747
|
set concurrency(value) {
|
|
1732
|
-
this
|
|
1733
|
-
this
|
|
1748
|
+
this._concurrency = value;
|
|
1749
|
+
this._run();
|
|
1734
1750
|
}
|
|
1735
1751
|
get concurrency() {
|
|
1736
|
-
return this
|
|
1752
|
+
return this._concurrency;
|
|
1737
1753
|
}
|
|
1738
1754
|
}
|
|
1739
1755
|
|
|
@@ -126,12 +126,15 @@ export type FileInfo = {
|
|
|
126
126
|
s3Bucket?: string;
|
|
127
127
|
metadata?: Metadata;
|
|
128
128
|
};
|
|
129
|
+
export type GroupFileInfo = FileInfo & {
|
|
130
|
+
defaultEffects: string;
|
|
131
|
+
};
|
|
129
132
|
export type GroupInfo = {
|
|
130
133
|
datetimeCreated: string;
|
|
131
134
|
datetimeStored: string | null;
|
|
132
135
|
filesCount: string;
|
|
133
136
|
cdnUrl: string;
|
|
134
|
-
files:
|
|
137
|
+
files: (GroupFileInfo | null)[];
|
|
135
138
|
url: string;
|
|
136
139
|
id: GroupId;
|
|
137
140
|
};
|
|
@@ -347,7 +350,8 @@ export declare class UploadcareFile {
|
|
|
347
350
|
readonly contentInfo: null | ContentInfo;
|
|
348
351
|
readonly metadata: null | Metadata;
|
|
349
352
|
readonly s3Bucket: null | string;
|
|
350
|
-
|
|
353
|
+
readonly defaultEffects: null | string;
|
|
354
|
+
constructor(fileInfo: FileInfo | GroupFileInfo, { baseCDN, fileName }?: {
|
|
351
355
|
baseCDN?: string;
|
|
352
356
|
fileName?: string;
|
|
353
357
|
});
|
|
@@ -449,7 +453,9 @@ export declare class UploadcareGroup {
|
|
|
449
453
|
readonly files: UploadcareFile[];
|
|
450
454
|
readonly createdAt: string;
|
|
451
455
|
readonly storedAt: string | null;
|
|
452
|
-
constructor(groupInfo: GroupInfo,
|
|
456
|
+
constructor(groupInfo: GroupInfo, { baseCDN }?: {
|
|
457
|
+
baseCDN?: string;
|
|
458
|
+
});
|
|
453
459
|
}
|
|
454
460
|
export type GroupFromOptions = {
|
|
455
461
|
jsonpCallback?: string;
|
|
@@ -474,8 +480,13 @@ export declare class UploadClient {
|
|
|
474
480
|
}
|
|
475
481
|
export type Task<T = unknown> = () => Promise<T>;
|
|
476
482
|
export declare class Queue {
|
|
477
|
-
|
|
483
|
+
private _concurrency;
|
|
484
|
+
private _pending;
|
|
485
|
+
private _running;
|
|
486
|
+
private _resolvers;
|
|
487
|
+
private _rejectors;
|
|
478
488
|
constructor(concurrency: number);
|
|
489
|
+
private _run;
|
|
479
490
|
add<T>(task: Task<T>): Promise<T>;
|
|
480
491
|
get pending(): number;
|
|
481
492
|
get running(): number;
|
|
@@ -403,7 +403,7 @@ const getUrl = (base, path, query) => {
|
|
|
403
403
|
return url.toString();
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
-
var version = '6.
|
|
406
|
+
var version = '6.7.0';
|
|
407
407
|
|
|
408
408
|
const LIBRARY_NAME = 'UploadcareUploadClient';
|
|
409
409
|
const LIBRARY_VERSION = version;
|
|
@@ -777,6 +777,9 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
|
|
|
777
777
|
});
|
|
778
778
|
}
|
|
779
779
|
|
|
780
|
+
function isGroupFileInfo(fileInfo) {
|
|
781
|
+
return 'defaultEffects' in fileInfo;
|
|
782
|
+
}
|
|
780
783
|
class UploadcareFile {
|
|
781
784
|
uuid;
|
|
782
785
|
name = null;
|
|
@@ -792,6 +795,7 @@ class UploadcareFile {
|
|
|
792
795
|
contentInfo = null;
|
|
793
796
|
metadata = null;
|
|
794
797
|
s3Bucket = null;
|
|
798
|
+
defaultEffects = null;
|
|
795
799
|
constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
|
|
796
800
|
const { uuid, s3Bucket } = fileInfo;
|
|
797
801
|
const cdnUrl = getUrl(baseCDN, `${uuid}/`);
|
|
@@ -812,6 +816,9 @@ class UploadcareFile {
|
|
|
812
816
|
this.metadata = fileInfo.metadata || null;
|
|
813
817
|
this.s3Bucket = s3Bucket || null;
|
|
814
818
|
this.s3Url = s3Url;
|
|
819
|
+
if (isGroupFileInfo(fileInfo)) {
|
|
820
|
+
this.defaultEffects = fileInfo.defaultEffects;
|
|
821
|
+
}
|
|
815
822
|
}
|
|
816
823
|
}
|
|
817
824
|
|
|
@@ -1509,14 +1516,16 @@ class UploadcareGroup {
|
|
|
1509
1516
|
files;
|
|
1510
1517
|
createdAt;
|
|
1511
1518
|
storedAt = null;
|
|
1512
|
-
constructor(groupInfo,
|
|
1519
|
+
constructor(groupInfo, { baseCDN = defaultSettings.baseCDN } = {}) {
|
|
1513
1520
|
this.uuid = groupInfo.id;
|
|
1514
1521
|
this.filesCount = groupInfo.filesCount;
|
|
1515
|
-
|
|
1522
|
+
const groupFiles = groupInfo.files.filter(Boolean);
|
|
1523
|
+
this.totalSize = Object.values(groupFiles).reduce((acc, file) => acc + file.size, 0);
|
|
1516
1524
|
this.isStored = !!groupInfo.datetimeStored;
|
|
1517
|
-
this.isImage = !!Object.values(
|
|
1525
|
+
this.isImage = !!Object.values(groupFiles).filter((file) => file.isImage)
|
|
1526
|
+
.length;
|
|
1518
1527
|
this.cdnUrl = groupInfo.cdnUrl;
|
|
1519
|
-
this.files =
|
|
1528
|
+
this.files = groupFiles.map((fileInfo) => new UploadcareFile(fileInfo, { baseCDN }));
|
|
1520
1529
|
this.createdAt = groupInfo.datetimeCreated;
|
|
1521
1530
|
this.storedAt = groupInfo.datetimeStored;
|
|
1522
1531
|
}
|
|
@@ -1574,27 +1583,34 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
|
|
|
1574
1583
|
onProgress({ isComputable: true, value: normalize(progressValues) });
|
|
1575
1584
|
};
|
|
1576
1585
|
};
|
|
1577
|
-
return Promise.all(data.map((file, index) =>
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1586
|
+
return Promise.all(data.map((file, index) => {
|
|
1587
|
+
if (isFileData(file) || isUrl(file)) {
|
|
1588
|
+
return uploadFile(file, {
|
|
1589
|
+
publicKey,
|
|
1590
|
+
fileName,
|
|
1591
|
+
baseURL,
|
|
1592
|
+
secureSignature,
|
|
1593
|
+
secureExpire,
|
|
1594
|
+
store,
|
|
1595
|
+
signal,
|
|
1596
|
+
onProgress: createProgressHandler(filesCount, index),
|
|
1597
|
+
source,
|
|
1598
|
+
integration,
|
|
1599
|
+
userAgent,
|
|
1600
|
+
retryThrottledRequestMaxTimes,
|
|
1601
|
+
retryNetworkErrorMaxTimes,
|
|
1602
|
+
contentType,
|
|
1603
|
+
multipartChunkSize,
|
|
1604
|
+
baseCDN,
|
|
1605
|
+
checkForUrlDuplicates,
|
|
1606
|
+
saveUrlForRecurrentUploads
|
|
1607
|
+
}).then((fileInfo) => fileInfo.uuid);
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
// Do not request file info by uuid before creating group because this isn't necessary
|
|
1611
|
+
return file;
|
|
1612
|
+
}
|
|
1613
|
+
})).then((uuids) => {
|
|
1598
1614
|
return group(uuids, {
|
|
1599
1615
|
publicKey,
|
|
1600
1616
|
baseURL,
|
|
@@ -1608,7 +1624,7 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
|
|
|
1608
1624
|
retryThrottledRequestMaxTimes,
|
|
1609
1625
|
retryNetworkErrorMaxTimes
|
|
1610
1626
|
})
|
|
1611
|
-
.then((groupInfo) => new UploadcareGroup(groupInfo,
|
|
1627
|
+
.then((groupInfo) => new UploadcareGroup(groupInfo, { baseCDN }))
|
|
1612
1628
|
.then((group) => {
|
|
1613
1629
|
onProgress && onProgress({ isComputable: true, value: 1 });
|
|
1614
1630
|
return group;
|
|
@@ -1679,32 +1695,32 @@ class UploadClient {
|
|
|
1679
1695
|
}
|
|
1680
1696
|
|
|
1681
1697
|
class Queue {
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1698
|
+
_concurrency = 1;
|
|
1699
|
+
_pending = [];
|
|
1700
|
+
_running = 0;
|
|
1701
|
+
_resolvers = new Map();
|
|
1702
|
+
_rejectors = new Map();
|
|
1687
1703
|
constructor(concurrency) {
|
|
1688
|
-
this
|
|
1704
|
+
this._concurrency = concurrency;
|
|
1689
1705
|
}
|
|
1690
|
-
|
|
1691
|
-
const tasksLeft = this
|
|
1706
|
+
_run() {
|
|
1707
|
+
const tasksLeft = this._concurrency - this._running;
|
|
1692
1708
|
for (let i = 0; i < tasksLeft; i++) {
|
|
1693
|
-
const task = this
|
|
1709
|
+
const task = this._pending.shift();
|
|
1694
1710
|
if (!task) {
|
|
1695
1711
|
return;
|
|
1696
1712
|
}
|
|
1697
|
-
const resolver = this
|
|
1698
|
-
const rejector = this
|
|
1713
|
+
const resolver = this._resolvers.get(task);
|
|
1714
|
+
const rejector = this._rejectors.get(task);
|
|
1699
1715
|
if (!resolver || !rejector)
|
|
1700
1716
|
throw new Error('Unexpected behavior: resolver or rejector is undefined');
|
|
1701
|
-
this
|
|
1717
|
+
this._running += 1;
|
|
1702
1718
|
task()
|
|
1703
1719
|
.finally(() => {
|
|
1704
|
-
this
|
|
1705
|
-
this
|
|
1706
|
-
this
|
|
1707
|
-
this
|
|
1720
|
+
this._resolvers.delete(task);
|
|
1721
|
+
this._rejectors.delete(task);
|
|
1722
|
+
this._running -= 1;
|
|
1723
|
+
this._run();
|
|
1708
1724
|
})
|
|
1709
1725
|
.then((value) => resolver(value))
|
|
1710
1726
|
.catch((error) => rejector(error));
|
|
@@ -1712,24 +1728,24 @@ class Queue {
|
|
|
1712
1728
|
}
|
|
1713
1729
|
add(task) {
|
|
1714
1730
|
return new Promise((resolve, reject) => {
|
|
1715
|
-
this
|
|
1716
|
-
this
|
|
1717
|
-
this
|
|
1718
|
-
this
|
|
1731
|
+
this._resolvers.set(task, resolve);
|
|
1732
|
+
this._rejectors.set(task, reject);
|
|
1733
|
+
this._pending.push(task);
|
|
1734
|
+
this._run();
|
|
1719
1735
|
});
|
|
1720
1736
|
}
|
|
1721
1737
|
get pending() {
|
|
1722
|
-
return this
|
|
1738
|
+
return this._pending.length;
|
|
1723
1739
|
}
|
|
1724
1740
|
get running() {
|
|
1725
|
-
return this
|
|
1741
|
+
return this._running;
|
|
1726
1742
|
}
|
|
1727
1743
|
set concurrency(value) {
|
|
1728
|
-
this
|
|
1729
|
-
this
|
|
1744
|
+
this._concurrency = value;
|
|
1745
|
+
this._run();
|
|
1730
1746
|
}
|
|
1731
1747
|
get concurrency() {
|
|
1732
|
-
return this
|
|
1748
|
+
return this._concurrency;
|
|
1733
1749
|
}
|
|
1734
1750
|
}
|
|
1735
1751
|
|
package/dist/index.d.ts
CHANGED
|
@@ -126,12 +126,15 @@ export type FileInfo = {
|
|
|
126
126
|
s3Bucket?: string;
|
|
127
127
|
metadata?: Metadata;
|
|
128
128
|
};
|
|
129
|
+
export type GroupFileInfo = FileInfo & {
|
|
130
|
+
defaultEffects: string;
|
|
131
|
+
};
|
|
129
132
|
export type GroupInfo = {
|
|
130
133
|
datetimeCreated: string;
|
|
131
134
|
datetimeStored: string | null;
|
|
132
135
|
filesCount: string;
|
|
133
136
|
cdnUrl: string;
|
|
134
|
-
files:
|
|
137
|
+
files: (GroupFileInfo | null)[];
|
|
135
138
|
url: string;
|
|
136
139
|
id: GroupId;
|
|
137
140
|
};
|
|
@@ -347,7 +350,8 @@ export declare class UploadcareFile {
|
|
|
347
350
|
readonly contentInfo: null | ContentInfo;
|
|
348
351
|
readonly metadata: null | Metadata;
|
|
349
352
|
readonly s3Bucket: null | string;
|
|
350
|
-
|
|
353
|
+
readonly defaultEffects: null | string;
|
|
354
|
+
constructor(fileInfo: FileInfo | GroupFileInfo, { baseCDN, fileName }?: {
|
|
351
355
|
baseCDN?: string;
|
|
352
356
|
fileName?: string;
|
|
353
357
|
});
|
|
@@ -449,7 +453,9 @@ export declare class UploadcareGroup {
|
|
|
449
453
|
readonly files: UploadcareFile[];
|
|
450
454
|
readonly createdAt: string;
|
|
451
455
|
readonly storedAt: string | null;
|
|
452
|
-
constructor(groupInfo: GroupInfo,
|
|
456
|
+
constructor(groupInfo: GroupInfo, { baseCDN }?: {
|
|
457
|
+
baseCDN?: string;
|
|
458
|
+
});
|
|
453
459
|
}
|
|
454
460
|
export type GroupFromOptions = {
|
|
455
461
|
jsonpCallback?: string;
|
|
@@ -474,8 +480,13 @@ export declare class UploadClient {
|
|
|
474
480
|
}
|
|
475
481
|
export type Task<T = unknown> = () => Promise<T>;
|
|
476
482
|
export declare class Queue {
|
|
477
|
-
|
|
483
|
+
private _concurrency;
|
|
484
|
+
private _pending;
|
|
485
|
+
private _running;
|
|
486
|
+
private _resolvers;
|
|
487
|
+
private _rejectors;
|
|
478
488
|
constructor(concurrency: number);
|
|
489
|
+
private _run;
|
|
479
490
|
add<T>(task: Task<T>): Promise<T>;
|
|
480
491
|
get pending(): number;
|
|
481
492
|
get running(): number;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/upload-client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Library for work with Uploadcare Upload API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.node.mjs",
|
|
7
7
|
"browser": "./dist/esm/index.browser.mjs",
|
|
8
|
-
"react-native": "./dist/index.react-native.
|
|
8
|
+
"react-native": "./dist/index.react-native.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"koa-body": "5.0.0",
|
|
91
91
|
"mock-socket": "9.0.3",
|
|
92
92
|
"start-server-and-test": "1.14.0",
|
|
93
|
-
"@uploadcare/api-client-utils": "^6.
|
|
93
|
+
"@uploadcare/api-client-utils": "^6.7.0",
|
|
94
94
|
"chalk": "^4.1.2"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|