@ardrive/turbo-sdk 1.31.0-alpha.3 → 1.31.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 CHANGED
@@ -627,7 +627,7 @@ const uploadResult = await turbo.uploadFile({
627
627
 
628
628
  ##### Customize Multi-Part Upload Behavior
629
629
 
630
- By default, the Turbo upload methods will split files into chunks that are larger than 10 MiB and send these chunks to the upload service multi-part endpoints. This behavior can be customized with the following inputs:
630
+ By default, the Turbo upload methods will split files that are larger than 10 MiB into chunks and send them to the upload service multi-part endpoints. This behavior can be customized with the following inputs:
631
631
 
632
632
  - `chunkByteCount`: The maximum size in bytes for each chunk. Must be between 5 MiB and 500 MiB. Defaults to 5 MiB.
633
633
  - `maxChunkConcurrency`: The maximum number of chunks to upload concurrently. Defaults to 5. Reducing concurrency will slow down uploads, but reduce memory utilization and serialize network calls. Increasing it will upload faster, but can strain available resources.
@@ -810,7 +810,7 @@ Revokes all credits shared from the connected wallet to the provided native addr
810
810
 
811
811
  ```typescript
812
812
  const revokedApprovals = await turbo.revokeCredits({
813
- approvedAddress: '2cor...VUa',
813
+ revokedAddress: '2cor...VUa',
814
814
  });
815
815
  ```
816
816
 
@@ -220928,7 +220928,7 @@ var import_winston = __toESM(require_winston(), 1);
220928
220928
  init_dirname();
220929
220929
  init_buffer2();
220930
220930
  init_process2();
220931
- var version21 = "1.31.0-alpha.2";
220931
+ var version21 = "1.31.0-alpha.3";
220932
220932
 
220933
220933
  // src/common/logger.ts
220934
220934
  var TurboWinstonLogger = class _TurboWinstonLogger {
@@ -274605,15 +274605,15 @@ var ChunkedUploader = class {
274605
274605
  }
274606
274606
  async finalizeUpload(uploadId, dataItemByteCount, paidBy, signal) {
274607
274607
  const fileSizeInGiB = Math.ceil(this.toGiB(dataItemByteCount));
274608
- const defaultMaxWaitTimeMins = fileSizeInGiB;
274609
- const maxWaitTimeMs = this.maxFinalizeMs ?? defaultMaxWaitTimeMins * 60 * 1e3;
274608
+ const defaultMaxWaitTimeMins = fileSizeInGiB * 2.5;
274609
+ const maxWaitTimeMs = this.maxFinalizeMs ?? Math.floor(defaultMaxWaitTimeMins * 60 * 1e3);
274610
274610
  const minimumWaitPerStepMs = (
274611
274611
  // Per step, files smaller than 100MB will wait 2 second,
274612
274612
  dataItemByteCount < 1024 * 1024 * 100 ? 2e3 : (
274613
- // files smaller than 3 GiB will wait 3 seconds,
274614
- dataItemByteCount < 1024 * 1024 * 1024 * 3 ? 3e3 : (
274615
- // and larger files will wait 1 second per GiB with max of 10 seconds
274616
- Math.max(1e3 * fileSizeInGiB, 1e4)
274613
+ // files smaller than 3 GiB will wait 4 seconds,
274614
+ dataItemByteCount < 1024 * 1024 * 1024 * 3 ? 4e3 : (
274615
+ // and larger files will wait 1.5 second per GiB with max of 15 seconds
274616
+ Math.max(1500 * fileSizeInGiB, 15e3)
274617
274617
  )
274618
274618
  )
274619
274619
  );
@@ -274632,7 +274632,7 @@ var ChunkedUploader = class {
274632
274632
  signal
274633
274633
  });
274634
274634
  this.logger.debug(
274635
- `Confirming upload to Turbo with uploadId ${uploadId} for up to ${defaultMaxWaitTimeMins} minutes.`
274635
+ `Confirming upload to Turbo with uploadId ${uploadId} for up to ${maxWaitTimeMs / 1e3 / 60} minutes.`
274636
274636
  );
274637
274637
  const startTime = Date.now();
274638
274638
  const cutoffTime = startTime + maxWaitTimeMs;
@@ -215,17 +215,17 @@ class ChunkedUploader {
215
215
  async finalizeUpload(uploadId, dataItemByteCount, paidBy, signal) {
216
216
  // Wait up to 1 minute per GiB of data for the upload to finalize
217
217
  const fileSizeInGiB = Math.ceil(this.toGiB(dataItemByteCount));
218
- const defaultMaxWaitTimeMins = fileSizeInGiB;
219
- const maxWaitTimeMs = this.maxFinalizeMs ?? defaultMaxWaitTimeMins * 60 * 1000;
218
+ const defaultMaxWaitTimeMins = fileSizeInGiB * 2.5;
219
+ const maxWaitTimeMs = this.maxFinalizeMs ?? Math.floor(defaultMaxWaitTimeMins * 60 * 1000);
220
220
  const minimumWaitPerStepMs =
221
221
  // Per step, files smaller than 100MB will wait 2 second,
222
222
  dataItemByteCount < 1024 * 1024 * 100
223
223
  ? 2000
224
- : // files smaller than 3 GiB will wait 3 seconds,
224
+ : // files smaller than 3 GiB will wait 4 seconds,
225
225
  dataItemByteCount < 1024 * 1024 * 1024 * 3
226
- ? 3000
227
- : // and larger files will wait 1 second per GiB with max of 10 seconds
228
- Math.max(1000 * fileSizeInGiB, 10000);
226
+ ? 4000
227
+ : // and larger files will wait 1.5 second per GiB with max of 15 seconds
228
+ Math.max(1500 * fileSizeInGiB, 15000);
229
229
  const paidByHeader = {};
230
230
  if (paidBy !== undefined) {
231
231
  paidByHeader['x-paid-by'] = Array.isArray(paidBy)
@@ -242,7 +242,7 @@ class ChunkedUploader {
242
242
  },
243
243
  signal,
244
244
  });
245
- this.logger.debug(`Confirming upload to Turbo with uploadId ${uploadId} for up to ${defaultMaxWaitTimeMins} minutes.`);
245
+ this.logger.debug(`Confirming upload to Turbo with uploadId ${uploadId} for up to ${maxWaitTimeMs / 1000 / 60} minutes.`);
246
246
  const startTime = Date.now();
247
247
  const cutoffTime = startTime + maxWaitTimeMs;
248
248
  let attempts = 0;
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '1.31.0-alpha.3';
20
+ exports.version = '1.31.0';
@@ -209,17 +209,17 @@ export class ChunkedUploader {
209
209
  async finalizeUpload(uploadId, dataItemByteCount, paidBy, signal) {
210
210
  // Wait up to 1 minute per GiB of data for the upload to finalize
211
211
  const fileSizeInGiB = Math.ceil(this.toGiB(dataItemByteCount));
212
- const defaultMaxWaitTimeMins = fileSizeInGiB;
213
- const maxWaitTimeMs = this.maxFinalizeMs ?? defaultMaxWaitTimeMins * 60 * 1000;
212
+ const defaultMaxWaitTimeMins = fileSizeInGiB * 2.5;
213
+ const maxWaitTimeMs = this.maxFinalizeMs ?? Math.floor(defaultMaxWaitTimeMins * 60 * 1000);
214
214
  const minimumWaitPerStepMs =
215
215
  // Per step, files smaller than 100MB will wait 2 second,
216
216
  dataItemByteCount < 1024 * 1024 * 100
217
217
  ? 2000
218
- : // files smaller than 3 GiB will wait 3 seconds,
218
+ : // files smaller than 3 GiB will wait 4 seconds,
219
219
  dataItemByteCount < 1024 * 1024 * 1024 * 3
220
- ? 3000
221
- : // and larger files will wait 1 second per GiB with max of 10 seconds
222
- Math.max(1000 * fileSizeInGiB, 10000);
220
+ ? 4000
221
+ : // and larger files will wait 1.5 second per GiB with max of 15 seconds
222
+ Math.max(1500 * fileSizeInGiB, 15000);
223
223
  const paidByHeader = {};
224
224
  if (paidBy !== undefined) {
225
225
  paidByHeader['x-paid-by'] = Array.isArray(paidBy)
@@ -236,7 +236,7 @@ export class ChunkedUploader {
236
236
  },
237
237
  signal,
238
238
  });
239
- this.logger.debug(`Confirming upload to Turbo with uploadId ${uploadId} for up to ${defaultMaxWaitTimeMins} minutes.`);
239
+ this.logger.debug(`Confirming upload to Turbo with uploadId ${uploadId} for up to ${maxWaitTimeMs / 1000 / 60} minutes.`);
240
240
  const startTime = Date.now();
241
241
  const cutoffTime = startTime + maxWaitTimeMs;
242
242
  let attempts = 0;
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '1.31.0-alpha.3';
17
+ export const version = '1.31.0';
@@ -1 +1 @@
1
- {"version":3,"file":"chunked.d.ts","sourceRoot":"","sources":["../../../src/common/chunked.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,WAAW,EAEX,2BAA2B,EAC3B,0BAA0B,EAG3B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,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V,IAAI,EACJ,KAAK,EACL,mBAAgD,EAChD,aAAa,EACb,cAAsC,EACtC,MAAmC,EACnC,YAAqB,EACrB,iBAAiB,GAClB,EAAE;QACD,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,gBAAgB,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,WAAW,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,YAAY,CAAC,EAAE,iBAAiB,CAAC;QACjC,iBAAiB,EAAE,SAAS,CAAC;KAC9B;IAqBD,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,iBAAiB;IAwDzB;;OAEG;YACW,UAAU;IAqBX,MAAM,CAAC,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,MAAM,EACN,MAAM,GACP,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAwHpE,OAAO,CAAC,KAAK;YAIC,cAAc;CAoG7B;AAED;;;GAGG;AACH,wBAAuB,eAAe,CACpC,MAAM,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,EAC7C,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAMvC;AACD,wBAAuB,uBAAuB,CAC5C,MAAM,EAAE,QAAQ,EAChB,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAkDvC;AAED,wBAAuB,6BAA6B,CAClD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAyDvC"}
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "1.31.0-alpha.2";
16
+ export declare const version = "1.31.0-alpha.3";
17
17
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.31.0-alpha.3",
3
+ "version": "1.31.0",
4
4
  "main": "./lib/cjs/node/index.js",
5
5
  "types": "./lib/types/node/index.d.ts",
6
6
  "module": "./lib/esm/node/index.js",