af-consul
Advanced tools
Comparing version 1.0.90 to 1.0.91
@@ -19,2 +19,7 @@ "use strict"; | ||
const UPDATE_INTERVAL_IF_SUCCESS_MILLIS = 2 * 60000; | ||
// A stub in case such a function is not set for the access point in the configuration | ||
function retrieveProps(accessPoint, host, meta) { | ||
const port = Number(meta.port) || accessPoint.port; | ||
return { host, port }; | ||
} | ||
let cache = {}; | ||
@@ -54,3 +59,8 @@ async function updateAccessPoint(clOptions, accessPoint) { | ||
accessPoint.lastSuccessUpdate = Date.now(); | ||
const changes = (_f = (_e = (_d = accessPoint.setProps) === null || _d === void 0 ? void 0 : _d.call(accessPoint, { host, port: Number(meta.port) || accessPoint.port })) === null || _e === void 0 ? void 0 : _e.getChanges) === null || _f === void 0 ? void 0 : _f.call(_e); | ||
// If the retrieveProps function is not set for the access point in the configuration, use the stub | ||
if (typeof accessPoint.retrieveProps !== 'function') { | ||
accessPoint.retrieveProps = retrieveProps.bind(null, accessPoint); | ||
} | ||
const properties = accessPoint.retrieveProps(host, meta); | ||
const changes = (_f = (_e = (_d = accessPoint.setProps) === null || _d === void 0 ? void 0 : _d.call(accessPoint, properties)) === null || _e === void 0 ? void 0 : _e.getChanges) === null || _f === void 0 ? void 0 : _f.call(_e); | ||
if (changes === null || changes === void 0 ? void 0 : changes.length) { | ||
@@ -57,0 +67,0 @@ (_g = clOptions.em) === null || _g === void 0 ? void 0 : _g.emit('access-point-updated', { accessPoint, changes }); |
@@ -16,2 +16,7 @@ /* eslint-disable no-console */ | ||
const UPDATE_INTERVAL_IF_SUCCESS_MILLIS = 2 * 60000; | ||
// A stub in case such a function is not set for the access point in the configuration | ||
function retrieveProps(accessPoint, host, meta) { | ||
const port = Number(meta.port) || accessPoint.port; | ||
return { host, port }; | ||
} | ||
let cache = {}; | ||
@@ -51,3 +56,8 @@ export async function updateAccessPoint(clOptions, accessPoint) { | ||
accessPoint.lastSuccessUpdate = Date.now(); | ||
const changes = (_f = (_e = (_d = accessPoint.setProps) === null || _d === void 0 ? void 0 : _d.call(accessPoint, { host, port: Number(meta.port) || accessPoint.port })) === null || _e === void 0 ? void 0 : _e.getChanges) === null || _f === void 0 ? void 0 : _f.call(_e); | ||
// If the retrieveProps function is not set for the access point in the configuration, use the stub | ||
if (typeof accessPoint.retrieveProps !== 'function') { | ||
accessPoint.retrieveProps = retrieveProps.bind(null, accessPoint); | ||
} | ||
const properties = accessPoint.retrieveProps(host, meta); | ||
const changes = (_f = (_e = (_d = accessPoint.setProps) === null || _d === void 0 ? void 0 : _d.call(accessPoint, properties)) === null || _e === void 0 ? void 0 : _e.getChanges) === null || _f === void 0 ? void 0 : _f.call(_e); | ||
if (changes === null || changes === void 0 ? void 0 : changes.length) { | ||
@@ -54,0 +64,0 @@ (_g = clOptions.em) === null || _g === void 0 ? void 0 : _g.emit('access-point-updated', { accessPoint, changes }); |
{ | ||
"name": "af-consul", | ||
"version": "1.0.90", | ||
"version": "1.0.91", | ||
"description": "A highly specialized function library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/src/index.js", |
@@ -22,2 +22,8 @@ /* eslint-disable no-console */ | ||
// A stub in case such a function is not set for the access point in the configuration | ||
function retrieveProps(accessPoint: IAccessPoint, host: string, meta: any) { | ||
const port = Number(meta.port) || accessPoint.port; | ||
return { host, port }; | ||
} | ||
let cache = {}; | ||
@@ -57,3 +63,10 @@ | ||
accessPoint.lastSuccessUpdate = Date.now(); | ||
const changes = accessPoint.setProps?.({ host, port: Number(meta.port) || accessPoint.port })?.getChanges?.(); | ||
// If the retrieveProps function is not set for the access point in the configuration, use the stub | ||
if (typeof accessPoint.retrieveProps !== 'function') { | ||
accessPoint.retrieveProps = retrieveProps.bind(null, accessPoint); | ||
} | ||
const properties = accessPoint.retrieveProps(host, meta); | ||
const changes = accessPoint.setProps?.(properties)?.getChanges?.(); | ||
if (changes?.length) { | ||
@@ -60,0 +73,0 @@ clOptions.em?.emit('access-point-updated', { accessPoint, changes }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
250988
3775