@ethersphere/bee-js 3.3.2 → 3.3.4

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 (52) hide show
  1. package/LICENSE +24 -22
  2. package/dist/cjs/modules/debug/status.js +1 -1
  3. package/dist/cjs/utils/data.browser.js +6 -10
  4. package/dist/cjs/utils/data.js +4 -6
  5. package/dist/index.browser.min.js +1 -1
  6. package/dist/index.browser.min.js.map +1 -1
  7. package/dist/mjs/bee-debug.js +294 -189
  8. package/dist/mjs/bee.js +316 -237
  9. package/dist/mjs/chunk/signer.js +46 -12
  10. package/dist/mjs/chunk/soc.js +71 -31
  11. package/dist/mjs/chunk/span.js +1 -1
  12. package/dist/mjs/feed/index.js +86 -42
  13. package/dist/mjs/feed/json.js +46 -10
  14. package/dist/mjs/index.js +2 -1
  15. package/dist/mjs/modules/bytes.js +61 -24
  16. package/dist/mjs/modules/bzz.js +96 -58
  17. package/dist/mjs/modules/chunk.js +51 -16
  18. package/dist/mjs/modules/debug/balance.js +60 -20
  19. package/dist/mjs/modules/debug/chequebook.js +115 -67
  20. package/dist/mjs/modules/debug/chunk.js +47 -11
  21. package/dist/mjs/modules/debug/connectivity.js +76 -32
  22. package/dist/mjs/modules/debug/settlements.js +46 -10
  23. package/dist/mjs/modules/debug/stamps.js +91 -47
  24. package/dist/mjs/modules/debug/states.js +48 -12
  25. package/dist/mjs/modules/debug/status.js +98 -50
  26. package/dist/mjs/modules/debug/tag.js +39 -5
  27. package/dist/mjs/modules/debug/transactions.js +65 -25
  28. package/dist/mjs/modules/feed.js +50 -16
  29. package/dist/mjs/modules/pinning.js +67 -27
  30. package/dist/mjs/modules/pss.js +44 -10
  31. package/dist/mjs/modules/soc.js +47 -14
  32. package/dist/mjs/modules/status.js +37 -3
  33. package/dist/mjs/modules/stewardship.js +46 -10
  34. package/dist/mjs/modules/tag.js +73 -31
  35. package/dist/mjs/utils/collection.browser.js +41 -4
  36. package/dist/mjs/utils/collection.js +45 -11
  37. package/dist/mjs/utils/collection.node.js +137 -42
  38. package/dist/mjs/utils/data.browser.js +88 -53
  39. package/dist/mjs/utils/data.js +57 -22
  40. package/dist/mjs/utils/error.js +0 -9
  41. package/dist/mjs/utils/eth.js +68 -32
  42. package/dist/mjs/utils/file.js +42 -8
  43. package/dist/mjs/utils/headers.js +4 -4
  44. package/dist/mjs/utils/http.js +110 -64
  45. package/dist/mjs/utils/merge.js +2 -2
  46. package/dist/mjs/utils/stream.js +0 -4
  47. package/dist/mjs/utils/type.js +6 -6
  48. package/dist/types/modules/debug/status.d.ts +1 -1
  49. package/dist/types/types/debug.d.ts +19 -0
  50. package/dist/types/utils/data.browser.d.ts +0 -1
  51. package/dist/types/utils/data.d.ts +2 -2
  52. package/package.json +14 -13
package/LICENSE CHANGED
@@ -1,27 +1,29 @@
1
- Copyright (c) 2020 The Swarm Authors. All rights reserved.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, The Swarm Authors
4
+ All rights reserved.
2
5
 
3
6
  Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
6
15
 
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above
10
- copyright notice, this list of conditions and the following disclaimer
11
- in the documentation and/or other materials provided with the
12
- distribution.
13
- * Neither the name of Swarm nor the names of its
14
- contributors may be used to endorse or promote products derived from
15
- this software without specific prior written permission.
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
16
19
 
17
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
29
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -17,7 +17,7 @@ const http_1 = require("../../utils/http");
17
17
  const major_js_1 = __importDefault(require("semver/functions/major.js"));
18
18
  // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
19
19
  // so if you are changing anything about them change the `update_bee` action accordingly!
