@ardrive/turbo-sdk 1.21.1-alpha.1 → 1.22.0-alpha.2

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.
Files changed (38) hide show
  1. package/bundles/web.bundle.min.js +114 -68
  2. package/lib/cjs/cli/commands/uploadFile.js +2 -1
  3. package/lib/cjs/cli/commands/uploadFolder.js +2 -1
  4. package/lib/cjs/cli/options.js +6 -0
  5. package/lib/cjs/cli/utils.js +30 -0
  6. package/lib/cjs/common/http.js +37 -19
  7. package/lib/cjs/common/upload.js +72 -25
  8. package/lib/cjs/utils/axiosClient.js +9 -7
  9. package/lib/cjs/utils/errors.js +2 -2
  10. package/lib/cjs/version.js +1 -1
  11. package/lib/esm/cli/commands/uploadFile.js +3 -2
  12. package/lib/esm/cli/commands/uploadFolder.js +3 -2
  13. package/lib/esm/cli/options.js +6 -0
  14. package/lib/esm/cli/utils.js +28 -0
  15. package/lib/esm/common/http.js +37 -19
  16. package/lib/esm/common/upload.js +72 -25
  17. package/lib/esm/utils/axiosClient.js +7 -6
  18. package/lib/esm/utils/errors.js +2 -2
  19. package/lib/esm/version.js +1 -1
  20. package/lib/types/cli/commands/uploadFile.d.ts.map +1 -1
  21. package/lib/types/cli/commands/uploadFolder.d.ts.map +1 -1
  22. package/lib/types/cli/options.d.ts +17 -0
  23. package/lib/types/cli/options.d.ts.map +1 -1
  24. package/lib/types/cli/types.d.ts +2 -0
  25. package/lib/types/cli/types.d.ts.map +1 -1
  26. package/lib/types/cli/utils.d.ts +14 -0
  27. package/lib/types/cli/utils.d.ts.map +1 -1
  28. package/lib/types/common/http.d.ts +1 -0
  29. package/lib/types/common/http.d.ts.map +1 -1
  30. package/lib/types/common/upload.d.ts +3 -16
  31. package/lib/types/common/upload.d.ts.map +1 -1
  32. package/lib/types/utils/axiosClient.d.ts +1 -0
  33. package/lib/types/utils/axiosClient.d.ts.map +1 -1
  34. package/lib/types/utils/errors.d.ts +1 -1
  35. package/lib/types/utils/errors.d.ts.map +1 -1
  36. package/lib/types/version.d.ts +1 -1
  37. package/lib/types/version.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -310551,7 +310551,7 @@ var import_winston = __toESM(require_winston(), 1);
310551
310551
  init_dirname();
310552
310552
  init_buffer2();
310553
310553
  init_process2();
310554
- var version16 = "1.21.0";
310554
+ var version16 = "1.22.0-alpha.1";
310555
310555
 
310556
310556
  // src/common/logger.ts
