@ethersphere/bee-js 9.5.0 → 9.6.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/dist/cjs/bee.js +11 -0
- 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/modules/status.js +12 -0
- package/dist/types/bee.d.ts +9 -0
- 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));
|
|
@@ -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
|
/**
|
|
@@ -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>;
|