@ethersphere/bee-js 6.0.0 → 6.2.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.
@@ -46,17 +46,13 @@ class BeeDebug {
46
46
  // which could lead to double slash in URL to which Bee responds with
47
47
  // unnecessary redirects.
48
48
  this.url = (0, url_1.stripLastSlash)(url);
49
- const requestOptions = {
49
+ this.requestOptions = {
50
50
  baseURL: this.url,
51
51
  timeout: options?.timeout ?? false,
52
+ headers: options?.headers,
53
+ onRequest: options?.onRequest,
54
+ adapter: options?.adapter,
52
55
  };
53
- if (options?.headers) {
54
- requestOptions.headers = options.headers;
55
- }
56
- if (options?.onRequest) {
57
- requestOptions.onRequest = options.onRequest;
58
- }
59
- this.requestOptions = requestOptions;
60
56
  }
61
57
  async getNodeAddresses(options) {
62
58
  (0, type_1.assertRequestOptions)(options);
package/dist/cjs/bee.js CHANGED
@@ -73,17 +73,13 @@ class Bee {
73
73
  if (options?.signer) {
74
74
  this.signer = (0, signer_1.makeSigner)(options.signer);
75
75
  }
76
- const requestOptions = {
76
+ this.requestOptions = {
77
77
  baseURL: this.url,
78
78
  timeout: options?.timeout ?? false,
79
+ headers: options?.headers,
80
+ onRequest: options?.onRequest,
81
+ adapter: options?.adapter,
79
82
  };
80
- if (options?.headers) {
81
- requestOptions.headers = options.headers;
82
- }
83
- if (options?.onRequest) {
84
- requestOptions.onRequest = options.onRequest;
85
- }
86
- this.requestOptions = requestOptions;
87
83
  }
88
84
  /**
89
85
  * Upload data to a Bee node
@@ -27,7 +27,7 @@ async function upload(requestOptions, data, postageBatchId, options) {
27
27
  });
28
28
  return {
29
29
  reference: response.data.reference,
30
- tagUid: (0, type_1.makeTagUid)(response.headers['swarm-tag']),
30
+ tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
31
31
  };
32
32
  }
33
33
  exports.upload = upload;
@@ -44,7 +44,7 @@ async function uploadFile(requestOptions, data, postageBatchId, name, options) {
44
44
  });
45
45
  return {
46
46
  reference: response.data.reference,
47
- tagUid: (0, type_1.makeTagUid)(response.headers['swarm-tag']),
47
+ tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
48
48
  };
49
49
  }
50
50
  exports.uploadFile = uploadFile;
@@ -119,7 +119,7 @@ async function uploadCollection(requestOptions, collection, postageBatchId, opti
119
119
  });
120
120
  return {
121
121
  reference: response.data.reference,
122
- tagUid: (0, type_1.makeTagUid)(response.headers['swarm-tag']),
122
+ tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
123
123
  };
124
124
  }
125
125
  exports.uploadCollection = uploadCollection;