@ethersphere/bee-js 9.5.0 → 9.6.1
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/dist/cjs/bee.js +11 -0
- package/dist/cjs/manifest/manifest.js +3 -3
- package/dist/cjs/modules/debug/status.js +2 -2
- package/dist/cjs/modules/status.js +15 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +11 -0
- package/dist/mjs/manifest/manifest.js +3 -3
- package/dist/mjs/modules/debug/status.js +2 -2
- package/dist/mjs/modules/status.js +12 -0
- package/dist/types/bee.d.ts +9 -0
- package/dist/types/manifest/manifest.d.ts +1 -1
- package/dist/types/modules/debug/status.d.ts +2 -2
- package/dist/types/modules/status.d.ts +1 -0
- package/package.json +1 -1
package/dist/mjs/bee.js
CHANGED
|
@@ -867,6 +867,17 @@ export class Bee {
|
|
|
867
867
|
}
|
|
868
868
|
return true;
|
|
869
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* Checks the `/gateway` endpoint to see if the remote API is a gateway.
|
|
872
|
+
*
|
|
873
|
+
* Do note that this is not a standard way to check for gateway nodes,
|
|
874
|
+
* but some of the gateway tooling expose this endpoint.
|
|
875
|
+
*
|
|
876
|
+
* @param options
|
|
877
|
+
*/
|
|
878
|
+
async isGateway(options) {
|
|
879
|
+
return status.isGateway(this.getRequestOptionsForCall(options));
|
|
880
|
+
}
|
|
870
881
|
// Legacy debug API
|
|
871
882
|
async getNodeAddresses(options) {
|
|
872
883
|
return connectivity.getNodeAddresses(this.getRequestOptionsForCall(options));
|
|
@@ -68,12 +68,12 @@ export class Fork {
|
|
|
68
68
|
}
|
|
69
69
|
return Binary.concatBytes(...data);
|
|
70
70
|
}
|
|
71
|
-
static unmarshal(reader) {
|
|
71
|
+
static unmarshal(reader, addressLength) {
|
|
72
72
|
const type = Binary.uint8ToNumber(reader.read(1));
|
|
73
73
|
const prefixLength = Binary.uint8ToNumber(reader.read(1));
|
|
74
74
|
const prefix = reader.read(prefixLength);
|
|
75
75
|
reader.read(30 - prefixLength);
|
|
76
|
-
const selfAddress = reader.read(
|
|
76
|
+
const selfAddress = reader.read(addressLength);
|
|
77
77
|
let metadata = undefined;
|
|
78
78
|
if (isType(type, TYPE_WITH_METADATA)) {
|
|
79
79
|
const metadataLength = Binary.uint16ToNumber(reader.read(2), 'BE');
|
|
@@ -219,7 +219,7 @@ export class MantarayNode {
|
|
|
219
219
|
const forkBitmap = reader.read(32);
|
|
220
220
|
for (let i = 0; i < 256; i++) {
|
|
221
221
|
if (Binary.getBit(forkBitmap, i, 'LE')) {
|
|
222
|
-
const newFork = Fork.unmarshal(reader);
|
|
222
|
+
const newFork = Fork.unmarshal(reader, targetAddressLength);
|
|
223
223
|
node.forks.set(i, newFork);
|
|
224
224
|
newFork.node.parent = node;
|
|
225
225
|
}
|
|
@@ -2,9 +2,9 @@ import { Types } from 'cafe-utility';
|
|
|
2
2
|
import getMajorSemver from 'semver/functions/major.js';
|
|
3
3
|
import { toBeeMode } from "../../types/debug.js";
|
|
4
4
|
import { http } from "../../utils/http.js";
|
|
5
|
-
export const SUPPORTED_BEE_VERSION_EXACT = '2.
|
|
5
|
+
export const SUPPORTED_BEE_VERSION_EXACT = '2.6.0-d0aa8b93';
|
|
6
6
|
export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.split('-')[0];
|
|
7
|
-
export const SUPPORTED_API_VERSION = '7.
|
|
7
|
+
export const SUPPORTED_API_VERSION = '7.3.0';
|
|
8
8
|
const NODE_INFO_URL = 'node';
|
|
9
9
|
const STATUS_URL = 'status';
|
|
10
10
|
const HEALTH_URL = 'health';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Types } from 'cafe-utility';
|
|
1
2
|
import { http } from "../utils/http.js";
|
|
2
3
|
/**
|
|
3
4
|
* Ping the base bee URL. If connection was not successful throw error
|
|
@@ -8,4 +9,15 @@ export async function checkConnection(requestOptions) {
|
|
|
8
9
|
await http(requestOptions, {
|
|
9
10
|
url: ''
|
|
10
11
|
});
|
|
12
|
+
}
|
|
13
|
+
export async function isGateway(requestOptions) {
|
|
14
|
+
try {
|
|
15
|
+
const response = await http(requestOptions, {
|
|
16
|
+
url: '/gateway'
|
|
17
|
+
});
|
|
18
|
+
const data = Types.asObject(response.data);
|
|
19
|
+
return Types.asBoolean(data.gateway);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
11
23
|
}
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -497,6 +497,15 @@ export declare class Bee {
|
|
|
497
497
|
* @returns true if successful, false on error
|
|
498
498
|
*/
|
|
499
499
|
isConnected(options?: BeeRequestOptions): Promise<boolean>;
|
|
500
|
+
/**
|
|
501
|
+
* Checks the `/gateway` endpoint to see if the remote API is a gateway.
|
|
502
|
+
*
|
|
503
|
+
* Do note that this is not a standard way to check for gateway nodes,
|
|
504
|
+
* but some of the gateway tooling expose this endpoint.
|
|
505
|
+
*
|
|
506
|
+
* @param options
|
|
507
|
+
*/
|
|
508
|
+
isGateway(options?: BeeRequestOptions): Promise<boolean>;
|
|
500
509
|
getNodeAddresses(options?: BeeRequestOptions): Promise<NodeAddresses>;
|
|
501
510
|
getBlocklist(options?: BeeRequestOptions): Promise<Peer[]>;
|
|
502
511
|
/**
|
|
@@ -9,7 +9,7 @@ export declare class Fork {
|
|
|
9
9
|
constructor(prefix: Uint8Array, node: MantarayNode);
|
|
10
10
|
static split(a: Fork, b: Fork): Fork;
|
|
11
11
|
marshal(): Uint8Array;
|
|
12
|
-
static unmarshal(reader: Uint8ArrayReader): Fork;
|
|
12
|
+
static unmarshal(reader: Uint8ArrayReader, addressLength: number): Fork;
|
|
13
13
|
}
|
|
14
14
|
interface MantarayNodeOptions {
|
|
15
15
|
selfAddress?: Uint8Array;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BeeRequestOptions } from '../../index';
|
|
2
2
|
import type { DebugStatus, Health, NodeInfo, Readiness } from '../../types/debug';
|
|
3
3
|
import { BeeVersions } from '../../types/debug';
|
|
4
|
-
export declare const SUPPORTED_BEE_VERSION_EXACT = "2.
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "2.6.0-d0aa8b93";
|
|
5
5
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
6
|
-
export declare const SUPPORTED_API_VERSION = "7.
|
|
6
|
+
export declare const SUPPORTED_API_VERSION = "7.3.0";
|
|
7
7
|
export declare function getDebugStatus(requestOptions: BeeRequestOptions): Promise<DebugStatus>;
|
|
8
8
|
/**
|
|
9
9
|
* Get health of node
|
|
@@ -5,3 +5,4 @@ import { BeeRequestOptions } from '../index';
|
|
|
5
5
|
* @param requestOptions Options for making requests
|
|
6
6
|
*/
|
|
7
7
|
export declare function checkConnection(requestOptions: BeeRequestOptions): Promise<void> | never;
|
|
8
|
+
export declare function isGateway(requestOptions: BeeRequestOptions): Promise<boolean>;
|