Socket
Socket
Sign inDemoInstall

configcat-common

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configcat-common - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

30

lib/AutoPollConfigService.js

@@ -73,9 +73,13 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.tryReadFromCache(0)];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() called.");
return [4 /*yield*/, this.tryReadFromCache(0)];
case 1:
p = _a.sent();
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - cache is empty, refreshing the cache.");
return [2 /*return*/, this.refreshLogic(true)];
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];

@@ -89,7 +93,10 @@ }

AutoPollConfigService.prototype.refreshConfigAsync = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshConfigAsync() called.");
return this.refreshLogic(true);
};
AutoPollConfigService.prototype.dispose = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() called.");
this.disposed = true;
if (this.timerId) {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() - clearing setTimeout.");
clearTimeout(this.timerId);

@@ -100,2 +107,3 @@ }

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -113,2 +121,3 @@ var cachedConfig, newConfig, weDontHaveCachedYetButHaveNew, weHaveBothButTheyDiffers;

weHaveBothButTheyDiffers = cachedConfig && newConfig && !ProjectConfig_1.ProjectConfig.equals(cachedConfig, newConfig);
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - weDontHaveCachedYetButHaveNew: ." + weDontHaveCachedYetButHaveNew + ". weHaveBothButTheyDiffers: " + weHaveBothButTheyDiffers + ".");
if (weDontHaveCachedYetButHaveNew || weHaveBothButTheyDiffers) {

@@ -125,3 +134,5 @@ this.configChanged();

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() called.");
this.refreshLogic(true).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() - calling refreshWorkerLogic()'s setTimeout.");
setTimeout(function () { return _this.refreshWorkerLogic(delay); }, delay);

@@ -133,5 +144,8 @@ });

if (this.disposed) {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called on a disposed client.");
return;
}
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called.");
this.refreshLogic(false).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - calling refreshWorkerLogic()'s setTimeout.");
_this.timerId = setTimeout(function () {

@@ -147,3 +161,5 @@ _this.refreshWorkerLogic(delay);

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - called. Tries: " + tries + ".");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -157,2 +173,8 @@ p = _a.sent();

|| p.Timestamp < new Date().getTime() - this.autoPollConfig.pollIntervalSeconds * 1000))) return [3 /*break*/, 3];
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is empty.");
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is expired.");
}
diff = this.maxInitWaitTimeStamp - new Date().getTime();

@@ -165,3 +187,5 @@ delay = 30 + (tries * tries * 20);

return [2 /*return*/, this.tryReadFromCache(tries)];
case 3: return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
case 3:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
}

@@ -168,0 +192,0 @@ });

@@ -73,9 +73,13 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.tryReadFromCache(0)];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() called.");
return [4 /*yield*/, this.tryReadFromCache(0)];
case 1:
p = _a.sent();
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - cache is empty, refreshing the cache.");
return [2 /*return*/, this.refreshLogic(true)];
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];

@@ -89,7 +93,10 @@ }

AutoPollConfigService.prototype.refreshConfigAsync = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshConfigAsync() called.");
return this.refreshLogic(true);
};
AutoPollConfigService.prototype.dispose = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() called.");
this.disposed = true;
if (this.timerId) {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() - clearing setTimeout.");
clearTimeout(this.timerId);

@@ -100,2 +107,3 @@ }

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -113,2 +121,3 @@ var cachedConfig, newConfig, weDontHaveCachedYetButHaveNew, weHaveBothButTheyDiffers;

weHaveBothButTheyDiffers = cachedConfig && newConfig && !ProjectConfig_1.ProjectConfig.equals(cachedConfig, newConfig);
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - weDontHaveCachedYetButHaveNew: ." + weDontHaveCachedYetButHaveNew + ". weHaveBothButTheyDiffers: " + weHaveBothButTheyDiffers + ".");
if (weDontHaveCachedYetButHaveNew || weHaveBothButTheyDiffers) {

@@ -125,3 +134,5 @@ this.configChanged();

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() called.");
this.refreshLogic(true).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() - calling refreshWorkerLogic()'s setTimeout.");
setTimeout(function () { return _this.refreshWorkerLogic(delay); }, delay);

@@ -133,5 +144,8 @@ });

