refactor: code formatting
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 21 May 2024 17:37:38 +0000 (19:37 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 21 May 2024 17:37:38 +0000 (19:37 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
32 files changed:
skip-preinstall.js
src/assets/ui-protocol/Insomnia-CSSimulatorUIHTTPProtocol.json
src/assets/ui-protocol/Insomnia-CSSimulatorUIWSProtocol.json
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/charging-station/Helpers.ts
src/charging-station/ocpp/1.6/OCPP16Constants.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/2.0/OCPP20Constants.ts
src/charging-station/ocpp/OCPPConstants.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPServiceUtils.ts
src/charging-station/ui-server/AbstractUIServer.ts
src/charging-station/ui-server/UIServerFactory.ts
src/performance/PerformanceStatistics.ts
src/performance/storage/MongoDBStorage.ts
src/performance/storage/Storage.ts
src/scripts/deleteChargingStations.cjs
src/scripts/setCSPublicFlag.cjs
src/utils/ChargingStationConfigurationUtils.ts
src/utils/Configuration.ts
src/utils/ErrorUtils.ts
src/utils/Utils.ts
src/worker/WorkerSet.ts
tests/utils/Utils.test.ts
ui/web/src/composables/UIClient.ts
ui/web/src/composables/Utils.ts
ui/web/src/shims-vue.d.ts
ui/web/src/views/ChargingStationsView.vue
ui/web/start.js

index e181f0e008798cb6151a924d13807f4e1d1f8e60..fb2477d707f2b57a8f3bb0760a775a92f13ee5b2 100644 (file)
@@ -1,6 +1,6 @@
 import { env, exit } from 'node:process'
 
-const skipPreinstall = parseInt(env.SKIP_PREINSTALL) || env.VCAP_APPLICATION != null
+const skipPreinstall = Number.parseInt(env.SKIP_PREINSTALL) || env.VCAP_APPLICATION != null
 if (skipPreinstall) {
   // eslint-disable-next-line n/no-process-exit
   exit()
index da32bbcbe72fd610919fc704ab5e1cb21234d5a1..e172ad29bbd5386c843a558f37b4f0080b92807c 100644 (file)
         "username": "admin",
         "password": "admin"
       },
-      "dataPropertyOrder": { "&": ["baseUrl", "protocol", "version", "username", "password"] },
+      "dataPropertyOrder": {
+        "&": ["baseUrl", "protocol", "version", "username", "password"]
+      },
       "color": null,
       "isPrivate": false,
       "metaSortKey": 1661789025528,
index 1312150c6d97b57eae80ffe854adbb4c42fd283f..3d9a5405f723c131bc6cdd607fe6910c9722a867 100644 (file)
         "protocol": "ui",
         "version": "0.0.1"
       },
-      "dataPropertyOrder": { "&": ["baseUrl", "username", "password", "protocol", "version"] },
+      "dataPropertyOrder": {
+        "&": ["baseUrl", "username", "password", "protocol", "version"]
+      },
       "color": null,
       "isPrivate": false,
       "metaSortKey": 1671183662529,
index 4b9b8f6cdbd6ef55cf4bf4fdf65a804640b1b6d1..0e081f7750011a095c5fe8a8917fa1aa8e099c90 100644 (file)
@@ -333,9 +333,9 @@ export class AutomaticTransactionGenerator {
     const connectorStatus = this.chargingStation.getConnectorStatus(connectorId)
     if (connectorStatus?.transactionStarted === true) {
       logger.info(
-        `${this.logPrefix(
-          connectorId
-        )} entered in transaction loop while a transaction ${connectorStatus.transactionId} is already started on connector ${connectorId}`
+        `${this.logPrefix(connectorId)} entered in transaction loop while a transaction ${
+          connectorStatus.transactionId
+        } is already started on connector ${connectorId}`
       )
       return false
     }
@@ -378,9 +378,9 @@ export class AutomaticTransactionGenerator {
     while (connectorStatus?.transactionStarted === true) {
       if (!logged) {
         logger.info(
-          `${this.logPrefix(
-            connectorId
-          )} transaction loop waiting for started transaction ${connectorStatus.transactionId} on connector ${connectorId} to be stopped`
+          `${this.logPrefix(connectorId)} transaction loop waiting for started transaction ${
+            connectorStatus.transactionId
+          } on connector ${connectorId} to be stopped`
         )
         logged = true
       }
@@ -416,7 +416,9 @@ export class AutomaticTransactionGenerator {
       )
     } else if (this.chargingStation.getAutomaticTransactionGeneratorStatuses() != null) {
       logger.warn(
-        `${this.logPrefix(connectorId)} no status found for connector #${connectorId} in charging station configuration file. New status will be created`
+        `${this.logPrefix(
+          connectorId
+        )} no status found for connector #${connectorId} in charging station configuration file. New status will be created`
       )
     }
     if (connectorStatus != null) {
@@ -507,7 +509,9 @@ export class AutomaticTransactionGenerator {
     startResponse = await this.chargingStation.ocppRequestService.requestHandler<
     Partial<StartTransactionRequest>,
     StartTransactionResponse
-    >(this.chargingStation, RequestCommand.START_TRANSACTION, { connectorId })
+    >(this.chargingStation, RequestCommand.START_TRANSACTION, {
+      connectorId
+    })
     this.handleStartTransactionResponse(connectorId, startResponse)
     PerformanceStatistics.endMeasure(measureId, beginId)
     return startResponse
index 5293a9a83c28a9a1791f166606d3ca275f2cbb67..d12f78f9b326e79152a11e33d3ccf9f09f2bd2d6 100644 (file)
@@ -225,9 +225,13 @@ export class Bootstrap extends EventEmitter {
         )
         console.info(
           chalk.green(
-            `Charging stations simulator ${
-              this.version
-            } started with ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s) from ${this.numberOfChargingStationTemplates} charging station template(s) and ${
+            `Charging stations simulator ${this.version} started with ${
+              this.numberOfConfiguredChargingStations
+            } configured and ${
+              this.numberOfProvisionedChargingStations
+            } provisioned charging station(s) from ${
+              this.numberOfChargingStationTemplates
+            } charging station template(s) and ${
               Configuration.workerDynamicPoolInUse() ? `${workerConfiguration.poolMinSize}/` : ''
             }${this.workerImplementation?.size}${
               Configuration.workerPoolInUse() ? `/${workerConfiguration.poolMaxSize}` : ''
@@ -373,7 +377,9 @@ export class Bootstrap extends EventEmitter {
         poolOptions: {
           messageHandler: this.messageHandler.bind(this) as MessageHandler<Worker>,
           ...(workerConfiguration.resourceLimits != null && {
-            workerOptions: { resourceLimits: workerConfiguration.resourceLimits }
+            workerOptions: {
+              resourceLimits: workerConfiguration.resourceLimits
+            }
           })
         }
       }
@@ -418,7 +424,11 @@ export class Bootstrap extends EventEmitter {
           break
         default:
           throw new BaseError(
-            `Unknown charging station worker message event: '${event}' received with data: ${JSON.stringify(data, undefined, 2)}`
+            `Unknown charging station worker message event: '${event}' received with data: ${JSON.stringify(
+              data,
+              undefined,
+              2
+            )}`
           )
       }
     } catch (error) {
@@ -436,7 +446,9 @@ export class Bootstrap extends EventEmitter {
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) added (${
         this.numberOfAddedChargingStations
-      } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
+      } added from ${this.numberOfConfiguredChargingStations} configured and ${
+        this.numberOfProvisionedChargingStations
+      } provisioned charging station(s))`
     )
   }
 
@@ -451,7 +463,9 @@ export class Bootstrap extends EventEmitter {
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) deleted (${
         this.numberOfAddedChargingStations
-      } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
+      } added from ${this.numberOfConfiguredChargingStations} configured and ${
+        this.numberOfProvisionedChargingStations
+      } provisioned charging station(s))`
     )
   }
 
index 978bcbd314e6ecbd04d64d53062d904b5b14d168..7df0a35ff7486bb7282455b4c3d63f629bbf7d99 100644 (file)
@@ -269,7 +269,9 @@ export class ChargingStation extends EventEmitter {
         : this.configuredSupervisionUrl.href
     }`
     return new URL(
-      `${wsConnectionBaseUrlStr}${!wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''}${this.stationInfo?.chargingStationId}`
+      `${wsConnectionBaseUrlStr}${
+        !wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''
+      }${this.stationInfo?.chargingStationId}`
     )
   }
 
@@ -1362,7 +1364,9 @@ export class ChargingStation extends EventEmitter {
       addConfigurationKey(this, StandardParametersKey.HeartbeatInterval, '0')
     }
     if (getConfigurationKey(this, StandardParametersKey.HeartBeatInterval) == null) {
-      addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', { visible: false })
+      addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', {
+        visible: false
+      })
     }
     if (
       this.stationInfo?.supervisionUrlOcppConfiguration === true &&
@@ -1380,7 +1384,9 @@ export class ChargingStation extends EventEmitter {
       isNotEmptyString(this.stationInfo.supervisionUrlOcppKey) &&
       getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey) != null
     ) {
-      deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey, { save: false })
+      deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey, {
+        save: false
+      })
     }
     if (
       isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
@@ -1739,7 +1745,9 @@ export class ChargingStation extends EventEmitter {
               ...(this.connectors.size > 0 && {
                 connectorsStatus: configurationData.connectorsStatus
               }),
-              ...(this.evses.size > 0 && { evsesStatus: configurationData.evsesStatus })
+              ...(this.evses.size > 0 && {
+                evsesStatus: configurationData.evsesStatus
+              })
             } satisfies ChargingStationConfiguration)
           )
           .digest('hex')
@@ -1816,7 +1824,9 @@ export class ChargingStation extends EventEmitter {
     if (this.isWebSocketConnectionOpened()) {
       this.emit(ChargingStationEvents.updated)
       logger.info(
-        `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} succeeded`
+        `${this.logPrefix()} Connection to OCPP server through ${
+          this.wsConnectionUrl.href
+        } succeeded`
       )
       let registrationRetryCount = 0
       if (!this.isRegistered()) {
@@ -2075,7 +2085,9 @@ export class ChargingStation extends EventEmitter {
           // eslint-disable-next-line @typescript-eslint/no-base-to-string
         }' message '${data.toString()}'${
           this.requests.has(messageId)
-            ? ` matching cached request '${JSON.stringify(this.getCachedRequest(messageType, messageId))}'`
+            ? ` matching cached request '${JSON.stringify(
+                this.getCachedRequest(messageType, messageId)
+              )}'`
             : ''
         } processing error:`,
         error
index 735a0b39c9bcf967f69297aa1a66618d2b4f9752..15ba379bf50ff28fc28fcb3ae3ab7c93eadd5b81 100644 (file)
@@ -306,7 +306,11 @@ export const checkConnectorsConfiguration = (
     )
     stationTemplate.randomConnectors = true
   }
-  return { configuredMaxConnectors, templateMaxConnectors, templateMaxAvailableConnectors }
+  return {
+    configuredMaxConnectors,
+    templateMaxConnectors,
+    templateMaxAvailableConnectors
+  }
 }
 
 export const checkStationInfoConnectorStatus = (
@@ -524,7 +528,10 @@ export const createSerialNumber = (
     randomSerialNumber?: boolean
   }
 ): void => {
-  params = { ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true }, ...params }
+  params = {
+    ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true },
+    ...params
+  }
   const serialNumberSuffix =
     params.randomSerialNumber === true
       ? getRandomSerialNumberSuffix({
index 4a604f1c4635d8d39658c8537ab04f19e49fe49e..214c5a85bf9797377d49d64813aa04d4116a319c 100644 (file)
@@ -7,15 +7,33 @@ export class OCPP16Constants extends OCPPConstants {
   > = Object.freeze([
       { to: OCPP16ChargePointStatus.Available },
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       { to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Available
+      },
       // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       { to: OCPP16ChargePointStatus.Faulted },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable }
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Available
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Unavailable
+      }
     // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
     ])
 
@@ -23,93 +41,252 @@ export class OCPP16Constants extends OCPPConstants {
     Object.freeze([
       { to: OCPP16ChargePointStatus.Available },
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.SuspendedEVSE },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Preparing
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Charging
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Finishing },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Reserved
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.Available,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Available },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.Available
+      },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Finishing },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.Charging
+      },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.Finishing
+      },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Reserved },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Preparing,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Available },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.Available
+      },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Preparing },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Finishing },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.Finishing
+      },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.Charging,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Available },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.Available
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Charging },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.Charging
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEV, OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Finishing },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.Finishing
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEV,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Available },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.Available
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.SuspendedEV },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.Charging
+      },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Finishing },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.Finishing
+      },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.SuspendedEVSE,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.Finishing},
-      { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Preparing },
+      {
+        from: OCPP16ChargePointStatus.Finishing,
+        to: OCPP16ChargePointStatus.Available
+      },
+      {
+        from: OCPP16ChargePointStatus.Finishing,
+        to: OCPP16ChargePointStatus.Preparing
+      },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Charging },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.SuspendedEV },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.SuspendedEVSE },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Finishing },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Finishing,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.Finishing,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       // { to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Preparing },
+      {
+        from: OCPP16ChargePointStatus.Reserved,
+        to: OCPP16ChargePointStatus.Available
+      },
+      {
+        from: OCPP16ChargePointStatus.Reserved,
+        to: OCPP16ChargePointStatus.Preparing
+      },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Charging },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.SuspendedEV },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.SuspendedEVSE },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Finishing },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Reserved,
+        to: OCPP16ChargePointStatus.Unavailable
+      },
+      {
+        from: OCPP16ChargePointStatus.Reserved,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       { to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.SuspendedEVSE },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Available
+      },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Preparing
+      },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Charging
+      },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
       // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Finishing },
       // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Reserved },
       // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
-      { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
+      {
+        from: OCPP16ChargePointStatus.Unavailable,
+        to: OCPP16ChargePointStatus.Faulted
+      },
       { to: OCPP16ChargePointStatus.Faulted },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Preparing },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Charging },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.SuspendedEV },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.SuspendedEVSE },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Finishing },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Reserved },
-      { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable }
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Available
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Preparing
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Charging
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.SuspendedEV
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.SuspendedEVSE
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Finishing
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Reserved
+      },
+      {
+        from: OCPP16ChargePointStatus.Faulted,
+        to: OCPP16ChargePointStatus.Unavailable
+      }
       // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
     ])
 }
index 84fb39c18ca1bb70968a2deab618427c3e17f909..0c8db60cf360547bf17dd83e69c7efe95f9b25f0 100644 (file)
@@ -433,11 +433,15 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
             .then(response => {
               if (response.status === OCPP16AuthorizationStatus.ACCEPTED) {
                 logger.debug(
-                  `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${idTag}'`
+                  `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+                    chargingStation.stationInfo?.chargingStationId
+                  }#${connectorId} for idTag '${idTag}'`
                 )
               } else {
                 logger.debug(
-                  `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${idTag}'`
+                  `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+                    chargingStation.stationInfo?.chargingStationId
+                  }#${connectorId} for idTag '${idTag}'`
                 )
               }
             })
@@ -465,11 +469,15 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
             .then(response => {
               if (response.status === GenericStatus.Accepted) {
                 logger.debug(
-                  `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for transaction '${transactionId}'`
+                  `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED on ${
+                    chargingStation.stationInfo?.chargingStationId
+                  }#${connectorId} for transaction '${transactionId}'`
                 )
               } else {
                 logger.debug(
-                  `${chargingStation.logPrefix()} Remote stop transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for transaction '${transactionId}'`
+                  `${chargingStation.logPrefix()} Remote stop transaction REJECTED on ${
+                    chargingStation.stationInfo?.chargingStationId
+                  }#${connectorId} for transaction '${transactionId}'`
                 )
               }
             })
@@ -1196,7 +1204,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       )
     }
     logger.debug(
-      `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${transactionConnectorId}}, idTag '${idTag}'`
+      `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+        chargingStation.stationInfo?.chargingStationId
+      }#${transactionConnectorId}}, idTag '${idTag}'`
     )
     return OCPP16Constants.OCPP_RESPONSE_ACCEPTED
   }
@@ -1208,7 +1218,11 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
   ): GenericResponse {
     const connectorStatus = chargingStation.getConnectorStatus(connectorId)
     logger.debug(
-      `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId}, idTag '${idTag}', availability '${connectorStatus?.availability}', status '${connectorStatus?.status}'`
+      `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+        chargingStation.stationInfo?.chargingStationId
+      }#${connectorId}, idTag '${idTag}', availability '${
+        connectorStatus?.availability
+      }', status '${connectorStatus?.status}'`
     )
     return OCPP16Constants.OCPP_RESPONSE_REJECTED
   }
