@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
@@ -1,8 +1,40 @@
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
  import getMajorSemver from 'semver/functions/major.js'; // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
3
35
  // so if you are changing anything about them change the `update_bee` action accordingly!
4
36
 
5
- export const SUPPORTED_BEE_VERSION_EXACT = '1.5.0-dda5606e';
37
+ export const SUPPORTED_BEE_VERSION_EXACT = '1.5.1-d0a77598';
6
38
  export const SUPPORTED_API_VERSION = '3.0.0';
7
39
  export const SUPPORTED_DEBUG_API_VERSION = '2.0.0';
8
40
  export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.substring(0, SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
@@ -14,13 +46,15 @@ const HEALTH_URL = 'health';
14
46
  * @param ky Ky debug instance
15
47
  */
16
48
 
17
- export async function getHealth(ky) {
18
- const response = await http(ky, {
19
- method: 'get',
20
- path: HEALTH_URL,
21
- responseType: 'json'
49
+ export function getHealth(ky) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const response = yield http(ky, {
52
+ method: 'get',
53
+ path: HEALTH_URL,
54
+ responseType: 'json'
55
+ });
56
+ return response.data;
22
57
  });
23
- return response.data;
24
58
  }
25
59
  /**
26
60
  * Get information about Bee node
@@ -28,13 +62,15 @@ export async function getHealth(ky) {
28
62
  * @param ky Ky debug instance
29
63
  */
30
64
 
31
- export async function getNodeInfo(ky) {
32
- const response = await http(ky, {
33
- method: 'get',
34
- path: NODE_INFO_URL,
35
- responseType: 'json'
65
+ export function getNodeInfo(ky) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const response = yield http(ky, {
68
+ method: 'get',
69
+ path: NODE_INFO_URL,
70
+ responseType: 'json'
71
+ });
72
+ return response.data;
36
73
  });
37
- return response.data;
38
74
  }
39
75
  /**
40
76
  * Connects to a node and checks if it is a supported Bee version by the bee-js
@@ -45,8 +81,10 @@ export async function getNodeInfo(ky) {
45
81
  * @deprecated Use `isSupportedExactVersion` instead
46
82
  */
47
83
 
48
- export async function isSupportedVersion(ky) {
49
- return isSupportedExactVersion(ky);
84
+ export function isSupportedVersion(ky) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ return isSupportedExactVersion(ky);
87
+ });
50
88
  }
51
89
  /**
52
90
  * Connects to a node and checks if its version matches with the one that bee-js supports.
@@ -59,11 +97,13 @@ export async function isSupportedVersion(ky) {
59
97
  * @param ky
60
98
  */
61
99
 
62
- export async function isSupportedExactVersion(ky) {
63
- const {
64
- version
65
- } = await getHealth(ky);
66
- return version === SUPPORTED_BEE_VERSION_EXACT;
100
+ export function isSupportedExactVersion(ky) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const {
103
+ version
104
+ } = yield getHealth(ky);
105
+ return version === SUPPORTED_BEE_VERSION_EXACT;
106
+ });
67
107
  }
68
108
  /**
69
109
  * Connects to a node and checks if its main's API version matches with the one that bee-js supports.
@@ -74,11 +114,13 @@ export async function isSupportedExactVersion(ky) {
74
114
  * @param ky
75
115
  */
76
116
 
77
- export async function isSupportedMainApiVersion(ky) {
78
- const {
79
- apiVersion
80
- } = await getHealth(ky);
81
- return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION);
117
+ export function isSupportedMainApiVersion(ky) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const {
120
+ apiVersion
121
+ } = yield getHealth(ky);
122
+ return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION);
123
+ });
82
124
  }
83
125
  /**
84
126
  * Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
@@ -89,11 +131,13 @@ export async function isSupportedMainApiVersion(ky) {
89
131
  * @param ky
90
132
  */
91
133
 
92
- export async function isSupportedDebugApiVersion(ky) {
93
- const {
94
- debugApiVersion
95
- } = await getHealth(ky);
96
- return getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
134
+ export function isSupportedDebugApiVersion(ky) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const {
137
+ debugApiVersion
138
+ } = yield getHealth(ky);
139
+ return getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
140
+ });
97
141
  }
