@logzio-node-toolbox/consul
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -15,3 +15,4 @@ import retry from 'async-retry'; | ||
backoffMax: 30000, | ||
maxAttempts: 10000 | ||
maxAttempts: 10000, | ||
ignoreFirst: true | ||
}; | ||
@@ -59,2 +60,3 @@ const defaultRegisterRetryOptions = { | ||
this.keyPrefix = baseUrl ? `${baseUrl.replace(/\/*$/, '')}/` : ''; | ||
this.didIgnoreFisrt = false; | ||
this.connectionParams = { | ||
@@ -149,3 +151,6 @@ host, | ||
if (!key || !onChange) return; | ||
const watchOptions = { | ||
const { | ||
ignoreFirst, | ||
...watchOptions | ||
} = { | ||
method: this.consulInstance.kv.get, | ||
@@ -159,7 +164,31 @@ options: { | ||
const watcher = this.consulInstance.watch(watchOptions); | ||
watcher.on('change', data => data && onChange(parseValue(data))); | ||
watcher.on('error', error => error && onError({ | ||
error, | ||
key | ||
})); | ||
if (!ignoreFirst) this.didIgnoreFisrt = true; | ||
this.get(key).then(data => !data ? this.didIgnoreFisrt = true : '').catch(() => this.didIgnoreFisrt = true); | ||
watcher.on('change', data => { | ||
if (this.didIgnoreFisrt && data) { | ||
onChange(parseValue(data)); | ||
} else if (data) { | ||
this.didIgnoreFisrt = true; | ||
} | ||
}); | ||
watcher.on('error', error => { | ||
if (error && error.message === 'not found') return; | ||
const returnError = { ...error, | ||
host: this.connectionParams.host, | ||
port: this.connectionParams.port | ||
}; | ||
if (error && error.code === 'ECONNREFUSED') { | ||
returnError.message = `unable to reconnect to ${this.connectionParams.host}:${this.connectionParams.port}, not watching ${key}`; | ||
} else if (error && error.code === 'ECONNRESET') { | ||
returnError.message = `connection to ${this.connectionParams.host}:${this.connectionParams.port} lost, stop watching ${key}`; | ||
} else { | ||
returnError.message = `error on watch ${key}`; | ||
} | ||
onError({ | ||
error: returnError, | ||
key | ||
}); | ||
}); | ||
this.openWatchersToClose.push(watcher); | ||
@@ -228,2 +257,44 @@ } | ||
function _classPrivateFieldGet(receiver, privateMap) { | ||
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); | ||
return _classApplyDescriptorGet(receiver, descriptor); | ||
} | ||
function _classPrivateFieldSet(receiver, privateMap, value) { | ||
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); | ||
_classApplyDescriptorSet(receiver, descriptor, value); | ||
return value; | ||
} | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to " + action + " private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
} | ||
function _classApplyDescriptorGet(receiver, descriptor) { | ||
if (descriptor.get) { | ||
return descriptor.get.call(receiver); | ||
} | ||
return descriptor.value; | ||
} | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { | ||
if (descriptor.set) { | ||
descriptor.set.call(receiver, value); | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
descriptor.value = value; | ||
} | ||
} | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
@@ -241,4 +312,5 @@ | ||
var global$1 = // eslint-disable-next-line no-undef | ||
check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func | ||
var global$1 = | ||
/* global globalThis -- safe */ | ||
check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback | ||
function () { | ||
@@ -268,5 +340,5 @@ return this; | ||
var nativePropertyIsEnumerable = {}.propertyIsEnumerable; | ||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug | ||
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug | ||
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ | ||
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ | ||
1: 2 | ||
@@ -276,4 +348,4 @@ }, 1); // `Object.prototype.propertyIsEnumerable` method implementation | ||
var f = NASHORN_BUG ? function propertyIsEnumerable(V) { | ||
var descriptor = getOwnPropertyDescriptor(this, V); | ||
var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) { | ||
var descriptor = getOwnPropertyDescriptor$1(this, V); | ||
return !!descriptor && descriptor.enumerable; | ||
@@ -283,3 +355,3 @@ } : nativePropertyIsEnumerable; | ||
var objectPropertyIsEnumerable = { | ||
f: f | ||
f: f$5 | ||
}; | ||
@@ -306,3 +378,3 @@ | ||
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 | ||
// eslint-disable-next-line no-prototype-builtins | ||
// eslint-disable-next-line no-prototype-builtins -- safe | ||
return !Object('z').propertyIsEnumerable(0); | ||
@@ -350,3 +422,3 @@ }) ? function (it) { | ||
var has = function (it, key) { | ||
var has$1 = function (it, key) { | ||
return hasOwnProperty.call(it, key); | ||
@@ -377,3 +449,3 @@ }; | ||
var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | ||
var f$4 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | ||
O = toIndexedObject(O); | ||
@@ -386,7 +458,7 @@ P = toPrimitive(P, true); | ||
} | ||
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); | ||
if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); | ||
}; | ||
var objectGetOwnPropertyDescriptor = { | ||
f: f$1 | ||
f: f$4 | ||
}; | ||
@@ -405,3 +477,3 @@ | ||
var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { | ||
var f$3 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { | ||
anObject(O); | ||
@@ -421,3 +493,3 @@ P = toPrimitive(P, true); | ||
var objectDefineProperty = { | ||
f: f$2 | ||
f: f$3 | ||
}; | ||
@@ -443,4 +515,4 @@ | ||
var SHARED = '__core-js_shared__'; | ||
var store = global$1[SHARED] || setGlobal(SHARED, {}); | ||
var sharedStore = store; | ||
var store$1 = global$1[SHARED] || setGlobal(SHARED, {}); | ||
var sharedStore = store$1; | ||
@@ -457,4 +529,4 @@ var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper | ||
var WeakMap$1 = global$1.WeakMap; | ||
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); | ||
var WeakMap$2 = global$1.WeakMap; | ||
var nativeWeakMap = typeof WeakMap$2 === 'function' && /native code/.test(inspectSource(WeakMap$2)); | ||
@@ -467,3 +539,3 @@ var isPure = false; | ||
})('versions', []).push({ | ||
version: '3.8.3', | ||
version: '3.9.1', | ||
mode: 'global', | ||
@@ -487,9 +559,9 @@ copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
var hiddenKeys = {}; | ||
var hiddenKeys$1 = {}; | ||
var WeakMap$2 = global$1.WeakMap; | ||
var set, get, has$1; | ||
var WeakMap$1 = global$1.WeakMap; | ||
var set, get, has; | ||
var enforce = function (it) { | ||
return has$1(it) ? get(it) : set(it, {}); | ||
return has(it) ? get(it) : set(it, {}); | ||
}; | ||
@@ -510,10 +582,10 @@ | ||
if (nativeWeakMap) { | ||
var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$2()); | ||
var wmget = store$1.get; | ||
var wmhas = store$1.has; | ||
var wmset = store$1.set; | ||
var store = sharedStore.state || (sharedStore.state = new WeakMap$1()); | ||
var wmget = store.get; | ||
var wmhas = store.has; | ||
var wmset = store.set; | ||
set = function (it, metadata) { | ||
metadata.facade = it; | ||
wmset.call(store$1, it, metadata); | ||
wmset.call(store, it, metadata); | ||
return metadata; | ||
@@ -523,11 +595,11 @@ }; | ||
get = function (it) { | ||
return wmget.call(store$1, it) || {}; | ||
return wmget.call(store, it) || {}; | ||
}; | ||
has$1 = function (it) { | ||
return wmhas.call(store$1, it); | ||
has = function (it) { | ||
return wmhas.call(store, it); | ||
}; | ||
} else { | ||
var STATE = sharedKey('state'); | ||
hiddenKeys[STATE] = true; | ||
hiddenKeys$1[STATE] = true; | ||
@@ -541,7 +613,7 @@ set = function (it, metadata) { | ||
get = function (it) { | ||
return has(it, STATE) ? it[STATE] : {}; | ||
return has$1(it, STATE) ? it[STATE] : {}; | ||
}; | ||
has$1 = function (it) { | ||
return has(it, STATE); | ||
has = function (it) { | ||
return has$1(it, STATE); | ||
}; | ||
@@ -553,3 +625,3 @@ } | ||
get: get, | ||
has: has$1, | ||
has: has, | ||
enforce: enforce, | ||
@@ -570,3 +642,3 @@ getterFor: getterFor | ||
if (typeof value == 'function') { | ||
if (typeof key == 'string' && !has(value, 'name')) { | ||
if (typeof key == 'string' && !has$1(value, 'name')) { | ||
createNonEnumerableProperty(value, 'name', key); | ||
@@ -599,3 +671,3 @@ } | ||
var aFunction = function (variable) { | ||
var aFunction$1 = function (variable) { | ||
return typeof variable == 'function' ? variable : undefined; | ||
@@ -605,3 +677,3 @@ }; | ||
var getBuiltIn = function (namespace, method) { | ||
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global$1[namespace]) : path[namespace] && path[namespace][method] || global$1[namespace] && global$1[namespace][method]; | ||
return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global$1[namespace]) : path[namespace] && path[namespace][method] || global$1[namespace] && global$1[namespace][method]; | ||
}; | ||
@@ -617,11 +689,11 @@ | ||
var min = Math.min; // `ToLength` abstract operation | ||
var min$1 = Math.min; // `ToLength` abstract operation | ||
// https://tc39.es/ecma262/#sec-tolength | ||
var toLength = function (argument) { | ||
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
return argument > 0 ? min$1(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
}; | ||
var max = Math.max; | ||
var min$1 = Math.min; // Helper for a popular repeating case of the spec: | ||
var min = Math.min; // Helper for a popular repeating case of the spec: | ||
// Let integer be ? ToInteger(index). | ||
@@ -632,3 +704,3 @@ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). | ||
var integer = toInteger(index); | ||
return integer < 0 ? max(integer + length, 0) : min$1(integer, length); | ||
return integer < 0 ? max(integer + length, 0) : min(integer, length); | ||
}; | ||
@@ -645,6 +717,6 @@ | ||
var value; // Array#includes uses SameValueZero equality algorithm | ||
// eslint-disable-next-line no-self-compare | ||
// eslint-disable-next-line no-self-compare -- NaN check | ||
if (IS_INCLUDES && el != el) while (length > index) { | ||
value = O[index++]; // eslint-disable-next-line no-self-compare | ||
value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check | ||
@@ -678,6 +750,6 @@ if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not | ||
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys | ||
for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); // Don't enum bug & hidden keys | ||
while (names.length > i) if (has(O, key = names[i++])) { | ||
while (names.length > i) if (has$1(O, key = names[i++])) { | ||
~indexOf(result, key) || result.push(key); | ||
@@ -692,17 +764,17 @@ } | ||
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method | ||
var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method | ||
// https://tc39.es/ecma262/#sec-object.getownpropertynames | ||
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | ||
return objectKeysInternal(O, hiddenKeys$1); | ||
var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | ||
return objectKeysInternal(O, hiddenKeys); | ||
}; | ||
var objectGetOwnPropertyNames = { | ||
f: f$3 | ||
f: f$2 | ||
}; | ||
var f$4 = Object.getOwnPropertySymbols; | ||
var f$1 = Object.getOwnPropertySymbols; | ||
var objectGetOwnPropertySymbols = { | ||
f: f$4 | ||
f: f$1 | ||
}; | ||
@@ -726,3 +798,3 @@ | ||
var key = keys[i]; | ||
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); | ||
if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); | ||
} | ||
@@ -747,3 +819,3 @@ }; | ||
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; | ||
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; | ||
@@ -793,3 +865,3 @@ | ||
if (options.noTargetGet) { | ||
descriptor = getOwnPropertyDescriptor$1(target, key); | ||
descriptor = getOwnPropertyDescriptor(target, key); | ||
targetProperty = descriptor && descriptor.value; | ||
@@ -815,3 +887,3 @@ } else targetProperty = target[key]; | ||
var aFunction$1 = function (it) { | ||
var aFunction = function (it) { | ||
if (typeof it != 'function') { | ||
@@ -831,8 +903,8 @@ throw TypeError(String(it) + ' is not a function'); | ||
}); | ||
this.resolve = aFunction$1(resolve); | ||
this.reject = aFunction$1(reject); | ||
this.resolve = aFunction(resolve); | ||
this.reject = aFunction(reject); | ||
}; // 25.4.1.5 NewPromiseCapability(C) | ||
var f$5 = function (C) { | ||
var f = function (C) { | ||
return new PromiseCapability(C); | ||
@@ -842,3 +914,3 @@ }; | ||
var newPromiseCapability = { | ||
f: f$5 | ||
f: f | ||
}; | ||
@@ -860,11 +932,35 @@ | ||
var engineIsNode = classofRaw(global$1.process) == 'process'; | ||
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; | ||
var process = global$1.process; | ||
var versions = process && process.versions; | ||
var v8 = versions && versions.v8; | ||
var match, version; | ||
if (v8) { | ||
match = v8.split('.'); | ||
version = match[0] + match[1]; | ||
} else if (engineUserAgent) { | ||
match = engineUserAgent.match(/Edge\/(\d+)/); | ||
if (!match || match[1] >= 74) { | ||
match = engineUserAgent.match(/Chrome\/(\d+)/); | ||
if (match) version = match[1]; | ||
} | ||
} | ||
var engineV8Version = version && +version; | ||
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { | ||
// Chrome 38 Symbol has incorrect toString conversion | ||
// eslint-disable-next-line no-undef | ||
return !String(Symbol()); | ||
/* global Symbol -- required for testing */ | ||
return !Symbol.sham && ( // Chrome 38 Symbol has incorrect toString conversion | ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances | ||
engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); | ||
}); | ||
var useSymbolAsUid = nativeSymbol // eslint-disable-next-line no-undef | ||
&& !Symbol.sham // eslint-disable-next-line no-undef | ||
&& typeof Symbol.iterator == 'symbol'; | ||
var useSymbolAsUid = nativeSymbol | ||
/* global Symbol -- safe */ | ||
&& !Symbol.sham && typeof Symbol.iterator == 'symbol'; | ||
@@ -876,4 +972,8 @@ var WellKnownSymbolsStore = shared('wks'); | ||
var wellKnownSymbol = function (name) { | ||
if (!has(WellKnownSymbolsStore, name)) { | ||
if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { | ||
if (nativeSymbol && has$1(Symbol$1, name)) { | ||
WellKnownSymbolsStore[name] = Symbol$1[name]; | ||
} else { | ||
WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
} | ||
} | ||
@@ -886,7 +986,7 @@ | ||
var ITERATOR = wellKnownSymbol('iterator'); | ||
var ITERATOR$1 = wellKnownSymbol('iterator'); | ||
var ArrayPrototype = Array.prototype; // check on default Array iterator | ||
var isArrayIteratorMethod = function (it) { | ||
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR] === it); | ||
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$1] === it); | ||
}; | ||
@@ -898,3 +998,3 @@ | ||
var functionBindContext = function (fn, that, length) { | ||
aFunction$1(fn); | ||
aFunction(fn); | ||
if (that === undefined) return fn; | ||
@@ -931,8 +1031,8 @@ | ||
var TO_STRING_TAG = wellKnownSymbol('toStringTag'); | ||
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); | ||
var test = {}; | ||
test[TO_STRING_TAG] = 'z'; | ||
test[TO_STRING_TAG$1] = 'z'; | ||
var toStringTagSupport = String(test) === '[object z]'; | ||
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); // ES3 wrong here | ||
var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here | ||
@@ -955,3 +1055,3 @@ var CORRECT_ARGUMENTS = classofRaw(function () { | ||
return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case | ||
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag // builtinTag case | ||
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case | ||
: CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback | ||
@@ -961,6 +1061,6 @@ : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; | ||
var ITERATOR$1 = wellKnownSymbol('iterator'); | ||
var ITERATOR = wellKnownSymbol('iterator'); | ||
var getIteratorMethod = function (it) { | ||
if (it != undefined) return it[ITERATOR$1] || it['@@iterator'] || iterators[classof(it)]; | ||
if (it != undefined) return it[ITERATOR] || it['@@iterator'] || iterators[classof(it)]; | ||
}; | ||
@@ -1051,3 +1151,3 @@ | ||
var result = perform(function () { | ||
var promiseResolve = aFunction$1(C.resolve); | ||
var promiseResolve = aFunction(C.resolve); | ||
var values = []; | ||
@@ -1093,3 +1193,3 @@ var counter = 0; | ||
var collection = anObject(this); | ||
var remover = aFunction$1(collection['delete']); | ||
var remover = aFunction(collection['delete']); | ||
var allDeleted = true; | ||
@@ -1123,36 +1223,2 @@ var wasDeleted; | ||
function _classPrivateFieldGet(receiver, privateMap) { | ||
var descriptor = privateMap.get(receiver); | ||
if (!descriptor) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
if (descriptor.get) { | ||
return descriptor.get.call(receiver); | ||
} | ||
return descriptor.value; | ||
} | ||
function _classPrivateFieldSet(receiver, privateMap, value) { | ||
var descriptor = privateMap.get(receiver); | ||
if (!descriptor) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
if (descriptor.set) { | ||
descriptor.set.call(receiver, value); | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
descriptor.value = value; | ||
} | ||
return value; | ||
} | ||
var _paths = new WeakMap(); | ||
@@ -1159,0 +1225,0 @@ |
{ | ||
"name": "@logzio-node-toolbox/consul", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Consul easy use for json configs and service discovery", | ||
@@ -30,5 +30,5 @@ "main": "dist/index.cjs", | ||
"async-retry": "1.3.1", | ||
"consul": "0.39.0", | ||
"consul": "0.40.0", | ||
"deepmerge": "4.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77357
2135
+ Addedconsul@0.40.0(transitive)
- Removedconsul@0.39.0(transitive)
Updatedconsul@0.40.0