@@ -1221,7 +1235,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     if (chargingProfile.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE) {
       OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, chargingProfile)
       logger.debug(
-        `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on ${chargingStation.stationInfo?.chargingStationId}#${connectorId}`,
+        `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on ${
+          chargingStation.stationInfo?.chargingStationId
+        }#${connectorId}`,
         chargingProfile
       )
       return true
@@ -1717,7 +1733,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
         chargingStation,
         OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
         error as Error,
-        { errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED }
+        {
+          errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED
+        }
       )!
     }
   }
index e6c3b43472c8ef0975f3e855deebf51b7c013919..64e33061d60c222c407003404708e9273baca9ea 100644 (file)
@@ -583,9 +583,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
         authorizeConnectorStatus.idTagAuthorized = false
         delete authorizeConnectorStatus.authorizeIdTag
         logger.debug(
-          `${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' rejected with status '${
-            payload.idTagInfo.status
-          }'`
+          `${chargingStation.logPrefix()} idTag '${
+            requestPayload.idTag
+          }' rejected with status '${payload.idTagInfo.status}'`
         )
       }
     } else {
@@ -698,7 +698,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
       connectorStatus?.status !== OCPP16ChargePointStatus.Preparing
     ) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with status ${connectorStatus?.status}`
+        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with status ${
+          connectorStatus?.status
+        }`
       )
       return
     }
