fix: fix worker options argument passing to worker pool/set
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationConfigurationUtils.ts
index 579e2ab49f2f129f5a7e362768636b39070ed7b0..7ffb4e216fbdb26b8becc72b3c4d19cddec6d2a0 100644 (file)
@@ -1,4 +1,4 @@
-import type { ChargingStation } from './internal';
+import type { ChargingStation } from './ChargingStation';
 import type { ConfigurationKey, ConfigurationKeyType } from '../types';
 import { logger } from '../utils';
 
@@ -35,10 +35,15 @@ export class ChargingStationConfigurationUtils {
     },
     params: AddConfigurationKeyParams = { overwrite: false, save: false }
   ): void {
-    options = options ?? ({} 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,