@ethersphere/bee-js 3.3.2-pre.1 → 3.3.3

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 (42) hide show
  1. package/dist/mjs/bee-debug.js +294 -189
  2. package/dist/mjs/bee.js +316 -237
  3. package/dist/mjs/chunk/signer.js +46 -12
  4. package/dist/mjs/chunk/soc.js +71 -31
  5. package/dist/mjs/chunk/span.js +1 -1
  6. package/dist/mjs/feed/index.js +86 -42
  7. package/dist/mjs/feed/json.js +46 -10
  8. package/dist/mjs/index.js +2 -1
  9. package/dist/mjs/modules/bytes.js +61 -24
  10. package/dist/mjs/modules/bzz.js +96 -58
  11. package/dist/mjs/modules/chunk.js +51 -16
  12. package/dist/mjs/modules/debug/balance.js +60 -20
  13. package/dist/mjs/modules/debug/chequebook.js +115 -67
  14. package/dist/mjs/modules/debug/chunk.js +47 -11
  15. package/dist/mjs/modules/debug/connectivity.js +76 -32
  16. package/dist/mjs/modules/debug/settlements.js +46 -10
  17. package/dist/mjs/modules/debug/stamps.js +91 -47
  18. package/dist/mjs/modules/debug/states.js +48 -12
  19. package/dist/mjs/modules/debug/status.js +97 -49
  20. package/dist/mjs/modules/debug/tag.js +39 -5
  21. package/dist/mjs/modules/debug/transactions.js +65 -25
  22. package/dist/mjs/modules/feed.js +50 -16
  23. package/dist/mjs/modules/pinning.js +67 -27
  24. package/dist/mjs/modules/pss.js +44 -10
  25. package/dist/mjs/modules/soc.js +47 -14
  26. package/dist/mjs/modules/status.js +37 -3
  27. package/dist/mjs/modules/stewardship.js +46 -10
  28. package/dist/mjs/modules/tag.js +73 -31
  29. package/dist/mjs/utils/collection.browser.js +41 -4
  30. package/dist/mjs/utils/collection.js +45 -11
  31. package/dist/mjs/utils/collection.node.js +137 -42
  32. package/dist/mjs/utils/data.browser.js +88 -52
  33. package/dist/mjs/utils/data.js +57 -21
  34. package/dist/mjs/utils/error.js +0 -9
  35. package/dist/mjs/utils/eth.js +68 -32
  36. package/dist/mjs/utils/file.js +42 -8
  37. package/dist/mjs/utils/headers.js +4 -4
  38. package/dist/mjs/utils/http.js +110 -64
  39. package/dist/mjs/utils/merge.js +2 -2
  40. package/dist/mjs/utils/stream.js +0 -4
  41. package/dist/mjs/utils/type.js +6 -6
  42. package/package.json +2 -2
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../../utils/http.js";
2
34
  const endpoint = 'chunks';
3
35
  /**
@@ -9,12 +41,14 @@ const endpoint = 'chunks';
9
41
  * @returns BeeGenericResponse if chunk is found or throws an exception
10
42
  */
11
43
 
12
- export async function checkIfChunkExistsLocally(ky, address) {
13
- const response = await http(ky, {
14
- path: endpoint + `/${address}`,
15
- responseType: 'json'
44
+ export function checkIfChunkExistsLocally(ky, address) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const response = yield http(ky, {
47
+ path: endpoint + `/${address}`,
48
+ responseType: 'json'
49
+ });
50
+ return response.data;
16
51
  });
17
- return response.data;
18
52
  }
19
53
  /**
20
54
  * Delete a chunk from local storage
@@ -25,11 +59,13 @@ export async function checkIfChunkExistsLocally(ky, address) {
25
59
  * @returns BeeGenericResponse if chunk was deleted or throws an exception
26
60
  */
27
61
 
28
- export async function deleteChunkFromLocalStorage(ky, address) {
29
- const response = await http(ky, {
30
- method: 'delete',
31
- path: endpoint + `/${address}`,
32
- responseType: 'json'
62
+ export function deleteChunkFromLocalStorage(ky, address) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const response = yield http(ky, {
65
+ method: 'delete',
66
+ path: endpoint + `/${address}`,
67
+ responseType: 'json'
68
+ });
69
+ return response.data;
33
70
  });
34
- return response.data;
35
71
  }