98
142
  /**
99
143
  * Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
@@ -103,12 +147,14 @@ export async function isSupportedDebugApiVersion(ky) {
103
147
  * @param ky
104
148
  */
105
149
 
106
- export async function isSupportedApiVersion(ky) {
107
- const {
108
- apiVersion,
109
- debugApiVersion
110
- } = await getHealth(ky);
111
- return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION) && getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
150
+ export function isSupportedApiVersion(ky) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ const {
153
+ apiVersion,
154
+ debugApiVersion
155
+ } = yield getHealth(ky);
156
+ return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION) && getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
157
+ });
112
158
  }
113
159
  /**
114
160
  * Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
@@ -117,18 +163,20 @@ export async function isSupportedApiVersion(ky) {
117
163
  * @param ky
118
164
  */
119
165
 
120
- export async function getVersions(ky) {
121
- const {
122
- version,
123
- apiVersion,
124
- debugApiVersion
125
- } = await getHealth(ky);
126
- return {
127
- supportedBeeVersion: SUPPORTED_BEE_VERSION_EXACT,
128
- supportedBeeApiVersion: SUPPORTED_API_VERSION,
129
- supportedBeeDebugApiVersion: SUPPORTED_DEBUG_API_VERSION,
130
- beeVersion: version,
131
- beeApiVersion: apiVersion,
132
- beeDebugApiVersion: debugApiVersion
133
- };
166
+ export function getVersions(ky) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ const {
169
+ version,
170
+ apiVersion,
171
+ debugApiVersion
172
+ } = yield getHealth(ky);
173
+ return {
174
+ supportedBeeVersion: SUPPORTED_BEE_VERSION_EXACT,
175
+ supportedBeeApiVersion: SUPPORTED_API_VERSION,
176
+ supportedBeeDebugApiVersion: SUPPORTED_DEBUG_API_VERSION,
177
+ beeVersion: version,
178
+ beeApiVersion: apiVersion,
179
+ beeDebugApiVersion: debugApiVersion
180
+ };
181
+ });
134
182
  }
@@ -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 = 'tags';
3
35
  /**
@@ -7,10 +39,12 @@ const endpoint = 'tags';
7
39
  * @param uid UID of tag to be retrieved
8
40
  */
9
41
 
10
- export async function retrieveExtendedTag(ky, uid) {
11
- const response = await http(ky, {
12
- path: `${endpoint}/${uid}`,
13
- responseType: 'json'
42
+ export function retrieveExtendedTag(ky, uid) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const response = yield http(ky, {
45
+ path: `${endpoint}/${uid}`,
46
+ responseType: 'json'
47
+ });
48
+ return response.data;
14
49
  });
15
- return response.data;
16
50
  }
@@ -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 transactionsEndpoint = 'transactions';
3
35
  /**
@@ -6,12 +38,14 @@ const transactionsEndpoint = 'transactions';
6
38
  * @param ky Debug Ky instance
7
39
  */
8
40
 
9
- export async function getAllTransactions(ky) {
10
- const response = await http(ky, {
11
- path: transactionsEndpoint,
12
- responseType: 'json'
41
+ export function getAllTransactions(ky) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const response = yield http(ky, {
44
+ path: transactionsEndpoint,
45
+ responseType: 'json'
46
+ });
47
+ return response.data.pendingTransactions;
13
48
  });
14
- return response.data.pendingTransactions;
15
49
  }
16
50
  /**
17
51
  * Get information for specific pending transactions
@@ -20,12 +54,14 @@ export async function getAllTransactions(ky) {
20
54
  * @param transactionHash Hash of the transaction
21
55
  */
22
56
 
23
- export async function getTransaction(ky, transactionHash) {
24
- const response = await http(ky, {
25
- path: `${transactionsEndpoint}/${transactionHash}`,
26
- responseType: 'json'
57
+ export function getTransaction(ky, transactionHash) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const response = yield http(ky, {
60
+ path: `${transactionsEndpoint}/${transactionHash}`,
61
+ responseType: 'json'
62
+ });
63
+ return response.data;
27
64
  });
28
- return response.data;
29
65
  }
30
66
  /**
31
67
  * Rebroadcast existing transaction
@@ -34,13 +70,15 @@ export async function getTransaction(ky, transactionHash) {
34
70
  * @param transactionHash Hash of the transaction
35
71
  */
36
72
 
37
- export async function rebroadcastTransaction(ky, transactionHash) {
38
- const response = await http(ky, {
39
- method: 'post',
40
- path: `${transactionsEndpoint}/${transactionHash}`,
41
- responseType: 'json'
73
+ export function rebroadcastTransaction(ky, transactionHash) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const response = yield http(ky, {
76
+ method: 'post',
77
+ path: `${transactionsEndpoint}/${transactionHash}`,
78
+ responseType: 'json'
79
+ });
80
+ return response.data.transactionHash;
42
81
  });
43
- return response.data.transactionHash;
44
82
  }
45
83
  /**
46
84
  * Cancel existing transaction
@@ -50,14 +88,16 @@ export async function rebroadcastTransaction(ky, transactionHash) {
50
88
  * @param gasPrice Optional gas price
51
89
  */
52
90
 
53
- export async function cancelTransaction(ky, transactionHash, gasPrice) {
54
- const response = await http(ky, {
55
- method: 'delete',
56
- headers: {
57
- 'gas-price': gasPrice
58
- },
59
- path: `${transactionsEndpoint}/${transactionHash}`,
60
- responseType: 'json'
91
+ export function cancelTransaction(ky, transactionHash, gasPrice) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const response = yield http(ky, {
94
+ method: 'delete',
95
+ headers: {
96
+ 'gas-price': gasPrice
97
+ },
98
+ path: `${transactionsEndpoint}/${transactionHash}`,
99
+ responseType: 'json'
100
+ });
101
+ return response.data.transactionHash;
61
102
  });
62
- return response.data.transactionHash;
63
103
  }
@@ -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 { filterHeaders, http } from "../utils/http.js";
2
34
  import { extractUploadHeaders } from "../utils/headers.js";
3
35
  import { BeeError } from "../utils/error.js";
@@ -12,15 +44,17 @@ const feedEndpoint = 'feeds';
12
44
  * @param options Additional options, like type (default: 'sequence')
13
45
  */
14
46
 
15
- export async function createFeedManifest(ky, owner, topic, postageBatchId, options) {
16
- const response = await http(ky, {
17
- method: 'post',
18
- responseType: 'json',
19
- path: `${feedEndpoint}/${owner}/${topic}`,
20
- searchParams: filterHeaders(options),
21
- headers: extractUploadHeaders(postageBatchId)
47
+ export function createFeedManifest(ky, owner, topic, postageBatchId, options) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const response = yield http(ky, {
50
+ method: 'post',
51
+ responseType: 'json',
52
+ path: `${feedEndpoint}/${owner}/${topic}`,
53
+ searchParams: filterHeaders(options),
54
+ headers: extractUploadHeaders(postageBatchId)
55
+ });
56
+ return response.data.reference;
22
57
  });
23
- return response.data.reference;
24
58
  }
25
59
 
