@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/cjs/bee.js
CHANGED
|
@@ -896,6 +896,17 @@ class Bee {
|
|
|
896
896
|
}
|
|
897
897
|
return true;
|
|
898
898
|
}
|
|
899
|
+
/**
|
|
900
|
+
* Checks the `/gateway` endpoint to see if the remote API is a gateway.
|
|
901
|
+
*
|
|
902
|
+
* Do note that this is not a standard way to check for gateway nodes,
|
|
903
|
+
* but some of the gateway tooling expose this endpoint.
|
|
904
|
+
*
|
|
905
|
+
* @param options
|
|
906
|
+
*/
|
|
907
|
+
async isGateway(options) {
|
|
908
|
+
return status.isGateway(this.getRequestOptionsForCall(options));
|
|
909
|
+
}
|
|
899
910
|
// Legacy debug API
|
|
900
911
|
async getNodeAddresses(options) {
|
|
901
912
|
return connectivity.getNodeAddresses(this.getRequestOptionsForCall(options));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkConnection = void 0;
|
|
3
|
+
exports.isGateway = exports.checkConnection = void 0;
|
|
4
|
+
const cafe_utility_1 = require("cafe-utility");
|
|
4
5
|
const http_1 = require("../utils/http");
|
|
5
6
|
/**
|
|
6
7
|
* Ping the base bee URL. If connection was not successful throw error
|
|
@@ -13,3 +14,16 @@ async function checkConnection(requestOptions) {
|
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
exports.checkConnection = checkConnection;
|
|
17
|
+
async function isGateway(requestOptions) {
|
|
18
|
+
try {
|
|
19
|
+
const response = await (0, http_1.http)(requestOptions, {
|
|
20
|
+
url: '/gateway',
|
|
21
|
+
});
|
|
22
|
+
const data = cafe_utility_1.Types.asObject(response.data);
|
|
23
|
+
return cafe_utility_1.Types.asBoolean(data.gateway);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.isGateway = isGateway;
|