@ethersphere/bee-js 10.4.0 → 11.1.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.
Files changed (81) hide show
  1. package/dist/cjs/bee.js +17 -10
  2. package/dist/cjs/chunk/bmt.js +1 -2
  3. package/dist/cjs/chunk/cac.js +3 -3
  4. package/dist/cjs/chunk/soc.js +24 -15
  5. package/dist/cjs/feed/identifier.js +1 -2
  6. package/dist/cjs/feed/index.js +25 -16
  7. package/dist/cjs/feed/retrievable.js +1 -2
  8. package/dist/cjs/index.js +17 -7
  9. package/dist/cjs/modules/bytes.js +4 -5
  10. package/dist/cjs/modules/bzz.js +4 -5
  11. package/dist/cjs/modules/chunk.js +2 -3
  12. package/dist/cjs/modules/debug/balance.js +4 -5
  13. package/dist/cjs/modules/debug/chequebook.js +8 -9
  14. package/dist/cjs/modules/debug/connectivity.js +7 -8
  15. package/dist/cjs/modules/debug/settlements.js +2 -3
  16. package/dist/cjs/modules/debug/stake.js +6 -7
  17. package/dist/cjs/modules/debug/stamps.js +7 -8
  18. package/dist/cjs/modules/debug/states.js +6 -6
  19. package/dist/cjs/modules/debug/status.js +9 -9
  20. package/dist/cjs/modules/debug/transactions.js +4 -5
  21. package/dist/cjs/modules/envelope.js +1 -2
  22. package/dist/cjs/modules/feed.js +3 -4
  23. package/dist/cjs/modules/grantee.js +3 -4
  24. package/dist/cjs/modules/gsoc.js +2 -3
  25. package/dist/cjs/modules/pinning.js +4 -5
  26. package/dist/cjs/modules/pss.js +2 -3
  27. package/dist/cjs/modules/rchash.js +1 -2
  28. package/dist/cjs/modules/soc.js +1 -2
  29. package/dist/cjs/modules/status.js +2 -3
  30. package/dist/cjs/modules/stewardship.js +2 -3
  31. package/dist/cjs/modules/tag.js +5 -6
  32. package/dist/cjs/types/debug.js +3 -3
  33. package/dist/cjs/types/index.js +2 -2
  34. package/dist/cjs/utils/bytes.js +2 -2
  35. package/dist/cjs/utils/chunk-size.js +1 -2
  36. package/dist/cjs/utils/chunk-stream.browser.js +30 -6
  37. package/dist/cjs/utils/chunk-stream.js +3 -4
  38. package/dist/cjs/utils/cid.js +3 -3
  39. package/dist/cjs/utils/collection.browser.js +2 -3
  40. package/dist/cjs/utils/collection.js +5 -6
  41. package/dist/cjs/utils/collection.node.js +2 -3
  42. package/dist/cjs/utils/data.browser.js +1 -2
  43. package/dist/cjs/utils/data.js +1 -2
  44. package/dist/cjs/utils/expose.js +2 -1
  45. package/dist/cjs/utils/file.js +2 -3
  46. package/dist/cjs/utils/headers.js +2 -3
  47. package/dist/cjs/utils/http.js +17 -3
  48. package/dist/cjs/utils/pss.js +1 -2
  49. package/dist/cjs/utils/redundancy.js +3 -4
  50. package/dist/cjs/utils/stamps.js +12 -13
  51. package/dist/cjs/utils/tar-uploader.browser.js +1 -2
  52. package/dist/cjs/utils/tar-uploader.js +1 -2
  53. package/dist/cjs/utils/tar-writer.browser.js +1 -2
  54. package/dist/cjs/utils/tar-writer.js +1 -2
  55. package/dist/cjs/utils/type.js +35 -25
  56. package/dist/cjs/utils/url.js +3 -4
  57. package/dist/cjs/utils/workaround.js +2 -3
  58. package/dist/index.browser.min.js +1 -1
  59. package/dist/index.browser.min.js.map +1 -1
  60. package/dist/mjs/bee.js +0 -3
  61. package/dist/mjs/modules/debug/states.js +3 -0
  62. package/dist/mjs/modules/debug/status.js +1 -1
  63. package/dist/mjs/utils/chunk-stream.browser.js +29 -5
  64. package/dist/mjs/utils/expose.js +1 -1
  65. package/dist/mjs/utils/http.js +17 -1
  66. package/dist/mjs/utils/type.js +2 -1
  67. package/dist/types/bee.d.ts +0 -4
  68. package/dist/types/index.d.ts +1 -0
  69. package/dist/types/modules/bzz.d.ts +0 -1
  70. package/dist/types/modules/debug/status.d.ts +1 -1
  71. package/dist/types/modules/gsoc.d.ts +0 -1
  72. package/dist/types/modules/pss.d.ts +0 -1
  73. package/dist/types/types/debug.d.ts +1 -0
  74. package/dist/types/types/index.d.ts +1 -0
  75. package/dist/types/utils/constants.d.ts +3 -3
  76. package/dist/types/utils/error.d.ts +2 -2
  77. package/dist/types/utils/expose.d.ts +1 -1
  78. package/dist/types/utils/tar.browser.d.ts +1 -1
  79. package/dist/types/utils/tar.d.ts +0 -1
  80. package/dist/types/utils/type.d.ts +0 -1
  81. package/package.json +10 -13