@@ -1,45 +1,89 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../../utils/http.js";
2
- export async function getNodeAddresses(ky) {
3
- const response = await http(ky, {
4
- path: 'addresses',
5
- responseType: 'json'
34
+ export function getNodeAddresses(ky) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const response = yield http(ky, {
37
+ path: 'addresses',
38
+ responseType: 'json'
39
+ });
40
+ return response.data;
6
41
  });
7
- return response.data;
8
42
  }
9
- export async function getPeers(ky) {
10
- const response = await http(ky, {
11
- path: 'peers',
12
- responseType: 'json'
43
+ export function getPeers(ky) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const response = yield http(ky, {
46
+ path: 'peers',
47
+ responseType: 'json'
48
+ });
49
+ return response.data.peers || [];
13
50
  });
14
- return response.data.peers || [];
15
51
  }
16
- export async function getBlocklist(ky) {
17
- const response = await http(ky, {
18
- path: 'blocklist',
19
- responseType: 'json'
52
+ export function getBlocklist(ky) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const response = yield http(ky, {
55
+ path: 'blocklist',
56
+ responseType: 'json'
57
+ });
58
+ return response.data.peers || [];
20
59
  });
21
- return response.data.peers || [];
22
60
  }
23
- export async function removePeer(ky, peer) {
24
- const response = await http(ky, {
25
- path: `peers/${peer}`,
26
- responseType: 'json',
27
- method: 'DELETE'
61
+ export function removePeer(ky, peer) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const response = yield http(ky, {
64
+ path: `peers/${peer}`,
65
+ responseType: 'json',
66
+ method: 'DELETE'
67
+ });
68
+ return response.data;
28
69
  });
29
- return response.data;
30
70
  }
31
- export async function getTopology(ky) {
32
- const response = await http(ky, {
33
- path: `topology`,
34
- responseType: 'json'
71
+ export function getTopology(ky) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const response = yield http(ky, {
74
+ path: `topology`,
75
+ responseType: 'json'
76
+ });
77
+ return response.data;
35
78
  });
36
- return response.data;
37
79
  }