@@ -733,9 +735,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
             logger.warn(
               `${chargingStation.logPrefix()} Reserved transaction ${
                 payload.transactionId
-              } started with a different idTag ${requestPayload.idTag} than the reservation one ${
-                reservation.idTag
-              }`
+              } started with a different idTag ${
+                requestPayload.idTag
+              } than the reservation one ${reservation.idTag}`
             )
           }
           if (hasReservationExpired(reservation)) {
@@ -774,11 +776,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
         OCPP16ChargePointStatus.Charging
       )
       logger.info(
-        `${chargingStation.logPrefix()} Transaction with id ${
-          payload.transactionId
-        } STARTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${
-          requestPayload.idTag
-        }'`
+        `${chargingStation.logPrefix()} Transaction with id ${payload.transactionId} STARTED on ${
+          chargingStation.stationInfo?.chargingStationId
+        }#${connectorId} for idTag '${requestPayload.idTag}'`
       )
       if (chargingStation.stationInfo?.powerSharedByConnectors === true) {
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
index 7acf7aef03ba32df4c3631a91d7ffff164b556ac..b4c73bc28963e7f998c625ce40a9257c16d274fb 100644 (file)
@@ -13,7 +13,10 @@ export class OCPP20Constants extends OCPPConstants {
         from: OCPP20ConnectorStatusEnumType.Available,
         to: OCPP20ConnectorStatusEnumType.Unavailable
       },
-      { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Faulted },
+      {
+        from: OCPP20ConnectorStatusEnumType.Available,
+        to: OCPP20ConnectorStatusEnumType.Faulted
+      },
       { to: OCPP20ConnectorStatusEnumType.Unavailable },
       {
         from: OCPP20ConnectorStatusEnumType.Unavailable,
@@ -28,7 +31,10 @@ export class OCPP20Constants extends OCPPConstants {
         to: OCPP20ConnectorStatusEnumType.Faulted
       },
       { to: OCPP20ConnectorStatusEnumType.Faulted },
-      { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Available },
+      {
+        from: OCPP20ConnectorStatusEnumType.Faulted,
+        to: OCPP20ConnectorStatusEnumType.Available
+      },
       {
         from: OCPP20ConnectorStatusEnumType.Faulted,
         to: OCPP20ConnectorStatusEnumType.Unavailable
@@ -40,31 +46,55 @@ export class OCPP20Constants extends OCPPConstants {
     [
       { to: OCPP20ConnectorStatusEnumType.Available },
       // { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
-      { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Occupied },
-      { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Reserved },
+      {
+        from: OCPP20ConnectorStatusEnumType.Available,
+        to: OCPP20ConnectorStatusEnumType.Occupied
+      },
+      {
+        from: OCPP20ConnectorStatusEnumType.Available,
+        to: OCPP20ConnectorStatusEnumType.Reserved
+      },
       {
         from: OCPP20ConnectorStatusEnumType.Available,
         to: OCPP20ConnectorStatusEnumType.Unavailable
       },
-      { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Faulted },
+      {
+        from: OCPP20ConnectorStatusEnumType.Available,
+        to: OCPP20ConnectorStatusEnumType.Faulted
+      },
       // { to: OCPP20ConnectorStatusEnumType.Occupied },
-      { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Available },
+      {
+        from: OCPP20ConnectorStatusEnumType.Occupied,
+        to: OCPP20ConnectorStatusEnumType.Available
+      },
       // { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Occupied },
       // { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Reserved },
       {
         from: OCPP20ConnectorStatusEnumType.Occupied,
         to: OCPP20ConnectorStatusEnumType.Unavailable
       },
-      { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Faulted },
+      {
+        from: OCPP20ConnectorStatusEnumType.Occupied,
+        to: OCPP20ConnectorStatusEnumType.Faulted
+      },
       // { to: OCPP20ConnectorStatusEnumType.Reserved },
-      { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Available },
-      { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Occupied },
+      {
+        from: OCPP20ConnectorStatusEnumType.Reserved,
+        to: OCPP20ConnectorStatusEnumType.Available
+      },
+      {
+        from: OCPP20ConnectorStatusEnumType.Reserved,
+        to: OCPP20ConnectorStatusEnumType.Occupied
+      },
       // { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Reserved },
       {
         from: OCPP20ConnectorStatusEnumType.Reserved,
         to: OCPP20ConnectorStatusEnumType.Unavailable
       },
-      { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Faulted },
+      {
+        from: OCPP20ConnectorStatusEnumType.Reserved,
+        to: OCPP20ConnectorStatusEnumType.Faulted
+      },
       { to: OCPP20ConnectorStatusEnumType.Unavailable },
       {
         from: OCPP20ConnectorStatusEnumType.Unavailable,
@@ -81,9 +111,18 @@ export class OCPP20Constants extends OCPPConstants {
         to: OCPP20ConnectorStatusEnumType.Faulted
       },
       { to: OCPP20ConnectorStatusEnumType.Faulted },
-      { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Available },
-      { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Occupied },
-      { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Reserved },
+      {
+        from: OCPP20ConnectorStatusEnumType.Faulted,
+        to: OCPP20ConnectorStatusEnumType.Available
+      },
+      {
+        from: OCPP20ConnectorStatusEnumType.Faulted,
+        to: OCPP20ConnectorStatusEnumType.Occupied
+      },
+      {
+        from: OCPP20ConnectorStatusEnumType.Faulted,
+        to: OCPP20ConnectorStatusEnumType.Reserved
+      },
       {
         from: OCPP20ConnectorStatusEnumType.Faulted,
         to: OCPP20ConnectorStatusEnumType.Unavailable
index b036738719944fae935f62c03ec137c06acca761..2abb197892d1bb1dc35e0dd87d0739d37e9f3d58 100644 (file)
@@ -26,8 +26,13 @@ export class OCPPConstants {
 
   static readonly OCPP_REQUEST_EMPTY = Constants.EMPTY_FROZEN_OBJECT
   static readonly OCPP_RESPONSE_EMPTY = Constants.EMPTY_FROZEN_OBJECT
-  static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.Accepted })
-  static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.Rejected })
+  static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({
+    status: GenericStatus.Accepted
+  })
+
+  static readonly OCPP_RESPONSE_REJECTED = Object.freeze({
+    status: GenericStatus.Rejected
+  })
 
   static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
     status: ConfigurationStatus.ACCEPTED
@@ -65,7 +70,10 @@ export class OCPPConstants {
     status: ClearChargingProfileStatus.UNKNOWN
   })
 
-  static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED })
+  static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({
+    status: UnlockStatus.UNLOCKED
+  })
+
   static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
     status: UnlockStatus.UNLOCK_FAILED
   })
