@ethersphere/bee-js 5.0.0 → 6.0.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 (192) hide show
  1. package/README.md +9 -1
  2. package/dist/index.browser.js +33 -0
  3. package/dist/index.browser.js.map +7 -0
  4. package/dist/src/bee-debug.js +624 -0
  5. package/dist/{mjs → src}/bee.js +243 -340
  6. package/dist/{mjs → src}/chunk/bmt.js +0 -0
  7. package/dist/{mjs → src}/chunk/cac.js +0 -0
  8. package/dist/{mjs → src}/chunk/serialize.js +0 -0
  9. package/dist/{mjs → src}/chunk/signer.js +13 -47
  10. package/dist/{mjs → src}/chunk/soc.js +31 -71
  11. package/dist/{mjs → src}/chunk/span.js +1 -1
  12. package/dist/{mjs → src}/feed/identifier.js +0 -0
  13. package/dist/src/feed/index.js +92 -0
  14. package/dist/src/feed/json.js +27 -0
  15. package/dist/src/feed/retrievable.js +67 -0
  16. package/dist/{mjs → src}/feed/topic.js +0 -0
  17. package/dist/{mjs → src}/feed/type.js +0 -0
  18. package/dist/{mjs → src}/index.js +1 -2
  19. package/dist/src/modules/bytes.js +59 -0
  20. package/dist/src/modules/bzz.js +122 -0
  21. package/dist/src/modules/chunk.js +45 -0
  22. package/dist/src/modules/debug/balance.js +57 -0
  23. package/dist/src/modules/debug/chequebook.js +150 -0
  24. package/dist/src/modules/debug/chunk.js +35 -0
  25. package/dist/src/modules/debug/connectivity.js +45 -0
  26. package/dist/src/modules/debug/settlements.js +29 -0
  27. package/dist/src/modules/debug/stamps.js +64 -0
  28. package/dist/src/modules/debug/states.js +46 -0
  29. package/dist/src/modules/debug/status.js +134 -0
  30. package/dist/src/modules/debug/tag.js +16 -0
  31. package/dist/src/modules/debug/transactions.js +69 -0
  32. package/dist/src/modules/feed.js +67 -0
  33. package/dist/src/modules/pinning.js +60 -0
  34. package/dist/src/modules/pss.js +40 -0
  35. package/dist/src/modules/soc.js +31 -0
  36. package/dist/src/modules/status.js +12 -0
  37. package/dist/src/modules/stewardship.js +24 -0
  38. package/dist/src/modules/tag.js +77 -0
  39. package/dist/{mjs → src}/types/debug.js +0 -0
  40. package/dist/{mjs → src}/types/index.js +0 -0
  41. package/dist/{mjs → src}/utils/bytes.js +3 -2
  42. package/dist/src/utils/collection-browser.js +19 -0
  43. package/dist/src/utils/collection-node.js +74 -0
  44. package/dist/src/utils/collection.js +64 -0
  45. package/dist/src/utils/data.browser.js +72 -0
  46. package/dist/src/utils/data.js +42 -0
  47. package/dist/{mjs → src}/utils/error.js +0 -0
  48. package/dist/{mjs → src}/utils/eth.js +32 -68
  49. package/dist/{mjs → src}/utils/expose.js +1 -1
  50. package/dist/src/utils/file.js +36 -0
  51. package/dist/{mjs → src}/utils/hash.js +0 -0
  52. package/dist/{mjs → src}/utils/headers.js +4 -4
  53. package/dist/{mjs → src}/utils/hex.js +0 -0
  54. package/dist/src/utils/http.js +162 -0
  55. package/dist/{mjs → src}/utils/merge.js +2 -2
  56. package/dist/{mjs → src}/utils/pss.js +0 -0
  57. package/dist/{mjs → src}/utils/reference.js +0 -0
  58. package/dist/src/utils/sleep.js +8 -0
  59. package/dist/{mjs → src}/utils/stamps.js +0 -0
  60. package/dist/{mjs → src}/utils/stream.js +3 -3
  61. package/dist/{mjs → src}/utils/tar.js +0 -0
  62. package/dist/{mjs → src}/utils/type.js +12 -13
  63. package/dist/{mjs → src}/utils/uint64.js +0 -0
  64. package/dist/{mjs → src}/utils/url.js +0 -0
  65. package/dist/types/chunk/bmt.d.ts +1 -1
  66. package/dist/types/chunk/soc.d.ts +1 -1
  67. package/dist/types/chunk/span.d.ts +1 -1
  68. package/dist/types/feed/index.d.ts +1 -1
  69. package/dist/types/index.d.ts +0 -13
  70. package/dist/types/modules/bzz.d.ts +1 -1
  71. package/dist/types/types/index.d.ts +8 -8
  72. package/dist/types/utils/{collection.browser.d.ts → collection-browser.d.ts} +0 -0
  73. package/dist/types/utils/{collection.node.d.ts → collection-node.d.ts} +0 -0
  74. package/dist/types/utils/error.d.ts +1 -1
  75. package/dist/types/utils/eth.d.ts +3 -3
  76. package/dist/types/utils/expose.d.ts +7 -4
  77. package/dist/types/utils/hash.d.ts +1 -1
  78. package/dist/types/utils/hex.d.ts +2 -2
  79. package/dist/types/utils/http.d.ts +3 -3
  80. package/dist/types/utils/stream.d.ts +1 -1
  81. package/dist/types/utils/uint64.d.ts +1 -1
  82. package/package.json +44 -59
  83. package/dist/cjs/bee-debug.js +0 -642
  84. package/dist/cjs/bee.js +0 -983
  85. package/dist/cjs/chunk/bmt.js +0 -55
  86. package/dist/cjs/chunk/cac.js +0 -56
  87. package/dist/cjs/chunk/serialize.js +0 -19
  88. package/dist/cjs/chunk/signer.js +0 -137
  89. package/dist/cjs/chunk/soc.js +0 -176
  90. package/dist/cjs/chunk/span.js +0 -29
  91. package/dist/cjs/feed/identifier.js +0 -35
  92. package/dist/cjs/feed/index.js +0 -132
  93. package/dist/cjs/feed/json.js +0 -41
  94. package/dist/cjs/feed/retrievable.js +0 -72
  95. package/dist/cjs/feed/topic.js +0 -25
  96. package/dist/cjs/feed/type.js +0 -15
  97. package/dist/cjs/index.js +0 -39
  98. package/dist/cjs/modules/bytes.js +0 -74
  99. package/dist/cjs/modules/bzz.js +0 -131
  100. package/dist/cjs/modules/chunk.js +0 -58
  101. package/dist/cjs/modules/debug/balance.js +0 -77
  102. package/dist/cjs/modules/debug/chequebook.js +0 -167
  103. package/dist/cjs/modules/debug/chunk.js +0 -51
  104. package/dist/cjs/modules/debug/connectivity.js +0 -75
  105. package/dist/cjs/modules/debug/settlements.js +0 -45
  106. package/dist/cjs/modules/debug/stamps.js +0 -89
  107. package/dist/cjs/modules/debug/states.js +0 -64
  108. package/dist/cjs/modules/debug/status.js +0 -153
  109. package/dist/cjs/modules/debug/tag.js +0 -30
  110. package/dist/cjs/modules/debug/transactions.js +0 -81
  111. package/dist/cjs/modules/feed.js +0 -76
  112. package/dist/cjs/modules/pinning.js +0 -80
  113. package/dist/cjs/modules/pss.js +0 -55
  114. package/dist/cjs/modules/soc.js +0 -40
  115. package/dist/cjs/modules/status.js +0 -26
  116. package/dist/cjs/modules/stewardship.js +0 -41
  117. package/dist/cjs/modules/tag.js +0 -96
  118. package/dist/cjs/package.json +0 -8
  119. package/dist/cjs/types/debug.js +0 -10
  120. package/dist/cjs/types/index.js +0 -51
  121. package/dist/cjs/types/ky-options.js +0 -8
  122. package/dist/cjs/types/ky-universal/common.js +0 -8
  123. package/dist/cjs/types/ky-universal/hooks.js +0 -8
  124. package/dist/cjs/types/ky-universal/retry.js +0 -8
  125. package/dist/cjs/utils/bytes.js +0 -121
  126. package/dist/cjs/utils/collection.browser.js +0 -36
  127. package/dist/cjs/utils/collection.js +0 -70
  128. package/dist/cjs/utils/collection.node.js +0 -115
  129. package/dist/cjs/utils/data.browser.js +0 -74
  130. package/dist/cjs/utils/data.js +0 -58
  131. package/dist/cjs/utils/error.js +0 -50
  132. package/dist/cjs/utils/eth.js +0 -211
  133. package/dist/cjs/utils/expose.js +0 -44
  134. package/dist/cjs/utils/file.js +0 -49
  135. package/dist/cjs/utils/hash.js +0 -21
  136. package/dist/cjs/utils/headers.js +0 -59
  137. package/dist/cjs/utils/hex.js +0 -150
  138. package/dist/cjs/utils/http.js +0 -172
  139. package/dist/cjs/utils/merge.js +0 -34
  140. package/dist/cjs/utils/pss.js +0 -18
  141. package/dist/cjs/utils/reference.js +0 -36
  142. package/dist/cjs/utils/sleep.js +0 -23
  143. package/dist/cjs/utils/stamps.js +0 -17
  144. package/dist/cjs/utils/stream.js +0 -146
  145. package/dist/cjs/utils/tar.js +0 -25
  146. package/dist/cjs/utils/type.js +0 -426
  147. package/dist/cjs/utils/uint64.js +0 -29
  148. package/dist/cjs/utils/url.js +0 -56
  149. package/dist/index.browser.min.js +0 -3
  150. package/dist/index.browser.min.js.LICENSE.txt +0 -60
  151. package/dist/index.browser.min.js.map +0 -1
  152. package/dist/mjs/bee-debug.js +0 -744
  153. package/dist/mjs/feed/index.js +0 -134
  154. package/dist/mjs/feed/json.js +0 -63
  155. package/dist/mjs/feed/retrievable.js +0 -105
  156. package/dist/mjs/modules/bytes.js +0 -96
  157. package/dist/mjs/modules/bzz.js +0 -160
  158. package/dist/mjs/modules/chunk.js +0 -80
  159. package/dist/mjs/modules/debug/balance.js +0 -97
  160. package/dist/mjs/modules/debug/chequebook.js +0 -198
  161. package/dist/mjs/modules/debug/chunk.js +0 -71
  162. package/dist/mjs/modules/debug/connectivity.js +0 -89
  163. package/dist/mjs/modules/debug/settlements.js +0 -65
  164. package/dist/mjs/modules/debug/stamps.js +0 -108
  165. package/dist/mjs/modules/debug/states.js +0 -84
  166. package/dist/mjs/modules/debug/status.js +0 -182
  167. package/dist/mjs/modules/debug/tag.js +0 -50
  168. package/dist/mjs/modules/debug/transactions.js +0 -103
  169. package/dist/mjs/modules/feed.js +0 -101
  170. package/dist/mjs/modules/pinning.js +0 -100
  171. package/dist/mjs/modules/pss.js +0 -74
  172. package/dist/mjs/modules/soc.js +0 -64
  173. package/dist/mjs/modules/status.js +0 -46
  174. package/dist/mjs/modules/stewardship.js +0 -60
  175. package/dist/mjs/modules/tag.js +0 -119
  176. package/dist/mjs/package.json +0 -8
  177. package/dist/mjs/types/ky-options.js +0 -7
  178. package/dist/mjs/types/ky-universal/common.js +0 -7
  179. package/dist/mjs/types/ky-universal/hooks.js +0 -7
  180. package/dist/mjs/types/ky-universal/retry.js +0 -7
  181. package/dist/mjs/utils/collection.browser.js +0 -56
  182. package/dist/mjs/utils/collection.js +0 -98
  183. package/dist/mjs/utils/collection.node.js +0 -169
  184. package/dist/mjs/utils/data.browser.js +0 -108
  185. package/dist/mjs/utils/data.js +0 -78
  186. package/dist/mjs/utils/file.js +0 -70
  187. package/dist/mjs/utils/http.js +0 -208
  188. package/dist/mjs/utils/sleep.js +0 -43
  189. package/dist/types/types/ky-options.d.ts +0 -221
  190. package/dist/types/types/ky-universal/common.d.ts +0 -13
  191. package/dist/types/types/ky-universal/hooks.d.ts +0 -92
  192. package/dist/types/types/ky-universal/retry.d.ts +0 -38