@@ -15,15 +15,41 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.makeTagUid = exports.prepareAllTagsOptions = exports.assertFileData = exports.assertData = exports.prepareTransactionOptions = exports.preparePostageBatchOptions = exports.prepareGsocMessageHandler = exports.preparePssMessageHandler = exports.isTag = exports.prepareCollectionUploadOptions = exports.prepareFileUploadOptions = exports.prepareRedundantUploadOptions = exports.prepareUploadOptions = exports.prepareDownloadOptions = exports.prepareBeeRequestOptions = exports.asNumberString = exports.isReadable = void 0;
36
+ exports.isReadable = isReadable;
37
+ exports.asNumberString = asNumberString;
38
+ exports.prepareBeeRequestOptions = prepareBeeRequestOptions;
39
+ exports.prepareDownloadOptions = prepareDownloadOptions;
40
+ exports.prepareUploadOptions = prepareUploadOptions;
41
+ exports.prepareRedundantUploadOptions = prepareRedundantUploadOptions;
42
+ exports.prepareFileUploadOptions = prepareFileUploadOptions;
43
+ exports.prepareCollectionUploadOptions = prepareCollectionUploadOptions;
44
+ exports.isTag = isTag;
45
+ exports.preparePssMessageHandler = preparePssMessageHandler;
46
+ exports.prepareGsocMessageHandler = prepareGsocMessageHandler;
47
+ exports.preparePostageBatchOptions = preparePostageBatchOptions;
48
+ exports.prepareTransactionOptions = prepareTransactionOptions;
49
+ exports.assertData = assertData;
50
+ exports.assertFileData = assertFileData;
51
+ exports.prepareAllTagsOptions = prepareAllTagsOptions;
52
+ exports.makeTagUid = makeTagUid;
27
53
  const cafe_utility_1 = require("cafe-utility");
28
54
  const stream = __importStar(require("stream"));
29
55
  const types_1 = require("../types");
@@ -32,14 +58,12 @@ const typed_bytes_1 = require("./typed-bytes");
32
58
  function isReadable(value) {
33
59
  return typeof stream.Readable !== 'undefined' && value instanceof stream.Readable;
34
60
  }
35
- exports.isReadable = isReadable;
36
61
  function asNumberString(value, options) {
37
62
  if (typeof value === 'bigint') {
38
63
  value = value.toString();
39
64
  }
40
65
  return cafe_utility_1.Types.asIntegerString(value, options);
41
66
  }
42
- exports.asNumberString = asNumberString;
43
67
  function prepareBeeRequestOptions(value) {
44
68
  const object = cafe_utility_1.Types.asObject(value, { name: 'BeeRequestOptions' });
45
69
  return {
@@ -50,9 +74,9 @@ function prepareBeeRequestOptions(value) {
50
74
  httpAgent: object.httpAgent,
51
75
  httpsAgent: object.httpsAgent,
52
76
  endlesslyRetry: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asBoolean(x, { name: 'endlesslyRetry' }), object.endlesslyRetry),
77
+ signal: object.signal,
53
78
  };
54
79
  }
