From: Jérôme Benoit Date: Tue, 13 Feb 2024 21:42:30 +0000 (+0100) Subject: fix: use lodash merge to deep merge objects X-Git-Tag: v1.2.37~64 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6e7e00faf3d51f4478d389f36a6a58f2da9c7f37;p=e-mobility-charging-stations-simulator.git fix: use lodash merge to deep merge objects Signed-off-by: Jérôme Benoit --- diff --git a/bundle.js b/bundle.js index 8dbfa3ee..698f52a8 100644 --- 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', diff --git a/package.json b/package.json index 0e4cc287..78c0324f 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "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", @@ -121,6 +121,7 @@ "@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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61d9eff8..6a44402f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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==} diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index e064d4cd..a3b0328d 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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( + stationInfo.firmwareUpgrade = merge( { versionUpgrade: { step: 1 @@ -1731,7 +1730,7 @@ export class ChargingStation extends EventEmitter { } else { delete configurationData.configurationKey } - configurationData = merge( + configurationData = merge( configurationData, buildChargingStationAutomaticTransactionGeneratorConfiguration(this) ) diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 1cec80f0..de3a79bb 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -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 = merge( uiServerConfiguration, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion Configuration.getConfigurationData()!.uiServer!