if (this.disposed) {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called on a disposed client.");
return;
}
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called.");
this.refreshLogic(false).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - calling refreshWorkerLogic()'s setTimeout.");
_this.timerId = setTimeout(function () {

@@ -147,3 +161,5 @@ _this.refreshWorkerLogic(delay);

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - called. Tries: " + tries + ".");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -157,2 +173,8 @@ p = _a.sent();

|| p.Timestamp < new Date().getTime() - this.autoPollConfig.pollIntervalSeconds * 1000))) return [3 /*break*/, 3];
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is empty.");
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is expired.");
}
diff = this.maxInitWaitTimeStamp - new Date().getTime();

@@ -165,3 +187,5 @@ delay = 30 + (tries * tries * 20);

return [2 /*return*/, this.tryReadFromCache(tries)];
case 3: return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
case 3:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
}

@@ -168,0 +192,0 @@ });

@@ -66,2 +66,3 @@ "use strict";

this.options = options;
this.options.logger.debug('Initializing ConfigCatClient. Options: ' + JSON.stringify(this.options));
if (!configCatKernel) {

@@ -90,3 +91,5 @@ throw new Error("Invalid 'configCatKernel' value");

ConfigCatClient.prototype.dispose = function () {
this.options.logger.debug("dispose() called");
if (this.configService instanceof AutoPollConfigService_1.AutoPollConfigService) {
this.options.logger.debug("Disposing AutoPollConfigService");
this.configService.dispose();

@@ -96,2 +99,3 @@ }

ConfigCatClient.prototype.getValue = function (key, defaultValue, callback, user) {
this.options.logger.debug("getValue() called.");
this.getValueAsync(key, defaultValue, user).then(function (value) {

@@ -103,2 +107,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -124,2 +129,3 @@ var settings, result;

ConfigCatClient.prototype.forceRefresh = function (callback) {
this.options.logger.debug("forceRefresh() called.");
this.forceRefreshAsync().then(function () {

@@ -131,2 +137,3 @@ callback();

var _this = this;
this.options.logger.debug("forceRefreshAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -146,2 +153,3 @@ var _a;

ConfigCatClient.prototype.getAllKeys = function (callback) {
this.options.logger.debug("getAllKeys() called.");
this.getAllKeysAsync().then(function (value) {

@@ -153,2 +161,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllKeysAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -173,2 +182,3 @@ var settings;

ConfigCatClient.prototype.getVariationId = function (key, defaultVariationId, callback, user) {
this.options.logger.debug("getVariationId() called.");
this.getVariationIdAsync(key, defaultVariationId, user).then(function (variationId) {

@@ -180,2 +190,3 @@ callback(variationId);

var _this = this;
this.options.logger.debug("getVariationIdAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -201,2 +212,3 @@ var settings, result;

ConfigCatClient.prototype.getAllVariationIds = function (callback, user) {
this.options.logger.debug("getAllVariationIds() called.");
this.getAllVariationIdsAsync(user).then(function (variationIds) {

@@ -208,2 +220,3 @@ callback(variationIds);

var _this = this;
this.options.logger.debug("getAllVariationIdsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -232,2 +245,3 @@ var keys, promises, variationIds;

ConfigCatClient.prototype.getKeyAndValue = function (variationId, callback) {
this.options.logger.debug("getKeyAndValue() called.");
this.getKeyAndValueAsync(variationId).then(function (settingKeyAndValue) {

@@ -239,2 +253,3 @@ callback(settingKeyAndValue);

var _this = this;
this.options.logger.debug("getKeyAndValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -286,2 +301,3 @@ var settings, settingKey, rolloutRules, i, rolloutRule, percentageItems, i, percentageItem;

ConfigCatClient.prototype.getAllValues = function (callback, user) {
this.options.logger.debug("getAllValues() called.");
this.getAllValuesAsync(user).then(function (value) {

@@ -293,2 +309,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllValuesAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -323,2 +340,3 @@ var settings, keys, result;

var _this = this;
this.options.logger.debug("getSettingsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -325,0 +343,0 @@ var localSettings, remoteConfig, remoteSettings, config;

@@ -51,2 +51,3 @@ "use strict";

if (forceUpdateCache === void 0) { forceUpdateCache = true; }
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - called.");
return new Promise(function (resolve) {

@@ -59,2 +60,3 @@ var _a;

if (!(newConfig && newConfig.ConfigJSON)) return [3 /*break*/, 2];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() success, returning config.");
return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), newConfig)];

@@ -67,2 +69,3 @@ case 1:

if (!(forceUpdateCache && lastProjectConfig && lastProjectConfig.ConfigJSON)) return [3 /*break*/, 4];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, setting the cache with last config with new timestamp, returning last config.");
lastProjectConfig.Timestamp = new Date().getTime();

@@ -75,2 +78,3 @@ return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), lastProjectConfig)];

case 4:
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, returing last config.");
resolve(lastProjectConfig);

@@ -86,5 +90,8 @@ _a.label = 5;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic() - called.");
var calledBaseUrl = this.baseConfig.baseUrl;
this.fetchLogicInternal(this.baseConfig, lastEtag, retries, function (result) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status: " + result.status);
if (result.status != index_1.FetchStatus.Fetched || ProjectConfig_1.ProjectConfig.compareEtags(lastEtag !== null && lastEtag !== void 0 ? lastEtag : '', result.eTag)) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status != FetchStatus.Fetched or etags are the same. Returning null.");
callback(null);

@@ -94,2 +101,3 @@ return;

if (!result.responseBody) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): no response body. Returning null.");
callback(null);

@@ -101,2 +109,3 @@ return;

if (!preferences) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): preferences is empty. Returning newConfig.");
callback(newConfig);

@@ -108,2 +117,3 @@ return;

if (!baseUrl || baseUrl == calledBaseUrl) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): baseUrl OK. Returning newConfig.");
callback(newConfig);

@@ -116,2 +126,3 @@ return;

if (options.baseUrlOverriden && redirect !== 2) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): options.baseUrlOverriden && redirect !== 2.");
callback(newConfig);

@@ -142,2 +153,3 @@ return;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): called.");
if (retries === 0) { // Only lock on the top-level calls, not on the recursive calls (config.json redirections).

@@ -147,8 +159,12 @@ this.fetchLogicCallbacks.push(callback);

// The first fetchLogic call is already in progress.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): The first fetchLogic call is already in progress. this.fetchLogicCallbacks.length = " + this.fetchLogicCallbacks.length);
return;
}
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): Calling fetchLogic");
this.configFetcher.fetchLogic(options, lastEtag, function (newProjectConfig) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callbacks. this.fetchLogicCallbacks.length = " + _this.fetchLogicCallbacks.length);
while (_this.fetchLogicCallbacks.length) {
var thisCallback = _this.fetchLogicCallbacks.pop();
if (thisCallback) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callback.");
thisCallback(newProjectConfig);

@@ -161,2 +177,3 @@ }

// Recursive calls should call the fetchLogic as is.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): calling fetchLogic(), recursive call. retries = " + retries);
this.configFetcher.fetchLogic(options, lastEtag, callback);

@@ -163,0 +180,0 @@ }

10

lib/cjs/LazyLoadConfigService.js

@@ -68,9 +68,13 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:
p = _a.sent();
if (p && p.Timestamp + (this.cacheTimeToLiveSeconds * 1000) > new Date().getTime()) {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache.");
return [2 /*return*/, p];
}
else {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is empty or expired, calling refreshLogicBaseAsync().");
return [2 /*return*/, this.refreshLogicBaseAsync(p)];

@@ -88,3 +92,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -91,0 +97,0 @@ p = _a.sent();

@@ -65,3 +65,5 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1: return [2 /*return*/, _a.sent()];

@@ -77,3 +79,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -80,0 +84,0 @@ p = _a.sent();

@@ -25,2 +25,3 @@ "use strict";

RolloutEvaluator.prototype.Evaluate = function (settings, key, defaultValue, user, defaultVariationId) {
this.logger.debug("RolloutEvaluator.Evaluate() called.");
if (!settings[key]) {

@@ -71,2 +72,3 @@ var s = "Evaluating getValue('" + key + "') failed. Returning default value: '" + defaultValue + "'.";

RolloutEvaluator.prototype.EvaluateRules = function (rolloutRules, user, eLog) {
this.logger.debug("RolloutEvaluator.EvaluateRules() called.");
var result = new EvaluateResult();

@@ -239,2 +241,3 @@ result.ValueAndVariationId = null;

RolloutEvaluator.prototype.EvaluateVariations = function (rolloutPercentageItems, key, user) {
this.logger.debug("RolloutEvaluator.EvaluateVariations() called.");
if (rolloutPercentageItems && rolloutPercentageItems.length > 0) {

@@ -259,2 +262,3 @@ var hashCandidate = key + ((user.identifier === null || user.identifier === undefined) ? '' : user.identifier);

RolloutEvaluator.prototype.EvaluateNumber = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateNumber() called.");
var n1, n2;

@@ -292,2 +296,3 @@ if (v1 && !Number.isNaN(Number.parseFloat(v1.replace(',', '.')))) {

RolloutEvaluator.prototype.EvaluateSemver = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateSemver() called.");
if (semver.valid(v1) == null || (0, Utils_1.isUndefined)(v2)) {

@@ -294,0 +299,0 @@ return false;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "5.0.1";
exports.default = "5.0.2";

@@ -66,2 +66,3 @@ "use strict";

this.options = options;
this.options.logger.debug('Initializing ConfigCatClient. Options: ' + JSON.stringify(this.options));
if (!configCatKernel) {

@@ -90,3 +91,5 @@ throw new Error("Invalid 'configCatKernel' value");

ConfigCatClient.prototype.dispose = function () {
this.options.logger.debug("dispose() called");
if (this.configService instanceof AutoPollConfigService_1.AutoPollConfigService) {
this.options.logger.debug("Disposing AutoPollConfigService");
this.configService.dispose();

@@ -96,2 +99,3 @@ }

ConfigCatClient.prototype.getValue = function (key, defaultValue, callback, user) {
this.options.logger.debug("getValue() called.");
this.getValueAsync(key, defaultValue, user).then(function (value) {

@@ -103,2 +107,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -124,2 +129,3 @@ var settings, result;

ConfigCatClient.prototype.forceRefresh = function (callback) {
this.options.logger.debug("forceRefresh() called.");
this.forceRefreshAsync().then(function () {

@@ -131,2 +137,3 @@ callback();

var _this = this;
this.options.logger.debug("forceRefreshAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -146,2 +153,3 @@ var _a;

ConfigCatClient.prototype.getAllKeys = function (callback) {
this.options.logger.debug("getAllKeys() called.");
this.getAllKeysAsync().then(function (value) {

@@ -153,2 +161,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllKeysAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -173,2 +182,3 @@ var settings;

ConfigCatClient.prototype.getVariationId = function (key, defaultVariationId, callback, user) {
this.options.logger.debug("getVariationId() called.");
this.getVariationIdAsync(key, defaultVariationId, user).then(function (variationId) {

@@ -180,2 +190,3 @@ callback(variationId);

var _this = this;
this.options.logger.debug("getVariationIdAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -201,2 +212,3 @@ var settings, result;

ConfigCatClient.prototype.getAllVariationIds = function (callback, user) {
this.options.logger.debug("getAllVariationIds() called.");
this.getAllVariationIdsAsync(user).then(function (variationIds) {

@@ -208,2 +220,3 @@ callback(variationIds);

var _this = this;
this.options.logger.debug("getAllVariationIdsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -232,2 +245,3 @@ var keys, promises, variationIds;

ConfigCatClient.prototype.getKeyAndValue = function (variationId, callback) {
this.options.logger.debug("getKeyAndValue() called.");
this.getKeyAndValueAsync(variationId).then(function (settingKeyAndValue) {

@@ -239,2 +253,3 @@ callback(settingKeyAndValue);

var _this = this;
this.options.logger.debug("getKeyAndValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -286,2 +301,3 @@ var settings, settingKey, rolloutRules, i, rolloutRule, percentageItems, i, percentageItem;

ConfigCatClient.prototype.getAllValues = function (callback, user) {
this.options.logger.debug("getAllValues() called.");
this.getAllValuesAsync(user).then(function (value) {

@@ -293,2 +309,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllValuesAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -323,2 +340,3 @@ var settings, keys, result;

var _this = this;
this.options.logger.debug("getSettingsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -325,0 +343,0 @@ var localSettings, remoteConfig, remoteSettings, config;

@@ -51,2 +51,3 @@ "use strict";

if (forceUpdateCache === void 0) { forceUpdateCache = true; }
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - called.");
return new Promise(function (resolve) {

@@ -59,2 +60,3 @@ var _a;

if (!(newConfig && newConfig.ConfigJSON)) return [3 /*break*/, 2];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() success, returning config.");
return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), newConfig)];

@@ -67,2 +69,3 @@ case 1:

if (!(forceUpdateCache && lastProjectConfig && lastProjectConfig.ConfigJSON)) return [3 /*break*/, 4];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, setting the cache with last config with new timestamp, returning last config.");
lastProjectConfig.Timestamp = new Date().getTime();

@@ -75,2 +78,3 @@ return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), lastProjectConfig)];

case 4:
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, returing last config.");
resolve(lastProjectConfig);

@@ -86,5 +90,8 @@ _a.label = 5;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic() - called.");
var calledBaseUrl = this.baseConfig.baseUrl;
this.fetchLogicInternal(this.baseConfig, lastEtag, retries, function (result) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status: " + result.status);
if (result.status != index_1.FetchStatus.Fetched || ProjectConfig_1.ProjectConfig.compareEtags(lastEtag !== null && lastEtag !== void 0 ? lastEtag : '', result.eTag)) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status != FetchStatus.Fetched or etags are the same. Returning null.");
callback(null);

@@ -94,2 +101,3 @@ return;

if (!result.responseBody) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): no response body. Returning null.");
callback(null);

@@ -101,2 +109,3 @@ return;

if (!preferences) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): preferences is empty. Returning newConfig.");
callback(newConfig);

@@ -108,2 +117,3 @@ return;

if (!baseUrl || baseUrl == calledBaseUrl) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): baseUrl OK. Returning newConfig.");
callback(newConfig);

@@ -116,2 +126,3 @@ return;

if (options.baseUrlOverriden && redirect !== 2) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): options.baseUrlOverriden && redirect !== 2.");
callback(newConfig);

@@ -142,2 +153,3 @@ return;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): called.");
if (retries === 0) { // Only lock on the top-level calls, not on the recursive calls (config.json redirections).

@@ -147,8 +159,12 @@ this.fetchLogicCallbacks.push(callback);

// The first fetchLogic call is already in progress.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): The first fetchLogic call is already in progress. this.fetchLogicCallbacks.length = " + this.fetchLogicCallbacks.length);
return;
}
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): Calling fetchLogic");
this.configFetcher.fetchLogic(options, lastEtag, function (newProjectConfig) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callbacks. this.fetchLogicCallbacks.length = " + _this.fetchLogicCallbacks.length);
while (_this.fetchLogicCallbacks.length) {
var thisCallback = _this.fetchLogicCallbacks.pop();
if (thisCallback) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callback.");
thisCallback(newProjectConfig);

@@ -161,2 +177,3 @@ }

// Recursive calls should call the fetchLogic as is.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): calling fetchLogic(), recursive call. retries = " + retries);
this.configFetcher.fetchLogic(options, lastEtag, callback);

@@ -163,0 +180,0 @@ }

@@ -70,9 +70,13 @@ var __extends = (this && this.__extends) || (function () {

switch (_a.label) {
case 0: return [4 /*yield*/, this.tryReadFromCache(0)];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() called.");
return [4 /*yield*/, this.tryReadFromCache(0)];
case 1:
p = _a.sent();
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - cache is empty, refreshing the cache.");
return [2 /*return*/, this.refreshLogic(true)];
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.getConfig() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];

@@ -86,7 +90,10 @@ }

AutoPollConfigService.prototype.refreshConfigAsync = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshConfigAsync() called.");
return this.refreshLogic(true);
};
AutoPollConfigService.prototype.dispose = function () {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() called.");
this.disposed = true;
if (this.timerId) {
this.autoPollConfig.logger.debug("AutoPollConfigService.dispose() - clearing setTimeout.");
clearTimeout(this.timerId);

@@ -97,2 +104,3 @@ }

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -110,2 +118,3 @@ var cachedConfig, newConfig, weDontHaveCachedYetButHaveNew, weHaveBothButTheyDiffers;

weHaveBothButTheyDiffers = cachedConfig && newConfig && !ProjectConfig.equals(cachedConfig, newConfig);
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshLogic() - weDontHaveCachedYetButHaveNew: ." + weDontHaveCachedYetButHaveNew + ". weHaveBothButTheyDiffers: " + weHaveBothButTheyDiffers + ".");
if (weDontHaveCachedYetButHaveNew || weHaveBothButTheyDiffers) {

@@ -122,3 +131,5 @@ this.configChanged();

var _this = this;
this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() called.");
this.refreshLogic(true).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.startRefreshWorker() - calling refreshWorkerLogic()'s setTimeout.");
setTimeout(function () { return _this.refreshWorkerLogic(delay); }, delay);

@@ -130,5 +141,8 @@ });

if (this.disposed) {
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called on a disposed client.");
return;
}
this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called.");
this.refreshLogic(false).then(function (_) {
_this.autoPollConfig.logger.debug("AutoPollConfigService.refreshWorkerLogic() - calling refreshWorkerLogic()'s setTimeout.");
_this.timerId = setTimeout(function () {

@@ -144,3 +158,5 @@ _this.refreshWorkerLogic(delay);

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - called. Tries: " + tries + ".");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -154,2 +170,8 @@ p = _a.sent();

|| p.Timestamp < new Date().getTime() - this.autoPollConfig.pollIntervalSeconds * 1000))) return [3 /*break*/, 3];
if (!p) {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is empty.");
}
else {
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - waiting for maxInitWaitTimeStamp because cache is expired.");
}
diff = this.maxInitWaitTimeStamp - new Date().getTime();

@@ -162,3 +184,5 @@ delay = 30 + (tries * tries * 20);

return [2 /*return*/, this.tryReadFromCache(tries)];
case 3: return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
case 3:
this.autoPollConfig.logger.debug("AutoPollConfigService.tryReadFromCache() - returning value from cache.");
return [2 /*return*/, new Promise(function (resolve) { return resolve(p); })];
}

@@ -165,0 +189,0 @@ });

@@ -63,2 +63,3 @@ var __assign = (this && this.__assign) || function () {

this.options = options;
this.options.logger.debug('Initializing ConfigCatClient. Options: ' + JSON.stringify(this.options));
if (!configCatKernel) {

@@ -87,3 +88,5 @@ throw new Error("Invalid 'configCatKernel' value");

ConfigCatClient.prototype.dispose = function () {
this.options.logger.debug("dispose() called");
if (this.configService instanceof AutoPollConfigService) {
this.options.logger.debug("Disposing AutoPollConfigService");
this.configService.dispose();

@@ -93,2 +96,3 @@ }

ConfigCatClient.prototype.getValue = function (key, defaultValue, callback, user) {
this.options.logger.debug("getValue() called.");
this.getValueAsync(key, defaultValue, user).then(function (value) {

@@ -100,2 +104,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -121,2 +126,3 @@ var settings, result;

ConfigCatClient.prototype.forceRefresh = function (callback) {
this.options.logger.debug("forceRefresh() called.");
this.forceRefreshAsync().then(function () {

@@ -128,2 +134,3 @@ callback();

var _this = this;
this.options.logger.debug("forceRefreshAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -143,2 +150,3 @@ var _a;

ConfigCatClient.prototype.getAllKeys = function (callback) {
this.options.logger.debug("getAllKeys() called.");
this.getAllKeysAsync().then(function (value) {

@@ -150,2 +158,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllKeysAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -170,2 +179,3 @@ var settings;

ConfigCatClient.prototype.getVariationId = function (key, defaultVariationId, callback, user) {
this.options.logger.debug("getVariationId() called.");
this.getVariationIdAsync(key, defaultVariationId, user).then(function (variationId) {

@@ -177,2 +187,3 @@ callback(variationId);

var _this = this;
this.options.logger.debug("getVariationIdAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -198,2 +209,3 @@ var settings, result;

ConfigCatClient.prototype.getAllVariationIds = function (callback, user) {
this.options.logger.debug("getAllVariationIds() called.");
this.getAllVariationIdsAsync(user).then(function (variationIds) {

@@ -205,2 +217,3 @@ callback(variationIds);

var _this = this;
this.options.logger.debug("getAllVariationIdsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -229,2 +242,3 @@ var keys, promises, variationIds;

ConfigCatClient.prototype.getKeyAndValue = function (variationId, callback) {
this.options.logger.debug("getKeyAndValue() called.");
this.getKeyAndValueAsync(variationId).then(function (settingKeyAndValue) {

@@ -236,2 +250,3 @@ callback(settingKeyAndValue);

var _this = this;
this.options.logger.debug("getKeyAndValueAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -283,2 +298,3 @@ var settings, settingKey, rolloutRules, i, rolloutRule, percentageItems, i, percentageItem;

ConfigCatClient.prototype.getAllValues = function (callback, user) {
this.options.logger.debug("getAllValues() called.");
this.getAllValuesAsync(user).then(function (value) {

@@ -290,2 +306,3 @@ callback(value);

var _this = this;
this.options.logger.debug("getAllValuesAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -320,2 +337,3 @@ var settings, keys, result;

var _this = this;
this.options.logger.debug("getSettingsAsync() called.");
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {

@@ -322,0 +340,0 @@ var localSettings, remoteConfig, remoteSettings, config;

@@ -48,2 +48,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (forceUpdateCache === void 0) { forceUpdateCache = true; }
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - called.");
return new Promise(function (resolve) {

@@ -56,2 +57,3 @@ var _a;

if (!(newConfig && newConfig.ConfigJSON)) return [3 /*break*/, 2];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() success, returning config.");
return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), newConfig)];

@@ -64,2 +66,3 @@ case 1:

if (!(forceUpdateCache && lastProjectConfig && lastProjectConfig.ConfigJSON)) return [3 /*break*/, 4];
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, setting the cache with last config with new timestamp, returning last config.");
lastProjectConfig.Timestamp = new Date().getTime();

@@ -72,2 +75,3 @@ return [4 /*yield*/, this.baseConfig.cache.set(this.baseConfig.getCacheKey(), lastProjectConfig)];

case 4:
this.baseConfig.logger.debug("ConfigServiceBase.refreshLogicBaseAsync() - fetchLogic() didn't return a config, returing last config.");
resolve(lastProjectConfig);

@@ -83,5 +87,8 @@ _a.label = 5;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic() - called.");
var calledBaseUrl = this.baseConfig.baseUrl;
this.fetchLogicInternal(this.baseConfig, lastEtag, retries, function (result) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status: " + result.status);
if (result.status != FetchStatus.Fetched || ProjectConfig.compareEtags(lastEtag !== null && lastEtag !== void 0 ? lastEtag : '', result.eTag)) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): result.status != FetchStatus.Fetched or etags are the same. Returning null.");
callback(null);

@@ -91,2 +98,3 @@ return;

if (!result.responseBody) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): no response body. Returning null.");
callback(null);

@@ -98,2 +106,3 @@ return;

if (!preferences) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): preferences is empty. Returning newConfig.");
callback(newConfig);

@@ -105,2 +114,3 @@ return;

if (!baseUrl || baseUrl == calledBaseUrl) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): baseUrl OK. Returning newConfig.");
callback(newConfig);

@@ -113,2 +123,3 @@ return;

if (options.baseUrlOverriden && redirect !== 2) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogic(): options.baseUrlOverriden && redirect !== 2.");
callback(newConfig);

@@ -139,2 +150,3 @@ return;

var _this = this;
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): called.");
if (retries === 0) { // Only lock on the top-level calls, not on the recursive calls (config.json redirections).

@@ -144,8 +156,12 @@ this.fetchLogicCallbacks.push(callback);

// The first fetchLogic call is already in progress.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): The first fetchLogic call is already in progress. this.fetchLogicCallbacks.length = " + this.fetchLogicCallbacks.length);
return;
}
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): Calling fetchLogic");
this.configFetcher.fetchLogic(options, lastEtag, function (newProjectConfig) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callbacks. this.fetchLogicCallbacks.length = " + _this.fetchLogicCallbacks.length);
while (_this.fetchLogicCallbacks.length) {
var thisCallback = _this.fetchLogicCallbacks.pop();
if (thisCallback) {
_this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): fetchLogic() success, calling callback.");
thisCallback(newProjectConfig);

@@ -158,2 +174,3 @@ }

// Recursive calls should call the fetchLogic as is.
this.baseConfig.logger.debug("ConfigServiceBase.fetchLogicInternal(): calling fetchLogic(), recursive call. retries = " + retries);
this.configFetcher.fetchLogic(options, lastEtag, callback);

@@ -160,0 +177,0 @@ }

@@ -65,9 +65,13 @@ var __extends = (this && this.__extends) || (function () {

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:
p = _a.sent();
if (p && p.Timestamp + (this.cacheTimeToLiveSeconds * 1000) > new Date().getTime()) {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache.");
return [2 /*return*/, p];
}
else {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is empty or expired, calling refreshLogicBaseAsync().");
return [2 /*return*/, this.refreshLogicBaseAsync(p)];

@@ -85,3 +89,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -88,0 +94,0 @@ p = _a.sent();

@@ -62,3 +62,5 @@ var __extends = (this && this.__extends) || (function () {

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1: return [2 /*return*/, _a.sent()];

@@ -74,3 +76,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -77,0 +81,0 @@ p = _a.sent();

@@ -22,2 +22,3 @@ import { sha1 } from "./Sha1";

RolloutEvaluator.prototype.Evaluate = function (settings, key, defaultValue, user, defaultVariationId) {
this.logger.debug("RolloutEvaluator.Evaluate() called.");
if (!settings[key]) {

@@ -68,2 +69,3 @@ var s = "Evaluating getValue('" + key + "') failed. Returning default value: '" + defaultValue + "'.";

RolloutEvaluator.prototype.EvaluateRules = function (rolloutRules, user, eLog) {
this.logger.debug("RolloutEvaluator.EvaluateRules() called.");
var result = new EvaluateResult();

@@ -236,2 +238,3 @@ result.ValueAndVariationId = null;

RolloutEvaluator.prototype.EvaluateVariations = function (rolloutPercentageItems, key, user) {
this.logger.debug("RolloutEvaluator.EvaluateVariations() called.");
if (rolloutPercentageItems && rolloutPercentageItems.length > 0) {

@@ -256,2 +259,3 @@ var hashCandidate = key + ((user.identifier === null || user.identifier === undefined) ? '' : user.identifier);

RolloutEvaluator.prototype.EvaluateNumber = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateNumber() called.");
var n1, n2;

@@ -289,2 +293,3 @@ if (v1 && !Number.isNaN(Number.parseFloat(v1.replace(',', '.')))) {

RolloutEvaluator.prototype.EvaluateSemver = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateSemver() called.");
if (semver.valid(v1) == null || isUndefined(v2)) {

@@ -291,0 +296,0 @@ return false;

@@ -1,1 +0,1 @@

export default "5.0.1";
export default "5.0.2";

@@ -68,9 +68,13 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:
p = _a.sent();
if (p && p.Timestamp + (this.cacheTimeToLiveSeconds * 1000) > new Date().getTime()) {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache.");
return [2 /*return*/, p];
}
else {
this.baseConfig.logger.debug("LazyLoadConfigService.getConfig(): cache is empty or expired, calling refreshLogicBaseAsync().");
return [2 /*return*/, this.refreshLogicBaseAsync(p)];

@@ -88,3 +92,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("LazyLoadConfigService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -91,0 +97,0 @@ p = _a.sent();

@@ -65,3 +65,5 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.getConfig() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1: return [2 /*return*/, _a.sent()];

@@ -77,3 +79,5 @@ }

switch (_a.label) {
case 0: return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 0:
this.baseConfig.logger.debug("ManualPollService.refreshConfigAsync() called.");
return [4 /*yield*/, this.baseConfig.cache.get(this.baseConfig.getCacheKey())];
case 1:

@@ -80,0 +84,0 @@ p = _a.sent();

@@ -25,2 +25,3 @@ "use strict";

RolloutEvaluator.prototype.Evaluate = function (settings, key, defaultValue, user, defaultVariationId) {
this.logger.debug("RolloutEvaluator.Evaluate() called.");
if (!settings[key]) {

@@ -71,2 +72,3 @@ var s = "Evaluating getValue('" + key + "') failed. Returning default value: '" + defaultValue + "'.";

RolloutEvaluator.prototype.EvaluateRules = function (rolloutRules, user, eLog) {
this.logger.debug("RolloutEvaluator.EvaluateRules() called.");
var result = new EvaluateResult();

@@ -239,2 +241,3 @@ result.ValueAndVariationId = null;

RolloutEvaluator.prototype.EvaluateVariations = function (rolloutPercentageItems, key, user) {
this.logger.debug("RolloutEvaluator.EvaluateVariations() called.");
if (rolloutPercentageItems && rolloutPercentageItems.length > 0) {

@@ -259,2 +262,3 @@ var hashCandidate = key + ((user.identifier === null || user.identifier === undefined) ? '' : user.identifier);

RolloutEvaluator.prototype.EvaluateNumber = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateNumber() called.");
var n1, n2;

@@ -292,2 +296,3 @@ if (v1 && !Number.isNaN(Number.parseFloat(v1.replace(',', '.')))) {

RolloutEvaluator.prototype.EvaluateSemver = function (v1, v2, comparator) {
this.logger.debug("RolloutEvaluator.EvaluateSemver() called.");
if (semver.valid(v1) == null || (0, Utils_1.isUndefined)(v2)) {

@@ -294,0 +299,0 @@ return false;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "5.0.1";
exports.default = "5.0.2";
{
"name": "configcat-common",
"version": "5.0.1",
"version": "5.0.2",
"description": "ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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

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

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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc