@ardrive/turbo-sdk 1.22.0-alpha.2 → 1.22.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.
@@ -312124,6 +312124,11 @@ 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
+
312127
312132
  // node_modules/axios/index.js
312128
312133
  init_dirname();
312129
312134
  init_buffer2();
@@ -314395,11 +314400,6 @@ var {
314395
314400
  mergeConfig: mergeConfig2
314396
314401
  } = axios_default;
314397
314402
 
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,20 +314609,19 @@ 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
- });
314622
314612
  var createAxiosInstance = ({
314623
314613
  logger: logger15 = TurboWinstonLogger.default,
314624
314614
  axiosConfig = {},
314625
- retryConfig = defaultRetryConfig(logger15)
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
+ }
314626
314625
  } = {}) => {
314627
314626
  const axiosInstance = axios_default.create({
314628
314627
  ...axiosConfig,
@@ -314633,7 +314632,7 @@ var createAxiosInstance = ({
314633
314632
  validateStatus: () => true
314634
314633
  // don't throw on non-200 status codes
314635
314634
  });
314636
- if (retryConfig.retries !== void 0 && retryConfig.retries > 0) {
314635
+ if (retryConfig.retries && retryConfig.retries > 0) {
314637
314636
  axiosRetry(axiosInstance, retryConfig);
314638
314637
  }
314639
314638
  return axiosInstance;
@@ -314650,10 +314649,8 @@ var BaseError = class extends Error {
314650
314649
  }
314651
314650
  };
314652
314651
  var FailedRequestError = class extends BaseError {
314653
- constructor(message, status) {
314654
- super(
314655
- `Failed request:${status !== void 0 ? ` ${status}:` : ""} ${message}`
314656
- );
314652
+ constructor(status, message) {
314653
+ super(`Failed request: ${status}: ${message}`);
314657
314654
  }
314658
314655
  };
314659
314656
  var ProvidedInputError = class extends BaseError {
@@ -314696,10 +314693,18 @@ var TurboHTTPService = class {
314696
314693
  allowedStatuses = [200, 202],
314697
314694
  headers
314698
314695
  }) {
314699
- return this.tryRequest(
314700
- () => this.axios.get(endpoint, { headers, signal }),
314701
- allowedStatuses
314702
- );
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;
314703
314708
  }
314704
314709
  async post({
314705
314710
  endpoint,
@@ -314708,31 +314713,22 @@ var TurboHTTPService = class {
314708
314713
  headers,
314709
314714
  data
314710
314715
  }) {
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;
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
+ );
314735
314730
  }
314731
+ return response;
314736
314732
  }
314737
314733
  };
314738
314734
 
@@ -349695,8 +349691,8 @@ var defaultUploadServiceURL = "https://upload.ardrive.io";
349695
349691
  var TurboUnauthenticatedUploadService = class {
349696
349692
  constructor({
349697
349693
  url = defaultUploadServiceURL,
349694
+ retryConfig,
349698
349695
  logger: logger15 = TurboWinstonLogger.default,
349699
- retryConfig = defaultRetryConfig(logger15),
349700
349696
  token = "arweave"
349701
349697
  }) {
349702
349698
  this.token = token;
@@ -349706,7 +349702,6 @@ var TurboUnauthenticatedUploadService = class {
349706
349702
  retryConfig,
349707
349703
  logger: this.logger
349708
349704
  });
349709
- this.retryConfig = retryConfig;
349710
349705
  }
349711
349706
  async uploadSignedDataItem({
349712
349707
  dataItemStreamFactory,
@@ -349743,70 +349738,29 @@ var TurboAuthenticatedBaseUploadService = class extends TurboUnauthenticatedUplo
349743
349738
  signal,
349744
349739
  dataItemOpts
349745
349740
  }) {
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
- ]);
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;
349804
349756
  }
349805
349757
  }
349806
- throw new FailedRequestError(
349807
- `Failed to upload file after ${maxRetries} attempts${lastError !== void 0 && lastError.length > 0 ? `: ${lastError}` : ""}`,
349808
- lastStatusCode
349809
- );
349758
+ return this.httpService.post({
349759
+ endpoint: `/tx/${this.token}`,
349760
+ signal,
349761
+ data: signedDataItem,
349762
+ headers
349763
+ });
349810
349764
  }