index 3a27a1923d7a0234efed3c223337e7e26ba2347f..a3eca0700ac40126ca601d3471ba11a4c9c26a8d 100644 (file)
@@ -383,7 +383,11 @@ export abstract class OCPPRequestService {
                     params.skipBufferingOnError === false ? '' : 'non '
                   }buffered message id '${messageId}' with content '${messageToSend}'`,
                   commandName,
-                  { name: error.name, message: error.message, stack: error.stack }
+                  {
+                    name: error.name,
+                    message: error.message,
+                    stack: error.stack
+                  }
                 )
               )
             }
index 256544fa50090a5a88319f08fdcbe47c2c845f05..9b2fee9cf7bd0d3a5f963bd82e8ecf3f4e1b2f43 100644 (file)
@@ -297,7 +297,7 @@ export const buildMeterValue = (
         const socMinimumValue = socSampledValueTemplate.minimumValue ?? 0
         const socSampledValueTemplateValue = isNotEmptyString(socSampledValueTemplate.value)
           ? getRandomFloatFluctuatedRounded(
-            parseInt(socSampledValueTemplate.value),
+            Number.parseInt(socSampledValueTemplate.value),
             socSampledValueTemplate.fluctuationPercent ?? Constants.DEFAULT_FLUCTUATION_PERCENT
           )
           : randomInt(socMinimumValue, socMaximumValue)
@@ -314,7 +314,9 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${socMinimumValue}/${
+            }: connector id ${connectorId}, transaction id ${
+              connector?.transactionId
+            }, value: ${socMinimumValue}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${socMaximumValue}`
           )
@@ -328,7 +330,7 @@ export const buildMeterValue = (
       )
       if (voltageSampledValueTemplate != null) {
         const voltageSampledValueTemplateValue = isNotEmptyString(voltageSampledValueTemplate.value)
-          ? parseInt(voltageSampledValueTemplate.value)
+          ? Number.parseInt(voltageSampledValueTemplate.value)
           : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
           chargingStation.stationInfo.voltageOut!
         const fluctuationPercent =
@@ -363,7 +365,7 @@ export const buildMeterValue = (
             const voltagePhaseLineToNeutralSampledValueTemplateValue = isNotEmptyString(
               voltagePhaseLineToNeutralSampledValueTemplate.value
             )
-              ? parseInt(voltagePhaseLineToNeutralSampledValueTemplate.value)
+              ? Number.parseInt(voltagePhaseLineToNeutralSampledValueTemplate.value)
               : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
               chargingStation.stationInfo.voltageOut!
             const fluctuationPhaseToNeutralPercent =
@@ -405,7 +407,7 @@ export const buildMeterValue = (
               const voltagePhaseLineToLineSampledValueTemplateValue = isNotEmptyString(
                 voltagePhaseLineToLineSampledValueTemplate.value
               )
-                ? parseInt(voltagePhaseLineToLineSampledValueTemplate.value)
+                ? Number.parseInt(voltagePhaseLineToLineSampledValueTemplate.value)
                 : voltagePhaseLineToLineValueRounded
               const fluctuationPhaseLineToLinePercent =
                 voltagePhaseLineToLineSampledValueTemplate.fluctuationPercent ??
@@ -646,7 +648,9 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumPowerRounded}/${
+            }: connector id ${connectorId}, transaction id ${
+              connector?.transactionId
+            }, value: ${connectorMinimumPowerRounded}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${connectorMaximumPowerRounded}`
           )
@@ -689,7 +693,9 @@ export const buildMeterValue = (
                 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
               }: phase ${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumPowerPerPhaseRounded}/${
+              }, connector id ${connectorId}, transaction id ${
+                connector?.transactionId
+              }, value: ${connectorMinimumPowerPerPhaseRounded}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
               }/${connectorMaximumPowerPerPhaseRounded}`
             )
@@ -901,7 +907,9 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumAmperage}/${
+            }: connector id ${connectorId}, transaction id ${
+              connector?.transactionId
+            }, value: ${connectorMinimumAmperage}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${connectorMaximumAmperage}`
           )
@@ -936,7 +944,9 @@ export const buildMeterValue = (
                 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
               }: phase ${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumAmperage}/${
+              }, connector id ${connectorId}, transaction id ${
+                connector?.transactionId
+              }, value: ${connectorMinimumAmperage}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
               }/${connectorMaximumAmperage}`
             )
