@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.
- package/README.md +9 -1
- package/dist/index.browser.js +33 -0
- package/dist/index.browser.js.map +7 -0
- package/dist/src/bee-debug.js +624 -0
- package/dist/{mjs → src}/bee.js +243 -340
- package/dist/{mjs → src}/chunk/bmt.js +0 -0
- package/dist/{mjs → src}/chunk/cac.js +0 -0
- package/dist/{mjs → src}/chunk/serialize.js +0 -0
- package/dist/{mjs → src}/chunk/signer.js +13 -47
- package/dist/{mjs → src}/chunk/soc.js +31 -71
- package/dist/{mjs → src}/chunk/span.js +1 -1
- package/dist/{mjs → src}/feed/identifier.js +0 -0
- package/dist/src/feed/index.js +92 -0
- package/dist/src/feed/json.js +27 -0
- package/dist/src/feed/retrievable.js +67 -0
- package/dist/{mjs → src}/feed/topic.js +0 -0
- package/dist/{mjs → src}/feed/type.js +0 -0
- package/dist/{mjs → src}/index.js +1 -2
- package/dist/src/modules/bytes.js +59 -0
- package/dist/src/modules/bzz.js +122 -0
- package/dist/src/modules/chunk.js +45 -0
- package/dist/src/modules/debug/balance.js +57 -0
- package/dist/src/modules/debug/chequebook.js +150 -0
- package/dist/src/modules/debug/chunk.js +35 -0
- package/dist/src/modules/debug/connectivity.js +45 -0
- package/dist/src/modules/debug/settlements.js +29 -0
- package/dist/src/modules/debug/stamps.js +64 -0
- package/dist/src/modules/debug/states.js +46 -0
- package/dist/src/modules/debug/status.js +134 -0
- package/dist/src/modules/debug/tag.js +16 -0
- package/dist/src/modules/debug/transactions.js +69 -0
- package/dist/src/modules/feed.js +67 -0
- package/dist/src/modules/pinning.js +60 -0
- package/dist/src/modules/pss.js +40 -0
- package/dist/src/modules/soc.js +31 -0
- package/dist/src/modules/status.js +12 -0
- package/dist/src/modules/stewardship.js +24 -0
- package/dist/src/modules/tag.js +77 -0
- package/dist/{mjs → src}/types/debug.js +0 -0
- package/dist/{mjs → src}/types/index.js +0 -0
- package/dist/{mjs → src}/utils/bytes.js +3 -2
- package/dist/src/utils/collection-browser.js +19 -0
- package/dist/src/utils/collection-node.js +74 -0
- package/dist/src/utils/collection.js +64 -0
- package/dist/src/utils/data.browser.js +72 -0
- package/dist/src/utils/data.js +42 -0
- package/dist/{mjs → src}/utils/error.js +0 -0
- package/dist/{mjs → src}/utils/eth.js +32 -68
- package/dist/{mjs → src}/utils/expose.js +1 -1
- package/dist/src/utils/file.js +36 -0
- package/dist/{mjs → src}/utils/hash.js +0 -0
- package/dist/{mjs → src}/utils/headers.js +4 -4
- package/dist/{mjs → src}/utils/hex.js +0 -0
- package/dist/src/utils/http.js +162 -0
- package/dist/{mjs → src}/utils/merge.js +2 -2
- package/dist/{mjs → src}/utils/pss.js +0 -0
- package/dist/{mjs → src}/utils/reference.js +0 -0
- package/dist/src/utils/sleep.js +8 -0
- package/dist/{mjs → src}/utils/stamps.js +0 -0
- package/dist/{mjs → src}/utils/stream.js +3 -3
- package/dist/{mjs → src}/utils/tar.js +0 -0
- package/dist/{mjs → src}/utils/type.js +12 -13
- package/dist/{mjs → src}/utils/uint64.js +0 -0
- package/dist/{mjs → src}/utils/url.js +0 -0
- package/dist/types/chunk/bmt.d.ts +1 -1
- package/dist/types/chunk/soc.d.ts +1 -1
- package/dist/types/chunk/span.d.ts +1 -1
- package/dist/types/feed/index.d.ts +1 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/modules/bzz.d.ts +1 -1
- package/dist/types/types/index.d.ts +8 -8
- package/dist/types/utils/{collection.browser.d.ts → collection-browser.d.ts} +0 -0
- package/dist/types/utils/{collection.node.d.ts → collection-node.d.ts} +0 -0
- package/dist/types/utils/error.d.ts +1 -1
- package/dist/types/utils/eth.d.ts +3 -3
- package/dist/types/utils/expose.d.ts +7 -4
- package/dist/types/utils/hash.d.ts +1 -1
- package/dist/types/utils/hex.d.ts +2 -2
- package/dist/types/utils/http.d.ts +3 -3
- package/dist/types/utils/stream.d.ts +1 -1
- package/dist/types/utils/uint64.d.ts +1 -1
- package/package.json +44 -59
- package/dist/cjs/bee-debug.js +0 -642
- package/dist/cjs/bee.js +0 -983
- package/dist/cjs/chunk/bmt.js +0 -55
- package/dist/cjs/chunk/cac.js +0 -56
- package/dist/cjs/chunk/serialize.js +0 -19
- package/dist/cjs/chunk/signer.js +0 -137
- package/dist/cjs/chunk/soc.js +0 -176
- package/dist/cjs/chunk/span.js +0 -29
- package/dist/cjs/feed/identifier.js +0 -35
- package/dist/cjs/feed/index.js +0 -132
- package/dist/cjs/feed/json.js +0 -41
- package/dist/cjs/feed/retrievable.js +0 -72
- package/dist/cjs/feed/topic.js +0 -25
- package/dist/cjs/feed/type.js +0 -15
- package/dist/cjs/index.js +0 -39
- package/dist/cjs/modules/bytes.js +0 -74
- package/dist/cjs/modules/bzz.js +0 -131
- package/dist/cjs/modules/chunk.js +0 -58
- package/dist/cjs/modules/debug/balance.js +0 -77
- package/dist/cjs/modules/debug/chequebook.js +0 -167
- package/dist/cjs/modules/debug/chunk.js +0 -51
- package/dist/cjs/modules/debug/connectivity.js +0 -75
- package/dist/cjs/modules/debug/settlements.js +0 -45
- package/dist/cjs/modules/debug/stamps.js +0 -89
- package/dist/cjs/modules/debug/states.js +0 -64
- package/dist/cjs/modules/debug/status.js +0 -153
- package/dist/cjs/modules/debug/tag.js +0 -30
- package/dist/cjs/modules/debug/transactions.js +0 -81
- package/dist/cjs/modules/feed.js +0 -76
- package/dist/cjs/modules/pinning.js +0 -80
- package/dist/cjs/modules/pss.js +0 -55
- package/dist/cjs/modules/soc.js +0 -40
- package/dist/cjs/modules/status.js +0 -26
- package/dist/cjs/modules/stewardship.js +0 -41
- package/dist/cjs/modules/tag.js +0 -96
- package/dist/cjs/package.json +0 -8
- package/dist/cjs/types/debug.js +0 -10
- package/dist/cjs/types/index.js +0 -51
- package/dist/cjs/types/ky-options.js +0 -8
- package/dist/cjs/types/ky-universal/common.js +0 -8
- package/dist/cjs/types/ky-universal/hooks.js +0 -8
- package/dist/cjs/types/ky-universal/retry.js +0 -8
- package/dist/cjs/utils/bytes.js +0 -121
- package/dist/cjs/utils/collection.browser.js +0 -36
- package/dist/cjs/utils/collection.js +0 -70
- package/dist/cjs/utils/collection.node.js +0 -115
- package/dist/cjs/utils/data.browser.js +0 -74
- package/dist/cjs/utils/data.js +0 -58
- package/dist/cjs/utils/error.js +0 -50
- package/dist/cjs/utils/eth.js +0 -211
- package/dist/cjs/utils/expose.js +0 -44
- package/dist/cjs/utils/file.js +0 -49
- package/dist/cjs/utils/hash.js +0 -21
- package/dist/cjs/utils/headers.js +0 -59
- package/dist/cjs/utils/hex.js +0 -150
- package/dist/cjs/utils/http.js +0 -172
- package/dist/cjs/utils/merge.js +0 -34
- package/dist/cjs/utils/pss.js +0 -18
- package/dist/cjs/utils/reference.js +0 -36
- package/dist/cjs/utils/sleep.js +0 -23
- package/dist/cjs/utils/stamps.js +0 -17
- package/dist/cjs/utils/stream.js +0 -146
- package/dist/cjs/utils/tar.js +0 -25
- package/dist/cjs/utils/type.js +0 -426
- package/dist/cjs/utils/uint64.js +0 -29
- package/dist/cjs/utils/url.js +0 -56
- package/dist/index.browser.min.js +0 -3
- package/dist/index.browser.min.js.LICENSE.txt +0 -60
- package/dist/index.browser.min.js.map +0 -1
- package/dist/mjs/bee-debug.js +0 -744
- package/dist/mjs/feed/index.js +0 -134
- package/dist/mjs/feed/json.js +0 -63
- package/dist/mjs/feed/retrievable.js +0 -105
- package/dist/mjs/modules/bytes.js +0 -96
- package/dist/mjs/modules/bzz.js +0 -160
- package/dist/mjs/modules/chunk.js +0 -80
- package/dist/mjs/modules/debug/balance.js +0 -97
- package/dist/mjs/modules/debug/chequebook.js +0 -198
- package/dist/mjs/modules/debug/chunk.js +0 -71
- package/dist/mjs/modules/debug/connectivity.js +0 -89
- package/dist/mjs/modules/debug/settlements.js +0 -65
- package/dist/mjs/modules/debug/stamps.js +0 -108
- package/dist/mjs/modules/debug/states.js +0 -84
- package/dist/mjs/modules/debug/status.js +0 -182
- package/dist/mjs/modules/debug/tag.js +0 -50
- package/dist/mjs/modules/debug/transactions.js +0 -103
- package/dist/mjs/modules/feed.js +0 -101
- package/dist/mjs/modules/pinning.js +0 -100
- package/dist/mjs/modules/pss.js +0 -74
- package/dist/mjs/modules/soc.js +0 -64
- package/dist/mjs/modules/status.js +0 -46
- package/dist/mjs/modules/stewardship.js +0 -60
- package/dist/mjs/modules/tag.js +0 -119
- package/dist/mjs/package.json +0 -8
- package/dist/mjs/types/ky-options.js +0 -7
- package/dist/mjs/types/ky-universal/common.js +0 -7
- package/dist/mjs/types/ky-universal/hooks.js +0 -7
- package/dist/mjs/types/ky-universal/retry.js +0 -7
- package/dist/mjs/utils/collection.browser.js +0 -56
- package/dist/mjs/utils/collection.js +0 -98
- package/dist/mjs/utils/collection.node.js +0 -169
- package/dist/mjs/utils/data.browser.js +0 -108
- package/dist/mjs/utils/data.js +0 -78
- package/dist/mjs/utils/file.js +0 -70
- package/dist/mjs/utils/http.js +0 -208
- package/dist/mjs/utils/sleep.js +0 -43
- package/dist/types/types/ky-options.d.ts +0 -221
- package/dist/types/types/ky-universal/common.d.ts +0 -13
- package/dist/types/types/ky-universal/hooks.d.ts +0 -92
- 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
|
-
}
|