@uploadcare/upload-client 6.6.0 → 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.
@@ -272,15 +272,14 @@ const request = ({ method, url, data, headers = {}, signal, onProgress }) => new
272
272
  }
273
273
  });
274
274
 
275
+ const isBuffer = (data) => false;
276
+
275
277
  const isBlob = (data) => {
276
278
  return typeof Blob !== 'undefined' && data instanceof Blob;
277
279
  };
278
280
  const isFile = (data) => {
279
281
  return typeof File !== 'undefined' && data instanceof File;
280
282
  };
281
- const isBuffer = (data) => {
282
- return typeof Buffer !== 'undefined' && data instanceof Buffer;
283
- };
284
283
  const isReactNativeAsset = (data) => {
285
284
  return (!!data &&
286
285
  typeof data === 'object' &&
@@ -289,7 +288,7 @@ const isReactNativeAsset = (data) => {
289
288
  typeof data.uri === 'string');
290
289
  };
291
290
  const isFileData = (data) => {
292
- return (isBlob(data) || isFile(data) || isBuffer(data) || isReactNativeAsset(data));
291
+ return (isBlob(data) || isFile(data) || isBuffer() || isReactNativeAsset(data));
293
292
  };
294
293
 
295
294
  const getFileOptions = () => [];
@@ -406,7 +405,7 @@ const getUrl = (base, path, query) => {
406
405
  return url.toString();
407
406
  };
408
407
 
409
- var version = '6.6.0';
408
+ var version = '6.7.0';
410
409
 
411
410
  const LIBRARY_NAME = 'UploadcareUploadClient';
412
411
  const LIBRARY_VERSION = version;
@@ -461,7 +460,7 @@ const getFileName = (file) => {
461
460
  if (isFile(file) && file.name) {
462
461
  filename = file.name;
463
462
  }
464
- else if (isBlob(file) || isBuffer(file)) {
463
+ else if (isBlob(file) || isBuffer()) {
465
464
  filename = '';
466
465
  }
467
466
  else if (isReactNativeAsset(file) && file.name) {
@@ -780,6 +779,9 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
780
779
  });
781
780
  }
782
781
 
782
+ function isGroupFileInfo(fileInfo) {
783
+ return 'defaultEffects' in fileInfo;
784
+ }
783
785
  class UploadcareFile {
784
786
  uuid;
785
787
  name = null;
@@ -795,6 +797,7 @@ class UploadcareFile {
795
797
  contentInfo = null;
796
798
  metadata = null;
797
799
  s3Bucket = null;
800
+ defaultEffects = null;
798
801
  constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
799
802
  const { uuid, s3Bucket } = fileInfo;
800
803
  const cdnUrl = getUrl(baseCDN, `${uuid}/`);
@@ -815,6 +818,9 @@ class UploadcareFile {
815
818
  this.metadata = fileInfo.metadata || null;
816
819
  this.s3Bucket = s3Bucket || null;
817
820
  this.s3Url = s3Url;
821
+ if (isGroupFileInfo(fileInfo)) {
822
+ this.defaultEffects = fileInfo.defaultEffects;
823
+ }
818
824
  }
819
825
  }
820
826
 
@@ -1226,9 +1232,6 @@ const getBlobFromReactNativeAsset = async (asset) => {
1226
1232
  };
1227
1233
 
1228
1234
  const getFileSize = async (file) => {
1229
- if (isBuffer(file)) {
1230
- return file.length;
1231
- }
1232
1235
  if (isFile(file) || isBlob(file)) {
1233
1236
  return file.size;
1234
1237
  }
@@ -1515,14 +1518,16 @@ class UploadcareGroup {
1515
1518
  files;
1516
1519
  createdAt;
1517
1520
  storedAt = null;
1518
- constructor(groupInfo, files) {
1521
+ constructor(groupInfo, { baseCDN = defaultSettings.baseCDN } = {}) {
1519
1522
  this.uuid = groupInfo.id;
1520
1523
  this.filesCount = groupInfo.filesCount;
1521
- this.totalSize = Object.values(groupInfo.files).reduce((acc, file) => acc + file.size, 0);
1524
+ const groupFiles = groupInfo.files.filter(Boolean);
1525
+ this.totalSize = Object.values(groupFiles).reduce((acc, file) => acc + file.size, 0);
1522
1526
  this.isStored = !!groupInfo.datetimeStored;
1523
- this.isImage = !!Object.values(groupInfo.files).filter((file) => file.isImage).length;
1527
+ this.isImage = !!Object.values(groupFiles).filter((file) => file.isImage)
1528
+ .length;
1524
1529
  this.cdnUrl = groupInfo.cdnUrl;
1525
- this.files = files;
1530
+ this.files = groupFiles.map((fileInfo) => new UploadcareFile(fileInfo, { baseCDN }));
1526
1531
  this.createdAt = groupInfo.datetimeCreated;
1527
1532
  this.storedAt = groupInfo.datetimeStored;
1528
1533
  }
@@ -1580,27 +1585,34 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
1580
1585
  onProgress({ isComputable: true, value: normalize(progressValues) });
1581
1586
  };
1582
1587
  };
1583
- return Promise.all(data.map((file, index) => uploadFile(file, {
1584
- publicKey,
1585
- fileName,
1586
- baseURL,
1587
- secureSignature,
1588
- secureExpire,
1589
- store,
1590
- signal,
1591
- onProgress: createProgressHandler(filesCount, index),
1592
- source,
1593
- integration,
1594
- userAgent,
1595
- retryThrottledRequestMaxTimes,
1596
- retryNetworkErrorMaxTimes,
1597
- contentType,
1598
- multipartChunkSize,
1599
- baseCDN,
1600
- checkForUrlDuplicates,
1601
- saveUrlForRecurrentUploads
1602
- }))).then((files) => {
1603
- const uuids = files.map((file) => file.uuid);
1588
+ return Promise.all(data.map((file, index) => {
1589
+ if (isFileData(file) || isUrl(file)) {
1590
+ return uploadFile(file, {
1591
+ publicKey,
1592
+ fileName,
1593
+ baseURL,
1594
+ secureSignature,
1595
+ secureExpire,
1596
+ store,
1597
+ signal,
1598
+ onProgress: createProgressHandler(filesCount, index),
1599
+ source,
1600
+ integration,
1601
+ userAgent,
1602
+ retryThrottledRequestMaxTimes,
1603
+ retryNetworkErrorMaxTimes,
1604
+ contentType,
1605
+ multipartChunkSize,
1606
+ baseCDN,
1607
+ checkForUrlDuplicates,
1608
+ saveUrlForRecurrentUploads
1609
+ }).then((fileInfo) => fileInfo.uuid);
1610
+ }
1611
+ else {
1612
+ // Do not request file info by uuid before creating group because this isn't necessary
1613
+ return file;
1614
+ }
1615
+ })).then((uuids) => {
1604
1616
  return group(uuids, {
1605
1617
  publicKey,
1606
1618
  baseURL,
@@ -1614,7 +1626,7 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
1614
1626
  retryThrottledRequestMaxTimes,
1615
1627
  retryNetworkErrorMaxTimes
1616
1628
  })
1617
- .then((groupInfo) => new UploadcareGroup(groupInfo, files))
1629
+ .then((groupInfo) => new UploadcareGroup(groupInfo, { baseCDN }))
1618
1630
  .then((group) => {
1619
1631
  onProgress && onProgress({ isComputable: true, value: 1 });
1620
1632
  return group;
@@ -1685,32 +1697,32 @@ class UploadClient {
1685
1697
  }
1686
1698
 
1687
1699
  class Queue {
1688
- #concurrency = 1;
1689
- #pending = [];
1690
- #running = 0;
1691
- #resolvers = new WeakMap();
1692
- #rejectors = new WeakMap();
1700
+ _concurrency = 1;
1701
+ _pending = [];
1702
+ _running = 0;
1703
+ _resolvers = new Map();
1704
+ _rejectors = new Map();
1693
1705
  constructor(concurrency) {
1694
- this.#concurrency = concurrency;
1706
+ this._concurrency = concurrency;
1695
1707
  }
1696
- #run() {
1697
- const tasksLeft = this.#concurrency - this.#running;
1708
+ _run() {
1709
+ const tasksLeft = this._concurrency - this._running;
1698
1710
  for (let i = 0; i < tasksLeft; i++) {
1699
- const task = this.#pending.shift();
1711
+ const task = this._pending.shift();
1700
1712
  if (!task) {
1701
1713
  return;
1702
1714
  }
1703
- const resolver = this.#resolvers.get(task);
1704
- const rejector = this.#rejectors.get(task);
1715
+ const resolver = this._resolvers.get(task);
1716
+ const rejector = this._rejectors.get(task);
1705
1717
  if (!resolver || !rejector)
1706
1718
  throw new Error('Unexpected behavior: resolver or rejector is undefined');
1707
- this.#running += 1;
1719
+ this._running += 1;
1708
1720
  task()
1709
1721
  .finally(() => {
1710
- this.#resolvers.delete(task);
1711
- this.#rejectors.delete(task);
1712
- this.#running -= 1;
1713
- this.#run();
1722
+ this._resolvers.delete(task);
1723
+ this._rejectors.delete(task);
1724
+ this._running -= 1;
1725
+ this._run();
1714
1726
  })
1715
1727
  .then((value) => resolver(value))
1716
1728
  .catch((error) => rejector(error));
@@ -1718,24 +1730,24 @@ class Queue {
1718
1730
  }
1719
1731
  add(task) {
1720
1732
  return new Promise((resolve, reject) => {
1721
- this.#resolvers.set(task, resolve);
1722
- this.#rejectors.set(task, reject);
1723
- this.#pending.push(task);
1724
- this.#run();
1733
+ this._resolvers.set(task, resolve);
1734
+ this._rejectors.set(task, reject);
1735
+ this._pending.push(task);
1736
+ this._run();
1725
1737
  });
1726
1738
  }
1727
1739
  get pending() {
1728
- return this.#pending.length;
1740
+ return this._pending.length;
1729
1741
  }
1730
1742
  get running() {
1731
- return this.#running;
1743
+ return this._running;
1732
1744
  }
1733
1745
  set concurrency(value) {
1734
- this.#concurrency = value;
1735
- this.#run();
1746
+ this._concurrency = value;
1747
+ this._run();
1736
1748
  }
1737
1749
  get concurrency() {
1738
- return this.#concurrency;
1750
+ return this._concurrency;
1739
1751
  }
1740
1752
  }
1741
1753
 
@@ -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: FileInfo[];
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
- constructor(fileInfo: FileInfo, { baseCDN, fileName }?: {
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, files: UploadcareFile[]);
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
- #private;
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;
@@ -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: FileInfo[];
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
- constructor(fileInfo: FileInfo, { baseCDN, fileName }?: {
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, files: UploadcareFile[]);
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
- #private;
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;
@@ -279,15 +279,14 @@ const getFileOptions = ({ name }) => name ? [name] : [];
279
279
  const transformFile = identity;
280
280
  var getFormData = () => new FormData();
281
281
 
282
+ const isBuffer = (data) => false;
283
+
282
284
  const isBlob = (data) => {
283
285
  return typeof Blob !== 'undefined' && data instanceof Blob;
284
286
  };
285
287
  const isFile = (data) => {
286
288
  return typeof File !== 'undefined' && data instanceof File;
287
289
  };
288
- const isBuffer = (data) => {
289
- return typeof Buffer !== 'undefined' && data instanceof Buffer;
290
- };
291
290
  const isReactNativeAsset = (data) => {
292
291
  return (!!data &&
293
292
  typeof data === 'object' &&
@@ -296,7 +295,7 @@ const isReactNativeAsset = (data) => {
296
295
  typeof data.uri === 'string');
297
296
  };
298
297
  const isFileData = (data) => {
299
- return (isBlob(data) || isFile(data) || isBuffer(data) || isReactNativeAsset(data));
298
+ return (isBlob(data) || isFile(data) || isBuffer() || isReactNativeAsset(data));
300
299
  };
301
300
 
302
301
  const isSimpleValue = (value) => {
@@ -396,7 +395,7 @@ const getUrl = (base, path, query) => {
396
395
  return url.toString();
397
396
  };
398
397
 
399
- var version = '6.6.0';
398
+ var version = '6.7.0';
400
399
 
401
400
  const LIBRARY_NAME = 'UploadcareUploadClient';
402
401
  const LIBRARY_VERSION = version;
@@ -451,7 +450,7 @@ const getFileName = (file) => {
451
450
  if (isFile(file) && file.name) {
452
451
  filename = file.name;
453
452
  }
454
- else if (isBlob(file) || isBuffer(file)) {
453
+ else if (isBlob(file) || isBuffer()) {
455
454
  filename = '';
456
455
  }
457
456
  else if (isReactNativeAsset(file) && file.name) {
@@ -770,6 +769,9 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
770
769
  });
771
770
  }
772
771
 
772
+ function isGroupFileInfo(fileInfo) {
773
+ return 'defaultEffects' in fileInfo;
774
+ }
773
775
  class UploadcareFile {
774
776
  uuid;
775
777
  name = null;
@@ -785,6 +787,7 @@ class UploadcareFile {
785
787
  contentInfo = null;
786
788
  metadata = null;
787
789
  s3Bucket = null;
790
+ defaultEffects = null;
788
791
  constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
789
792
  const { uuid, s3Bucket } = fileInfo;
790
793
  const cdnUrl = getUrl(baseCDN, `${uuid}/`);
@@ -805,6 +808,9 @@ class UploadcareFile {
805
808
  this.metadata = fileInfo.metadata || null;
806
809
  this.s3Bucket = s3Bucket || null;
807
810
  this.s3Url = s3Url;
811
+ if (isGroupFileInfo(fileInfo)) {
812
+ this.defaultEffects = fileInfo.defaultEffects;
813
+ }
808
814
  }
809
815
  }
810
816
 
@@ -1216,9 +1222,6 @@ const getBlobFromReactNativeAsset = async (asset) => {
1216
1222
  };
1217
1223
 
1218
1224
  const getFileSize = async (file) => {
1219
- if (isBuffer(file)) {
1220
- return file.length;
1221
- }
1222
1225
  if (isFile(file) || isBlob(file)) {
1223
1226
  return file.size;
1224
1227
  }
@@ -1485,14 +1488,16 @@ class UploadcareGroup {
1485
1488
  files;
1486
1489
  createdAt;
1487
1490
  storedAt = null;
1488
- constructor(groupInfo, files) {
1491
+ constructor(groupInfo, { baseCDN = defaultSettings.baseCDN } = {}) {
1489
1492
  this.uuid = groupInfo.id;
1490
1493
  this.filesCount = groupInfo.filesCount;
1491
- this.totalSize = Object.values(groupInfo.files).reduce((acc, file) => acc + file.size, 0);
1494
+ const groupFiles = groupInfo.files.filter(Boolean);
1495
+ this.totalSize = Object.values(groupFiles).reduce((acc, file) => acc + file.size, 0);
1492
1496
  this.isStored = !!groupInfo.datetimeStored;
1493
- this.isImage = !!Object.values(groupInfo.files).filter((file) => file.isImage).length;
1497
+ this.isImage = !!Object.values(groupFiles).filter((file) => file.isImage)
1498
+ .length;
1494
1499
  this.cdnUrl = groupInfo.cdnUrl;
1495
- this.files = files;
1500
+ this.files = groupFiles.map((fileInfo) => new UploadcareFile(fileInfo, { baseCDN }));
1496
1501
  this.createdAt = groupInfo.datetimeCreated;
1497
1502
  this.storedAt = groupInfo.datetimeStored;
1498
1503
  }
@@ -1550,27 +1555,34 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
1550
1555
  onProgress({ isComputable: true, value: normalize(progressValues) });
1551
1556
  };
1552
1557
  };
1553
- return Promise.all(data.map((file, index) => uploadFile(file, {
1554
- publicKey,
1555
- fileName,
1556
- baseURL,
1557
- secureSignature,
1558
- secureExpire,
1559
- store,
1560
- signal,
1561
- onProgress: createProgressHandler(filesCount, index),
1562
- source,
1563
- integration,
1564
- userAgent,
1565
- retryThrottledRequestMaxTimes,
1566
- retryNetworkErrorMaxTimes,
1567
- contentType,
1568
- multipartChunkSize,
1569
- baseCDN,
1570
- checkForUrlDuplicates,
1571
- saveUrlForRecurrentUploads
1572
- }))).then((files) => {
1573
- const uuids = files.map((file) => file.uuid);
1558
+ return Promise.all(data.map((file, index) => {
1559
+ if (isFileData(file) || isUrl(file)) {
1560
+ return uploadFile(file, {
1561
+ publicKey,
1562
+ fileName,
1563
+ baseURL,
1564
+ secureSignature,
1565
+ secureExpire,
1566
+ store,
1567
+ signal,
1568
+ onProgress: createProgressHandler(filesCount, index),
1569
+ source,
1570
+ integration,
1571
+ userAgent,
1572
+ retryThrottledRequestMaxTimes,
1573
+ retryNetworkErrorMaxTimes,
1574
+ contentType,
1575
+ multipartChunkSize,
1576
+ baseCDN,
1577
+ checkForUrlDuplicates,
1578
+ saveUrlForRecurrentUploads
1579
+ }).then((fileInfo) => fileInfo.uuid);
1580
+ }
1581
+ else {
1582
+ // Do not request file info by uuid before creating group because this isn't necessary
1583
+ return file;
1584
+ }
1585
+ })).then((uuids) => {
1574
1586
  return group(uuids, {
1575
1587
  publicKey,
1576
1588
  baseURL,
@@ -1584,7 +1596,7 @@ function uploadFileGroup(data, { publicKey, fileName, baseURL = defaultSettings.
1584
1596
  retryThrottledRequestMaxTimes,
1585
1597
  retryNetworkErrorMaxTimes
1586
1598
  })
1587
- .then((groupInfo) => new UploadcareGroup(groupInfo, files))
1599
+ .then((groupInfo) => new UploadcareGroup(groupInfo, { baseCDN }))
1588
1600
  .then((group) => {
1589
1601
  onProgress && onProgress({ isComputable: true, value: 1 });
1590
1602
  return group;
@@ -1655,32 +1667,32 @@ class UploadClient {
1655
1667
  }
1656
1668
 
1657
1669
  class Queue {
1658
- #concurrency = 1;
1659
- #pending = [];
1660
- #running = 0;
1661
- #resolvers = new WeakMap();
1662
- #rejectors = new WeakMap();
1670
+ _concurrency = 1;
1671
+ _pending = [];
1672
+ _running = 0;
1673
+ _resolvers = new Map();
1674
+ _rejectors = new Map();
1663
1675
  constructor(concurrency) {
1664
- this.#concurrency = concurrency;
1676
+ this._concurrency = concurrency;
1665
1677
  }
1666
- #run() {
1667
- const tasksLeft = this.#concurrency - this.#running;
1678
+ _run() {
1679
+ const tasksLeft = this._concurrency - this._running;
1668
1680
  for (let i = 0; i < tasksLeft; i++) {
1669
- const task = this.#pending.shift();
1681
+ const task = this._pending.shift();
1670
1682
  if (!task) {
1671
1683
  return;
1672
1684
  }
1673
- const resolver = this.#resolvers.get(task);
1674
- const rejector = this.#rejectors.get(task);
1685
+ const resolver = this._resolvers.get(task);
1686
+ const rejector = this._rejectors.get(task);
1675
1687
  if (!resolver || !rejector)
1676
1688
  throw new Error('Unexpected behavior: resolver or rejector is undefined');
1677
- this.#running += 1;
1689
+ this._running += 1;
1678
1690
  task()
1679
1691
  .finally(() => {
1680
- this.#resolvers.delete(task);
1681
- this.#rejectors.delete(task);
1682
- this.#running -= 1;
1683
- this.#run();
1692
+ this._resolvers.delete(task);
1693
+ this._rejectors.delete(task);
1694
+ this._running -= 1;
1695
+ this._run();
1684
1696
  })
1685
1697
  .then((value) => resolver(value))
1686
1698
  .catch((error) => rejector(error));
@@ -1688,24 +1700,24 @@ class Queue {
1688
1700
  }
1689
1701
  add(task) {
1690
1702
  return new Promise((resolve, reject) => {
1691
- this.#resolvers.set(task, resolve);
1692
- this.#rejectors.set(task, reject);
1693
- this.#pending.push(task);
1694
- this.#run();
1703
+ this._resolvers.set(task, resolve);
1704
+ this._rejectors.set(task, reject);
1705
+ this._pending.push(task);
1706
+ this._run();
1695
1707
  });
1696
1708
  }
1697
1709
  get pending() {
1698
- return this.#pending.length;
1710
+ return this._pending.length;
1699
1711
  }
1700
1712
  get running() {
1701
- return this.#running;
1713
+ return this._running;
1702
1714
  }
1703
1715
  set concurrency(value) {
1704
- this.#concurrency = value;
1705
- this.#run();
1716
+ this._concurrency = value;
1717
+ this._run();
1706
1718
  }
1707
1719
  get concurrency() {
1708
- return this.#concurrency;
1720
+ return this._concurrency;
1709
1721
  }
1710
1722
  }
1711
1723
 
@@ -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: FileInfo[];
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
- constructor(fileInfo: FileInfo, { baseCDN, fileName }?: {
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, files: UploadcareFile[]);
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
- #private;
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;