@transcommerce/cwm-shared 1.1.77 → 1.1.79
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.
|
@@ -27750,7 +27750,8 @@ class ConfigService {
|
|
|
27750
27750
|
// --- FIX: AUTO-PARSE JSON IF APPLICABLE ---
|
|
27751
27751
|
if (setting.contentType === "application/json" || setting.contentType === "JSON") {
|
|
27752
27752
|
try {
|
|
27753
|
-
|
|
27753
|
+
this.configCache = JSON.parse(setting.value ?? "{}");
|
|
27754
|
+
return this.configCache;
|
|
27754
27755
|
}
|
|
27755
27756
|
catch (err) {
|
|
27756
27757
|
this.logger.error("Failed to parse JSON configuration value", err);
|
|
@@ -27778,7 +27779,7 @@ class ConfigService {
|
|
|
27778
27779
|
this.logger.trace("This is just a sting marked as JSON so we are correcting the contentType");
|
|
27779
27780
|
}
|
|
27780
27781
|
else {
|
|
27781
|
-
valueToSave = JSON.stringify(setting);
|
|
27782
|
+
valueToSave = JSON.stringify(setting, null, 2);
|
|
27782
27783
|
this.logger.trace("This is a valid JSON configuration");
|
|
27783
27784
|
}
|
|
27784
27785
|
}
|
|
@@ -27804,7 +27805,10 @@ class ConfigService {
|
|
|
27804
27805
|
/**********************************************************************************************************************/
|
|
27805
27806
|
async getConfigAsync(company, force = false) {
|
|
27806
27807
|
this.logger.methodName = "getConfigAsync()";
|
|
27807
|
-
|
|
27808
|
+
if (force) {
|
|
27809
|
+
this.logger.info("Force Reload Enabled, Clearing Config Cache");
|
|
27810
|
+
ConfigService._configCache = undefined;
|
|
27811
|
+
}
|
|
27808
27812
|
if (this.mockData) {
|
|
27809
27813
|
this.configCache = DEFAULT_CONFIGURATION;
|
|
27810
27814
|
this.logger.debug("Mock Data Enabled, Using Mock Config", this.configCache);
|
|
@@ -27824,7 +27828,7 @@ class ConfigService {
|
|
|
27824
27828
|
return config;
|
|
27825
27829
|
}
|
|
27826
27830
|
/**********************************************************************************************************************/
|
|
27827
|
-
async saveConfigAsync(config, company
|
|
27831
|
+
async saveConfigAsync(config, company) {
|
|
27828
27832
|
this.logger.logLevel = config.authConfig.logLevel;
|
|
27829
27833
|
this.logger.methodName = "saveConfigAsync()";
|
|
27830
27834
|
// Update configuration cache
|