fix: fix worker options argument passing to worker pool/set
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationConfigurationUtils.ts
index 5e14e4589cba3e63302833cc760ab710835fbed3..7ffb4e216fbdb26b8becc72b3c4d19cddec6d2a0 100644 (file)
@@ -1,6 +1,6 @@
-import type { ChargingStation } from './internal';
+import type { ChargingStation } from './ChargingStation';
 import type { ConfigurationKey, ConfigurationKeyType } from '../types';
-import { Constants, logger } from '../utils';
+import { logger } from '../utils';
 
 type ConfigurationKeyOptions = { readonly?: boolean; visible?: boolean; reboot?: boolean };
 type DeleteConfigurationKeyParams = { save?: boolean; caseInsensitive?: boolean };
@@ -35,10 +35,15 @@ export class ChargingStationConfigurationUtils {
     },
     params: AddConfigurationKeyParams = { overwrite: false, save: false }
   ): void {
-    options = options ?? (Constants.EMPTY_OBJECT as ConfigurationKeyOptions);
-    options.readonly = options?.readonly ?? false;
-    options.visible = options?.visible ?? true;
-    options.reboot = options?.reboot ?? false;
+    options = {
+      ...{
+        readonly: false,
+        visible: true,
+        reboot: false,
+      },
+      ...options,
+    };
+    params = { ...{ overwrite: false, save: false }, ...params };
     let keyFound = ChargingStationConfigurationUtils.getConfigurationKey(chargingStation, key);
     if (keyFound && params?.overwrite) {
       ChargingStationConfigurationUtils.deleteConfigurationKey(chargingStation, keyFound.key, {
@@ -92,6 +97,7 @@ export class ChargingStationConfigurationUtils {
     key: ConfigurationKeyType,
     params: DeleteConfigurationKeyParams = { save: true, caseInsensitive: false }
   ): ConfigurationKey[] | undefined {
+    params = { ...{ save: true, caseInsensitive: false }, ...params };
     const keyFound = ChargingStationConfigurationUtils.getConfigurationKey(
       chargingStation,
       key,