349811
349765
  async generateManifest({
349812
349766
  paths,
@@ -1,22 +1,6 @@
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");
20
4
  const axiosClient_js_1 = require("../utils/axiosClient.js");
21
5
  const errors_js_1 = require("../utils/errors.js");
22
6
  class TurboHTTPService {
@@ -42,30 +26,28 @@ class TurboHTTPService {
42
26
  });
43
27
  }
44
28
  async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
45
- return this.tryRequest(() => this.axios.get(endpoint, { headers, signal }), allowedStatuses);
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;
46
39
  }
47
40
  async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
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;
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);
68
49
  }
50
+ return response;
69
51
  }
70
52
  }
71
53
  exports.TurboHTTPService = TurboHTTPService;
@@ -16,12 +16,8 @@ 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");
20
19
  const node_buffer_1 = require("node:buffer");
21
20
  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");
25
21
  const http_js_1 = require("./http.js");
26
22
  const logger_js_1 = require("./logger.js");
27
23
  exports.creditSharingTagNames = {
@@ -33,7 +29,7 @@ exports.creditSharingTagNames = {
33
29
  exports.developmentUploadServiceURL = 'https://upload.ardrive.dev';
34
30
  exports.defaultUploadServiceURL = 'https://upload.ardrive.io';
35
31
  class TurboUnauthenticatedUploadService {
36
- constructor({ url = exports.defaultUploadServiceURL, logger = logger_js_1.TurboWinstonLogger.default, retryConfig = (0, axiosClient_js_1.defaultRetryConfig)(logger), token = 'arweave', }) {
32
+ constructor({ url = exports.defaultUploadServiceURL, retryConfig, logger = logger_js_1.TurboWinstonLogger.default, token = 'arweave', }) {
37
33
  this.token = token;
38
34
  this.logger = logger;
39
35
  this.httpService = new http_js_1.TurboHTTPService({
@@ -41,7 +37,6 @@ class TurboUnauthenticatedUploadService {
41
37
  retryConfig,
42
38
  logger: this.logger,
43
39
  });
44
- this.retryConfig = retryConfig;
45
40
  }
46
41
  async uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
47
42
  const fileSize = dataItemSizeFactory();
@@ -66,74 +61,32 @@ class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUploadServ
66
61
  this.signer = signer;
67
62
  }
68
63
  async uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts, }) {
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
- ]);
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;
133
82
  }
134
83
  }
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);
84
+ return this.httpService.post({
85
+ endpoint: `/tx/${this.token}`,
86
+ signal,
87
+ data: signedDataItem,
88
+ headers,
89
+ });
137
90
  }
