fix: use lodash merge to deep merge objects
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 13 Feb 2024 21:42:30 +0000 (22:42 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 13 Feb 2024 21:42:30 +0000 (22:42 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
bundle.js
package.json
pnpm-lock.yaml
src/charging-station/ChargingStation.ts
src/utils/Configuration.ts

index 8dbfa3eedad7f959db4eadc8f6d98170ec35860b..698f52a893e1204a3e5fcca499fe8ebd74210213 100644 (file)
--- a/bundle.js
+++ b/bundle.js
@@ -23,7 +23,7 @@ await build({
     'chalk',
     'date-fns',
     'http-status-codes',
-    'just-merge',
+    'lodash-es',
     'logform',
     'mnemonist',
     'mongodb',
index 0e4cc2879efe2e3fe4ef9451a4b1796ae67cc0d5..78c0324f1bc52d33d9bfa2a3d83a665fc1691c31 100644 (file)
     "chalk": "^5.3.0",
     "date-fns": "^3.3.1",
     "http-status-codes": "^2.3.0",
-    "just-merge": "^3.2.0",
+    "lodash-es": "^4.17.21",
     "logform": "^2.6.0",
     "mnemonist": "0.40.0-rc1",
     "mongodb": "^6.3.0",
     "@commitlint/config-conventional": "^18.6.0",
     "@mikro-orm/cli": "^6.1.3",
     "@release-it/bumper": "^6.0.1",
+    "@types/lodash-es": "^4.17.12",
     "@types/node": "^20.11.17",
     "@types/tar": "^6.1.11",
     "@types/ws": "^8.5.10",
index 61d9eff8df75bb5d9b597dc5a339720d982e09c0..6a44402fd08a0d882074dbb57a58a57bdc26bbd1 100644 (file)
@@ -44,9 +44,9 @@ dependencies:
   http-status-codes:
     specifier: ^2.3.0
     version: 2.3.0
-  just-merge:
-    specifier: ^3.2.0
-    version: 3.2.0
+  lodash-es:
+    specifier: ^4.17.21
+    version: 4.17.21
   logform:
     specifier: ^2.6.0
     version: 2.6.0
@@ -93,6 +93,9 @@ devDependencies:
   '@release-it/bumper':
     specifier: ^6.0.1
     version: 6.0.1(release-it@17.0.3)
+  '@types/lodash-es':
+    specifier: ^4.17.12
+    version: 4.17.12
   '@types/node':
     specifier: ^20.11.17
     version: 20.11.17
@@ -1591,6 +1594,16 @@ packages:
     resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
     dev: true
 
+  /@types/lodash-es@4.17.12:
+    resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
+    dependencies:
+      '@types/lodash': 4.14.202
+    dev: true
+
+  /@types/lodash@4.14.202:
+    resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==}
+    dev: true
+
   /@types/long@4.0.2:
     resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==}
     dev: true
@@ -6200,10 +6213,6 @@ packages:
       verror: 1.10.0
     dev: true
 
-  /just-merge@3.2.0:
-    resolution: {integrity: sha512-cNh5FWt44hx4SpQS1xZU8Tzr/fQA69pqCdjbwxmaYYIOuRfA8EIg+dn1bGmIW03ZUtR2vkMOCjWKc+jIbpauSw==}
-    dev: false
-
   /keyv@4.5.4:
     resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
     dependencies:
@@ -6371,7 +6380,6 @@ packages:
 
   /lodash-es@4.17.21:
     resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
-    dev: true
 
   /lodash.camelcase@4.3.0:
     resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
index e064d4cd7237c58114b9a514072aabdf322ebaee..a3b0328d4470a00c4eb8acf5f84d9f917a7e0410 100644 (file)
@@ -8,7 +8,7 @@ import { URL } from 'node:url'
 import { parentPort } from 'node:worker_threads'
 
 import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns'
-import merge from 'just-merge'
+import { merge } from 'lodash-es'
 import { type RawData, WebSocket } from 'ws'
 
 import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
@@ -88,7 +88,6 @@ import {
   FirmwareStatus,
   type FirmwareStatusNotificationRequest,
   type FirmwareStatusNotificationResponse,
-  type FirmwareUpgrade,
   type HeartbeatRequest,
   type HeartbeatResponse,
   type IncomingRequest,
@@ -1199,7 +1198,7 @@ export class ChargingStation extends EventEmitter {
         } does not match firmware version pattern '${stationInfo.firmwareVersionPattern}'`
       )
     }
-    stationInfo.firmwareUpgrade = merge<FirmwareUpgrade>(
+    stationInfo.firmwareUpgrade = merge(
       {
         versionUpgrade: {
           step: 1
@@ -1731,7 +1730,7 @@ export class ChargingStation extends EventEmitter {
         } else {
           delete configurationData.configurationKey
         }
-        configurationData = merge<ChargingStationConfiguration>(
+        configurationData = merge(
           configurationData,
           buildChargingStationAutomaticTransactionGeneratorConfiguration(this)
         )
index 1cec80f038366ac590211b331d865bea4becc96e..de3a79bb1b47e943a8b061980e80783f1652164b 100644 (file)
@@ -4,7 +4,7 @@ import { env } from 'node:process'
 import { fileURLToPath } from 'node:url'
 
 import chalk from 'chalk'
-import merge from 'just-merge'
+import { merge } from 'lodash-es'
 
 import {
   buildPerformanceUriFilePath,
@@ -161,7 +161,7 @@ export class Configuration {
       }
     }
     if (hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.uiServer)) {
-      uiServerConfiguration = merge<UIServerConfiguration>(
+      uiServerConfiguration = merge(
         uiServerConfiguration,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         Configuration.getConfigurationData()!.uiServer!