@ethersphere/bee-js 3.3.2 → 3.4.0-pre.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 (48) hide show
  1. package/dist/cjs/utils/data.browser.js +6 -10
  2. package/dist/cjs/utils/data.js +4 -6
  3. package/dist/index.browser.min.js +1 -1
  4. package/dist/index.browser.min.js.map +1 -1
  5. package/dist/mjs/bee-debug.js +294 -189
  6. package/dist/mjs/bee.js +316 -237
  7. package/dist/mjs/chunk/signer.js +46 -12
  8. package/dist/mjs/chunk/soc.js +71 -31
  9. package/dist/mjs/chunk/span.js +1 -1
  10. package/dist/mjs/feed/index.js +86 -42
  11. package/dist/mjs/feed/json.js +46 -10
  12. package/dist/mjs/index.js +2 -1
  13. package/dist/mjs/modules/bytes.js +61 -24
  14. package/dist/mjs/modules/bzz.js +96 -58
  15. package/dist/mjs/modules/chunk.js +51 -16
  16. package/dist/mjs/modules/debug/balance.js +60 -20
  17. package/dist/mjs/modules/debug/chequebook.js +115 -67
  18. package/dist/mjs/modules/debug/chunk.js +47 -11
  19. package/dist/mjs/modules/debug/connectivity.js +76 -32
  20. package/dist/mjs/modules/debug/settlements.js +46 -10
  21. package/dist/mjs/modules/debug/stamps.js +91 -47
  22. package/dist/mjs/modules/debug/states.js +48 -12
  23. package/dist/mjs/modules/debug/status.js +97 -49
  24. package/dist/mjs/modules/debug/tag.js +39 -5
  25. package/dist/mjs/modules/debug/transactions.js +65 -25
  26. package/dist/mjs/modules/feed.js +50 -16
  27. package/dist/mjs/modules/pinning.js +67 -27
  28. package/dist/mjs/modules/pss.js +44 -10
  29. package/dist/mjs/modules/soc.js +47 -14
  30. package/dist/mjs/modules/status.js +37 -3
  31. package/dist/mjs/modules/stewardship.js +46 -10
  32. package/dist/mjs/modules/tag.js +73 -31
  33. package/dist/mjs/utils/collection.browser.js +41 -4
  34. package/dist/mjs/utils/collection.js +45 -11
  35. package/dist/mjs/utils/collection.node.js +137 -42
  36. package/dist/mjs/utils/data.browser.js +88 -53
  37. package/dist/mjs/utils/data.js +57 -22
  38. package/dist/mjs/utils/error.js +0 -9
  39. package/dist/mjs/utils/eth.js +68 -32
  40. package/dist/mjs/utils/file.js +42 -8
  41. package/dist/mjs/utils/headers.js +4 -4
  42. package/dist/mjs/utils/http.js +110 -64
  43. package/dist/mjs/utils/merge.js +2 -2
  44. package/dist/mjs/utils/stream.js +0 -4
  45. package/dist/mjs/utils/type.js +6 -6
  46. package/dist/types/utils/data.browser.d.ts +0 -1
  47. package/dist/types/utils/data.d.ts +2 -2
  48. package/package.json +14 -13
@@ -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');