55
- exports.prepareBeeRequestOptions = prepareBeeRequestOptions;
56
80
  function prepareDownloadOptions(value) {
57
81
  const object = cafe_utility_1.Types.asObject(value, { name: 'DownloadOptions' });
58
82
  return {
@@ -64,7 +88,6 @@ function prepareDownloadOptions(value) {
64
88
  actTimestamp: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asNumber(x, { name: 'actTimestamp' }), object.actTimestamp),
65
89
  };
66
90
  }
67
- exports.prepareDownloadOptions = prepareDownloadOptions;
68
91
  function prepareUploadOptions(value, name = 'UploadOptions') {
69
92
  const object = cafe_utility_1.Types.asObject(value, { name });
70
93
  return {
@@ -76,7 +99,6 @@ function prepareUploadOptions(value, name = 'UploadOptions') {
76
99
  tag: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'tag', min: 0 }), object.tag),
77
100
  };
78
101
  }
79
- exports.prepareUploadOptions = prepareUploadOptions;
80
102
  function prepareRedundantUploadOptions(value, name = 'UploadOptions') {
81
103
  const uploadOptions = prepareUploadOptions(value, name);
82
104
  const object = cafe_utility_1.Types.asObject(value, { name });
@@ -85,7 +107,6 @@ function prepareRedundantUploadOptions(value, name = 'UploadOptions') {
85
107
  redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
86
108
  };
87
109
  }
88
- exports.prepareRedundantUploadOptions = prepareRedundantUploadOptions;
89
110
  function prepareFileUploadOptions(value) {
90
111
  const uploadOptions = prepareUploadOptions(value, 'FileUploadOptions');
91
112
  const object = cafe_utility_1.Types.asObject(value, { name: 'FileUploadOptions' });
@@ -96,7 +117,6 @@ function prepareFileUploadOptions(value) {
96
117
  redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
97
118
  };
98
119
  }
99
- exports.prepareFileUploadOptions = prepareFileUploadOptions;
100
120
  function prepareCollectionUploadOptions(value) {
101
121
  const uploadOptions = prepareUploadOptions(value, 'CollectionUploadOptions');
102
122
  const object = cafe_utility_1.Types.asObject(value, { name: 'CollectionUploadOptions' });
@@ -107,7 +127,6 @@ function prepareCollectionUploadOptions(value) {
107
127
  redundancyLevel: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'redundancyLevel', min: 0 }), object.redundancyLevel),
108
128
  };
109
129
  }