138
91
  async generateManifest({ paths, indexFile, fallbackFile, }) {
139
92
  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.defaultRetryConfig = exports.defaultRequestHeaders = void 0;
29
+ exports.createAxiosInstance = exports.defaultRequestHeaders = void 0;
30
30
  /**
31
31
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
32
32
  *
@@ -50,20 +50,17 @@ exports.defaultRequestHeaders = {
50
50
  'x-turbo-source-version': version_js_1.version,
51
51
  'x-turbo-source-identifier': 'turbo-sdk',
52
52
  };
53
- const defaultRetryConfig = (logger = logger_js_1.TurboWinstonLogger.default) => ({
53
+ const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default, axiosConfig = {}, retryConfig = {
54
54
  retryDelay: axios_retry_1.default.exponentialDelay,
55
- retries: 5,
55
+ retries: 3,
56
56
  retryCondition: (error) => {
57
57
  return (!(error instanceof axios_1.CanceledError) &&
58
- axios_retry_1.default.isIdempotentRequestError(error) &&
59
- axios_retry_1.default.isNetworkError(error));
58
+ axios_retry_1.default.isNetworkOrIdempotentRequestError(error));
60
59
  },
61
60
  onRetry: (retryCount, error) => {
62
61
  logger.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
63
62
  },
64
- });
65
- exports.defaultRetryConfig = defaultRetryConfig;
66
- const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default, axiosConfig = {}, retryConfig = (0, exports.defaultRetryConfig)(logger), } = {}) => {
63
+ }, } = {}) => {
67
64
  const axiosInstance = axios_1.default.create({
68
65
  ...axiosConfig,
69
66
  headers: {
@@ -72,7 +69,8 @@ const createAxiosInstance = ({ logger = logger_js_1.TurboWinstonLogger.default,
72
69
  },
73
70
  validateStatus: () => true, // don't throw on non-200 status codes
74
71
  });
75
- if (retryConfig.retries !== undefined && retryConfig.retries > 0) {
72
+ // eslint-disable-next-line
73
+ if (retryConfig.retries && retryConfig.retries > 0) {
76
74
  (0, axios_retry_1.default)(axiosInstance, retryConfig);
77
75
  }
78
76
  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(message, status) {
34
- super(`Failed request:${status !== undefined ? ` ${status}:` : ''} ${message}`);
33
+ constructor(status, message) {
34
+ super(`Failed request: ${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.22.0-alpha.2';
20
+ exports.version = '1.22.0';
@@ -1,19 +1,3 @@
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';
17
1
  import { createAxiosInstance } from '../utils/axiosClient.js';
18
2
  import { FailedRequestError } from '../utils/errors.js';
19
3
  export class TurboHTTPService {
@@ -39,29 +23,27 @@ export class TurboHTTPService {
39
23
  });
40
24
  }
41
25
  async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
42
- return this.tryRequest(() => this.axios.get(endpoint, { headers, signal }), allowedStatuses);
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;
43
36
  }
44
37
  async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
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;
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);
65
46
  }
47
+ return response;
66
48
  }
67
49
  }
@@ -13,12 +13,8 @@
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';
17
16
  import { Buffer } from 'node:buffer';
18
17
  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';
22
18
  import { TurboHTTPService } from './http.js';
23
19
  import { TurboWinstonLogger } from './logger.js';
24
20
  export const creditSharingTagNames = {
@@ -30,7 +26,7 @@ export const creditSharingTagNames = {
30
26
  export const developmentUploadServiceURL = 'https://upload.ardrive.dev';
31
27
  export const defaultUploadServiceURL = 'https://upload.ardrive.io';
32
28
  export class TurboUnauthenticatedUploadService {
33
- constructor({ url = defaultUploadServiceURL, logger = TurboWinstonLogger.default, retryConfig = defaultRetryConfig(logger), token = 'arweave', }) {
29
+ constructor({ url = defaultUploadServiceURL, retryConfig, logger = TurboWinstonLogger.default, token = 'arweave', }) {
34
30
  this.token = token;
35
31
  this.logger = logger;
36
32
  this.httpService = new TurboHTTPService({
@@ -38,7 +34,6 @@ export class TurboUnauthenticatedUploadService {
38
34
  retryConfig,
39
35
  logger: this.logger,
40
36
  });
41
- this.retryConfig = retryConfig;
42
37
  }
43
38
  async uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
44
39
  const fileSize = dataItemSizeFactory();
@@ -62,74 +57,32 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
62
57
  this.signer = signer;
63
58
  }
64
59
  async uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts, }) {
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
- ]);
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;
129
78
  }
130
79
  }
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);
80
+ return this.httpService.post({
81
+ endpoint: `/tx/${this.token}`,
82
+ signal,
83
+ data: signedDataItem,
84
+ headers,
85
+ });
133
86
  }
134
87
  async generateManifest({ paths, indexFile, fallbackFile, }) {
135
88
  const indexPath =
@@ -21,19 +21,17 @@ export const defaultRequestHeaders = {
21
21
  'x-turbo-source-version': version,
22
22
  'x-turbo-source-identifier': 'turbo-sdk',
23
23
  };
24
- export const defaultRetryConfig = (logger = TurboWinstonLogger.default) => ({
24
+ export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axiosConfig = {}, retryConfig = {
25
25
  retryDelay: axiosRetry.exponentialDelay,
26
- retries: 5,
26
+ retries: 3,
27
27
  retryCondition: (error) => {
28
28
  return (!(error instanceof CanceledError) &&
29
- axiosRetry.isIdempotentRequestError(error) &&
30
- axiosRetry.isNetworkError(error));
29
+ axiosRetry.isNetworkOrIdempotentRequestError(error));
31
30
  },
32
31
  onRetry: (retryCount, error) => {
33
32
  logger.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
34
33
  },
35
- });
36
- export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axiosConfig = {}, retryConfig = defaultRetryConfig(logger), } = {}) => {
34
+ }, } = {}) => {
37
35
  const axiosInstance = axios.create({
38
36
  ...axiosConfig,
39
37
  headers: {
@@ -42,7 +40,8 @@ export const createAxiosInstance = ({ logger = TurboWinstonLogger.default, axios
42
40
  },
43
41
  validateStatus: () => true, // don't throw on non-200 status codes
44
42
  });
45
- if (retryConfig.retries !== undefined && retryConfig.retries > 0) {
43
+ // eslint-disable-next-line
44
+ if (retryConfig.retries && retryConfig.retries > 0) {
46
45
  axiosRetry(axiosInstance, retryConfig);
47
46
  }
48
47
  return axiosInstance;
@@ -25,8 +25,8 @@ export class UnauthenticatedRequestError extends BaseError {
25
25
  }
26
26
  }
27
27
  export class FailedRequestError extends BaseError {
28
- constructor(message, status) {
29
- super(`Failed request:${status !== undefined ? ` ${status}:` : ''} ${message}`);
28
+ constructor(status, message) {
29
+ super(`Failed request: ${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.22.0-alpha.2';
17
+ export const version = '1.22.0';
@@ -40,6 +40,5 @@ 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;
44
43
  }
45
44
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAc,aAAa,EAAgC,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAIrB,qBAAa,gBAAiB,YAAW,yBAAyB;IAChE,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;gBAElB,EACV,GAAG,EACH,WAAW,EACX,MAAM,GACP,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,iBAAiB,CAAC;QAChC,MAAM,EAAE,WAAW,CAAC;KACrB;IAsBK,GAAG,CAAC,CAAC,EAAE,EACX,QAAQ,EACR,MAAM,EACN,eAA4B,EAC5B,OAAO,GACR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AG,EACH,WAAW,EACX,MAAM,GACP,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,iBAAiB,CAAC;QAChC,MAAM,EAAE,WAAW,CAAC;KACrB;IAqBK,GAAG,CAAC,CAAC,EAAE,EACX,QAAQ,EACR,MAAM,EACN,eAA4B,EAC5B,OAAO,GACR,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;KACvE,GAAG,OAAO,CAAC,CAAC,CAAC;IAiBR,IAAI,CAAC,CAAC,EAAE,EACZ,QAAQ,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;CAoBf"}
@@ -1,4 +1,18 @@
1
- import { IAxiosRetryConfig } from 'axios-retry';
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
+ */
2
16
  import { Buffer } from 'node:buffer';
3
17
  import { Readable } from 'node:stream';
4
18
  import { ArweaveManifest, CreditShareApproval, TokenType, TurboAbortSignal, TurboAuthenticatedUploadServiceConfiguration, TurboAuthenticatedUploadServiceInterface, TurboCreateCreditShareApprovalParams, TurboDataItemSigner, TurboFileFactory, TurboLogger, TurboRevokeCreditsParams, TurboSignedDataItemFactory, TurboUnauthenticatedUploadServiceConfiguration, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse, TurboUploadFolderParams, TurboUploadFolderResponse } from '../types.js';
@@ -15,8 +29,7 @@ export declare class TurboUnauthenticatedUploadService implements TurboUnauthent
15
29
  protected httpService: TurboHTTPService;
16
30
  protected logger: TurboLogger;
17
31
  protected token: TokenType;
18
- protected retryConfig: IAxiosRetryConfig;
19
- constructor({ url, logger, retryConfig, token, }: TurboUnauthenticatedUploadServiceConfiguration);
32
+ constructor({ url, retryConfig, logger, token, }: TurboUnauthenticatedUploadServiceConfiguration);
20
33
  uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
21
34
  }
22
35
  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":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,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,gBA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CAAC,EAAE,MAAM,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,eAAe,CAAC;IA6B5B,QAAQ,CAAC,QAAQ,CACf,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM;IACzD,QAAQ,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,cAAc;IAC7E,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IACjD,QAAQ,CAAC,eAAe,CACtB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,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,6 +25,5 @@ export interface AxiosInstanceParameters {
25
25
  retryConfig?: IAxiosRetryConfig;
26
26
  logger?: TurboLogger;
27
27
  }
28
- export declare const defaultRetryConfig: (logger?: TurboLogger) => IAxiosRetryConfig;
29
28
  export declare const createAxiosInstance: ({ logger, axiosConfig, retryConfig, }?: AxiosInstanceParameters) => AxiosInstance;
30
29
  //# 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,kBAAkB,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,iBAezD,CAAC;AAEH,eAAO,MAAM,mBAAmB,2CAI7B,uBAAuB,KAAQ,aAejC,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,mBAAmB,2CAgB7B,uBAAuB,KAAQ,aAgBjC,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(message: string, status?: number);
23
+ constructor(status: number, message: string);
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,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;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,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG5C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.22.0-alpha.2",
3
+ "version": "1.22.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",