node-consul-service 1.0.11 → 1.0.13
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/index.cjs.js +5 -0
- package/dist/index.esm.js +5 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -90,6 +90,10 @@ async function getRandomServiceInstance(serviceName) {
|
|
|
90
90
|
const randomIndex = Math.floor(Math.random() * instances.length);
|
|
91
91
|
return instances[randomIndex];
|
|
92
92
|
}
|
|
93
|
+
async function getServiceUrl(serviceName) {
|
|
94
|
+
const instance = await getRandomServiceInstance(serviceName);
|
|
95
|
+
return `http://${instance.ServiceAddress}:${instance.ServicePort}`;
|
|
96
|
+
}
|
|
93
97
|
|
|
94
98
|
function bind(fn, thisArg) {
|
|
95
99
|
return function wrap() {
|
|
@@ -19034,6 +19038,7 @@ exports.callService = callService;
|
|
|
19034
19038
|
exports.deregisterService = deregisterService;
|
|
19035
19039
|
exports.getRandomServiceInstance = getRandomServiceInstance;
|
|
19036
19040
|
exports.getServiceInstances = getServiceInstances;
|
|
19041
|
+
exports.getServiceUrl = getServiceUrl;
|
|
19037
19042
|
exports.listServices = listServices;
|
|
19038
19043
|
exports.registerService = registerService;
|
|
19039
19044
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.esm.js
CHANGED
|
@@ -88,6 +88,10 @@ async function getRandomServiceInstance(serviceName) {
|
|
|
88
88
|
const randomIndex = Math.floor(Math.random() * instances.length);
|
|
89
89
|
return instances[randomIndex];
|
|
90
90
|
}
|
|
91
|
+
async function getServiceUrl(serviceName) {
|
|
92
|
+
const instance = await getRandomServiceInstance(serviceName);
|
|
93
|
+
return `http://${instance.ServiceAddress}:${instance.ServicePort}`;
|
|
94
|
+
}
|
|
91
95
|
|
|
92
96
|
function bind(fn, thisArg) {
|
|
93
97
|
return function wrap() {
|
|
@@ -19028,5 +19032,5 @@ async function callService(serviceName, options = {}) {
|
|
|
19028
19032
|
return response.data;
|
|
19029
19033
|
}
|
|
19030
19034
|
|
|
19031
|
-
export { callService, deregisterService, getRandomServiceInstance, getServiceInstances, listServices, registerService };
|
|
19035
|
+
export { callService, deregisterService, getRandomServiceInstance, getServiceInstances, getServiceUrl, listServices, registerService };
|
|
19032
19036
|
//# sourceMappingURL=index.esm.js.map
|