@transcommerce/cwm-shared 1.1.76 → 1.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27698,6 +27698,7 @@ const MockProfile = DEFAULT_PROFILE;
|
|
|
27698
27698
|
|
|
27699
27699
|
const MockCustomer = DEFAULT_CUSTOMER;
|
|
27700
27700
|
|
|
27701
|
+
/**********************************************************************************************************************/
|
|
27701
27702
|
class ConfigService {
|
|
27702
27703
|
authConfig;
|
|
27703
27704
|
logger;
|
|
@@ -27711,6 +27712,7 @@ class ConfigService {
|
|
|
27711
27712
|
set configCache(value) {
|
|
27712
27713
|
ConfigService._configCache = value;
|
|
27713
27714
|
}
|
|
27715
|
+
/**********************************************************************************************************************/
|
|
27714
27716
|
constructor(authConfig, logger) {
|
|
27715
27717
|
this.authConfig = authConfig;
|
|
27716
27718
|
this.logger = logger;
|
|
@@ -27720,6 +27722,7 @@ class ConfigService {
|
|
|
27720
27722
|
this.logger.debug("Config Client", this.configClient);
|
|
27721
27723
|
this.logger.methodName = "";
|
|
27722
27724
|
}
|
|
27725
|
+
/**********************************************************************************************************************/
|
|
27723
27726
|
async getConfigurationSettingAsync(key, label) {
|
|
27724
27727
|
this.logger.methodName = "getConfigurationSettingAsync()";
|
|
27725
27728
|
let setting = {};
|
|
@@ -27756,6 +27759,7 @@ class ConfigService {
|
|
|
27756
27759
|
}
|
|
27757
27760
|
return setting.value;
|
|
27758
27761
|
}
|
|
27762
|
+
/**********************************************************************************************************************/
|
|
27759
27763
|
async setConfigurationSettingAsync(templateName, label, setting, contentType = "application/json") {
|
|
27760
27764
|
this.logger.methodName = "setConfigurationSettingAsync()";
|
|
27761
27765
|
if (this.mockData) {
|
|
@@ -27774,7 +27778,7 @@ class ConfigService {
|
|
|
27774
27778
|
this.logger.trace("This is just a sting marked as JSON so we are correcting the contentType");
|
|
27775
27779
|
}
|
|
27776
27780
|
else {
|
|
27777
|
-
valueToSave = JSON.stringify(setting);
|
|
27781
|
+
valueToSave = JSON.stringify(setting, null, 2);
|
|
27778
27782
|
this.logger.trace("This is a valid JSON configuration");
|
|
27779
27783
|
}
|
|
27780
27784
|
}
|
|
@@ -27797,8 +27801,13 @@ class ConfigService {
|
|
|
27797
27801
|
await this.configClient.setConfigurationSetting(configurationSetting);
|
|
27798
27802
|
this.logger.methodName = "";
|
|
27799
27803
|
}
|
|
27800
|
-
|
|
27804
|
+
/**********************************************************************************************************************/
|
|
27805
|
+
async getConfigAsync(company, force = false) {
|
|
27801
27806
|
this.logger.methodName = "getConfigAsync()";
|
|
27807
|
+
if (force) {
|
|
27808
|
+
this.logger.info("Force Reload Enabled, Clearing Config Cache");
|
|
27809
|
+
ConfigService._configCache = undefined;
|
|
27810
|
+
}
|
|
27802
27811
|
if (this.mockData) {
|
|
27803
27812
|
this.configCache = DEFAULT_CONFIGURATION;
|
|
27804
27813
|
this.logger.debug("Mock Data Enabled, Using Mock Config", this.configCache);
|
|
@@ -27817,6 +27826,7 @@ class ConfigService {
|
|
|
27817
27826
|
this.logger.methodName = "";
|
|
27818
27827
|
return config;
|
|
27819
27828
|
}
|
|
27829
|
+
/**********************************************************************************************************************/
|
|
27820
27830
|
async saveConfigAsync(config, company) {
|
|
27821
27831
|
this.logger.logLevel = config.authConfig.logLevel;
|
|
27822
27832
|
this.logger.methodName = "saveConfigAsync()";
|