@ethersphere/bee-js 2.1.1 → 3.3.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 +2 -2
- package/dist/cjs/bee-debug.js +615 -0
- package/dist/cjs/bee.js +922 -0
- package/dist/cjs/chunk/bmt.js +50 -0
- package/dist/cjs/chunk/cac.js +56 -0
- package/dist/cjs/chunk/serialize.js +19 -0
- package/dist/cjs/chunk/signer.js +132 -0
- package/dist/cjs/chunk/soc.js +172 -0
- package/dist/cjs/chunk/span.js +29 -0
- package/dist/cjs/feed/index.js +184 -0
- package/dist/cjs/feed/json.js +41 -0
- package/dist/cjs/feed/topic.js +25 -0
- package/dist/cjs/feed/type.js +15 -0
- package/dist/cjs/index.js +35 -0
- package/dist/cjs/modules/bytes.js +74 -0
- package/dist/cjs/modules/bzz.js +131 -0
- package/dist/cjs/modules/chunk.js +58 -0
- package/dist/cjs/modules/debug/balance.js +77 -0
- package/dist/cjs/modules/debug/chequebook.js +167 -0
- package/dist/cjs/modules/debug/chunk.js +51 -0
- package/dist/cjs/modules/debug/connectivity.js +75 -0
- package/dist/cjs/modules/debug/settlements.js +45 -0
- package/dist/cjs/modules/debug/stamps.js +89 -0
- package/dist/cjs/modules/debug/states.js +47 -0
- package/dist/cjs/modules/debug/status.js +153 -0
- package/dist/cjs/modules/debug/tag.js +30 -0
- package/dist/cjs/modules/debug/transactions.js +81 -0
- package/dist/cjs/modules/feed.js +76 -0
- package/dist/cjs/modules/pinning.js +84 -0
- package/dist/cjs/modules/pss.js +55 -0
- package/dist/cjs/modules/soc.js +40 -0
- package/dist/cjs/modules/status.js +26 -0
- package/dist/cjs/modules/stewardship.js +41 -0
- package/dist/cjs/modules/tag.js +96 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/types/debug.js +9 -0
- package/dist/cjs/types/index.js +46 -0
- package/dist/cjs/utils/bytes.js +107 -0
- package/dist/cjs/utils/collection.browser.js +36 -0
- package/dist/cjs/utils/collection.js +70 -0
- package/dist/cjs/utils/collection.node.js +115 -0
- package/dist/cjs/utils/data.browser.js +78 -0
- package/dist/cjs/utils/data.js +60 -0
- package/dist/cjs/utils/error.js +50 -0
- package/dist/cjs/utils/eth.js +206 -0
- package/dist/cjs/utils/expose.js +44 -0
- package/dist/cjs/utils/file.js +49 -0
- package/dist/cjs/utils/hash.js +16 -0
- package/dist/cjs/utils/headers.js +59 -0
- package/dist/cjs/utils/hex.js +150 -0
- package/dist/cjs/utils/http.js +166 -0
- package/dist/cjs/utils/merge.js +34 -0
- package/dist/cjs/utils/pss.js +18 -0
- package/dist/cjs/utils/stamps.js +17 -0
- package/dist/cjs/utils/stream.js +137 -0
- package/dist/cjs/utils/tar.js +25 -0
- package/dist/cjs/utils/type.js +327 -0
- package/dist/cjs/utils/uint64.js +29 -0
- package/dist/cjs/utils/url.js +56 -0
- package/dist/index.js +28326 -0
- package/dist/index.js.map +1 -0
- package/dist/mjs/bee-debug.js +509 -0
- package/dist/mjs/bee.js +845 -0
- package/dist/mjs/chunk/bmt.js +46 -0
- package/dist/mjs/chunk/cac.js +50 -0
- package/dist/mjs/chunk/serialize.js +15 -0
- package/dist/mjs/chunk/signer.js +112 -0
- package/dist/mjs/chunk/soc.js +127 -0
- package/dist/mjs/chunk/span.js +25 -0
- package/dist/mjs/feed/index.js +136 -0
- package/dist/mjs/feed/json.js +23 -0
- package/dist/mjs/feed/topic.js +20 -0
- package/dist/mjs/feed/type.js +10 -0
- package/dist/mjs/index.js +7 -0
- package/dist/mjs/modules/bytes.js +56 -0
- package/dist/mjs/modules/bzz.js +119 -0
- package/dist/mjs/modules/chunk.js +43 -0
- package/dist/mjs/modules/debug/balance.js +53 -0
- package/dist/mjs/modules/debug/chequebook.js +131 -0
- package/dist/mjs/modules/debug/chunk.js +33 -0
- package/dist/mjs/modules/debug/connectivity.js +45 -0
- package/dist/mjs/modules/debug/settlements.js +27 -0
- package/dist/mjs/modules/debug/stamps.js +59 -0
- package/dist/mjs/modules/debug/states.js +29 -0
- package/dist/mjs/modules/debug/status.js +114 -0
- package/dist/mjs/modules/debug/tag.js +15 -0
- package/dist/mjs/modules/debug/transactions.js +57 -0
- package/dist/mjs/modules/feed.js +61 -0
- package/dist/mjs/modules/pinning.js +60 -0
- package/dist/mjs/modules/pss.js +36 -0
- package/dist/mjs/modules/soc.js +28 -0
- package/dist/mjs/modules/status.js +11 -0
- package/dist/mjs/modules/stewardship.js +23 -0
- package/dist/mjs/modules/tag.js +69 -0
- package/dist/mjs/package.json +7 -0
- package/dist/mjs/types/debug.js +6 -0
- package/dist/mjs/types/index.js +33 -0
- package/dist/mjs/utils/bytes.js +95 -0
- package/dist/mjs/utils/collection.browser.js +18 -0
- package/dist/mjs/utils/collection.js +52 -0
- package/dist/mjs/utils/collection.node.js +63 -0
- package/dist/mjs/utils/data.browser.js +57 -0
- package/dist/mjs/utils/data.js +39 -0
- package/dist/mjs/utils/error.js +48 -0
- package/dist/mjs/utils/eth.js +184 -0
- package/dist/mjs/utils/expose.js +9 -0
- package/dist/mjs/utils/file.js +33 -0
- package/dist/mjs/utils/hash.js +12 -0
- package/dist/mjs/utils/headers.js +54 -0
- package/dist/mjs/utils/hex.js +139 -0
- package/dist/mjs/utils/http.js +136 -0
- package/dist/mjs/utils/merge.js +30 -0
- package/dist/mjs/utils/pss.js +14 -0
- package/dist/mjs/utils/stamps.js +13 -0
- package/dist/mjs/utils/stream.js +131 -0
- package/dist/mjs/utils/tar.js +18 -0
- package/dist/mjs/utils/type.js +296 -0
- package/dist/mjs/utils/uint64.js +23 -0
- package/dist/mjs/utils/url.js +50 -0
- package/dist/{src → types}/bee-debug.d.ts +51 -1
- package/dist/{src → types}/bee.d.ts +23 -46
- package/dist/{src → types}/chunk/bmt.d.ts +0 -0
- package/dist/{src → types}/chunk/cac.d.ts +0 -0
- package/dist/{src → types}/chunk/serialize.d.ts +0 -0
- package/dist/{src → types}/chunk/signer.d.ts +0 -0
- package/dist/{src → types}/chunk/soc.d.ts +0 -0
- package/dist/{src → types}/chunk/span.d.ts +0 -0
- package/dist/{src → types}/feed/index.d.ts +0 -0
- package/dist/{src → types}/feed/json.d.ts +0 -0
- package/dist/{src → types}/feed/topic.d.ts +0 -0
- package/dist/{src → types}/feed/type.d.ts +0 -0
- package/dist/{src → types}/index.d.ts +0 -0
- package/dist/{src → types}/modules/bytes.d.ts +0 -0
- package/dist/{src → types}/modules/bzz.d.ts +0 -0
- package/dist/{src → types}/modules/chunk.d.ts +2 -10
- package/dist/{src → types}/modules/debug/balance.d.ts +0 -0
- package/dist/{src → types}/modules/debug/chequebook.d.ts +0 -0
- package/dist/{src → types}/modules/debug/chunk.d.ts +0 -0
- package/dist/{src → types}/modules/debug/connectivity.d.ts +0 -0
- package/dist/{src → types}/modules/debug/settlements.d.ts +0 -0
- package/dist/{src → types}/modules/debug/stamps.d.ts +0 -0
- package/dist/{src → types}/modules/debug/states.d.ts +0 -0
- package/dist/types/modules/debug/status.d.ts +72 -0
- package/dist/{src → types}/modules/debug/tag.d.ts +0 -0
- package/dist/{src → types}/modules/debug/transactions.d.ts +0 -0
- package/dist/{src → types}/modules/feed.d.ts +0 -0
- package/dist/{src → types}/modules/pinning.d.ts +0 -0
- package/dist/{src → types}/modules/pss.d.ts +0 -0
- package/dist/{src → types}/modules/soc.d.ts +0 -0
- package/dist/{src → types}/modules/status.d.ts +0 -0
- package/dist/{src → types}/modules/stewardship.d.ts +0 -0
- package/dist/{src → types}/modules/tag.d.ts +0 -0
- package/dist/{src → types}/types/debug.d.ts +27 -0
- package/dist/{src → types}/types/index.d.ts +32 -2
- package/dist/{src → types}/utils/bytes.d.ts +0 -0
- package/dist/types/utils/collection.browser.d.ts +15 -0
- package/dist/{src → types}/utils/collection.d.ts +0 -14
- package/dist/types/utils/collection.node.d.ts +15 -0
- package/dist/{src → types}/utils/data.browser.d.ts +0 -0
- package/dist/{src → types}/utils/data.d.ts +0 -0
- package/dist/types/utils/error.d.ts +33 -0
- package/dist/{src → types}/utils/eth.d.ts +0 -0
- package/dist/{src → types}/utils/expose.d.ts +3 -1
- package/dist/{src → types}/utils/file.d.ts +0 -0
- package/dist/{src → types}/utils/hash.d.ts +0 -0
- package/dist/{src → types}/utils/headers.d.ts +0 -0
- package/dist/{src → types}/utils/hex.d.ts +0 -0
- package/dist/{src → types}/utils/http.d.ts +7 -9
- package/dist/{src → types}/utils/merge.d.ts +0 -0
- package/dist/{src → types}/utils/pss.d.ts +0 -0
- package/dist/types/utils/stamps.d.ts +12 -0
- package/dist/{src → types}/utils/stream.d.ts +0 -0
- package/dist/{src → types}/utils/tar.d.ts +0 -0
- package/dist/{src → types}/utils/type.d.ts +6 -0
- package/dist/{src → types}/utils/uint64.d.ts +0 -0
- package/dist/{src → types}/utils/url.d.ts +0 -0
- package/package.json +59 -42
- package/CHANGELOG.md +0 -529
- package/dist/index.browser.min.js +0 -3
- package/dist/index.browser.min.js.LICENSE.txt +0 -59
- package/dist/index.browser.min.js.map +0 -1
- package/dist/index.min.js +0 -3
- package/dist/index.min.js.LICENSE.txt +0 -50
- package/dist/index.min.js.map +0 -1
- package/dist/src/modules/debug/status.d.ts +0 -18
- package/dist/src/modules/stamps.d.ts +0 -4
- package/dist/src/utils/error.d.ts +0 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FeedType } from './feed/type';
|
|
2
2
|
import { EthAddress } from './utils/eth';
|
|
3
|
-
import { AllTagsOptions, Collection,
|
|
4
|
-
import type { Tag, FileData, Reference, UploadOptions, PublicKey, AddressPrefix, PssMessageHandler, PssSubscription, CollectionUploadOptions, FileUploadOptions, Data, Signer, FeedReader, FeedWriter, SOCWriter, SOCReader, Topic, BeeOptions, JsonFeedOptions, AnyJson, Pin,
|
|
3
|
+
import { AllTagsOptions, Collection, Readable, RequestOptions, UploadResult } from './types';
|
|
4
|
+
import type { Tag, FileData, Reference, UploadOptions, PublicKey, AddressPrefix, PssMessageHandler, PssSubscription, CollectionUploadOptions, FileUploadOptions, Data, Signer, FeedReader, FeedWriter, SOCWriter, SOCReader, Topic, BeeOptions, JsonFeedOptions, AnyJson, Pin, BatchId } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* The main component that abstracts operations available on the main Bee API.
|
|
7
7
|
*
|
|
@@ -57,6 +57,27 @@ export declare class Bee {
|
|
|
57
57
|
* @see [Bee API reference - `GET /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1{reference}/get)
|
|
58
58
|
*/
|
|
59
59
|
downloadReadableData(reference: Reference | string, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
60
|
+
/**
|
|
61
|
+
* Upload chunk to a Bee node
|
|
62
|
+
*
|
|
63
|
+
* @param postageBatchId Postage BatchId to be used to upload the chunk with
|
|
64
|
+
* @param data Raw chunk to be uploaded
|
|
65
|
+
* @param options Additional options like tag, encryption, pinning, content-type and request options
|
|
66
|
+
*
|
|
67
|
+
* @returns reference is a content hash of the data
|
|
68
|
+
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
|
|
69
|
+
* @see [Bee API reference - `POST /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post)
|
|
70
|
+
*/
|
|
71
|
+
uploadChunk(postageBatchId: string | BatchId, data: Uint8Array, options?: UploadOptions): Promise<Reference>;
|
|
72
|
+
/**
|
|
73
|
+
* Download chunk as a byte array
|
|
74
|
+
*
|
|
75
|
+
* @param reference Bee chunk reference
|
|
76
|
+
* @param options Options that affects the request behavior
|
|
77
|
+
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
|
|
78
|
+
* @see [Bee API reference - `GET /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1{reference}/get)
|
|
79
|
+
*/
|
|
80
|
+
downloadChunk(reference: Reference | string, options?: RequestOptions): Promise<Data>;
|
|
60
81
|
/**
|
|
61
82
|
* Upload single file to a Bee node.
|
|
62
83
|
*
|
|
@@ -448,50 +469,6 @@ export declare class Bee {
|
|
|
448
469
|
* @see [Bee docs - Chunk Types](https://docs.ethswarm.org/docs/dapps-on-swarm/chunk-types#single-owner-chunks)
|
|
449
470
|
*/
|
|
450
471
|
makeSOCWriter(signer?: Signer | Uint8Array | string, options?: RequestOptions): SOCWriter;
|
|
451
|
-
/**
|
|
452
|
-
* Creates new postage batch from the funds that the node has available in its Ethereum account.
|
|
453
|
-
*
|
|
454
|
-
* For better understanding what each parameter means and what are the optimal values please see
|
|
455
|
-
* [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
|
|
456
|
-
*
|
|
457
|
-
* **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
|
|
458
|
-
* **Warning! Not allowed when node is in Gateway mode!**
|
|
459
|
-
*
|
|
460
|
-
* @param amount Amount that represents the value per chunk, has to be greater or equal zero.
|
|
461
|
-
* @param depth Logarithm of the number of chunks that can be stamped with the batch.
|
|
462
|
-
* @param options Options for creation of postage batch and request options
|
|
463
|
-
* @throws BeeArgumentError when negative amount or depth is specified
|
|
464
|
-
* @throws TypeError if non-integer value is passed to amount or depth
|
|
465
|
-
*
|
|
466
|
-
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
|
|
467
|
-
* @see [Bee API reference - `POST /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1{amount}~1{depth}/post)
|
|
468
|
-
* @deprecated Use DebugBee for postage batch management
|
|
469
|
-
*/
|
|
470
|
-
createPostageBatch(amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
|
|
471
|
-
/**
|
|
472
|
-
* Return details for specific postage batch.
|
|
473
|
-
*
|
|
474
|
-
* **Warning! Not allowed when node is in Gateway mode!**
|
|
475
|
-
*
|
|
476
|
-
* @param postageBatchId Batch ID
|
|
477
|
-
* @param options Options that affects the request behavior
|
|
478
|
-
*
|
|
479
|
-
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
|
|
480
|
-
* @see [Bee API reference - `GET /stamps/${id}`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1{id}/get)
|
|
481
|
-
* @deprecated Use DebugBee for postage batch management
|
|
482
|
-
*/
|
|
483
|
-
getPostageBatch(postageBatchId: BatchId | string, options?: RequestOptions): Promise<PostageBatch>;
|
|
484
|
-
/**
|
|
485
|
-
* Return all postage batches that has the node available.
|
|
486
|
-
*
|
|
487
|
-
* **Warning! Not allowed when node is in Gateway mode!**
|
|
488
|
-
*
|
|
489
|
-
* @param options Options that affects the request behavior
|
|
490
|
-
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
|
|
491
|
-
* @see [Bee API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
|
|
492
|
-
* @deprecated Use DebugBee for postage batch management
|
|
493
|
-
*/
|
|
494
|
-
getAllPostageBatch(options?: RequestOptions): Promise<PostageBatch[]>;
|
|
495
472
|
/**
|
|
496
473
|
* Ping the Bee node to see if there is a live Bee node on the given URL.
|
|
497
474
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { BatchId, Ky, UploadOptions } from '../types';
|
|
2
|
-
import { Reference } from '../types';
|
|
1
|
+
import type { BatchId, Data, Ky, Reference, UploadOptions } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Upload chunk to a Bee node
|
|
5
4
|
*
|
|
@@ -20,11 +19,4 @@ export declare function upload(ky: Ky, data: Uint8Array, postageBatchId: BatchId
|
|
|
20
19
|
* @param hash Bee content reference
|
|
21
20
|
*
|
|
22
21
|
*/
|
|
23
|
-
export declare function download(ky: Ky, hash: string): Promise<
|
|
24
|
-
/**
|
|
25
|
-
* Download chunk data as a readable stream
|
|
26
|
-
*
|
|
27
|
-
* @param ky Ky instance for given Bee class instance
|
|
28
|
-
* @param hash Bee content reference
|
|
29
|
-
*/
|
|
30
|
-
export declare function downloadReadable(ky: Ky, hash: string): Promise<ReadableStream<Uint8Array>>;
|
|
22
|
+
export declare function download(ky: Ky, hash: string): Promise<Data>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
|
+
import { Ky } from '../../types';
|
|
3
|
+
import { BeeVersions } from '../../types/debug';
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.4.3-1213e063";
|
|
5
|
+
export declare const SUPPORTED_API_VERSION = "2.0.0";
|
|
6
|
+
export declare const SUPPORTED_DEBUG_API_VERSION = "1.2.1";
|
|
7
|
+
export declare const SUPPORTED_BEE_VERSION: string;
|
|
8
|
+
/**
|
|
9
|
+
* Get health of node
|
|
10
|
+
*
|
|
11
|
+
* @param ky Ky debug instance
|
|
12
|
+
*/
|
|
13
|
+
export declare function getHealth(ky: Ky): Promise<Health>;
|
|
14
|
+
/**
|
|
15
|
+
* Get information about Bee node
|
|
16
|
+
*
|
|
17
|
+
* @param ky Ky debug instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNodeInfo(ky: Ky): Promise<NodeInfo>;
|
|
20
|
+
/**
|
|
21
|
+
* Connects to a node and checks if it is a supported Bee version by the bee-js
|
|
22
|
+
*
|
|
23
|
+
* @param ky Ky debug instance
|
|
24
|
+
*
|
|
25
|
+
* @returns true if the Bee node version is supported
|
|
26
|
+
* @deprecated Use `isSupportedExactVersion` instead
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSupportedVersion(ky: Ky): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Connects to a node and checks if its version matches with the one that bee-js supports.
|
|
31
|
+
*
|
|
32
|
+
* Be aware that this is the most strict version check and most probably
|
|
33
|
+
* you will want to use more relaxed API-versions based checks like
|
|
34
|
+
* `isSupportedApiVersion`, `isSupportedMainApiVersion` or `isSupportedDebugApiVersion`
|
|
35
|
+
* based on your use-case.
|
|
36
|
+
*
|
|
37
|
+
* @param ky
|
|
38
|
+
*/
|
|
39
|
+
export declare function isSupportedExactVersion(ky: Ky): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Connects to a node and checks if its main's API version matches with the one that bee-js supports.
|
|
42
|
+
*
|
|
43
|
+
* This is useful if you are not using `BeeDebug` class (for anything else then this check)
|
|
44
|
+
* and want to make sure about compatibility.
|
|
45
|
+
*
|
|
46
|
+
* @param ky
|
|
47
|
+
*/
|
|
48
|
+
export declare function isSupportedMainApiVersion(ky: Ky): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
|
|
51
|
+
*
|
|
52
|
+
* This is useful if you are not using `Bee` class in your application and want to make sure
|
|
53
|
+
* about compatibility.
|
|
54
|
+
*
|
|
55
|
+
* @param ky
|
|
56
|
+
*/
|
|
57
|
+
export declare function isSupportedDebugApiVersion(ky: Ky): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
|
|
60
|
+
*
|
|
61
|
+
* This should be the main way how to check compatibility for your app and Bee node.
|
|
62
|
+
*
|
|
63
|
+
* @param ky
|
|
64
|
+
*/
|
|
65
|
+
export declare function isSupportedApiVersion(ky: Ky): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
|
|
68
|
+
* and versions that bee-js supports (properties prefixed with `supported*`).
|
|
69
|
+
*
|
|
70
|
+
* @param ky
|
|
71
|
+
*/
|
|
72
|
+
export declare function getVersions(ky: Ky): Promise<BeeVersions>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -118,7 +118,34 @@ export interface BalanceResponse {
|
|
|
118
118
|
export interface Health {
|
|
119
119
|
status: 'ok';
|
|
120
120
|
version: string;
|
|
121
|
+
apiVersion: string;
|
|
122
|
+
debugApiVersion: string;
|
|
123
|
+
}
|
|
124
|
+
export interface BeeVersions {
|
|
125
|
+
supportedBeeVersion: string;
|
|
126
|
+
supportedBeeApiVersion: string;
|
|
127
|
+
supportedBeeDebugApiVersion: string;
|
|
128
|
+
beeVersion: string;
|
|
129
|
+
beeApiVersion: string;
|
|
130
|
+
beeDebugApiVersion: string;
|
|
131
|
+
}
|
|
132
|
+
export declare enum BeeModes {
|
|
133
|
+
FULL = "full",
|
|
134
|
+
LIGHT = "light",
|
|
135
|
+
DEV = "dev"
|
|
121
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Information about Bee node and its configuration
|
|
139
|
+
*/
|
|
140
|
+
export interface NodeInfo {
|
|
141
|
+
gatewayMode: boolean;
|
|
142
|
+
beeMode: BeeModes;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Information about Bee node and its configuration
|
|
146
|
+
* @deprecated Use NodeInfo instead
|
|
147
|
+
*/
|
|
148
|
+
export declare type NodesInfo = NodeInfo;
|
|
122
149
|
export interface RemovePeerResponse {
|
|
123
150
|
message: string;
|
|
124
151
|
code: 0;
|
|
@@ -11,11 +11,16 @@ import type ky from 'ky-universal';
|
|
|
11
11
|
import type { Readable as NativeReadable } from 'stream';
|
|
12
12
|
import type { Readable as CompatibilityReadable } from 'readable-stream';
|
|
13
13
|
import type { ReadableStream as ReadableStreamPonyfill } from 'web-streams-polyfill/ponyfill';
|
|
14
|
+
import { Options as KyOptions } from 'ky-universal';
|
|
14
15
|
export * from './debug';
|
|
15
16
|
export declare type Ky = typeof ky;
|
|
16
17
|
export interface Dictionary<T> {
|
|
17
18
|
[Key: string]: T;
|
|
18
19
|
}
|
|
20
|
+
export declare const SPAN_SIZE = 8;
|
|
21
|
+
export declare const SECTION_SIZE = 32;
|
|
22
|
+
export declare const BRANCHES = 128;
|
|
23
|
+
export declare const CHUNK_SIZE: number;
|
|
19
24
|
export declare const ADDRESS_HEX_LENGTH = 64;
|
|
20
25
|
export declare const PSS_TARGET_HEX_LENGTH_MAX = 6;
|
|
21
26
|
export declare const PUBKEY_HEX_LENGTH = 66;
|
|
@@ -59,6 +64,17 @@ export declare type BatchId = HexString<typeof BATCH_ID_HEX_LENGTH>;
|
|
|
59
64
|
* It represents PSS Address Prefix that is used to define address neighborhood that will receive the PSS message.
|
|
60
65
|
*/
|
|
61
66
|
export declare type AddressPrefix = HexString;
|
|
67
|
+
/**
|
|
68
|
+
* Internal interface that represents configuration for creating a request with Ky
|
|
69
|
+
*/
|
|
70
|
+
export interface KyRequestOptions extends Omit<KyOptions, 'searchParams'> {
|
|
71
|
+
path: string;
|
|
72
|
+
responseType?: 'json' | 'arraybuffer' | 'stream';
|
|
73
|
+
/**
|
|
74
|
+
* Overridden parameter that allows undefined as a value.
|
|
75
|
+
*/
|
|
76
|
+
searchParams?: Record<string, string | number | boolean | undefined>;
|
|
77
|
+
}
|
|
62
78
|
export interface RequestOptions {
|
|
63
79
|
/**
|
|
64
80
|
* Timeout of requests in milliseconds
|
|
@@ -138,6 +154,17 @@ export interface UploadOptions extends RequestOptions {
|
|
|
138
154
|
* @link Tag
|
|
139
155
|
*/
|
|
140
156
|
tag?: number;
|
|
157
|
+
/**
|
|
158
|
+
* Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true).
|
|
159
|
+
*
|
|
160
|
+
* With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags.
|
|
161
|
+
* With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network.
|
|
162
|
+
*
|
|
163
|
+
* In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself.
|
|
164
|
+
*
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
deferred?: boolean;
|
|
141
168
|
}
|
|
142
169
|
export interface FileUploadOptions extends UploadOptions {
|
|
143
170
|
/**
|
|
@@ -335,6 +362,7 @@ export interface FeedWriter extends FeedReader {
|
|
|
335
362
|
* Interface for downloading single owner chunks
|
|
336
363
|
*/
|
|
337
364
|
export interface SOCReader {
|
|
365
|
+
readonly owner: HexEthAddress;
|
|
338
366
|
/**
|
|
339
367
|
* Downloads a single owner chunk
|
|
340
368
|
*
|
|
@@ -368,14 +396,16 @@ export interface PostageBatch {
|
|
|
368
396
|
bucketDepth: number;
|
|
369
397
|
blockNumber: number;
|
|
370
398
|
immutableFlag: boolean;
|
|
371
|
-
}
|
|
372
|
-
export interface DebugPostageBatch extends PostageBatch {
|
|
373
399
|
/**
|
|
374
400
|
* The time (in seconds) remaining until the batch expires; -1 signals that the batch never expires; 0 signals that the batch has already expired.
|
|
375
401
|
*/
|
|
376
402
|
batchTTL: number;
|
|
377
403
|
exists: boolean;
|
|
378
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* @deprecated Use PostageBatch instead.
|
|
407
|
+
*/
|
|
408
|
+
export declare type DebugPostageBatch = PostageBatch;
|
|
379
409
|
export interface BatchBucket {
|
|
380
410
|
bucketID: number;
|
|
381
411
|
collisions: number;
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Collection } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates array in the format of Collection with data loaded from directory on filesystem.
|
|
4
|
+
* The function loads all the data into memory!
|
|
5
|
+
*
|
|
6
|
+
* @param dir path to the directory
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeCollectionFromFS(dir: string): Promise<Collection<Uint8Array>>;
|
|
9
|
+
/**
|
|
10
|
+
* Calculate folder size recursively
|
|
11
|
+
*
|
|
12
|
+
* @param dir the path to the folder to check
|
|
13
|
+
* @returns size in bytes
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFolderSize(dir: string): Promise<number>;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Collection } from '../types';
|
|
2
2
|
export declare function isCollection(data: unknown): data is Collection<Uint8Array>;
|
|
3
3
|
export declare function assertCollection(data: unknown): asserts data is Collection<Uint8Array>;
|
|
4
|
-
/**
|
|
5
|
-
* Creates array in the format of Collection with data loaded from directory on filesystem.
|
|
6
|
-
* The function loads all the data into memory!
|
|
7
|
-
*
|
|
8
|
-
* @param dir path to the directory
|
|
9
|
-
*/
|
|
10
|
-
export declare function makeCollectionFromFS(dir: string): Promise<Collection<Uint8Array>>;
|
|
11
4
|
export declare function makeCollectionFromFileList(fileList: FileList | File[]): Promise<Collection<Uint8Array>>;
|
|
12
5
|
/**
|
|
13
6
|
* Calculate cumulative size of files
|
|
@@ -16,10 +9,3 @@ export declare function makeCollectionFromFileList(fileList: FileList | File[]):
|
|
|
16
9
|
* @returns size in bytes
|
|
17
10
|
*/
|
|
18
11
|
export declare function getCollectionSize(fileList: FileList | File[]): number;
|
|
19
|
-
/**
|
|
20
|
-
* Calculate folder size recursively
|
|
21
|
-
*
|
|
22
|
-
* @param dir the path to the folder to check
|
|
23
|
-
* @returns size in bytes
|
|
24
|
-
*/
|
|
25
|
-
export declare function getFolderSize(dir: string): Promise<number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Collection } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates array in the format of Collection with data loaded from directory on filesystem.
|
|
4
|
+
* The function loads all the data into memory!
|
|
5
|
+
*
|
|
6
|
+
* @param dir path to the directory
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeCollectionFromFS(dir: string): Promise<Collection<Uint8Array>>;
|
|
9
|
+
/**
|
|
10
|
+
* Calculate folder size recursively
|
|
11
|
+
*
|
|
12
|
+
* @param dir the path to the folder to check
|
|
13
|
+
* @returns size in bytes
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFolderSize(dir: string): Promise<number>;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { KyRequestOptions } from '../types';
|
|
2
|
+
export declare class BeeError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class BeeArgumentError extends BeeError {
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
constructor(message: string, value: unknown);
|
|
8
|
+
}
|
|
9
|
+
export declare class BeeRequestError extends BeeError {
|
|
10
|
+
readonly requestOptions: KyRequestOptions;
|
|
11
|
+
/**
|
|
12
|
+
* @param message
|
|
13
|
+
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
14
|
+
*/
|
|
15
|
+
constructor(message: string, requestOptions: KyRequestOptions);
|
|
16
|
+
}
|
|
17
|
+
export declare class BeeResponseError extends BeeError {
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly response: Response;
|
|
20
|
+
readonly responseBody: string;
|
|
21
|
+
readonly requestOptions: KyRequestOptions;
|
|
22
|
+
/**
|
|
23
|
+
* @param status HTTP status code number
|
|
24
|
+
* @param response Response returned from the server
|
|
25
|
+
* @param responseBody Response body as string which is returned from response.text() call
|
|
26
|
+
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
27
|
+
* @param message
|
|
28
|
+
*/
|
|
29
|
+
constructor(status: number, response: Response, responseBody: string, requestOptions: KyRequestOptions, message: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class BeeNotAJsonError extends BeeError {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { getCollectionSize
|
|
1
|
+
export { getCollectionSize } from './collection';
|
|
2
|
+
export { getFolderSize } from './collection.node';
|
|
2
3
|
export { Bytes, FlexBytes, isBytes, assertBytes, isFlexBytes, assertFlexBytes, bytesAtOffset, flexBytesAtOffset, bytesEqual, } from './bytes';
|
|
3
4
|
export { HexString, PrefixedHexString, makeHexString, hexToBytes, bytesToHex, intToHex, isHexString, assertHexString, assertPrefixedHexString, } from './hex';
|
|
4
5
|
export { EthAddress, makeEthAddress, makeHexEthAddress, isHexEthAddress, ethToSwarmAddress, toLittleEndian, fromLittleEndian, makeEthereumWalletSigner, } from './eth';
|
|
5
6
|
export { readableWebToNode, readableNodeToWeb, isReadableStream, isNodeReadable, normalizeToReadableStream, isReadable, } from './stream';
|
|
6
7
|
export { keccak256Hash } from './hash';
|
|
7
8
|
export { makeMaxTarget } from './pss';
|
|
9
|
+
export { getStampUsage } from './stamps';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { BeeRequest, BeeResponse, HookCallback, Ky } from '../types';
|
|
2
2
|
import { Options as KyOptions } from 'ky-universal';
|
|
3
|
-
|
|
4
|
-
path: string;
|
|
5
|
-
responseType?: 'json' | 'arraybuffer' | 'stream';
|
|
6
|
-
/**
|
|
7
|
-
* Overridden parameter that allows undefined as a value.
|
|
8
|
-
*/
|
|
9
|
-
searchParams?: Record<string, string | number | boolean | undefined>;
|
|
10
|
-
}
|
|
3
|
+
import { KyRequestOptions } from '../types';
|
|
11
4
|
interface KyResponse<T> extends Response {
|
|
12
5
|
data: T;
|
|
13
6
|
}
|
|
@@ -20,6 +13,11 @@ export declare function wrapResponseClosure(cb: HookCallback<BeeResponse>): (req
|
|
|
20
13
|
* @param obj
|
|
21
14
|
*/
|
|
22
15
|
export declare function filterHeaders(obj?: object): Record<string, string> | undefined;
|
|
23
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Main utility function to make HTTP requests.
|
|
18
|
+
* @param ky
|
|
19
|
+
* @param config
|
|
20
|
+
*/
|
|
21
|
+
export declare function http<T>(ky: Ky, config: KyRequestOptions): Promise<KyResponse<T>>;
|
|
24
22
|
export declare function makeDefaultKy(kyConfig: KyOptions): Ky;
|
|
25
23
|
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DebugPostageBatch } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Utility function that calculates usage of postage batch based on its utilization, depth and bucket depth.
|
|
4
|
+
*
|
|
5
|
+
* Be aware for small depths (17, 18) this does not provide that much information as the provided set of distinct values
|
|
6
|
+
* is small.
|
|
7
|
+
*
|
|
8
|
+
* @param utilization
|
|
9
|
+
* @param depth
|
|
10
|
+
* @param bucketDepth
|
|
11
|
+
*/
|
|
12
|
+
export declare function getStampUsage({ utilization, depth, bucketDepth }: DebugPostageBatch): number;
|
|
File without changes
|
|
File without changes
|
|
@@ -12,6 +12,12 @@ export declare function isObject(value: unknown): value is Record<string, unknow
|
|
|
12
12
|
* @param value
|
|
13
13
|
*/
|
|
14
14
|
export declare function isStrictlyObject(value: unknown): value is object;
|
|
15
|
+
/**
|
|
16
|
+
* Asserts if object is Error
|
|
17
|
+
*
|
|
18
|
+
* @param e
|
|
19
|
+
*/
|
|
20
|
+
export declare function isError(e: unknown): e is Error;
|
|
15
21
|
export declare function assertStrictlyObject(value: unknown, name?: string): asserts value is object;
|
|
16
22
|
export declare function assertBoolean(value: unknown, name?: string): asserts value is boolean;
|
|
17
23
|
export declare function assertInteger(value: unknown, name?: string): asserts value is number | NumberString;
|
|
File without changes
|
|
File without changes
|