38
- export async function pingPeer(ky, peer) {
39
- const response = await http(ky, {
40
- path: `pingpong/${peer}`,
41
- responseType: 'json',
42
- method: 'POST'
80
+ export function pingPeer(ky, peer) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const response = yield http(ky, {
83
+ path: `pingpong/${peer}`,
84
+ responseType: 'json',
85
+ method: 'POST'
86
+ });
87
+ return response.data;
43
88
  });
44
- return response.data;
45
89
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../../utils/http.js";
2
34
  const settlementsEndpoint = 'settlements';
3
35
  /**
@@ -7,12 +39,14 @@ const settlementsEndpoint = 'settlements';
7
39
  * @param peer Swarm address of peer
8
40
  */
9
41
 
10
- export async function getSettlements(ky, peer) {
11
- const response = await http(ky, {
12
- path: `${settlementsEndpoint}/${peer}`,
13
- responseType: 'json'
42
+ export function getSettlements(ky, peer) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const response = yield http(ky, {
45
+ path: `${settlementsEndpoint}/${peer}`,
46
+ responseType: 'json'
47
+ });
48
+ return response.data;
14
49
  });
15
- return response.data;
16
50
  }
17
51
  /**
18
52
  * Get settlements with all known peers and total amount sent or received
@@ -20,10 +54,12 @@ export async function getSettlements(ky, peer) {
20
54
  * @param ky Ky debug instance
21
55
  */
22
56
 
23
- export async function getAllSettlements(ky) {
24
- const response = await http(ky, {
25
- path: settlementsEndpoint,
26
- responseType: 'json'
57
+ export function getAllSettlements(ky) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const response = yield http(ky, {
60
+ path: settlementsEndpoint,
61
+ responseType: 'json'
62
+ });
63
+ return response.data;
27
64
  });
28
- return response.data;
29
65
  }
@@ -1,64 +1,108 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../../utils/http.js";
2
34
  const STAMPS_ENDPOINT = 'stamps';
3
- export async function getAllPostageBatches(ky) {
4
- const response = await http(ky, {
5
- method: 'get',
6
- path: `${STAMPS_ENDPOINT}`,
7
- responseType: 'json'
35
+ export function getAllPostageBatches(ky) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const response = yield http(ky, {
38
+ method: 'get',
39
+ path: `${STAMPS_ENDPOINT}`,
40
+ responseType: 'json'
41
+ });
42
+ return response.data.stamps || [];
8
43
  });
9
- return response.data.stamps || [];
10
44
  }
11
- export async function getPostageBatch(ky, postageBatchId) {
12
- const response = await http(ky, {
13
- method: 'get',
14
- path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
15
- responseType: 'json'
45
+ export function getPostageBatch(ky, postageBatchId) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const response = yield http(ky, {
48
+ method: 'get',
49
+ path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
50
+ responseType: 'json'
51
+ });
52
+ return response.data;
16
53
  });
17
- return response.data;
18
54
  }
19
- export async function getPostageBatchBuckets(ky, postageBatchId) {
20
- const response = await http(ky, {
21
- method: 'get',
22
- path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
23
- responseType: 'json'
55
+ export function getPostageBatchBuckets(ky, postageBatchId) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const response = yield http(ky, {
58
+ method: 'get',
59
+ path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
60
+ responseType: 'json'
61
+ });
62
+ return response.data;
24
63
  });
25
- return response.data;
26
64
  }
27
- export async function createPostageBatch(ky, amount, depth, options) {
28
- const headers = {};
65
+ export function createPostageBatch(ky, amount, depth, options) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const headers = {};
29
68
 
30
- if (options?.gasPrice) {
31
- headers['gas-price'] = options.gasPrice.toString();
32
- }
69
+ if (options === null || options === void 0 ? void 0 : options.gasPrice) {
70
+ headers['gas-price'] = options.gasPrice.toString();
71
+ }
33
72
 
34
- if (options?.immutableFlag !== undefined) {
35
- headers.immutable = String(options.immutableFlag);
36
- }
73
+ if ((options === null || options === void 0 ? void 0 : options.immutableFlag) !== undefined) {
74
+ headers.immutable = String(options.immutableFlag);
75
+ }
37
76
 
38
- const response = await http(ky, {
39
- method: 'post',
40
- path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
41
- responseType: 'json',
42
- searchParams: {
43
- label: options?.label
44
- },
45
- headers
77
+ const response = yield http(ky, {
78
+ method: 'post',
79
+ path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
80
+ responseType: 'json',
81
+ searchParams: {
82
+ label: options === null || options === void 0 ? void 0 : options.label
83
+ },
84
+ headers
85
+ });
86
+ return response.data.batchID;
46
87
  });
47
- return response.data.batchID;
48
88
  }
49
- export async function topUpBatch(ky, id, amount) {
50
- const response = await http(ky, {
51
- method: 'patch',
52
- path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
53
- responseType: 'json'
89
+ export function topUpBatch(ky, id, amount) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const response = yield http(ky, {
92
+ method: 'patch',
93
+ path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
94
+ responseType: 'json'
95
+ });
96
+ return response.data.batchID;
54
97
  });
55
- return response.data.batchID;
56
98
  }
57
- export async function diluteBatch(ky, id, depth) {
58
- const response = await http(ky, {
59
- method: 'patch',
60
- path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
61
- responseType: 'json'
99
+ export function diluteBatch(ky, id, depth) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const response = yield http(ky, {
102
+ method: 'patch',
103
+ path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
104
+ responseType: 'json'
105
+ });
106
+ return response.data.batchID;
62
107
  });
63
- return response.data.batchID;
64
108
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../../utils/http.js";
2
34
  const RESERVE_STATE_ENDPOINT = 'reservestate';
3
35
  const CHAIN_STATE_ENDPOINT = 'chainstate';
@@ -7,13 +39,15 @@ const CHAIN_STATE_ENDPOINT = 'chainstate';
7
39
  * @param ky Ky debug instance
8
40
  */
9
41
 
10
- export async function getReserveState(ky) {
11
- const response = await http(ky, {
12
- method: 'get',
13
- path: `${RESERVE_STATE_ENDPOINT}`,
14
- responseType: 'json'
42
+ export function getReserveState(ky) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const response = yield http(ky, {
45
+ method: 'get',
46
+ path: `${RESERVE_STATE_ENDPOINT}`,
47
+ responseType: 'json'
48
+ });
49
+ return response.data;
15
50
  });
16
- return response.data;
17
51
  }
18
52
  /**
19
53
  * Get state of reserve
@@ -21,11 +55,13 @@ export async function getReserveState(ky) {
21
55
  * @param ky Ky debug instance
22
56
  */
23
57
 
24
- export async function getChainState(ky) {
25
- const response = await http(ky, {
26
- method: 'get',
27
- path: `${CHAIN_STATE_ENDPOINT}`,
28
- responseType: 'json'
58
+ export function getChainState(ky) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const response = yield http(ky, {
61
+ method: 'get',
62
+ path: `${CHAIN_STATE_ENDPOINT}`,
63
+ responseType: 'json'
64
+ });
65
+ return response.data;
29
66
  });
30
- return response.data;
31
67
  }