configcat-common
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -35,2 +35,7 @@ import { IConfigCatKernel } from "./index"; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
/** Sets the default user for feature flag evaluations. | ||
* In case the getValue function isn't called with a UserObject, this default user will be used instead. */ | ||
setDefaultUser(defaultUser: User): void; | ||
/** Clears the default user. */ | ||
clearDefaultUser(): void; | ||
} | ||
@@ -41,2 +46,3 @@ export declare class ConfigCatClient implements IConfigCatClient { | ||
private options; | ||
private defaultUser?; | ||
constructor(options: AutoPollOptions | ManualPollOptions | LazyLoadOptions, configCatKernel: IConfigCatKernel); | ||
@@ -58,2 +64,4 @@ dispose(): void; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
setDefaultUser(defaultUser: User): void; | ||
clearDefaultUser(): void; | ||
private getSettingsAsync; | ||
@@ -60,0 +68,0 @@ } |
@@ -73,2 +73,5 @@ "use strict"; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.defaultUser) { | ||
this.setDefaultUser(options.defaultUser); | ||
} | ||
this.evaluator = new RolloutEvaluator_1.RolloutEvaluator(options.logger); | ||
@@ -118,3 +121,3 @@ if (((_a = options === null || options === void 0 ? void 0 : options.flagOverrides) === null || _a === void 0 ? void 0 : _a.behaviour) != FlagOverrides_1.OverrideBehaviour.LocalOnly) { | ||
} | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user).Value; | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user !== null && user !== void 0 ? user : this.defaultUser).Value; | ||
resolve(result); | ||
@@ -196,3 +199,3 @@ return [2 /*return*/]; | ||
} | ||
result = this.evaluator.Evaluate(settings, key, null, user, defaultVariationId).VariationId; | ||
result = this.evaluator.Evaluate(settings, key, null, user !== null && user !== void 0 ? user : this.defaultUser, defaultVariationId).VariationId; | ||
resolve(result); | ||
@@ -316,3 +319,3 @@ return [2 /*return*/]; | ||
settingKey: key, | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user).Value | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user !== null && user !== void 0 ? user : _this.defaultUser).Value | ||
}); | ||
@@ -326,2 +329,8 @@ }); | ||
}; | ||
ConfigCatClient.prototype.setDefaultUser = function (defaultUser) { | ||
this.defaultUser = defaultUser; | ||
}; | ||
ConfigCatClient.prototype.clearDefaultUser = function () { | ||
this.defaultUser = undefined; | ||
}; | ||
ConfigCatClient.prototype.getSettingsAsync = function () { | ||
@@ -332,5 +341,5 @@ var _this = this; | ||
var localSettings, remoteConfig, remoteSettings, config; | ||
var _a, _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var _a, _b, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -340,3 +349,3 @@ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.flagOverrides)) return [3 /*break*/, 3]; | ||
case 1: | ||
localSettings = _e.sent(); | ||
localSettings = _d.sent(); | ||
if (this.options.flagOverrides.behaviour == FlagOverrides_1.OverrideBehaviour.LocalOnly) { | ||
@@ -348,4 +357,4 @@ resolve(localSettings); | ||
case 2: | ||
remoteConfig = _e.sent(); | ||
remoteSettings = (0, Utils_1.getSettingsFromConfig)((_c = remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON) !== null && _c !== void 0 ? _c : {}); | ||
remoteConfig = _d.sent(); | ||
remoteSettings = (0, Utils_1.getSettingsFromConfig)(remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON); | ||
if (this.options.flagOverrides.behaviour == FlagOverrides_1.OverrideBehaviour.LocalOverRemote) { | ||
@@ -359,6 +368,6 @@ resolve(__assign(__assign({}, remoteSettings), localSettings)); | ||
} | ||
_e.label = 3; | ||
case 3: return [4 /*yield*/, ((_d = this.configService) === null || _d === void 0 ? void 0 : _d.getConfig())]; | ||
_d.label = 3; | ||
case 3: return [4 /*yield*/, ((_c = this.configService) === null || _c === void 0 ? void 0 : _c.getConfig())]; | ||
case 4: | ||
config = _e.sent(); | ||
config = _d.sent(); | ||
if (!config || !config.ConfigJSON || !config.ConfigJSON[ProjectConfig_1.ConfigFile.FeatureFlags]) { | ||
@@ -365,0 +374,0 @@ resolve(null); |
@@ -1,2 +0,2 @@ | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache } from "./index"; | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache, User } from "./index"; | ||
import { FlagOverrides } from "./FlagOverrides"; | ||
@@ -24,2 +24,7 @@ /** Control the location of the config.json files containing your feature flags and settings within the ConfigCat CDN. */ | ||
flagOverrides?: FlagOverrides | null; | ||
/** | ||
* The default user, used as fallback when there's no user parameter is passed to the | ||
* ConfigCatClient.getValue, ConfigCatClient.getValueAsync, getVariationId, getVariationIdAsync, getAllValues, getAllValuesAsync, etc. methods. | ||
*/ | ||
defaultUser?: User | null; | ||
} | ||
@@ -38,2 +43,3 @@ export declare abstract class OptionsBase implements IOptions { | ||
flagOverrides?: FlagOverrides; | ||
defaultUser?: User | null; | ||
constructor(apiKey: string, clientVersion: string, options?: IOptions | null, defaultCache?: ICache | null); | ||
@@ -40,0 +46,0 @@ getUrl(): string; |
@@ -79,2 +79,5 @@ "use strict"; | ||
} | ||
if (options.defaultUser) { | ||
this.defaultUser = options.defaultUser; | ||
} | ||
} | ||
@@ -81,0 +84,0 @@ } |
@@ -89,4 +89,4 @@ "use strict"; | ||
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: " + (result === null || result === void 0 ? void 0 : result.status)); | ||
if (!result || 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."); | ||
@@ -93,0 +93,0 @@ callback(null); |
@@ -85,6 +85,7 @@ import { IConfigCatClient } from "./ConfigCatClient"; | ||
export { ProjectConfig } from "./ProjectConfig"; | ||
export { IConfigCatClient } from "./ConfigCatClient"; | ||
export type { IConfigCatClient } from "./ConfigCatClient"; | ||
export { OptionsBase, DataGovernance } from "./ConfigCatClientOptions"; | ||
export { User } from "./RolloutEvaluator"; | ||
export { IOverrideDataSource, FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
export type { IOverrideDataSource } from "./FlagOverrides"; | ||
export { FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -78,8 +78,10 @@ "use strict"; | ||
var comparisonAttribute = this_1.GetUserAttribute(user, rule.comparisonAttribute); | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
if (!comparisonAttribute) { | ||
log += "NO MATCH (Attribute is not defined on the user object)"; | ||
eLog.OpAppendLine(log); | ||
return "continue"; | ||
} | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
switch (comparator) { | ||
@@ -86,0 +88,0 @@ case 0: // is one of |
@@ -8,2 +8,5 @@ "use strict"; | ||
function getSettingsFromConfig(json) { | ||
if (!json) { | ||
return {}; | ||
} | ||
return Object.fromEntries(Object.entries(json[ProjectConfig_1.ConfigFile.FeatureFlags]).map(function (_a) { | ||
@@ -10,0 +13,0 @@ var key = _a[0], value = _a[1]; |
@@ -35,2 +35,7 @@ import { IConfigCatKernel } from "./index"; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
/** Sets the default user for feature flag evaluations. | ||
* In case the getValue function isn't called with a UserObject, this default user will be used instead. */ | ||
setDefaultUser(defaultUser: User): void; | ||
/** Clears the default user. */ | ||
clearDefaultUser(): void; | ||
} | ||
@@ -41,2 +46,3 @@ export declare class ConfigCatClient implements IConfigCatClient { | ||
private options; | ||
private defaultUser?; | ||
constructor(options: AutoPollOptions | ManualPollOptions | LazyLoadOptions, configCatKernel: IConfigCatKernel); | ||
@@ -58,2 +64,4 @@ dispose(): void; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
setDefaultUser(defaultUser: User): void; | ||
clearDefaultUser(): void; | ||
private getSettingsAsync; | ||
@@ -60,0 +68,0 @@ } |
@@ -73,2 +73,5 @@ "use strict"; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.defaultUser) { | ||
this.setDefaultUser(options.defaultUser); | ||
} | ||
this.evaluator = new RolloutEvaluator_1.RolloutEvaluator(options.logger); | ||
@@ -118,3 +121,3 @@ if (((_a = options === null || options === void 0 ? void 0 : options.flagOverrides) === null || _a === void 0 ? void 0 : _a.behaviour) != FlagOverrides_1.OverrideBehaviour.LocalOnly) { | ||
} | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user).Value; | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user !== null && user !== void 0 ? user : this.defaultUser).Value; | ||
resolve(result); | ||
@@ -196,3 +199,3 @@ return [2 /*return*/]; | ||
} | ||
result = this.evaluator.Evaluate(settings, key, null, user, defaultVariationId).VariationId; | ||
result = this.evaluator.Evaluate(settings, key, null, user !== null && user !== void 0 ? user : this.defaultUser, defaultVariationId).VariationId; | ||
resolve(result); | ||
@@ -316,3 +319,3 @@ return [2 /*return*/]; | ||
settingKey: key, | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user).Value | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user !== null && user !== void 0 ? user : _this.defaultUser).Value | ||
}); | ||
@@ -326,2 +329,8 @@ }); | ||
}; | ||
ConfigCatClient.prototype.setDefaultUser = function (defaultUser) { | ||
this.defaultUser = defaultUser; | ||
}; | ||
ConfigCatClient.prototype.clearDefaultUser = function () { | ||
this.defaultUser = undefined; | ||
}; | ||
ConfigCatClient.prototype.getSettingsAsync = function () { | ||
@@ -332,5 +341,5 @@ var _this = this; | ||
var localSettings, remoteConfig, remoteSettings, config; | ||
var _a, _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var _a, _b, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -340,3 +349,3 @@ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.flagOverrides)) return [3 /*break*/, 3]; | ||
case 1: | ||
localSettings = _e.sent(); | ||
localSettings = _d.sent(); | ||
if (this.options.flagOverrides.behaviour == FlagOverrides_1.OverrideBehaviour.LocalOnly) { | ||
@@ -348,4 +357,4 @@ resolve(localSettings); | ||
case 2: | ||
remoteConfig = _e.sent(); | ||
remoteSettings = (0, Utils_1.getSettingsFromConfig)((_c = remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON) !== null && _c !== void 0 ? _c : {}); | ||
remoteConfig = _d.sent(); | ||
remoteSettings = (0, Utils_1.getSettingsFromConfig)(remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON); | ||
if (this.options.flagOverrides.behaviour == FlagOverrides_1.OverrideBehaviour.LocalOverRemote) { | ||
@@ -359,6 +368,6 @@ resolve(__assign(__assign({}, remoteSettings), localSettings)); | ||
} | ||
_e.label = 3; | ||
case 3: return [4 /*yield*/, ((_d = this.configService) === null || _d === void 0 ? void 0 : _d.getConfig())]; | ||
_d.label = 3; | ||
case 3: return [4 /*yield*/, ((_c = this.configService) === null || _c === void 0 ? void 0 : _c.getConfig())]; | ||
case 4: | ||
config = _e.sent(); | ||
config = _d.sent(); | ||
if (!config || !config.ConfigJSON || !config.ConfigJSON[ProjectConfig_1.ConfigFile.FeatureFlags]) { | ||
@@ -365,0 +374,0 @@ resolve(null); |
@@ -1,2 +0,2 @@ | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache } from "./index"; | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache, User } from "./index"; | ||
import { FlagOverrides } from "./FlagOverrides"; | ||
@@ -24,2 +24,7 @@ /** Control the location of the config.json files containing your feature flags and settings within the ConfigCat CDN. */ | ||
flagOverrides?: FlagOverrides | null; | ||
/** | ||
* The default user, used as fallback when there's no user parameter is passed to the | ||
* ConfigCatClient.getValue, ConfigCatClient.getValueAsync, getVariationId, getVariationIdAsync, getAllValues, getAllValuesAsync, etc. methods. | ||
*/ | ||
defaultUser?: User | null; | ||
} | ||
@@ -38,2 +43,3 @@ export declare abstract class OptionsBase implements IOptions { | ||
flagOverrides?: FlagOverrides; | ||
defaultUser?: User | null; | ||
constructor(apiKey: string, clientVersion: string, options?: IOptions | null, defaultCache?: ICache | null); | ||
@@ -40,0 +46,0 @@ getUrl(): string; |
@@ -79,2 +79,5 @@ "use strict"; | ||
} | ||
if (options.defaultUser) { | ||
this.defaultUser = options.defaultUser; | ||
} | ||
} | ||
@@ -81,0 +84,0 @@ } |
@@ -89,4 +89,4 @@ "use strict"; | ||
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: " + (result === null || result === void 0 ? void 0 : result.status)); | ||
if (!result || 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."); | ||
@@ -93,0 +93,0 @@ callback(null); |
@@ -35,2 +35,7 @@ import { IConfigCatKernel } from "./index"; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
/** Sets the default user for feature flag evaluations. | ||
* In case the getValue function isn't called with a UserObject, this default user will be used instead. */ | ||
setDefaultUser(defaultUser: User): void; | ||
/** Clears the default user. */ | ||
clearDefaultUser(): void; | ||
} | ||
@@ -41,2 +46,3 @@ export declare class ConfigCatClient implements IConfigCatClient { | ||
private options; | ||
private defaultUser?; | ||
constructor(options: AutoPollOptions | ManualPollOptions | LazyLoadOptions, configCatKernel: IConfigCatKernel); | ||
@@ -58,2 +64,4 @@ dispose(): void; | ||
getAllValuesAsync(user?: User): Promise<SettingKeyValue[]>; | ||
setDefaultUser(defaultUser: User): void; | ||
clearDefaultUser(): void; | ||
private getSettingsAsync; | ||
@@ -60,0 +68,0 @@ } |
@@ -70,2 +70,5 @@ var __assign = (this && this.__assign) || function () { | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.defaultUser) { | ||
this.setDefaultUser(options.defaultUser); | ||
} | ||
this.evaluator = new RolloutEvaluator(options.logger); | ||
@@ -115,3 +118,3 @@ if (((_a = options === null || options === void 0 ? void 0 : options.flagOverrides) === null || _a === void 0 ? void 0 : _a.behaviour) != OverrideBehaviour.LocalOnly) { | ||
} | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user).Value; | ||
result = this.evaluator.Evaluate(settings, key, defaultValue, user !== null && user !== void 0 ? user : this.defaultUser).Value; | ||
resolve(result); | ||
@@ -193,3 +196,3 @@ return [2 /*return*/]; | ||
} | ||
result = this.evaluator.Evaluate(settings, key, null, user, defaultVariationId).VariationId; | ||
result = this.evaluator.Evaluate(settings, key, null, user !== null && user !== void 0 ? user : this.defaultUser, defaultVariationId).VariationId; | ||
resolve(result); | ||
@@ -313,3 +316,3 @@ return [2 /*return*/]; | ||
settingKey: key, | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user).Value | ||
settingValue: _this.evaluator.Evaluate(settings, key, undefined, user !== null && user !== void 0 ? user : _this.defaultUser).Value | ||
}); | ||
@@ -323,2 +326,8 @@ }); | ||
}; | ||
ConfigCatClient.prototype.setDefaultUser = function (defaultUser) { | ||
this.defaultUser = defaultUser; | ||
}; | ||
ConfigCatClient.prototype.clearDefaultUser = function () { | ||
this.defaultUser = undefined; | ||
}; | ||
ConfigCatClient.prototype.getSettingsAsync = function () { | ||
@@ -329,5 +338,5 @@ var _this = this; | ||
var localSettings, remoteConfig, remoteSettings, config; | ||
var _a, _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var _a, _b, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -337,3 +346,3 @@ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.flagOverrides)) return [3 /*break*/, 3]; | ||
case 1: | ||
localSettings = _e.sent(); | ||
localSettings = _d.sent(); | ||
if (this.options.flagOverrides.behaviour == OverrideBehaviour.LocalOnly) { | ||
@@ -345,4 +354,4 @@ resolve(localSettings); | ||
case 2: | ||
remoteConfig = _e.sent(); | ||
remoteSettings = getSettingsFromConfig((_c = remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON) !== null && _c !== void 0 ? _c : {}); | ||
remoteConfig = _d.sent(); | ||
remoteSettings = getSettingsFromConfig(remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.ConfigJSON); | ||
if (this.options.flagOverrides.behaviour == OverrideBehaviour.LocalOverRemote) { | ||
@@ -356,6 +365,6 @@ resolve(__assign(__assign({}, remoteSettings), localSettings)); | ||
} | ||
_e.label = 3; | ||
case 3: return [4 /*yield*/, ((_d = this.configService) === null || _d === void 0 ? void 0 : _d.getConfig())]; | ||
_d.label = 3; | ||
case 3: return [4 /*yield*/, ((_c = this.configService) === null || _c === void 0 ? void 0 : _c.getConfig())]; | ||
case 4: | ||
config = _e.sent(); | ||
config = _d.sent(); | ||
if (!config || !config.ConfigJSON || !config.ConfigJSON[ConfigFile.FeatureFlags]) { | ||
@@ -362,0 +371,0 @@ resolve(null); |
@@ -1,2 +0,2 @@ | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache } from "./index"; | ||
import { IConfigCatLogger, IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, ICache, User } from "./index"; | ||
import { FlagOverrides } from "./FlagOverrides"; | ||
@@ -24,2 +24,7 @@ /** Control the location of the config.json files containing your feature flags and settings within the ConfigCat CDN. */ | ||
flagOverrides?: FlagOverrides | null; | ||
/** | ||
* The default user, used as fallback when there's no user parameter is passed to the | ||
* ConfigCatClient.getValue, ConfigCatClient.getValueAsync, getVariationId, getVariationIdAsync, getAllValues, getAllValuesAsync, etc. methods. | ||
*/ | ||
defaultUser?: User | null; | ||
} | ||
@@ -38,2 +43,3 @@ export declare abstract class OptionsBase implements IOptions { | ||
flagOverrides?: FlagOverrides; | ||
defaultUser?: User | null; | ||
constructor(apiKey: string, clientVersion: string, options?: IOptions | null, defaultCache?: ICache | null); | ||
@@ -40,0 +46,0 @@ getUrl(): string; |
@@ -76,2 +76,5 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
if (options.defaultUser) { | ||
this.defaultUser = options.defaultUser; | ||
} | ||
} | ||
@@ -78,0 +81,0 @@ } |
@@ -86,4 +86,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
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: " + (result === null || result === void 0 ? void 0 : result.status)); | ||
if (!result || 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."); | ||
@@ -90,0 +90,0 @@ callback(null); |
@@ -85,6 +85,7 @@ import { IConfigCatClient } from "./ConfigCatClient"; | ||
export { ProjectConfig } from "./ProjectConfig"; | ||
export { IConfigCatClient } from "./ConfigCatClient"; | ||
export type { IConfigCatClient } from "./ConfigCatClient"; | ||
export { OptionsBase, DataGovernance } from "./ConfigCatClientOptions"; | ||
export { User } from "./RolloutEvaluator"; | ||
export { IOverrideDataSource, FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
export type { IOverrideDataSource } from "./FlagOverrides"; | ||
export { FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -75,8 +75,10 @@ import { sha1 } from "./Sha1"; | ||
var comparisonAttribute = this_1.GetUserAttribute(user, rule.comparisonAttribute); | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
if (!comparisonAttribute) { | ||
log += "NO MATCH (Attribute is not defined on the user object)"; | ||
eLog.OpAppendLine(log); | ||
return "continue"; | ||
} | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
switch (comparator) { | ||
@@ -83,0 +85,0 @@ case 0: // is one of |
import { ConfigFile, Setting } from "./ProjectConfig"; | ||
export var isUndefined = function (comp) { return comp === undefined; }; | ||
export function getSettingsFromConfig(json) { | ||
if (!json) { | ||
return {}; | ||
} | ||
return Object.fromEntries(Object.entries(json[ConfigFile.FeatureFlags]).map(function (_a) { | ||
@@ -5,0 +8,0 @@ var key = _a[0], value = _a[1]; |
@@ -85,6 +85,7 @@ import { IConfigCatClient } from "./ConfigCatClient"; | ||
export { ProjectConfig } from "./ProjectConfig"; | ||
export { IConfigCatClient } from "./ConfigCatClient"; | ||
export type { IConfigCatClient } from "./ConfigCatClient"; | ||
export { OptionsBase, DataGovernance } from "./ConfigCatClientOptions"; | ||
export { User } from "./RolloutEvaluator"; | ||
export { IOverrideDataSource, FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
export type { IOverrideDataSource } from "./FlagOverrides"; | ||
export { FlagOverrides, MapOverrideDataSource, OverrideBehaviour } from "./FlagOverrides"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -78,8 +78,10 @@ "use strict"; | ||
var comparisonAttribute = this_1.GetUserAttribute(user, rule.comparisonAttribute); | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
if (!comparisonAttribute) { | ||
log += "NO MATCH (Attribute is not defined on the user object)"; | ||
eLog.OpAppendLine(log); | ||
return "continue"; | ||
} | ||
var comparator = rule.comparator; | ||
var comparisonValue = rule.comparisonValue; | ||
var log = "Evaluating rule: '" + comparisonAttribute + "' " + this_1.RuleToString(comparator) + " '" + comparisonValue + "' => "; | ||
switch (comparator) { | ||
@@ -86,0 +88,0 @@ case 0: // is one of |
@@ -8,2 +8,5 @@ "use strict"; | ||
function getSettingsFromConfig(json) { | ||
if (!json) { | ||
return {}; | ||
} | ||
return Object.fromEntries(Object.entries(json[ProjectConfig_1.ConfigFile.FeatureFlags]).map(function (_a) { | ||
@@ -10,0 +13,0 @@ var key = _a[0], value = _a[1]; |
{ | ||
"name": "configcat-common", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.", | ||
@@ -32,5 +32,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/chai": "4.3.1", | ||
"@types/chai": "4.3.3", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^17.0.31", | ||
"@types/node": "^17.0.45", | ||
"chai": "^4.3.6", | ||
@@ -41,4 +41,4 @@ "mocha": "^10.0.0", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.6.4" | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.7.4" | ||
}, | ||
@@ -45,0 +45,0 @@ "repository": { |
@@ -31,1 +31,9 @@ # ConfigCat Common library for JavaScript | ||
- [Blog](https://configcat.com/blog) | ||
# Troubleshooting | ||
### Make sure you have the proper Node.js version installed | ||
You might run into errors caused by the wrong version of Node.js. To make sure you are using the recommended Node.js version follow these steps. | ||
1. Have nvm (Node Version Manager - https://github.com/nvm-sh/nvm ) installed: | ||
1. Run `nvm install`. This will install the compatible version of Node.js. | ||
1. Run `nvm use`. This will use the compatible version of Node.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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
448351
149
8410
38
1