@@ -1,92 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- import type { NormalizedOptions } from '../ky-options';
8
- export declare const stop: unique symbol;
9
- export declare type BeforeRequestHook = (request: Request, options: NormalizedOptions) => Request | Response | void | Promise<Request | Response | void>;
10
- export declare type BeforeRetryState = {
11
- request: Request;
12
- response: Response;
13
- options: NormalizedOptions;
14
- error: Error;
15
- retryCount: number;
16
- };
17
- export declare type BeforeRetryHook = (options: BeforeRetryState) => typeof stop | void | Promise<typeof stop | void>;
18
- export declare type AfterResponseHook = (request: Request, options: NormalizedOptions, response: Response) => Response | void | Promise<Response | void>;
19
- export interface Hooks {
20
- /**
21
- This hook enables you to modify the request right before it is sent. Ky will make no further changes to the request after this. The hook function receives normalized input and options as arguments. You could, forf example, modiy `options.headers` here.
22
-
23
- A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from this hook to completely avoid making a HTTP request. This can be used to mock a request, check an internal cache, etc. An **important** consideration when returning a `Response` from this hook is that all the following hooks will be skipped, so **ensure you only return a `Response` from the last hook**.
24
-
25
- @default []
26
- */
27
- beforeRequest?: BeforeRequestHook[];
28
- /**
29
- This hook enables you to modify the request right before retry. Ky will make no further changes to the request after this. The hook function receives an object with the normalized request and options, an error instance, and the retry count. You could, for example, modify `request.headers` here.
30
-
31
- If the request received a response, the error will be of type `HTTPError` and the `Response` object will be available at `error.response`. Be aware that some types of errors, such as network errors, inherently mean that a response was not received. In that case, the error will not be an instance of `HTTPError`.
32
-
33
- You can prevent Ky from retrying the request by throwing an error. Ky will not handle it in any way and the error will be propagated to the request initiator. The rest of the `beforeRetry` hooks will not be called in this case. Alternatively, you can return the [`ky.stop`](#ky.stop) symbol to do the same thing but without propagating an error (this has some limitations, see `ky.stop` docs for details).
34
-
35
- @example
36
- ```
37
- import ky from 'ky';
38
-
39
- const response = await ky('https://example.com', {
40
- hooks: {
41
- beforeRetry: [
42
- async ({request, options, error, retryCount}) => {
43
- const token = await ky('https://example.com/refresh-token');
44
- options.headers.set('Authorization', `token ${token}`);
45
- }
46
- ]
47
- }
48
- });
49
- ```
50
-
51
- @default []
52
- */
53
- beforeRetry?: BeforeRetryHook[];
54
- /**
55
- This hook enables you to read and optionally modify the response. The hook function receives normalized input, options, and a clone of the response as arguments. The return value of the hook function will be used by Ky as the response object if it's an instance of [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
56
-
57
- @default []
58
-
59
- @example
60
- ```
61
- import ky from 'ky';
62
-
63
- const response = await ky('https://example.com', {
64
- hooks: {
65
- afterResponse: [
66
- (_input, _options, response) => {
67
- // You could do something with the response, for example, logging.
68
- log(response);
69
-
70
- // Or return a `Response` instance to overwrite the response.
71
- return new Response('A different response', {status: 200});
72
- },
73
-
74
- // Or retry with a fresh token on a 403 error
75
- async (input, options, response) => {
76
- if (response.status === 403) {
77
- // Get a fresh token
78
- const token = await ky('https://example.com/token').text();
79
-
80
- // Retry with the token
81
- options.headers.set('Authorization', `token ${token}`);
82
-
83
- return ky(input, options);
84
- }
85
- }
86
- ]
87
- }
88
- });
89
- ```
90
- */
91
- afterResponse?: AfterResponseHook[];
92
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Types extracted from Ky as a backport for older Ky non-ESM version
3
- *
4
- * @author https://github.com/sindresorhus
5
- * @licence MIT https://github.com/sindresorhus/ky/blob/main/license
6
- */
7
- export interface RetryOptions {
8
- /**
9
- The number of times to retry failed requests.
10
-
11
- @default 2
12
- */
13
- limit?: number;
14
- /**
15
- The HTTP methods allowed to retry.
16
-
17
- @default ['get', 'put', 'head', 'delete', 'options', 'trace']
18
- */
19
- methods?: string[];
20
- /**
21
- The HTTP status codes allowed to retry.
22
-
23
- @default [408, 413, 429, 500, 502, 503, 504]
24
- */
25
- statusCodes?: number[];
26
- /**
27
- The HTTP status codes allowed to retry with a `Retry-After` header.
28
-
29
- @default [413, 429, 503]
30
- */
31
- afterStatusCodes?: number[];
32
- /**
33
- If the `Retry-After` header is greater than `maxRetryAfter`, the request will be canceled.
34
-
35
- @default Infinity
36
- */
37
- maxRetryAfter?: number;
38
- }