@@ -1009,7 +1019,9 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumEnergyRounded}/${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${interval}ms`
+            }: connector id ${connectorId}, transaction id ${
+              connector?.transactionId
+            }, value: ${connectorMinimumEnergyRounded}/${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${interval}ms`
           )
         }
       }
@@ -1081,7 +1093,11 @@ const getLimitFromSampledValueTemplateCustomValue = (
   value: string | undefined,
   maxLimit: number,
   minLimit: number,
-  options?: { limitationEnabled?: boolean, fallbackValue?: number, unitMultiplier?: number }
+  options?: {
+    limitationEnabled?: boolean
+    fallbackValue?: number
+    unitMultiplier?: number
+  }
 ): number => {
   options = {
     ...{
@@ -1091,11 +1107,14 @@ const getLimitFromSampledValueTemplateCustomValue = (
     },
     ...options
   }
-  const parsedValue = parseInt(value ?? '')
+  const parsedValue = Number.parseInt(value ?? '')
   if (options.limitationEnabled === true) {
     return max(
-      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      min((!isNaN(parsedValue) ? parsedValue : Infinity) * options.unitMultiplier!, maxLimit),
+      min(
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        (!isNaN(parsedValue) ? parsedValue : Number.POSITIVE_INFINITY) * options.unitMultiplier!,
+        maxLimit
+      ),
       minLimit
     )
   }
index 9d2705f28f677f37ffcc869c60587ade090745f5..a786fbbddc2ed43623316f297a7f5ac94503d474 100644 (file)
@@ -166,7 +166,9 @@ export abstract class AbstractUIServer {
     const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(/,\s+/).pop()
     const [username, password] = getUsernameAndPasswordFromAuthorizationToken(
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join('=')}`
+      `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join(
+        '='
+      )}`
         .split('.')
         .pop() ?? '',
       next
index 34138e02b0204636b79d5ab884fe9f6328514d8f..cf176bdc0403d2be85890204ba7b67e06f9b6c4a 100644 (file)
@@ -68,8 +68,10 @@ export class UIServerFactory {
             uiServerConfiguration.type as ApplicationProtocol
           )
         ) {
-          // eslint-disable-next-line @typescript-eslint/no-base-to-string
-          const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${ConfigurationSection.uiServer}' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
+          const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${
+            ConfigurationSection.uiServer
+            // eslint-disable-next-line @typescript-eslint/no-base-to-string
+          }' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
             ApplicationProtocol.WS
           }'`
           logger.warn(`${UIServerFactory.logPrefix()} ${logMsg}`)
index f05a4182324f51725be663140d649cdd1bfb8d11..07893578dd8a97b153aeb12aa804a0a1d0bb149a 100644 (file)
@@ -179,9 +179,9 @@ export class PerformanceStatistics {
       )
     if (performanceStorageConfiguration.enabled === true) {
       logger.info(
-        `${this.logPrefix()} storage enabled: type ${performanceStorageConfiguration.type}, uri: ${
-          performanceStorageConfiguration.uri
-        }`
+        `${this.logPrefix()} storage enabled: type ${
+          performanceStorageConfiguration.type
+        }, uri: ${performanceStorageConfiguration.uri}`
       )
     }
   }
@@ -290,9 +290,10 @@ export class PerformanceStatistics {
           Constants.DEFAULT_CIRCULAR_BUFFER_CAPACITY
         )
     }
