@ethersphere/bee-js 3.1.0 → 3.2.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/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/src/bee-debug.d.ts +2 -2
- package/dist/src/modules/debug/status.d.ts +2 -2
- package/dist/src/types/debug.d.ts +9 -1
- package/dist/src/types/index.d.ts +27 -2
- package/dist/src/utils/error.d.ts +21 -2
- package/dist/src/utils/http.d.ts +7 -9
- package/dist/src/utils/type.d.ts +6 -0
- package/package.json +20 -21
- package/CHANGELOG.md +0 -574
package/dist/src/bee-debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Peer, BalanceResponse, PeerBalance, ChequebookAddressResponse, ChequebookBalanceResponse, LastChequesResponse, LastChequesForPeerResponse, LastCashoutActionResponse, Settlements, AllSettlements, RemovePeerResponse, Topology, PingResponse, Health, NodeAddresses, ReserveState, ChainState, NumberString, ExtendedTag, PostageBatchBuckets, DebugPostageBatch, TransactionInfo, TransactionHash,
|
|
1
|
+
import type { Address, Peer, BalanceResponse, PeerBalance, ChequebookAddressResponse, ChequebookBalanceResponse, LastChequesResponse, LastChequesForPeerResponse, LastCashoutActionResponse, Settlements, AllSettlements, RemovePeerResponse, Topology, PingResponse, Health, NodeAddresses, ReserveState, ChainState, NumberString, ExtendedTag, PostageBatchBuckets, DebugPostageBatch, TransactionInfo, TransactionHash, NodeInfo } from './types';
|
|
2
2
|
import { BatchId, BeeOptions, CashoutOptions, PostageBatchOptions, RequestOptions, Tag } from './types';
|
|
3
3
|
export declare class BeeDebug {
|
|
4
4
|
/**
|
|
@@ -120,7 +120,7 @@ export declare class BeeDebug {
|
|
|
120
120
|
/**
|
|
121
121
|
* Get mode information of node
|
|
122
122
|
*/
|
|
123
|
-
getNodeInfo(options?: RequestOptions): Promise<
|
|
123
|
+
getNodeInfo(options?: RequestOptions): Promise<NodeInfo>;
|
|
124
124
|
/**
|
|
125
125
|
* Connnects to a node and checks if it is a supported Bee version by the bee-js
|
|
126
126
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Health,
|
|
1
|
+
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
2
|
import { Ky } from '../../types';
|
|
3
3
|
export declare const SUPPORTED_BEE_VERSION_EXACT: string;
|
|
4
4
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
@@ -13,7 +13,7 @@ export declare function getHealth(ky: Ky): Promise<Health>;
|
|
|
13
13
|
*
|
|
14
14
|
* @param ky Ky debug instance
|
|
15
15
|
*/
|
|
16
|
-
export declare function getNodeInfo(ky: Ky): Promise<
|
|
16
|
+
export declare function getNodeInfo(ky: Ky): Promise<NodeInfo>;
|
|
17
17
|
/**
|
|
18
18
|
* Connects to a node and checks if it is a supported Bee version by the bee-js
|
|
19
19
|
*
|
|
@@ -126,10 +126,18 @@ export declare enum BeeModes {
|
|
|
126
126
|
LIGHT = "light",
|
|
127
127
|
DEV = "dev"
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Information about Bee node and its configuration
|
|
131
|
+
*/
|
|
132
|
+
export interface NodeInfo {
|
|
130
133
|
gatewayMode: boolean;
|
|
131
134
|
beeMode: BeeModes;
|
|
132
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Information about Bee node and its configuration
|
|
138
|
+
* @deprecated Use NodeInfo instead
|
|
139
|
+
*/
|
|
140
|
+
export declare type NodesInfo = NodeInfo;
|
|
133
141
|
export interface RemovePeerResponse {
|
|
134
142
|
message: string;
|
|
135
143
|
code: 0;
|
|
@@ -11,6 +11,7 @@ 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> {
|
|
@@ -63,6 +64,17 @@ export declare type BatchId = HexString<typeof BATCH_ID_HEX_LENGTH>;
|
|
|
63
64
|
* It represents PSS Address Prefix that is used to define address neighborhood that will receive the PSS message.
|
|
64
65
|
*/
|
|
65
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
|
+
}
|
|
66
78
|
export interface RequestOptions {
|
|
67
79
|
/**
|
|
68
80
|
* Timeout of requests in milliseconds
|
|
@@ -142,6 +154,17 @@ export interface UploadOptions extends RequestOptions {
|
|
|
142
154
|
* @link Tag
|
|
143
155
|
*/
|
|
144
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;
|
|
145
168
|
}
|
|
146
169
|
export interface FileUploadOptions extends UploadOptions {
|
|
147
170
|
/**
|
|
@@ -372,14 +395,16 @@ export interface PostageBatch {
|
|
|
372
395
|
bucketDepth: number;
|
|
373
396
|
blockNumber: number;
|
|
374
397
|
immutableFlag: boolean;
|
|
375
|
-
}
|
|
376
|
-
export interface DebugPostageBatch extends PostageBatch {
|
|
377
398
|
/**
|
|
378
399
|
* The time (in seconds) remaining until the batch expires; -1 signals that the batch never expires; 0 signals that the batch has already expired.
|
|
379
400
|
*/
|
|
380
401
|
batchTTL: number;
|
|
381
402
|
exists: boolean;
|
|
382
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* @deprecated Use PostageBatch instead.
|
|
406
|
+
*/
|
|
407
|
+
export declare type DebugPostageBatch = PostageBatch;
|
|
383
408
|
export interface BatchBucket {
|
|
384
409
|
bucketID: number;
|
|
385
410
|
collisions: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KyRequestOptions } from '../types';
|
|
1
2
|
export declare class BeeError extends Error {
|
|
2
3
|
constructor(message: string);
|
|
3
4
|
}
|
|
@@ -6,9 +7,27 @@ export declare class BeeArgumentError extends BeeError {
|
|
|
6
7
|
constructor(message: string, value: unknown);
|
|
7
8
|
}
|
|
8
9
|
export declare class BeeRequestError extends BeeError {
|
|
9
|
-
|
|
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);
|
|
10
16
|
}
|
|
11
17
|
export declare class BeeResponseError extends BeeError {
|
|
12
18
|
readonly status: number;
|
|
13
|
-
|
|
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();
|
|
14
33
|
}
|
package/dist/src/utils/http.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/src/utils/type.d.ts
CHANGED
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -61,23 +61,23 @@
|
|
|
61
61
|
"ky-universal": "^0.8.2",
|
|
62
62
|
"readable-stream": "^3.6.0",
|
|
63
63
|
"tar-js": "^0.3.0",
|
|
64
|
-
"utf-8-validate": "^5.0.
|
|
64
|
+
"utf-8-validate": "^5.0.8",
|
|
65
65
|
"web-streams-polyfill": "^3.1.0",
|
|
66
66
|
"ws": "^7.5.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@babel/core": "^7.14.6",
|
|
70
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
70
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
71
71
|
"@babel/plugin-transform-runtime": "^7.14.5",
|
|
72
72
|
"@babel/preset-env": "^7.14.7",
|
|
73
73
|
"@babel/preset-typescript": "^7.14.5",
|
|
74
74
|
"@commitlint/cli": "^12.1.1",
|
|
75
|
-
"@commitlint/config-conventional": "^
|
|
75
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
76
76
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
77
77
|
"@jest/test-sequencer": "^27.0.5",
|
|
78
78
|
"@jest/types": "^27.0.2",
|
|
79
|
-
"@types/content-disposition": "^0.5.
|
|
80
|
-
"@types/debug": "^4.1.
|
|
79
|
+
"@types/content-disposition": "^0.5.4",
|
|
80
|
+
"@types/debug": "^4.1.7",
|
|
81
81
|
"@types/elliptic": "^6.4.12",
|
|
82
82
|
"@types/expect-puppeteer": "^4.4.5",
|
|
83
83
|
"@types/glob": "^7.1.3",
|
|
@@ -85,35 +85,34 @@
|
|
|
85
85
|
"@types/jest-environment-puppeteer": "^4.4.1",
|
|
86
86
|
"@types/node": "^15.12.4",
|
|
87
87
|
"@types/puppeteer": "^5.4.3",
|
|
88
|
-
"@types/terser-webpack-plugin": "^5.0.3",
|
|
89
88
|
"@types/ws": "^7.4.5",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
91
|
-
"@typescript-eslint/parser": "^
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
90
|
+
"@typescript-eslint/parser": "^5.10.0",
|
|
92
91
|
"babel-jest": "^27.0.5",
|
|
93
92
|
"babel-loader": "^8.2.2",
|
|
94
93
|
"debug": "^4.3.1",
|
|
95
|
-
"depcheck": "^1.4.
|
|
96
|
-
"eslint": "^7.
|
|
94
|
+
"depcheck": "^1.4.3",
|
|
95
|
+
"eslint": "^8.7.0",
|
|
97
96
|
"eslint-config-prettier": "^8.3.0",
|
|
98
|
-
"eslint-plugin-jest": "^
|
|
99
|
-
"eslint-plugin-prettier": "^
|
|
100
|
-
"eslint-plugin-unused-imports": "^
|
|
97
|
+
"eslint-plugin-jest": "^25.7.0",
|
|
98
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
99
|
+
"eslint-plugin-unused-imports": "^2.0.0",
|
|
101
100
|
"glob": "^7.1.7",
|
|
102
101
|
"husky": "^6.0.0",
|
|
103
102
|
"jest": "^27.0.5",
|
|
104
103
|
"jest-puppeteer": "^5.0.4",
|
|
105
|
-
"nock": "^13.
|
|
104
|
+
"nock": "^13.2.2",
|
|
106
105
|
"prettier": "^2.3.1",
|
|
107
106
|
"puppeteer": "^9.1.1",
|
|
108
107
|
"rimraf": "^3.0.2",
|
|
109
|
-
"terser-webpack-plugin": "^5.
|
|
108
|
+
"terser-webpack-plugin": "^5.3.0",
|
|
110
109
|
"ts-node": "^10.0.0",
|
|
111
|
-
"typedoc": "^0.
|
|
112
|
-
"typedoc-plugin-markdown": "^3.
|
|
113
|
-
"typescript": "^4.
|
|
114
|
-
"webpack": "^5.
|
|
110
|
+
"typedoc": "^0.22.11",
|
|
111
|
+
"typedoc-plugin-markdown": "^3.11.12",
|
|
112
|
+
"typescript": "^4.5.4",
|
|
113
|
+
"webpack": "^5.65.0",
|
|
115
114
|
"webpack-bundle-analyzer": "^4.4.1",
|
|
116
|
-
"webpack-cli": "^4.
|
|
115
|
+
"webpack-cli": "^4.9.2"
|
|
117
116
|
},
|
|
118
117
|
"engines": {
|
|
119
118
|
"node": ">=12.0.0",
|