26
60
  function readFeedUpdateHeaders(headers) {
@@ -55,13 +89,13 @@ function readFeedUpdateHeaders(headers) {
55
89
  */
56
90
 
57
91
 
58
- export async function fetchFeedUpdate(ky, owner, topic, options) {
59
- const response = await http(ky, {
60
- responseType: 'json',
61
- path: `${feedEndpoint}/${owner}/${topic}`,
62
- searchParams: filterHeaders(options)
92
+ export function fetchFeedUpdate(ky, owner, topic, options) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const response = yield http(ky, {
95
+ responseType: 'json',
96
+ path: `${feedEndpoint}/${owner}/${topic}`,
97
+ searchParams: filterHeaders(options)
98
+ });
99
+ return Object.assign(Object.assign({}, response.data), readFeedUpdateHeaders(response.headers));
63
100
  });
64
- return { ...response.data,
65
- ...readFeedUpdateHeaders(response.headers)
66
- };
67
101
  }
@@ -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 PINNING_ENDPOINT = 'pins';
3
35
  /**
@@ -7,11 +39,13 @@ const PINNING_ENDPOINT = 'pins';
7
39
  * @param reference Bee data reference
8
40
  */
9
41
 
10
- export async function pin(ky, reference) {
11
- await http(ky, {
12
- method: 'post',
13
- responseType: 'json',
14
- path: `${PINNING_ENDPOINT}/${reference}`
42
+ export function pin(ky, reference) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ yield http(ky, {
45
+ method: 'post',
46
+ responseType: 'json',
47
+ path: `${PINNING_ENDPOINT}/${reference}`
48
+ });
15
49
  });
16
50
  }
17
51
  /**
@@ -21,11 +55,13 @@ export async function pin(ky, reference) {
21
55
  * @param reference Bee data reference
22
56
  */
23
57
 
24
- export async function unpin(ky, reference) {
25
- await http(ky, {
26
- method: 'delete',
27
- responseType: 'json',
28
- path: `${PINNING_ENDPOINT}/${reference}`
58
+ export function unpin(ky, reference) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ yield http(ky, {
61
+ method: 'delete',
62
+ responseType: 'json',
63
+ path: `${PINNING_ENDPOINT}/${reference}`
64
+ });
29
65
  });
30
66
  }
31
67
  /**
@@ -36,13 +72,15 @@ export async function unpin(ky, reference) {
36
72
  * @throws Error if given address is not pinned
37
73
  */
38
74
 
39
- export async function getPin(ky, reference) {
40
- const response = await http(ky, {
41
- method: 'get',
42
- responseType: 'json',
43
- path: `${PINNING_ENDPOINT}/${reference}`
75
+ export function getPin(ky, reference) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const response = yield http(ky, {
78
+ method: 'get',
79
+ responseType: 'json',
80
+ path: `${PINNING_ENDPOINT}/${reference}`
81
+ });
82
+ return response.data;
44
83
  });
45
- return response.data;
46
84
  }
47
85
  /**
48
86
  * Get list of all pins
@@ -50,17 +88,19 @@ export async function getPin(ky, reference) {
50
88
  * @param ky Ky instance
51
89
  */
52
90
 
53
- export async function getAllPins(ky) {
54
- const response = await http(ky, {
55
- method: 'get',
56
- responseType: 'json',
57
- path: `${PINNING_ENDPOINT}`
58
- });
59
- const result = response.data.references;
91
+ export function getAllPins(ky) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const response = yield http(ky, {
94
+ method: 'get',
95
+ responseType: 'json',
96
+ path: `${PINNING_ENDPOINT}`
97
+ });
98
+ const result = response.data.references;
60
99
 
61
- if (result === null) {
62
- return [];
63
- }
100
+ if (result === null) {
101
+ return [];
102
+ }
64
103
 
65
- return result;
104
+ return result;
105
+ });
66
106
  }
@@ -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 WebSocket from 'isomorphic-ws';
2
34
  import { prepareData } from "../utils/data.js";
3
35
  import { http } from "../utils/http.js";
@@ -15,16 +47,18 @@ const endpoint = 'pss';
15
47
  *
16
48
  */
17
49
 
18
- export async function send(ky, topic, target, data, postageBatchId, recipient) {
19
- await http(ky, {
20
- method: 'post',
21
- path: `${endpoint}/send/${topic}/${target}`,
22
- body: await prepareData(data),
23
- responseType: 'json',
24
- searchParams: {
25
- recipient
26
- },
27
- headers: extractUploadHeaders(postageBatchId)
50
+ export function send(ky, topic, target, data, postageBatchId, recipient) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ yield http(ky, {
53
+ method: 'post',
54
+ path: `${endpoint}/send/${topic}/${target}`,
55
+ body: yield prepareData(data),
56
+ responseType: 'json',
57
+ searchParams: {
58
+ recipient
59
+ },
60
+ headers: extractUploadHeaders(postageBatchId)
61
+ });
28
62
  });
29
63
  }
30
64
  /**