@ethersphere/bee-js 4.1.1 → 5.0.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 +6 -2
- package/dist/cjs/bee.js +9 -3
- package/dist/cjs/chunk/soc.js +5 -1
- package/dist/cjs/feed/index.js +5 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/modules/debug/connectivity.js +2 -2
- package/dist/cjs/modules/debug/stamps.js +1 -1
- package/dist/cjs/modules/debug/status.js +3 -3
- package/dist/cjs/modules/pinning.js +1 -5
- package/dist/cjs/types/index.js +5 -1
- package/dist/cjs/utils/type.js +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +1 -1
- package/dist/mjs/bee.js +4 -2
- package/dist/mjs/modules/debug/connectivity.js +2 -2
- package/dist/mjs/modules/debug/stamps.js +1 -1
- package/dist/mjs/modules/debug/status.js +3 -3
- package/dist/mjs/modules/pinning.js +1 -7
- package/dist/mjs/utils/type.js +1 -1
- package/dist/types/bee.d.ts +2 -3
- package/dist/types/modules/debug/status.d.ts +3 -3
- package/dist/types/modules/pinning.d.ts +1 -1
- package/dist/types/types/debug.d.ts +2 -7
- package/dist/types/types/index.d.ts +25 -8
- package/dist/types/utils/type.d.ts +6 -2
- package/package.json +10 -10
package/dist/mjs/bee-debug.js
CHANGED
|
@@ -550,7 +550,7 @@ export class BeeDebug {
|
|
|
550
550
|
|
|
551
551
|
const stamp = yield stamps.createPostageBatch(this.getKy(options), amount, depth, options);
|
|
552
552
|
|
|
553
|
-
if (options === null || options === void 0 ? void 0 : options.waitForUsable) {
|
|
553
|
+
if ((options === null || options === void 0 ? void 0 : options.waitForUsable) !== false) {
|
|
554
554
|
yield this.waitForUsablePostageStamp(stamp, options === null || options === void 0 ? void 0 : options.waitForUsableTimeout);
|
|
555
555
|
}
|
|
556
556
|
|
package/dist/mjs/bee.js
CHANGED
|
@@ -833,7 +833,6 @@ export class Bee {
|
|
|
833
833
|
*
|
|
834
834
|
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
|
|
835
835
|
* @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
|
|
836
|
-
* TODO: Once breaking add support for Feed CID
|
|
837
836
|
*/
|
|
838
837
|
|
|
839
838
|
|
|
@@ -844,9 +843,12 @@ export class Bee {
|
|
|
844
843
|
assertBatchId(postageBatchId);
|
|
845
844
|
const canonicalTopic = makeTopic(topic);
|
|
846
845
|
const canonicalOwner = makeHexEthAddress(owner);
|
|
847
|
-
|
|
846
|
+
const reference = yield createFeedManifest(this.getKy(options), canonicalOwner, canonicalTopic, postageBatchId, {
|
|
848
847
|
type
|
|
849
848
|
});
|
|
849
|
+
return addCidConversionFunction({
|
|
850
|
+
reference
|
|
851
|
+
}, ReferenceType.FEED);
|
|
850
852
|
});
|
|
851
853
|
}
|
|
852
854
|
/**
|
|
@@ -46,7 +46,7 @@ export function getPeers(ky) {
|
|
|
46
46
|
path: 'peers',
|
|
47
47
|
responseType: 'json'
|
|
48
48
|
});
|
|
49
|
-
return response.data.peers
|
|
49
|
+
return response.data.peers;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
export function getBlocklist(ky) {
|
|
@@ -55,7 +55,7 @@ export function getBlocklist(ky) {
|
|
|
55
55
|
path: 'blocklist',
|
|
56
56
|
responseType: 'json'
|
|
57
57
|
});
|
|
58
|
-
return response.data.peers
|
|
58
|
+
return response.data.peers;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
export function removePeer(ky, peer) {
|
|
@@ -34,9 +34,9 @@ import { http } from "../../utils/http.js";
|
|
|
34
34
|
import getMajorSemver from 'semver/functions/major.js'; // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
|
|
35
35
|
// so if you are changing anything about them change the `update_bee` action accordingly!
|
|
36
36
|
|
|
37
|
-
export const SUPPORTED_BEE_VERSION_EXACT = '1.
|
|
38
|
-
export const SUPPORTED_API_VERSION = '3.0.
|
|
39
|
-
export const SUPPORTED_DEBUG_API_VERSION = '
|
|
37
|
+
export const SUPPORTED_BEE_VERSION_EXACT = '1.7.0-bbf13011';
|
|
38
|
+
export const SUPPORTED_API_VERSION = '3.0.2';
|
|
39
|
+
export const SUPPORTED_DEBUG_API_VERSION = '3.0.2';
|
|
40
40
|
export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.substring(0, SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
|
|
41
41
|
const NODE_INFO_URL = 'node';
|
|
42
42
|
const HEALTH_URL = 'health';
|
|
@@ -95,12 +95,6 @@ export function getAllPins(ky) {
|
|
|
95
95
|
responseType: 'json',
|
|
96
96
|
path: `${PINNING_ENDPOINT}`
|
|
97
97
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (result === null) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return result;
|
|
98
|
+
return response.data.references;
|
|
105
99
|
});
|
|
106
100
|
}
|
package/dist/mjs/utils/type.js
CHANGED
|
@@ -151,7 +151,7 @@ export function makeReferenceOrEns(value, expectedCidType) {
|
|
|
151
151
|
|
|
152
152
|
export function addCidConversionFunction(result, cidType) {
|
|
153
153
|
return Object.assign(Object.assign({}, result), {
|
|
154
|
-
|
|
154
|
+
cid() {
|
|
155
155
|
return encodeReference(result.reference, cidType).toString();
|
|
156
156
|
}
|
|
157
157
|
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Index, IndexBytes } from './feed';
|
|
|
2
2
|
import { FeedType } from './feed/type';
|
|
3
3
|
import { EthAddress } from './utils/eth';
|
|
4
4
|
import type { AddressPrefix, AnyJson, BatchId, BeeOptions, CollectionUploadOptions, Data, FeedReader, FeedWriter, FileData, FileUploadOptions, JsonFeedOptions, Pin, PssMessageHandler, PssSubscription, PublicKey, Reference, Signer, SOCReader, SOCWriter, Tag, Topic, UploadOptions, UploadResultWithCid } from './types';
|
|
5
|
-
import { AllTagsOptions, Collection, Readable, ReferenceCidOrEns, ReferenceOrEns, RequestOptions, UploadResult } from './types';
|
|
5
|
+
import { AllTagsOptions, Collection, FeedManifestResult, Readable, ReferenceCidOrEns, ReferenceOrEns, RequestOptions, UploadResult } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* The main component that abstracts operations available on the main Bee API.
|
|
8
8
|
*
|
|
@@ -411,9 +411,8 @@ export declare class Bee {
|
|
|
411
411
|
*
|
|
412
412
|
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
|
|
413
413
|
* @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
|
|
414
|
-
* TODO: Once breaking add support for Feed CID
|
|
415
414
|
*/
|
|
416
|
-
createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): Promise<
|
|
415
|
+
createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): Promise<FeedManifestResult>;
|
|
417
416
|
/**
|
|
418
417
|
* Make a new feed reader for downloading feed updates.
|
|
419
418
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
2
|
import { Ky } from '../../types';
|
|
3
3
|
import { BeeVersions } from '../../types/debug';
|
|
4
|
-
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.
|
|
5
|
-
export declare const SUPPORTED_API_VERSION = "3.0.
|
|
6
|
-
export declare const SUPPORTED_DEBUG_API_VERSION = "
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.7.0-bbf13011";
|
|
5
|
+
export declare const SUPPORTED_API_VERSION = "3.0.2";
|
|
6
|
+
export declare const SUPPORTED_DEBUG_API_VERSION = "3.0.2";
|
|
7
7
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
8
8
|
/**
|
|
9
9
|
* Get health of node
|
|
@@ -161,11 +161,6 @@ export interface NodeInfo {
|
|
|
161
161
|
*/
|
|
162
162
|
swapEnabled: boolean;
|
|
163
163
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Information about Bee node and its configuration
|
|
166
|
-
* @deprecated Use NodeInfo instead
|
|
167
|
-
*/
|
|
168
|
-
export declare type NodesInfo = NodeInfo;
|
|
169
164
|
export interface RemovePeerResponse {
|
|
170
165
|
message: string;
|
|
171
166
|
code: 0;
|
|
@@ -173,8 +168,8 @@ export interface RemovePeerResponse {
|
|
|
173
168
|
export interface Bin {
|
|
174
169
|
population: number;
|
|
175
170
|
connected: number;
|
|
176
|
-
disconnectedPeers: Peer[]
|
|
177
|
-
connectedPeers: Peer[]
|
|
171
|
+
disconnectedPeers: Peer[];
|
|
172
|
+
connectedPeers: Peer[];
|
|
178
173
|
}
|
|
179
174
|
export interface Topology {
|
|
180
175
|
baseAddr: string;
|
|
@@ -124,7 +124,13 @@ export interface BeeOptions extends RequestOptions {
|
|
|
124
124
|
onResponse?: HookCallback<BeeResponse>;
|
|
125
125
|
}
|
|
126
126
|
export interface UploadResultWithCid extends UploadResult {
|
|
127
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Function that converts the reference into Swarm CIDs
|
|
129
|
+
*
|
|
130
|
+
* @throws TypeError if the reference is encrypted reference (eq. 128 chars long) which is not supported in CID
|
|
131
|
+
* @see https://github.com/ethersphere/swarm-cid-js
|
|
132
|
+
*/
|
|
133
|
+
cid: () => string;
|
|
128
134
|
}
|
|
129
135
|
/**
|
|
130
136
|
* Result of upload calls.
|
|
@@ -332,6 +338,21 @@ export declare const TOPIC_HEX_LENGTH = 64;
|
|
|
332
338
|
* Hex string of length 64 chars without prefix that specifies topics for feed.
|
|
333
339
|
*/
|
|
334
340
|
export declare type Topic = HexString<typeof TOPIC_HEX_LENGTH>;
|
|
341
|
+
/**
|
|
342
|
+
* Result of upload calls.
|
|
343
|
+
*/
|
|
344
|
+
export interface FeedManifestResult {
|
|
345
|
+
/**
|
|
346
|
+
* Reference of the uploaded data
|
|
347
|
+
*/
|
|
348
|
+
reference: Reference;
|
|
349
|
+
/**
|
|
350
|
+
* Function that converts the reference into Swarm Feed CID.
|
|
351
|
+
*
|
|
352
|
+
* @see https://github.com/ethersphere/swarm-cid-js
|
|
353
|
+
*/
|
|
354
|
+
cid: () => string;
|
|
355
|
+
}
|
|
335
356
|
/**
|
|
336
357
|
* FeedReader is an interface for downloading feed updates
|
|
337
358
|
*/
|
|
@@ -417,10 +438,6 @@ export interface PostageBatch {
|
|
|
417
438
|
batchTTL: number;
|
|
418
439
|
exists: boolean;
|
|
419
440
|
}
|
|
420
|
-
/**
|
|
421
|
-
* @deprecated Use PostageBatch instead.
|
|
422
|
-
*/
|
|
423
|
-
export declare type DebugPostageBatch = PostageBatch;
|
|
424
441
|
export interface BatchBucket {
|
|
425
442
|
bucketID: number;
|
|
426
443
|
collisions: number;
|
|
@@ -459,12 +476,12 @@ export interface PostageBatchOptions extends RequestOptions {
|
|
|
459
476
|
/**
|
|
460
477
|
* The returned Promise will await until the purchased Postage Batch is usable.
|
|
461
478
|
* In other word, it has to have enough block confirmations that Bee pronounce it usable.
|
|
462
|
-
*
|
|
479
|
+
* When turned on, this significantly prolongs the creation of postage batch!
|
|
480
|
+
*
|
|
463
481
|
* If you plan to use the stamp right away for some action with Bee (like uploading using this stamp) it is
|
|
464
482
|
* highly recommended to use this option, otherwise you might get errors "stamp not usable" from Bee.
|
|
465
483
|
*
|
|
466
|
-
*
|
|
467
|
-
* @default false
|
|
484
|
+
* @default true
|
|
468
485
|
*/
|
|
469
486
|
waitForUsable?: boolean;
|
|
470
487
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns
|
|
1
|
+
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns } from '../types';
|
|
2
2
|
import { ReferenceType } from '@ethersphere/swarm-cid';
|
|
3
3
|
export declare function isUint8Array(obj: unknown): obj is Uint8Array;
|
|
4
4
|
export declare function isInteger(value: unknown): value is number | NumberString;
|
|
@@ -38,7 +38,11 @@ export declare function makeReferenceOrEns(value: unknown, expectedCidType: Refe
|
|
|
38
38
|
* @param result
|
|
39
39
|
* @param cidType Type as described in the @ethersphere/swarm-cids-js -> ReferenceType
|
|
40
40
|
*/
|
|
41
|
-
export declare function addCidConversionFunction
|
|
41
|
+
export declare function addCidConversionFunction<T extends {
|
|
42
|
+
reference: string;
|
|
43
|
+
}>(result: T, cidType: ReferenceType): T & {
|
|
44
|
+
cid: () => string;
|
|
45
|
+
};
|
|
42
46
|
export declare function assertAddress(value: unknown): asserts value is Address;
|
|
43
47
|
export declare function assertBatchId(value: unknown): asserts value is BatchId;
|
|
44
48
|
export declare function assertRequestOptions(value: unknown, name?: string): asserts value is RequestOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
"tar-js": "^0.3.0",
|
|
78
78
|
"utf-8-validate": "^5.0.9",
|
|
79
79
|
"web-streams-polyfill": "^4.0.0-beta.1",
|
|
80
|
-
"ws": "^8.
|
|
80
|
+
"ws": "^8.7.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/cli": "^7.17.10",
|
|
84
|
-
"@babel/core": "^7.
|
|
84
|
+
"@babel/core": "^7.18.2",
|
|
85
85
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
86
86
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
87
87
|
"@babel/preset-env": "^7.17.10",
|
|
88
88
|
"@babel/preset-typescript": "^7.14.5",
|
|
89
|
-
"@commitlint/cli": "^
|
|
89
|
+
"@commitlint/cli": "^17.0.2",
|
|
90
90
|
"@commitlint/config-conventional": "^16.2.1",
|
|
91
91
|
"@ethersphere/bee-factory": "^0.4.1",
|
|
92
92
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"puppeteer": "^14.1.0",
|
|
127
127
|
"rimraf": "^3.0.2",
|
|
128
128
|
"terser-webpack-plugin": "^5.3.1",
|
|
129
|
-
"ts-node": "^10.
|
|
129
|
+
"ts-node": "^10.8.0",
|
|
130
130
|
"typescript": "^4.5.4",
|
|
131
|
-
"webpack": "^5.72.
|
|
131
|
+
"webpack": "^5.72.1",
|
|
132
132
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
133
133
|
"webpack-cli": "^4.9.2"
|
|
134
134
|
},
|
|
135
135
|
"engines": {
|
|
136
|
-
"node": ">=
|
|
136
|
+
"node": ">=14.0.0",
|
|
137
137
|
"npm": ">=6.0.0",
|
|
138
|
-
"beeApiVersion": "3.0.
|
|
139
|
-
"beeDebugApiVersion": "
|
|
140
|
-
"bee": "1.
|
|
138
|
+
"beeApiVersion": "3.0.2",
|
|
139
|
+
"beeDebugApiVersion": "3.0.2",
|
|
140
|
+
"bee": "1.7.0-bbf13011"
|
|
141
141
|
}
|
|
142
142
|
}
|