20
- exports.SUPPORTED_BEE_VERSION_EXACT = '1.5.0-dda5606e';
20
+ exports.SUPPORTED_BEE_VERSION_EXACT = '1.5.1-d0a77598';
21
21
  exports.SUPPORTED_API_VERSION = '3.0.0';
22
22
  exports.SUPPORTED_DEBUG_API_VERSION = '2.0.0';
23
23
  exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT.substring(0, exports.SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
@@ -8,13 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.prepareWebsocketData = exports.prepareData = void 0;
16
13
  const stream_1 = require("./stream");
17
- const cross_blob_1 = __importDefault(require("cross-blob"));
18
14
  /**
19
15
  * Validates input and converts to Uint8Array
20
16
  *
@@ -23,11 +19,11 @@ const cross_blob_1 = __importDefault(require("cross-blob"));
23
19
  function prepareData(data) {
24
20
  return __awaiter(this, void 0, void 0, function* () {
25
21
  if (typeof data === 'string')
26
- return new cross_blob_1.default([data], { type: 'text/plain' });
22
+ return new Blob([data], { type: 'text/plain' });
27
23
  if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
28
- return new cross_blob_1.default([data], { type: 'application/octet-stream' });
24
+ return new Blob([data], { type: 'application/octet-stream' });
29
25
  }
30
- if (data instanceof cross_blob_1.default) {
26
+ if (data instanceof Blob) {
31
27
  return data;
32
28
  }
33
29
  // Currently it is not possible to stream requests from browsers
@@ -41,7 +37,7 @@ function prepareData(data) {
41
37
  buffers.push(d);
42
38
  });
43
39
  data.on('end', () => {
44
- resolve(new cross_blob_1.default(buffers, { type: 'application/octet-stream' }));
40
+ resolve(new Blob(buffers, { type: 'application/octet-stream' }));
45
41
  });
46
42
  });
47
43
  }
@@ -57,7 +53,7 @@ function prepareData(data) {
57
53
  buffers.push(value);
58
54
  }
59
55
  } while (!done);
60
- resolve(new cross_blob_1.default(buffers, { type: 'application/octet-stream' }));
56
+ resolve(new Blob(buffers, { type: 'application/octet-stream' }));
61
57
  }));
62
58
  }
63
59
  throw new TypeError('unknown data type');
@@ -70,7 +66,7 @@ function prepareWebsocketData(data) {
70
66
  return new TextEncoder().encode(data);
71
67
  if (data instanceof ArrayBuffer)
72
68
  return new Uint8Array(data);
73
- if (data instanceof cross_blob_1.default)
69
+ if (data instanceof Blob)
74
70
  return new Uint8Array(yield new Response(data).arrayBuffer());
75
71
  throw new TypeError('unknown websocket data type');
76
72
  });
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.prepareWebsocketData = exports.prepareData = void 0;
16
- const cross_blob_1 = __importDefault(require("cross-blob"));
16
+ const fetch_blob_1 = __importDefault(require("fetch-blob"));
17
17
  const stream_1 = require("./stream");
18
18
  /**
19
19
  * Prepare data for valid input for node-fetch.
@@ -26,11 +26,11 @@ const stream_1 = require("./stream");
26
26
  function prepareData(data) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  if (typeof data === 'string')
29
- return new cross_blob_1.default([data], { type: 'text/plain' });
29
+ return new fetch_blob_1.default([data], { type: 'text/plain' });
30
30
  if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
31
- return new cross_blob_1.default([data], { type: 'application/octet-stream' });
31
+ return new fetch_blob_1.default([data], { type: 'application/octet-stream' });
32
32
  }
33
- if (data instanceof cross_blob_1.default || (0, stream_1.isNodeReadable)(data))
33
+ if (data instanceof fetch_blob_1.default || (0, stream_1.isNodeReadable)(data))
34
34
  return data;
35
35
  if ((0, stream_1.isReadableStream)(data)) {
36
36
  return (0, stream_1.readableWebToNode)(data);
@@ -50,8 +50,6 @@ function prepareWebsocketData(data) {
50
50
  return new Uint8Array(data);
51
51
  if (data instanceof ArrayBuffer)
52
52
  return new Uint8Array(data);
53
- if (data instanceof cross_blob_1.default)
54
- return new Uint8Array(yield new Response(data).arrayBuffer());
55
53
  if (isBufferArray(data))
56
54
  return new Uint8Array(Buffer.concat(data));
57
55
  throw new TypeError('unknown websocket data type');