310557
310557
  var TurboWinstonLogger = class _TurboWinstonLogger {
@@ -312124,11 +312124,6 @@ init_dirname();
312124
312124
  init_buffer2();
312125
312125
  init_process2();
312126
312126
 
312127
- // src/utils/axiosClient.ts
312128
- init_dirname();
312129
- init_buffer2();
312130
- init_process2();
312131
-
312132
312127
  // node_modules/axios/index.js
312133
312128
  init_dirname();
312134
312129
  init_buffer2();
@@ -314400,6 +314395,11 @@ var {
314400
314395
  mergeConfig: mergeConfig2
314401
314396
  } = axios_default;
314402
314397
 
314398
+ // src/utils/axiosClient.ts
314399
+ init_dirname();
314400
+ init_buffer2();
314401
+ init_process2();
314402
+
314403
314403
  // node_modules/axios-retry/lib/esm/index.js
314404
314404
  init_dirname();
314405
314405
  init_buffer2();
@@ -314609,19 +314609,20 @@ var defaultRequestHeaders = {
314609
314609
  "x-turbo-source-version": version16,
314610
314610
  "x-turbo-source-identifier": "turbo-sdk"
314611
314611
  };
314612
+ var defaultRetryConfig = (logger15 = TurboWinstonLogger.default) => ({
314613
+ retryDelay: axiosRetry.exponentialDelay,
314614
+ retries: 5,
314615
+ retryCondition: (error) => {
314616
+ return !(error instanceof CanceledError2) && axiosRetry.isIdempotentRequestError(error) && axiosRetry.isNetworkError(error);
314617
+ },
314618
+ onRetry: (retryCount, error) => {
314619
+ logger15.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
314620
+ }
314621
+ });
314612
314622
  var createAxiosInstance = ({
314613
314623
  logger: logger15 = TurboWinstonLogger.default,
314614
314624
  axiosConfig = {},
314615
- retryConfig = {
314616
- retryDelay: axiosRetry.exponentialDelay,
314617
- retries: 3,
314618
- retryCondition: (error) => {
314619
- return !(error instanceof CanceledError2) && axiosRetry.isNetworkOrIdempotentRequestError(error);
314620
- },
314621
- onRetry: (retryCount, error) => {
314622
- logger15.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
314623
- }
314624
- }
314625
+ retryConfig = defaultRetryConfig(logger15)
314625
314626
  } = {}) => {
314626
314627
  const axiosInstance = axios_default.create({
314627
314628
  ...axiosConfig,
@@ -314632,7 +314633,7 @@ var createAxiosInstance = ({
314632
314633
  validateStatus: () => true
314633
314634
  // don't throw on non-200 status codes
314634
314635
  });
314635
- if (retryConfig.retries && retryConfig.retries > 0) {
314636
+ if (retryConfig.retries !== void 0 && retryConfig.retries > 0) {
314636
314637
  axiosRetry(axiosInstance, retryConfig);
314637
314638
  }
314638
314639
  return axiosInstance;
@@ -314649,8 +314650,10 @@ var BaseError = class extends Error {
314649
314650
  }
314650
314651
  };
314651
314652
  var FailedRequestError = class extends BaseError {
314652
- constructor(status, message) {
314653
- super(`Failed request: ${status}: ${message}`);
314653
+ constructor(message, status) {
314654
+ super(
314655
+ `Failed request:${status !== void 0 ? ` ${status}:` : ""} ${message}`
314656
+ );
314654
314657
  }
314655
314658
  };
314656
314659
  var ProvidedInputError = class extends BaseError {
@@ -314693,18 +314696,10 @@ var TurboHTTPService = class {
314693
314696
  allowedStatuses = [200, 202],
314694
314697
  headers
314695
314698
  }) {
314696
- const { status, statusText, data } = await this.axios.get(endpoint, {
314697
- headers,
314698
- signal
314699
- });
314700
- if (!allowedStatuses.includes(status)) {
314701
- throw new FailedRequestError(
314702
- status,
314703
- // Return error message from server if available
314704
- typeof data === "string" ? data : statusText
314705
- );
314706
- }
314707
- return data;
314699
+ return this.tryRequest(
314700
+ () => this.axios.get(endpoint, { headers, signal }),
314701
+ allowedStatuses
314702
+ );
314708
314703
  }
314709
314704
  async post({
314710
314705
  endpoint,
@@ -314713,22 +314708,31 @@ var TurboHTTPService = class {
314713
314708
  headers,
314714
314709
  data
314715
314710
  }) {
314716
- const {
314717
- status,
314718
- statusText,
314719
- data: response
314720
- } = await this.axios.post(endpoint, data, {
314721
- headers,
314722
- signal
314723
- });
314724
- if (!allowedStatuses.includes(status)) {
314725
- throw new FailedRequestError(
314726
- status,
314727
- // Return error message from server if available
314728
- typeof response === "string" ? response : statusText
314729
- );
314711
+ return this.tryRequest(
314712
+ () => this.axios.post(endpoint, data, { headers, signal }),
314713
+ allowedStatuses
314714
+ );
314715
+ }
314716
+ async tryRequest(request3, allowedStatuses) {
314717
+ try {
314718
+ const { status, data, statusText } = await request3();
314719
+ if (!allowedStatuses.includes(status)) {
314720
+ throw new FailedRequestError(
314721
+ // Return error message from server if available
314722
+ typeof data === "string" ? data : statusText,
314723
+ status
314724
+ );
314725
+ }
314726
+ return data;
314727
+ } catch (error) {
314728
+ if (error instanceof CanceledError2) {
314729
+ throw error;
314730
+ }
314731
+ if (error instanceof AxiosError2) {
314732
+ throw new FailedRequestError(error.code ?? error.message, error.status);
314733
+ }
314734
+ throw error;
314730
314735
  }
314731
- return response;
314732
314736
  }
314733
314737
  };
314734
314738
 
@@ -349691,8 +349695,8 @@ var defaultUploadServiceURL = "https://upload.ardrive.io";
349691
349695
  var TurboUnauthenticatedUploadService = class {
349692
349696
  constructor({
349693
349697
  url = defaultUploadServiceURL,
349694
- retryConfig,
349695
349698
  logger: logger15 = TurboWinstonLogger.default,
349699
+ retryConfig = defaultRetryConfig(logger15),
349696
349700
  token = "arweave"
349697
349701
  }) {
349698
349702
  this.token = token;
@@ -349702,6 +349706,7 @@ var TurboUnauthenticatedUploadService = class {
349702
349706
  retryConfig,
349703
349707
  logger: this.logger
349704
349708
  });
349709
+ this.retryConfig = retryConfig;
349705
349710
  }
349706
349711
  async uploadSignedDataItem({
349707
349712
  dataItemStreamFactory,
@@ -349738,29 +349743,70 @@ var TurboAuthenticatedBaseUploadService = class extends TurboUnauthenticatedUplo
349738
349743
  signal,
349739
349744
  dataItemOpts
349740
349745
  }) {
349741
- const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
349742
- fileStreamFactory,
349743
- fileSizeFactory,
349744
- dataItemOpts
349745
- });
349746
- const signedDataItem = dataItemStreamFactory();
349747
- this.logger.debug("Uploading signed data item...");
349748
- const headers = {
349749
- "content-type": "application/octet-stream",
349750
- "content-length": `${dataItemSizeFactory()}`
349751
- };
349752
- if (dataItemOpts !== void 0 && dataItemOpts.paidBy !== void 0) {
349753
- const paidBy = Array.isArray(dataItemOpts.paidBy) ? dataItemOpts.paidBy : [dataItemOpts.paidBy];
349754
- if (dataItemOpts.paidBy.length > 0) {
349755
- headers["x-paid-by"] = paidBy;
349746
+ let retries = 0;
349747
+ const maxRetries = this.retryConfig.retries ?? 3;
349748
+ const retryDelay = this.retryConfig.retryDelay ?? ((retryNumber) => retryNumber * 1e3);
349749
+ let lastError = void 0;
349750
+ let lastStatusCode = void 0;
349751
+ while (retries < maxRetries) {
349752
+ if (signal?.aborted) {
349753
+ throw new CanceledError2();
349754
+ }
349755
+ const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
349756
+ fileStreamFactory,
349757
+ fileSizeFactory,
349758
+ dataItemOpts
349759
+ });
349760
+ try {
349761
+ this.logger.debug("Uploading signed data item...");
349762
+ const headers = {
349763
+ "content-type": "application/octet-stream",
349764
+ "content-length": `${dataItemSizeFactory()}`
349765
+ };
349766
+ if (dataItemOpts !== void 0 && dataItemOpts.paidBy !== void 0) {
349767
+ const paidBy = Array.isArray(dataItemOpts.paidBy) ? dataItemOpts.paidBy : [dataItemOpts.paidBy];
349768
+ if (dataItemOpts.paidBy.length > 0) {
349769
+ headers["x-paid-by"] = paidBy;
349770
+ }
349771
+ }
349772
+ const data = await this.httpService.post({
349773
+ endpoint: `/tx/${this.token}`,
349774
+ signal,
349775
+ data: dataItemStreamFactory(),
349776
+ headers
349777
+ });
349778
+ return data;
349779
+ } catch (error) {
349780
+ if (error instanceof FailedRequestError) {
349781
+ throw error;
349782
+ }
349783
+ if (error instanceof AxiosError2) {
349784
+ lastStatusCode = error.response?.status;
349785
+ lastError = error.code ?? error.message;
349786
+ } else {
349787
+ lastError = error instanceof Error && error.message !== void 0 ? error.message : `${error}`;
349788
+ }
349789
+ this.logger.debug(
349790
+ `Upload failed on attempt ${retries + 1}/${maxRetries + 1}`,
349791
+ { message: lastError },
349792
+ error
349793
+ );
349794
+ retries++;
349795
+ const abortEventPromise = new Promise((resolve3) => {
349796
+ signal?.addEventListener("abort", () => {
349797
+ resolve3();
349798
+ });
349799
+ });
349800
+ await Promise.race([
349801
+ sleep(retryDelay(retries, error)),
349802
+ abortEventPromise
349803
+ ]);
349756
349804
  }
349757
349805
  }
349758
- return this.httpService.post({
349759
- endpoint: `/tx/${this.token}`,
349760
- signal,
349761
- data: signedDataItem,
349762
- headers
349763
- });
349806
+ throw new FailedRequestError(
349807
+ `Failed to upload file after ${maxRetries} attempts${lastError !== void 0 && lastError.length > 0 ? `: ${lastError}` : ""}`,
349808
+ lastStatusCode
349809
+ );
349764
349810
  }
349765
349811
  async generateManifest({
349766
349812
  paths,
@@ -26,11 +26,12 @@ async function uploadFile(options) {
26
26
  }
27
27
  const turbo = await (0, utils_js_1.turboFromOptions)(options);
28
28
  const paidBy = await (0, utils_js_1.paidByFromOptions)(options, turbo);
29
+ const customTags = (0, utils_js_1.getTagsFromOptions)(options);
29
30
  const fileSize = (0, fs_1.statSync)(filePath).size;
30
31
  const result = await turbo.uploadFile({
31
32
  fileStreamFactory: () => (0, fs_1.createReadStream)(filePath),
32
33
  fileSizeFactory: () => fileSize,
33
- dataItemOpts: { tags: [...constants_js_1.turboCliTags], paidBy }, // TODO: Inject user tags
34
+ dataItemOpts: { tags: [...constants_js_1.turboCliTags, ...customTags], paidBy },
34
35
  });
35
36
  console.log('Uploaded file:', JSON.stringify(result, null, 2));
36
37
  }
@@ -22,9 +22,10 @@ async function uploadFolder(options) {
22
22
  const turbo = await (0, utils_js_1.turboFromOptions)(options);
23
23
  const paidBy = await (0, utils_js_1.paidByFromOptions)(options, turbo);
24
24
  const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = (0, utils_js_1.getUploadFolderOptions)(options);
25
+ const customTags = (0, utils_js_1.getTagsFromOptions)(options);
25
26
  const result = await turbo.uploadFolder({
26
27
  folderPath: folderPath,
27
- dataItemOpts: { tags: [...constants_js_1.turboCliTags], paidBy }, // TODO: Inject user tags
28
+ dataItemOpts: { tags: [...constants_js_1.turboCliTags, ...customTags], paidBy },
28
29
  manifestOptions: {
29
30
  disableManifest,
30
31
  indexFile,
@@ -40,6 +40,11 @@ exports.optionMap = {
40
40
  alias: '-a, --address <nativeAddress>',
41
41
  description: 'Native address to use for action',
42
42
  },
43
+ tags: {
44
+ description: 'An array of additional tags for the write action, in "--tags name1 value1 name2 value2" format',
45
+ alias: '--tags <tags...>',
46
+ type: 'array',
47
+ },
43
48
  value: {
44
49
  alias: '-v, --value <value>',
45
50
  description: 'Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR',
@@ -168,6 +173,7 @@ exports.uploadOptions = [
168
173
  exports.optionMap.paidBy,
169
174
  exports.optionMap.ignoreApprovals,
170
175
  exports.optionMap.useSignerBalanceFirst,
176
+ exports.optionMap.tags,
171
177
  ];
172
178
  exports.uploadFolderOptions = [
173
179
  ...exports.uploadOptions,
@@ -16,6 +16,8 @@ exports.configFromOptions = configFromOptions;
16
16
  exports.turboFromOptions = turboFromOptions;
17
17
  exports.paidByFromOptions = paidByFromOptions;
18
18
  exports.getUploadFolderOptions = getUploadFolderOptions;
19
+ exports.parseTags = parseTags;
20
+ exports.getTagsFromOptions = getTagsFromOptions;
19
21
  /**
20
22
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
21
23
  *
@@ -217,3 +219,31 @@ function getUploadFolderOptions(options) {
217
219
  maxConcurrentUploads: +(options.maxConcurrency ?? 1),
218
220
  };
219
221
  }
222
+ /**
223
+ * Parse tags array from CLI input into Tag array
224
+ * Accepts format: ["name1", "value1", "name2", "value2"]
225
+ * @param tagsArr Array of alternating tag names and values
226
+ * @returns Array of {name: string, value: string} objects
227
+ */
228
+ function parseTags(tagsArr) {
229
+ if (!tagsArr || tagsArr.length === 0) {
230
+ return [];
231
+ }
232
+ if (tagsArr.length % 2 !== 0) {
233
+ throw new Error('Invalid tags format. Tags must be provided in pairs of name and value.');
234
+ }
235
+ const tags = [];
236
+ const arr = [...tagsArr];
237
+ while (arr.length) {
238
+ const name = arr.shift();
239
+ const value = arr.shift();
240
+ if (name === undefined || value === undefined) {
241
+ throw new Error('Invalid tag format. Each tag must have both a name and value.');
242
+ }
243
+ tags.push({ name, value });
244
+ }
245
+ return tags;
246
+ }
247
+ function getTagsFromOptions(options) {
248
+ return parseTags(options.tags);
249
+ }
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TurboHTTPService = void 0;
4
+ /**
5
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const axios_1 = require("axios");
4
20
  const axiosClient_js_1 = require("../utils/axiosClient.js");
5
21
  const errors_js_1 = require("../utils/errors.js");
6
22
  class TurboHTTPService {
@@ -26,28 +42,30 @@ class TurboHTTPService {
26
42
  });
27
43
  }
28
44
  async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
29
- const { status, statusText, data } = await this.axios.get(endpoint, {
30
- headers,
31
- signal,
32
- });
33
- if (!allowedStatuses.includes(status)) {
34
- throw new errors_js_1.FailedRequestError(status,
35
- // Return error message from server if available
36
- typeof data === 'string' ? data : statusText);
37
- }
38
- return data;
45
+ return this.tryRequest(() => this.axios.get(endpoint, { headers, signal }), allowedStatuses);
39
46
  }
40
47
  async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
41
- const { status, statusText, data: response, } = await this.axios.post(endpoint, data, {
42
- headers,
43
- signal,
44
- });
45
- if (!allowedStatuses.includes(status)) {
46
- throw new errors_js_1.FailedRequestError(status,
47
- // Return error message from server if available
48
- typeof response === 'string' ? response : statusText);
48
+ return this.tryRequest(() => this.axios.post(endpoint, data, { headers, signal }), allowedStatuses);
49
+ }
50
+ async tryRequest(request, allowedStatuses) {
51
+ try {
52
+ const { status, data, statusText } = await request();
53
+ if (!allowedStatuses.includes(status)) {
54
+ throw new errors_js_1.FailedRequestError(
55
+ // Return error message from server if available
56
+ typeof data === 'string' ? data : statusText, status);
57
+ }
58
+ return data;
59
+ }
60
+ catch (error) {
61
+ if (error instanceof axios_1.CanceledError) {
62
+ throw error;
63
+ }
64
+ if (error instanceof axios_1.AxiosError) {
65
+ throw new errors_js_1.FailedRequestError(error.code ?? error.message, error.status);
66
+ }
67
+ throw error;
49
68
  }
50
- return response;
51
69
  }
52
70
  }
53
71
  exports.TurboHTTPService = TurboHTTPService;
@@ -16,8 +16,12 @@ exports.TurboAuthenticatedBaseUploadService = exports.TurboUnauthenticatedUpload
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
+ const axios_1 = require("axios");
19
20
  const node_buffer_1 = require("node:buffer");
20
21
  const plimit_lit_1 = require("plimit-lit");
22
+ const axiosClient_js_1 = require("../utils/axiosClient.js");
23
+ const common_js_1 = require("../utils/common.js");
24
+ const errors_js_1 = require("../utils/errors.js");
21
25
  const http_js_1 = require("./http.js");
22
26
  const logger_js_1 = require("./logger.js");
23
27
  exports.creditSharingTagNames = {
@@ -29,7 +33,7 @@ exports.creditSharingTagNames = {
29
33
  exports.developmentUploadServiceURL = 'https://upload.ardrive.dev';
30
34
  exports.defaultUploadServiceURL = 'https://upload.ardrive.io';
31
35
  class TurboUnauthenticatedUploadService {
32
- constructor({ url = exports.defaultUploadServiceURL, retryConfig, logger = logger_js_1.TurboWinstonLogger.default, token = 'arweave', }) {
36
+ constructor({ url = exports.defaultUploadServiceURL, logger = logger_js_1.TurboWinstonLogger.default, retryConfig = (0, axiosClient_js_1.defaultRetryConfig)(logger), token = 'arweave', }) {
33
37
  this.token = token;
34
38
  this.logger = logger;
35
39
  this.httpService = new http_js_1.TurboHTTPService({
@@ -37,6 +41,7 @@ class TurboUnauthenticatedUploadService {
37
41
  retryConfig,
38
42
  logger: this.logger,
39
43
  });
44
+ this.retryConfig = retryConfig;
40
45
  }
41
46
  async uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
42
47
  const fileSize = dataItemSizeFactory();
@@ -61,32 +66,74 @@ class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUploadServ
61
66
  this.signer = signer;
62
67
  }
63
68
  async uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts, }) {
64
- const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
65
- fileStreamFactory,
66
- fileSizeFactory,
67
- dataItemOpts,
68
- });
69
- const signedDataItem = dataItemStreamFactory();
70
- this.logger.debug('Uploading signed data item...');
71
- // TODO: add p-limit constraint or replace with separate upload class
72
- const headers = {
73
- 'content-type': 'application/octet-stream',
74
- 'content-length': `${dataItemSizeFactory()}`,
75
- };
76
- if (dataItemOpts !== undefined && dataItemOpts.paidBy !== undefined) {
77
- const paidBy = Array.isArray(dataItemOpts.paidBy)
78
- ? dataItemOpts.paidBy
79
- : [dataItemOpts.paidBy];
80
- if (dataItemOpts.paidBy.length > 0) {
81
- headers['x-paid-by'] = paidBy;
69
+ let retries = 0;
70
+ const maxRetries = this.retryConfig.retries ?? 3;
71
+ const retryDelay = this.retryConfig.retryDelay ??
72
+ ((retryNumber) => retryNumber * 1000);
73
+ let lastError = undefined; // Store the last error for throwing
74
+ let lastStatusCode = undefined; // Store the last status code for throwing
75
+ while (retries < maxRetries) {
76
+ if (signal?.aborted) {
77
+ throw new axios_1.CanceledError();
78
+ }
79
+ const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
80
+ fileStreamFactory,
81
+ fileSizeFactory,
82
+ dataItemOpts,
83
+ });
84
+ try {
85
+ this.logger.debug('Uploading signed data item...');
86
+ // TODO: add p-limit constraint or replace with separate upload class
87
+ const headers = {
88
+ 'content-type': 'application/octet-stream',
89
+ 'content-length': `${dataItemSizeFactory()}`,
90
+ };
91
+ if (dataItemOpts !== undefined && dataItemOpts.paidBy !== undefined) {
92
+ const paidBy = Array.isArray(dataItemOpts.paidBy)
93
+ ? dataItemOpts.paidBy
94
+ : [dataItemOpts.paidBy];
95
+ if (dataItemOpts.paidBy.length > 0) {
96
+ headers['x-paid-by'] = paidBy;
97
+ }
98
+ }
99
+ const data = await this.httpService.post({
100
+ endpoint: `/tx/${this.token}`,
101
+ signal,
102
+ data: dataItemStreamFactory(),
103
+ headers,
104
+ });
105
+ return data;
106
+ }
107
+ catch (error) {
108
+ if (error instanceof errors_js_1.FailedRequestError) {
109
+ throw error; // Rethrow if it's already a failed request error from HTTP service
110
+ }
111
+ // Store the last encountered error and status for re-throwing after retries
112
+ if (error instanceof axios_1.AxiosError) {
113
+ lastStatusCode = error.response?.status;
114
+ lastError = error.code ?? error.message;
115
+ }
116
+ else {
117
+ lastError =
118
+ error instanceof Error && error.message !== undefined
119
+ ? error.message
120
+ : `${error}`; // Stringify the whole error if it's not a known Error instance
121
+ }
122
+ this.logger.debug(`Upload failed on attempt ${retries + 1}/${maxRetries + 1}`, { message: lastError }, error);
123
+ retries++;
124
+ const abortEventPromise = new Promise((resolve) => {
125
+ signal?.addEventListener('abort', () => {
126
+ resolve();
127
+ });
128
+ });
129
+ await Promise.race([
130
+ (0, common_js_1.sleep)(retryDelay(retries, error)),
131
+ abortEventPromise,
132
+ ]);
82
133
  }
83
134
  }
84
- return this.httpService.post({
85
- endpoint: `/tx/${this.token}`,
86
- signal,
87
- data: signedDataItem,
88
- headers,
89
- });
135
+ // After all retries, throw the last error for catching
136
+ throw new errors_js_1.FailedRequestError(`Failed to upload file after ${maxRetries} attempts${lastError !== undefined && lastError.length > 0 ? `: ${lastError}` : ''}`, lastStatusCode);
90
137
  }
91
138
  async generateManifest({ paths, indexFile, fallbackFile, }) {
92
139
  const indexPath =
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.createAxiosInstance = exports.defaultRequestHeaders = void 0;
29
+ exports.createAxiosInstance = exports.defaultRetryConfig = exports.defaultRequestHeaders = void 0;
30
30
  /**
31
31
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
32
32
  *
@@ -50,17 +50,20 @@ exports.defaultRequestHeaders = {
50
50
  'x-turbo-source-version': version_js_1.version,
51
51
  'x-turbo-source-identifier': 'turbo-sdk',
52
52
  };
53
- const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default, axiosConfig = {}, retryConfig = {
53
+ const defaultRetryConfig = (logger = logger_js_1.TurboWinstonLogger.default) => ({
54
54
  retryDelay: axios_retry_1.default.exponentialDelay,
55
- retries: 3,
55
+ retries: 5,
56
56
  retryCondition: (error) => {
57
57
  return (!(error instanceof axios_1.CanceledError) &&
58
- axios_retry_1.default.isNetworkOrIdempotentRequestError(error));
58
+ axios_retry_1.default.isIdempotentRequestError(error) &&
59
+ axios_retry_1.default.isNetworkError(error));
59
60
  },
60
61
  onRetry: (retryCount, error) => {
61
62
  logger.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
62
63
  },
63
- }, } = {}) => {
64
+ });
65
+ exports.defaultRetryConfig = defaultRetryConfig;
66
+ const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default, axiosConfig = {}, retryConfig = (0, exports.defaultRetryConfig)(logger), } = {}) => {
64
67
  const axiosInstance = axios_1.default.create({
65
68
  ...axiosConfig,
66
69
  headers: {
@@ -69,8 +72,7 @@ const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default,
69
72
  },
70
73
  validateStatus: () => true, // don't throw on non-200 status codes
71
74
  });
72
- // eslint-disable-next-line
73
- if (retryConfig.retries && retryConfig.retries > 0) {
75
+ if (retryConfig.retries !== undefined && retryConfig.retries > 0) {
74
76
  (0, axios_retry_1.default)(axiosInstance, retryConfig);
75
77
  }
76
78
  return axiosInstance;
@@ -30,8 +30,8 @@ class UnauthenticatedRequestError extends BaseError {
30
30
  }
31
31
  exports.UnauthenticatedRequestError = UnauthenticatedRequestError;
32
32
  class FailedRequestError extends BaseError {
33
- constructor(status, message) {
34
- super(`Failed request: ${status}: ${message}`);
33
+ constructor(message, status) {
34
+ super(`Failed request:${status !== undefined ? ` ${status}:` : ''} ${message}`);
35
35
  }
36
36
  }
37
37
  exports.FailedRequestError = FailedRequestError;
@@ -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.21.1-alpha.1';
20
+ exports.version = '1.22.0-alpha.2';
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { createReadStream, statSync } from 'fs';
17
17
  import { turboCliTags } from '../constants.js';
18
- import { paidByFromOptions, turboFromOptions } from '../utils.js';
18
+ import { getTagsFromOptions, paidByFromOptions, turboFromOptions, } from '../utils.js';
19
19
  export async function uploadFile(options) {
20
20
  const { filePath } = options;
21
21
  if (filePath === undefined) {
@@ -23,11 +23,12 @@ export async function uploadFile(options) {
23
23
  }
24
24
  const turbo = await turboFromOptions(options);
25
25
  const paidBy = await paidByFromOptions(options, turbo);
26
+ const customTags = getTagsFromOptions(options);
26
27
  const fileSize = statSync(filePath).size;
27
28
  const result = await turbo.uploadFile({
28
29
  fileStreamFactory: () => createReadStream(filePath),
29
30
  fileSizeFactory: () => fileSize,
30
- dataItemOpts: { tags: [...turboCliTags], paidBy }, // TODO: Inject user tags
31
+ dataItemOpts: { tags: [...turboCliTags, ...customTags], paidBy },
31
32
  });
32
33
  console.log('Uploaded file:', JSON.stringify(result, null, 2));
33
34
  }
@@ -14,14 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { turboCliTags } from '../constants.js';
17
- import { getUploadFolderOptions, paidByFromOptions, turboFromOptions, } from '../utils.js';
17
+ import { getTagsFromOptions, getUploadFolderOptions, paidByFromOptions, turboFromOptions, } from '../utils.js';
18
18
  export async function uploadFolder(options) {
19
19
  const turbo = await turboFromOptions(options);
20
20
  const paidBy = await paidByFromOptions(options, turbo);
21
21
  const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = getUploadFolderOptions(options);
22
+ const customTags = getTagsFromOptions(options);
22
23
  const result = await turbo.uploadFolder({
23
24
  folderPath: folderPath,
24
- dataItemOpts: { tags: [...turboCliTags], paidBy }, // TODO: Inject user tags
25
+ dataItemOpts: { tags: [...turboCliTags, ...customTags], paidBy },
25
26
  manifestOptions: {
26
27
  disableManifest,
27
28
  indexFile,
@@ -37,6 +37,11 @@ export const optionMap = {
37
37
  alias: '-a, --address <nativeAddress>',
38
38
  description: 'Native address to use for action',
39
39
  },
40
+ tags: {
41
+ description: 'An array of additional tags for the write action, in "--tags name1 value1 name2 value2" format',
42
+ alias: '--tags <tags...>',
43
+ type: 'array',
44
+ },
40
45
  value: {
41
46
  alias: '-v, --value <value>',
42
47
  description: 'Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR',
@@ -165,6 +170,7 @@ export const uploadOptions = [
165
170
  optionMap.paidBy,
166
171
  optionMap.ignoreApprovals,
167
172
  optionMap.useSignerBalanceFirst,
173
+ optionMap.tags,
168
174
  ];
169
175
  export const uploadFolderOptions = [
170
176
  ...uploadOptions,
@@ -199,3 +199,31 @@ export function getUploadFolderOptions(options) {
199
199
  maxConcurrentUploads: +(options.maxConcurrency ?? 1),
200
200
  };
201
201
  }
202
+ /**
203
+ * Parse tags array from CLI input into Tag array
204
+ * Accepts format: ["name1", "value1", "name2", "value2"]
205
+ * @param tagsArr Array of alternating tag names and values
206
+ * @returns Array of {name: string, value: string} objects
207
+ */
208
+ export function parseTags(tagsArr) {
209
+ if (!tagsArr || tagsArr.length === 0) {
210
+ return [];
211
+ }
212
+ if (tagsArr.length % 2 !== 0) {
213
+ throw new Error('Invalid tags format. Tags must be provided in pairs of name and value.');
214
+ }
215
+ const tags = [];
216
+ const arr = [...tagsArr];
217
+ while (arr.length) {
218
+ const name = arr.shift();
219
+ const value = arr.shift();
220
+ if (name === undefined || value === undefined) {
221
+ throw new Error('Invalid tag format. Each tag must have both a name and value.');
222
+ }
223
+ tags.push({ name, value });
224
+ }
225
+ return tags;
226
+ }
227
+ export function getTagsFromOptions(options) {
228
+ return parseTags(options.tags);
229
+ }
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AxiosError, CanceledError } from 'axios';
1
17
  import { createAxiosInstance } from '../utils/axiosClient.js';
2
18
  import { FailedRequestError } from '../utils/errors.js';
3
19
  export class TurboHTTPService {
@@ -23,27 +39,29 @@ export class TurboHTTPService {
23
39
  });
24
40
  }
25
41
  async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
26
- const { status, statusText, data } = await this.axios.get(endpoint, {
27
- headers,
28
- signal,
29
- });
30
- if (!allowedStatuses.includes(status)) {
31
- throw new FailedRequestError(status,
32
- // Return error message from server if available
33
- typeof data === 'string' ? data : statusText);
34
- }
35
- return data;
42
+ return this.tryRequest(() => this.axios.get(endpoint, { headers, signal }), allowedStatuses);
36
43
  }
37
44
  async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
38
- const { status, statusText, data: response, } = await this.axios.post(endpoint, data, {
39
- headers,
40
- signal,
41
- });
42
- if (!allowedStatuses.includes(status)) {
43
- throw new FailedRequestError(status,
44
- // Return error message from server if available
45
- typeof response === 'string' ? response : statusText);
45
+ return this.tryRequest(() => this.axios.post(endpoint, data, { headers, signal }), allowedStatuses);
46
+ }
47
+ async tryRequest(request, allowedStatuses) {
48
+ try {
49
+ const { status, data, statusText } = await request();
50
+ if (!allowedStatuses.includes(status)) {
51
+ throw new FailedRequestError(
52
+ // Return error message from server if available
53
+ typeof data === 'string' ? data : statusText, status);
54
+ }
55
+ return data;
56
+ }
57
+ catch (error) {
58
+ if (error instanceof CanceledError) {
59
+ throw error;
60
+ }
61
+ if (error instanceof AxiosError) {
62
+ throw new FailedRequestError(error.code ?? error.message, error.status);
63
+ }
64
+ throw error;
46
65
  }
47
- return response;
48
66
  }
49
67
  }
@@ -13,8 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { AxiosError, CanceledError } from 'axios';
16
17
  import { Buffer } from 'node:buffer';
17
18
  import { pLimit } from 'plimit-lit';
19
+ import { defaultRetryConfig } from '../utils/axiosClient.js';
20
+ import { sleep } from '../utils/common.js';
21
+ import { FailedRequestError } from '../utils/errors.js';
18
22
  import { TurboHTTPService } from './http.js';
19
23
  import { TurboWinstonLogger } from './logger.js';
20
24
  export const creditSharingTagNames = {
@@ -26,7 +30,7 @@ export const creditSharingTagNames = {
26
30
  export const developmentUploadServiceURL = 'https://upload.ardrive.dev';
27
31
  export const defaultUploadServiceURL = 'https://upload.ardrive.io';
28
32
  export class TurboUnauthenticatedUploadService {
29
- constructor({ url = defaultUploadServiceURL, retryConfig, logger = TurboWinstonLogger.default, token = 'arweave', }) {
33
+ constructor({ url = defaultUploadServiceURL, logger = TurboWinstonLogger.default, retryConfig = defaultRetryConfig(logger), token = 'arweave', }) {
30
34
  this.token = token;
31
35
  this.logger = logger;
32
36
  this.httpService = new TurboHTTPService({
@@ -34,6 +38,7 @@ export class TurboUnauthenticatedUploadService {
34
38
  retryConfig,
35
39
  logger: this.logger,
36
40
  });
41
+ this.retryConfig = retryConfig;
37
42
  }
38
43
  async uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
39
44
  const fileSize = dataItemSizeFactory();
@@ -57,32 +62,74 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
57
62
  this.signer = signer;
58
63
  }
59
64
  async uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts, }) {
60
- const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
61
- fileStreamFactory,
62
- fileSizeFactory,
63
- dataItemOpts,
64
- });
65
- const signedDataItem = dataItemStreamFactory();
66
- this.logger.debug('Uploading signed data item...');
67
- // TODO: add p-limit constraint or replace with separate upload class
68
- const headers = {
69
- 'content-type': 'application/octet-stream',
70
- 'content-length': `${dataItemSizeFactory()}`,
71
- };
72
- if (dataItemOpts !== undefined && dataItemOpts.paidBy !== undefined) {
73
- const paidBy = Array.isArray(dataItemOpts.paidBy)
74
- ? dataItemOpts.paidBy
75
- : [dataItemOpts.paidBy];
76
- if (dataItemOpts.paidBy.length > 0) {
77
- headers['x-paid-by'] = paidBy;
65
+ let retries = 0;
66
+ const maxRetries = this.retryConfig.retries ?? 3;
67
+ const retryDelay = this.retryConfig.retryDelay ??
68
+ ((retryNumber) => retryNumber * 1000);
69
+ let lastError = undefined; // Store the last error for throwing
70
+ let lastStatusCode = undefined; // Store the last status code for throwing
71
+ while (retries < maxRetries) {
72
+ if (signal?.aborted) {
73
+ throw new CanceledError();
74
+ }
75
+ const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
76
+ fileStreamFactory,
77
+ fileSizeFactory,
78
+ dataItemOpts,
79
+ });
80
+ try {
81
+ this.logger.debug('Uploading signed data item...');
82
+ // TODO: add p-limit constraint or replace with separate upload class
83
+ const headers = {
84
+ 'content-type': 'application/octet-stream',
85
+ 'content-length': `${dataItemSizeFactory()}`,
86
+ };
87
+ if (dataItemOpts !== undefined && dataItemOpts.paidBy !== undefined) {
88
+ const paidBy = Array.isArray(dataItemOpts.paidBy)
89
+ ? dataItemOpts.paidBy
90
+ : [dataItemOpts.paidBy];
91
+ if (dataItemOpts.paidBy.length > 0) {
92
+ headers['x-paid-by'] = paidBy;
93
+ }
94
+ }
95
+ const data = await this.httpService.post({
96
+ endpoint: `/tx/${this.token}`,
97
+ signal,
98
+ data: dataItemStreamFactory(),
99
+ headers,
100
+ });
101
+ return data;
102
+ }
103
+ catch (error) {
104
+ if (error instanceof FailedRequestError) {
105
+ throw error; // Rethrow if it's already a failed request error from HTTP service
106
+ }
107
+ // Store the last encountered error and status for re-throwing after retries
108
+ if (error instanceof AxiosError) {
109
+ lastStatusCode = error.response?.status;
110
+ lastError = error.code ?? error.message;
111
+ }
112
+ else {
113
+ lastError =
114
+ error instanceof Error && error.message !== undefined
115
+ ? error.message
116
+ : `${error}`; // Stringify the whole error if it's not a known Error instance
117
+ }
118
+ this.logger.debug(`Upload failed on attempt ${retries + 1}/${maxRetries + 1}`, { message: lastError }, error);
119
+ retries++;
120
+ const abortEventPromise = new Promise((resolve) => {
121
+ signal?.addEventListener('abort', () => {
122
+ resolve();
123
+ });
124
+ });
125
+ await Promise.race([
126
+ sleep(retryDelay(retries, error)),
127
+ abortEventPromise,
128
+ ]);
78
129
  }
79
130
  }
80
- return this.httpService.post({
81
- endpoint: `/tx/${this.token}`,
82
- signal,
83
- data: signedDataItem,
84
- headers,
85
- });
131
+ // After all retries, throw the last error for catching
132
+ throw new FailedRequestError(`Failed to upload file after ${maxRetries} attempts${lastError !== undefined && lastError.length > 0 ? `: ${lastError}` : ''}`, lastStatusCode);
86
133
  }
87
134
  async generateManifest({ paths, indexFile, fallbackFile, }) {
88
135
  const indexPath =
@@ -21,17 +21,19 @@ export const defaultRequestHeaders = {
21
21
  'x-turbo-source-version': version,
22
22
  'x-turbo-source-identifier': 'turbo-sdk',
23
23
  };
24
- export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axiosConfig = {}, retryConfig = {
24
+ export const defaultRetryConfig = (logger = TurboWinstonLogger.default) => ({
25
25
  retryDelay: axiosRetry.exponentialDelay,
26
- retries: 3,
26
+ retries: 5,
27
27
  retryCondition: (error) => {
28
28
  return (!(error instanceof CanceledError) &&
29
- axiosRetry.isNetworkOrIdempotentRequestError(error));
29
+ axiosRetry.isIdempotentRequestError(error) &&
30
+ axiosRetry.isNetworkError(error));
30
31
  },
31
32
  onRetry: (retryCount, error) => {
32
33
  logger.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
33
34
  },
34
- }, } = {}) => {
35
+ });
36
+ export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axiosConfig = {}, retryConfig = defaultRetryConfig(logger), } = {}) => {
35
37
  const axiosInstance = axios.create({
36
38
  ...axiosConfig,
37
39
  headers: {
@@ -40,8 +42,7 @@ export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axios
40
42
  },
41
43
  validateStatus: () => true, // don't throw on non-200 status codes
42
44
  });
43
- // eslint-disable-next-line
44
- if (retryConfig.retries && retryConfig.retries > 0) {
45
+ if (retryConfig.retries !== undefined && retryConfig.retries > 0) {
45
46
  axiosRetry(axiosInstance, retryConfig);
46
47
  }
47
48
  return axiosInstance;
@@ -25,8 +25,8 @@ export class UnauthenticatedRequestError extends BaseError {
25
25
  }
26
26
  }
27
27
  export class FailedRequestError extends BaseError {
28
- constructor(status, message) {
29
- super(`Failed request: ${status}: ${message}`);
28
+ constructor(message, status) {
29
+ super(`Failed request:${status !== undefined ? ` ${status}:` : ''} ${message}`);
30
30
  }
31
31
  }
32
32
  export class ProvidedInputError extends BaseError {
@@ -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.21.1-alpha.1';
17
+ export const version = '1.22.0-alpha.2';
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFile.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB1E"}
1
+ {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFile.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFolder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOlD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
1
+ {"version":3,"file":"uploadFolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFolder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQlD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -37,6 +37,11 @@ export declare const optionMap: {
37
37
  readonly alias: "-a, --address <nativeAddress>";
38
38
  readonly description: "Native address to use for action";
39
39
  };
40
+ readonly tags: {
41
+ readonly description: "An array of additional tags for the write action, in \"--tags name1 value1 name2 value2\" format";
42
+ readonly alias: "--tags <tags...>";
43
+ readonly type: "array";
44
+ };
40
45
  readonly value: {
41
46
  readonly alias: "-v, --value <value>";
42
47
  readonly description: "Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR";
@@ -190,6 +195,10 @@ export declare const globalOptions: ({
190
195
  readonly default: false;
191
196
  })[];
192
197
  export declare const uploadOptions: ({
198
+ readonly description: "An array of additional tags for the write action, in \"--tags name1 value1 name2 value2\" format";
199
+ readonly alias: "--tags <tags...>";
200
+ readonly type: "array";
201
+ } | {
193
202
  readonly alias: "-w, --wallet-file <filePath>";
194
203
  readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
195
204
  } | {
@@ -212,6 +221,10 @@ export declare const uploadOptions: ({
212
221
  readonly default: false;
213
222
  })[];
214
223
  export declare const uploadFolderOptions: ({
224
+ readonly description: "An array of additional tags for the write action, in \"--tags name1 value1 name2 value2\" format";
225
+ readonly alias: "--tags <tags...>";
226
+ readonly type: "array";
227
+ } | {
215
228
  readonly alias: "-w, --wallet-file <filePath>";
216
229
  readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
217
230
  } | {
@@ -250,6 +263,10 @@ export declare const uploadFolderOptions: ({
250
263
  readonly default: false;
251
264
  })[];
252
265
  export declare const uploadFileOptions: ({
266
+ readonly description: "An array of additional tags for the write action, in \"--tags name1 value1 name2 value2\" format";
267
+ readonly alias: "--tags <tags...>";
268
+ readonly type: "array";
269
+ } | {
253
270
  readonly alias: "-w, --wallet-file <filePath>";
254
271
  readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
255
272
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;IAKzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;IAAyC,CAAC;AAExE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;IAK/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;IAAwC,CAAC;AAE1E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAuB,CAAC"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;IAMzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAyC,CAAC;AAExE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;IAK/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;IAAwC,CAAC;AAE1E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAuB,CAAC"}
@@ -40,6 +40,7 @@ export type UploadOptions = WalletOptions & {
40
40
  paidBy: string[];
41
41
  ignoreApprovals: boolean;
42
42
  useSignerBalanceFirst: boolean;
43
+ tags: string[] | undefined;
43
44
  };
44
45
  export type UploadFolderOptions = UploadOptions & {
45
46
  folderPath: string | undefined;
@@ -50,6 +51,7 @@ export type UploadFolderOptions = UploadOptions & {
50
51
  };
51
52
  export type UploadFileOptions = UploadOptions & {
52
53
  filePath: string | undefined;
54
+ tags: string[] | undefined;
53
55
  };
54
56
  export type TokenPriceOptions = GlobalOptions & {
55
57
  byteCount: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAA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MAAM,GAAG,SAAS,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC"}
@@ -28,5 +28,19 @@ export declare function getUploadFolderOptions(options: UploadFolderOptions): {
28
28
  disableManifest: boolean;
29
29
  maxConcurrentUploads: number;
30
30
  };
31
+ /**
32
+ * Parse tags array from CLI input into Tag array
33
+ * Accepts format: ["name1", "value1", "name2", "value2"]
34
+ * @param tagsArr Array of alternating tag names and values
35
+ * @returns Array of {name: string, value: string} objects
36
+ */
37
+ export declare function parseTags(tagsArr?: string[]): {
38
+ name: string;
39
+ value: string;
40
+ }[];
41
+ export declare function getTagsFromOptions(options: UploadOptions): {
42
+ name: string;
43
+ value: string;
44
+ }[];
31
45
  export {};
32
46
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/cli/utils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EACL,SAAS,EACT,wBAAwB,EAExB,iCAAiC,EAKlC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,QAG9C;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,YAAY,EACrD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,iBAUtC;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MA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,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,GACN,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBjC;AAWD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,GACrB,iCAAiC,CA8CnC;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,wBAAwB,CAAC,CAOnC;AAED,wBAAsB,iBAAiB,CACrC,EACE,MAAM,EAAE,cAAc,EACtB,eAAe,EACf,qBAAqB,GACtB,EAAE,aAAa,EAChB,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAwB/B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAYA;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CA0BnC;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAEnC"}
@@ -40,5 +40,6 @@ export declare class TurboHTTPService implements TurboHTTPServiceInterface {
40
40
  headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
41
41
  data: Readable | Buffer | ReadableStream;
42
42
  }): Promise<T>;
43
+ private tryRequest;
43
44
  }
44
45
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/http.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EACR,MAAM,EACN,eAA4B,EAC5B,OAAO,EACP,IAAI,GACL,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;KAC1C,GAAG,OAAO,CAAC,CAAC,CAAC;YAOA,UAAU;CAwBzB"}
@@ -1,18 +1,4 @@
1
- /**
2
- * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
1
+ import { IAxiosRetryConfig } from 'axios-retry';
16
2
  import { Buffer } from 'node:buffer';
17
3
  import { Readable } from 'node:stream';
18
4
  import { ArweaveManifest, CreditShareApproval, TokenType, TurboAbortSignal, TurboAuthenticatedUploadServiceConfiguration, TurboAuthenticatedUploadServiceInterface, TurboCreateCreditShareApprovalParams, TurboDataItemSigner, TurboFileFactory, TurboLogger, TurboRevokeCreditsParams, TurboSignedDataItemFactory, TurboUnauthenticatedUploadServiceConfiguration, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse, TurboUploadFolderParams, TurboUploadFolderResponse } from '../types.js';
@@ -29,7 +15,8 @@ export declare class TurboUnauthenticatedUploadService implements TurboUnauthent
29
15
  protected httpService: TurboHTTPService;
30
16
  protected logger: TurboLogger;
31
17
  protected token: TokenType;
32
- constructor({ url, retryConfig, logger, token, }: TurboUnauthenticatedUploadServiceConfiguration);
18
+ protected retryConfig: IAxiosRetryConfig;
19
+ constructor({ url, logger, retryConfig, token, }: TurboUnauthenticatedUploadServiceConfiguration);
33
20
  uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
34
21
  }
35
22
  export declare abstract class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUploadService implements TurboAuthenticatedUploadServiceInterface {
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/common/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EACL,eAAe,EACf,mBAAmB,EAEnB,SAAS,EACT,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,EACxC,oCAAoC,EACpC,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,8CAA8C,EAC9C,0CAA0C,EAC1C,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,eAAO,MAAM,qBAAqB;;;;;CAKjC,CAAC;AAEF,eAAO,MAAM,2BAA2B,+BAA+B,CAAC;AACxE,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE,qBAAa,iCACX,YAAW,0CAA0C;IAErD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;gBAEf,EACV,GAA6B,EAC7B,WAAW,EACX,MAAmC,EACnC,KAAiB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AAM,EAAE,uBAAuB,GAC9B,MAAM;IACT,QAAQ,CAAC,oBAAoB,CAC3B,cAAc,EAAE,MAAM,GACrB,QAAQ,GAAG,cAAc;IAE5B,OAAO,CAAC,cAAc;IAchB,YAAY,CAChB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,yBAAyB,CAAC;IAqGxB,YAAY,CAAC,EACxB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GACjB,EAAE,oCAAoC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqCzD,aAAa,CAAC,EACzB,cAAc,GACf,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAwB7D"}
@@ -25,5 +25,6 @@ export interface AxiosInstanceParameters {
25
25
  retryConfig?: IAxiosRetryConfig;
26
26
  logger?: TurboLogger;
27
27
  }
28
+ export declare const defaultRetryConfig: (logger?: TurboLogger) => IAxiosRetryConfig;
28
29
  export declare const createAxiosInstance: ({ logger, axiosConfig, retryConfig, }?: AxiosInstanceParameters) => AxiosInstance;
29
30
  //# sourceMappingURL=axiosClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/utils/axiosClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAChF,OAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,2CAgB7B,uBAAuB,KAAQ,aAgBjC,CAAC"}
1
+ {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/utils/axiosClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAChF,OAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,iBAezD,CAAC;AAEH,eAAO,MAAM,mBAAmB,2CAI7B,uBAAuB,KAAQ,aAejC,CAAC"}
@@ -20,7 +20,7 @@ export declare class UnauthenticatedRequestError extends BaseError {
20
20
  constructor();
21
21
  }
22
22
  export declare class FailedRequestError extends BaseError {
23
- constructor(status: number, message: string);
23
+ constructor(message: string, status?: number);
24
24
  }
25
25
  export declare class ProvidedInputError extends BaseError {
26
26
  constructor(message?: string);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,2BAA4B,SAAQ,SAAS;;CAIzD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG5C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG7B"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,2BAA4B,SAAQ,SAAS;;CAIzD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG7B"}
@@ -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.21.0";
16
+ export declare const version = "1.22.0-alpha.1";
17
17
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,eAAO,MAAM,OAAO,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.21.1-alpha.1",
3
+ "version": "1.22.0-alpha.2",
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",