-    this.statistics.statisticsData
-      .get(entry.name)
-      ?.measurementTimeSeries?.push({ timestamp: entry.startTime, value: entry.duration })
+    this.statistics.statisticsData.get(entry.name)?.measurementTimeSeries?.push({
+      timestamp: entry.startTime,
+      value: entry.duration
+    })
     const timeMeasurementValues = extractTimeSeriesValues(
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       this.statistics.statisticsData.get(entry.name)!.measurementTimeSeries!
index c3c98022d4204c63aa6d940f7cac887d2424ed58..3d99284f4814dee29c4dd039c0d368f94ec2b83f 100644 (file)
@@ -25,7 +25,9 @@ export class MongoDBStorage extends Storage {
       await this.client
         ?.db(this.dbName)
         .collection<Statistics>(Constants.PERFORMANCE_RECORDS_TABLE)
-        .replaceOne({ id: performanceStatistics.id }, performanceStatistics, { upsert: true })
+        .replaceOne({ id: performanceStatistics.id }, performanceStatistics, {
+          upsert: true
+        })
     } catch (error) {
       this.handleDBError(StorageType.MONGO_DB, error as Error, Constants.PERFORMANCE_RECORDS_TABLE)
     }
index aee3ae9efbb5ca86b17a8a7ddf3fcd01b7b80684..46a3a6db0af2170b54c3b6538ae25c10cc1a1796 100644 (file)
@@ -26,7 +26,10 @@ export abstract class Storage {
     type: StorageType,
     error: Error,
     table?: string,
-    params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+    params: HandleErrorParams<EmptyObject> = {
+      throwError: false,
+      consoleOut: false
+    }
   ): void {
     setDefaultErrorParams(params, { throwError: false, consoleOut: false })
     const inTableOrCollectionStr = table != null && ` in table or collection '${table}'`
index 19fd71855cdd5ed9451573e72e93deab177c9c46..345381425e7422f428b4a8fed775b2344ad057b4 100755 (executable)
@@ -14,7 +14,7 @@ const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8'))
 // Mongo Connection and Query
 if (config?.mongoConnectionString) {
   // eslint-disable-next-line n/handle-callback-err
-  MongoClient.connect(config.mongoConnectionString, async function (_err, client) {
+  MongoClient.connect(config.mongoConnectionString, async (_err, client) => {
     const db = client.db()
 
     for await (const tenantID of config.tenantIDs) {
index d41dc1665bb1c4c7f783b35a1fb05f5e0902d269..09e5873b62319fec802d382d21ea54b907c6701f 100755 (executable)
@@ -15,7 +15,7 @@ const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8'))
 // Mongo Connection and Query
 if (config?.mongoConnectionString) {
   // eslint-disable-next-line n/handle-callback-err
-  MongoClient.connect(config.mongoConnectionString, async function (_err, client) {
+  MongoClient.connect(config.mongoConnectionString, async (_err, client) => {
     const db = client.db()
 
     for await (const tenantID of config.tenantIDs) {
index 7b5346d52392deb1996673bc7210e1a3bf300708..c5330a0d95ecd700b997d618261ab70909967e71 100644 (file)
@@ -25,7 +25,7 @@ export const buildConnectorsStatus = (chargingStation: ChargingStation): Connect
   )
 }
 
-export const enum OutputFormat {
+export enum OutputFormat {
   configuration = 'configuration',
   worker = 'worker'
 }
index 25a1475bc2a5f6ec9a6ea40df049048db9538ad8..cd3e0e8af807453cf6ef25b61f6539b5534c26e3 100644 (file)
@@ -171,7 +171,7 @@ export class Configuration {
     if (isCFEnvironment()) {
       delete uiServerConfiguration.options?.host
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      uiServerConfiguration.options!.port = parseInt(env.PORT!)
+      uiServerConfiguration.options!.port = Number.parseInt(env.PORT!)
     }
     return uiServerConfiguration
   }
index 9c243a299e769f67c4e70859aae110651a3444cd..36a5f04ca944df16e9b37bb186e1deb54dd01c12 100644 (file)
@@ -80,7 +80,10 @@ export const handleSendMessageError = (
   chargingStation: ChargingStation,
   commandName: RequestCommand | IncomingRequestCommand,
   error: Error,
-  params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+  params: HandleErrorParams<EmptyObject> = {
+    throwError: false,
+    consoleOut: false
+  }
 ): void => {
   setDefaultErrorParams(params, { throwError: false, consoleOut: false })
   logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error)
index fe059e0688cd5672f8e25fd977113aa394b7bb11..9d021ecb2d3773cfeb318f5bbf07e53d55f41a90 100644 (file)
@@ -113,7 +113,7 @@ export const convertToInt = (value: unknown): number => {
   }
   let changedValue: number = value as number
   if (typeof value === 'string') {
-    changedValue = parseInt(value)
+    changedValue = Number.parseInt(value)
   }
   if (isNaN(changedValue)) {
     throw new Error(`Cannot convert to integer: '${String(value)}'`)
@@ -127,7 +127,7 @@ export const convertToFloat = (value: unknown): number => {
   }
   let changedValue: number = value as number
   if (typeof value === 'string') {
-    changedValue = parseFloat(value)
+    changedValue = Number.parseFloat(value)
   }
   if (isNaN(changedValue)) {
     throw new Error(`Cannot convert to float: '${String(value)}'`)
@@ -282,7 +282,9 @@ export const JSONStringify = <
       if (is(Map, value)) {
         switch (mapFormat) {
           case MapStringifyFormat.object:
-            return { ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries()) }
+            return {
+              ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries())
+            }
           case MapStringifyFormat.array:
           default:
             return [...value]
index c45e6a617147edce428800d8a777178eea9b53ea..1774c24a4f17585e8ce1c6dd4bbcef1c109a5fee 100644 (file)
@@ -130,7 +130,11 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
         data: elementData
       } satisfies WorkerMessage<D>
       workerSetElement.worker.postMessage(message)
-      this.promiseResponseMap.set(message.uuid, { resolve, reject, workerSetElement })
+      this.promiseResponseMap.set(message.uuid, {
+        resolve,
+        reject,
+        workerSetElement
+      })
     })
     const response = await sendMessageToWorker
     // Add element sequentially to optimize memory at startup
@@ -199,7 +203,10 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
     worker.once('exit', () => {
       this.removeWorkerSetElement(this.getWorkerSetElementByWorker(worker))
     })
-    const workerSetElement: WorkerSetElement = { worker, numberOfWorkerElements: 0 }
+    const workerSetElement: WorkerSetElement = {
+      worker,
+      numberOfWorkerElements: 0
+    }
     this.workerSet.add(workerSetElement)
     this.workerStartup = false
     return workerSetElement
index 8ab1332baf76eabc8bfae51ae6354769adfc3331..de5b1fd79907db54f30038921abe17fc53a2f764 100644 (file)
@@ -232,7 +232,7 @@ await describe('Utils test suite', async () => {
     expect(isAsyncFunction([])).toBe(false)
     expect(isAsyncFunction(new Date())).toBe(false)
     // eslint-disable-next-line prefer-regex-literals
-    expect(isAsyncFunction(new RegExp('[a-z]', 'i'))).toBe(false)
+    expect(isAsyncFunction(/[a-z]/i)).toBe(false)
     expect(isAsyncFunction(new Error())).toBe(false)
     expect(isAsyncFunction(new Map())).toBe(false)
     expect(isAsyncFunction(new Set())).toBe(false)
index 9522c59213c666a526d48927447024f3e8fc065a..04587e2d8a98d7688eb8016a0833e01edc5b93a4 100644 (file)
@@ -105,7 +105,9 @@ export class UIClient {
   }
 
   public async deleteChargingStation(hashId: string): Promise<ResponsePayload> {
-    return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, { hashIds: [hashId] })
+    return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, {
+      hashIds: [hashId]
+    })
   }
 
   public async setSupervisionUrl(hashId: string, supervisionUrl: string): Promise<ResponsePayload> {
@@ -116,11 +118,15 @@ export class UIClient {
   }
 
   public async startChargingStation(hashId: string): Promise<ResponsePayload> {
-    return this.sendRequest(ProcedureName.START_CHARGING_STATION, { hashIds: [hashId] })
+    return this.sendRequest(ProcedureName.START_CHARGING_STATION, {
+      hashIds: [hashId]
+    })
   }
 
   public async stopChargingStation(hashId: string): Promise<ResponsePayload> {
-    return this.sendRequest(ProcedureName.STOP_CHARGING_STATION, { hashIds: [hashId] })
+    return this.sendRequest(ProcedureName.STOP_CHARGING_STATION, {
+      hashIds: [hashId]
+    })
   }
 
   public async openConnection(hashId: string): Promise<ResponsePayload> {
@@ -183,11 +189,17 @@ export class UIClient {
       this.uiServerConfiguration.authentication?.type === AuthenticationType.PROTOCOL_BASIC_AUTH
         ? [
             `${this.uiServerConfiguration.protocol}${this.uiServerConfiguration.version}`,
-            `authorization.basic.${btoa(`${this.uiServerConfiguration.authentication.username}:${this.uiServerConfiguration.authentication.password}`).replace(/={1,2}$/, '')}`
+            `authorization.basic.${btoa(
+              `${this.uiServerConfiguration.authentication.username}:${this.uiServerConfiguration.authentication.password}`
+            ).replace(/={1,2}$/, '')}`
           ]
         : `${this.uiServerConfiguration.protocol}${this.uiServerConfiguration.version}`
     this.ws = new WebSocket(
-      `${this.uiServerConfiguration.secure === true ? ApplicationProtocol.WSS : ApplicationProtocol.WS}://${this.uiServerConfiguration.host}:${this.uiServerConfiguration.port}`,
+      `${
+        this.uiServerConfiguration.secure === true
+          ? ApplicationProtocol.WSS
+          : ApplicationProtocol.WS
+      }://${this.uiServerConfiguration.host}:${this.uiServerConfiguration.port}`,
       protocols
     )
     this.ws.onopen = () => {
index 0c8a83996e905c7e046d624ad9a8bd64124d1df1..b1bebc92582b5ae64c82b6839ab244a05c0c6075 100644 (file)
@@ -27,7 +27,7 @@ export const convertToInt = (value: unknown): number => {
   }
   let changedValue: number = value as number
   if (typeof value === 'string') {
-    changedValue = parseInt(value)
+    changedValue = Number.parseInt(value)
   }
   if (isNaN(changedValue)) {
     throw new Error(`Cannot convert to integer: '${String(value)}'`)
index 6f0d76e38bac14a980a967753b9db65609cc0a46..48265c5acbcd3d56459240ccbfe0ebe4ee2bd2ee 100644 (file)
@@ -1,4 +1,4 @@
-export {}
+export type {}
 
 declare module 'vue' {
   export interface GlobalComponents {
index 695b88608b4df60c0e90ff848167057ddcbcdfb7..af6fbe99a4d771068a2429845ad6632bd13be2b0 100644 (file)
@@ -142,7 +142,9 @@ const simulatorButtonClass = computed<string>(() =>
 )
 const simulatorButtonMessage = computed<string>(
   () =>
-    `${simulatorState.value?.started === true ? 'Stop' : 'Start'} Simulator${simulatorState.value?.version != null ? ` (${simulatorState.value.version})` : ''}`
+    `${simulatorState.value?.started === true ? 'Stop' : 'Start'} Simulator${
+      simulatorState.value?.version != null ? ` (${simulatorState.value.version})` : ''
+    }`
 )
 
 const state = ref<{
@@ -286,7 +288,10 @@ onUnmounted(() => {
   unregisterWSEventListeners()
 })
 
-const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] = (
+const uiServerConfigurations: {
+  index: number
+  configuration: UIServerConfigurationSection
+}[] = (
   app?.appContext.config.globalProperties.$configuration.value
     .uiServer as UIServerConfigurationSection[]
 ).map((configuration: UIServerConfigurationSection, index: number) => ({
index 46a8bb75884f67da0c4b2ecfc9138bff44fb7ab2..3eb2838e8925cb1b38e872695e66162c97883607 100644 (file)
@@ -7,7 +7,7 @@ import finalhandler from 'finalhandler'
 import serveStatic from 'serve-static'
 
 const isCFEnvironment = env.VCAP_APPLICATION != null
-const PORT = isCFEnvironment ? parseInt(env.PORT) : 3030
+const PORT = isCFEnvironment ? Number.parseInt(env.PORT) : 3030
 const uiPath = join(dirname(fileURLToPath(import.meta.url)), './dist')
 
 const serve = serveStatic(uiPath)