110
- exports.prepareCollectionUploadOptions = prepareCollectionUploadOptions;
111
130
  function isTag(value) {
112
131
  try {
113
132
  const object = cafe_utility_1.Types.asObject(value, { name: 'Tag' });
@@ -118,7 +137,6 @@ function isTag(value) {
118
137
  return false;
119
138
  }
120
139
  }
121
- exports.isTag = isTag;
122
140
  function preparePssMessageHandler(value) {
123
141
  const object = cafe_utility_1.Types.asObject(value, { name: 'PssMessageHandler' });
124
142
  return {
@@ -127,7 +145,6 @@ function preparePssMessageHandler(value) {
127
145
  onClose: cafe_utility_1.Types.asFunction(object.onClose, { name: 'onClose' }),
128
146
  };
129
147
  }
130
- exports.preparePssMessageHandler = preparePssMessageHandler;
131
148
  function prepareGsocMessageHandler(value) {
132
149
  const object = cafe_utility_1.Types.asObject(value, { name: 'GsocMessageHandler' });
133
150
  return {
@@ -136,7 +153,6 @@ function prepareGsocMessageHandler(value) {
136
153
  onClose: cafe_utility_1.Types.asFunction(object.onClose, { name: 'onClose' }),
137
154
  };
138
155
  }
139
- exports.prepareGsocMessageHandler = prepareGsocMessageHandler;
140
156
  function preparePostageBatchOptions(value) {
141
157
  const object = cafe_utility_1.Types.asObject(value, { name: 'PostageBatchOptions' });
142
158
  return {
@@ -147,7 +163,6 @@ function preparePostageBatchOptions(value) {
147
163
  waitForUsableTimeout: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'waitForUsableTimeout', min: 0 }), object.waitForUsableTimeout),
148
164
  };
149
165
  }
150
- exports.preparePostageBatchOptions = preparePostageBatchOptions;
151
166
  function prepareTransactionOptions(value, name = 'TransactionOptions') {
152
167
  const object = cafe_utility_1.Types.asObject(value, { name });
153
168
  return {
@@ -155,7 +170,6 @@ function prepareTransactionOptions(value, name = 'TransactionOptions') {
155
170
  gasPrice: cafe_utility_1.Types.asOptional(x => asNumberString(x, { name: 'gasPrice', min: 0n }), object.gasPrice),
156
171
  };
157
172
  }
158
- exports.prepareTransactionOptions = prepareTransactionOptions;
159
173
  /**
160
174
  * Check whether the given parameter is valid data to upload
161
175
  * @param value
@@ -166,7 +180,6 @@ function assertData(value) {
166
180
  throw new TypeError('Data must be either string or Uint8Array!');
167
181
  }
168
182
  }
169
- exports.assertData = assertData;
170
183
  /**
171
184
  * Check whether the given parameter is a correct file representation to file upload.
172
185
  * @param value
@@ -177,7 +190,6 @@ function assertFileData(value) {
177
190
  throw new TypeError('Data must be either string, Readable, Uint8Array or File!');
178
191
  }
179
192
  }
180
- exports.assertFileData = assertFileData;
181
193
  /**
182
194
  * Checks whether optional options for AllTags query are valid
183
195
  * @param options
@@ -189,7 +201,6 @@ function prepareAllTagsOptions(value) {
189
201
  offset: cafe_utility_1.Types.asOptional(x => cafe_utility_1.Types.asInteger(x, { name: 'offset', min: 0 }), object.offset),
190
202
  };
191
203
  }
192
- exports.prepareAllTagsOptions = prepareAllTagsOptions;
193
204
  /**
194
205
  * Utility functions that return Tag UID
195
206
  * @param tagUid
@@ -206,4 +217,3 @@ function makeTagUid(tagUid) {
206
217
  }
207
218
  throw new TypeError(`Expected number | Tag | string from tagUid, got: ${tagUid}`);
208
219
  }
209
- exports.makeTagUid = makeTagUid;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripLastSlash = exports.assertBeeUrl = exports.isValidBeeUrl = void 0;
3
+ exports.isValidBeeUrl = isValidBeeUrl;
4
+ exports.assertBeeUrl = assertBeeUrl;
5
+ exports.stripLastSlash = stripLastSlash;
4
6
  const error_1 = require("./error");
5
7
  /**
6
8
  * Validates that passed string is valid URL of Bee.
@@ -21,7 +23,6 @@ function isValidBeeUrl(url) {
21
23
  return false;
22
24
  }
23
25
  }
24
- exports.isValidBeeUrl = isValidBeeUrl;
25
26
  /**
26
27
  * Validates that passed string is valid URL of Bee, if not it throws BeeArgumentError.
27
28
  * We support only HTTP and HTTPS protocols.
@@ -33,7 +34,6 @@ function assertBeeUrl(url) {
33
34
  throw new error_1.BeeArgumentError('URL is not valid!', url);
34
35
  }
35
36
  }
36
- exports.assertBeeUrl = assertBeeUrl;
37
37
  /**
38
38
  * Removes trailing slash out of the given string.
39
39
  * @param url
@@ -44,4 +44,3 @@ function stripLastSlash(url) {
44
44
  }
45
45
  return url;
46
46
  }
47
- exports.stripLastSlash = stripLastSlash;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  // TODO: Remove this file after the issue is fixed
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.normalizeCurrentPrice = exports.normalizeBatchTTL = void 0;
4
+ exports.normalizeBatchTTL = normalizeBatchTTL;
5
+ exports.normalizeCurrentPrice = normalizeCurrentPrice;
5
6
  function normalizeBatchTTL(batchTTL) {
6
7
  if (!Number.isInteger(batchTTL)) {
7
8
  return 1;
@@ -17,7 +18,6 @@ function normalizeBatchTTL(batchTTL) {
17
18
  }
18
19
  return batchTTL;
19
20
  }
20
- exports.normalizeBatchTTL = normalizeBatchTTL;
21
21
  function normalizeCurrentPrice(currentPrice) {
22
22
  if (!Number.isInteger(currentPrice)) {
23
23
  return 24000;
@@ -27,4 +27,3 @@ function normalizeCurrentPrice(currentPrice) {
27
27
  }
28
28
  return currentPrice;
29
29
  }
30
- exports.normalizeCurrentPrice = normalizeCurrentPrice;