chore: migrate to neostandard eslint configuration
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 14 Jul 2024 20:48:56 +0000 (22:48 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 14 Jul 2024 20:48:56 +0000 (22:48 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
95 files changed:
.cfignore
.eslintignore [deleted file]
.eslintrc.cjs [deleted file]
.lintstagedrc.js
.prettierrc.json
.vscode/settings.json
README.md
build-requirements.js
bundle.js
e-mobility-charging-stations-simulator.code-workspace
eslint.config.js [new file with mode: 0644]
mikro-orm.config-template.ts
package.json
pnpm-lock.yaml
prepare.js
skip-preinstall.js
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/charging-station/ChargingStationWorker.ts
src/charging-station/ConfigurationKeyUtils.ts
src/charging-station/Helpers.ts
src/charging-station/IdTagsCache.ts
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts
src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
src/charging-station/broadcast-channel/WorkerBroadcastChannel.ts
src/charging-station/index.ts
src/charging-station/ocpp/1.6/OCPP16Constants.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20Constants.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20RequestService.ts
src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
src/charging-station/ocpp/OCPPConstants.ts
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPResponseService.ts
src/charging-station/ocpp/OCPPServiceUtils.ts
src/charging-station/ocpp/index.ts
src/charging-station/ui-server/AbstractUIServer.ts
src/charging-station/ui-server/UIHttpServer.ts
src/charging-station/ui-server/UIServerFactory.ts
src/charging-station/ui-server/UIServerUtils.ts
src/charging-station/ui-server/UIWebSocketServer.ts
src/charging-station/ui-server/ui-services/AbstractUIService.ts
src/performance/PerformanceStatistics.ts
src/performance/storage/MikroOrmStorage.ts
src/performance/storage/MongoDBStorage.ts
src/performance/storage/Storage.ts
src/scripts/deleteChargingStations.cjs
src/scripts/setCSPublicFlag.cjs
src/types/ChargingStationConfiguration.ts
src/types/ChargingStationInfo.ts
src/types/ChargingStationTemplate.ts
src/types/ChargingStationWorker.ts
src/types/WebSocket.ts
src/types/index.ts
src/types/ocpp/1.6/Requests.ts
src/types/ocpp/2.0/Requests.ts
src/types/ocpp/2.0/Responses.ts
src/types/ocpp/ChargePointErrorCode.ts
src/types/ocpp/ChargingProfile.ts
src/types/ocpp/Configuration.ts
src/types/ocpp/ConnectorStatusEnum.ts
src/types/ocpp/MeterValues.ts
src/types/ocpp/Requests.ts
src/types/ocpp/Responses.ts
src/types/ocpp/Transaction.ts
src/types/orm/entities/PerformanceRecord.ts
src/utils/ChargingStationConfigurationUtils.ts
src/utils/Configuration.ts
src/utils/ConfigurationUtils.ts
src/utils/Constants.ts
src/utils/ErrorUtils.ts
src/utils/FileUtils.ts
src/utils/Logger.ts
src/utils/MessageChannelUtils.ts
src/utils/StatisticUtils.ts
src/utils/Utils.ts
src/utils/index.ts
src/worker/WorkerAbstract.ts
src/worker/WorkerConstants.ts
src/worker/WorkerDynamicPool.ts
src/worker/WorkerFixedPool.ts
src/worker/WorkerSet.ts
src/worker/WorkerTypes.ts
src/worker/WorkerUtils.ts
src/worker/index.ts
tests/types/ConfigurationData.test.ts
tests/utils/ErrorUtils.test.ts
tests/utils/Utils.test.ts
utils/runtime.js

index 83aae17ac8d8a4d0dd8bf451ef3db1abf46c6b00..bd5a5aa424051f0b51a1385423dd2fdef96a5854 100644 (file)
--- a/.cfignore
+++ b/.cfignore
@@ -5,12 +5,7 @@
 .github
 .prettierrc.json
 .prettierignore
-.jshintrc
-.eslintrc.json
-.eslintrc.js
-.eslintrc.cjs
-.eslintrc.mjs
-.eslintignore
+eslint.config.js
 .eslintcache
 .lintstagedrc.json
 .lintstagedrc.js
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644 (file)
index 5374793..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-dist/
-ui/web/
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
deleted file mode 100644 (file)
index d4ff8a2..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// eslint-disable-next-line n/no-unpublished-require
-const { defineConfig } = require('eslint-define-config')
-
-module.exports = defineConfig({
-  root: true,
-  env: {
-    es2022: true,
-    node: true
-  },
-  parserOptions: {
-    sourceType: 'module',
-    ecmaVersion: 2022
-  },
-  plugins: ['simple-import-sort'],
-  extends: ['eslint:recommended', 'plugin:import/recommended'],
-  settings: {
-    'import/resolver': {
-      typescript: {
-        project: './tsconfig.json'
-      }
-    }
-  },
-  rules: {
-    'simple-import-sort/imports': 'error',
-    'simple-import-sort/exports': 'error'
-  },
-  overrides: [
-    {
-      files: ['**/*.ts'],
-      parser: '@typescript-eslint/parser',
-      parserOptions: {
-        project: './tsconfig.json'
-      },
-      plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
-      extends: [
-        'plugin:@typescript-eslint/strict-type-checked',
-        'plugin:@typescript-eslint/stylistic-type-checked',
-        'plugin:import/typescript',
-        'love'
-      ],
-      rules: {
-        'operator-linebreak': 'off',
-        'tsdoc/syntax': 'warn'
-      }
-    },
-    {
-      files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
-      plugins: ['jsdoc'],
-      extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'],
-      rules: {
-        'n/shebang': 'off'
-      }
-    }
-  ]
-})
index 0124480b4544144624cc6959bfd0a8ff223cee57..27d7dfed86f6c929ed797442c9b00570bb708542 100644 (file)
@@ -1,5 +1,7 @@
 export default {
-  '{src,tests}/**/*.{ts,tsx,cts,mts}': ['prettier --cache --write', 'eslint --cache --fix'],
+  '{src,tests}/**/*.{ts,tsx,cts,mts}': [
+    /* 'prettier --cache --write', 'eslint --cache --fix' */
+  ],
   '**/*.{json,md,yml,yaml}': ['prettier --cache --write'],
-  '**/*.{js,jsx,cjs,mjs}': ['prettier --cache --write', 'eslint --cache --fix']
+  '**/*.{js,jsx,cjs,mjs}': ['prettier --cache --write', 'eslint --cache --fix'],
 }
index 066e89fcd2212b26dc027ef6abfb85510c9bae0f..b962a2dd7a7a404be05bec53d5e449f7cba2f72c 100644 (file)
@@ -4,5 +4,5 @@
   "arrowParens": "avoid",
   "singleQuote": true,
   "semi": false,
-  "trailingComma": "none"
+  "trailingComma": "es5"
 }
index ba2b5805ca08727eafa0b6ca27b4b949382119a3..ba2b6f57eecec94f1e340bd12d6791ec2395a268 100644 (file)
@@ -40,6 +40,7 @@
     "mikro",
     "MILLI",
     "mnemonist",
+    "neostandard",
     "ocpp",
     "olivierbagot",
     "onconnection",
index 3f7d629763958200e200af5d42baea9a90849092..9e5ff7bf73ecd6ad47656cdcd84fec9263cf6850 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
 [![GitHub commit activity (main)](https://img.shields.io/github/commit-activity/m/SAP/e-mobility-charging-stations-simulator/main?color=brightgreen&logo=github)](https://github.com/SAP/e-mobility-charging-stations-simulator/graphs/commit-activity)
 [![CI workflow](https://github.com/SAP/e-mobility-charging-stations-simulator/actions/workflows/ci.yml/badge.svg)](https://github.com/SAP/e-mobility-charging-stations-simulator/actions/workflows/ci.yml)
 [![REUSE status](https://api.reuse.software/badge/github.com/SAP/e-mobility-charging-stations-simulator)](https://api.reuse.software/info/github.com/SAP/e-mobility-charging-stations-simulator)
-[![Javascript Standard Style Guide](<https://badgen.net/static/code style/standard/green>)](https://standardjs.com)
+[![neostandard Javascript Code Style](<https://badgen.net/static/code style/neostandard/green>)](https://github.com/neostandard/neostandard)
 
 </div>
 
index e6acc8239bb5c654f98991a16fc402a5e6f5932a..453e3d159969a8cca3a89f059cd9322e46197553 100644 (file)
@@ -20,7 +20,6 @@ export const checkNodeVersion = () => {
         `Required node version ${enginesNodeVersion} not satisfied with current version ${version}`
       )
     )
-    // eslint-disable-next-line n/no-process-exit
     exit(1)
   }
 }
index 4443f985160205ae4e0356f8d133f221712a3e6f..6f419e18287d3c0547e63fe6e91d6e251cc0afaf 100644 (file)
--- a/bundle.js
+++ b/bundle.js
@@ -34,7 +34,7 @@ await build({
     'winston',
     'winston/*',
     'winston-daily-rotate-file',
-    'ws'
+    'ws',
   ],
   treeShaking: true,
   minify: true,
@@ -50,33 +50,33 @@ await build({
         './dist/assets/json-schemas',
         './dist/assets/station-templates',
         './dist/assets/ui-protocol',
-        './dist/assets/configs-docker'
-      ]
+        './dist/assets/configs-docker',
+      ],
     }),
     copy({
       assets: [
         {
           from: ['./src/assets/config.json'],
-          to: ['./assets']
+          to: ['./assets'],
         },
         {
           from: ['./src/assets/idtags!(-template)*.json'],
-          to: ['./assets']
+          to: ['./assets'],
         },
         {
           from: ['./src/assets/json-schemas/**/*.json'],
-          to: ['./assets/json-schemas']
+          to: ['./assets/json-schemas'],
         },
         {
           from: ['./src/assets/station-templates/**/*.json'],
-          to: ['./assets/station-templates']
+          to: ['./assets/station-templates'],
         },
         {
           from: ['./src/assets/configs-docker/*.json'],
-          to: ['./assets/configs-docker']
-        }
-      ]
-    })
-  ]
+          to: ['./assets/configs-docker'],
+        },
+      ],
+    }),
+  ],
 })
 console.timeEnd('Build time')
index 06cb8f27ee839a9b00f1d1f220bffd09ff05e559..40aac8a202f7bacd39bee687b9ded0e5c0049560 100644 (file)
@@ -1,25 +1,25 @@
 {
   "folders": [
     {
-      "path": "."
+      "path": ".",
     },
     {
-      "path": "ui/web"
+      "path": "ui/web",
     },
     {
-      "path": "tests/ocpp-server"
-    }
+      "path": "tests/ocpp-server",
+    },
   ],
   "settings": {
     "nodejs-testing.extensions": [
       {
         "extensions": ["mjs", "cjs", "js"],
-        "parameters": []
+        "parameters": [],
       },
       {
         "extensions": ["mts", "cts", "ts"],
-        "parameters": ["--import", "tsx"]
-      }
-    ]
-  }
+        "parameters": ["--import", "tsx"],
+      },
+    ],
+  },
 }
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644 (file)
index 0000000..f23dd8a
--- /dev/null
@@ -0,0 +1,71 @@
+/* eslint-disable n/no-unpublished-import */
+import js from '@eslint/js'
+import { defineFlatConfig } from 'eslint-define-config'
+import jsdoc from 'eslint-plugin-jsdoc'
+import simpleImportSort from 'eslint-plugin-simple-import-sort'
+import neostandard, { plugins } from 'neostandard'
+
+export default defineFlatConfig([
+  {
+    ignores: ['dist/**', 'ui/web/**'],
+  },
+  js.configs.recommended,
+  plugins.promise.configs['flat/recommended'],
+  ...plugins.n.configs['flat/mixed-esm-and-cjs'],
+  jsdoc.configs['flat/recommended-typescript'],
+  {
+    rules: {
+      'jsdoc/check-tag-names': [
+        'warn',
+        {
+          typed: true,
+          definedTags: ['defaultValue', 'experimental', 'typeParam'],
+        },
+      ],
+    },
+  },
+  ...neostandard({
+    ts: true,
+  }),
+  ...plugins['typescript-eslint'].config(
+    ...plugins['typescript-eslint'].configs.strictTypeChecked,
+    ...plugins['typescript-eslint'].configs.stylisticTypeChecked
+  ),
+  {
+    languageOptions: {
+      parserOptions: {
+        project: true,
+        tsconfigRootDir: import.meta.dirname,
+      },
+    },
+  },
+  {
+    plugins: {
+      'simple-import-sort': simpleImportSort,
+    },
+    rules: {
+      'simple-import-sort/imports': 'error',
+      'simple-import-sort/exports': 'error',
+    },
+  },
+  {
+    files: [
+      'src/charging-station/ChargingStation.ts',
+      'src/charging-station/ocpp/OCPPServiceUtils.ts',
+      'src/performance/PerformanceStatistics.ts',
+    ],
+    rules: {
+      '@stylistic/operator-linebreak': 'off',
+    },
+  },
+  {
+    files: ['src/scripts/*.cjs'],
+    rules: {
+      '@typescript-eslint/no-require-imports': 'off',
+    },
+  },
+  {
+    files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
+    ...plugins['typescript-eslint'].configs.disableTypeChecked,
+  },
+])
index 1291cbd2cc3dad2f96864021cd194af178944c58..af4b08dd6be5b71e895fdc7b215ab97f7620b5f9 100644 (file)
@@ -6,5 +6,5 @@ export default defineConfig({
   dbName: `${Constants.DEFAULT_PERFORMANCE_DIRECTORY}/${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`,
   entities: ['./dist/types/orm/entities/*.js'],
   entitiesTs: ['./src/types/orm/entities/*.ts'],
-  debug: true
+  debug: true,
 })
index e3443e59173eec8f6cef58eeef262371d278f1a9..93bb1ff2d529be605d658402d56627b73435a958 100644 (file)
     "build:entities": "tsc -p tsconfig-mikro-orm.json",
     "clean:dist": "pnpm exec rimraf dist",
     "clean:node_modules": "pnpm exec rimraf node_modules",
-    "lint": "cross-env TIMING=1 eslint --cache src tests ./*.cjs ./*.js ./*.ts",
-    "lint:fix": "cross-env TIMING=1 eslint --cache --fix src tests ./*.cjs ./*.js ./*.ts",
-    "format": "prettier --cache --write .; eslint --cache --fix src tests ./*.cjs ./*.js ./*.ts",
+    "lint": "cross-env TIMING=1 eslint --cache src tests ./*.js ./*.ts",
+    "lint:fix": "cross-env TIMING=1 eslint --cache --fix src tests ./*.js ./*.ts",
+    "format": "prettier --cache --write .; eslint --cache --fix src tests ./*.js ./*.ts",
+    "prettier": "prettier --cache --write .",
     "test": "glob -c \"c8 node --import tsx --test\" \"tests/**/*.test.ts\"",
     "test:debug": "glob -c \"node --import tsx --test --inspect\" \"tests/**/*.test.ts\"",
     "coverage": "c8 report --reporter=lcov",
   "devDependencies": {
     "@commitlint/cli": "^19.3.0",
     "@commitlint/config-conventional": "^19.2.2",
+    "@eslint/js": "^9.7.0",
     "@mikro-orm/cli": "^6.2.9",
     "@types/node": "^20.14.10",
     "@types/semver": "^7.5.8",
     "@types/ws": "^8.5.11",
-    "@typescript-eslint/eslint-plugin": "^7.16.0",
-    "@typescript-eslint/parser": "^7.16.0",
     "c8": "^10.1.2",
     "clinic": "^13.0.0",
     "cross-env": "^7.0.3",
     "esbuild": "^0.23.0",
     "esbuild-plugin-clean": "^1.0.1",
     "esbuild-plugin-copy": "^2.1.1",
-    "eslint": "^8.57.0",
-    "eslint-config-love": "^47.0.0",
-    "eslint-config-standard": "^17.1.0",
+    "eslint": "^9.7.0",
     "eslint-define-config": "^2.1.0",
-    "eslint-import-resolver-typescript": "^3.6.1",
-    "eslint-plugin-import": "^2.29.1",
     "eslint-plugin-jsdoc": "^48.7.0",
-    "eslint-plugin-n": "^17.9.0",
     "eslint-plugin-simple-import-sort": "^12.1.1",
-    "eslint-plugin-tsdoc": "^0.3.0",
     "expect": "^29.7.0",
     "glob": "^11.0.0",
     "husky": "^9.0.11",
     "lint-staged": "^15.2.7",
+    "neostandard": "^0.11.0",
     "prettier": "^3.3.3",
     "rimraf": "^6.0.1",
     "semver": "^7.6.2",
index e87b0a03f1734ca4dc7c5c93e0647bb0550158e1..9303e9475987449b2748a10b848b6a74692b3e56 100644 (file)
@@ -88,6 +88,9 @@ importers:
       '@commitlint/config-conventional':
         specifier: ^19.2.2
         version: 19.2.2
+      '@eslint/js':
+        specifier: ^9.7.0
+        version: 9.7.0
       '@mikro-orm/cli':
         specifier: ^6.2.9
         version: 6.2.9(mariadb@3.3.0)
@@ -100,12 +103,6 @@ importers:
       '@types/ws':
         specifier: ^8.5.11
         version: 8.5.11
-      '@typescript-eslint/eslint-plugin':
-        specifier: ^7.16.0
-        version: 7.16.0(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3)
-      '@typescript-eslint/parser':
-        specifier: ^7.16.0
-        version: 7.16.0(eslint@8.57.0)(typescript@5.5.3)
       c8:
         specifier: ^10.1.2
         version: 10.1.2
@@ -125,35 +122,17 @@ importers:
         specifier: ^2.1.1
         version: 2.1.1(esbuild@0.23.0)
       eslint:
-        specifier: ^8.57.0
-        version: 8.57.0
-      eslint-config-love:
-        specifier: ^47.0.0
-        version: 47.0.0(@typescript-eslint/eslint-plugin@7.16.0(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3))(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint-plugin-n@17.9.0(eslint@8.57.0))(eslint-plugin-promise@6.2.0(eslint@8.57.0))(eslint@8.57.0)(typescript@5.5.3)
-      eslint-config-standard:
-        specifier: ^17.1.0
-        version: 17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint-plugin-n@17.9.0(eslint@8.57.0))(eslint-plugin-promise@6.2.0(eslint@8.57.0))(eslint@8.57.0)
+        specifier: ^9.7.0
+        version: 9.7.0
       eslint-define-config:
         specifier: ^2.1.0
         version: 2.1.0
-      eslint-import-resolver-typescript:
-        specifier: ^3.6.1
-        version: 3.6.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-plugin-import@2.29.1)(eslint@8.57.0)
-      eslint-plugin-import:
-        specifier: ^2.29.1
-        version: 2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
       eslint-plugin-jsdoc:
         specifier: ^48.7.0
-        version: 48.7.0(eslint@8.57.0)
-      eslint-plugin-n:
-        specifier: ^17.9.0
-        version: 17.9.0(eslint@8.57.0)
+        version: 48.7.0(eslint@9.7.0)
       eslint-plugin-simple-import-sort:
         specifier: ^12.1.1
-        version: 12.1.1(eslint@8.57.0)
-      eslint-plugin-tsdoc:
-        specifier: ^0.3.0
-        version: 0.3.0
+        version: 12.1.1(eslint@9.7.0)
       expect:
         specifier: ^29.7.0
         version: 29.7.0
@@ -166,6 +145,9 @@ importers:
       lint-staged:
         specifier: ^15.2.7
         version: 15.2.7
+      neostandard:
+        specifier: ^0.11.0
+        version: 0.11.0(eslint@9.7.0)(typescript@5.5.3)
       prettier:
         specifier: ^3.3.3
         version: 3.3.3
@@ -843,14 +825,30 @@ packages:
     resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==}
     engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
 
+  '@eslint/config-array@0.17.0':
+    resolution: {integrity: sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@eslint/eslintrc@2.1.4':
     resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
 
+  '@eslint/eslintrc@3.1.0':
+    resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@eslint/js@8.57.0':
     resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
 
+  '@eslint/js@9.7.0':
+    resolution: {integrity: sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+  '@eslint/object-schema@2.1.4':
+    resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@gar/promisify@1.1.3':
     resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==}
 
@@ -859,6 +857,9 @@ packages:
     engines: {node: '>=10.10.0'}
     deprecated: Use @eslint/config-array instead
 
+  '@humanwhocodes/gitignore-to-minimatch@1.0.2':
+    resolution: {integrity: sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==}
+
   '@humanwhocodes/module-importer@1.0.1':
     resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
     engines: {node: '>=12.22'}
@@ -867,6 +868,10 @@ packages:
     resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
     deprecated: Use @eslint/object-schema instead
 
+  '@humanwhocodes/retry@0.3.0':
+    resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==}
+    engines: {node: '>=18.18'}
+
   '@isaacs/cliui@8.0.2':
     resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
     engines: {node: '>=12'}
@@ -915,12 +920,6 @@ packages:
   '@jridgewell/trace-mapping@0.3.9':
     resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
 
-  '@microsoft/tsdoc-config@0.17.0':
-    resolution: {integrity: sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==}
-
-  '@microsoft/tsdoc@0.15.0':
-    resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==}
-
   '@mikro-orm/cli@6.2.9':
     resolution: {integrity: sha512-9eW9ZSzdO03KBkUn5Q0OxWBv/2RrKDwOabW2FKzuWslOY3ZBX+k+e8eP6a/+T8GeGGD/uqj8xVZSgM2DuGGqrw==}
     engines: {node: '>= 18.12.0'}
@@ -1092,6 +1091,35 @@ packages:
     resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==}
     engines: {node: '>=14.16'}
 
+  '@stylistic/eslint-plugin-js@2.6.0-beta.0':
+    resolution: {integrity: sha512-KQiNvzNzvl9AmMs1MiIBszLIy/Xy1bTExnyaVy5dSzOF9c+yT64JQfH0p0jP6XpGwoCnZsrPUNflwP30G42QBQ==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: '>=8.40.0'
+
+  '@stylistic/eslint-plugin-jsx@2.6.0-beta.0':
+    resolution: {integrity: sha512-TOimEpr3vndXHRhuQ5gMqmJv1SBlFI3poIJzyeNMmXi3NWVHoPxfd4QAJHGNJe5G3EO2NAXGf2H7nl8gY5QaZA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: '>=8.40.0'
+
+  '@stylistic/eslint-plugin-plus@2.6.0-beta.0':
+    resolution: {integrity: sha512-Wp+e4sTbFq0Uk5ncU3PETYfg1IcCZ1KycdlqFYXIA7/bgcieeShXouXUcA+S/S5+gWLXGuVJ12IxNzY8yfe4IA==}
+    peerDependencies:
+      eslint: '*'
+
+  '@stylistic/eslint-plugin-ts@2.6.0-beta.0':
+    resolution: {integrity: sha512-WMz1zgmMC3bvg1L/tiYt5ygvDbTDKlbezoHoX2lV9MnUCAEQZUP4xJ9Wj3jmIKxb4mUuK5+vFZJVcOygvbbqow==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: '>=8.40.0'
+
+  '@stylistic/eslint-plugin@2.6.0-beta.0':
+    resolution: {integrity: sha512-1NJy1iIDSFC4gelDJ82VMTq9J32tNvQ9k1lnxOsipZ0YQB826U5zGLiH37QAM8dRfNY6yeYhjlrUVtZUxFR19w==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: '>=8.40.0'
+
   '@szmarczak/http-timer@5.0.1':
     resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==}
     engines: {node: '>=14.16'}
@@ -1214,6 +1242,17 @@ packages:
       typescript:
         optional: true
 
+  '@typescript-eslint/eslint-plugin@8.0.0-alpha.42':
+    resolution: {integrity: sha512-la2sVBOUd6oKsSXSrLgDTu0+m6+TeA3YodHtPqUY231ETdd835hWbJkyVU893MWRRDuOyC09I528RRiGjBAODA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
+      eslint: ^8.57.0 || ^9.0.0
+      typescript: '*'
+    peerDependenciesMeta:
+      typescript:
+        optional: true
+
   '@typescript-eslint/parser@7.16.0':
     resolution: {integrity: sha512-ar9E+k7CU8rWi2e5ErzQiC93KKEFAXA2Kky0scAlPcxYblLt8+XZuHUZwlyfXILyQa95P6lQg+eZgh/dDs3+Vw==}
     engines: {node: ^18.18.0 || >=20.0.0}
@@ -1224,10 +1263,24 @@ packages:
       typescript:
         optional: true
 
+  '@typescript-eslint/parser@8.0.0-alpha.42':
+    resolution: {integrity: sha512-lOUDE+wJwQMq+/KJFCNo9SkJvQ1WGyoubucCWtgDHzr2itfmg0c51Z1wZLyeLSVBsHAWSiR+TIsGoCpHy+5D5Q==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: ^8.57.0 || ^9.0.0
+      typescript: '*'
+    peerDependenciesMeta:
+      typescript:
+        optional: true
+
   '@typescript-eslint/scope-manager@7.16.0':
     resolution: {integrity: sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw==}
     engines: {node: ^18.18.0 || >=20.0.0}
 
+  '@typescript-eslint/scope-manager@8.0.0-alpha.42':
+    resolution: {integrity: sha512-3nS6VEzxUPEMvqadRaGkjZuL+fsjNf5lCYbvS0IQYzqJl7338yhxvPCraHmXe/xlB08p+5BAd6JYAbkTeSXxJw==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@typescript-eslint/type-utils@7.16.0':
     resolution: {integrity: sha512-j0fuUswUjDHfqV/UdW6mLtOQQseORqfdmoBNDFOqs9rvNVR2e+cmu6zJu/Ku4SDuqiJko6YnhwcL8x45r8Oqxg==}
     engines: {node: ^18.18.0 || >=20.0.0}
@@ -1238,10 +1291,23 @@ packages:
       typescript:
         optional: true
 
+  '@typescript-eslint/type-utils@8.0.0-alpha.42':
+    resolution: {integrity: sha512-vmmJgOHycCTUe/d7DdbBkhz1NAJ08wVptyFP17pcmagIq2oTTan9ffIMbIxCKepGi0l5UzdSGf3l9IYZ+xjD8w==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      typescript: '*'
+    peerDependenciesMeta:
+      typescript:
+        optional: true
+
   '@typescript-eslint/types@7.16.0':
     resolution: {integrity: sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw==}
     engines: {node: ^18.18.0 || >=20.0.0}
 
+  '@typescript-eslint/types@8.0.0-alpha.42':
+    resolution: {integrity: sha512-cvfuxLiSVi6EfsgE/1A07JD67pnv+Grf9YMhGAKUsokIvsMcusLSI1h2On6qoyZghJuFXkH3hiMsg7DtxZBtsw==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@typescript-eslint/typescript-estree@7.16.0':
     resolution: {integrity: sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw==}
     engines: {node: ^18.18.0 || >=20.0.0}
@@ -1251,16 +1317,35 @@ packages:
       typescript:
         optional: true
 
+  '@typescript-eslint/typescript-estree@8.0.0-alpha.42':
+    resolution: {integrity: sha512-rIHLylSgsfY5hTE68hd8UXcacZxOq4DWAitRKF8xs33hEBDyxInj4FtUglYU420HvFqyVFtVdB7WEFY4cFQ+iA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      typescript: '*'
+    peerDependenciesMeta:
+      typescript:
+        optional: true
+
   '@typescript-eslint/utils@7.16.0':
     resolution: {integrity: sha512-PqP4kP3hb4r7Jav+NiRCntlVzhxBNWq6ZQ+zQwII1y/G/1gdIPeYDCKr2+dH6049yJQsWZiHU6RlwvIFBXXGNA==}
     engines: {node: ^18.18.0 || >=20.0.0}
     peerDependencies:
       eslint: ^8.56.0
 
+  '@typescript-eslint/utils@8.0.0-alpha.42':
+    resolution: {integrity: sha512-ousp9L07jDosMqnayZNF8QOJB2FDZP7lSN2lUI7BknV5B1beUoPizWZl0yDHxrk64ldZu5JoqkhAbOcbPNJu5Q==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      eslint: ^8.57.0 || ^9.0.0
+
   '@typescript-eslint/visitor-keys@7.16.0':
     resolution: {integrity: sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg==}
     engines: {node: ^18.18.0 || >=20.0.0}
 
+  '@typescript-eslint/visitor-keys@8.0.0-alpha.42':
+    resolution: {integrity: sha512-Bf/BObckzDnCS9AslkTsuH1vU+h4rppUrmPbTbhGlPurmss6Lt/Ft9H8vQ8wXeN8rk0drRhML2Feo6aODLeKdA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   '@ungap/structured-clone@1.2.0':
     resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
 
@@ -1451,9 +1536,6 @@ packages:
   ajv@6.12.6:
     resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
 
-  ajv@8.12.0:
-    resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==}
-
   ajv@8.17.1:
     resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
 
@@ -2555,31 +2637,12 @@ packages:
     peerDependencies:
       eslint: '>=6.0.0'
 
-  eslint-config-love@47.0.0:
-    resolution: {integrity: sha512-wIeJhb4/NF7nE5Ltppg1e9dp1Auxx0+ZPRysrXQ3uBKlW4Nj/UiTZu4r3sKWCxo6HGcRcI4MC1Q5421y3fny2w==}
-    peerDependencies:
-      '@typescript-eslint/eslint-plugin': ^7.0.1
-      eslint: ^8.0.1
-      eslint-plugin-import: ^2.25.2
-      eslint-plugin-n: '^15.0.0 || ^16.0.0 '
-      eslint-plugin-promise: ^6.0.0
-      typescript: '*'
-
   eslint-config-prettier@9.1.0:
     resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==}
     hasBin: true
     peerDependencies:
       eslint: '>=7.0.0'
 
-  eslint-config-standard@17.1.0:
-    resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
-    engines: {node: '>=12.0.0'}
-    peerDependencies:
-      eslint: ^8.0.1
-      eslint-plugin-import: ^2.25.2
-      eslint-plugin-n: '^15.0.0 || ^16.0.0 '
-      eslint-plugin-promise: ^6.0.0
-
   eslint-define-config@2.1.0:
     resolution: {integrity: sha512-QUp6pM9pjKEVannNAbSJNeRuYwW3LshejfyBBpjeMGaJjaDUpVps4C6KVR8R7dWZnD3i0synmrE36znjTkJvdQ==}
     engines: {node: '>=18.0.0', npm: '>=9.0.0', pnpm: '>=8.6.0'}
@@ -2657,8 +2720,8 @@ packages:
       eslint-config-prettier:
         optional: true
 
-  eslint-plugin-promise@6.2.0:
-    resolution: {integrity: sha512-QmAqwizauvnKOlifxyDj2ObfULpHQawlg/zQdgEixur9vl0CvZGv/LCJV2rtj3210QCoeGBzVMfMXqGAOr/4fA==}
+  eslint-plugin-promise@6.4.0:
+    resolution: {integrity: sha512-/KWWRaD3fGkVCZsdR0RU53PSthFmoHVhZl+y9+6DqeDLSikLdlUVpVEAmI6iCRR5QyOjBYBqHZV/bdv4DJ4Gtw==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
     peerDependencies:
       eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
@@ -2668,9 +2731,6 @@ packages:
     peerDependencies:
       eslint: '>=5.0.0'
 
-  eslint-plugin-tsdoc@0.3.0:
-    resolution: {integrity: sha512-0MuFdBrrJVBjT/gyhkP2BqpD0np1NxNLfQ38xXDlSs/KVVpKI2A6vN7jx2Rve/CyUsvOsMGwp9KKrinv7q9g3A==}
-
   eslint-plugin-vue@9.27.0:
     resolution: {integrity: sha512-5Dw3yxEyuBSXTzT5/Ge1X5kIkRTQ3nvBn/VwPwInNiZBSJOO/timWMUaflONnFBzU6NhB68lxnCda7ULV5N7LA==}
     engines: {node: ^14.17.0 || >=16.0.0}
@@ -2681,15 +2741,28 @@ packages:
     resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
 
+  eslint-scope@8.0.2:
+    resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   eslint-visitor-keys@3.4.3:
     resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
 
+  eslint-visitor-keys@4.0.0:
+    resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   eslint@8.57.0:
     resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
     hasBin: true
 
+  eslint@9.7.0:
+    resolution: {integrity: sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    hasBin: true
+
   esm@3.2.25:
     resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==}
     engines: {node: '>=6'}
@@ -2698,6 +2771,10 @@ packages:
     resolution: {integrity: sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==}
     engines: {node: '>=0.10'}
 
+  espree@10.1.0:
+    resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
   espree@9.6.1:
     resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
     engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -2834,6 +2911,10 @@ packages:
     resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
     engines: {node: ^10.12.0 || >=12.0.0}
 
+  file-entry-cache@8.0.0:
+    resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
+    engines: {node: '>=16.0.0'}
+
   file-stream-rotator@0.6.1:
     resolution: {integrity: sha512-u+dBid4PvZw17PmDeRcNOtCP9CCK/9lRN2w+r1xIS7yOL9JFrIBKTvrYsxT4P0pGtThYTn++QS5ChHaUov3+zQ==}
 
@@ -2867,6 +2948,10 @@ packages:
     resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==}
     engines: {node: ^10.12.0 || >=12.0.0}
 
+  flat-cache@4.0.1:
+    resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==}
+    engines: {node: '>=16'}
+
   flatstr@1.0.12:
     resolution: {integrity: sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==}
 
@@ -3048,6 +3133,10 @@ packages:
     resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==}
     engines: {node: '>=8'}
 
+  globals@14.0.0:
+    resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==}
+    engines: {node: '>=18'}
+
   globals@15.8.0:
     resolution: {integrity: sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw==}
     engines: {node: '>=18'}
@@ -3582,9 +3671,6 @@ packages:
     resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==}
     hasBin: true
 
-  jju@1.4.0:
-    resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==}
-
   js-beautify@1.15.1:
     resolution: {integrity: sha512-ESjNzSlt/sWE8sciZH8kBF8BPlwXPwhR6pWKAw8bw4Bwj+iZcnKW6ONWUutJ7eObuBZQpiIb8S7OYspWrKt7rA==}
     engines: {node: '>=14'}
@@ -4175,6 +4261,13 @@ packages:
     resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
     engines: {node: '>= 0.6'}
 
+  neostandard@0.11.0:
+    resolution: {integrity: sha512-20B3IxFDnQf9d9sWdCtiuiArOjtozxt4GF1suatqKk/J1qHdaJSkfnQdfdACi8O21W7yTKmc7jc2wvm0vH7Y2w==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    hasBin: true
+    peerDependencies:
+      eslint: ^9.0.0
+
   next-tick@1.1.0:
     resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
 
@@ -4478,6 +4571,10 @@ packages:
     resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==}
     engines: {node: '>=0.12'}
 
+  peowly@1.3.2:
+    resolution: {integrity: sha512-BYIrwr8JCXY49jUZscgw311w9oGEKo7ux/s+BxrhKTQbiQ0iYNdZNJ5LgagaeercQdFHwnR7Z5IxxFWVQ+BasQ==}
+    engines: {node: '>=18.6.0'}
+
   performance-now@2.1.0:
     resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==}
 
@@ -4491,6 +4588,10 @@ packages:
     resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
     engines: {node: '>=8.6'}
 
+  picomatch@4.0.2:
+    resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
+    engines: {node: '>=12'}
+
   pidtree@0.6.0:
     resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==}
     engines: {node: '>=0.10'}
@@ -5423,6 +5524,15 @@ packages:
   typedarray@0.0.6:
     resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
 
+  typescript-eslint@8.0.0-alpha.42:
+    resolution: {integrity: sha512-lD1yEYS0hGOtRheGp7Lyze2r6AQgJeKHjpNyVlXkYEQgDCs9dPlO2VF9/WMvdA1d3TPa24hVGlUcKJ34G5jNKQ==}
+    engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+    peerDependencies:
+      typescript: '*'
+    peerDependenciesMeta:
+      typescript:
+        optional: true
+
   typescript@5.5.3:
     resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==}
     engines: {node: '>=14.17'}
@@ -6452,8 +6562,21 @@ snapshots:
       eslint: 8.57.0
       eslint-visitor-keys: 3.4.3
 
+  '@eslint-community/eslint-utils@4.4.0(eslint@9.7.0)':
+    dependencies:
+      eslint: 9.7.0
+      eslint-visitor-keys: 3.4.3
+
   '@eslint-community/regexpp@4.11.0': {}
 
+  '@eslint/config-array@0.17.0':
+    dependencies:
+      '@eslint/object-schema': 2.1.4
+      debug: 4.3.5
+      minimatch: 3.1.2
+    transitivePeerDependencies:
+      - supports-color
+
   '@eslint/eslintrc@2.1.4':
     dependencies:
       ajv: 6.12.6
@@ -6468,8 +6591,26 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@eslint/eslintrc@3.1.0':
+    dependencies:
+      ajv: 6.12.6
+      debug: 4.3.5
+      espree: 10.1.0
+      globals: 14.0.0
+      ignore: 5.3.1
+      import-fresh: 3.3.0
+      js-yaml: 4.1.0
+      minimatch: 3.1.2
+      strip-json-comments: 3.1.1
+    transitivePeerDependencies:
+      - supports-color
+
   '@eslint/js@8.57.0': {}
 
+  '@eslint/js@9.7.0': {}
+
+  '@eslint/object-schema@2.1.4': {}
+
   '@gar/promisify@1.1.3':
     optional: true
 
@@ -6481,10 +6622,14 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@humanwhocodes/gitignore-to-minimatch@1.0.2': {}
+
   '@humanwhocodes/module-importer@1.0.1': {}
 
   '@humanwhocodes/object-schema@2.0.3': {}
 
+  '@humanwhocodes/retry@0.3.0': {}
+
   '@isaacs/cliui@8.0.2':
     dependencies:
       string-width: 5.1.2
@@ -6545,15 +6690,6 @@ snapshots:
       '@jridgewell/resolve-uri': 3.1.2
       '@jridgewell/sourcemap-codec': 1.5.0
 
-  '@microsoft/tsdoc-config@0.17.0':
-    dependencies:
-      '@microsoft/tsdoc': 0.15.0
-      ajv: 8.12.0
-      jju: 1.4.0
-      resolve: 1.22.8
-
-  '@microsoft/tsdoc@0.15.0': {}
-
   '@mikro-orm/cli@6.2.9(mariadb@3.3.0)':
     dependencies:
       '@jercle/yargonaut': 1.1.5
@@ -6736,6 +6872,53 @@ snapshots:
 
   '@sindresorhus/is@5.6.0': {}
 
+  '@stylistic/eslint-plugin-js@2.6.0-beta.0(eslint@9.7.0)':
+    dependencies:
+      '@types/eslint': 8.56.10
+      acorn: 8.12.1
+      eslint: 9.7.0
+      eslint-visitor-keys: 4.0.0
+      espree: 10.1.0
+
+  '@stylistic/eslint-plugin-jsx@2.6.0-beta.0(eslint@9.7.0)':
+    dependencies:
+      '@stylistic/eslint-plugin-js': 2.6.0-beta.0(eslint@9.7.0)
+      '@types/eslint': 8.56.10
+      eslint: 9.7.0
+      estraverse: 5.3.0
+      picomatch: 4.0.2
+
+  '@stylistic/eslint-plugin-plus@2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@types/eslint': 8.56.10
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      eslint: 9.7.0
+    transitivePeerDependencies:
+      - supports-color
+      - typescript
+
+  '@stylistic/eslint-plugin-ts@2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@stylistic/eslint-plugin-js': 2.6.0-beta.0(eslint@9.7.0)
+      '@types/eslint': 8.56.10
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      eslint: 9.7.0
+    transitivePeerDependencies:
+      - supports-color
+      - typescript
+
+  '@stylistic/eslint-plugin@2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@stylistic/eslint-plugin-js': 2.6.0-beta.0(eslint@9.7.0)
+      '@stylistic/eslint-plugin-jsx': 2.6.0-beta.0(eslint@9.7.0)
+      '@stylistic/eslint-plugin-plus': 2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)
+      '@stylistic/eslint-plugin-ts': 2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)
+      '@types/eslint': 8.56.10
+      eslint: 9.7.0
+    transitivePeerDependencies:
+      - supports-color
+      - typescript
+
   '@szmarczak/http-timer@5.0.1':
     dependencies:
       defer-to-connect: 2.0.1
@@ -6787,7 +6970,6 @@ snapshots:
     dependencies:
       '@types/estree': 1.0.5
       '@types/json-schema': 7.0.15
-    optional: true
 
   '@types/estree@1.0.5': {}
 
@@ -6811,8 +6993,7 @@ snapshots:
       '@types/tough-cookie': 4.0.5
       parse5: 7.1.2
 
-  '@types/json-schema@7.0.15':
-    optional: true
+  '@types/json-schema@7.0.15': {}
 
   '@types/json5@0.0.29': {}
 
@@ -6870,6 +7051,24 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@typescript-eslint/eslint-plugin@8.0.0-alpha.42(@typescript-eslint/parser@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3))(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@eslint-community/regexpp': 4.11.0
+      '@typescript-eslint/parser': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/scope-manager': 8.0.0-alpha.42
+      '@typescript-eslint/type-utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/visitor-keys': 8.0.0-alpha.42
+      eslint: 9.7.0
+      graphemer: 1.4.0
+      ignore: 5.3.1
+      natural-compare: 1.4.0
+      ts-api-utils: 1.3.0(typescript@5.5.3)
+    optionalDependencies:
+      typescript: 5.5.3
+    transitivePeerDependencies:
+      - supports-color
+
   '@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3)':
     dependencies:
       '@typescript-eslint/scope-manager': 7.16.0
@@ -6883,11 +7082,29 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@typescript-eslint/parser@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@typescript-eslint/scope-manager': 8.0.0-alpha.42
+      '@typescript-eslint/types': 8.0.0-alpha.42
+      '@typescript-eslint/typescript-estree': 8.0.0-alpha.42(typescript@5.5.3)
+      '@typescript-eslint/visitor-keys': 8.0.0-alpha.42
+      debug: 4.3.5
+      eslint: 9.7.0
+    optionalDependencies:
+      typescript: 5.5.3
+    transitivePeerDependencies:
+      - supports-color
+
   '@typescript-eslint/scope-manager@7.16.0':
     dependencies:
       '@typescript-eslint/types': 7.16.0
       '@typescript-eslint/visitor-keys': 7.16.0
 
+  '@typescript-eslint/scope-manager@8.0.0-alpha.42':
+    dependencies:
+      '@typescript-eslint/types': 8.0.0-alpha.42
+      '@typescript-eslint/visitor-keys': 8.0.0-alpha.42
+
   '@typescript-eslint/type-utils@7.16.0(eslint@8.57.0)(typescript@5.5.3)':
     dependencies:
       '@typescript-eslint/typescript-estree': 7.16.0(typescript@5.5.3)
@@ -6900,8 +7117,22 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@typescript-eslint/type-utils@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@typescript-eslint/typescript-estree': 8.0.0-alpha.42(typescript@5.5.3)
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      debug: 4.3.5
+      ts-api-utils: 1.3.0(typescript@5.5.3)
+    optionalDependencies:
+      typescript: 5.5.3
+    transitivePeerDependencies:
+      - eslint
+      - supports-color
+
   '@typescript-eslint/types@7.16.0': {}
 
+  '@typescript-eslint/types@8.0.0-alpha.42': {}
+
   '@typescript-eslint/typescript-estree@7.16.0(typescript@5.5.3)':
     dependencies:
       '@typescript-eslint/types': 7.16.0
@@ -6917,6 +7148,21 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  '@typescript-eslint/typescript-estree@8.0.0-alpha.42(typescript@5.5.3)':
+    dependencies:
+      '@typescript-eslint/types': 8.0.0-alpha.42
+      '@typescript-eslint/visitor-keys': 8.0.0-alpha.42
+      debug: 4.3.5
+      globby: 11.1.0
+      is-glob: 4.0.3
+      minimatch: 9.0.5
+      semver: 7.6.2
+      ts-api-utils: 1.3.0(typescript@5.5.3)
+    optionalDependencies:
+      typescript: 5.5.3
+    transitivePeerDependencies:
+      - supports-color
+
   '@typescript-eslint/utils@7.16.0(eslint@8.57.0)(typescript@5.5.3)':
     dependencies:
       '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
@@ -6928,11 +7174,27 @@ snapshots:
       - supports-color
       - typescript
 
+  '@typescript-eslint/utils@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)':
+    dependencies:
+      '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0)
+      '@typescript-eslint/scope-manager': 8.0.0-alpha.42
+      '@typescript-eslint/types': 8.0.0-alpha.42
+      '@typescript-eslint/typescript-estree': 8.0.0-alpha.42(typescript@5.5.3)
+      eslint: 9.7.0
+    transitivePeerDependencies:
+      - supports-color
+      - typescript
+
   '@typescript-eslint/visitor-keys@7.16.0':
     dependencies:
       '@typescript-eslint/types': 7.16.0
       eslint-visitor-keys: 3.4.3
 
+  '@typescript-eslint/visitor-keys@8.0.0-alpha.42':
+    dependencies:
+      '@typescript-eslint/types': 8.0.0-alpha.42
+      eslint-visitor-keys: 3.4.3
+
   '@ungap/structured-clone@1.2.0': {}
 
   '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.10))(vue@3.4.31(typescript@5.5.3))':
@@ -7189,13 +7451,6 @@ snapshots:
       json-schema-traverse: 0.4.1
       uri-js: 4.4.1
 
-  ajv@8.12.0:
-    dependencies:
-      fast-deep-equal: 3.1.3
-      json-schema-traverse: 1.0.0
-      require-from-string: 2.0.2
-      uri-js: 4.4.1
-
   ajv@8.17.1:
     dependencies:
       fast-deep-equal: 3.1.3
@@ -8581,34 +8836,15 @@ snapshots:
     optionalDependencies:
       source-map: 0.6.1
 
-  eslint-compat-utils@0.5.1(eslint@8.57.0):
+  eslint-compat-utils@0.5.1(eslint@9.7.0):
     dependencies:
-      eslint: 8.57.0
+      eslint: 9.7.0
       semver: 7.6.2
 
-  eslint-config-love@47.0.0(@typescript-eslint/eslint-plugin@7.16.0(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3))(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint-plugin-n@17.9.0(eslint@8.57.0))(eslint-plugin-promise@6.2.0(eslint@8.57.0))(eslint@8.57.0)(typescript@5.5.3):
-    dependencies:
-      '@typescript-eslint/eslint-plugin': 7.16.0(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3)
-      '@typescript-eslint/parser': 7.16.0(eslint@8.57.0)(typescript@5.5.3)
-      eslint: 8.57.0
-      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
-      eslint-plugin-n: 17.9.0(eslint@8.57.0)
-      eslint-plugin-promise: 6.2.0(eslint@8.57.0)
-      typescript: 5.5.3
-    transitivePeerDependencies:
-      - supports-color
-
   eslint-config-prettier@9.1.0(eslint@8.57.0):
     dependencies:
       eslint: 8.57.0
 
-  eslint-config-standard@17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint-plugin-n@17.9.0(eslint@8.57.0))(eslint-plugin-promise@6.2.0(eslint@8.57.0))(eslint@8.57.0):
-    dependencies:
-      eslint: 8.57.0
-      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
-      eslint-plugin-n: 17.9.0(eslint@8.57.0)
-      eslint-plugin-promise: 6.2.0(eslint@8.57.0)
-
   eslint-define-config@2.1.0: {}
 
   eslint-import-resolver-node@0.3.9:
@@ -8647,12 +8883,12 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
-  eslint-plugin-es-x@7.8.0(eslint@8.57.0):
+  eslint-plugin-es-x@7.8.0(eslint@9.7.0):
     dependencies:
-      '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
+      '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0)
       '@eslint-community/regexpp': 4.11.0
-      eslint: 8.57.0
-      eslint-compat-utils: 0.5.1(eslint@8.57.0)
+      eslint: 9.7.0
+      eslint-compat-utils: 0.5.1(eslint@9.7.0)
 
   eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.16.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0):
     dependencies:
@@ -8681,14 +8917,14 @@ snapshots:
       - eslint-import-resolver-webpack
       - supports-color
 
-  eslint-plugin-jsdoc@48.7.0(eslint@8.57.0):
+  eslint-plugin-jsdoc@48.7.0(eslint@9.7.0):
     dependencies:
       '@es-joy/jsdoccomment': 0.46.0
       are-docs-informative: 0.0.2
       comment-parser: 1.4.1
       debug: 4.3.5
       escape-string-regexp: 4.0.0
-      eslint: 8.57.0
+      eslint: 9.7.0
       esquery: 1.6.0
       parse-imports: 2.1.1
       semver: 7.6.2
@@ -8697,12 +8933,12 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
-  eslint-plugin-n@17.9.0(eslint@8.57.0):
+  eslint-plugin-n@17.9.0(eslint@9.7.0):
     dependencies:
-      '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
+      '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0)
       enhanced-resolve: 5.17.0
-      eslint: 8.57.0
-      eslint-plugin-es-x: 7.8.0(eslint@8.57.0)
+      eslint: 9.7.0
+      eslint-plugin-es-x: 7.8.0(eslint@9.7.0)
       get-tsconfig: 4.7.5
       globals: 15.8.0
       ignore: 5.3.1
@@ -8719,18 +8955,17 @@ snapshots:
       '@types/eslint': 8.56.10
       eslint-config-prettier: 9.1.0(eslint@8.57.0)
 
-  eslint-plugin-promise@6.2.0(eslint@8.57.0):
+  eslint-plugin-promise@6.4.0(eslint@9.7.0):
     dependencies:
-      eslint: 8.57.0
+      eslint: 9.7.0
 
   eslint-plugin-simple-import-sort@12.1.1(eslint@8.57.0):
     dependencies:
       eslint: 8.57.0
 
-  eslint-plugin-tsdoc@0.3.0:
+  eslint-plugin-simple-import-sort@12.1.1(eslint@9.7.0):
     dependencies:
-      '@microsoft/tsdoc': 0.15.0
-      '@microsoft/tsdoc-config': 0.17.0
+      eslint: 9.7.0
 
   eslint-plugin-vue@9.27.0(eslint@8.57.0):
     dependencies:
@@ -8751,8 +8986,15 @@ snapshots:
       esrecurse: 4.3.0
       estraverse: 5.3.0
 
+  eslint-scope@8.0.2:
+    dependencies:
+      esrecurse: 4.3.0
+      estraverse: 5.3.0
+
   eslint-visitor-keys@3.4.3: {}
 
+  eslint-visitor-keys@4.0.0: {}
+
   eslint@8.57.0:
     dependencies:
       '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
@@ -8796,6 +9038,45 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
+  eslint@9.7.0:
+    dependencies:
+      '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0)
+      '@eslint-community/regexpp': 4.11.0
+      '@eslint/config-array': 0.17.0
+      '@eslint/eslintrc': 3.1.0
+      '@eslint/js': 9.7.0
+      '@humanwhocodes/module-importer': 1.0.1
+      '@humanwhocodes/retry': 0.3.0
+      '@nodelib/fs.walk': 1.2.8
+      ajv: 6.12.6
+      chalk: 4.1.2
+      cross-spawn: 7.0.3
+      debug: 4.3.5
+      escape-string-regexp: 4.0.0
+      eslint-scope: 8.0.2
+      eslint-visitor-keys: 4.0.0
+      espree: 10.1.0
+      esquery: 1.6.0
+      esutils: 2.0.3
+      fast-deep-equal: 3.1.3
+      file-entry-cache: 8.0.0
+      find-up: 5.0.0
+      glob-parent: 6.0.2
+      ignore: 5.3.1
+      imurmurhash: 0.1.4
+      is-glob: 4.0.3
+      is-path-inside: 3.0.3
+      json-stable-stringify-without-jsonify: 1.0.1
+      levn: 0.4.1
+      lodash.merge: 4.6.2
+      minimatch: 3.1.2
+      natural-compare: 1.4.0
+      optionator: 0.9.4
+      strip-ansi: 6.0.1
+      text-table: 0.2.0
+    transitivePeerDependencies:
+      - supports-color
+
   esm@3.2.25: {}
 
   esniff@2.0.1:
@@ -8805,6 +9086,12 @@ snapshots:
       event-emitter: 0.3.5
       type: 2.7.3
 
+  espree@10.1.0:
+    dependencies:
+      acorn: 8.12.1
+      acorn-jsx: 5.3.2(acorn@8.12.1)
+      eslint-visitor-keys: 4.0.0
+
   espree@9.6.1:
     dependencies:
       acorn: 8.12.1
@@ -8943,6 +9230,10 @@ snapshots:
     dependencies:
       flat-cache: 3.2.0
 
+  file-entry-cache@8.0.0:
+    dependencies:
+      flat-cache: 4.0.1
+
   file-stream-rotator@0.6.1:
     dependencies:
       moment: 2.30.1
@@ -8990,6 +9281,11 @@ snapshots:
       keyv: 4.5.4
       rimraf: 3.0.2
 
+  flat-cache@4.0.1:
+    dependencies:
+      flatted: 3.3.1
+      keyv: 4.5.4
+
   flatstr@1.0.12: {}
 
   flatted@3.3.1: {}
@@ -9187,6 +9483,8 @@ snapshots:
     dependencies:
       type-fest: 0.20.2
 
+  globals@14.0.0: {}
+
   globals@15.8.0: {}
 
   globalthis@1.0.4:
@@ -9740,8 +10038,6 @@ snapshots:
 
   jiti@1.21.6: {}
 
-  jju@1.4.0: {}
-
   js-beautify@1.15.1:
     dependencies:
       config-chain: 1.1.13
@@ -10372,6 +10668,22 @@ snapshots:
   negotiator@0.6.3:
     optional: true
 
+  neostandard@0.11.0(eslint@9.7.0)(typescript@5.5.3):
+    dependencies:
+      '@humanwhocodes/gitignore-to-minimatch': 1.0.2
+      '@stylistic/eslint-plugin': 2.6.0-beta.0(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      eslint: 9.7.0
+      eslint-plugin-n: 17.9.0(eslint@9.7.0)
+      eslint-plugin-promise: 6.4.0(eslint@9.7.0)
+      find-up: 5.0.0
+      globals: 15.8.0
+      peowly: 1.3.2
+      typescript-eslint: 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+    transitivePeerDependencies:
+      - supports-color
+      - typescript
+
   next-tick@1.1.0: {}
 
   no-case@2.3.2:
@@ -10683,6 +10995,8 @@ snapshots:
       safe-buffer: 5.2.1
       sha.js: 2.4.11
 
+  peowly@1.3.2: {}
+
   performance-now@2.1.0: {}
 
   pg-connection-string@2.6.2: {}
@@ -10691,6 +11005,8 @@ snapshots:
 
   picomatch@2.3.1: {}
 
+  picomatch@4.0.2: {}
+
   pidtree@0.6.0: {}
 
   pify@2.3.0: {}
@@ -11756,6 +12072,17 @@ snapshots:
 
   typedarray@0.0.6: {}
 
+  typescript-eslint@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3):
+    dependencies:
+      '@typescript-eslint/eslint-plugin': 8.0.0-alpha.42(@typescript-eslint/parser@8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3))(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/parser': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+      '@typescript-eslint/utils': 8.0.0-alpha.42(eslint@9.7.0)(typescript@5.5.3)
+    optionalDependencies:
+      typescript: 5.5.3
+    transitivePeerDependencies:
+      - eslint
+      - supports-color
+
   typescript@5.5.3: {}
 
   umd@3.0.3: {}
index bf54524b32ad93a7b167b340fce78e32c201b2b9..12dd76a483d34869f23bbf0af5684bbee21233de 100644 (file)
@@ -4,5 +4,9 @@ const isCIEnvironment = env.CI != null
 const isCFEnvironment = env.VCAP_APPLICATION != null
 if (isCFEnvironment === false && isCIEnvironment === false) {
   // eslint-disable-next-line n/no-unpublished-import
-  import('husky').then(husky => console.warn(husky.default()))
+  import('husky')
+    .then(husky => {
+      return console.warn(husky.default())
+    })
+    .catch(console.error)
 }
index fb2477d707f2b57a8f3bb0760a775a92f13ee5b2..fa9abfe24d611376b9896eb32737c32a3995fb4e 100644 (file)
@@ -2,9 +2,7 @@ import { env, exit } from 'node:process'
 
 const skipPreinstall = Number.parseInt(env.SKIP_PREINSTALL) || env.VCAP_APPLICATION != null
 if (skipPreinstall) {
-  // eslint-disable-next-line n/no-process-exit
   exit()
 } else {
-  // eslint-disable-next-line n/no-process-exit
   exit(1)
 }
index 9f1c4d39af45133373e889711eab2739e8c11da4..9bf1151e9dad2b4bea75d5c89936aa762be3cb35 100644 (file)
@@ -14,7 +14,7 @@ import {
   type StartTransactionResponse,
   type Status,
   StopTransactionReason,
-  type StopTransactionResponse
+  type StopTransactionResponse,
 } from '../types/index.js'
 import {
   clone,
@@ -25,7 +25,7 @@ import {
   logger,
   logPrefix,
   secureRandom,
-  sleep
+  sleep,
 } from '../utils/index.js'
 import type { ChargingStation } from './ChargingStation.js'
 import { checkChargingStation } from './Helpers.js'
@@ -34,8 +34,8 @@ import { isIdTagAuthorized } from './ocpp/index.js'
 
 export class AutomaticTransactionGenerator {
   private static readonly instances: Map<string, AutomaticTransactionGenerator> = new Map<
-  string,
-  AutomaticTransactionGenerator
+    string,
+    AutomaticTransactionGenerator
   >()
 
   public readonly connectorsStatus: Map<number, Status>
@@ -112,7 +112,7 @@ export class AutomaticTransactionGenerator {
     }
     if (!this.connectorsStatus.has(connectorId)) {
       logger.error(`${this.logPrefix(connectorId)} starting on non existing connector`)
-      throw new BaseError(`Connector ${connectorId} does not exist`)
+      throw new BaseError(`Connector ${connectorId.toString()} does not exist`)
     }
     if (this.connectorsStatus.get(connectorId)?.start === false) {
       this.internalStartConnector(connectorId, stopAbsoluteDuration).catch(Constants.EMPTY_FUNCTION)
@@ -124,7 +124,7 @@ export class AutomaticTransactionGenerator {
   public stopConnector (connectorId: number): void {
     if (!this.connectorsStatus.has(connectorId)) {
       logger.error(`${this.logPrefix(connectorId)} stopping on non existing connector`)
-      throw new BaseError(`Connector ${connectorId} does not exist`)
+      throw new BaseError(`Connector ${connectorId.toString()} does not exist`)
     }
     if (this.connectorsStatus.get(connectorId)?.start === true) {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -230,7 +230,8 @@ export class AutomaticTransactionGenerator {
           )
           logger.info(
             `${this.logPrefix(connectorId)} transaction started with id ${
-              this.chargingStation.getConnectorStatus(connectorId)?.transactionId
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              this.chargingStation.getConnectorStatus(connectorId)?.transactionId?.toString()
             } and will stop in ${formatDurationMilliSeconds(waitTrxEnd)}`
           )
           await sleep(waitTrxEnd)
@@ -243,8 +244,10 @@ export class AutomaticTransactionGenerator {
         ++this.connectorsStatus.get(connectorId)!.skippedTransactions
         logger.info(
           `${this.logPrefix(connectorId)} skipped consecutively ${
-            this.connectorsStatus.get(connectorId)?.skippedConsecutiveTransactions
-          }/${this.connectorsStatus.get(connectorId)?.skippedTransactions} transaction(s)`
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            this.connectorsStatus.get(connectorId)?.skippedConsecutiveTransactions.toString()
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          }/${this.connectorsStatus.get(connectorId)?.skippedTransactions.toString()} transaction(s)`
         )
       }
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -329,7 +332,7 @@ export class AutomaticTransactionGenerator {
       logger.info(
         `${this.logPrefix(
           connectorId
-        )} entered in transaction loop while the connector ${connectorId} is unavailable`
+        )} entered in transaction loop while the connector ${connectorId.toString()} is unavailable`
       )
       return false
     }
@@ -337,8 +340,9 @@ export class AutomaticTransactionGenerator {
     if (connectorStatus?.transactionStarted === true) {
       logger.info(
         `${this.logPrefix(connectorId)} entered in transaction loop while a transaction ${
-          connectorStatus.transactionId
-        } is already started on connector ${connectorId}`
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          connectorStatus.transactionId?.toString()
+        } is already started on connector ${connectorId.toString()}`
       )
       return false
     }
@@ -367,7 +371,7 @@ export class AutomaticTransactionGenerator {
         logger.info(
           `${this.logPrefix(
             connectorId
-          )} transaction loop waiting for connector ${connectorId} to be available`
+          )} transaction loop waiting for connector ${connectorId.toString()} to be available`
         )
         logged = true
       }
@@ -382,8 +386,9 @@ export class AutomaticTransactionGenerator {
       if (!logged) {
         logger.info(
           `${this.logPrefix(connectorId)} transaction loop waiting for started transaction ${
-            connectorStatus.transactionId
-          } on connector ${connectorId} to be stopped`
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            connectorStatus.transactionId?.toString()
+          } on connector ${connectorId.toString()} to be stopped`
         )
         logged = true
       }
@@ -413,7 +418,7 @@ export class AutomaticTransactionGenerator {
     const statusIndex = connectorId - 1
     if (statusIndex < 0) {
       logger.error(`${this.logPrefix(connectorId)} invalid connector id`)
-      throw new BaseError(`Invalid connector id ${connectorId}`)
+      throw new BaseError(`Invalid connector id ${connectorId.toString()}`)
     }
     let connectorStatus: Status | undefined
     if (this.chargingStation.getAutomaticTransactionGeneratorStatuses()?.[statusIndex] != null) {
@@ -425,7 +430,7 @@ export class AutomaticTransactionGenerator {
       logger.warn(
         `${this.logPrefix(
           connectorId
-        )} no status found for connector #${connectorId} in charging station configuration file. New status will be created`
+        )} no status found for connector #${connectorId.toString()} in charging station configuration file. New status will be created`
       )
     }
     if (connectorStatus != null) {
@@ -454,7 +459,7 @@ export class AutomaticTransactionGenerator {
         acceptedStopTransactionRequests: 0,
         rejectedStopTransactionRequests: 0,
         skippedConsecutiveTransactions: 0,
-        skippedTransactions: 0
+        skippedTransactions: 0,
       }
     )
   }
@@ -484,11 +489,11 @@ export class AutomaticTransactionGenerator {
           logger.info(startTransactionLogMsg)
           // Start transaction
           startResponse = await this.chargingStation.ocppRequestService.requestHandler<
-          Partial<StartTransactionRequest>,
-          StartTransactionResponse
+            Partial<StartTransactionRequest>,
+            StartTransactionResponse
           >(this.chargingStation, RequestCommand.START_TRANSACTION, {
             connectorId,
-            idTag
+            idTag,
           })
           this.handleStartTransactionResponse(connectorId, startResponse)
           PerformanceStatistics.endMeasure(measureId, beginId)
@@ -502,11 +507,11 @@ export class AutomaticTransactionGenerator {
       logger.info(startTransactionLogMsg)
       // Start transaction
       startResponse = await this.chargingStation.ocppRequestService.requestHandler<
-      Partial<StartTransactionRequest>,
-      StartTransactionResponse
+        Partial<StartTransactionRequest>,
+        StartTransactionResponse
       >(this.chargingStation, RequestCommand.START_TRANSACTION, {
         connectorId,
-        idTag
+        idTag,
       })
       this.handleStartTransactionResponse(connectorId, startResponse)
       PerformanceStatistics.endMeasure(measureId, beginId)
@@ -514,10 +519,10 @@ export class AutomaticTransactionGenerator {
     }
     logger.info(`${this.logPrefix(connectorId)} start transaction without an idTag`)
     startResponse = await this.chargingStation.ocppRequestService.requestHandler<
-    Partial<StartTransactionRequest>,
-    StartTransactionResponse
+      Partial<StartTransactionRequest>,
+      StartTransactionResponse
     >(this.chargingStation, RequestCommand.START_TRANSACTION, {
-      connectorId
+      connectorId,
     })
     this.handleStartTransactionResponse(connectorId, startResponse)
     PerformanceStatistics.endMeasure(measureId, beginId)
@@ -534,7 +539,8 @@ export class AutomaticTransactionGenerator {
     if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
       logger.info(
         `${this.logPrefix(connectorId)} stop transaction with id ${
-          this.chargingStation.getConnectorStatus(connectorId)?.transactionId
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          this.chargingStation.getConnectorStatus(connectorId)?.transactionId?.toString()
         }`
       )
       stopResponse = await this.chargingStation.stopTransactionOnConnector(connectorId, reason)
@@ -551,7 +557,7 @@ export class AutomaticTransactionGenerator {
       const transactionId = this.chargingStation.getConnectorStatus(connectorId)?.transactionId
       logger.debug(
         `${this.logPrefix(connectorId)} stopping a not started transaction${
-          transactionId != null ? ` with id ${transactionId}` : ''
+          transactionId != null ? ` with id ${transactionId.toString()}` : ''
         }`
       )
     }
@@ -567,8 +573,9 @@ export class AutomaticTransactionGenerator {
 
   private readonly logPrefix = (connectorId?: number): string => {
     return logPrefix(
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       ` ${this.chargingStation.stationInfo?.chargingStationId} | ATG${
-        connectorId != null ? ` on connector #${connectorId}` : ''
+        connectorId != null ? ` on connector #${connectorId.toString()}` : ''
       }:`
     )
   }
index d12f78f9b326e79152a11e33d3ccf9f09f2bd2d6..a0b620daef9d48f978835391f54e72990f8b8fa1 100644 (file)
@@ -28,7 +28,7 @@ import {
   type StorageConfiguration,
   type TemplateStatistics,
   type UIServerConfiguration,
-  type WorkerConfiguration
+  type WorkerConfiguration,
 } from '../types/index.js'
 import {
   Configuration,
@@ -40,7 +40,7 @@ import {
   isAsyncFunction,
   isNotEmptyArray,
   logger,
-  logPrefix
+  logPrefix,
 } from '../utils/index.js'
 import { DEFAULT_ELEMENTS_PER_WORKER, type WorkerAbstract, WorkerFactory } from '../worker/index.js'
 import { buildTemplateName, waitChargingStationEvents } from './Helpers.js'
@@ -126,7 +126,7 @@ export class Bootstrap extends EventEmitter {
       version: this.version,
       configuration: Configuration.getConfigurationData(),
       started: this.started,
-      templateStatistics: this.templateStatistics
+      templateStatistics: this.templateStatistics,
     }
   }
 
@@ -178,7 +178,7 @@ export class Bootstrap extends EventEmitter {
         if (isAsyncFunction(this.workerImplementation?.start)) {
           await this.workerImplementation.start()
         } else {
-          (this.workerImplementation?.start as () => void)()
+          ;(this.workerImplementation?.start as () => void)()
         }
         const performanceStorageConfiguration =
           Configuration.getConfigurationSection<StorageConfiguration>(
@@ -226,18 +226,22 @@ export class Bootstrap extends EventEmitter {
         console.info(
           chalk.green(
             `Charging stations simulator ${this.version} started with ${
-              this.numberOfConfiguredChargingStations
+              this.numberOfConfiguredChargingStations.toString()
             } configured and ${
-              this.numberOfProvisionedChargingStations
+              this.numberOfProvisionedChargingStations.toString()
             } provisioned charging station(s) from ${
-              this.numberOfChargingStationTemplates
+              this.numberOfChargingStationTemplates.toString()
             } charging station template(s) and ${
-              Configuration.workerDynamicPoolInUse() ? `${workerConfiguration.poolMinSize}/` : ''
-            }${this.workerImplementation?.size}${
-              Configuration.workerPoolInUse() ? `/${workerConfiguration.poolMaxSize}` : ''
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              Configuration.workerDynamicPoolInUse() ? `${workerConfiguration.poolMinSize?.toString()}/` : ''
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            }${this.workerImplementation?.size.toString()}${
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              Configuration.workerPoolInUse() ? `/${workerConfiguration.poolMaxSize?.toString()}` : ''
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             } worker(s) concurrently running in '${workerConfiguration.processType}' mode${
               this.workerImplementation?.maxElementsPerWorker != null
-                ? ` (${this.workerImplementation.maxElementsPerWorker} charging station(s) per worker)`
+                ? ` (${this.workerImplementation.maxElementsPerWorker.toString()} charging station(s) per worker)`
                 : ''
             }`
           )
@@ -322,13 +326,14 @@ export class Bootstrap extends EventEmitter {
         ChargingStationWorkerMessageEvents.stopped,
         this.numberOfStartedChargingStations
       )
-        .then(() => {
+        .then((events) => {
           resolve('Charging stations stopped')
+          return events
         })
-        .catch(reject)
         .finally(() => {
           clearTimeout(waitTimeout)
         })
+        .catch(reject)
     })
   }
 
@@ -357,8 +362,8 @@ export class Bootstrap extends EventEmitter {
         elementsPerWorker = workerConfiguration.elementsPerWorker ?? DEFAULT_ELEMENTS_PER_WORKER
     }
     this.workerImplementation = WorkerFactory.getWorkerImplementation<
-    ChargingStationWorkerData,
-    ChargingStationInfo
+      ChargingStationWorkerData,
+      ChargingStationInfo
     >(
       join(
         dirname(fileURLToPath(import.meta.url)),
@@ -378,10 +383,10 @@ export class Bootstrap extends EventEmitter {
           messageHandler: this.messageHandler.bind(this) as MessageHandler<Worker>,
           ...(workerConfiguration.resourceLimits != null && {
             workerOptions: {
-              resourceLimits: workerConfiguration.resourceLimits
-            }
-          })
-        }
+              resourceLimits: workerConfiguration.resourceLimits,
+            },
+          }),
+        },
       }
     )
   }
@@ -443,11 +448,12 @@ export class Bootstrap extends EventEmitter {
     this.uiServer.chargingStations.set(data.stationInfo.hashId, data)
     logger.info(
       `${this.logPrefix()} ${moduleName}.workerEventAdded: Charging station ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) added (${
-        this.numberOfAddedChargingStations
-      } added from ${this.numberOfConfiguredChargingStations} configured and ${
-        this.numberOfProvisionedChargingStations
+        this.numberOfAddedChargingStations.toString()
+      } added from ${this.numberOfConfiguredChargingStations.toString()} configured and ${
+        this.numberOfProvisionedChargingStations.toString()
       } provisioned charging station(s))`
     )
   }
@@ -460,11 +466,12 @@ export class Bootstrap extends EventEmitter {
     templateStatistics.indexes.delete(data.stationInfo.templateIndex)
     logger.info(
       `${this.logPrefix()} ${moduleName}.workerEventDeleted: Charging station ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) deleted (${
-        this.numberOfAddedChargingStations
-      } added from ${this.numberOfConfiguredChargingStations} configured and ${
-        this.numberOfProvisionedChargingStations
+        this.numberOfAddedChargingStations.toString()
+      } added from ${this.numberOfConfiguredChargingStations.toString()} configured and ${
+        this.numberOfProvisionedChargingStations.toString()
       } provisioned charging station(s))`
     )
   }
@@ -475,10 +482,11 @@ export class Bootstrap extends EventEmitter {
     ++this.templateStatistics.get(data.stationInfo.templateName)!.started
     logger.info(
       `${this.logPrefix()} ${moduleName}.workerEventStarted: Charging station ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) started (${
-        this.numberOfStartedChargingStations
-      } started from ${this.numberOfAddedChargingStations} added charging station(s))`
+        this.numberOfStartedChargingStations.toString()
+      } started from ${this.numberOfAddedChargingStations.toString()} added charging station(s))`
     )
   }
 
@@ -488,10 +496,11 @@ export class Bootstrap extends EventEmitter {
     --this.templateStatistics.get(data.stationInfo.templateName)!.started
     logger.info(
       `${this.logPrefix()} ${moduleName}.workerEventStopped: Charging station ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         data.stationInfo.chargingStationId
       } (hashId: ${data.stationInfo.hashId}) stopped (${
-        this.numberOfStartedChargingStations
-      } started from ${this.numberOfAddedChargingStations} added charging station(s))`
+        this.numberOfStartedChargingStations.toString()
+      } started from ${this.numberOfAddedChargingStations.toString()} added charging station(s))`
     )
   }
 
@@ -502,13 +511,13 @@ export class Bootstrap extends EventEmitter {
   private readonly workerEventPerformanceStatistics = (data: Statistics): void => {
     // eslint-disable-next-line @typescript-eslint/unbound-method
     if (isAsyncFunction(this.storage?.storePerformanceStatistics)) {
-      (
+      ;(
         this.storage.storePerformanceStatistics as (
           performanceStatistics: Statistics
         ) => Promise<void>
       )(data).catch(Constants.EMPTY_FUNCTION)
     } else {
-      (this.storage?.storePerformanceStatistics as (performanceStatistics: Statistics) => void)(
+      ;(this.storage?.storePerformanceStatistics as (performanceStatistics: Statistics) => void)(
         data
       )
     }
@@ -525,7 +534,7 @@ export class Bootstrap extends EventEmitter {
           provisioned: stationTemplateUrl.provisionedNumberOfStations ?? 0,
           added: 0,
           started: 0,
-          indexes: new Set<number>()
+          indexes: new Set<number>(),
         })
         this.uiServer.chargingStationTemplates.add(templateName)
       }
@@ -575,7 +584,7 @@ export class Bootstrap extends EventEmitter {
         'station-templates',
         templateFile
       ),
-      options
+      options,
     })
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const templateStatistics = this.templateStatistics.get(buildTemplateName(templateFile))!
@@ -591,12 +600,15 @@ export class Bootstrap extends EventEmitter {
         this.uiServer.stop()
         this.uiServerStarted = false
         this.waitChargingStationsStopped()
+          // eslint-disable-next-line promise/no-nesting
           .then(() => {
-            exit(exitCodes.succeeded)
+            return exit(exitCodes.succeeded)
           })
+          // eslint-disable-next-line promise/no-nesting
           .catch(() => {
             exit(exitCodes.gracefulShutdownError)
           })
+        return undefined
       })
       .catch((error: unknown) => {
         console.error(chalk.red('Error while shutdowning charging stations simulator: '), error)
index e217991ac8aad3c7c4256010687929df0f0162a3..7f7e0802c4e57a98f3b32c508147c05ef16375dc 100644 (file)
@@ -64,7 +64,7 @@ import {
   type Voltage,
   WebSocketCloseEventStatusCode,
   type WSError,
-  type WsOptions
+  type WsOptions,
 } from '../types/index.js'
 import {
   ACElectricUtils,
@@ -98,7 +98,7 @@ import {
   roundTo,
   secureRandom,
   sleep,
-  watchJsonFile
+  watchJsonFile,
 } from '../utils/index.js'
 import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
 import { ChargingStationWorkerBroadcastChannel } from './broadcast-channel/ChargingStationWorkerBroadcastChannel.js'
@@ -106,7 +106,7 @@ import {
   addConfigurationKey,
   deleteConfigurationKey,
   getConfigurationKey,
-  setConfigurationKeyValue
+  setConfigurationKeyValue,
 } from './ConfigurationKeyUtils.js'
 import {
   buildConnectorsMap,
@@ -136,7 +136,7 @@ import {
   propagateSerialNumber,
   setChargingStationOptions,
   stationTemplateToStationInfo,
-  warnTemplateKeysDeprecation
+  warnTemplateKeysDeprecation,
 } from './Helpers.js'
 import { IdTagsCache } from './IdTagsCache.js'
 import {
@@ -151,7 +151,7 @@ import {
   OCPP20ResponseService,
   type OCPPIncomingRequestService,
   type OCPPRequestService,
-  sendAndSetConnectorStatus
+  sendAndSetConnectorStatus,
 } from './ocpp/index.js'
 import { SharedLRUCache } from './SharedLRUCache.js'
 
@@ -267,6 +267,7 @@ export class ChargingStation extends EventEmitter {
 
   public get wsConnectionUrl (): URL {
     const wsConnectionBaseUrlStr = `${
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       this.stationInfo?.supervisionUrlOcppConfiguration === true &&
       isNotEmptyString(this.stationInfo.supervisionUrlOcppKey) &&
       isNotEmptyString(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey)?.value)
@@ -276,6 +277,7 @@ export class ChargingStation extends EventEmitter {
     return new URL(
       `${wsConnectionBaseUrlStr}${
         !wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       }${this.stationInfo?.chargingStationId}`
     )
   }
@@ -424,8 +426,8 @@ export class ChargingStation extends EventEmitter {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       isNaN(connectorAmperageLimitationLimit!)
         ? Number.POSITIVE_INFINITY
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        connectorAmperageLimitationLimit!,
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        connectorAmperageLimitationLimit!,
       isNaN(chargingStationChargingProfilesLimit)
         ? Number.POSITIVE_INFINITY
         : chargingStationChargingProfilesLimit,
@@ -543,7 +545,7 @@ export class ChargingStation extends EventEmitter {
     this.stationInfo?.autoRegister === false &&
       logger.warn(
         `${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${
-          Constants.DEFAULT_HEARTBEAT_INTERVAL
+          Constants.DEFAULT_HEARTBEAT_INTERVAL.toString()
         }`
       )
     return Constants.DEFAULT_HEARTBEAT_INTERVAL
@@ -589,7 +591,7 @@ export class ChargingStation extends EventEmitter {
       )
     } else {
       logger.error(
-        `${this.logPrefix()} Heartbeat interval set to ${heartbeatInterval}, not starting the heartbeat`
+        `${this.logPrefix()} Heartbeat interval set to ${heartbeatInterval.toString()}, not starting the heartbeat`
       )
     }
   }
@@ -610,20 +612,20 @@ export class ChargingStation extends EventEmitter {
 
   public startMeterValues (connectorId: number, interval: number): void {
     if (connectorId === 0) {
-      logger.error(`${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId}`)
+      logger.error(`${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId.toString()}`)
       return
     }
     const connectorStatus = this.getConnectorStatus(connectorId)
     if (connectorStatus == null) {
       logger.error(
         `${this.logPrefix()} Trying to start MeterValues on non existing connector id
-          ${connectorId}`
+          ${connectorId.toString()}`
       )
       return
     }
     if (connectorStatus.transactionStarted === false) {
       logger.error(
-        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId} with no transaction started`
+        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId.toString()} with no transaction started`
       )
       return
     } else if (
@@ -631,7 +633,7 @@ export class ChargingStation extends EventEmitter {
       connectorStatus.transactionId == null
     ) {
       logger.error(
-        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId} with no transaction id`
+        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId.toString()} with no transaction id`
       )
       return
     }
@@ -646,14 +648,14 @@ export class ChargingStation extends EventEmitter {
         )
         this.ocppRequestService
           .requestHandler<MeterValuesRequest, MeterValuesResponse>(
-          this,
-          RequestCommand.METER_VALUES,
-          {
-            connectorId,
-            transactionId: connectorStatus.transactionId,
-            meterValue: [meterValue]
-          }
-        )
+            this,
+            RequestCommand.METER_VALUES,
+            {
+              connectorId,
+              transactionId: connectorStatus.transactionId,
+              meterValue: [meterValue],
+            }
+          )
           .catch((error: unknown) => {
             logger.error(
               `${this.logPrefix()} Error while sending '${RequestCommand.METER_VALUES}':`,
@@ -665,7 +667,7 @@ export class ChargingStation extends EventEmitter {
       logger.error(
         `${this.logPrefix()} Charging station ${
           StandardParametersKey.MeterValueSampleInterval
-        } configuration set to ${interval}, not sending MeterValues`
+        } configuration set to ${interval.toString()}, not sending MeterValues`
       )
     }
   }
@@ -817,12 +819,12 @@ export class ChargingStation extends EventEmitter {
 
   public openWSConnection (
     options?: WsOptions,
-    params?: { closeOpened?: boolean, terminateOpened?: boolean }
+    params?: { closeOpened?: boolean; terminateOpened?: boolean }
   ): void {
     options = {
       handshakeTimeout: secondsToMilliseconds(this.getConnectionTimeout()),
       ...this.stationInfo?.wsOptions,
-      ...options
+      ...options,
     }
     params = { ...{ closeOpened: false, terminateOpened: false }, ...params }
     if (!checkChargingStation(this, this.logPrefix())) {
@@ -831,10 +833,10 @@ export class ChargingStation extends EventEmitter {
     if (this.stationInfo?.supervisionUser != null && this.stationInfo.supervisionPassword != null) {
       options.auth = `${this.stationInfo.supervisionUser}:${this.stationInfo.supervisionPassword}`
     }
-    if (params.closeOpened === true) {
+    if (params.closeOpened) {
       this.closeWSConnection()
     }
-    if (params.terminateOpened === true) {
+    if (params.terminateOpened) {
       this.terminateWSConnection()
     }
 
@@ -849,6 +851,7 @@ export class ChargingStation extends EventEmitter {
 
     this.wsConnection = new WebSocket(
       this.wsConnectionUrl,
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       `ocpp${this.stationInfo?.ocppVersion}`,
       options
     )
@@ -881,12 +884,12 @@ export class ChargingStation extends EventEmitter {
   }
 
   public getAutomaticTransactionGeneratorConfiguration ():
-  | AutomaticTransactionGeneratorConfiguration
-  | undefined {
+    | AutomaticTransactionGeneratorConfiguration
+    | undefined {
     if (this.automaticTransactionGeneratorConfiguration == null) {
       let automaticTransactionGeneratorConfiguration:
-      | AutomaticTransactionGeneratorConfiguration
-      | undefined
+        | AutomaticTransactionGeneratorConfiguration
+        | undefined
       const stationTemplate = this.getTemplateFromFile()
       const stationConfiguration = this.getConfigurationFromFile()
       if (
@@ -901,7 +904,7 @@ export class ChargingStation extends EventEmitter {
       }
       this.automaticTransactionGeneratorConfiguration = {
         ...Constants.DEFAULT_ATG_CONFIGURATION,
-        ...automaticTransactionGeneratorConfiguration
+        ...automaticTransactionGeneratorConfiguration,
       }
     }
     return this.automaticTransactionGeneratorConfiguration
@@ -960,17 +963,17 @@ export class ChargingStation extends EventEmitter {
         {
           connectorId,
           transactionId,
-          meterValue: [transactionEndMeterValue]
+          meterValue: [transactionEndMeterValue],
         }
       )
     }
     return await this.ocppRequestService.requestHandler<
-    Partial<StopTransactionRequest>,
-    StopTransactionResponse
+      Partial<StopTransactionRequest>,
+      StopTransactionResponse
     >(this, RequestCommand.STOP_TRANSACTION, {
       transactionId,
       meterStop: this.getEnergyActiveImportRegisterByTransactionId(transactionId, true),
-      ...(reason != null && { reason })
+      ...(reason != null && { reason }),
     })
   }
 
@@ -1119,7 +1122,7 @@ export class ChargingStation extends EventEmitter {
         const [messageType] = JSON.parse(message) as OutgoingRequest | Response | ErrorResponse
         const isRequest = messageType === MessageType.CALL_MESSAGE
         if (isRequest) {
-          [, , commandName] = JSON.parse(message) as OutgoingRequest
+          ;[, , commandName] = JSON.parse(message) as OutgoingRequest
           beginId = PerformanceStatistics.beginMeasure(commandName)
         }
         this.wsConnection?.send(message, (error?: Error) => {
@@ -1224,7 +1227,7 @@ export class ChargingStation extends EventEmitter {
       .stationInfoPersistentConfiguration
   ): ChargingStationInfo | undefined {
     let stationInfo: ChargingStationInfo | undefined
-    if (stationInfoPersistentConfiguration === true) {
+    if (stationInfoPersistentConfiguration) {
       stationInfo = this.getConfigurationFromFile()?.stationInfo
       if (stationInfo != null) {
         delete stationInfo.infoHash
@@ -1276,6 +1279,7 @@ export class ChargingStation extends EventEmitter {
   }
 
   private handleUnsupportedVersion (version: OCPPVersion | undefined): void {
+    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
     const errorMsg = `Unsupported protocol version '${version}' configured in template file ${this.templateFile}`
     logger.error(`${this.logPrefix()} ${errorMsg}`)
     throw new BaseError(errorMsg)
@@ -1346,7 +1350,7 @@ export class ChargingStation extends EventEmitter {
       this.bootNotificationResponse = {
         currentTime: new Date(),
         interval: millisecondsToSeconds(this.getHeartbeatInterval()),
-        status: RegistrationStatusEnumType.ACCEPTED
+        status: RegistrationStatusEnumType.ACCEPTED,
       }
     }
   }
@@ -1381,7 +1385,7 @@ export class ChargingStation extends EventEmitter {
     }
     if (getConfigurationKey(this, StandardParametersKey.HeartBeatInterval) == null) {
       addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', {
-        visible: false
+        visible: false,
       })
     }
     if (
@@ -1401,7 +1405,7 @@ export class ChargingStation extends EventEmitter {
       getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey) != null
     ) {
       deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey, {
-        save: false
+        save: false,
       })
     }
     if (
@@ -1450,10 +1454,8 @@ export class ChargingStation extends EventEmitter {
         }
       } else {
         for (const connectorId of this.connectors.keys()) {
-          connectorsPhaseRotation.push(
-            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-            getPhaseRotationValue(connectorId, this.getNumberOfPhases())!
-          )
+          // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+          connectorsPhaseRotation.push(getPhaseRotationValue(connectorId, this.getNumberOfPhases())!)
         }
       }
       addConfigurationKey(
@@ -1499,9 +1501,9 @@ export class ChargingStation extends EventEmitter {
             // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
             evseStatusConfiguration.connectorsStatus!.map((connectorStatus, connectorId) => [
               connectorId,
-              prepareConnectorStatus(connectorStatus)
+              prepareConnectorStatus(connectorStatus),
             ])
-          )
+          ),
         })
       }
     } else if (configuration.evsesStatus != null && configuration.connectorsStatus != null) {
@@ -1645,7 +1647,7 @@ export class ChargingStation extends EventEmitter {
                 this.logPrefix(),
                 this.templateFile
               ),
-              availability: AvailabilityType.Operative
+              availability: AvailabilityType.Operative,
             })
             // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
             initializeConnectorsMapStatus(this.evses.get(evseId)!.connectors, this.logPrefix())
@@ -1762,11 +1764,11 @@ export class ChargingStation extends EventEmitter {
               configurationKey: configurationData.configurationKey,
               automaticTransactionGenerator: configurationData.automaticTransactionGenerator,
               ...(this.connectors.size > 0 && {
-                connectorsStatus: configurationData.connectorsStatus
+                connectorsStatus: configurationData.connectorsStatus,
               }),
               ...(this.evses.size > 0 && {
-                evsesStatus: configurationData.evsesStatus
-              })
+                evsesStatus: configurationData.evsesStatus,
+              }),
             } satisfies ChargingStationConfiguration)
           )
           .digest('hex')
@@ -1822,7 +1824,7 @@ export class ChargingStation extends EventEmitter {
     ocppPersistentConfiguration?: boolean
   ): ChargingStationOcppConfiguration | undefined {
     const configurationKey = this.getConfigurationFromFile()?.configurationKey
-    if (ocppPersistentConfiguration === true && Array.isArray(configurationKey)) {
+    if (ocppPersistentConfiguration && Array.isArray(configurationKey)) {
       return { configurationKey }
     }
     return undefined
@@ -1853,10 +1855,10 @@ export class ChargingStation extends EventEmitter {
         // Send BootNotification
         do {
           await this.ocppRequestService.requestHandler<
-          BootNotificationRequest,
-          BootNotificationResponse
+            BootNotificationRequest,
+            BootNotificationResponse
           >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
-            skipBufferingOnError: true
+            skipBufferingOnError: true,
           })
           // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
           this.bootNotificationResponse!.currentTime = convertToDate(
@@ -1865,7 +1867,6 @@ export class ChargingStation extends EventEmitter {
           if (!this.isRegistered()) {
             this.stationInfo?.registrationMaxRetries !== -1 && ++registrationRetryCount
             await sleep(
-              // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
               this.bootNotificationResponse?.interval != null
                 ? secondsToMilliseconds(this.bootNotificationResponse.interval)
                 : Constants.DEFAULT_BOOT_NOTIFICATION_INTERVAL
@@ -1880,8 +1881,9 @@ export class ChargingStation extends EventEmitter {
       }
       if (!this.isRegistered()) {
         logger.error(
-          `${this.logPrefix()} Registration failure: maximum retries reached (${registrationRetryCount}) or retry disabled (${
-            this.stationInfo?.registrationMaxRetries
+          `${this.logPrefix()} Registration failure: maximum retries reached (${registrationRetryCount.toString()}) or retry disabled (${
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            this.stationInfo?.registrationMaxRetries?.toString()
           })`
         )
       }
@@ -1918,6 +1920,7 @@ export class ChargingStation extends EventEmitter {
           this.reconnect()
             .then(() => {
               this.emit(ChargingStationEvents.updated)
+              return undefined
             })
             .catch((error: unknown) =>
               logger.error(`${this.logPrefix()} Error while reconnecting:`, error)
@@ -2026,7 +2029,7 @@ export class ChargingStation extends EventEmitter {
       // eslint-disable-next-line @typescript-eslint/no-base-to-string
       request = JSON.parse(data.toString()) as IncomingRequest | Response | ErrorResponse
       if (Array.isArray(request)) {
-        [messageType] = request
+        ;[messageType] = request
         // Check the type of message
         switch (messageType) {
           // Incoming Message
@@ -2054,12 +2057,13 @@ export class ChargingStation extends EventEmitter {
           'Incoming message is not an array',
           undefined,
           {
-            request
+            request,
           }
         )
       }
     } catch (error) {
       if (!Array.isArray(request)) {
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         logger.error(`${this.logPrefix()} Incoming message '${request}' parsing error:`, error)
         return
       }
@@ -2069,7 +2073,7 @@ export class ChargingStation extends EventEmitter {
       const [, messageId] = request
       switch (messageType) {
         case MessageType.CALL_MESSAGE:
-          [, , commandName] = request as IncomingRequest
+          ;[, , commandName] = request as IncomingRequest
           // Send error
           await this.ocppRequestService.sendError(this, messageId, error as OCPPError, commandName)
           break
@@ -2077,7 +2081,7 @@ export class ChargingStation extends EventEmitter {
         case MessageType.CALL_ERROR_MESSAGE:
           if (this.requests.has(messageId)) {
             // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-            [, errorCallback, requestCommandName] = this.getCachedRequest(messageType, messageId)!
+            ;[, errorCallback, requestCommandName] = this.getCachedRequest(messageType, messageId)!
             // Reject the deferred promise in case of error at response handling (rejecting an already fulfilled promise is a no-op)
             errorCallback(error as OCPPError, false)
           } else {
@@ -2090,7 +2094,7 @@ export class ChargingStation extends EventEmitter {
         logger.warn(
           `${this.logPrefix()} Error thrown at incoming OCPP command ${
             commandName ?? requestCommandName ?? Constants.UNKNOWN_OCPP_COMMAND
-            // eslint-disable-next-line @typescript-eslint/no-base-to-string
+          // eslint-disable-next-line @typescript-eslint/no-base-to-string
           } message '${data.toString()}' handling is not an OCPPError:`,
           error
         )
@@ -2098,7 +2102,7 @@ export class ChargingStation extends EventEmitter {
       logger.error(
         `${this.logPrefix()} Incoming OCPP command '${
           commandName ?? requestCommandName ?? Constants.UNKNOWN_OCPP_COMMAND
-          // eslint-disable-next-line @typescript-eslint/no-base-to-string
+        // eslint-disable-next-line @typescript-eslint/no-base-to-string
         }' message '${data.toString()}'${
           this.requests.has(messageId)
             ? ` matching cached request '${JSON.stringify(
@@ -2238,10 +2242,10 @@ export class ChargingStation extends EventEmitter {
   private async startMessageSequence (ATGStopAbsoluteDuration?: boolean): Promise<void> {
     if (this.stationInfo?.autoRegister === true) {
       await this.ocppRequestService.requestHandler<
-      BootNotificationRequest,
-      BootNotificationResponse
+        BootNotificationRequest,
+        BootNotificationResponse
       >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
-        skipBufferingOnError: true
+        skipBufferingOnError: true,
       })
     }
     // Start WebSocket ping
@@ -2284,10 +2288,10 @@ export class ChargingStation extends EventEmitter {
     }
     if (this.stationInfo?.firmwareStatus === FirmwareStatus.Installing) {
       await this.ocppRequestService.requestHandler<
-      FirmwareStatusNotificationRequest,
-      FirmwareStatusNotificationResponse
+        FirmwareStatusNotificationRequest,
+        FirmwareStatusNotificationResponse
       >(this, RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-        status: FirmwareStatus.Installed
+        status: FirmwareStatus.Installed,
       })
       this.stationInfo.firmwareStatus = FirmwareStatus.Installed
     }
@@ -2316,7 +2320,7 @@ export class ChargingStation extends EventEmitter {
   ): Promise<void> {
     this.internalStopMessageSequence()
     // Stop ongoing transactions
-    stopTransactions === true && (await this.stopRunningTransactions(reason))
+    stopTransactions && (await this.stopRunningTransactions(reason))
     if (this.hasEvses) {
       for (const [evseId, evseStatus] of this.evses) {
         if (evseId > 0) {
@@ -2368,7 +2372,7 @@ export class ChargingStation extends EventEmitter {
       )
     } else {
       logger.error(
-        `${this.logPrefix()} WebSocket ping interval set to ${webSocketPingInterval}, not starting the WebSocket ping`
+        `${this.logPrefix()} WebSocket ping interval set to ${webSocketPingInterval.toString()}, not starting the WebSocket ping`
       )
     }
   }
@@ -2397,7 +2401,7 @@ export class ChargingStation extends EventEmitter {
             Configuration.getSupervisionUrlDistribution()!
           ) &&
             logger.warn(
-              // eslint-disable-next-line @typescript-eslint/no-base-to-string
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-base-to-string
               `${this.logPrefix()} Unknown supervision url distribution '${Configuration.getSupervisionUrlDistribution()}' in configuration from values '${SupervisionUrlDistribution.toString()}', defaulting to '${
                 SupervisionUrlDistribution.CHARGING_STATION_AFFINITY
               }'`
@@ -2450,7 +2454,7 @@ export class ChargingStation extends EventEmitter {
         `${this.logPrefix()} WebSocket connection retry in ${roundTo(
           reconnectDelay,
           2
-        )}ms, timeout ${reconnectTimeout}ms`
+        ).toString()}ms, timeout ${reconnectTimeout.toString()}ms`
       )
       await sleep(reconnectDelay)
       logger.error(
@@ -2458,12 +2462,13 @@ export class ChargingStation extends EventEmitter {
       )
       this.openWSConnection(
         {
-          handshakeTimeout: reconnectTimeout
+          handshakeTimeout: reconnectTimeout,
         },
         { closeOpened: true }
       )
     } else if (this.stationInfo?.autoReconnectMaxRetries !== -1) {
       logger.error(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `${this.logPrefix()} WebSocket connection retries failure: maximum retries reached (${this.wsConnectionRetryCount.toString()}) or retries disabled (${this.stationInfo?.autoReconnectMaxRetries?.toString()})`
       )
     }
index ab32a464fabbcf3ca3ee2e20a7c48d685945f327..581cd9422751c94c08d11c8ffe0cd9a2dce6e744 100644 (file)
@@ -13,8 +13,8 @@ import { ChargingStation } from './ChargingStation.js'
 export let chargingStationWorker: object
 if (Configuration.workerPoolInUse()) {
   chargingStationWorker = new ThreadWorker<
-  ChargingStationWorkerData,
-  ChargingStationInfo | undefined
+    ChargingStationWorkerData,
+    ChargingStationInfo | undefined
   >((data?: ChargingStationWorkerData): ChargingStationInfo | undefined => {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const { index, templateFile, options } = data!
@@ -40,7 +40,7 @@ if (Configuration.workerPoolInUse()) {
                   uuid,
                   event: WorkerMessageEvents.addedWorkerElement,
                   // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-                  data: chargingStation.stationInfo!
+                  data: chargingStation.stationInfo!,
                 } satisfies WorkerMessage<ChargingStationInfo>)
               } catch (error) {
                 parentPort?.postMessage({
@@ -50,8 +50,8 @@ if (Configuration.workerPoolInUse()) {
                     event,
                     name: (error as Error).name,
                     message: (error as Error).message,
-                    stack: (error as Error).stack
-                  }
+                    stack: (error as Error).stack,
+                  },
                 } satisfies WorkerMessage<WorkerDataError>)
               }
               break
index 4b9eb40aa211f9c5d5c651aae0203bc8f330fb74..072ec9a93d99e6a7b5e7738c914b8867057cfd99 100644 (file)
@@ -40,15 +40,15 @@ export const addConfigurationKey = (
     ...{
       readonly: false,
       visible: true,
-      reboot: false
+      reboot: false,
     },
-    ...options
+    ...options,
   }
   params = { ...{ overwrite: false, save: false }, ...params }
   let keyFound = getConfigurationKey(chargingStation, key)
-  if (keyFound != null && params.overwrite === true) {
+  if (keyFound != null && params.overwrite) {
     deleteConfigurationKey(chargingStation, keyFound.key, {
-      save: false
+      save: false,
     })
     keyFound = undefined
   }
@@ -59,9 +59,9 @@ export const addConfigurationKey = (
       readonly: options.readonly!,
       value,
       visible: options.visible,
-      reboot: options.reboot
+      reboot: options.reboot,
     })
-    params.save === true && chargingStation.saveOcppConfiguration()
+    params.save && chargingStation.saveOcppConfiguration()
   } else {
     logger.error(
       `${chargingStation.logPrefix()} Trying to add an already existing configuration key: %j`,
@@ -105,7 +105,7 @@ export const deleteConfigurationKey = (
       chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound),
       1
     )
-    params.save === true && chargingStation.saveOcppConfiguration()
+    params.save && chargingStation.saveOcppConfiguration()
     return deletedConfigurationKey
   }
 }
index 6163f6780c379d0942e74f58a1b27aa04bd13503..0378d0f8a84ff38be8df85867e6f75b8cac50768 100644 (file)
@@ -18,7 +18,7 @@ import {
   isDate,
   isPast,
   isWithinInterval,
-  toDate
+  toDate,
 } from 'date-fns'
 import { maxTime } from 'date-fns/constants'
 import { isEmpty } from 'rambda'
@@ -52,7 +52,7 @@ import {
   ReservationTerminationReason,
   StandardParametersKey,
   type SupportedFeatureProfiles,
-  Voltage
+  Voltage,
 } from '../types/index.js'
 import {
   ACElectricUtils,
@@ -66,7 +66,7 @@ import {
   isNotEmptyString,
   isValidDate,
   logger,
-  secureRandom
+  secureRandom,
 } from '../utils/index.js'
 import type { ChargingStation } from './ChargingStation.js'
 import { getConfigurationKey } from './ConfigurationKeyUtils.js'
@@ -158,17 +158,17 @@ export const getHashId = (index: number, stationTemplate: ChargingStationTemplat
     chargePointModel: stationTemplate.chargePointModel,
     chargePointVendor: stationTemplate.chargePointVendor,
     ...(stationTemplate.chargeBoxSerialNumberPrefix != null && {
-      chargeBoxSerialNumber: stationTemplate.chargeBoxSerialNumberPrefix
+      chargeBoxSerialNumber: stationTemplate.chargeBoxSerialNumberPrefix,
     }),
     ...(stationTemplate.chargePointSerialNumberPrefix != null && {
-      chargePointSerialNumber: stationTemplate.chargePointSerialNumberPrefix
+      chargePointSerialNumber: stationTemplate.chargePointSerialNumberPrefix,
     }),
     ...(stationTemplate.meterSerialNumberPrefix != null && {
-      meterSerialNumber: stationTemplate.meterSerialNumberPrefix
+      meterSerialNumber: stationTemplate.meterSerialNumberPrefix,
     }),
     ...(stationTemplate.meterType != null && {
-      meterType: stationTemplate.meterType
-    })
+      meterType: stationTemplate.meterType,
+    }),
   }
   return createHash(Constants.DEFAULT_HASH_ALGORITHM)
     .update(`${JSON.stringify(chargingStationInfo)}${getChargingStationId(index, stationTemplate)}`)
@@ -192,14 +192,14 @@ export const getPhaseRotationValue = (
 ): string | undefined => {
   // AC/DC
   if (connectorId === 0 && numberOfPhases === 0) {
-    return `${connectorId}.${ConnectorPhaseRotation.RST}`
+    return `${connectorId.toString()}.${ConnectorPhaseRotation.RST}`
   } else if (connectorId > 0 && numberOfPhases === 0) {
-    return `${connectorId}.${ConnectorPhaseRotation.NotApplicable}`
+    return `${connectorId.toString()}.${ConnectorPhaseRotation.NotApplicable}`
     // AC
   } else if (connectorId >= 0 && numberOfPhases === 1) {
-    return `${connectorId}.${ConnectorPhaseRotation.NotApplicable}`
+    return `${connectorId.toString()}.${ConnectorPhaseRotation.NotApplicable}`
   } else if (connectorId >= 0 && numberOfPhases === 3) {
-    return `${connectorId}.${ConnectorPhaseRotation.RST}`
+    return `${connectorId.toString()}.${ConnectorPhaseRotation.RST}`
   }
 }
 
@@ -310,7 +310,7 @@ export const checkConnectorsConfiguration = (
   return {
     configuredMaxConnectors,
     templateMaxConnectors,
-    templateMaxAvailableConnectors
+    templateMaxAvailableConnectors,
   }
 }
 
@@ -322,7 +322,7 @@ export const checkStationInfoConnectorStatus = (
 ): void => {
   if (connectorStatus.status != null) {
     logger.warn(
-      `${logPrefix} Charging station information from template ${templateFile} with connector id ${connectorId} status configuration defined, undefine it`
+      `${logPrefix} Charging station information from template ${templateFile} with connector id ${connectorId.toString()} status configuration defined, undefine it`
     )
     delete connectorStatus.status
   }
@@ -387,8 +387,9 @@ export const initializeConnectorsMapStatus = (
   for (const connectorId of connectors.keys()) {
     if (connectorId > 0 && connectors.get(connectorId)?.transactionStarted === true) {
       logger.warn(
-        `${logPrefix} Connector id ${connectorId} at initialization has a transaction started with id ${
-          connectors.get(connectorId)?.transactionId
+        `${logPrefix} Connector id ${connectorId.toString()} at initialization has a transaction started with id ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          connectors.get(connectorId)?.transactionId?.toString()
         }`
       )
     }
@@ -471,22 +472,22 @@ export const createBootNotificationRequest = (
         chargePointModel: stationInfo.chargePointModel,
         chargePointVendor: stationInfo.chargePointVendor,
         ...(stationInfo.chargeBoxSerialNumber != null && {
-          chargeBoxSerialNumber: stationInfo.chargeBoxSerialNumber
+          chargeBoxSerialNumber: stationInfo.chargeBoxSerialNumber,
         }),
         ...(stationInfo.chargePointSerialNumber != null && {
-          chargePointSerialNumber: stationInfo.chargePointSerialNumber
+          chargePointSerialNumber: stationInfo.chargePointSerialNumber,
         }),
         ...(stationInfo.firmwareVersion != null && {
-          firmwareVersion: stationInfo.firmwareVersion
+          firmwareVersion: stationInfo.firmwareVersion,
         }),
         ...(stationInfo.iccid != null && { iccid: stationInfo.iccid }),
         ...(stationInfo.imsi != null && { imsi: stationInfo.imsi }),
         ...(stationInfo.meterSerialNumber != null && {
-          meterSerialNumber: stationInfo.meterSerialNumber
+          meterSerialNumber: stationInfo.meterSerialNumber,
         }),
         ...(stationInfo.meterType != null && {
-          meterType: stationInfo.meterType
-        })
+          meterType: stationInfo.meterType,
+        }),
       } satisfies OCPP16BootNotificationRequest
     case OCPPVersion.VERSION_20:
     case OCPPVersion.VERSION_201:
@@ -496,18 +497,18 @@ export const createBootNotificationRequest = (
           model: stationInfo.chargePointModel,
           vendorName: stationInfo.chargePointVendor,
           ...(stationInfo.firmwareVersion != null && {
-            firmwareVersion: stationInfo.firmwareVersion
+            firmwareVersion: stationInfo.firmwareVersion,
           }),
           ...(stationInfo.chargeBoxSerialNumber != null && {
-            serialNumber: stationInfo.chargeBoxSerialNumber
+            serialNumber: stationInfo.chargeBoxSerialNumber,
           }),
           ...((stationInfo.iccid != null || stationInfo.imsi != null) && {
             modem: {
               ...(stationInfo.iccid != null && { iccid: stationInfo.iccid }),
-              ...(stationInfo.imsi != null && { imsi: stationInfo.imsi })
-            }
-          })
-        }
+              ...(stationInfo.imsi != null && { imsi: stationInfo.imsi }),
+            },
+          }),
+        },
       } satisfies OCPP20BootNotificationRequest
   }
 }
@@ -517,11 +518,11 @@ export const warnTemplateKeysDeprecation = (
   logPrefix: string,
   templateFile: string
 ): void => {
-  const templateKeys: Array<{ deprecatedKey: string, key?: string }> = [
+  const templateKeys: { deprecatedKey: string; key?: string }[] = [
     { deprecatedKey: 'supervisionUrl', key: 'supervisionUrls' },
     { deprecatedKey: 'authorizationFile', key: 'idTagsFile' },
     { deprecatedKey: 'payloadSchemaValidation', key: 'ocppStrictCompliance' },
-    { deprecatedKey: 'mustAuthorizeAtRemoteStart', key: 'remoteAuthorization' }
+    { deprecatedKey: 'mustAuthorizeAtRemoteStart', key: 'remoteAuthorization' },
   ]
   for (const templateKey of templateKeys) {
     warnDeprecatedTemplateKey(
@@ -562,14 +563,13 @@ export const createSerialNumber = (
 ): void => {
   params = {
     ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true },
-    ...params
+    ...params,
   }
-  const serialNumberSuffix =
-    params.randomSerialNumber === true
-      ? getRandomSerialNumberSuffix({
-        upperCase: params.randomSerialNumberUpperCase
-      })
-      : ''
+  const serialNumberSuffix = params.randomSerialNumber
+    ? getRandomSerialNumberSuffix({
+      upperCase: params.randomSerialNumberUpperCase,
+    })
+    : ''
   isNotEmptyString(stationTemplate.chargePointSerialNumberPrefix) &&
     (stationInfo.chargePointSerialNumber = `${stationTemplate.chargePointSerialNumberPrefix}${serialNumberSuffix}`)
   isNotEmptyString(stationTemplate.chargeBoxSerialNumberPrefix) &&
@@ -654,8 +654,8 @@ export const getChargingStationChargingProfilesLimit = (
       if (limit > chargingStationMaximumPower) {
         logger.error(
           `${chargingStation.logPrefix()} ${moduleName}.getChargingStationChargingProfilesLimit: Charging profile id ${
-            chargingProfilesLimit.chargingProfile.chargingProfileId
-          } limit ${limit} is greater than charging station maximum ${chargingStationMaximumPower}: %j`,
+            chargingProfilesLimit.chargingProfile.chargingProfileId.toString()
+          } limit ${limit.toString()} is greater than charging station maximum ${chargingStationMaximumPower.toString()}: %j`,
           chargingProfilesLimit
         )
         return chargingStationMaximumPower
@@ -668,7 +668,6 @@ export const getChargingStationChargingProfilesLimit = (
 /**
  * Gets the connector charging profiles relevant for power limitation shallow cloned
  * and sorted by priorities
- *
  * @param chargingStation - Charging station
  * @param connectorId - Connector id
  * @returns connector charging profiles array
@@ -722,8 +721,8 @@ export const getConnectorChargingProfilesLimit = (
       if (limit > connectorMaximumPower) {
         logger.error(
           `${chargingStation.logPrefix()} ${moduleName}.getConnectorChargingProfilesLimit: Charging profile id ${
-            chargingProfilesLimit.chargingProfile.chargingProfileId
-          } limit ${limit} is greater than connector ${connectorId} maximum ${connectorMaximumPower}: %j`,
+            chargingProfilesLimit.chargingProfile.chargingProfileId.toString()
+          } limit ${limit.toString()} is greater than connector ${connectorId.toString()} maximum ${connectorMaximumPower.toString()}: %j`,
           chargingProfilesLimit
         )
         return connectorMaximumPower
@@ -737,6 +736,7 @@ const buildChargingProfilesLimit = (
   chargingStation: ChargingStation,
   chargingProfilesLimit: ChargingProfilesLimit
 ): number => {
+  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
   const errorMsg = `Unknown ${chargingStation.stationInfo?.currentOutType} currentOutType in charging station information, cannot build charging profiles limit`
   const { limit, chargingProfile } = chargingProfilesLimit
   switch (chargingStation.stationInfo?.currentOutType) {
@@ -752,8 +752,8 @@ const buildChargingProfilesLimit = (
     case CurrentType.DC:
       return chargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT
         ? limit
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        DCElectricUtils.power(chargingStation.stationInfo.voltageOut!, limit)
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        DCElectricUtils.power(chargingStation.stationInfo.voltageOut!, limit)
     default:
       logger.error(
         `${chargingStation.logPrefix()} ${moduleName}.buildChargingProfilesLimit: ${errorMsg}`
@@ -843,7 +843,7 @@ const checkConfiguredMaxConnectors = (
 ): void => {
   if (configuredMaxConnectors <= 0) {
     logger.warn(
-      `${logPrefix} Charging station information from template ${templateFile} with ${configuredMaxConnectors} connectors`
+      `${logPrefix} Charging station information from template ${templateFile} with ${configuredMaxConnectors.toString()} connectors`
     )
   }
 }
@@ -900,7 +900,7 @@ const convertDeprecatedTemplateKey = (
 ): void => {
   if (template[deprecatedKey as keyof ChargingStationTemplate] != null) {
     if (key != null) {
-      (template as unknown as Record<string, unknown>)[key] =
+      ;(template as unknown as Record<string, unknown>)[key] =
         template[deprecatedKey as keyof ChargingStationTemplate]
     }
     // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
@@ -916,7 +916,6 @@ interface ChargingProfilesLimit {
 /**
  * Get the charging profiles limit for a connector
  * Charging profiles shall already be sorted by priorities
- *
  * @param chargingStation -
  * @param connectorId -
  * @param chargingProfiles -
@@ -935,21 +934,21 @@ const getChargingProfilesLimit = (
     const chargingSchedule = chargingProfile.chargingSchedule
     if (chargingSchedule.startSchedule == null) {
       logger.debug(
-        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId} has no startSchedule defined. Trying to set it to the connector current transaction start date`
+        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId.toString()} has no startSchedule defined. Trying to set it to the connector current transaction start date`
       )
       // OCPP specifies that if startSchedule is not defined, it should be relative to start of the connector transaction
       chargingSchedule.startSchedule = connectorStatus?.transactionStart
     }
     if (!isDate(chargingSchedule.startSchedule)) {
       logger.warn(
-        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId} startSchedule property is not a Date instance. Trying to convert it to a Date instance`
+        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId.toString()} startSchedule property is not a Date instance. Trying to convert it to a Date instance`
       )
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       chargingSchedule.startSchedule = convertToDate(chargingSchedule.startSchedule)!
     }
     if (chargingSchedule.duration == null) {
       logger.debug(
-        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId} has no duration defined and will be set to the maximum time allowed`
+        `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId.toString()} has no duration defined and will be set to the maximum time allowed`
       )
       // OCPP specifies that if duration is not defined, it should be infinite
       chargingSchedule.duration = differenceInSeconds(maxTime, chargingSchedule.startSchedule)
@@ -971,7 +970,7 @@ const getChargingProfilesLimit = (
     if (
       isWithinInterval(currentDate, {
         start: chargingSchedule.startSchedule,
-        end: addSeconds(chargingSchedule.startSchedule, chargingSchedule.duration)
+        end: addSeconds(chargingSchedule.startSchedule, chargingSchedule.duration),
       })
     ) {
       if (isNotEmptyArray(chargingSchedule.chargingSchedulePeriod)) {
@@ -986,14 +985,14 @@ const getChargingProfilesLimit = (
           )
         ) {
           logger.warn(
-            `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId} schedule periods are not sorted by start period`
+            `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId.toString()} schedule periods are not sorted by start period`
           )
           chargingSchedule.chargingSchedulePeriod.sort(chargingSchedulePeriodCompareFn)
         }
         // Check if the first schedule period startPeriod property is equal to 0
         if (chargingSchedule.chargingSchedulePeriod[0].startPeriod !== 0) {
           logger.error(
-            `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId} first schedule period start period ${chargingSchedule.chargingSchedulePeriod[0].startPeriod} is not equal to 0`
+            `${chargingStation.logPrefix()} ${moduleName}.getChargingProfilesLimit: Charging profile id ${chargingProfile.chargingProfileId.toString()} first schedule period start period ${chargingSchedule.chargingSchedulePeriod[0].startPeriod.toString()} is not equal to 0`
           )
           continue
         }
@@ -1001,7 +1000,7 @@ const getChargingProfilesLimit = (
         if (chargingSchedule.chargingSchedulePeriod.length === 1) {
           const chargingProfilesLimit: ChargingProfilesLimit = {
             limit: chargingSchedule.chargingSchedulePeriod[0].limit,
-            chargingProfile
+            chargingProfile,
           }
           logger.debug(debugLogMsg, chargingProfilesLimit)
           return chargingProfilesLimit
@@ -1010,7 +1009,7 @@ const getChargingProfilesLimit = (
         // Search for the right schedule period
         for (const [
           index,
-          chargingSchedulePeriod
+          chargingSchedulePeriod,
         ] of chargingSchedule.chargingSchedulePeriod.entries()) {
           // Find the right schedule period
           if (
@@ -1022,7 +1021,7 @@ const getChargingProfilesLimit = (
             // Found the schedule period: previous is the correct one
             const chargingProfilesLimit: ChargingProfilesLimit = {
               limit: previousChargingSchedulePeriod?.limit ?? chargingSchedulePeriod.limit,
-              chargingProfile: previousActiveChargingProfile ?? chargingProfile
+              chargingProfile: previousActiveChargingProfile ?? chargingProfile,
             }
             logger.debug(debugLogMsg, chargingProfilesLimit)
             return chargingProfilesLimit
@@ -1041,7 +1040,7 @@ const getChargingProfilesLimit = (
           ) {
             const chargingProfilesLimit: ChargingProfilesLimit = {
               limit: chargingSchedulePeriod.limit,
-              chargingProfile
+              chargingProfile,
             }
             logger.debug(debugLogMsg, chargingProfilesLimit)
             return chargingProfilesLimit
@@ -1072,7 +1071,7 @@ export const prepareChargingProfileKind = (
     case ChargingProfileKindType.RELATIVE:
       if (chargingProfile.chargingSchedule.startSchedule != null) {
         logger.warn(
-          `${logPrefix} ${moduleName}.prepareChargingProfileKind: Relative charging profile id ${chargingProfile.chargingProfileId} has a startSchedule property defined. It will be ignored or used if the connector has a transaction started`
+          `${logPrefix} ${moduleName}.prepareChargingProfileKind: Relative charging profile id ${chargingProfile.chargingProfileId.toString()} has a startSchedule property defined. It will be ignored or used if the connector has a transaction started`
         )
         delete chargingProfile.chargingSchedule.startSchedule
       }
@@ -1096,9 +1095,9 @@ export const canProceedChargingProfile = (
   ) {
     logger.debug(
       `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${
-        chargingProfile.chargingProfileId
+        chargingProfile.chargingProfileId.toString()
       } is not valid for the current date ${
-        isDate(currentDate) ? currentDate.toISOString() : currentDate
+        isDate(currentDate) ? currentDate.toISOString() : currentDate.toString()
       }`
     )
     return false
@@ -1108,19 +1107,19 @@ export const canProceedChargingProfile = (
     chargingProfile.chargingSchedule.duration == null
   ) {
     logger.error(
-      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId} has no startSchedule or duration defined`
+      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId.toString()} has no startSchedule or duration defined`
     )
     return false
   }
   if (!isValidDate(chargingProfile.chargingSchedule.startSchedule)) {
     logger.error(
-      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId} has an invalid startSchedule date defined`
+      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId.toString()} has an invalid startSchedule date defined`
     )
     return false
   }
   if (!Number.isSafeInteger(chargingProfile.chargingSchedule.duration)) {
     logger.error(
-      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId} has non integer duration defined`
+      `${logPrefix} ${moduleName}.canProceedChargingProfile: Charging profile id ${chargingProfile.chargingProfileId.toString()} has non integer duration defined`
     )
     return false
   }
@@ -1136,7 +1135,7 @@ const canProceedRecurringChargingProfile = (
     chargingProfile.recurrencyKind == null
   ) {
     logger.error(
-      `${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId} has no recurrencyKind defined`
+      `${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId.toString()} has no recurrencyKind defined`
     )
     return false
   }
@@ -1145,7 +1144,7 @@ const canProceedRecurringChargingProfile = (
     chargingProfile.chargingSchedule.startSchedule == null
   ) {
     logger.error(
-      `${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId} has no startSchedule defined`
+      `${logPrefix} ${moduleName}.canProceedRecurringChargingProfile: Recurring charging profile id ${chargingProfile.chargingProfileId.toString()} has no startSchedule defined`
     )
     return false
   }
@@ -1154,10 +1153,10 @@ const canProceedRecurringChargingProfile = (
 
 /**
  * Adjust recurring charging profile startSchedule to the current recurrency time interval if needed
- *
  * @param chargingProfile -
  * @param currentDate -
  * @param logPrefix -
+ * @returns boolean
  */
 const prepareRecurringChargingProfile = (
   chargingProfile: ChargingProfile,
@@ -1173,7 +1172,7 @@ const prepareRecurringChargingProfile = (
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         start: chargingSchedule.startSchedule!,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        end: addDays(chargingSchedule.startSchedule!, 1)
+        end: addDays(chargingSchedule.startSchedule!, 1),
       }
       checkRecurringChargingProfileDuration(chargingProfile, recurringInterval, logPrefix)
       if (
@@ -1186,7 +1185,7 @@ const prepareRecurringChargingProfile = (
         )
         recurringInterval = {
           start: chargingSchedule.startSchedule,
-          end: addDays(chargingSchedule.startSchedule, 1)
+          end: addDays(chargingSchedule.startSchedule, 1),
         }
         recurringIntervalTranslated = true
       }
@@ -1196,7 +1195,7 @@ const prepareRecurringChargingProfile = (
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         start: chargingSchedule.startSchedule!,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        end: addWeeks(chargingSchedule.startSchedule!, 1)
+        end: addWeeks(chargingSchedule.startSchedule!, 1),
       }
       checkRecurringChargingProfileDuration(chargingProfile, recurringInterval, logPrefix)
       if (
@@ -1209,27 +1208,29 @@ const prepareRecurringChargingProfile = (
         )
         recurringInterval = {
           start: chargingSchedule.startSchedule,
-          end: addWeeks(chargingSchedule.startSchedule, 1)
+          end: addWeeks(chargingSchedule.startSchedule, 1),
         }
         recurringIntervalTranslated = true
       }
       break
     default:
       logger.error(
-        `${logPrefix} ${moduleName}.prepareRecurringChargingProfile: Recurring ${chargingProfile.recurrencyKind} charging profile id ${chargingProfile.chargingProfileId} is not supported`
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+        `${logPrefix} ${moduleName}.prepareRecurringChargingProfile: Recurring ${chargingProfile.recurrencyKind} charging profile id ${chargingProfile.chargingProfileId.toString()} is not supported`
       )
   }
   // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
   if (recurringIntervalTranslated && !isWithinInterval(currentDate, recurringInterval!)) {
     logger.error(
       `${logPrefix} ${moduleName}.prepareRecurringChargingProfile: Recurring ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         chargingProfile.recurrencyKind
-      } charging profile id ${chargingProfile.chargingProfileId} recurrency time interval [${toDate(
+      } charging profile id ${chargingProfile.chargingProfileId.toString()} recurrency time interval [${toDate(
         recurringInterval?.start as Date
       ).toISOString()}, ${toDate(
         recurringInterval?.end as Date
       ).toISOString()}] has not been properly translated to current date ${
-        isDate(currentDate) ? currentDate.toISOString() : currentDate
+        isDate(currentDate) ? currentDate.toISOString() : currentDate.toString()
       } `
     )
   }
@@ -1246,11 +1247,11 @@ const checkRecurringChargingProfileDuration = (
       `${logPrefix} ${moduleName}.checkRecurringChargingProfileDuration: Recurring ${
         chargingProfile.chargingProfileKind
       } charging profile id ${
-        chargingProfile.chargingProfileId
+        chargingProfile.chargingProfileId.toString()
       } duration is not defined, set it to the recurrency time interval duration ${differenceInSeconds(
         interval.end,
         interval.start
-      )}`
+      ).toString()}`
     )
     chargingProfile.chargingSchedule.duration = differenceInSeconds(interval.end, interval.start)
   } else if (
@@ -1259,12 +1260,12 @@ const checkRecurringChargingProfileDuration = (
     logger.warn(
       `${logPrefix} ${moduleName}.checkRecurringChargingProfileDuration: Recurring ${
         chargingProfile.chargingProfileKind
-      } charging profile id ${chargingProfile.chargingProfileId} duration ${
-        chargingProfile.chargingSchedule.duration
+      } charging profile id ${chargingProfile.chargingProfileId.toString()} duration ${
+        chargingProfile.chargingSchedule.duration.toString()
       } is greater than the recurrency time interval duration ${differenceInSeconds(
         interval.end,
         interval.start
-      )}`
+      ).toString()}`
     )
     chargingProfile.chargingSchedule.duration = differenceInSeconds(interval.end, interval.start)
   }
@@ -1274,8 +1275,8 @@ const getRandomSerialNumberSuffix = (params?: {
   randomBytesLength?: number
   upperCase?: boolean
 }): string => {
-  const randomSerialNumberSuffix = randomBytes(params?.randomBytesLength ?? 16).toString('hex')
-  if (params?.upperCase === true) {
+  const randomSerialNumberSuffix = randomBytes(params.randomBytesLength ?? 16).toString('hex')
+  if (params.upperCase) {
     return randomSerialNumberSuffix.toUpperCase()
   }
   return randomSerialNumberSuffix
index da4b38bfce79de421343e16f90dd2b6a17e85c6b..60fa9c4c43c10cee2a5cb2bddbd393abfe4d24be 100644 (file)
@@ -7,7 +7,7 @@ import {
   logger,
   logPrefix,
   secureRandom,
-  watchJsonFile
+  watchJsonFile,
 } from '../utils/index.js'
 import type { ChargingStation } from './ChargingStation.js'
 import { getIdTagsFile } from './Helpers.js'
@@ -37,11 +37,10 @@ export class IdTagsCache {
   /**
    * Gets one idtag from the cache given the distribution
    * Must be called after checking the cache is not an empty array
-   *
    * @param distribution -
    * @param chargingStation -
    * @param connectorId -
-   * @returns
+   * @returns string
    */
   public getIdTag (
     distribution: IdTagDistribution,
@@ -51,7 +50,7 @@ export class IdTagsCache {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const hashId = chargingStation.stationInfo!.hashId
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-    const idTagsFile = getIdTagsFile(chargingStation.stationInfo!)!
+    const idTagsFile = getIdTagsFile(chargingStation.stationInfo)!
     switch (distribution) {
       case IdTagDistribution.RANDOM:
         return this.getRandomIdTag(hashId, idTagsFile)
@@ -67,9 +66,8 @@ export class IdTagsCache {
   /**
    * Gets all idtags from the cache
    * Must be called after checking the cache is not an empty array
-   *
    * @param file -
-   * @returns
+   * @returns string[] | undefined
    */
   public getIdTags (file: string): string[] | undefined {
     if (!this.hasIdTagsCache(file)) {
@@ -151,13 +149,13 @@ export class IdTagsCache {
                 error as NodeJS.ErrnoException,
                 this.logPrefix(file),
                 {
-                  throwError: false
+                  throwError: false,
                 }
               )
             }
           }
         }
-      )
+      ),
     })
   }
 
index 9acdd3a42c94c491587ead7839156d95949ec797..dc93edf8e48bbd0ec02ca34bf3afb75aa8ef801d 100644 (file)
@@ -35,7 +35,7 @@ import {
   type StatusNotificationRequest,
   type StatusNotificationResponse,
   type StopTransactionRequest,
-  type StopTransactionResponse
+  type StopTransactionResponse,
 } from '../../types/index.js'
 import { Constants, convertToInt, isAsyncFunction, logger } from '../../utils/index.js'
 import type { ChargingStation } from '../ChargingStation.js'
@@ -66,71 +66,71 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
   constructor (chargingStation: ChargingStation) {
     super()
     const requestParams: RequestParams = {
-      throwError: true
+      throwError: true,
     }
     this.commandHandlers = new Map<BroadcastChannelProcedureName, CommandHandler>([
       [
         BroadcastChannelProcedureName.START_CHARGING_STATION,
         () => {
           this.chargingStation.start()
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.STOP_CHARGING_STATION,
         async () => {
           await this.chargingStation.stop()
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.DELETE_CHARGING_STATIONS,
         async (requestPayload?: BroadcastChannelRequestPayload) => {
           await this.chargingStation.delete(requestPayload?.deleteConfiguration as boolean)
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.OPEN_CONNECTION,
         () => {
           this.chargingStation.openWSConnection()
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.CLOSE_CONNECTION,
         () => {
           this.chargingStation.closeWSConnection()
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
         (requestPayload?: BroadcastChannelRequestPayload) => {
           this.chargingStation.startAutomaticTransactionGenerator(requestPayload?.connectorIds)
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
         (requestPayload?: BroadcastChannelRequestPayload) => {
           this.chargingStation.stopAutomaticTransactionGenerator(requestPayload?.connectorIds)
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.SET_SUPERVISION_URL,
         (requestPayload?: BroadcastChannelRequestPayload) => {
           this.chargingStation.setSupervisionUrl(requestPayload?.url as string)
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.START_TRANSACTION,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          StartTransactionRequest,
-          StartTransactionResponse
-          >(this.chargingStation, RequestCommand.START_TRANSACTION, requestPayload, requestParams)
+            StartTransactionRequest,
+            StartTransactionResponse
+          >(this.chargingStation, RequestCommand.START_TRANSACTION, requestPayload as StartTransactionRequest, requestParams),
       ],
       [
         BroadcastChannelProcedureName.STOP_TRANSACTION,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          StopTransactionRequest,
-          StartTransactionResponse
+            StopTransactionRequest,
+            StartTransactionResponse
           >(
             this.chargingStation,
             RequestCommand.STOP_TRANSACTION,
@@ -139,54 +139,59 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
                 requestPayload?.transactionId,
                 true
               ),
-              ...requestPayload
-            },
+              ...requestPayload,
+            } as StopTransactionRequest,
             requestParams
-          )
+          ),
       ],
       [
         BroadcastChannelProcedureName.AUTHORIZE,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          AuthorizeRequest,
-          AuthorizeResponse
-          >(this.chargingStation, RequestCommand.AUTHORIZE, requestPayload, requestParams)
+            AuthorizeRequest,
+            AuthorizeResponse
+          >(this.chargingStation, RequestCommand.AUTHORIZE, requestPayload as AuthorizeRequest, requestParams),
       ],
       [
         BroadcastChannelProcedureName.BOOT_NOTIFICATION,
         async (requestPayload?: BroadcastChannelRequestPayload) => {
           return await this.chargingStation.ocppRequestService.requestHandler<
-          BootNotificationRequest,
-          BootNotificationResponse
+            BootNotificationRequest,
+            BootNotificationResponse
           >(
             this.chargingStation,
             RequestCommand.BOOT_NOTIFICATION,
             {
               ...this.chargingStation.bootNotificationRequest,
-              ...requestPayload
-            },
+              ...requestPayload,
+            } as BootNotificationRequest,
             {
               skipBufferingOnError: true,
-              throwError: true
+              throwError: true,
             }
           )
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.STATUS_NOTIFICATION,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          StatusNotificationRequest,
-          StatusNotificationResponse
-          >(this.chargingStation, RequestCommand.STATUS_NOTIFICATION, requestPayload, requestParams)
+            StatusNotificationRequest,
+            StatusNotificationResponse
+          >(
+            this.chargingStation,
+            RequestCommand.STATUS_NOTIFICATION,
+            requestPayload as StatusNotificationRequest,
+            requestParams
+          ),
       ],
       [
         BroadcastChannelProcedureName.HEARTBEAT,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          HeartbeatRequest,
-          HeartbeatResponse
-          >(this.chargingStation, RequestCommand.HEARTBEAT, requestPayload, requestParams)
+            HeartbeatRequest,
+            HeartbeatResponse
+          >(this.chargingStation, RequestCommand.HEARTBEAT, requestPayload as HeartbeatRequest, requestParams),
       ],
       [
         BroadcastChannelProcedureName.METER_VALUES,
@@ -196,8 +201,8 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
             StandardParametersKey.MeterValueSampleInterval
           )
           return await this.chargingStation.ocppRequestService.requestHandler<
-          MeterValuesRequest,
-          MeterValuesResponse
+            MeterValuesRequest,
+            MeterValuesResponse
           >(
             this.chargingStation,
             RequestCommand.METER_VALUES,
@@ -213,48 +218,48 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
                   configuredMeterValueSampleInterval != null
                     ? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value))
                     : Constants.DEFAULT_METER_VALUES_INTERVAL
-                )
+                ),
               ],
-              ...requestPayload
-            },
+              ...requestPayload,
+            } as MeterValuesRequest,
             requestParams
           )
-        }
+        },
       ],
       [
         BroadcastChannelProcedureName.DATA_TRANSFER,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          DataTransferRequest,
-          DataTransferResponse
-          >(this.chargingStation, RequestCommand.DATA_TRANSFER, requestPayload, requestParams)
+            DataTransferRequest,
+            DataTransferResponse
+          >(this.chargingStation, RequestCommand.DATA_TRANSFER, requestPayload as DataTransferRequest, requestParams),
       ],
       [
         BroadcastChannelProcedureName.DIAGNOSTICS_STATUS_NOTIFICATION,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          DiagnosticsStatusNotificationRequest,
-          DiagnosticsStatusNotificationResponse
+            DiagnosticsStatusNotificationRequest,
+            DiagnosticsStatusNotificationResponse
           >(
             this.chargingStation,
             RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
-            requestPayload,
+            requestPayload as DiagnosticsStatusNotificationRequest,
             requestParams
-          )
+          ),
       ],
       [
         BroadcastChannelProcedureName.FIRMWARE_STATUS_NOTIFICATION,
         async (requestPayload?: BroadcastChannelRequestPayload) =>
           await this.chargingStation.ocppRequestService.requestHandler<
-          FirmwareStatusNotificationRequest,
-          FirmwareStatusNotificationResponse
+            FirmwareStatusNotificationRequest,
+            FirmwareStatusNotificationResponse
           >(
             this.chargingStation,
             RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
-            requestPayload,
+            requestPayload as FirmwareStatusNotificationRequest,
             requestParams
-          )
-      ]
+          ),
+      ],
     ])
     this.chargingStation = chargingStation
     this.onmessage = this.requestHandler.bind(this) as (message: unknown) => void
@@ -289,7 +294,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
         if (commandResponse == null || isEmpty(commandResponse)) {
           responsePayload = {
             hashId: this.chargingStation.stationInfo?.hashId,
-            status: ResponseStatus.SUCCESS
+            status: ResponseStatus.SUCCESS,
           }
         } else {
           responsePayload = this.commandResponseToResponsePayload(
@@ -298,6 +303,11 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
             commandResponse
           )
         }
+        return undefined
+      })
+      .finally(() => {
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        this.sendResponse([uuid, responsePayload!])
       })
       .catch((error: unknown) => {
         logger.error(
@@ -311,13 +321,9 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
           requestPayload,
           errorMessage: (error as OCPPError).message,
           errorStack: (error as OCPPError).stack,
-          errorDetails: (error as OCPPError).details
+          errorDetails: (error as OCPPError).details,
         } satisfies BroadcastChannelResponsePayload
       })
-      .finally(() => {
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        this.sendResponse([uuid, responsePayload!])
-      })
   }
 
   private messageErrorHandler (messageEvent: MessageEvent): void {
@@ -357,7 +363,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
     delete requestPayload.hashIds
     ![
       BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
-      BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR
+      BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
     ].includes(command) && delete requestPayload.connectorIds
   }
 
@@ -370,7 +376,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
     if (responseStatus === ResponseStatus.SUCCESS) {
       return {
         hashId: this.chargingStation.stationInfo?.hashId,
-        status: responseStatus
+        status: responseStatus,
       }
     }
     return {
@@ -378,7 +384,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
       status: responseStatus,
       command,
       requestPayload,
-      commandResponse
+      commandResponse,
     }
   }
 
@@ -390,14 +396,10 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
       case BroadcastChannelProcedureName.START_TRANSACTION:
       case BroadcastChannelProcedureName.STOP_TRANSACTION:
       case BroadcastChannelProcedureName.AUTHORIZE:
-        if (
-          (
-            commandResponse as
-              | StartTransactionResponse
-              | StopTransactionResponse
-              | AuthorizeResponse
-          ).idTagInfo?.status === AuthorizationStatus.ACCEPTED
-        ) {
+        if ((commandResponse as
+                        | StartTransactionResponse
+                        | StopTransactionResponse
+                        | AuthorizeResponse).idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
           return ResponseStatus.SUCCESS
         }
         return ResponseStatus.FAILURE
index 1157c71e5e09c164dc8e653545e962d1e9f98aa7..958c9375c1401bd3ea83adcfe1649a60e15156ae 100644 (file)
@@ -3,7 +3,7 @@ import {
   type BroadcastChannelResponsePayload,
   type MessageEvent,
   type ResponsePayload,
-  ResponseStatus
+  ResponseStatus,
 } from '../../types/index.js'
 import { logger } from '../../utils/index.js'
 import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIService.js'
@@ -42,7 +42,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
       this.responses.set(uuid, {
         responsesExpected: this.uiService.getBroadcastChannelExpectedResponses(uuid),
         responsesReceived: 1,
-        responses: [responsePayload]
+        responses: [responsePayload],
       })
     } else if (
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -90,7 +90,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
             }
             return undefined
           })
-          .filter(hashId => hashId != null)!
+          .filter(hashId => hashId != null)!,
       }),
       ...(responsesStatus === ResponseStatus.FAILURE && {
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
@@ -102,8 +102,8 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
             }
             return undefined
           })
-          .filter(response => response != null)!
-      })
+          .filter(response => response != null)!,
+      }),
     }
   }
 
index 91c92ac2b41ede0d234b184d127ec6329f1b9427..7dfa92651d30c188416be09347cb6e184dd3a38f 100644 (file)
@@ -4,7 +4,7 @@ import type {
   BroadcastChannelRequest,
   BroadcastChannelResponse,
   JsonType,
-  MessageEvent
+  MessageEvent,
 } from '../../types/index.js'
 import { logger, logPrefix, validateUUID } from '../../utils/index.js'
 
index 1a5f955f52011ae05e8979f81ba9e3614d42964f..9d9d44faa4f42b4c73f51e4c4165b6ecb96519f2 100644 (file)
@@ -3,7 +3,7 @@ export type { ChargingStation } from './ChargingStation.js'
 export {
   addConfigurationKey,
   getConfigurationKey,
-  setConfigurationKeyValue
+  setConfigurationKeyValue,
 } from './ConfigurationKeyUtils.js'
 export {
   canProceedChargingProfile,
@@ -15,5 +15,5 @@ export {
   prepareChargingProfileKind,
   removeExpiredReservations,
   resetAuthorizeConnectorStatus,
-  resetConnectorStatus
+  resetConnectorStatus,
 } from './Helpers.js'
index 229124e0ee0480372482f317004475c00e0e6ebc..f430706a5f434e47cc31a4d0b114eaaaa1a139ca 100644 (file)
@@ -8,31 +8,31 @@ export class OCPP16Constants extends OCPPConstants {
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       { to: OCPP16ChargePointStatus.Unavailable },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       { to: OCPP16ChargePointStatus.Faulted },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Unavailable
-      }
+        to: OCPP16ChargePointStatus.Unavailable,
+      },
       // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
     ])
 
@@ -42,153 +42,153 @@ export class OCPP16Constants extends OCPPConstants {
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Preparing
+        to: OCPP16ChargePointStatus.Preparing,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        to: OCPP16ChargePointStatus.SuspendedEVSE,
       },
       // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Finishing },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Reserved
+        to: OCPP16ChargePointStatus.Reserved,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.Available,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.Preparing },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Preparing },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        to: OCPP16ChargePointStatus.SuspendedEVSE,
       },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.Finishing
+        to: OCPP16ChargePointStatus.Finishing,
       },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Reserved },
       // { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Unavailable },
       {
         from: OCPP16ChargePointStatus.Preparing,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.Charging },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Preparing },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Charging },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        to: OCPP16ChargePointStatus.SuspendedEVSE,
       },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.Finishing
+        to: OCPP16ChargePointStatus.Finishing,
       },
       // { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.Charging,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.SuspendedEV },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Preparing },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEV, OCPP16ChargePointStatus.SuspendedEV },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        to: OCPP16ChargePointStatus.SuspendedEVSE,
       },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.Finishing
+        to: OCPP16ChargePointStatus.Finishing,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.SuspendedEV,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.SuspendedEVSE },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Preparing },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.SuspendedEVSE },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.Finishing
+        to: OCPP16ChargePointStatus.Finishing,
       },
       // { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.SuspendedEVSE,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.Finishing},
       {
         from: OCPP16ChargePointStatus.Finishing,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       {
         from: OCPP16ChargePointStatus.Finishing,
-        to: OCPP16ChargePointStatus.Preparing
+        to: OCPP16ChargePointStatus.Preparing,
       },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Charging },
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.SuspendedEV },
@@ -197,20 +197,20 @@ export class OCPP16Constants extends OCPPConstants {
       // { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.Finishing,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.Finishing,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       // { to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.Reserved,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       {
         from: OCPP16ChargePointStatus.Reserved,
-        to: OCPP16ChargePointStatus.Preparing
+        to: OCPP16ChargePointStatus.Preparing,
       },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Charging },
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.SuspendedEV },
@@ -219,73 +219,73 @@ export class OCPP16Constants extends OCPPConstants {
       // { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Reserved },
       {
         from: OCPP16ChargePointStatus.Reserved,
-        to: OCPP16ChargePointStatus.Unavailable
+        to: OCPP16ChargePointStatus.Unavailable,
       },
       {
         from: OCPP16ChargePointStatus.Reserved,
-        to: OCPP16ChargePointStatus.Faulted
+        to: OCPP16ChargePointStatus.Faulted,
       },
       { to: OCPP16ChargePointStatus.Unavailable },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.Preparing
+        to: OCPP16ChargePointStatus.Preparing,
       },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       {
         from: OCPP16ChargePointStatus.Unavailable,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        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
+        to: OCPP16ChargePointStatus.Faulted,
       },
       { to: OCPP16ChargePointStatus.Faulted },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Available
+        to: OCPP16ChargePointStatus.Available,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Preparing
+        to: OCPP16ChargePointStatus.Preparing,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Charging
+        to: OCPP16ChargePointStatus.Charging,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.SuspendedEV
+        to: OCPP16ChargePointStatus.SuspendedEV,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.SuspendedEVSE
+        to: OCPP16ChargePointStatus.SuspendedEVSE,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Finishing
+        to: OCPP16ChargePointStatus.Finishing,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Reserved
+        to: OCPP16ChargePointStatus.Reserved,
       },
       {
         from: OCPP16ChargePointStatus.Faulted,
-        to: OCPP16ChargePointStatus.Unavailable
-      }
+        to: OCPP16ChargePointStatus.Unavailable,
+      },
       // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
     ])
 }
index 4b6a7c13f970d2fdea2b1adc335d772cb9bab53f..30b071087c1dfa5785fc5a7a5e52a89dbd2e9af5 100644 (file)
@@ -12,7 +12,7 @@ import {
   differenceInSeconds,
   type Interval,
   isDate,
-  secondsToMilliseconds
+  secondsToMilliseconds,
 } from 'date-fns'
 import { maxTime } from 'date-fns/constants'
 import { isEmpty } from 'rambda'
@@ -27,7 +27,7 @@ import {
   prepareChargingProfileKind,
   removeExpiredReservations,
   resetAuthorizeConnectorStatus,
-  setConfigurationKeyValue
+  setConfigurationKeyValue,
 } from '../../../charging-station/index.js'
 import { OCPPError } from '../../../exception/index.js'
 import {
@@ -98,7 +98,7 @@ import {
   type SetChargingProfileRequest,
   type SetChargingProfileResponse,
   type UnlockConnectorRequest,
-  type UnlockConnectorResponse
+  type UnlockConnectorResponse,
 } from '../../../types/index.js'
 import {
   Configuration,
@@ -111,7 +111,7 @@ import {
   isNotEmptyArray,
   isNotEmptyString,
   logger,
-  sleep
+  sleep,
 } from '../../../utils/index.js'
 import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js'
 import { OCPP16Constants } from './OCPP16Constants.js'
@@ -123,8 +123,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
   protected payloadValidateFunctions: Map<OCPP16IncomingRequestCommand, ValidateFunction<JsonType>>
 
   private readonly incomingRequestHandlers: Map<
-  OCPP16IncomingRequestCommand,
-  IncomingRequestHandler
+    OCPP16IncomingRequestCommand,
+    IncomingRequestHandler
   >
 
   public constructor () {
@@ -135,76 +135,76 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     this.incomingRequestHandlers = new Map<OCPP16IncomingRequestCommand, IncomingRequestHandler>([
       [
         OCPP16IncomingRequestCommand.RESET,
-        this.handleRequestReset.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestReset.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CACHE,
-        this.handleRequestClearCache.bind(this) as IncomingRequestHandler
+        this.handleRequestClearCache.bind(this) as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
-        this.handleRequestUnlockConnector.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestUnlockConnector.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.GET_CONFIGURATION,
-        this.handleRequestGetConfiguration.bind(this) as IncomingRequestHandler
+        this.handleRequestGetConfiguration.bind(this) as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
-        this.handleRequestChangeConfiguration.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestChangeConfiguration.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
-        this.handleRequestGetCompositeSchedule.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestGetCompositeSchedule.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
-        this.handleRequestSetChargingProfile.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestSetChargingProfile.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
-        this.handleRequestClearChargingProfile.bind(this) as IncomingRequestHandler
+        this.handleRequestClearChargingProfile.bind(this) as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
-        this.handleRequestChangeAvailability.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestChangeAvailability.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
-        this.handleRequestRemoteStartTransaction.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestRemoteStartTransaction.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
-        this.handleRequestRemoteStopTransaction.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestRemoteStopTransaction.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
-        this.handleRequestGetDiagnostics.bind(this) as IncomingRequestHandler
+        this.handleRequestGetDiagnostics.bind(this) as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
-        this.handleRequestTriggerMessage.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestTriggerMessage.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.DATA_TRANSFER,
-        this.handleRequestDataTransfer.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestDataTransfer.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
-        this.handleRequestUpdateFirmware.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestUpdateFirmware.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.RESERVE_NOW,
-        this.handleRequestReserveNow.bind(this) as unknown as IncomingRequestHandler
+        this.handleRequestReserveNow.bind(this) as unknown as IncomingRequestHandler,
       ],
       [
         OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
-        this.handleRequestCancelReservation.bind(this) as unknown as IncomingRequestHandler
-      ]
+        this.handleRequestCancelReservation.bind(this) as unknown as IncomingRequestHandler,
+      ],
     ])
     this.payloadValidateFunctions = new Map<
-    OCPP16IncomingRequestCommand,
-    ValidateFunction<JsonType>
+      OCPP16IncomingRequestCommand,
+      ValidateFunction<JsonType>
     >([
       [
         OCPP16IncomingRequestCommand.RESET,
@@ -216,7 +216,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CACHE,
@@ -228,7 +228,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
@@ -240,7 +240,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_CONFIGURATION,
@@ -252,7 +252,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
@@ -264,7 +264,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
@@ -276,7 +276,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
@@ -288,7 +288,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
@@ -300,7 +300,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
@@ -312,7 +312,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
@@ -324,7 +324,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
@@ -336,7 +336,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
@@ -348,7 +348,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
@@ -360,7 +360,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.DATA_TRANSFER,
@@ -372,7 +372,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
@@ -384,7 +384,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.RESERVE_NOW,
@@ -396,7 +396,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
@@ -408,8 +408,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     // Handle incoming request events
     this.on(
@@ -425,27 +425,32 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           chargingStation.getConnectorStatus(connectorId!)!.transactionRemoteStarted = true
           chargingStation.ocppRequestService
             .requestHandler<Partial<OCPP16StartTransactionRequest>, OCPP16StartTransactionResponse>(
-            chargingStation,
-            OCPP16RequestCommand.START_TRANSACTION,
-            {
-              connectorId,
-              idTag
-            }
-          )
+              chargingStation,
+              OCPP16RequestCommand.START_TRANSACTION,
+              {
+                connectorId,
+                idTag,
+              }
+            )
             .then(response => {
               if (response.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) {
                 logger.debug(
                   `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+                    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                     chargingStation.stationInfo?.chargingStationId
-                  }#${connectorId} for idTag '${idTag}'`
+                  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                  }#${connectorId?.toString()} for idTag '${idTag}'`
                 )
               } else {
                 logger.debug(
                   `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+                    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                     chargingStation.stationInfo?.chargingStationId
-                  }#${connectorId} for idTag '${idTag}'`
+                  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                  }#${connectorId?.toString()} for idTag '${idTag}'`
                 )
               }
+              return undefined
             })
             .catch((error: unknown) => {
               logger.error(
@@ -472,16 +477,19 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
               if (response.status === GenericStatus.Accepted) {
                 logger.debug(
                   `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED on ${
+                    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                     chargingStation.stationInfo?.chargingStationId
-                  }#${connectorId} for transaction '${transactionId}'`
+                  }#${connectorId.toString()} for transaction '${transactionId.toString()}'`
                 )
               } else {
                 logger.debug(
                   `${chargingStation.logPrefix()} Remote stop transaction REJECTED on ${
+                    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                     chargingStation.stationInfo?.chargingStationId
-                  }#${connectorId} for transaction '${transactionId}'`
+                  }#${connectorId.toString()} for transaction '${transactionId.toString()}'`
                 )
               }
+              return undefined
             })
             .catch((error: unknown) => {
               logger.error(
@@ -513,80 +521,80 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           case OCPP16MessageTrigger.BootNotification:
             chargingStation.ocppRequestService
               .requestHandler<
-            OCPP16BootNotificationRequest,
-            OCPP16BootNotificationResponse
-            >(chargingStation, OCPP16RequestCommand.BOOT_NOTIFICATION, chargingStation.bootNotificationRequest as OCPP16BootNotificationRequest, { skipBufferingOnError: true, triggerMessage: true })
+                OCPP16BootNotificationRequest,
+                OCPP16BootNotificationResponse
+              >(chargingStation, OCPP16RequestCommand.BOOT_NOTIFICATION, chargingStation.bootNotificationRequest as OCPP16BootNotificationRequest, { skipBufferingOnError: true, triggerMessage: true })
               .catch(errorHandler)
             break
           case OCPP16MessageTrigger.Heartbeat:
             chargingStation.ocppRequestService
               .requestHandler<OCPP16HeartbeatRequest, OCPP16HeartbeatResponse>(
-              chargingStation,
-              OCPP16RequestCommand.HEARTBEAT,
-              undefined,
-              {
-                triggerMessage: true
-              }
-            )
+                chargingStation,
+                OCPP16RequestCommand.HEARTBEAT,
+                undefined,
+                {
+                  triggerMessage: true,
+                }
+              )
               .catch(errorHandler)
             break
           case OCPP16MessageTrigger.StatusNotification:
             if (connectorId != null) {
               chargingStation.ocppRequestService
                 .requestHandler<OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse>(
-                chargingStation,
-                OCPP16RequestCommand.STATUS_NOTIFICATION,
-                {
-                  connectorId,
-                  errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
-                  status: chargingStation.getConnectorStatus(connectorId)
-                    ?.status as OCPP16ChargePointStatus
-                },
-                {
-                  triggerMessage: true
-                }
-              )
+                  chargingStation,
+                  OCPP16RequestCommand.STATUS_NOTIFICATION,
+                  {
+                    connectorId,
+                    errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
+                    status: chargingStation.getConnectorStatus(connectorId)
+                      ?.status as OCPP16ChargePointStatus,
+                  },
+                  {
+                    triggerMessage: true,
+                  }
+                )
                 .catch(errorHandler)
             } else if (chargingStation.hasEvses) {
               for (const evseStatus of chargingStation.evses.values()) {
                 for (const [id, connectorStatus] of evseStatus.connectors) {
                   chargingStation.ocppRequestService
                     .requestHandler<
-                  OCPP16StatusNotificationRequest,
-                  OCPP16StatusNotificationResponse
+                      OCPP16StatusNotificationRequest,
+                      OCPP16StatusNotificationResponse
+                    >(
+                      chargingStation,
+                      OCPP16RequestCommand.STATUS_NOTIFICATION,
+                      {
+                        connectorId: id,
+                        errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
+                        status: connectorStatus.status as OCPP16ChargePointStatus,
+                      },
+                      {
+                        triggerMessage: true,
+                      }
+                    )
+                    .catch(errorHandler)
+                }
+              }
+            } else {
+              for (const [id, connectorStatus] of chargingStation.connectors) {
+                chargingStation.ocppRequestService
+                  .requestHandler<
+                    OCPP16StatusNotificationRequest,
+                    OCPP16StatusNotificationResponse
                   >(
                     chargingStation,
                     OCPP16RequestCommand.STATUS_NOTIFICATION,
                     {
                       connectorId: id,
                       errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
-                      status: connectorStatus.status as OCPP16ChargePointStatus
+                      status: connectorStatus.status as OCPP16ChargePointStatus,
                     },
                     {
-                      triggerMessage: true
+                      triggerMessage: true,
                     }
                   )
-                    .catch(errorHandler)
-                }
-              }
-            } else {
-              for (const [id, connectorStatus] of chargingStation.connectors) {
-                chargingStation.ocppRequestService
-                  .requestHandler<
-                OCPP16StatusNotificationRequest,
-                OCPP16StatusNotificationResponse
-                >(
-                  chargingStation,
-                  OCPP16RequestCommand.STATUS_NOTIFICATION,
-                  {
-                    connectorId: id,
-                    errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
-                    status: connectorStatus.status as OCPP16ChargePointStatus
-                  },
-                  {
-                    triggerMessage: true
-                  }
-                )
                   .catch(errorHandler)
               }
             }
@@ -723,12 +731,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { connectorId } = commandPayload
     if (!chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to unlock a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to unlock a non existing connector id ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED
     }
     if (connectorId === 0) {
-      logger.error(`${chargingStation.logPrefix()} Trying to unlock connector id ${connectorId}`)
+      logger.error(`${chargingStation.logPrefix()} Trying to unlock connector id ${connectorId.toString()}`)
       return OCPP16Constants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED
     }
     if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
@@ -765,7 +773,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
         configurationKey.push({
           key: configKey.key,
           readonly: configKey.readonly,
-          value: configKey.value
+          value: configKey.value,
         })
       }
     } else if (isNotEmptyArray(key)) {
@@ -778,7 +786,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           configurationKey.push({
             key: keyFound.key,
             readonly: keyFound.readonly,
-            value: keyFound.value
+            value: keyFound.value,
           })
         } else {
           unknownKey.push(k)
@@ -787,7 +795,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     }
     return {
       configurationKey,
-      unknownKey
+      unknownKey,
     }
   }
 
@@ -883,7 +891,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { connectorId, csChargingProfiles } = commandPayload
     if (!chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set charging profile(s) to a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to set charging profile(s) to a non existing connector id ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
     }
@@ -899,7 +907,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       connectorId === 0
     ) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
     }
@@ -910,7 +918,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       connectorStatus?.transactionStarted === false
     ) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId} without a started transaction`
+        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId.toString()} without a started transaction`
       )
       return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
     }
@@ -922,15 +930,16 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       csChargingProfiles.transactionId !== connectorStatus.transactionId
     ) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId} with a different transaction id ${
-          csChargingProfiles.transactionId
-        } than the started transaction id ${connectorStatus.transactionId}`
+        `${chargingStation.logPrefix()} Trying to set transaction charging profile(s) on connector ${connectorId.toString()} with a different transaction id ${
+          csChargingProfiles.transactionId.toString()
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+        } than the started transaction id ${connectorStatus.transactionId?.toString()}`
       )
       return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
     }
     OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, csChargingProfiles)
     logger.debug(
-      `${chargingStation.logPrefix()} Charging profile(s) set on connector id ${connectorId}: %j`,
+      `${chargingStation.logPrefix()} Charging profile(s) set on connector id ${connectorId.toString()}: %j`,
       csChargingProfiles
     )
     return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED
@@ -952,13 +961,13 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { connectorId, duration, chargingRateUnit } = commandPayload
     if (!chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to get composite schedule to a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to get composite schedule to a non existing connector id ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_RESPONSE_REJECTED
     }
     if (connectorId === 0) {
       logger.error(
-        `${chargingStation.logPrefix()} Get composite schedule on connector id ${connectorId} is not yet supported`
+        `${chargingStation.logPrefix()} Get composite schedule on connector id ${connectorId.toString()} is not yet supported`
       )
       return OCPP16Constants.OCPP_RESPONSE_REJECTED
     }
@@ -977,7 +986,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const currentDate = new Date()
     const compositeScheduleInterval: Interval = {
       start: currentDate,
-      end: addSeconds(currentDate, duration)
+      end: addSeconds(currentDate, duration),
     }
     // FIXME: add and handle charging station charging profiles
     const chargingProfiles: OCPP16ChargingProfile[] = getConnectorChargingProfiles(
@@ -990,7 +999,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (chargingProfile.chargingSchedule.startSchedule == null) {
         logger.debug(
           `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Charging profile id ${
-            chargingProfile.chargingProfileId
+            chargingProfile.chargingProfileId.toString()
           } has no startSchedule defined. Trying to set it to the connector current transaction start date`
         )
         // OCPP specifies that if startSchedule is not defined, it should be relative to start of the connector transaction
@@ -999,7 +1008,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (!isDate(chargingProfile.chargingSchedule.startSchedule)) {
         logger.warn(
           `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Charging profile id ${
-            chargingProfile.chargingProfileId
+            chargingProfile.chargingProfileId.toString()
           } startSchedule property is not a Date instance. Trying to convert it to a Date instance`
         )
         chargingProfile.chargingSchedule.startSchedule = convertToDate(
@@ -1009,7 +1018,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (chargingProfile.chargingSchedule.duration == null) {
         logger.debug(
           `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Charging profile id ${
-            chargingProfile.chargingProfileId
+            chargingProfile.chargingProfileId.toString()
           } has no duration defined and will be set to the maximum time allowed`
         )
         // OCPP specifies that if duration is not defined, it should be infinite
@@ -1050,7 +1059,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
         status: GenericStatus.Accepted,
         scheduleStart: compositeSchedule.startSchedule,
         connectorId,
-        chargingSchedule: compositeSchedule
+        chargingSchedule: compositeSchedule,
       }
     }
     return OCPP16Constants.OCPP_RESPONSE_REJECTED
@@ -1073,7 +1082,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     if (connectorId != null) {
       if (!chargingStation.hasConnector(connectorId)) {
         logger.error(
-          `${chargingStation.logPrefix()} Trying to clear a charging profile(s) to a non existing connector id ${connectorId}`
+          `${chargingStation.logPrefix()} Trying to clear a charging profile(s) to a non existing connector id ${connectorId.toString()}`
         )
         return OCPP16Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN
       }
@@ -1081,7 +1090,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (isNotEmptyArray(connectorStatus?.chargingProfiles)) {
         connectorStatus.chargingProfiles = []
         logger.debug(
-          `${chargingStation.logPrefix()} Charging profile(s) cleared on connector id ${connectorId}`
+          `${chargingStation.logPrefix()} Charging profile(s) cleared on connector id ${connectorId.toString()}`
         )
         return OCPP16Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED
       }
@@ -1126,7 +1135,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { connectorId, type } = commandPayload
     if (!chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to change the availability of a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to change the availability of a non existing connector id ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED
     }
@@ -1199,6 +1208,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (commandPayload.connectorId == null) {
         logger.debug(
           `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             chargingStation.stationInfo?.chargingStationId
           }, idTag '${commandPayload.idTag}': no available connector found`
         )
@@ -1250,8 +1260,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     }
     logger.debug(
       `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         chargingStation.stationInfo?.chargingStationId
-      }#${transactionConnectorId}}, idTag '${idTag}'`
+      }#${transactionConnectorId.toString()}}, idTag '${idTag}'`
     )
     return OCPP16Constants.OCPP_RESPONSE_ACCEPTED
   }
@@ -1264,9 +1275,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const connectorStatus = chargingStation.getConnectorStatus(connectorId)
     logger.debug(
       `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         chargingStation.stationInfo?.chargingStationId
-      }#${connectorId}, idTag '${idTag}', availability '${
+      }#${connectorId.toString()}, idTag '${idTag}', availability '${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         connectorStatus?.availability
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       }', status '${connectorStatus?.status}'`
     )
     return OCPP16Constants.OCPP_RESPONSE_REJECTED
@@ -1284,8 +1298,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, chargingProfile)
       logger.debug(
         `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           chargingStation.stationInfo?.chargingStationId
-        }#${connectorId}`,
+        }#${connectorId.toString()}`,
         chargingProfile
       )
       return true
@@ -1305,12 +1320,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { transactionId } = commandPayload
     if (chargingStation.getConnectorIdByTransactionId(transactionId) != null) {
       logger.debug(
-        `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED for transactionId '${transactionId}'`
+        `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED for transactionId '${transactionId.toString()}'`
       )
       return OCPP16Constants.OCPP_RESPONSE_ACCEPTED
     }
     logger.debug(
-      `${chargingStation.logPrefix()} Remote stop transaction REJECTED for transactionId '${transactionId}'`
+      `${chargingStation.logPrefix()} Remote stop transaction REJECTED for transactionId '${transactionId.toString()}'`
     )
     return OCPP16Constants.OCPP_RESPONSE_REJECTED
   }
@@ -1391,10 +1406,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       }
     }
     await chargingStation.ocppRequestService.requestHandler<
-    OCPP16FirmwareStatusNotificationRequest,
-    OCPP16FirmwareStatusNotificationResponse
+      OCPP16FirmwareStatusNotificationRequest,
+      OCPP16FirmwareStatusNotificationResponse
     >(chargingStation, OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-      status: OCPP16FirmwareStatus.Downloading
+      status: OCPP16FirmwareStatus.Downloading,
     })
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     chargingStation.stationInfo!.firmwareStatus = OCPP16FirmwareStatus.Downloading
@@ -1404,10 +1419,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     ) {
       await sleep(secondsToMilliseconds(randomInt(minDelay, maxDelay)))
       await chargingStation.ocppRequestService.requestHandler<
-      OCPP16FirmwareStatusNotificationRequest,
-      OCPP16FirmwareStatusNotificationResponse
+        OCPP16FirmwareStatusNotificationRequest,
+        OCPP16FirmwareStatusNotificationResponse
       >(chargingStation, OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-        status: chargingStation.stationInfo.firmwareUpgrade.failureStatus
+        status: chargingStation.stationInfo.firmwareUpgrade.failureStatus,
       })
       chargingStation.stationInfo.firmwareStatus =
         chargingStation.stationInfo.firmwareUpgrade.failureStatus
@@ -1415,10 +1430,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     }
     await sleep(secondsToMilliseconds(randomInt(minDelay, maxDelay)))
     await chargingStation.ocppRequestService.requestHandler<
-    OCPP16FirmwareStatusNotificationRequest,
-    OCPP16FirmwareStatusNotificationResponse
+      OCPP16FirmwareStatusNotificationRequest,
+      OCPP16FirmwareStatusNotificationResponse
     >(chargingStation, OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-      status: OCPP16FirmwareStatus.Downloaded
+      status: OCPP16FirmwareStatus.Downloaded,
     })
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     chargingStation.stationInfo!.firmwareStatus = OCPP16FirmwareStatus.Downloaded
@@ -1429,7 +1444,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       if (runningTransactions > 0) {
         const waitTime = secondsToMilliseconds(15)
         logger.debug(
-          `${chargingStation.logPrefix()} ${moduleName}.updateFirmwareSimulation: ${runningTransactions} transaction(s) in progress, waiting ${formatDurationMilliSeconds(
+          `${chargingStation.logPrefix()} ${moduleName}.updateFirmwareSimulation: ${runningTransactions.toString()} transaction(s) in progress, waiting ${formatDurationMilliSeconds(
             waitTime
           )} before continuing firmware update simulation`
         )
@@ -1474,10 +1489,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       return
     }
     await chargingStation.ocppRequestService.requestHandler<
-    OCPP16FirmwareStatusNotificationRequest,
-    OCPP16FirmwareStatusNotificationResponse
+      OCPP16FirmwareStatusNotificationRequest,
+      OCPP16FirmwareStatusNotificationResponse
     >(chargingStation, OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-      status: OCPP16FirmwareStatus.Installing
+      status: OCPP16FirmwareStatus.Installing,
     })
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     chargingStation.stationInfo!.firmwareStatus = OCPP16FirmwareStatus.Installing
@@ -1487,10 +1502,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     ) {
       await sleep(secondsToMilliseconds(randomInt(minDelay, maxDelay)))
       await chargingStation.ocppRequestService.requestHandler<
-      OCPP16FirmwareStatusNotificationRequest,
-      OCPP16FirmwareStatusNotificationResponse
+        OCPP16FirmwareStatusNotificationRequest,
+        OCPP16FirmwareStatusNotificationResponse
       >(chargingStation, OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, {
-        status: chargingStation.stationInfo.firmwareUpgrade.failureStatus
+        status: chargingStation.stationInfo.firmwareUpgrade.failureStatus,
       })
       chargingStation.stationInfo.firmwareStatus =
         chargingStation.stationInfo.firmwareUpgrade.failureStatus
@@ -1534,6 +1549,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           .filter(file => file.endsWith(extname(logConfiguration.file!)))
           // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
           .map(file => join(dirname(logConfiguration.file!), file))
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         const diagnosticsArchive = `${chargingStation.stationInfo?.chargingStationId}_logs.tar.gz`
         create({ gzip: true }, logFiles).pipe(createWriteStream(diagnosticsArchive))
         ftpClient = new Client()
@@ -1541,23 +1557,23 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           host: uri.hostname,
           ...(isNotEmptyString(uri.port) && { port: convertToInt(uri.port) }),
           ...(isNotEmptyString(uri.username) && { user: uri.username }),
-          ...(isNotEmptyString(uri.password) && { password: uri.password })
+          ...(isNotEmptyString(uri.password) && { password: uri.password }),
         })
         let uploadResponse: FTPResponse | undefined
         if (accessResponse.code === 220) {
           ftpClient.trackProgress(info => {
             logger.info(
               `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetDiagnostics: ${
-                info.bytes / 1024
+                (info.bytes / 1024).toString()
               } bytes transferred from diagnostics archive ${info.name}`
             )
             chargingStation.ocppRequestService
               .requestHandler<
-            OCPP16DiagnosticsStatusNotificationRequest,
-            OCPP16DiagnosticsStatusNotificationResponse
-            >(chargingStation, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, {
-              status: OCPP16DiagnosticsStatus.Uploading
-            })
+                OCPP16DiagnosticsStatusNotificationRequest,
+                OCPP16DiagnosticsStatusNotificationResponse
+              >(chargingStation, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, {
+                status: OCPP16DiagnosticsStatus.Uploading,
+              })
               .catch((error: unknown) => {
                 logger.error(
                   `${chargingStation.logPrefix()} ${moduleName}.handleRequestGetDiagnostics: Error while sending '${
@@ -1573,31 +1589,32 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           )
           if (uploadResponse.code === 226) {
             await chargingStation.ocppRequestService.requestHandler<
-            OCPP16DiagnosticsStatusNotificationRequest,
-            OCPP16DiagnosticsStatusNotificationResponse
+              OCPP16DiagnosticsStatusNotificationRequest,
+              OCPP16DiagnosticsStatusNotificationResponse
             >(chargingStation, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, {
-              status: OCPP16DiagnosticsStatus.Uploaded
+              status: OCPP16DiagnosticsStatus.Uploaded,
             })
             ftpClient.close()
             return { fileName: diagnosticsArchive }
           }
           throw new OCPPError(
             ErrorType.GENERIC_ERROR,
-            `Diagnostics transfer failed with error code ${accessResponse.code}|${uploadResponse.code}`,
+            `Diagnostics transfer failed with error code ${accessResponse.code.toString()}|${uploadResponse.code.toString()}`,
             OCPP16IncomingRequestCommand.GET_DIAGNOSTICS
           )
         }
         throw new OCPPError(
           ErrorType.GENERIC_ERROR,
-          `Diagnostics transfer failed with error code ${accessResponse.code}|${uploadResponse?.code}`,
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          `Diagnostics transfer failed with error code ${accessResponse.code.toString()}|${uploadResponse?.code.toString()}`,
           OCPP16IncomingRequestCommand.GET_DIAGNOSTICS
         )
       } catch (error) {
         await chargingStation.ocppRequestService.requestHandler<
-        OCPP16DiagnosticsStatusNotificationRequest,
-        OCPP16DiagnosticsStatusNotificationResponse
+          OCPP16DiagnosticsStatusNotificationRequest,
+          OCPP16DiagnosticsStatusNotificationResponse
         >(chargingStation, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, {
-          status: OCPP16DiagnosticsStatus.UploadFailed
+          status: OCPP16DiagnosticsStatus.UploadFailed,
         })
         ftpClient?.close()
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -1615,10 +1632,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
         } to transfer the diagnostic logs archive`
       )
       await chargingStation.ocppRequestService.requestHandler<
-      OCPP16DiagnosticsStatusNotificationRequest,
-      OCPP16DiagnosticsStatusNotificationResponse
+        OCPP16DiagnosticsStatusNotificationRequest,
+        OCPP16DiagnosticsStatusNotificationResponse
       >(chargingStation, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, {
-        status: OCPP16DiagnosticsStatus.UploadFailed
+        status: OCPP16DiagnosticsStatus.UploadFailed,
       })
       return OCPP16Constants.OCPP_RESPONSE_EMPTY
     }
@@ -1698,7 +1715,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     const { reservationId, idTag, connectorId } = commandPayload
     if (!chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to reserve a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to reserve a non existing connector id ${connectorId.toString()}`
       )
       return OCPP16Constants.OCPP_RESERVATION_RESPONSE_REJECTED
     }
@@ -1744,7 +1761,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
           }
           await chargingStation.addReservation({
             id: commandPayload.reservationId,
-            ...commandPayload
+            ...commandPayload,
           })
           response = OCPP16Constants.OCPP_RESERVATION_RESPONSE_ACCEPTED
           break
@@ -1781,7 +1798,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       const reservation = chargingStation.getReservationBy('reservationId', reservationId)
       if (reservation == null) {
         logger.debug(
-          `${chargingStation.logPrefix()} Reservation with id ${reservationId} does not exist on charging station`
+          `${chargingStation.logPrefix()} Reservation with id ${reservationId.toString()} does not exist on charging station`
         )
         return OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED
       }
@@ -1797,7 +1814,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
         OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
         error as Error,
         {
-          errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED
+          errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED,
         }
       )!
     }
index 6f772e0700d52f8c77280304f41ec7ae564ba7d4..7c8e9006d394d26dfa6bc026c1a424075a6c3783 100644 (file)
@@ -21,7 +21,7 @@ import {
   type OCPP16StatusNotificationRequest,
   type OCPP16StopTransactionRequest,
   OCPPVersion,
-  type RequestParams
+  type RequestParams,
 } from '../../../types/index.js'
 import { Constants, generateUUID } from '../../../utils/index.js'
 import { OCPPRequestService } from '../OCPPRequestService.js'
@@ -50,7 +50,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.BOOT_NOTIFICATION,
@@ -62,7 +62,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
@@ -74,7 +74,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.HEARTBEAT,
@@ -86,7 +86,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.METER_VALUES,
@@ -98,7 +98,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.STATUS_NOTIFICATION,
@@ -110,7 +110,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.START_TRANSACTION,
@@ -122,7 +122,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.STOP_TRANSACTION,
@@ -134,7 +134,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.DATA_TRANSFER,
@@ -146,7 +146,7 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
@@ -158,8 +158,8 @@ export class OCPP16RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.buildRequestPayload = this.buildRequestPayload.bind(this)
   }
@@ -218,7 +218,7 @@ export class OCPP16RequestService extends OCPPRequestService {
       case OCPP16RequestCommand.AUTHORIZE:
         return {
           idTag: Constants.DEFAULT_IDTAG,
-          ...commandParams
+          ...commandParams,
         } as unknown as Request
       case OCPP16RequestCommand.HEARTBEAT:
         return OCPP16Constants.OCPP_REQUEST_EMPTY as unknown as Request
@@ -241,9 +241,9 @@ export class OCPP16RequestService extends OCPPRequestService {
               chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved
                 ? 0
                 : (commandParams.connectorId as number)
-            )!.reservationId
+            )!.reservationId,
           }),
-          ...commandParams
+          ...commandParams,
         } as unknown as Request
       case OCPP16RequestCommand.STOP_TRANSACTION:
         chargingStation.stationInfo?.transactionDataMeterValues === true &&
@@ -268,9 +268,9 @@ export class OCPP16RequestService extends OCPPRequestService {
                 connectorId!,
                 energyActiveImportRegister
               )
-            )
+            ),
           }),
-          ...commandParams
+          ...commandParams,
         } as unknown as Request
       default:
         // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError().
index df8374214f8e8865fea5453e9ae4075ea5ee2ece..ee82e5acb949fb7ea77822786dae73642c563b7d 100644 (file)
@@ -8,7 +8,7 @@ import {
   type ChargingStation,
   getConfigurationKey,
   hasReservationExpired,
-  resetConnectorStatus
+  resetConnectorStatus,
 } from '../../../charging-station/index.js'
 import { OCPPError } from '../../../exception/index.js'
 import {
@@ -49,7 +49,7 @@ import {
   ReservationTerminationReason,
   type ResponseHandler,
   type SetChargingProfileResponse,
-  type UnlockConnectorResponse
+  type UnlockConnectorResponse,
 } from '../../../types/index.js'
 import { Constants, convertToInt, isAsyncFunction, logger } from '../../../utils/index.js'
 import { OCPPResponseService } from '../OCPPResponseService.js'
@@ -59,8 +59,8 @@ const moduleName = 'OCPP16ResponseService'
 
 export class OCPP16ResponseService extends OCPPResponseService {
   public incomingRequestResponsePayloadValidateFunctions: Map<
-  OCPP16IncomingRequestCommand,
-  ValidateFunction<JsonType>
+    OCPP16IncomingRequestCommand,
+    ValidateFunction<JsonType>
   >
 
   protected payloadValidateFunctions: Map<OCPP16RequestCommand, ValidateFunction<JsonType>>
@@ -74,29 +74,29 @@ export class OCPP16ResponseService extends OCPPResponseService {
     this.responseHandlers = new Map<OCPP16RequestCommand, ResponseHandler>([
       [
         OCPP16RequestCommand.BOOT_NOTIFICATION,
-        this.handleResponseBootNotification.bind(this) as ResponseHandler
+        this.handleResponseBootNotification.bind(this) as ResponseHandler,
       ],
       [OCPP16RequestCommand.HEARTBEAT, this.emptyResponseHandler],
       [OCPP16RequestCommand.AUTHORIZE, this.handleResponseAuthorize.bind(this) as ResponseHandler],
       [
         OCPP16RequestCommand.START_TRANSACTION,
-        this.handleResponseStartTransaction.bind(this) as ResponseHandler
+        this.handleResponseStartTransaction.bind(this) as ResponseHandler,
       ],
       [
         OCPP16RequestCommand.STOP_TRANSACTION,
-        this.handleResponseStopTransaction.bind(this) as ResponseHandler
+        this.handleResponseStopTransaction.bind(this) as ResponseHandler,
       ],
       [
         OCPP16RequestCommand.STATUS_NOTIFICATION,
-        this.emptyResponseHandler.bind(this) as ResponseHandler
+        this.emptyResponseHandler.bind(this) as ResponseHandler,
       ],
       [OCPP16RequestCommand.METER_VALUES, this.emptyResponseHandler],
       [
         OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
-        this.emptyResponseHandler.bind(this) as ResponseHandler
+        this.emptyResponseHandler.bind(this) as ResponseHandler,
       ],
       [OCPP16RequestCommand.DATA_TRANSFER, this.emptyResponseHandler],
-      [OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, this.emptyResponseHandler]
+      [OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, this.emptyResponseHandler],
     ])
     this.payloadValidateFunctions = new Map<OCPP16RequestCommand, ValidateFunction<JsonType>>([
       [
@@ -109,7 +109,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.HEARTBEAT,
@@ -121,7 +121,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.AUTHORIZE,
@@ -133,7 +133,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.START_TRANSACTION,
@@ -145,7 +145,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.STOP_TRANSACTION,
@@ -157,7 +157,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.STATUS_NOTIFICATION,
@@ -169,7 +169,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.METER_VALUES,
@@ -181,7 +181,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
@@ -193,7 +193,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.DATA_TRANSFER,
@@ -205,7 +205,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
@@ -217,12 +217,12 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.incomingRequestResponsePayloadValidateFunctions = new Map<
-    OCPP16IncomingRequestCommand,
-    ValidateFunction<JsonType>
+      OCPP16IncomingRequestCommand,
+      ValidateFunction<JsonType>
     >([
       [
         OCPP16IncomingRequestCommand.RESET,
@@ -234,7 +234,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CACHE,
@@ -246,7 +246,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
@@ -258,7 +258,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
@@ -270,7 +270,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_CONFIGURATION,
@@ -282,7 +282,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
@@ -294,7 +294,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
@@ -306,7 +306,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
@@ -318,7 +318,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
@@ -330,7 +330,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
@@ -342,7 +342,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
@@ -354,7 +354,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
@@ -366,7 +366,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
@@ -378,7 +378,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.DATA_TRANSFER,
@@ -390,7 +390,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
@@ -402,7 +402,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.RESERVE_NOW,
@@ -414,7 +414,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
@@ -426,8 +426,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.validatePayload = this.validatePayload.bind(this)
   }
@@ -450,7 +450,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
           if (isAsyncFunction(responseHandler)) {
             await responseHandler(chargingStation, payload, requestPayload)
           } else {
-            (
+            ;(
               responseHandler as (
                 chargingStation: ChargingStation,
                 payload: JsonType,
@@ -585,7 +585,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
         logger.debug(
           `${chargingStation.logPrefix()} idTag '${
             requestPayload.idTag
-          }' accepted on connector id ${authorizeConnectorId}`
+          }' accepted on connector id ${authorizeConnectorId.toString()}`
         )
       } else {
         authorizeConnectorStatus.idTagAuthorized = false
@@ -613,7 +613,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
     const { connectorId } = requestPayload
     if (connectorId === 0 || !chargingStation.hasConnector(connectorId)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to start a transaction on a non existing connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Trying to start a transaction on a non existing connector id ${connectorId.toString()}`
       )
       return
     }
@@ -627,8 +627,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
     ) {
       logger.error(
         `${chargingStation.logPrefix()} Trying to start a transaction with a not local authorized idTag ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           connectorStatus.localAuthorizeIdTag
-        } on connector id ${connectorId}`
+        } on connector id ${connectorId.toString()}`
       )
       await this.resetConnectorOnStartTransactionError(chargingStation, connectorId)
       return
@@ -642,8 +643,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
     ) {
       logger.error(
         `${chargingStation.logPrefix()} Trying to start a transaction with a not authorized idTag ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           connectorStatus.authorizeIdTag
-        } on connector id ${connectorId}`
+        } on connector id ${connectorId.toString()}`
       )
       await this.resetConnectorOnStartTransactionError(chargingStation, connectorId)
       return
@@ -658,7 +660,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
           requestPayload.idTag
         } different from the authorize request one ${
           connectorStatus.authorizeIdTag
-        } on connector id ${connectorId}`
+        } on connector id ${connectorId.toString()}`
       )
       await this.resetConnectorOnStartTransactionError(chargingStation, connectorId)
       return
@@ -673,14 +675,15 @@ export class OCPP16ResponseService extends OCPPResponseService {
           requestPayload.idTag
         } different from the local authorized one ${
           connectorStatus.localAuthorizeIdTag
-        } on connector id ${connectorId}`
+        } on connector id ${connectorId.toString()}`
       )
       await this.resetConnectorOnStartTransactionError(chargingStation, connectorId)
       return
     }
     if (connectorStatus?.transactionStarted === true) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector id ${connectorId} by idTag ${
+        `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector id ${connectorId.toString()} by idTag ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           connectorStatus.transactionIdTag
         }`
       )
@@ -692,7 +695,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
           for (const [id, status] of evseStatus.connectors) {
             if (id !== connectorId && status.transactionStarted === true) {
               logger.error(
-                `${chargingStation.logPrefix()} Trying to start a transaction on an already used evse id ${evseId} by connector id ${id} with idTag ${
+                `${chargingStation.logPrefix()} Trying to start a transaction on an already used evse id ${evseId.toString()} by connector id ${id.toString()} with idTag ${
+                  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                   status.transactionIdTag
                 }`
               )
@@ -708,7 +712,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
       connectorStatus?.status !== OCPP16ChargePointStatus.Preparing
     ) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with status ${
+        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId.toString()} with status ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           connectorStatus?.status
         }`
       )
@@ -716,8 +721,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
     }
     if (!Number.isSafeInteger(payload.transactionId)) {
       logger.warn(
-        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with a non integer transaction id ${
-          payload.transactionId
+        `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId.toString()} with a non integer transaction id ${
+          payload.transactionId.toString()
         }, converting to integer`
       )
       payload.transactionId = convertToInt(payload.transactionId)
@@ -744,7 +749,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
           if (reservation.idTag !== requestPayload.idTag) {
             logger.warn(
               `${chargingStation.logPrefix()} Reserved transaction ${
-                payload.transactionId
+                payload.transactionId.toString()
               } started with a different idTag ${
                 requestPayload.idTag
               } than the reservation one ${reservation.idTag}`
@@ -753,9 +758,9 @@ export class OCPP16ResponseService extends OCPPResponseService {
           if (hasReservationExpired(reservation)) {
             logger.warn(
               `${chargingStation.logPrefix()} Reserved transaction ${
-                payload.transactionId
+                payload.transactionId.toString()
               } started with expired reservation ${
-                requestPayload.reservationId
+                requestPayload.reservationId.toString()
               } (expiry date: ${reservation.expiryDate.toISOString()}))`
             )
           }
@@ -766,19 +771,19 @@ export class OCPP16ResponseService extends OCPPResponseService {
         } else {
           logger.warn(
             `${chargingStation.logPrefix()} Reserved transaction ${
-              payload.transactionId
-            } started with unknown reservation ${requestPayload.reservationId}`
+              payload.transactionId.toString()
+            } started with unknown reservation ${requestPayload.reservationId.toString()}`
           )
         }
       }
       chargingStation.stationInfo?.beginEndMeterValues === true &&
         (await chargingStation.ocppRequestService.requestHandler<
-        OCPP16MeterValuesRequest,
-        OCPP16MeterValuesResponse
+          OCPP16MeterValuesRequest,
+          OCPP16MeterValuesResponse
         >(chargingStation, OCPP16RequestCommand.METER_VALUES, {
           connectorId,
           transactionId: payload.transactionId,
-          meterValue: [connectorStatus.transactionBeginMeterValue]
+          meterValue: [connectorStatus.transactionBeginMeterValue],
         } satisfies OCPP16MeterValuesRequest))
       await OCPP16ServiceUtils.sendAndSetConnectorStatus(
         chargingStation,
@@ -786,9 +791,10 @@ export class OCPP16ResponseService extends OCPPResponseService {
         OCPP16ChargePointStatus.Charging
       )
       logger.info(
-        `${chargingStation.logPrefix()} Transaction with id ${payload.transactionId} STARTED on ${
+        `${chargingStation.logPrefix()} Transaction with id ${payload.transactionId.toString()} STARTED on ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           chargingStation.stationInfo?.chargingStationId
-        }#${connectorId} for idTag '${requestPayload.idTag}'`
+        }#${connectorId.toString()} for idTag '${requestPayload.idTag}'`
       )
       if (chargingStation.stationInfo?.powerSharedByConnectors === true) {
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -807,14 +813,16 @@ export class OCPP16ResponseService extends OCPPResponseService {
     } else {
       logger.warn(
         `${chargingStation.logPrefix()} Starting transaction with id ${
-          payload.transactionId
+          payload.transactionId.toString()
         } REJECTED on ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           chargingStation.stationInfo?.chargingStationId
-        }#${connectorId} with status '${payload.idTagInfo.status}', idTag '${
+        }#${connectorId.toString()} with status '${payload.idTagInfo.status}', idTag '${
           requestPayload.idTag
         }'${
           OCPP16ServiceUtils.hasReservation(chargingStation, connectorId, requestPayload.idTag)
-            ? `, reservationId '${requestPayload.reservationId}'`
+            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            ? `, reservationId '${requestPayload.reservationId?.toString()}'`
             : ''
         }`
       )
@@ -843,7 +851,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
     if (transactionConnectorId == null) {
       logger.error(
         `${chargingStation.logPrefix()} Trying to stop a non existing transaction with id ${
-          requestPayload.transactionId
+          requestPayload.transactionId.toString()
         }`
       )
       return
@@ -852,8 +860,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
       chargingStation.stationInfo.ocppStrictCompliance === false &&
       chargingStation.stationInfo.outOfOrderEndMeterValues === true &&
       (await chargingStation.ocppRequestService.requestHandler<
-      OCPP16MeterValuesRequest,
-      OCPP16MeterValuesResponse
+        OCPP16MeterValuesRequest,
+        OCPP16MeterValuesResponse
       >(chargingStation, OCPP16RequestCommand.METER_VALUES, {
         connectorId: transactionConnectorId,
         transactionId: requestPayload.transactionId,
@@ -862,8 +870,8 @@ export class OCPP16ResponseService extends OCPPResponseService {
             chargingStation,
             transactionConnectorId,
             requestPayload.meterStop
-          )
-        ]
+          ),
+        ],
       }))
     if (
       !chargingStation.isChargingStationAvailable() ||
@@ -888,10 +896,12 @@ export class OCPP16ResponseService extends OCPPResponseService {
     resetConnectorStatus(chargingStation.getConnectorStatus(transactionConnectorId))
     chargingStation.stopMeterValues(transactionConnectorId)
     const logMsg = `${chargingStation.logPrefix()} Transaction with id ${
-      requestPayload.transactionId
+      requestPayload.transactionId.toString()
     } STOPPED on ${
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       chargingStation.stationInfo?.chargingStationId
-    }#${transactionConnectorId} with status '${payload.idTagInfo?.status}'`
+    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+    }#${transactionConnectorId.toString()} with status '${payload.idTagInfo?.status}'`
     if (
       payload.idTagInfo == null ||
       payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED
index d9144064003fb5bf07e0443720e17ac2af084501..5d77bffbe2eaffd74a82640a05ebc0ee01092e4e 100644 (file)
@@ -8,13 +8,13 @@ import {
   type Interval,
   isAfter,
   isBefore,
-  isWithinInterval
+  isWithinInterval,
 } from 'date-fns'
 
 import {
   type ChargingStation,
   hasFeatureProfile,
-  hasReservationExpired
+  hasReservationExpired,
 } from '../../../charging-station/index.js'
 import {
   type ConfigurationKey,
@@ -35,7 +35,7 @@ import {
   OCPP16StandardParametersKey,
   OCPP16StopTransactionReason,
   type OCPP16SupportedFeatureProfiles,
-  OCPPVersion
+  OCPPVersion,
 } from '../../../types/index.js'
 import { convertToDate, isNotEmptyArray, logger, roundTo } from '../../../utils/index.js'
 import { OCPPServiceUtils } from '../OCPPServiceUtils.js'
@@ -65,7 +65,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
   ): OCPP16MeterValue {
     const meterValue: OCPP16MeterValue = {
       timestamp: new Date(),
-      sampledValue: []
+      sampledValue: [],
     }
     // Energy.Active.Import.Register measurand (default)
     const sampledValueTemplate = OCPP16ServiceUtils.getSampledValueTemplate(
@@ -152,14 +152,14 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
   ): void {
     if (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles == null) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId} with an uninitialized charging profiles array attribute, applying deferred initialization`
+        `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId.toString()} with an uninitialized charging profiles array attribute, applying deferred initialization`
       )
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       chargingStation.getConnectorStatus(connectorId)!.chargingProfiles = []
     }
     if (!Array.isArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)) {
       logger.error(
-        `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId} with an improper attribute type for the charging profiles array, applying proper type deferred initialization`
+        `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId.toString()} with an improper attribute type for the charging profiles array, applying proper type deferred initialization`
       )
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       chargingStation.getConnectorStatus(connectorId)!.chargingProfiles = []
@@ -256,7 +256,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
         compositeChargingScheduleHigher!.startSchedule!,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         compositeChargingScheduleHigher!.duration!
-      )
+      ),
     }
     const compositeChargingScheduleLowerInterval: Interval = {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -266,7 +266,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
         compositeChargingScheduleLower!.startSchedule!,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         compositeChargingScheduleLower!.duration!
-      )
+      ),
     }
     const higherFirst = isBefore(
       compositeChargingScheduleHigherInterval.start,
@@ -305,7 +305,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   differenceInSeconds(
                     compositeChargingScheduleHigherInterval.start,
                     compositeChargingScheduleLowerInterval.start
-                  )
+                  ),
             }
           }),
           // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -318,10 +318,10 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                     compositeChargingScheduleLowerInterval.start,
                     compositeChargingScheduleHigherInterval.start
                   )
-                : 0
+                : 0,
             }
-          })
-        ].sort((a, b) => a.startPeriod - b.startPeriod)
+          }),
+        ].sort((a, b) => a.startPeriod - b.startPeriod),
       }
     }
     return {
@@ -351,7 +351,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 differenceInSeconds(
                   compositeChargingScheduleHigherInterval.start,
                   compositeChargingScheduleLowerInterval.start
-                )
+                ),
           }
         }),
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -366,7 +366,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 ),
                 {
                   start: compositeChargingScheduleLowerInterval.start,
-                  end: compositeChargingScheduleHigherInterval.end
+                  end: compositeChargingScheduleHigherInterval.end,
                 }
               )
             ) {
@@ -383,7 +383,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 ),
                 {
                   start: compositeChargingScheduleLowerInterval.start,
-                  end: compositeChargingScheduleHigherInterval.end
+                  end: compositeChargingScheduleHigherInterval.end,
                 }
               ) &&
               isWithinInterval(
@@ -394,7 +394,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 ),
                 {
                   start: compositeChargingScheduleLowerInterval.start,
-                  end: compositeChargingScheduleHigherInterval.end
+                  end: compositeChargingScheduleHigherInterval.end,
                 }
               )
             ) {
@@ -409,7 +409,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 ),
                 {
                   start: compositeChargingScheduleHigherInterval.start,
-                  end: compositeChargingScheduleLowerInterval.end
+                  end: compositeChargingScheduleLowerInterval.end,
                 }
               )
             ) {
@@ -429,10 +429,10 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                     compositeChargingScheduleLowerInterval.start,
                     compositeChargingScheduleHigherInterval.start
                   )
-                : 0
+                : 0,
             }
-          })
-      ].sort((a, b) => a.startPeriod - b.startPeriod)
+          }),
+      ].sort((a, b) => a.startPeriod - b.startPeriod),
     }
   }
 
@@ -462,7 +462,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
         chargingStationReservation.idTag === idTag)
     ) {
       logger.debug(
-        `${chargingStation.logPrefix()} Connector id ${connectorId} has a valid reservation for idTag ${idTag}: %j`,
+        `${chargingStation.logPrefix()} Connector id ${connectorId.toString()} has a valid reservation for idTag ${idTag}: %j`,
         connectorReservation ?? chargingStationReservation
       )
       return true
@@ -491,7 +491,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       start: chargingSchedule.startSchedule!,
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      end: addSeconds(chargingSchedule.startSchedule!, chargingSchedule.duration!)
+      end: addSeconds(chargingSchedule.startSchedule!, chargingSchedule.duration!),
     }
     if (areIntervalsOverlapping(chargingScheduleInterval, compositeInterval)) {
       chargingSchedule.chargingSchedulePeriod.sort((a, b) => a.startPeriod - b.startPeriod)
@@ -536,7 +536,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                 schedulePeriod.startPeriod = 0
               }
               return schedulePeriod
-            })
+            }),
         }
       }
       if (isAfter(chargingScheduleInterval.end, compositeInterval.end)) {
@@ -551,7 +551,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
               addSeconds(chargingScheduleInterval.start, schedulePeriod.startPeriod),
               compositeInterval
             )
-          )
+          ),
         }
       }
       return chargingSchedule
index 9e3c52a0e3a1f590f9476063d81f0135d18461ef..c94fbe9f10d486e2eeb6a98b52bf25ad8a7e70d7 100644 (file)
@@ -1,6 +1,6 @@
 import {
   type ConnectorStatusTransition,
-  OCPP20ConnectorStatusEnumType
+  OCPP20ConnectorStatusEnumType,
 } from '../../../types/index.js'
 import { OCPPConstants } from '../OCPPConstants.js'
 
@@ -11,16 +11,16 @@ export class OCPP20Constants extends OCPPConstants {
       // { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
       {
         from: OCPP20ConnectorStatusEnumType.Available,
-        to: OCPP20ConnectorStatusEnumType.Unavailable
+        to: OCPP20ConnectorStatusEnumType.Unavailable,
       },
       {
         from: OCPP20ConnectorStatusEnumType.Available,
-        to: OCPP20ConnectorStatusEnumType.Faulted
+        to: OCPP20ConnectorStatusEnumType.Faulted,
       },
       { to: OCPP20ConnectorStatusEnumType.Unavailable },
       {
         from: OCPP20ConnectorStatusEnumType.Unavailable,
-        to: OCPP20ConnectorStatusEnumType.Available
+        to: OCPP20ConnectorStatusEnumType.Available,
       },
       // {
       //   from: OCPP20ConnectorStatusEnumType.Unavailable,
@@ -28,17 +28,17 @@ export class OCPP20Constants extends OCPPConstants {
       // },
       {
         from: OCPP20ConnectorStatusEnumType.Unavailable,
-        to: OCPP20ConnectorStatusEnumType.Faulted
+        to: OCPP20ConnectorStatusEnumType.Faulted,
       },
       { to: OCPP20ConnectorStatusEnumType.Faulted },
       {
         from: OCPP20ConnectorStatusEnumType.Faulted,
-        to: OCPP20ConnectorStatusEnumType.Available
+        to: OCPP20ConnectorStatusEnumType.Available,
       },
       {
         from: OCPP20ConnectorStatusEnumType.Faulted,
-        to: OCPP20ConnectorStatusEnumType.Unavailable
-      }
+        to: OCPP20ConnectorStatusEnumType.Unavailable,
+      },
       // { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted }
     ])
 
@@ -47,85 +47,85 @@ export class OCPP20Constants extends OCPPConstants {
     // { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
     {
       from: OCPP20ConnectorStatusEnumType.Available,
-      to: OCPP20ConnectorStatusEnumType.Occupied
+      to: OCPP20ConnectorStatusEnumType.Occupied,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Available,
-      to: OCPP20ConnectorStatusEnumType.Reserved
+      to: OCPP20ConnectorStatusEnumType.Reserved,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Available,
-      to: OCPP20ConnectorStatusEnumType.Unavailable
+      to: OCPP20ConnectorStatusEnumType.Unavailable,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Available,
-      to: OCPP20ConnectorStatusEnumType.Faulted
+      to: OCPP20ConnectorStatusEnumType.Faulted,
     },
     // { to: OCPP20ConnectorStatusEnumType.Occupied },
     {
       from: OCPP20ConnectorStatusEnumType.Occupied,
-      to: OCPP20ConnectorStatusEnumType.Available
+      to: OCPP20ConnectorStatusEnumType.Available,
     },
     // { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Occupied },
     // { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Reserved },
     {
       from: OCPP20ConnectorStatusEnumType.Occupied,
-      to: OCPP20ConnectorStatusEnumType.Unavailable
+      to: OCPP20ConnectorStatusEnumType.Unavailable,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Occupied,
-      to: OCPP20ConnectorStatusEnumType.Faulted
+      to: OCPP20ConnectorStatusEnumType.Faulted,
     },
     // { to: OCPP20ConnectorStatusEnumType.Reserved },
     {
       from: OCPP20ConnectorStatusEnumType.Reserved,
-      to: OCPP20ConnectorStatusEnumType.Available
+      to: OCPP20ConnectorStatusEnumType.Available,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Reserved,
-      to: OCPP20ConnectorStatusEnumType.Occupied
+      to: OCPP20ConnectorStatusEnumType.Occupied,
     },
     // { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Reserved },
     {
       from: OCPP20ConnectorStatusEnumType.Reserved,
-      to: OCPP20ConnectorStatusEnumType.Unavailable
+      to: OCPP20ConnectorStatusEnumType.Unavailable,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Reserved,
-      to: OCPP20ConnectorStatusEnumType.Faulted
+      to: OCPP20ConnectorStatusEnumType.Faulted,
     },
     { to: OCPP20ConnectorStatusEnumType.Unavailable },
     {
       from: OCPP20ConnectorStatusEnumType.Unavailable,
-      to: OCPP20ConnectorStatusEnumType.Available
+      to: OCPP20ConnectorStatusEnumType.Available,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Unavailable,
-      to: OCPP20ConnectorStatusEnumType.Occupied
+      to: OCPP20ConnectorStatusEnumType.Occupied,
     },
     // { from: OCPP20ConnectorStatusEnumType.Unavailable, to: OCPP20ConnectorStatusEnumType.Reserved },
     // { from: OCPP20ConnectorStatusEnumType.Unavailable, to: OCPP20ConnectorStatusEnumType.Unavailable },
     {
       from: OCPP20ConnectorStatusEnumType.Unavailable,
-      to: OCPP20ConnectorStatusEnumType.Faulted
+      to: OCPP20ConnectorStatusEnumType.Faulted,
     },
     { to: OCPP20ConnectorStatusEnumType.Faulted },
     {
       from: OCPP20ConnectorStatusEnumType.Faulted,
-      to: OCPP20ConnectorStatusEnumType.Available
+      to: OCPP20ConnectorStatusEnumType.Available,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Faulted,
-      to: OCPP20ConnectorStatusEnumType.Occupied
+      to: OCPP20ConnectorStatusEnumType.Occupied,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Faulted,
-      to: OCPP20ConnectorStatusEnumType.Reserved
+      to: OCPP20ConnectorStatusEnumType.Reserved,
     },
     {
       from: OCPP20ConnectorStatusEnumType.Faulted,
-      to: OCPP20ConnectorStatusEnumType.Unavailable
-    }
+      to: OCPP20ConnectorStatusEnumType.Unavailable,
+    },
     // { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted }
   ])
 }
index 4ae587d43f7de90a119341843b8682985c95dccc..5817ede428ddcc624fa0317f541cba74957daea1 100644 (file)
@@ -10,7 +10,7 @@ import {
   type JsonType,
   type OCPP20ClearCacheRequest,
   OCPP20IncomingRequestCommand,
-  OCPPVersion
+  OCPPVersion,
 } from '../../../types/index.js'
 import { isAsyncFunction, logger } from '../../../utils/index.js'
 import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js'
@@ -22,8 +22,8 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
   protected payloadValidateFunctions: Map<OCPP20IncomingRequestCommand, ValidateFunction<JsonType>>
 
   private readonly incomingRequestHandlers: Map<
-  OCPP20IncomingRequestCommand,
-  IncomingRequestHandler
+    OCPP20IncomingRequestCommand,
+    IncomingRequestHandler
   >
 
   public constructor () {
@@ -32,11 +32,11 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
     // }
     super(OCPPVersion.VERSION_201)
     this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>([
-      [OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)]
+      [OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)],
     ])
     this.payloadValidateFunctions = new Map<
-    OCPP20IncomingRequestCommand,
-    ValidateFunction<JsonType>
+      OCPP20IncomingRequestCommand,
+      ValidateFunction<JsonType>
     >([
       [
         OCPP20IncomingRequestCommand.CLEAR_CACHE,
@@ -48,8 +48,8 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.validatePayload = this.validatePayload.bind(this)
   }
index 38dbedf87f9b7f426507cfa8e92bf42ca5ef606d..0fb6c7f0808e036a6e310a9e666a2cb66e2fcd04 100644 (file)
@@ -13,7 +13,7 @@ import {
   OCPP20RequestCommand,
   type OCPP20StatusNotificationRequest,
   OCPPVersion,
-  type RequestParams
+  type RequestParams,
 } from '../../../types/index.js'
 import { generateUUID } from '../../../utils/index.js'
 import { OCPPRequestService } from '../OCPPRequestService.js'
@@ -42,7 +42,7 @@ export class OCPP20RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP20RequestCommand.HEARTBEAT,
@@ -54,7 +54,7 @@ export class OCPP20RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP20RequestCommand.STATUS_NOTIFICATION,
@@ -66,8 +66,8 @@ export class OCPP20RequestService extends OCPPRequestService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.buildRequestPayload = this.buildRequestPayload.bind(this)
   }
@@ -112,7 +112,7 @@ export class OCPP20RequestService extends OCPPRequestService {
       case OCPP20RequestCommand.STATUS_NOTIFICATION:
         return {
           timestamp: new Date(),
-          ...commandParams
+          ...commandParams,
         } as unknown as Request
       default:
         // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError().
index 9851d3339371d8fe3e47cb7a5dcaa835d7bcace0..d24800b2c5b7bbee36b9500f9392bb654aedd6ba 100644 (file)
@@ -17,7 +17,7 @@ import {
   type OCPP20StatusNotificationResponse,
   OCPPVersion,
   RegistrationStatusEnumType,
-  type ResponseHandler
+  type ResponseHandler,
 } from '../../../types/index.js'
 import { isAsyncFunction, logger } from '../../../utils/index.js'
 import { OCPPResponseService } from '../OCPPResponseService.js'
@@ -27,8 +27,8 @@ const moduleName = 'OCPP20ResponseService'
 
 export class OCPP20ResponseService extends OCPPResponseService {
   public incomingRequestResponsePayloadValidateFunctions: Map<
-  OCPP20IncomingRequestCommand,
-  ValidateFunction<JsonType>
+    OCPP20IncomingRequestCommand,
+    ValidateFunction<JsonType>
   >
 
   protected payloadValidateFunctions: Map<OCPP20RequestCommand, ValidateFunction<JsonType>>
@@ -42,10 +42,10 @@ export class OCPP20ResponseService extends OCPPResponseService {
     this.responseHandlers = new Map<OCPP20RequestCommand, ResponseHandler>([
       [
         OCPP20RequestCommand.BOOT_NOTIFICATION,
-        this.handleResponseBootNotification.bind(this) as ResponseHandler
+        this.handleResponseBootNotification.bind(this) as ResponseHandler,
       ],
       [OCPP20RequestCommand.HEARTBEAT, this.emptyResponseHandler],
-      [OCPP20RequestCommand.STATUS_NOTIFICATION, this.emptyResponseHandler]
+      [OCPP20RequestCommand.STATUS_NOTIFICATION, this.emptyResponseHandler],
     ])
     this.payloadValidateFunctions = new Map<OCPP20RequestCommand, ValidateFunction<JsonType>>([
       [
@@ -58,7 +58,7 @@ export class OCPP20ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP20RequestCommand.HEARTBEAT,
@@ -70,7 +70,7 @@ export class OCPP20ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
+          .bind(this),
       ],
       [
         OCPP20RequestCommand.STATUS_NOTIFICATION,
@@ -82,12 +82,12 @@ export class OCPP20ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.incomingRequestResponsePayloadValidateFunctions = new Map<
-    OCPP20IncomingRequestCommand,
-    ValidateFunction<JsonType>
+      OCPP20IncomingRequestCommand,
+      ValidateFunction<JsonType>
     >([
       [
         OCPP20IncomingRequestCommand.CLEAR_CACHE,
@@ -99,8 +99,8 @@ export class OCPP20ResponseService extends OCPPResponseService {
               'constructor'
             )
           )
-          .bind(this)
-      ]
+          .bind(this),
+      ],
     ])
     this.validatePayload = this.validatePayload.bind(this)
   }
@@ -123,7 +123,7 @@ export class OCPP20ResponseService extends OCPPResponseService {
           if (isAsyncFunction(responseHandler)) {
             await responseHandler(chargingStation, payload, requestPayload)
           } else {
-            (
+            ;(
               responseHandler as (
                 chargingStation: ChargingStation,
                 payload: JsonType,
index 2abb197892d1bb1dc35e0dd87d0739d37e9f3d58..404ee83413e3d09c582570196ab306828d42934e 100644 (file)
@@ -8,7 +8,7 @@ import {
   MeterValueMeasurand,
   ReservationStatus,
   TriggerMessageStatus,
-  UnlockStatus
+  UnlockStatus,
 } from '../../types/index.js'
 import { Constants } from '../../utils/index.js'
 
@@ -21,129 +21,129 @@ export class OCPPConstants {
     MeterValueMeasurand.VOLTAGE,
     MeterValueMeasurand.POWER_ACTIVE_IMPORT,
     MeterValueMeasurand.CURRENT_IMPORT,
-    MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
+    MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER,
   ])
 
   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
+    status: GenericStatus.Accepted,
   })
 
   static readonly OCPP_RESPONSE_REJECTED = Object.freeze({
-    status: GenericStatus.Rejected
+    status: GenericStatus.Rejected,
   })
 
   static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
-    status: ConfigurationStatus.ACCEPTED
+    status: ConfigurationStatus.ACCEPTED,
   })
 
   static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({
-    status: ConfigurationStatus.REJECTED
+    status: ConfigurationStatus.REJECTED,
   })
 
   static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({
-    status: ConfigurationStatus.REBOOT_REQUIRED
+    status: ConfigurationStatus.REBOOT_REQUIRED,
   })
 
   static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({
-    status: ConfigurationStatus.NOT_SUPPORTED
+    status: ConfigurationStatus.NOT_SUPPORTED,
   })
 
   static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
-    status: ChargingProfileStatus.ACCEPTED
+    status: ChargingProfileStatus.ACCEPTED,
   })
 
   static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({
-    status: ChargingProfileStatus.REJECTED
+    status: ChargingProfileStatus.REJECTED,
   })
 
   static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({
-    status: ChargingProfileStatus.NOT_SUPPORTED
+    status: ChargingProfileStatus.NOT_SUPPORTED,
   })
 
   static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
-    status: ClearChargingProfileStatus.ACCEPTED
+    status: ClearChargingProfileStatus.ACCEPTED,
   })
 
   static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({
-    status: ClearChargingProfileStatus.UNKNOWN
+    status: ClearChargingProfileStatus.UNKNOWN,
   })
 
   static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({
-    status: UnlockStatus.UNLOCKED
+    status: UnlockStatus.UNLOCKED,
   })
 
   static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
-    status: UnlockStatus.UNLOCK_FAILED
+    status: UnlockStatus.UNLOCK_FAILED,
   })
 
   static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({
-    status: UnlockStatus.NOT_SUPPORTED
+    status: UnlockStatus.NOT_SUPPORTED,
   })
 
   static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({
-    status: AvailabilityStatus.ACCEPTED
+    status: AvailabilityStatus.ACCEPTED,
   })
 
   static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({
-    status: AvailabilityStatus.REJECTED
+    status: AvailabilityStatus.REJECTED,
   })
 
   static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({
-    status: AvailabilityStatus.SCHEDULED
+    status: AvailabilityStatus.SCHEDULED,
   })
 
   static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({
-    status: TriggerMessageStatus.ACCEPTED
+    status: TriggerMessageStatus.ACCEPTED,
   })
 
   static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({
-    status: TriggerMessageStatus.REJECTED
+    status: TriggerMessageStatus.REJECTED,
   })
 
   static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({
-    status: TriggerMessageStatus.NOT_IMPLEMENTED
+    status: TriggerMessageStatus.NOT_IMPLEMENTED,
   })
 
   static readonly OCPP_DATA_TRANSFER_RESPONSE_ACCEPTED = Object.freeze({
-    status: DataTransferStatus.ACCEPTED
+    status: DataTransferStatus.ACCEPTED,
   })
 
   static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({
-    status: DataTransferStatus.REJECTED
+    status: DataTransferStatus.REJECTED,
   })
 
   static readonly OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID = Object.freeze({
-    status: DataTransferStatus.UNKNOWN_VENDOR_ID
+    status: DataTransferStatus.UNKNOWN_VENDOR_ID,
   })
 
   static readonly OCPP_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({
-    status: ReservationStatus.ACCEPTED
+    status: ReservationStatus.ACCEPTED,
   }) // Reservation has been made
 
   static readonly OCPP_RESERVATION_RESPONSE_FAULTED = Object.freeze({
-    status: ReservationStatus.FAULTED
+    status: ReservationStatus.FAULTED,
   }) // Reservation has not been made, because of connector in FAULTED state
 
   static readonly OCPP_RESERVATION_RESPONSE_OCCUPIED = Object.freeze({
-    status: ReservationStatus.OCCUPIED
+    status: ReservationStatus.OCCUPIED,
   }) // Reservation has not been made, because all connectors are OCCUPIED
 
   static readonly OCPP_RESERVATION_RESPONSE_REJECTED = Object.freeze({
-    status: ReservationStatus.REJECTED
+    status: ReservationStatus.REJECTED,
   }) // Reservation has not been made, because charging station is not configured to accept reservations
 
   static readonly OCPP_RESERVATION_RESPONSE_UNAVAILABLE = Object.freeze({
-    status: ReservationStatus.UNAVAILABLE
+    status: ReservationStatus.UNAVAILABLE,
   }) // Reservation has not been made, because connector is in UNAVAILABLE state
 
   static readonly OCPP_CANCEL_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({
-    status: GenericStatus.Accepted
+    status: GenericStatus.Accepted,
   }) // Reservation for id has been cancelled
 
   static readonly OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED = Object.freeze({
-    status: GenericStatus.Rejected
+    status: GenericStatus.Rejected,
   }) // Reservation could not be cancelled, because there is no reservation active for id
 
   protected constructor () {
index 545438d5d61dda84a995c1c4351562a1c8a94e1b..cdfd5c54d1293e7f14ae54a07e7ae0b95e6e62bc 100644 (file)
@@ -9,7 +9,7 @@ import type {
   ClearCacheResponse,
   IncomingRequestCommand,
   JsonType,
-  OCPPVersion
+  OCPPVersion,
 } from '../../types/index.js'
 import { logger } from '../../utils/index.js'
 import { OCPPConstants } from './OCPPConstants.js'
@@ -26,8 +26,8 @@ export abstract class OCPPIncomingRequestService extends EventEmitter {
   private readonly version: OCPPVersion
   protected readonly ajv: Ajv
   protected abstract payloadValidateFunctions: Map<
-  IncomingRequestCommand,
-  ValidateFunction<JsonType>
+    IncomingRequestCommand,
+    ValidateFunction<JsonType>
   >
 
   protected constructor (version: OCPPVersion) {
@@ -35,7 +35,7 @@ export abstract class OCPPIncomingRequestService extends EventEmitter {
     this.version = version
     this.ajv = new Ajv({
       keywords: ['javaType'],
-      multipleOfPrecision: 2
+      multipleOfPrecision: 2,
     })
     ajvFormats(this.ajv)
     this.incomingRequestHandler = this.incomingRequestHandler.bind(this)
index 48aca2ccafb2fe79b6adab93bd2894c372d790cf..58cb6408681b812cd30e9e74977b985777c9378f 100644 (file)
@@ -18,20 +18,20 @@ import {
   type RequestParams,
   type Response,
   type ResponseCallback,
-  type ResponseType
+  type ResponseType,
 } from '../../types/index.js'
 import {
   clone,
   formatDurationMilliSeconds,
   handleSendMessageError,
-  logger
+  logger,
 } from '../../utils/index.js'
 import { OCPPConstants } from './OCPPConstants.js'
 import type { OCPPResponseService } from './OCPPResponseService.js'
 import {
   ajvErrorsToErrorType,
   convertDateToISOString,
-  getMessageTypeString
+  getMessageTypeString,
 } from './OCPPServiceUtils.js'
 type Ajv = _Ajv.default
 // eslint-disable-next-line @typescript-eslint/no-redeclare
@@ -43,7 +43,7 @@ const moduleName = 'OCPPRequestService'
 const defaultRequestParams: RequestParams = {
   skipBufferingOnError: false,
   triggerMessage: false,
-  throwError: false
+  throwError: false,
 }
 
 export abstract class OCPPRequestService {
@@ -57,7 +57,7 @@ export abstract class OCPPRequestService {
     this.version = version
     this.ajv = new Ajv({
       keywords: ['javaType'],
-      multipleOfPrecision: 2
+      multipleOfPrecision: 2,
     })
     ajvFormats(this.ajv)
     this.ocppResponseService = ocppResponseService
@@ -104,7 +104,7 @@ export abstract class OCPPRequestService {
         MessageType.CALL_RESULT_MESSAGE,
         error as Error,
         {
-          throwError: true
+          throwError: true,
         }
       )
       return null
@@ -146,7 +146,7 @@ export abstract class OCPPRequestService {
   ): Promise<ResponseType> {
     params = {
       ...defaultRequestParams,
-      ...params
+      ...params,
     }
     try {
       return await this.internalSendMessage(
@@ -164,7 +164,7 @@ export abstract class OCPPRequestService {
         MessageType.CALL_MESSAGE,
         error as Error,
         {
-          throwError: params.throwError
+          throwError: params.throwError,
         }
       )
       return null
@@ -253,7 +253,7 @@ export abstract class OCPPRequestService {
   ): Promise<ResponseType> {
     params = {
       ...defaultRequestParams,
-      ...params
+      ...params,
     }
     if (
       (chargingStation.inUnknownState() && commandName === RequestCommand.BOOT_NOTIFICATION) ||
@@ -269,7 +269,6 @@ export abstract class OCPPRequestService {
       return await new Promise<ResponseType>((resolve, reject: (reason?: unknown) => void) => {
         /**
          * Function that will receive the request's response
-         *
          * @param payload -
          * @param requestPayload -
          */
@@ -290,17 +289,17 @@ export abstract class OCPPRequestService {
             )
             .then(() => {
               resolve(payload)
+              return undefined
             })
-            .catch(reject)
             .finally(() => {
               chargingStation.requests.delete(messageId)
               chargingStation.emit(ChargingStationEvents.updated)
             })
+            .catch(reject)
         }
 
         /**
          * Function that will receive the request's error response
-         *
          * @param ocppError -
          * @param requestStatistic -
          */
@@ -407,7 +406,7 @@ export abstract class OCPPRequestService {
                   {
                     name: error.name,
                     message: error.message,
-                    stack: error.stack
+                    stack: error.stack,
                   }
                 )
               )
@@ -429,6 +428,7 @@ export abstract class OCPPRequestService {
     }
     throw new OCPPError(
       ErrorType.SECURITY_ERROR,
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation.bootNotificationResponse?.status} state on the central server`,
       commandName
     )
@@ -452,7 +452,7 @@ export abstract class OCPPRequestService {
           messageType,
           messageId,
           commandName as RequestCommand,
-          messagePayload as JsonType
+          messagePayload as JsonType,
         ] satisfies OutgoingRequest)
         break
       // Response
@@ -466,7 +466,7 @@ export abstract class OCPPRequestService {
         messageToSend = JSON.stringify([
           messageType,
           messageId,
-          messagePayload as JsonType
+          messagePayload as JsonType,
         ] satisfies Response)
         break
       // Error Message
@@ -478,8 +478,8 @@ export abstract class OCPPRequestService {
           (messagePayload as OCPPError).code,
           (messagePayload as OCPPError).message,
           (messagePayload as OCPPError).details ?? {
-            command: (messagePayload as OCPPError).command
-          }
+            command: (messagePayload as OCPPError).command,
+          },
         ] satisfies ErrorResponse)
         break
     }
@@ -498,7 +498,7 @@ export abstract class OCPPRequestService {
       responseCallback,
       errorCallback,
       commandName,
-      messagePayload
+      messagePayload,
     ])
   }
 
index 00d539b7c214b1f4ed973299d31836dbcf4b2ae3..16c1965f6c38cbb4b7cd4c9c6a7f669fa272eafc 100644 (file)
@@ -7,7 +7,7 @@ import type {
   IncomingRequestCommand,
   JsonType,
   OCPPVersion,
-  RequestCommand
+  RequestCommand,
 } from '../../types/index.js'
 import { Constants, logger } from '../../utils/index.js'
 import { ajvErrorsToErrorType } from './OCPPServiceUtils.js'
@@ -25,20 +25,20 @@ export abstract class OCPPResponseService {
   protected readonly ajvIncomingRequest: Ajv
   protected abstract payloadValidateFunctions: Map<RequestCommand, ValidateFunction<JsonType>>
   public abstract incomingRequestResponsePayloadValidateFunctions: Map<
-  IncomingRequestCommand,
-  ValidateFunction<JsonType>
+    IncomingRequestCommand,
+    ValidateFunction<JsonType>
   >
 
   protected constructor (version: OCPPVersion) {
     this.version = version
     this.ajv = new Ajv({
       keywords: ['javaType'],
-      multipleOfPrecision: 2
+      multipleOfPrecision: 2,
     })
     ajvFormats(this.ajv)
     this.ajvIncomingRequest = new Ajv({
       keywords: ['javaType'],
-      multipleOfPrecision: 2
+      multipleOfPrecision: 2,
     })
     ajvFormats(this.ajvIncomingRequest)
     this.responseHandler = this.responseHandler.bind(this)
index b077b03a6603610c8464c07170f5e6d07df77802..8646b40a8c1bc48dae291edac4e4937a71525757 100644 (file)
@@ -3,13 +3,13 @@ import { readFileSync } from 'node:fs'
 import { dirname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
 
-import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv'
+import type { ErrorObject, JSONSchemaType } from 'ajv'
 import { isDate } from 'date-fns'
 
 import {
   type ChargingStation,
   getConfigurationKey,
-  getIdTagsFile
+  getIdTagsFile,
 } from '../../charging-station/index.js'
 import { BaseError, OCPPError } from '../../exception/index.js'
 import {
@@ -45,7 +45,7 @@ import {
   type SampledValueTemplate,
   StandardParametersKey,
   type StatusNotificationRequest,
-  type StatusNotificationResponse
+  type StatusNotificationResponse,
 } from '../../types/index.js'
 import {
   ACElectricUtils,
@@ -62,7 +62,7 @@ import {
   logPrefix,
   max,
   min,
-  roundTo
+  roundTo,
 } from '../../utils/index.js'
 import { OCPP16Constants } from './1.6/OCPP16Constants.js'
 import { OCPP20Constants } from './2.0/OCPP20Constants.js'
@@ -92,7 +92,7 @@ const buildStatusNotificationRequest = (
       return {
         connectorId,
         status: status as OCPP16ChargePointStatus,
-        errorCode: ChargePointErrorCode.NO_ERROR
+        errorCode: ChargePointErrorCode.NO_ERROR,
       } satisfies OCPP16StatusNotificationRequest
     case OCPPVersion.VERSION_20:
     case OCPPVersion.VERSION_201:
@@ -101,7 +101,7 @@ const buildStatusNotificationRequest = (
         connectorStatus: status as OCPP20ConnectorStatusEnumType,
         connectorId,
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        evseId: evseId!
+        evseId: evseId!,
       } satisfies OCPP20StatusNotificationRequest
     default:
       throw new BaseError('Cannot build status notification payload: OCPP version not supported')
@@ -161,7 +161,7 @@ const isIdTagRemoteAuthorized = async (
         chargingStation,
         RequestCommand.AUTHORIZE,
         {
-          idTag
+          idTag,
         }
       )
     ).idTagInfo.status === AuthorizationStatus.ACCEPTED
@@ -179,8 +179,8 @@ export const sendAndSetConnectorStatus = async (
   if (options.send) {
     checkConnectorStatusTransition(chargingStation, connectorId, status)
     await chargingStation.ocppRequestService.requestHandler<
-    StatusNotificationRequest,
-    StatusNotificationResponse
+      StatusNotificationRequest,
+      StatusNotificationResponse
     >(
       chargingStation,
       RequestCommand.STATUS_NOTIFICATION,
@@ -191,7 +191,7 @@ export const sendAndSetConnectorStatus = async (
   chargingStation.getConnectorStatus(connectorId)!.status = status
   chargingStation.emit(ChargingStationEvents.connectorStatusChanged, {
     connectorId,
-    ...chargingStation.getConnectorStatus(connectorId)
+    ...chargingStation.getConnectorStatus(connectorId),
   })
 }
 
@@ -249,6 +249,7 @@ const checkConnectorStatusTransition = (
       break
     default:
       throw new BaseError(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `Cannot check connector status transition: OCPP version ${chargingStation.stationInfo?.ocppVersion} not supported`
       )
   }
@@ -256,7 +257,8 @@ const checkConnectorStatusTransition = (
     logger.warn(
       `${chargingStation.logPrefix()} OCPP ${
         chargingStation.stationInfo.ocppVersion
-      } connector id ${connectorId} status transition from '${
+      } connector id ${connectorId.toString()} status transition from '${
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         chargingStation.getConnectorStatus(connectorId)?.status
       }' to '${status}' is not allowed`
     )
@@ -266,7 +268,7 @@ const checkConnectorStatusTransition = (
 
 export const ajvErrorsToErrorType = (errors: ErrorObject[] | undefined | null): ErrorType => {
   if (isNotEmptyArray(errors)) {
-    for (const error of errors as DefinedError[]) {
+    for (const error of errors) {
       switch (error.keyword) {
         case 'type':
           return ErrorType.TYPE_CONSTRAINT_VIOLATION
@@ -286,12 +288,10 @@ export const convertDateToISOString = <T extends JsonType>(object: T): void => {
   for (const key in object) {
     // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion
     if (isDate(object![key])) {
+      ;(object[key] as unknown as string) = (object[key] as Date).toISOString()
       // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion
-      (object![key] as string) = (object![key] as Date).toISOString()
-      // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-condition
-    } else if (typeof object![key] === 'object' && object![key] !== null) {
-      // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion
-      convertDateToISOString<T>(object![key] as T)
+    } else if (typeof object![key] === 'object' && object[key] !== null) {
+      convertDateToISOString<T>(object[key] as T)
     }
   }
 }
@@ -317,7 +317,7 @@ export const buildMeterValue = (
     case OCPPVersion.VERSION_16:
       meterValue = {
         timestamp: new Date(),
-        sampledValue: []
+        sampledValue: [],
       }
       // SoC measurand
       socSampledValueTemplate = getSampledValueTemplate(
@@ -347,11 +347,12 @@ 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.toString()}, transaction id ${
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              connector?.transactionId?.toString()
+            }, value: ${socMinimumValue.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
-            }/${socMaximumValue}`
+            }/${socMaximumValue.toString()}`
           )
         }
       }
@@ -386,7 +387,7 @@ export const buildMeterValue = (
           chargingStation.getNumberOfPhases() === 3 && phase <= chargingStation.getNumberOfPhases();
           phase++
         ) {
-          const phaseLineToNeutralValue = `L${phase}-N`
+          const phaseLineToNeutralValue = `L${phase.toString()}-N`
           const voltagePhaseLineToNeutralSampledValueTemplate = getSampledValueTemplate(
             chargingStation,
             connectorId,
@@ -418,10 +419,10 @@ export const buildMeterValue = (
             )
           )
           if (chargingStation.stationInfo.phaseLineToLineVoltageMeterValues === true) {
-            const phaseLineToLineValue = `L${phase}-L${
+            const phaseLineToLineValue = `L${phase.toString()}-L${
               (phase + 1) % chargingStation.getNumberOfPhases() !== 0
-                ? (phase + 1) % chargingStation.getNumberOfPhases()
-                : chargingStation.getNumberOfPhases()
+                ? ((phase + 1) % chargingStation.getNumberOfPhases()).toString()
+                : chargingStation.getNumberOfPhases().toString()
             }`
             const voltagePhaseLineToLineValueRounded = roundTo(
               Math.sqrt(chargingStation.getNumberOfPhases()) *
@@ -490,19 +491,19 @@ export const buildMeterValue = (
             connectorId,
             MeterValueMeasurand.POWER_ACTIVE_IMPORT,
             MeterValuePhase.L3_N
-          )
+          ),
         }
       }
       if (powerSampledValueTemplate != null) {
         checkMeasurandPowerDivider(chargingStation, powerSampledValueTemplate.measurand)
         const errMsg = `MeterValues measurand ${
           powerSampledValueTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         }: Unknown ${chargingStation.stationInfo.currentOutType} currentOutType in template file ${
           chargingStation.templateFile
         }, cannot calculate ${
           powerSampledValueTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         } measurand value`
-        // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
         const powerMeasurandValues: MeasurandValues = {} as MeasurandValues
         const unitDivider = powerSampledValueTemplate.unit === MeterValueUnit.KILO_WATT ? 1000 : 1
         connectorMaximumAvailablePower =
@@ -529,7 +530,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumPower / unitDivider
+                      fallbackValue: connectorMinimumPower / unitDivider,
                     }
                   ) / chargingStation.getNumberOfPhases(),
                   powerSampledValueTemplate.fluctuationPercent ??
@@ -547,7 +548,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider
+                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider,
                     }
                   ),
                   powerPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
@@ -565,7 +566,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider
+                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider,
                     }
                   ),
                   powerPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
@@ -583,7 +584,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider
+                      fallbackValue: connectorMinimumPowerPerPhase / unitDivider,
                     }
                   ),
                   powerPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
@@ -621,7 +622,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumPower / unitDivider
+                      fallbackValue: connectorMinimumPower / unitDivider,
                     }
                   ),
                   powerSampledValueTemplate.fluctuationPercent ??
@@ -649,7 +650,7 @@ export const buildMeterValue = (
                   {
                     limitationEnabled:
                         chargingStation.stationInfo.customValueLimitationMeterValues,
-                    fallbackValue: connectorMinimumPower / unitDivider
+                    fallbackValue: connectorMinimumPower / unitDivider,
                   }
                 ),
                 powerSampledValueTemplate.fluctuationPercent ??
@@ -681,11 +682,12 @@ 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.toString()}, transaction id ${
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              connector?.transactionId?.toString()
+            }, value: ${connectorMinimumPowerRounded.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
-            }/${connectorMaximumPowerRounded}`
+            }/${connectorMaximumPowerRounded.toString()}`
           )
         }
         for (
@@ -693,13 +695,13 @@ export const buildMeterValue = (
           chargingStation.getNumberOfPhases() === 3 && phase <= chargingStation.getNumberOfPhases();
           phase++
         ) {
-          const phaseValue = `L${phase}-N`
+          const phaseValue = `L${phase.toString()}-N`
           meterValue.sampledValue.push(
             buildSampledValue(
               powerPerPhaseSampledValueTemplates[
-                `L${phase}` as keyof MeasurandPerPhaseSampledValueTemplates
+                `L${phase.toString()}` as keyof MeasurandPerPhaseSampledValueTemplates
               ] ?? powerSampledValueTemplate,
-              powerMeasurandValues[`L${phase}` as keyof MeasurandPerPhaseSampledValueTemplates],
+              powerMeasurandValues[`L${phase.toString()}` as keyof MeasurandPerPhaseSampledValueTemplates],
               undefined,
               phaseValue as MeterValuePhase
             )
@@ -725,12 +727,14 @@ export const buildMeterValue = (
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ??
                 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
               }: phase ${
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId}, transaction id ${
-                connector?.transactionId
-              }, value: ${connectorMinimumPowerPerPhaseRounded}/${
+              }, connector id ${connectorId.toString()}, transaction id ${
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                connector?.transactionId?.toString()
+              }, value: ${connectorMinimumPowerPerPhaseRounded.toString()}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
-              }/${connectorMaximumPowerPerPhaseRounded}`
+              }/${connectorMaximumPowerPerPhaseRounded.toString()}`
             )
           }
         }
@@ -760,20 +764,19 @@ export const buildMeterValue = (
             connectorId,
             MeterValueMeasurand.CURRENT_IMPORT,
             MeterValuePhase.L3
-          )
+          ),
         }
       }
       if (currentSampledValueTemplate != null) {
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         checkMeasurandPowerDivider(chargingStation, currentSampledValueTemplate.measurand)
         const errMsg = `MeterValues measurand ${
           currentSampledValueTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         }: Unknown ${chargingStation.stationInfo.currentOutType} currentOutType in template file ${
           chargingStation.templateFile
         }, cannot calculate ${
           currentSampledValueTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         } measurand value`
-        // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
         const currentMeasurandValues: MeasurandValues = {} as MeasurandValues
         connectorMaximumAvailablePower == null &&
           (connectorMaximumAvailablePower =
@@ -800,7 +803,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumAmperage
+                      fallbackValue: connectorMinimumAmperage,
                     }
                   ),
                   currentSampledValueTemplate.fluctuationPercent ??
@@ -818,7 +821,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumAmperage
+                      fallbackValue: connectorMinimumAmperage,
                     }
                   ),
                   currentPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
@@ -836,7 +839,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumAmperage
+                      fallbackValue: connectorMinimumAmperage,
                     }
                   ),
                   currentPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
@@ -854,7 +857,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumAmperage
+                      fallbackValue: connectorMinimumAmperage,
                     }
                   ),
                   currentPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
@@ -883,7 +886,7 @@ export const buildMeterValue = (
                     {
                       limitationEnabled:
                           chargingStation.stationInfo.customValueLimitationMeterValues,
-                      fallbackValue: connectorMinimumAmperage
+                      fallbackValue: connectorMinimumAmperage,
                     }
                   ),
                   currentSampledValueTemplate.fluctuationPercent ??
@@ -914,7 +917,7 @@ export const buildMeterValue = (
                   {
                     limitationEnabled:
                         chargingStation.stationInfo.customValueLimitationMeterValues,
-                    fallbackValue: connectorMinimumAmperage
+                    fallbackValue: connectorMinimumAmperage,
                   }
                 ),
                 currentSampledValueTemplate.fluctuationPercent ??
@@ -941,11 +944,12 @@ 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.toString()}, transaction id ${
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              connector?.transactionId?.toString()
+            }, value: ${connectorMinimumAmperage.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
-            }/${connectorMaximumAmperage}`
+            }/${connectorMaximumAmperage.toString()}`
           )
         }
         for (
@@ -953,7 +957,7 @@ export const buildMeterValue = (
           chargingStation.getNumberOfPhases() === 3 && phase <= chargingStation.getNumberOfPhases();
           phase++
         ) {
-          const phaseValue = `L${phase}`
+          const phaseValue = `L${phase.toString()}`
           meterValue.sampledValue.push(
             buildSampledValue(
               currentPerPhaseSampledValueTemplates[
@@ -977,12 +981,14 @@ export const buildMeterValue = (
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ??
                 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
               }: phase ${
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId}, transaction id ${
-                connector?.transactionId
-              }, value: ${connectorMinimumAmperage}/${
+              }, connector id ${connectorId.toString()}, transaction id ${
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                connector?.transactionId?.toString()
+              }, value: ${connectorMinimumAmperage.toString()}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
-              }/${connectorMaximumAmperage}`
+              }/${connectorMaximumAmperage.toString()}`
             )
           }
         }
@@ -1013,7 +1019,7 @@ export const buildMeterValue = (
               {
                 limitationEnabled: chargingStation.stationInfo.customValueLimitationMeterValues,
                 fallbackValue: connectorMinimumEnergyRounded,
-                unitMultiplier: unitDivider
+                unitMultiplier: unitDivider,
               }
             ),
             energySampledValueTemplate.fluctuationPercent ?? Constants.DEFAULT_FLUCTUATION_PERCENT
@@ -1054,9 +1060,10 @@ 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.toString()}, transaction id ${
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              connector?.transactionId?.toString()
+            }, value: ${connectorMinimumEnergyRounded.toString()}/${energyValueRounded.toString()}/${connectorMaximumEnergyRounded.toString()}, duration: ${interval.toString()}ms`
           )
         }
       }
@@ -1065,6 +1072,7 @@ export const buildMeterValue = (
     case OCPPVersion.VERSION_201:
     default:
       throw new BaseError(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `Cannot build meterValue: OCPP version ${chargingStation.stationInfo?.ocppVersion} not supported`
       )
   }
@@ -1082,7 +1090,7 @@ export const buildTransactionEndMeterValue = (
     case OCPPVersion.VERSION_16:
       meterValue = {
         timestamp: new Date(),
-        sampledValue: []
+        sampledValue: [],
       }
       // Energy.Active.Import.Register measurand (default)
       sampledValueTemplate = getSampledValueTemplate(chargingStation, connectorId)
@@ -1100,6 +1108,7 @@ export const buildTransactionEndMeterValue = (
     case OCPPVersion.VERSION_201:
     default:
       throw new BaseError(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `Cannot build meterValue: OCPP version ${chargingStation.stationInfo?.ocppVersion} not supported`
       )
   }
@@ -1118,7 +1127,7 @@ const checkMeasurandPowerDivider = (
   } else if (chargingStation.powerDivider <= 0) {
     const errMsg = `MeterValues measurand ${
       measurandType ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-    }: powerDivider have zero or below value ${chargingStation.powerDivider}`
+    }: powerDivider have zero or below value ${chargingStation.powerDivider.toString()}`
     logger.error(`${chargingStation.logPrefix()} ${errMsg}`)
     throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES)
   }
@@ -1138,12 +1147,12 @@ const getLimitFromSampledValueTemplateCustomValue = (
     ...{
       limitationEnabled: false,
       unitMultiplier: 1,
-      fallbackValue: 0
+      fallbackValue: 0,
     },
-    ...options
+    ...options,
   }
   const parsedValue = Number.parseInt(value ?? '')
-  if (options.limitationEnabled === true) {
+  if (options.limitationEnabled) {
     return max(
       min(
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -1166,7 +1175,7 @@ const getSampledValueTemplate = (
   const onPhaseStr = phase != null ? `on phase ${phase} ` : ''
   if (!OCPPConstants.OCPP_MEASURANDS_SUPPORTED.includes(measurand)) {
     logger.warn(
-      `${chargingStation.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
+      `${chargingStation.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()}`
     )
     return
   }
@@ -1178,7 +1187,7 @@ const getSampledValueTemplate = (
     )?.value?.includes(measurand) === false
   ) {
     logger.debug(
-      `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId} not found in '${
+      `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()} not found in '${
         StandardParametersKey.MeterValuesSampledData
       }' OCPP parameter`
     )
@@ -1198,7 +1207,7 @@ const getSampledValueTemplate = (
       )
     ) {
       logger.warn(
-        `${chargingStation.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
+        `${chargingStation.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()}`
       )
     } else if (
       phase != null &&
@@ -1229,12 +1238,12 @@ const getSampledValueTemplate = (
     }
   }
   if (measurand === MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER) {
-    const errorMsg = `Missing MeterValues for default measurand '${measurand}' in template on connector id ${connectorId}`
+    const errorMsg = `Missing MeterValues for default measurand '${measurand}' in template on connector id ${connectorId.toString()}`
     logger.error(`${chargingStation.logPrefix()} ${errorMsg}`)
     throw new BaseError(errorMsg)
   }
   logger.debug(
-    `${chargingStation.logPrefix()} No MeterValues for measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
+    `${chargingStation.logPrefix()} No MeterValues for measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()}`
   )
 }
 
@@ -1251,15 +1260,15 @@ const buildSampledValue = (
   const sampledValuePhase = phase ?? sampledValueTemplate.phase
   return {
     ...(sampledValueTemplate.unit != null && {
-      unit: sampledValueTemplate.unit
+      unit: sampledValueTemplate.unit,
     }),
     ...(sampledValueContext != null && { context: sampledValueContext }),
     ...(sampledValueTemplate.measurand != null && {
-      measurand: sampledValueTemplate.measurand
+      measurand: sampledValueTemplate.measurand,
     }),
     ...(sampledValueLocation != null && { location: sampledValueLocation }),
     ...{ value: value.toString() },
-    ...(sampledValuePhase != null && { phase: sampledValuePhase })
+    ...(sampledValuePhase != null && { phase: sampledValuePhase }),
   } satisfies SampledValue
 }
 
@@ -1374,7 +1383,7 @@ export class OCPPServiceUtils {
   ): boolean {
     if (connectorId < 0) {
       logger.error(
-        `${chargingStation.logPrefix()} ${ocppCommand} incoming request received with invalid connector id ${connectorId}`
+        `${chargingStation.logPrefix()} ${ocppCommand} incoming request received with invalid connector id ${connectorId.toString()}`
       )
       return false
     }
@@ -1398,7 +1407,6 @@ export class OCPPServiceUtils {
         OCPPServiceUtils.logPrefix(ocppVersion, moduleName, methodName),
         { throwError: false }
       )
-      // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
       return {} as JSONSchemaType<T>
     }
   }
index e4e565c34196d0078e9641151964e08b1a17e8a0..6357eaaa83ebec846d1ba53dcd7260a2839a6625 100644 (file)
@@ -11,5 +11,5 @@ export {
   buildTransactionEndMeterValue,
   getMessageTypeString,
   isIdTagAuthorized,
-  sendAndSetConnectorStatus
+  sendAndSetConnectorStatus,
 } from './OCPPServiceUtils.js'
index a786fbbddc2ed43623316f297a7f5ac94503d474..40be3687e6f78d395855fb9de565fc10b3904755 100644 (file)
@@ -15,7 +15,7 @@ import {
   ProtocolVersion,
   type RequestPayload,
   type ResponsePayload,
-  type UIServerConfiguration
+  type UIServerConfiguration,
 } from '../../types/index.js'
 import { logger } from '../../utils/index.js'
 import type { AbstractUIService } from './ui-services/AbstractUIService.js'
@@ -30,7 +30,7 @@ export abstract class AbstractUIServer {
   protected readonly httpServer: Server | Http2Server
   protected readonly responseHandlers: Map<
     `${string}-${string}-${string}-${string}-${string}`,
-  ServerResponse | WebSocket
+    ServerResponse | WebSocket
   >
 
   protected readonly uiServices: Map<ProtocolVersion, AbstractUIService>
@@ -47,12 +47,13 @@ export abstract class AbstractUIServer {
         break
       default:
         throw new BaseError(
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           `Unsupported application protocol version ${this.uiServerConfiguration.version} in '${ConfigurationSection.uiServer}' configuration section`
         )
     }
     this.responseHandlers = new Map<
       `${string}-${string}-${string}-${string}-${string}`,
-    ServerResponse | WebSocket
+      ServerResponse | WebSocket
     >()
     this.uiServices = new Map<ProtocolVersion, AbstractUIService>()
   }
@@ -165,7 +166,7 @@ export abstract class AbstractUIServer {
   private isValidProtocolBasicAuth (req: IncomingMessage, next: (err?: Error) => void): boolean {
     const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(/,\s+/).pop()
     const [username, password] = getUsernameAndPasswordFromAuthorizationToken(
-      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/restrict-template-expressions
       `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join(
         '='
       )}`
index 5bcae7beff6ed84fc6d0e202437361bc7f1c3725..1682c0def3c79c25634bc4c10c8071f590a9103c 100644 (file)
@@ -13,7 +13,7 @@ import {
   type ProtocolVersion,
   type RequestPayload,
   ResponseStatus,
-  type UIServerConfiguration
+  type UIServerConfiguration,
 } from '../../types/index.js'
 import {
   Constants,
@@ -21,7 +21,7 @@ import {
   isNotEmptyString,
   JSONStringify,
   logger,
-  logPrefix
+  logPrefix,
 } from '../../utils/index.js'
 import { AbstractUIServer } from './AbstractUIServer.js'
 import { isProtocolAndVersionSupported } from './UIServerUtils.js'
@@ -60,7 +60,7 @@ export class UIHttpServer extends AbstractUIServer {
         const res = this.responseHandlers.get(uuid) as ServerResponse
         res
           .writeHead(this.responseStatusToStatusCode(payload.status), {
-            'Content-Type': 'application/json'
+            'Content-Type': 'application/json',
           })
           .end(JSONStringify(payload, undefined, MapStringifyFormat.object))
       } else {
@@ -93,9 +93,9 @@ export class UIHttpServer extends AbstractUIServer {
         res
           .writeHead(StatusCodes.UNAUTHORIZED, {
             'Content-Type': 'text/plain',
-            'WWW-Authenticate': 'Basic realm=users'
+            'WWW-Authenticate': 'Basic realm=users',
           })
-          .end(`${StatusCodes.UNAUTHORIZED} Unauthorized`)
+          .end(`${StatusCodes.UNAUTHORIZED.toString()} Unauthorized`)
         res.destroy()
         req.destroy()
       }
@@ -135,7 +135,7 @@ export class UIHttpServer extends AbstractUIServer {
                 this.buildProtocolResponse(uuid, {
                   status: ResponseStatus.FAILURE,
                   errorMessage: (error as Error).message,
-                  errorStack: (error as Error).stack
+                  errorStack: (error as Error).stack,
                 })
               )
               return
@@ -147,10 +147,12 @@ export class UIHttpServer extends AbstractUIServer {
                 if (protocolResponse != null) {
                   this.sendResponse(protocolResponse)
                 }
+                return undefined
               })
               .catch(Constants.EMPTY_FUNCTION)
           })
       } else {
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         throw new BaseError(`Unsupported HTTP method: '${req.method}'`)
       }
     } catch (error) {
index cf176bdc0403d2be85890204ba7b67e06f9b6c4a..600d9e9dbc71425f48be3c78cb1ea3bdfcf248df 100644 (file)
@@ -6,7 +6,7 @@ import {
   ApplicationProtocolVersion,
   AuthenticationType,
   ConfigurationSection,
-  type UIServerConfiguration
+  type UIServerConfiguration,
 } from '../../types/index.js'
 import { logger, logPrefix } from '../../utils/index.js'
 import type { AbstractUIServer } from './AbstractUIServer.js'
@@ -68,9 +68,10 @@ export class UIServerFactory {
             uiServerConfiguration.type as ApplicationProtocol
           )
         ) {
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${
             ConfigurationSection.uiServer
-            // eslint-disable-next-line @typescript-eslint/no-base-to-string
+          // eslint-disable-next-line @typescript-eslint/no-base-to-string
           }' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
             ApplicationProtocol.WS
           }'`
index cfe4fd2f6198ee6ae544d0b46b786e9f496f69af..f8322f700f7094dc40ced63bf47912cdcfc233ad 100644 (file)
@@ -36,6 +36,7 @@ export const handleProtocols = (
   logger.error(
     `${logPrefix(
       ' UI WebSocket Server |'
+    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
     )} Unsupported protocol: '${protocol}' or protocol version: '${version}'`
   )
   return false
index bf0a6c444749201fe06d2cdcc6f24b10fa09582a..dfd9e628468b8fafb1f8069d6f1756b6d976e6e9 100644 (file)
@@ -9,7 +9,7 @@ import {
   type ProtocolRequest,
   type ProtocolResponse,
   type UIServerConfiguration,
-  WebSocketCloseEventStatusCode
+  WebSocketCloseEventStatusCode,
 } from '../../types/index.js'
 import {
   Constants,
@@ -18,13 +18,13 @@ import {
   JSONStringify,
   logger,
   logPrefix,
-  validateUUID
+  validateUUID,
 } from '../../utils/index.js'
 import { AbstractUIServer } from './AbstractUIServer.js'
 import {
   getProtocolAndVersion,
   handleProtocols,
-  isProtocolAndVersionSupported
+  isProtocolAndVersionSupported,
 } from './UIServerUtils.js'
 
 const moduleName = 'UIWebSocketServer'
@@ -36,7 +36,7 @@ export class UIWebSocketServer extends AbstractUIServer {
     super(uiServerConfiguration)
     this.webSocketServer = new WebSocketServer({
       handleProtocols,
-      noServer: true
+      noServer: true,
     })
   }
 
@@ -68,6 +68,7 @@ export class UIWebSocketServer extends AbstractUIServer {
             if (protocolResponse != null) {
               this.sendResponse(protocolResponse)
             }
+            return undefined
           })
           .catch(Constants.EMPTY_FUNCTION)
       })
@@ -87,7 +88,7 @@ export class UIWebSocketServer extends AbstractUIServer {
     })
     this.httpServer.on('connect', (req: IncomingMessage, socket: Duplex, _head: Buffer) => {
       if (req.headers.connection !== 'Upgrade' || req.headers.upgrade !== 'websocket') {
-        socket.write(`HTTP/1.1 ${StatusCodes.BAD_REQUEST} Bad Request\r\n\r\n`)
+        socket.write(`HTTP/1.1 ${StatusCodes.BAD_REQUEST.toString()} Bad Request\r\n\r\n`)
         socket.destroy()
       }
     })
@@ -104,7 +105,7 @@ export class UIWebSocketServer extends AbstractUIServer {
       socket.on('error', onSocketError)
       this.authenticate(req, err => {
         if (err != null) {
-          socket.write(`HTTP/1.1 ${StatusCodes.UNAUTHORIZED} Unauthorized\r\n\r\n`)
+          socket.write(`HTTP/1.1 ${StatusCodes.UNAUTHORIZED.toString()} Unauthorized\r\n\r\n`)
           socket.destroy()
           return
         }
@@ -144,7 +145,7 @@ export class UIWebSocketServer extends AbstractUIServer {
               moduleName,
               'sendResponse'
             )} Error at sending response id '${responseId}', WebSocket is not open: ${
-              ws.readyState
+              ws.readyState.toString()
             }`
           )
         }
@@ -205,7 +206,7 @@ export class UIWebSocketServer extends AbstractUIServer {
         `${this.logPrefix(
           moduleName,
           'validateRawDataRequest'
-          // eslint-disable-next-line @typescript-eslint/no-base-to-string
+        // eslint-disable-next-line @typescript-eslint/no-base-to-string
         )} UI protocol request is not valid JSON: ${rawData.toString()}`
       )
       return false
index e37c632b391e37360644c0fc58ac1b9bee91a60e..56e601e6143d522fff1048466bcbd2b1d0b1fc3d 100644 (file)
@@ -15,7 +15,7 @@ import {
   type RequestPayload,
   type ResponsePayload,
   ResponseStatus,
-  type StorageConfiguration
+  type StorageConfiguration,
 } from '../../../types/index.js'
 import { Configuration, isAsyncFunction, isNotEmptyArray, logger } from '../../../utils/index.js'
 import { Bootstrap } from '../../Bootstrap.js'
@@ -32,24 +32,24 @@ interface AddChargingStationsRequestPayload extends RequestPayload {
 
 export abstract class AbstractUIService {
   protected static readonly ProcedureNameToBroadCastChannelProcedureNameMapping = new Map<
-  ProcedureName,
-  BroadcastChannelProcedureName
+    ProcedureName,
+    BroadcastChannelProcedureName
   >([
     [ProcedureName.START_CHARGING_STATION, BroadcastChannelProcedureName.START_CHARGING_STATION],
     [ProcedureName.STOP_CHARGING_STATION, BroadcastChannelProcedureName.STOP_CHARGING_STATION],
     [
       ProcedureName.DELETE_CHARGING_STATIONS,
-      BroadcastChannelProcedureName.DELETE_CHARGING_STATIONS
+      BroadcastChannelProcedureName.DELETE_CHARGING_STATIONS,
     ],
     [ProcedureName.CLOSE_CONNECTION, BroadcastChannelProcedureName.CLOSE_CONNECTION],
     [ProcedureName.OPEN_CONNECTION, BroadcastChannelProcedureName.OPEN_CONNECTION],
     [
       ProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
-      BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR
+      BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
     ],
     [
       ProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
-      BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR
+      BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
     ],
     [ProcedureName.SET_SUPERVISION_URL, BroadcastChannelProcedureName.SET_SUPERVISION_URL],
     [ProcedureName.START_TRANSACTION, BroadcastChannelProcedureName.START_TRANSACTION],
@@ -62,12 +62,12 @@ export abstract class AbstractUIService {
     [ProcedureName.DATA_TRANSFER, BroadcastChannelProcedureName.DATA_TRANSFER],
     [
       ProcedureName.DIAGNOSTICS_STATUS_NOTIFICATION,
-      BroadcastChannelProcedureName.DIAGNOSTICS_STATUS_NOTIFICATION
+      BroadcastChannelProcedureName.DIAGNOSTICS_STATUS_NOTIFICATION,
     ],
     [
       ProcedureName.FIRMWARE_STATUS_NOTIFICATION,
-      BroadcastChannelProcedureName.FIRMWARE_STATUS_NOTIFICATION
-    ]
+      BroadcastChannelProcedureName.FIRMWARE_STATUS_NOTIFICATION,
+    ],
   ])
 
   protected readonly requestHandlers: Map<ProcedureName, ProtocolRequestHandler>
@@ -76,7 +76,7 @@ export abstract class AbstractUIService {
   private readonly uiServiceWorkerBroadcastChannel: UIServiceWorkerBroadcastChannel
   private readonly broadcastChannelRequests: Map<
     `${string}-${string}-${string}-${string}-${string}`,
-  number
+    number
   >
 
   constructor (uiServer: AbstractUIServer, version: ProtocolVersion) {
@@ -89,12 +89,12 @@ export abstract class AbstractUIService {
       [ProcedureName.PERFORMANCE_STATISTICS, this.handlePerformanceStatistics.bind(this)],
       [ProcedureName.SIMULATOR_STATE, this.handleSimulatorState.bind(this)],
       [ProcedureName.START_SIMULATOR, this.handleStartSimulator.bind(this)],
-      [ProcedureName.STOP_SIMULATOR, this.handleStopSimulator.bind(this)]
+      [ProcedureName.STOP_SIMULATOR, this.handleStopSimulator.bind(this)],
     ])
     this.uiServiceWorkerBroadcastChannel = new UIServiceWorkerBroadcastChannel(this)
     this.broadcastChannelRequests = new Map<
       `${string}-${string}-${string}-${string}-${string}`,
-    number
+      number
     >()
   }
 
@@ -109,7 +109,7 @@ export abstract class AbstractUIService {
     let requestPayload: RequestPayload | undefined
     let responsePayload: ResponsePayload | undefined
     try {
-      [uuid, command, requestPayload] = request
+      ;[uuid, command, requestPayload] = request
 
       if (!this.requestHandlers.has(command)) {
         throw new BaseError(
@@ -146,7 +146,7 @@ export abstract class AbstractUIService {
         responsePayload,
         errorMessage: (error as OCPPError).message,
         errorStack: (error as OCPPError).stack,
-        errorDetails: (error as OCPPError).details
+        errorDetails: (error as OCPPError).details,
       } satisfies ResponsePayload
     }
     if (responsePayload != null) {
@@ -242,14 +242,14 @@ export abstract class AbstractUIService {
   private handleListTemplates (): ResponsePayload {
     return {
       status: ResponseStatus.SUCCESS,
-      templates: [...this.uiServer.chargingStationTemplates.values()] as JsonType[]
+      templates: [...this.uiServer.chargingStationTemplates.values()],
     } satisfies ResponsePayload
   }
 
   private handleListChargingStations (): ResponsePayload {
     return {
       status: ResponseStatus.SUCCESS,
-      chargingStations: [...this.uiServer.chargingStations.values()] as JsonType[]
+      chargingStations: [...this.uiServer.chargingStations.values()],
     } satisfies ResponsePayload
   }
 
@@ -264,19 +264,19 @@ export abstract class AbstractUIService {
       return {
         status: ResponseStatus.FAILURE,
         errorMessage:
-          'Cannot add charging station(s) while the charging stations simulator is not started'
+          'Cannot add charging station(s) while the charging stations simulator is not started',
       } satisfies ResponsePayload
     }
     if (typeof template !== 'string' || typeof numberOfStations !== 'number') {
       return {
         status: ResponseStatus.FAILURE,
-        errorMessage: 'Invalid request payload'
+        errorMessage: 'Invalid request payload',
       } satisfies ResponsePayload
     }
     if (!this.uiServer.chargingStationTemplates.has(template)) {
       return {
         status: ResponseStatus.FAILURE,
-        errorMessage: `Template '${template}' not found`
+        errorMessage: `Template '${template}' not found`,
       } satisfies ResponsePayload
     }
     const succeededStationInfos: ChargingStationInfo[] = []
@@ -303,12 +303,12 @@ export abstract class AbstractUIService {
     return {
       status: err != null ? ResponseStatus.FAILURE : ResponseStatus.SUCCESS,
       ...(succeededStationInfos.length > 0 && {
-        hashIdsSucceeded: succeededStationInfos.map(stationInfo => stationInfo.hashId)
+        hashIdsSucceeded: succeededStationInfos.map(stationInfo => stationInfo.hashId),
       }),
       ...(failedStationInfos.length > 0 && {
-        hashIdsFailed: failedStationInfos.map(stationInfo => stationInfo.hashId)
+        hashIdsFailed: failedStationInfos.map(stationInfo => stationInfo.hashId),
       }),
-      ...(err != null && { errorMessage: err.message, errorStack: err.stack })
+      ...(err != null && { errorMessage: err.message, errorStack: err.stack }),
     } satisfies ResponsePayload
   }
 
@@ -320,7 +320,7 @@ export abstract class AbstractUIService {
     ) {
       return {
         status: ResponseStatus.FAILURE,
-        errorMessage: 'Performance statistics storage is not enabled'
+        errorMessage: 'Performance statistics storage is not enabled',
       } satisfies ResponsePayload
     }
     try {
@@ -328,14 +328,14 @@ export abstract class AbstractUIService {
         status: ResponseStatus.SUCCESS,
         performanceStatistics: [
           // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-          ...Bootstrap.getInstance().getPerformanceStatistics()!
-        ] as JsonType[]
+          ...Bootstrap.getInstance().getPerformanceStatistics()!,
+        ] as JsonType[],
       } satisfies ResponsePayload
     } catch (error) {
       return {
         status: ResponseStatus.FAILURE,
         errorMessage: (error as Error).message,
-        errorStack: (error as Error).stack
+        errorStack: (error as Error).stack,
       } satisfies ResponsePayload
     }
   }
@@ -344,13 +344,13 @@ export abstract class AbstractUIService {
     try {
       return {
         status: ResponseStatus.SUCCESS,
-        state: Bootstrap.getInstance().getState() as unknown as JsonObject
+        state: Bootstrap.getInstance().getState() as unknown as JsonObject,
       } satisfies ResponsePayload
     } catch (error) {
       return {
         status: ResponseStatus.FAILURE,
         errorMessage: (error as Error).message,
-        errorStack: (error as Error).stack
+        errorStack: (error as Error).stack,
       } satisfies ResponsePayload
     }
   }
@@ -363,7 +363,7 @@ export abstract class AbstractUIService {
       return {
         status: ResponseStatus.FAILURE,
         errorMessage: (error as Error).message,
-        errorStack: (error as Error).stack
+        errorStack: (error as Error).stack,
       } satisfies ResponsePayload
     }
   }
@@ -376,7 +376,7 @@ export abstract class AbstractUIService {
       return {
         status: ResponseStatus.FAILURE,
         errorMessage: (error as Error).message,
-        errorStack: (error as Error).stack
+        errorStack: (error as Error).stack,
       } satisfies ResponsePayload
     }
   }
index 864446c6ce30ee1bad805c65a61eec9b46755e2d..5a4cd7aa10cd5f6a11efe245f7dba48540351e09 100644 (file)
@@ -19,7 +19,7 @@ import {
   type Statistics,
   type StatisticsData,
   type StorageConfiguration,
-  type TimestampedData
+  type TimestampedData,
 } from '../types/index.js'
 import {
   buildPerformanceStatisticsMessage,
@@ -34,13 +34,13 @@ import {
   max,
   min,
   nthPercentile,
-  stdDeviation
+  stdDeviation,
 } from '../utils/index.js'
 
 export class PerformanceStatistics {
   private static readonly instances: Map<string, PerformanceStatistics> = new Map<
-  string,
-  PerformanceStatistics
+    string,
+    PerformanceStatistics
   >()
 
   private readonly objId: string | undefined
@@ -58,7 +58,7 @@ export class PerformanceStatistics {
       name: this.objName,
       uri: uri.toString(),
       createdAt: new Date(),
-      statisticsData: new Map()
+      statisticsData: new Map(),
     }
   }
 
@@ -132,7 +132,7 @@ export class PerformanceStatistics {
         } else {
           this.statistics.statisticsData.set(command, {
             ...this.statistics.statisticsData.get(command),
-            requestCount: 1
+            requestCount: 1,
           })
         }
         break
@@ -146,7 +146,7 @@ export class PerformanceStatistics {
         } else {
           this.statistics.statisticsData.set(command, {
             ...this.statistics.statisticsData.get(command),
-            responseCount: 1
+            responseCount: 1,
           })
         }
         break
@@ -160,7 +160,7 @@ export class PerformanceStatistics {
         } else {
           this.statistics.statisticsData.set(command, {
             ...this.statistics.statisticsData.get(command),
-            errorCount: 1
+            errorCount: 1,
           })
         }
         break
@@ -180,7 +180,9 @@ export class PerformanceStatistics {
     if (performanceStorageConfiguration.enabled === true) {
       logger.info(
         `${this.logPrefix()} storage enabled: type ${
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           performanceStorageConfiguration.type
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         }, uri: ${performanceStorageConfiguration.uri}`
       )
     }
@@ -215,7 +217,7 @@ export class PerformanceStatistics {
       ...this.statistics,
       statisticsData: JSON.parse(
         JSONStringify(this.statistics.statisticsData, undefined, MapStringifyFormat.object)
-      ) as Map<string | RequestCommand | IncomingRequestCommand, StatisticsData>
+      ) as Map<string | RequestCommand | IncomingRequestCommand, StatisticsData>,
     })
   }
 
@@ -241,7 +243,7 @@ export class PerformanceStatistics {
       )
     } else if (logConfiguration.enabled === true) {
       logger.info(
-        `${this.logPrefix()} log interval is set to ${logStatisticsInterval}. Not logging statistics`
+        `${this.logPrefix()} log interval is set to ${logStatisticsInterval.toString()}. Not logging statistics`
       )
     }
   }
@@ -292,7 +294,7 @@ export class PerformanceStatistics {
     }
     this.statistics.statisticsData.get(entry.name)?.measurementTimeSeries?.push({
       timestamp: entry.startTime,
-      value: entry.duration
+      value: entry.duration,
     })
     const timeMeasurementValues = extractTimeSeriesValues(
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -328,6 +330,7 @@ export class PerformanceStatistics {
   }
 
   private readonly logPrefix = (): string => {
+    // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
     return logPrefix(` ${this.objName} | Performance statistics`)
   }
 }
index 7269ce76dae82587822e38cfafd485e3aca03e64..7d7beedea4b695cffb1831d659f797cfdf281cef 100644 (file)
@@ -24,8 +24,8 @@ export class MikroOrmStorage extends Storage {
         ...performanceStatistics,
         statisticsData: Array.from(performanceStatistics.statisticsData, ([name, value]) => ({
           name,
-          ...value
-        }))
+          ...value,
+        })),
       } satisfies PerformanceRecord)
     } catch (error) {
       this.handleDBStorageError(
@@ -78,7 +78,7 @@ export class MikroOrmStorage extends Storage {
       dbName: this.dbName,
       entities: ['./dist/types/orm/entities/*.js'],
       entitiesTs: ['./src/types/orm/entities/*.ts'],
-      clientUrl: this.getClientUrl()
+      clientUrl: this.getClientUrl(),
     }
   }
 
index 982e55bf682800ba02da10dc717bf6dea08fa736..5635e2b29cfc20ae65d0991757201fb6342ba038 100644 (file)
@@ -26,7 +26,7 @@ export class MongoDBStorage extends Storage {
         ?.db(this.dbName)
         .collection<Statistics>(Constants.PERFORMANCE_RECORDS_TABLE)
         .replaceOne({ id: performanceStatistics.id }, performanceStatistics, {
-          upsert: true
+          upsert: true,
         })
     } catch (error) {
       this.handleDBStorageError(
@@ -63,6 +63,7 @@ export class MongoDBStorage extends Storage {
   private checkDBConnection (): void {
     if (this.client == null) {
       throw new BaseError(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `${this.logPrefix} ${this.getDBNameFromStorageType(
           StorageType.MONGO_DB
         )} client initialization failed while trying to issue a request`
@@ -70,6 +71,7 @@ export class MongoDBStorage extends Storage {
     }
     if (!this.connected) {
       throw new BaseError(
+        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         `${this.logPrefix} ${this.getDBNameFromStorageType(
           StorageType.MONGO_DB
         )} connection not opened while trying to issue a request`
index 39d0a1b30250b80fd825351f4d476792ef89a3a6..89e4dbd232f64b41faa23cbe822aa7e808406f38 100644 (file)
@@ -7,7 +7,7 @@ import {
   type EmptyObject,
   type HandleErrorParams,
   type Statistics,
-  StorageType
+  StorageType,
 } from '../../types/index.js'
 import { logger } from '../../utils/index.js'
 
@@ -28,20 +28,22 @@ export abstract class Storage {
     table?: string,
     params: HandleErrorParams<EmptyObject> = {
       throwError: false,
-      consoleOut: false
+      consoleOut: false,
     }
   ): void {
     params = {
       ...{
         throwError: false,
-        consoleOut: false
+        consoleOut: false,
       },
-      ...params
+      ...params,
     }
     const inTableOrCollectionStr = table != null && ` in table or collection '${table}'`
     logger.error(
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       `${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${
         error.message
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       }'${inTableOrCollectionStr}:`,
       error
     )
index 345381425e7422f428b4a8fed775b2344ad057b4..52349887e6f1c4b460802980796979aab1c604c4 100755 (executable)
@@ -13,7 +13,6 @@ 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 (_err, client) => {
     const db = client.db()
 
index 09e5873b62319fec802d382d21ea54b907c6701f..8aa428ad1499c576cc4e517ca4c9f60331c69c18 100755 (executable)
@@ -14,7 +14,6 @@ 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 (_err, client) => {
     const db = client.db()
 
index bb42adff99a4c53365b04cb2b25f2473824eef82..630e1bd0cb1c55666b362d173c272f91e86af32b 100644 (file)
@@ -17,9 +17,9 @@ interface EvsesConfiguration {
 }
 
 export type ChargingStationConfiguration = ChargingStationInfoConfiguration &
-ChargingStationOcppConfiguration &
-ChargingStationAutomaticTransactionGeneratorConfiguration &
-ConnectorsConfiguration &
-EvsesConfiguration & {
-  configurationHash?: string
-}
+  ChargingStationOcppConfiguration &
+  ChargingStationAutomaticTransactionGeneratorConfiguration &
+  ConnectorsConfiguration &
+  EvsesConfiguration & {
+    configurationHash?: string
+  }
index 12327cd891b918cee810e3843f180503f0f41547..8f4966f9f4d66178fe159e9e7f70c5b033df4962 100644 (file)
@@ -2,17 +2,17 @@ import type { ChargingStationTemplate } from './ChargingStationTemplate.js'
 import type { FirmwareStatus } from './ocpp/Requests.js'
 
 export type ChargingStationInfo = Omit<
-ChargingStationTemplate,
-| 'Connectors'
-| 'Evses'
-| 'Configuration'
-| 'AutomaticTransactionGenerator'
-| 'numberOfConnectors'
-| 'power'
-| 'powerUnit'
-| 'chargeBoxSerialNumberPrefix'
-| 'chargePointSerialNumberPrefix'
-| 'meterSerialNumberPrefix'
+  ChargingStationTemplate,
+  | 'Connectors'
+  | 'Evses'
+  | 'Configuration'
+  | 'AutomaticTransactionGenerator'
+  | 'numberOfConnectors'
+  | 'power'
+  | 'powerUnit'
+  | 'chargeBoxSerialNumberPrefix'
+  | 'chargePointSerialNumberPrefix'
+  | 'meterSerialNumberPrefix'
 > & {
   hashId: string
   templateIndex: number
index b3cc773489d0f384feb8bf93cb5934039628eeae..9497e500900c8b8e3e44d4a72520e50c5c0f0bf6 100644 (file)
@@ -13,7 +13,7 @@ import type {
   FirmwareStatus,
   IncomingRequestCommand,
   MessageTrigger,
-  RequestCommand
+  RequestCommand,
 } from './ocpp/Requests.js'
 
 export enum CurrentType {
index 4d47a5e3698bb96a5bad1e9f3093af396993be32..fd8c7d1458242ceeb8369173cdeaf4e7a5693d19 100644 (file)
@@ -53,7 +53,7 @@ enum ChargingStationMessageEvents {
 
 export const ChargingStationWorkerMessageEvents = {
   ...ChargingStationEvents,
-  ...ChargingStationMessageEvents
+  ...ChargingStationMessageEvents,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargingStationWorkerMessageEvents =
index 2f7269aaf2ea563271745b9826b9f877382d0d5a..499fe09bc90eb0183b33cc010d21fd8af948332f 100644 (file)
@@ -15,7 +15,7 @@ export const WebSocketCloseEventStatusString: Record<WebSocketCloseEventStatusCo
     1012: 'Service Restart',
     1013: 'Try Again Later',
     1014: 'Bad Gateway',
-    1015: 'TLS Handshake'
+    1015: 'TLS Handshake',
   })
 
 export enum WebSocketCloseEventStatusCode {
index 6fa70636b9d3e9b153d90c8f5dd20a4b36d75018..63b1cdeea44bc5daa50d4a355924e75167685908 100644 (file)
@@ -2,17 +2,17 @@ export {
   type AutomaticTransactionGeneratorConfiguration,
   type ChargingStationAutomaticTransactionGeneratorConfiguration,
   IdTagDistribution,
-  type Status
+  type Status,
 } from './AutomaticTransactionGenerator.js'
 export type {
   ChargingStationConfiguration,
-  EvseStatusConfiguration
+  EvseStatusConfiguration,
 } from './ChargingStationConfiguration.js'
 export { ChargingStationEvents } from './ChargingStationEvents.js'
 export type { ChargingStationInfo } from './ChargingStationInfo.js'
 export type {
   ChargingStationOcppConfiguration,
-  ConfigurationKey
+  ConfigurationKey,
 } from './ChargingStationOcppConfiguration.js'
 export {
   AmpereUnits,
@@ -21,7 +21,7 @@ export {
   type FirmwareUpgrade,
   PowerUnits,
   Voltage,
-  type WsOptions
+  type WsOptions,
 } from './ChargingStationTemplate.js'
 export {
   type ChargingStationData,
@@ -30,7 +30,7 @@ export {
   type ChargingStationWorkerMessage,
   type ChargingStationWorkerMessageData,
   ChargingStationWorkerMessageEvents,
-  type EvseStatusWorkerType
+  type EvseStatusWorkerType,
 } from './ChargingStationWorker.js'
 export {
   ApplicationProtocolVersion,
@@ -42,7 +42,7 @@ export {
   type StorageConfiguration,
   SupervisionUrlDistribution,
   type UIServerConfiguration,
-  type WorkerConfiguration
+  type WorkerConfiguration,
 } from './ConfigurationData.js'
 export type { ConnectorStatus } from './ConnectorStatus.js'
 export type { EmptyObject } from './EmptyObject.js'
@@ -53,7 +53,7 @@ export type { JsonObject, JsonType } from './JsonType.js'
 export { MapStringifyFormat } from './MapStringifyFormat.js'
 export type {
   MeasurandPerPhaseSampledValueTemplates,
-  SampledValueTemplate
+  SampledValueTemplate,
 } from './MeasurandPerPhaseSampledValueTemplates.js'
 export type { MeasurandValues } from './MeasurandValues.js'
 export { OCPP16ChargePointErrorCode } from './ocpp/1.6/ChargePointErrorCode.js'
@@ -63,11 +63,11 @@ export {
   OCPP16ChargingProfilePurposeType,
   OCPP16ChargingRateUnitType,
   type OCPP16ChargingSchedule,
-  type OCPP16ChargingSchedulePeriod
+  type OCPP16ChargingSchedulePeriod,
 } from './ocpp/1.6/ChargingProfile.js'
 export {
   OCPP16StandardParametersKey,
-  OCPP16SupportedFeatureProfiles
+  OCPP16SupportedFeatureProfiles,
 } from './ocpp/1.6/Configuration.js'
 export { OCPP16DiagnosticsStatus } from './ocpp/1.6/DiagnosticsStatus.js'
 export {
@@ -79,7 +79,7 @@ export {
   type OCPP16MeterValuesRequest,
   type OCPP16MeterValuesResponse,
   OCPP16MeterValueUnit,
-  type OCPP16SampledValue
+  type OCPP16SampledValue,
 } from './ocpp/1.6/MeterValues.js'
 export {
   type ChangeConfigurationRequest,
@@ -109,7 +109,7 @@ export {
   type RemoteStopTransactionRequest,
   type ResetRequest,
   type SetChargingProfileRequest,
-  type UnlockConnectorRequest
+  type UnlockConnectorRequest,
 } from './ocpp/1.6/Requests.js'
 export {
   type ChangeConfigurationResponse,
@@ -130,7 +130,7 @@ export {
   OCPP16TriggerMessageStatus,
   type OCPP16UpdateFirmwareResponse,
   type SetChargingProfileResponse,
-  type UnlockConnectorResponse
+  type UnlockConnectorResponse,
 } from './ocpp/1.6/Responses.js'
 export {
   OCPP16AuthorizationStatus,
@@ -140,7 +140,7 @@ export {
   type OCPP16StartTransactionResponse,
   OCPP16StopTransactionReason,
   type OCPP16StopTransactionRequest,
-  type OCPP16StopTransactionResponse
+  type OCPP16StopTransactionResponse,
 } from './ocpp/1.6/Transaction.js'
 export { BootReasonEnumType, OCPP20ConnectorStatusEnumType } from './ocpp/2.0/Common.js'
 export {
@@ -149,13 +149,13 @@ export {
   type OCPP20HeartbeatRequest,
   OCPP20IncomingRequestCommand,
   OCPP20RequestCommand,
-  type OCPP20StatusNotificationRequest
+  type OCPP20StatusNotificationRequest,
 } from './ocpp/2.0/Requests.js'
 export type {
   OCPP20BootNotificationResponse,
   OCPP20ClearCacheResponse,
   OCPP20HeartbeatResponse,
-  OCPP20StatusNotificationResponse
+  OCPP20StatusNotificationResponse,
 } from './ocpp/2.0/Responses.js'
 export { OCPP20OptionalVariableName } from './ocpp/2.0/Variables.js'
 export { ChargePointErrorCode } from './ocpp/ChargePointErrorCode.js'
@@ -165,7 +165,7 @@ export {
   ChargingProfilePurposeType,
   ChargingRateUnitType,
   type ChargingSchedulePeriod,
-  RecurrencyKindType
+  RecurrencyKindType,
 } from './ocpp/ChargingProfile.js'
 export { type GenericResponse, GenericStatus, RegistrationStatusEnumType } from './ocpp/Common.js'
 export {
@@ -174,7 +174,7 @@ export {
   type OCPPConfigurationKey,
   StandardParametersKey,
   SupportedFeatureProfiles,
-  VendorParametersKey
+  VendorParametersKey,
 } from './ocpp/Configuration.js'
 export { ConnectorStatusEnum, type ConnectorStatusTransition } from './ocpp/ConnectorStatusEnum.js'
 export { ErrorType } from './ocpp/ErrorType.js'
@@ -186,7 +186,7 @@ export {
   MeterValueMeasurand,
   MeterValuePhase,
   MeterValueUnit,
-  type SampledValue
+  type SampledValue,
 } from './ocpp/MeterValues.js'
 export { OCPPVersion } from './ocpp/OCPPVersion.js'
 export {
@@ -209,12 +209,12 @@ export {
   type RequestParams,
   type ResponseCallback,
   type ResponseType,
-  type StatusNotificationRequest
+  type StatusNotificationRequest,
 } from './ocpp/Requests.js'
 export {
   type Reservation,
   type ReservationKey,
-  ReservationTerminationReason
+  ReservationTerminationReason,
 } from './ocpp/Reservation.js'
 export {
   AvailabilityStatus,
@@ -235,7 +235,7 @@ export {
   type ResponseHandler,
   type StatusNotificationResponse,
   TriggerMessageStatus,
-  UnlockStatus
+  UnlockStatus,
 } from './ocpp/Responses.js'
 export {
   AuthorizationStatus,
@@ -245,7 +245,7 @@ export {
   type StartTransactionResponse,
   StopTransactionReason,
   type StopTransactionRequest,
-  type StopTransactionResponse
+  type StopTransactionResponse,
 } from './ocpp/Transaction.js'
 export { PerformanceRecord } from './orm/entities/PerformanceRecord.js'
 export type { SimulatorState } from './SimulatorState.js'
@@ -253,7 +253,7 @@ export type {
   Statistics,
   StatisticsData,
   TemplateStatistics,
-  TimestampedData
+  TimestampedData,
 } from './Statistics.js'
 export { DBName, StorageType } from './Storage.js'
 export {
@@ -267,12 +267,12 @@ export {
   ProtocolVersion,
   type RequestPayload,
   type ResponsePayload,
-  ResponseStatus
+  ResponseStatus,
 } from './UIProtocol.js'
 export {
   WebSocketCloseEventStatusCode,
   WebSocketCloseEventStatusString,
-  type WSError
+  type WSError,
 } from './WebSocket.js'
 export {
   BroadcastChannelProcedureName,
@@ -280,5 +280,5 @@ export {
   type BroadcastChannelRequestPayload,
   type BroadcastChannelResponse,
   type BroadcastChannelResponsePayload,
-  type MessageEvent
+  type MessageEvent,
 } from './WorkerBroadcastChannel.js'
index e186679f5004938c7662615dfa4fde8d29133300..014be2ed083e50d95b42902adae62e2f3cc6906d 100644 (file)
@@ -5,7 +5,7 @@ import type { OCPP16ChargePointStatus } from './ChargePointStatus.js'
 import type {
   OCPP16ChargingProfile,
   OCPP16ChargingProfilePurposeType,
-  OCPP16ChargingRateUnitType
+  OCPP16ChargingRateUnitType,
 } from './ChargingProfile.js'
 import type { OCPP16StandardParametersKey, OCPP16VendorParametersKey } from './Configuration.js'
 import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus.js'
index f075e642f7284f657398f5e3a7a46b0ab7f565db..2673cbaf9eccb0894b4b291ee976fff78eee16e8 100644 (file)
@@ -3,7 +3,7 @@ import type { JsonObject } from '../../JsonType.js'
 import type {
   BootReasonEnumType,
   InstallCertificateUseEnumType,
-  OCPP20ConnectorStatusEnumType
+  OCPP20ConnectorStatusEnumType,
 } from './Common.js'
 import type { OCPP20SetVariableDataType } from './Variables.js'
 
index 4248c5d8f6baf74bc7b5874371c6026a781e9442..b0f281c7cbda063580421cd646018259b4949266 100644 (file)
@@ -4,7 +4,7 @@ import type { RegistrationStatusEnumType } from '../Common.js'
 import type {
   GenericStatusEnumType,
   InstallCertificateStatusEnumType,
-  StatusInfoType
+  StatusInfoType,
 } from './Common.js'
 import type { OCPP20SetVariableResultType } from './Variables.js'
 
index 9c29390e6974923bdaa37a508696bcad5a906d28..cd20da95dc4080e1433003cc07ce3306f10ade96 100644 (file)
@@ -1,7 +1,7 @@
 import { OCPP16ChargePointErrorCode } from './1.6/ChargePointErrorCode.js'
 
 export const ChargePointErrorCode = {
-  ...OCPP16ChargePointErrorCode
+  ...OCPP16ChargePointErrorCode,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargePointErrorCode = OCPP16ChargePointErrorCode
index 8fc773b73a5352642006bd249a4f6fc42e44e09e..9009b76fce9da759b766a05ac5dbc37ab648b143 100644 (file)
@@ -4,7 +4,7 @@ import {
   OCPP16ChargingProfilePurposeType,
   OCPP16ChargingRateUnitType,
   type OCPP16ChargingSchedulePeriod,
-  OCPP16RecurrencyKindType
+  OCPP16RecurrencyKindType,
 } from './1.6/ChargingProfile.js'
 
 export type ChargingProfile = OCPP16ChargingProfile
@@ -12,25 +12,25 @@ export type ChargingProfile = OCPP16ChargingProfile
 export type ChargingSchedulePeriod = OCPP16ChargingSchedulePeriod
 
 export const ChargingProfilePurposeType = {
-  ...OCPP16ChargingProfilePurposeType
+  ...OCPP16ChargingProfilePurposeType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargingProfilePurposeType = OCPP16ChargingProfilePurposeType
 
 export const ChargingProfileKindType = {
-  ...OCPP16ChargingProfileKindType
+  ...OCPP16ChargingProfileKindType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargingProfileKindType = OCPP16ChargingProfileKindType
 
 export const RecurrencyKindType = {
-  ...OCPP16RecurrencyKindType
+  ...OCPP16RecurrencyKindType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type RecurrencyKindType = OCPP16RecurrencyKindType
 
 export const ChargingRateUnitType = {
-  ...OCPP16ChargingRateUnitType
+  ...OCPP16ChargingRateUnitType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargingRateUnitType = OCPP16ChargingRateUnitType
index f1cd34ba3f8ec0cd79b70de1d8378fb409d7e511..c4dbba8ad61b3c4b76aaa0fc41b934337ba6ed4f 100644 (file)
@@ -2,31 +2,31 @@ import type { JsonObject } from '../JsonType.js'
 import {
   OCPP16StandardParametersKey,
   OCPP16SupportedFeatureProfiles,
-  OCPP16VendorParametersKey
+  OCPP16VendorParametersKey,
 } from './1.6/Configuration.js'
 import {
   OCPP20OptionalVariableName,
   OCPP20RequiredVariableName,
-  OCPP20VendorVariableName
+  OCPP20VendorVariableName,
 } from './2.0/Variables.js'
 
 export const StandardParametersKey = {
   ...OCPP16StandardParametersKey,
   ...OCPP20RequiredVariableName,
-  ...OCPP20OptionalVariableName
+  ...OCPP20OptionalVariableName,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type StandardParametersKey = OCPP16StandardParametersKey
 
 export const VendorParametersKey = {
   ...OCPP16VendorParametersKey,
-  ...OCPP20VendorVariableName
+  ...OCPP20VendorVariableName,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type VendorParametersKey = OCPP16VendorParametersKey
 
 export const SupportedFeatureProfiles = {
-  ...OCPP16SupportedFeatureProfiles
+  ...OCPP16SupportedFeatureProfiles,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type SupportedFeatureProfiles = OCPP16SupportedFeatureProfiles
index 9c4d246994bd09ecec97242fb247a6366ea46048..ee31829194f7e9d52579e3fe40f9761d0d622b0b 100644 (file)
@@ -3,7 +3,7 @@ import { OCPP20ConnectorStatusEnumType } from './2.0/Common.js'
 
 export const ConnectorStatusEnum = {
   ...OCPP16ChargePointStatus,
-  ...OCPP20ConnectorStatusEnumType
+  ...OCPP20ConnectorStatusEnumType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ConnectorStatusEnum = OCPP16ChargePointStatus | OCPP20ConnectorStatusEnumType
index aec3d19e1934e4e61a030713d9018e58ad05f158..6a44bb7456d4a78a3edcdfbea3ecea38019a04da 100644 (file)
@@ -5,35 +5,35 @@ import {
   OCPP16MeterValueMeasurand,
   OCPP16MeterValuePhase,
   OCPP16MeterValueUnit,
-  type OCPP16SampledValue
+  type OCPP16SampledValue,
 } from './1.6/MeterValues.js'
 
 export const MeterValueUnit = {
-  ...OCPP16MeterValueUnit
+  ...OCPP16MeterValueUnit,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MeterValueUnit = OCPP16MeterValueUnit
 
 export const MeterValueContext = {
-  ...OCPP16MeterValueContext
+  ...OCPP16MeterValueContext,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MeterValueContext = OCPP16MeterValueContext
 
 export const MeterValueMeasurand = {
-  ...OCPP16MeterValueMeasurand
+  ...OCPP16MeterValueMeasurand,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MeterValueMeasurand = OCPP16MeterValueMeasurand
 
 export const MeterValueLocation = {
-  ...OCPP16MeterValueLocation
+  ...OCPP16MeterValueLocation,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MeterValueLocation = OCPP16MeterValueLocation
 
 export const MeterValuePhase = {
-  ...OCPP16MeterValuePhase
+  ...OCPP16MeterValuePhase,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MeterValuePhase = OCPP16MeterValuePhase
index 12e1c68c3e6996cf9c3d1ddb48158662ea7ab0df..b5d6f7f0bb58321cad72a0164976c39d96360a24 100644 (file)
@@ -16,20 +16,20 @@ import {
   OCPP16MessageTrigger,
   OCPP16RequestCommand,
   type OCPP16ReserveNowRequest,
-  type OCPP16StatusNotificationRequest
+  type OCPP16StatusNotificationRequest,
 } from './1.6/Requests.js'
 import { OperationalStatusEnumType } from './2.0/Common.js'
 import {
   type OCPP20BootNotificationRequest,
   OCPP20IncomingRequestCommand,
   OCPP20RequestCommand,
-  type OCPP20StatusNotificationRequest
+  type OCPP20StatusNotificationRequest,
 } from './2.0/Requests.js'
 import type { MessageType } from './MessageType.js'
 
 export const RequestCommand = {
   ...OCPP16RequestCommand,
-  ...OCPP20RequestCommand
+  ...OCPP20RequestCommand,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type RequestCommand = OCPP16RequestCommand | OCPP20RequestCommand
@@ -44,7 +44,7 @@ export interface RequestParams {
 
 export const IncomingRequestCommand = {
   ...OCPP16IncomingRequestCommand,
-  ...OCPP20IncomingRequestCommand
+  ...OCPP20IncomingRequestCommand,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type IncomingRequestCommand = OCPP16IncomingRequestCommand | OCPP20IncomingRequestCommand
@@ -60,15 +60,10 @@ export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) =>
 
 export type ErrorCallback = (ocppError: OCPPError, requestStatistic?: boolean) => void
 
-export type CachedRequest = [
-  ResponseCallback,
-  ErrorCallback,
-  RequestCommand | IncomingRequestCommand,
-  JsonType
-]
+export type CachedRequest = [ResponseCallback, ErrorCallback, RequestCommand, JsonType]
 
 export const MessageTrigger = {
-  ...OCPP16MessageTrigger
+  ...OCPP16MessageTrigger,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type MessageTrigger = OCPP16MessageTrigger
@@ -91,19 +86,19 @@ export type FirmwareStatusNotificationRequest = OCPP16FirmwareStatusNotification
 
 export const AvailabilityType = {
   ...OCPP16AvailabilityType,
-  ...OperationalStatusEnumType
+  ...OperationalStatusEnumType,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type AvailabilityType = OCPP16AvailabilityType | OperationalStatusEnumType
 
 export const DiagnosticsStatus = {
-  ...OCPP16DiagnosticsStatus
+  ...OCPP16DiagnosticsStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type DiagnosticsStatus = OCPP16DiagnosticsStatus
 
 export const FirmwareStatus = {
-  ...OCPP16FirmwareStatus
+  ...OCPP16FirmwareStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type FirmwareStatus = OCPP16FirmwareStatus
index aac5a5fc3774b39d008b454d5e85faad021e2016..43b595150f8a999e19a3423bc91662e504a578b5 100644 (file)
@@ -15,7 +15,7 @@ import {
   OCPP16ReservationStatus,
   type OCPP16StatusNotificationResponse,
   OCPP16TriggerMessageStatus,
-  OCPP16UnlockStatus
+  OCPP16UnlockStatus,
 } from './1.6/Responses.js'
 import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from './2.0/Responses.js'
 import { type GenericResponse, GenericStatus } from './Common.js'
@@ -51,43 +51,43 @@ export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotif
 export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse
 
 export const AvailabilityStatus = {
-  ...OCPP16AvailabilityStatus
+  ...OCPP16AvailabilityStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type AvailabilityStatus = OCPP16AvailabilityStatus
 
 export const ChargingProfileStatus = {
-  ...OCPP16ChargingProfileStatus
+  ...OCPP16ChargingProfileStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ChargingProfileStatus = OCPP16ChargingProfileStatus
 
 export const ClearChargingProfileStatus = {
-  ...OCPP16ClearChargingProfileStatus
+  ...OCPP16ClearChargingProfileStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus
 
 export const ConfigurationStatus = {
-  ...OCPP16ConfigurationStatus
+  ...OCPP16ConfigurationStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type ConfigurationStatus = OCPP16ConfigurationStatus
 
 export const UnlockStatus = {
-  ...OCPP16UnlockStatus
+  ...OCPP16UnlockStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type UnlockStatus = OCPP16UnlockStatus
 
 export const TriggerMessageStatus = {
-  ...OCPP16TriggerMessageStatus
+  ...OCPP16TriggerMessageStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type TriggerMessageStatus = OCPP16TriggerMessageStatus
 
 export const DataTransferStatus = {
-  ...OCPP16DataTransferStatus
+  ...OCPP16DataTransferStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type DataTransferStatus = OCPP16DataTransferStatus
@@ -95,13 +95,13 @@ export type DataTransferStatus = OCPP16DataTransferStatus
 export type ReservationStatus = OCPP16ReservationStatus
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export const ReservationStatus = {
-  ...OCPP16ReservationStatus
+  ...OCPP16ReservationStatus,
 } as const
 
 export type CancelReservationStatus = GenericStatus
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export const CancelReservationStatus = {
-  ...GenericStatus
+  ...GenericStatus,
 } as const
 
 export type CancelReservationResponse = GenericResponse
index 75034efc92a6550afedc481b0ef3901116134b6c..5379f11192d8b35c618218743047cb61b0cf6afd 100644 (file)
@@ -6,11 +6,11 @@ import {
   type OCPP16StartTransactionResponse,
   OCPP16StopTransactionReason,
   type OCPP16StopTransactionRequest,
-  type OCPP16StopTransactionResponse
+  type OCPP16StopTransactionResponse,
 } from './1.6/Transaction.js'
 
 export const AuthorizationStatus = {
-  ...OCPP16AuthorizationStatus
+  ...OCPP16AuthorizationStatus,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type AuthorizationStatus = OCPP16AuthorizationStatus
@@ -20,7 +20,7 @@ export type AuthorizeRequest = OCPP16AuthorizeRequest
 export type AuthorizeResponse = OCPP16AuthorizeResponse
 
 export const StopTransactionReason = {
-  ...OCPP16StopTransactionReason
+  ...OCPP16StopTransactionReason,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type StopTransactionReason = OCPP16StopTransactionReason
index bdd88abaeb6cd04e4ab8fc79752343ade355d295..53cc5108d370be873bc57ae6e3431e99579eeed1 100644 (file)
@@ -6,10 +6,10 @@ interface StatisticsData {
   responseCount: number
   errorCount: number
   timeMeasurementCount: number
-  measurementTimeSeries: Array<{
+  measurementTimeSeries: {
     timestamp: number
     value: number
-  }>
+  }[]
   currentTimeMeasurement: number
   minTimeMeasurement: number
   maxTimeMeasurement: number
@@ -23,20 +23,20 @@ interface StatisticsData {
 @Entity()
 export class PerformanceRecord {
   @PrimaryKey()
-    id!: string
+  id!: string
 
   @Property()
-    name!: string
+  name!: string
 
   @Property()
-    uri!: string
+  uri!: string
 
   @Property()
-    createdAt!: Date
+  createdAt!: Date
 
   @Property()
-    updatedAt?: Date
+  updatedAt?: Date
 
   @Property()
-    statisticsData!: Array<Partial<StatisticsData>>
+  statisticsData!: Partial<StatisticsData>[]
 }
index c5330a0d95ecd700b997d618261ab70909967e71..c6717a74289554b5dec43c8d4a5da32178483b7e 100644 (file)
@@ -3,7 +3,7 @@ import type {
   ChargingStationAutomaticTransactionGeneratorConfiguration,
   ConnectorStatus,
   EvseStatusConfiguration,
-  EvseStatusWorkerType
+  EvseStatusWorkerType,
 } from '../types/index.js'
 
 export const buildChargingStationAutomaticTransactionGeneratorConfiguration = (
@@ -13,9 +13,9 @@ export const buildChargingStationAutomaticTransactionGeneratorConfiguration = (
     automaticTransactionGenerator: chargingStation.getAutomaticTransactionGeneratorConfiguration(),
     ...(chargingStation.automaticTransactionGenerator?.connectorsStatus != null && {
       automaticTransactionGeneratorStatuses: [
-        ...chargingStation.automaticTransactionGenerator.connectorsStatus.values()
-      ]
-    })
+        ...chargingStation.automaticTransactionGenerator.connectorsStatus.values(),
+      ],
+    }),
   }
 }
 
@@ -33,7 +33,7 @@ export enum OutputFormat {
 export const buildEvsesStatus = (
   chargingStation: ChargingStation,
   outputFormat: OutputFormat = OutputFormat.configuration
-): Array<EvseStatusWorkerType | EvseStatusConfiguration> => {
+): (EvseStatusWorkerType | EvseStatusConfiguration)[] => {
   // eslint-disable-next-line array-callback-return
   return [...chargingStation.evses.values()].map(evseStatus => {
     const connectorsStatus = [...evseStatus.connectors.values()].map(
@@ -44,12 +44,12 @@ export const buildEvsesStatus = (
       case OutputFormat.worker:
         return {
           ...evseStatus,
-          connectors: connectorsStatus
+          connectors: connectorsStatus,
         }
       case OutputFormat.configuration:
         status = {
           ...evseStatus,
-          connectorsStatus
+          connectorsStatus,
         }
         delete (status as EvseStatusWorkerType).connectors
         return status
index 06f543a58f017bcb3dec3cf10a4683fad3f79180..970fd99267171c1dc5c371f941c6cd62efc7e261 100644 (file)
@@ -18,14 +18,14 @@ import {
   StorageType,
   SupervisionUrlDistribution,
   type UIServerConfiguration,
-  type WorkerConfiguration
+  type WorkerConfiguration,
 } from '../types/index.js'
 import {
   DEFAULT_ELEMENT_ADD_DELAY,
   DEFAULT_POOL_MAX_SIZE,
   DEFAULT_POOL_MIN_SIZE,
   DEFAULT_WORKER_START_DELAY,
-  WorkerProcessType
+  WorkerProcessType,
 } from '../worker/index.js'
 import {
   buildPerformanceUriFilePath,
@@ -33,7 +33,7 @@ import {
   checkWorkerProcessType,
   getDefaultPerformanceStorageUri,
   handleFileException,
-  logPrefix
+  logPrefix,
 } from './ConfigurationUtils.js'
 import { Constants } from './Constants.js'
 import { hasOwnProp, isCFEnvironment } from './Utils.js'
@@ -50,13 +50,13 @@ const defaultUIServerConfiguration: UIServerConfiguration = {
   version: ApplicationProtocolVersion.VERSION_11,
   options: {
     host: Constants.DEFAULT_UI_SERVER_HOST,
-    port: Constants.DEFAULT_UI_SERVER_PORT
-  }
+    port: Constants.DEFAULT_UI_SERVER_PORT,
+  },
 }
 
 const defaultStorageConfiguration: StorageConfiguration = {
   enabled: true,
-  type: StorageType.NONE
+  type: StorageType.NONE,
 }
 
 const defaultLogConfiguration: LogConfiguration = {
@@ -66,7 +66,7 @@ const defaultLogConfiguration: LogConfiguration = {
   statisticsInterval: Constants.DEFAULT_LOG_STATISTICS_INTERVAL,
   level: 'info',
   format: 'simple',
-  rotate: true
+  rotate: true,
 }
 
 const defaultWorkerConfiguration: WorkerConfiguration = {
@@ -75,7 +75,7 @@ const defaultWorkerConfiguration: WorkerConfiguration = {
   elementsPerWorker: 'auto',
   elementAddDelay: DEFAULT_ELEMENT_ADD_DELAY,
   poolMinSize: DEFAULT_POOL_MIN_SIZE,
-  poolMaxSize: DEFAULT_POOL_MAX_SIZE
+  poolMaxSize: DEFAULT_POOL_MAX_SIZE,
 }
 
 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
@@ -102,25 +102,25 @@ export class Configuration {
         stationTemplateUrls: [
           {
             file: 'siemens.station-template.json',
-            numberOfStations: 1
-          }
+            numberOfStations: 1,
+          },
         ],
         supervisionUrls: 'ws://localhost:8180/steve/websocket/CentralSystemService',
         supervisionUrlDistribution: SupervisionUrlDistribution.ROUND_ROBIN,
         uiServer: defaultUIServerConfiguration,
         performanceStorage: defaultStorageConfiguration,
         log: defaultLogConfiguration,
-        worker: defaultWorkerConfiguration
+        worker: defaultWorkerConfiguration,
       }
     }
     Configuration.configurationSectionCache = new Map<
-    ConfigurationSection,
-    ConfigurationSectionType
+      ConfigurationSection,
+      ConfigurationSectionType
     >([
       [ConfigurationSection.log, Configuration.buildLogSection()],
       [ConfigurationSection.performanceStorage, Configuration.buildPerformanceStorageSection()],
       [ConfigurationSection.worker, Configuration.buildWorkerSection()],
-      [ConfigurationSection.uiServer, Configuration.buildUIServerSection()]
+      [ConfigurationSection.uiServer, Configuration.buildUIServerSection()],
     ])
   }
 
@@ -232,14 +232,14 @@ export class Configuration {
         storageConfiguration = {
           enabled: false,
           type: StorageType.SQLITE,
-          uri: getDefaultPerformanceStorageUri(StorageType.SQLITE)
+          uri: getDefaultPerformanceStorageUri(StorageType.SQLITE),
         }
         break
       case StorageType.JSON_FILE:
         storageConfiguration = {
           enabled: false,
           type: StorageType.JSON_FILE,
-          uri: getDefaultPerformanceStorageUri(StorageType.JSON_FILE)
+          uri: getDefaultPerformanceStorageUri(StorageType.JSON_FILE),
         }
         break
       case StorageType.NONE:
@@ -258,8 +258,8 @@ export class Configuration {
           uri: buildPerformanceUriFilePath(
             // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
             new URL(Configuration.getConfigurationData()!.performanceStorage!.uri!).pathname
-          )
-        })
+          ),
+        }),
       }
     }
     return storageConfiguration
@@ -268,41 +268,41 @@ export class Configuration {
   private static buildLogSection (): LogConfiguration {
     const deprecatedLogConfiguration: LogConfiguration = {
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logEnabled') && {
-        enabled: Configuration.getConfigurationData()?.logEnabled
+        enabled: Configuration.getConfigurationData()?.logEnabled,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logFile') && {
-        file: Configuration.getConfigurationData()?.logFile
+        file: Configuration.getConfigurationData()?.logFile,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logErrorFile') && {
-        errorFile: Configuration.getConfigurationData()?.logErrorFile
+        errorFile: Configuration.getConfigurationData()?.logErrorFile,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logStatisticsInterval') && {
-        statisticsInterval: Configuration.getConfigurationData()?.logStatisticsInterval
+        statisticsInterval: Configuration.getConfigurationData()?.logStatisticsInterval,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logLevel') && {
-        level: Configuration.getConfigurationData()?.logLevel
+        level: Configuration.getConfigurationData()?.logLevel,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logConsole') && {
-        console: Configuration.getConfigurationData()?.logConsole
+        console: Configuration.getConfigurationData()?.logConsole,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logFormat') && {
-        format: Configuration.getConfigurationData()?.logFormat
+        format: Configuration.getConfigurationData()?.logFormat,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logRotate') && {
-        rotate: Configuration.getConfigurationData()?.logRotate
+        rotate: Configuration.getConfigurationData()?.logRotate,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logMaxFiles') && {
-        maxFiles: Configuration.getConfigurationData()?.logMaxFiles
+        maxFiles: Configuration.getConfigurationData()?.logMaxFiles,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'logMaxSize') && {
-        maxSize: Configuration.getConfigurationData()?.logMaxSize
-      })
+        maxSize: Configuration.getConfigurationData()?.logMaxSize,
+      }),
     }
     const logConfiguration: LogConfiguration = {
       ...defaultLogConfiguration,
       ...deprecatedLogConfiguration,
       ...(hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.log) &&
-        Configuration.getConfigurationData()?.log)
+        Configuration.getConfigurationData()?.log),
     }
     return logConfiguration
   }
@@ -310,26 +310,26 @@ export class Configuration {
   private static buildWorkerSection (): WorkerConfiguration {
     const deprecatedWorkerConfiguration: WorkerConfiguration = {
       ...(hasOwnProp(Configuration.getConfigurationData(), 'workerProcess') && {
-        processType: Configuration.getConfigurationData()?.workerProcess
+        processType: Configuration.getConfigurationData()?.workerProcess,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'workerStartDelay') && {
-        startDelay: Configuration.getConfigurationData()?.workerStartDelay
+        startDelay: Configuration.getConfigurationData()?.workerStartDelay,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'chargingStationsPerWorker') && {
-        elementsPerWorker: Configuration.getConfigurationData()?.chargingStationsPerWorker
+        elementsPerWorker: Configuration.getConfigurationData()?.chargingStationsPerWorker,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'elementAddDelay') && {
-        elementAddDelay: Configuration.getConfigurationData()?.elementAddDelay
+        elementAddDelay: Configuration.getConfigurationData()?.elementAddDelay,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData()?.worker, 'elementStartDelay') && {
-        elementAddDelay: Configuration.getConfigurationData()?.worker?.elementStartDelay
+        elementAddDelay: Configuration.getConfigurationData()?.worker?.elementStartDelay,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'workerPoolMinSize') && {
-        poolMinSize: Configuration.getConfigurationData()?.workerPoolMinSize
+        poolMinSize: Configuration.getConfigurationData()?.workerPoolMinSize,
       }),
       ...(hasOwnProp(Configuration.getConfigurationData(), 'workerPoolMaxSize') && {
-        poolMaxSize: Configuration.getConfigurationData()?.workerPoolMaxSize
-      })
+        poolMaxSize: Configuration.getConfigurationData()?.workerPoolMaxSize,
+      }),
     }
     hasOwnProp(Configuration.getConfigurationData(), 'workerPoolStrategy') &&
       delete Configuration.getConfigurationData()?.workerPoolStrategy
@@ -337,7 +337,7 @@ export class Configuration {
       ...defaultWorkerConfiguration,
       ...deprecatedWorkerConfiguration,
       ...(hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.worker) &&
-        Configuration.getConfigurationData()?.worker)
+        Configuration.getConfigurationData()?.worker),
     }
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     checkWorkerProcessType(workerConfiguration.processType!)
@@ -379,7 +379,6 @@ export class Configuration {
         ] as StationTemplateUrl[])
     Configuration.getConfigurationData()?.stationTemplateUrls.forEach(
       (stationTemplateUrl: StationTemplateUrl) => {
-        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
         if (stationTemplateUrl['numberOfStation' as keyof StationTemplateUrl] != null) {
           console.error(
             `${chalk.green(logPrefix())} ${chalk.red(
@@ -613,6 +612,7 @@ export class Configuration {
           const consoleWarnOnce = once(console.warn)
           consoleWarnOnce(
             `${chalk.green(logPrefix())} ${chalk.yellow(
+              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
               `${FileType.Configuration} ${this.configurationFile} file have changed, reload`
             )}`
           )
@@ -620,12 +620,12 @@ export class Configuration {
           Configuration.configurationSectionCache.clear()
           if (Configuration.configurationChangeCallback != null) {
             Configuration.configurationChangeCallback()
-              .catch((error: unknown) => {
-                throw typeof error === 'string' ? new Error(error) : error
-              })
               .finally(() => {
                 Configuration.configurationFileReloading = false
               })
+              .catch((error: unknown) => {
+                throw typeof error === 'string' ? new Error(error) : error
+              })
           } else {
             Configuration.configurationFileReloading = false
           }
index 2a85bb0e2fd5686b603bf9a405181c3bc13f1b64..22631d9548c00a84da78d9e9c11a2927e68c9bab 100644 (file)
@@ -77,12 +77,13 @@ export const checkWorkerElementsPerWorker = (
     !Number.isSafeInteger(elementsPerWorker)
   ) {
     throw new SyntaxError(
-      `Invalid number of elements per worker '${elementsPerWorker}' defined in configuration`
+      `Invalid number of elements per worker '${elementsPerWorker.toString()}' defined in configuration`
     )
   }
   if (Number.isSafeInteger(elementsPerWorker) && (elementsPerWorker as number) <= 0) {
     throw RangeError(
-      `Invalid negative or zero number of elements per worker '${elementsPerWorker}' defined in configuration`
+      // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+      `Invalid negative or zero number of elements per worker '${elementsPerWorker?.toString()}' defined in configuration`
     )
   }
 }
index 2d66659889e3a5418d083b9b60b7cdeb8960a18c..c770c5263d46ba569000d72568081538fbb7bee7 100644 (file)
@@ -5,7 +5,7 @@ import {
   type IncomingRequestCommand,
   OCPPVersion,
   type RequestCommand,
-  VendorParametersKey
+  VendorParametersKey,
 } from '../types/index.js'
 
 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
@@ -36,9 +36,9 @@ export class Constants {
     firmwareVersionPattern: Constants.SEMVER_PATTERN,
     firmwareUpgrade: {
       versionUpgrade: {
-        step: 1
+        step: 1,
       },
-      reset: true
+      reset: true,
     },
     ocppPersistentConfiguration: true,
     stationInfoPersistentConfiguration: true,
@@ -47,7 +47,7 @@ export class Constants {
     autoReconnectMaxRetries: -1,
     registrationMaxRetries: -1,
     reconnectExponentialDelay: false,
-    stopTransactionsOnStopped: true
+    stopTransactionsOnStopped: true,
   })
 
   static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000 // Ms
@@ -64,7 +64,7 @@ export class Constants {
       maxDelayBetweenTwoTransactions: 30,
       probabilityOfStart: 1,
       stopAfterHours: 0.25,
-      stopAbsoluteDuration: false
+      stopAbsoluteDuration: false,
     })
 
   static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 386
index fcbf92b272772cac2aa8ca6fd3ec51598c2a8620..5bc2cae33fcdf5cf06ee4bfedfdd19e3589db27a 100644 (file)
@@ -11,7 +11,7 @@ import type {
   IncomingRequestCommand,
   JsonType,
   MessageType,
-  RequestCommand
+  RequestCommand,
 } from '../types/index.js'
 import { logger } from './Logger.js'
 import { isNotEmptyString } from './Utils.js'
@@ -40,9 +40,9 @@ export const handleFileException = (
   params = {
     ...{
       throwError: true,
-      consoleOut: false
+      consoleOut: false,
     },
-    ...params
+    ...params,
   }
   const prefix = isNotEmptyString(logPrefix) ? `${logPrefix} ` : ''
   let logMsg: string
@@ -91,9 +91,9 @@ export const handleSendMessageError = (
   params = {
     ...{
       throwError: false,
-      consoleOut: false
+      consoleOut: false,
     },
-    ...params
+    ...params,
   }
   logger.error(
     `${chargingStation.logPrefix()} ${moduleName}.handleSendMessageError: Send ${getMessageTypeString(messageType)} command '${commandName}' error:`,
@@ -113,9 +113,9 @@ export const handleIncomingRequestError = <T extends JsonType>(
   params = {
     ...{
       throwError: true,
-      consoleOut: false
+      consoleOut: false,
     },
-    ...params
+    ...params,
   }
   logger.error(
     `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command '${commandName}' error:`,
index 543a2b23c2eda50f157680f15377ee335ec697da..10e04df61a9223678d697fdb1cd39b1249a46fc7 100644 (file)
@@ -18,7 +18,7 @@ export const watchJsonFile = <T extends JsonType>(
           (refreshedVariable = JSON.parse(readFileSync(file, 'utf8')) as T)
       } catch (error) {
         handleFileException(file, fileType, error as NodeJS.ErrnoException, logPrefix, {
-          throwError: false
+          throwError: false,
         })
       }
     }
@@ -29,7 +29,7 @@ export const watchJsonFile = <T extends JsonType>(
       return watch(file, listener)
     } catch (error) {
       handleFileException(file, fileType, error as NodeJS.ErrnoException, logPrefix, {
-        throwError: false
+        throwError: false,
       })
     }
   } else {
index b13ec0477ab9314aca3859f264e62c40ae531929..c6d88c491b87b140d09e10fdc64d3d1945479860 100644 (file)
@@ -25,24 +25,24 @@ if (logConfiguration.rotate === true) {
       ),
       level: 'error',
       ...(logMaxFiles != null && { maxFiles: logMaxFiles }),
-      ...(logMaxSize != null && { maxSize: logMaxSize })
+      ...(logMaxSize != null && { maxSize: logMaxSize }),
     }),
     new DailyRotateFile({
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       filename: insertAt(logConfiguration.file!, '-%DATE%', logConfiguration.file!.indexOf('.log')),
       ...(logMaxFiles != null && { maxFiles: logMaxFiles }),
-      ...(logMaxSize != null && { maxSize: logMaxSize })
-    })
+      ...(logMaxSize != null && { maxSize: logMaxSize }),
+    }),
   ]
 } else {
   transports = [
     new TransportType.File({
       filename: logConfiguration.errorFile,
-      level: 'error'
+      level: 'error',
     }),
     new TransportType.File({
-      filename: logConfiguration.file
-    })
+      filename: logConfiguration.file,
+    }),
   ]
 }
 
@@ -54,7 +54,7 @@ export const logger = createLogger({
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     (format[logConfiguration.format! as keyof FormatWrap] as FormatWrap)()
   ),
-  transports
+  transports,
 })
 
 //
@@ -68,7 +68,7 @@ if (logConfiguration.console === true) {
         format.splat(),
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         (format[logConfiguration.format! as keyof FormatWrap] as FormatWrap)()
-      )
+      ),
     })
   )
 }
index f9d1e14980017606a7c1f64ec0135eb47bf8e80b..6b79957e1db0860bf654f393ea33b5d57ec82b73 100644 (file)
@@ -6,13 +6,13 @@ import {
   type ChargingStationWorkerMessage,
   ChargingStationWorkerMessageEvents,
   type Statistics,
-  type TimestampedData
+  type TimestampedData,
 } from '../types/index.js'
 import {
   buildChargingStationAutomaticTransactionGeneratorConfiguration,
   buildConnectorsStatus,
   buildEvsesStatus,
-  OutputFormat
+  OutputFormat,
 } from './ChargingStationConfigurationUtils.js'
 
 export const buildAddedMessage = (
@@ -20,7 +20,7 @@ export const buildAddedMessage = (
 ): ChargingStationWorkerMessage<ChargingStationData> => {
   return {
     event: ChargingStationWorkerMessageEvents.added,
-    data: buildChargingStationDataPayload(chargingStation)
+    data: buildChargingStationDataPayload(chargingStation),
   }
 }
 
@@ -29,7 +29,7 @@ export const buildDeletedMessage = (
 ): ChargingStationWorkerMessage<ChargingStationData> => {
   return {
     event: ChargingStationWorkerMessageEvents.deleted,
-    data: buildChargingStationDataPayload(chargingStation)
+    data: buildChargingStationDataPayload(chargingStation),
   }
 }
 
@@ -38,7 +38,7 @@ export const buildStartedMessage = (
 ): ChargingStationWorkerMessage<ChargingStationData> => {
   return {
     event: ChargingStationWorkerMessageEvents.started,
-    data: buildChargingStationDataPayload(chargingStation)
+    data: buildChargingStationDataPayload(chargingStation),
   }
 }
 
@@ -47,7 +47,7 @@ export const buildStoppedMessage = (
 ): ChargingStationWorkerMessage<ChargingStationData> => {
   return {
     event: ChargingStationWorkerMessageEvents.stopped,
-    data: buildChargingStationDataPayload(chargingStation)
+    data: buildChargingStationDataPayload(chargingStation),
   }
 }
 
@@ -56,7 +56,7 @@ export const buildUpdatedMessage = (
 ): ChargingStationWorkerMessage<ChargingStationData> => {
   return {
     event: ChargingStationWorkerMessageEvents.updated,
-    data: buildChargingStationDataPayload(chargingStation)
+    data: buildChargingStationDataPayload(chargingStation),
   }
 }
 
@@ -77,8 +77,8 @@ export const buildPerformanceStatisticsMessage = (
       uri: statistics.uri,
       createdAt: statistics.createdAt,
       updatedAt: statistics.updatedAt,
-      statisticsData
-    }
+      statisticsData,
+    },
   }
 }
 
@@ -96,7 +96,7 @@ const buildChargingStationDataPayload = (chargingStation: ChargingStation): Char
     bootNotificationResponse: chargingStation.bootNotificationResponse,
     ...(chargingStation.automaticTransactionGenerator != null && {
       automaticTransactionGenerator:
-        buildChargingStationAutomaticTransactionGeneratorConfiguration(chargingStation)
-    })
+        buildChargingStationAutomaticTransactionGeneratorConfiguration(chargingStation),
+    }),
   }
 }
index 501dea7797ec30ecc469604ed1e93697551ad095..7f0784bd63dbd9576bdb15a9afbab38658248177 100644 (file)
@@ -35,7 +35,6 @@ export const nthPercentile = (dataSet: number[], percentile: number): number =>
 
 /**
  * Computes the sample standard deviation of the given data set.
- *
  * @param dataSet - Data set.
  * @param dataSetAverage - Average of the data set.
  * @returns The sample standard deviation of the given data set.
index 9a06c64ed5658e01e7409bb38ae95baaba61be5c..95a1430c2cea9754f8e5a2ad3b167b300563b0c3 100644 (file)
@@ -10,7 +10,7 @@ import {
   millisecondsToMinutes,
   millisecondsToSeconds,
   minutesToSeconds,
-  secondsToMilliseconds
+  secondsToMilliseconds,
 } from 'date-fns'
 import type { CircularBuffer } from 'mnemonist'
 import { is } from 'rambda'
@@ -19,7 +19,7 @@ import {
   type JsonType,
   MapStringifyFormat,
   type TimestampedData,
-  WebSocketCloseEventStatusString
+  WebSocketCloseEventStatusString,
 } from '../types/index.js'
 
 export const logPrefix = (prefixString = ''): string => {
@@ -65,7 +65,7 @@ export const formatDurationMilliSeconds = (duration: number): string => {
     days,
     hours,
     minutes,
-    seconds
+    seconds,
   })
 }
 
@@ -95,7 +95,7 @@ export const convertToDate = (
   if (typeof value === 'string' || typeof value === 'number') {
     const valueToDate = new Date(value)
     if (isNaN(valueToDate.getTime())) {
-      throw new Error(`Cannot convert to date: '${value}'`)
+      throw new Error(`Cannot convert to date: '${value.toString()}'`)
     }
     return valueToDate
   }
@@ -163,7 +163,6 @@ export const getRandomFloat = (max = Number.MAX_VALUE, min = 0): number => {
 /**
  * Rounds the given number to the given scale.
  * The rounding is done using the "round half away from zero" method.
- *
  * @param numberValue - The number to round.
  * @param scale - The scale to round to.
  * @returns The rounded number.
@@ -187,7 +186,7 @@ export const getRandomFloatFluctuatedRounded = (
 ): number => {
   if (fluctuationPercent < 0 || fluctuationPercent > 100) {
     throw new RangeError(
-      `Fluctuation percent must be between 0 and 100. Actual value: ${fluctuationPercent}`
+      `Fluctuation percent must be between 0 and 100. Actual value: ${fluctuationPercent.toString()}`
     )
   }
   if (fluctuationPercent === 0) {
@@ -211,7 +210,6 @@ export const clone = <T>(object: T): T => {
 
 /**
  * Detects whether the given value is an asynchronous function or not.
- *
  * @param fn - Unknown value.
  * @returns `true` if `fn` was an asynchronous function, otherwise `false`.
  * @internal
@@ -245,7 +243,6 @@ export const insertAt = (str: string, subStr: string, pos: number): string =>
 
 /**
  * Computes the retry delay in milliseconds using an exponential backoff algorithm.
- *
  * @param retryNumber - the number of retries that have already been attempted
  * @param delayFactor - the base delay factor in milliseconds
  * @returns delay in milliseconds
@@ -258,7 +255,6 @@ export const exponentialDelay = (retryNumber = 0, delayFactor = 100): number =>
 
 /**
  * Generates a cryptographically secure random number in the [0,1[ range
- *
  * @returns A number in the [0,1[ range
  */
 export const secureRandom = (): number => {
@@ -267,10 +263,10 @@ export const secureRandom = (): number => {
 
 export const JSONStringify = <
   T extends
-  | JsonType
-  | Array<Record<string, unknown>>
-  | Set<Record<string, unknown>>
-  | Map<string, Record<string, unknown>>
+    | JsonType
+    | Record<string, unknown>[]
+    | Set<Record<string, unknown>>
+    | Map<string, Record<string, unknown>>
 >(
     object: T,
     space?: string | number,
@@ -283,14 +279,14 @@ export const JSONStringify = <
         switch (mapFormat) {
           case MapStringifyFormat.object:
             return {
-              ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries())
+              ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries()),
             }
           case MapStringifyFormat.array:
           default:
             return [...value]
         }
       } else if (is(Set, value)) {
-        return [...value] as JsonType[]
+        return [...value]
       }
       return value
     },
@@ -300,7 +296,6 @@ export const JSONStringify = <
 
 /**
  * Converts websocket error code to human readable string message
- *
  * @param code - websocket error code
  * @returns human readable string message
  */
index d6efcdc7d17111df6b2897e2866144c3f81341c5..c36574020949b4e2f9a66f10cf6acd3b34b99531 100644 (file)
@@ -3,7 +3,7 @@ export {
   buildChargingStationAutomaticTransactionGeneratorConfiguration,
   buildConnectorsStatus,
   buildEvsesStatus,
-  OutputFormat
+  OutputFormat,
 } from './ChargingStationConfigurationUtils.js'
 export { Configuration } from './Configuration.js'
 export { Constants } from './Constants.js'
@@ -13,7 +13,7 @@ export {
   handleIncomingRequestError,
   handleSendMessageError,
   handleUncaughtException,
-  handleUnhandledRejection
+  handleUnhandledRejection,
 } from './ErrorUtils.js'
 export { watchJsonFile } from './FileUtils.js'
 export { logger } from './Logger.js'
@@ -23,7 +23,7 @@ export {
   buildPerformanceStatisticsMessage,
   buildStartedMessage,
   buildStoppedMessage,
-  buildUpdatedMessage
+  buildUpdatedMessage,
 } from './MessageChannelUtils.js'
 export { max, min, nthPercentile, stdDeviation } from './StatisticUtils.js'
 export {
@@ -50,5 +50,5 @@ export {
   roundTo,
   secureRandom,
   sleep,
-  validateUUID
+  validateUUID,
 } from './Utils.js'
index f6713f8976d2cdda47d74f5951880f8d1fdfd48d..f6f982f30f58b5c1389400d41cf0234d0a6770a4 100644 (file)
@@ -15,7 +15,6 @@ export abstract class WorkerAbstract<D extends WorkerData, R extends WorkerData>
 
   /**
    * `WorkerAbstract` constructor.
-   *
    * @param workerScript -
    * @param workerOptions -
    */
@@ -46,7 +45,6 @@ export abstract class WorkerAbstract<D extends WorkerData, R extends WorkerData>
   public abstract stop (): Promise<void>
   /**
    * Adds a task element to the worker pool/set.
-   *
    * @param elementData -
    */
   public abstract addElement (elementData: D): Promise<R>
index ded5c89142f8e2aa9f485ed9df6ea476a7832100..5a8dc13aad9d36beda820fda10a40428fc70c31e 100644 (file)
@@ -26,6 +26,6 @@ export const DEFAULT_WORKER_OPTIONS: WorkerOptions = Object.freeze({
     enableEvents: true,
     restartWorkerOnError: true,
     errorHandler: defaultErrorHandler,
-    exitHandler: defaultExitHandler
-  }
+    exitHandler: defaultExitHandler,
+  },
 })
index 5217d7fe16a6772a81b946969702fe1189f0d5dc..f412f081e5920d0f8021938764cf9dcf4d9b9143 100644 (file)
@@ -7,14 +7,13 @@ import type { WorkerData, WorkerOptions } from './WorkerTypes.js'
 import { randomizeDelay, sleep } from './WorkerUtils.js'
 
 export class WorkerDynamicPool<D extends WorkerData, R extends WorkerData> extends WorkerAbstract<
-D,
-R
+  D,
+  R
 > {
   private readonly pool: DynamicThreadPool<D, R>
 
   /**
    * Creates a new `WorkerDynamicPool`.
-   *
    * @param workerScript -
    * @param workerOptions -
    */
index 96060854743112a438dc408dcc8285842e1bbd19..29755fedddd92ba50dbfa06ad03e77742a911c75 100644 (file)
@@ -7,14 +7,13 @@ import type { WorkerData, WorkerOptions } from './WorkerTypes.js'
 import { randomizeDelay, sleep } from './WorkerUtils.js'
 
 export class WorkerFixedPool<D extends WorkerData, R extends WorkerData> extends WorkerAbstract<
-D,
-R
+  D,
+  R
 > {
   private readonly pool: FixedThreadPool<D, R>
 
   /**
    * Creates a new `WorkerFixedPool`.
-   *
    * @param workerScript -
    * @param workerOptions -
    */
index 1774c24a4f17585e8ce1c6dd4bbcef1c109a5fee..2fd637149bcdbcd4d4ab33f843500cef5f335f9f 100644 (file)
@@ -13,7 +13,7 @@ import {
   WorkerMessageEvents,
   type WorkerOptions,
   type WorkerSetElement,
-  WorkerSetEvents
+  WorkerSetEvents,
 } from './WorkerTypes.js'
 import { randomizeDelay, sleep } from './WorkerUtils.js'
 
@@ -28,7 +28,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
   private readonly workerSet: Set<WorkerSetElement>
   private readonly promiseResponseMap: Map<
     `${string}-${string}-${string}-${string}`,
-  ResponseWrapper<R>
+    ResponseWrapper<R>
   >
 
   private started: boolean
@@ -36,7 +36,6 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
 
   /**
    * Creates a new `WorkerSet`.
-   *
    * @param workerScript -
    * @param workerOptions -
    */
@@ -54,7 +53,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
     this.workerSet = new Set<WorkerSetElement>()
     this.promiseResponseMap = new Map<
       `${string}-${string}-${string}-${string}`,
-    ResponseWrapper<R>
+      ResponseWrapper<R>
     >()
     if (this.workerOptions.poolOptions?.enableEvents === true) {
       this.emitter = new EventEmitterAsyncResource({ name: 'workerset' })
@@ -75,7 +74,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
         0
       ),
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      elementsPerWorker: this.maxElementsPerWorker!
+      elementsPerWorker: this.maxElementsPerWorker!,
     }
   }
 
@@ -127,13 +126,13 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
       const message = {
         uuid: randomUUID(),
         event: WorkerMessageEvents.addWorkerElement,
-        data: elementData
+        data: elementData,
       } satisfies WorkerMessage<D>
       workerSetElement.worker.postMessage(message)
       this.promiseResponseMap.set(message.uuid, {
         resolve,
         reject,
-        workerSetElement
+        workerSetElement,
       })
     })
     const response = await sendMessageToWorker
@@ -148,12 +147,13 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
 
   /**
    * Adds a new `WorkerSetElement`.
+   * @returns The new `WorkerSetElement`.
    */
   private addWorkerSetElement (): WorkerSetElement {
     this.workerStartup = true
     const worker = new Worker(this.workerScript, {
       env: SHARE_ENV,
-      ...this.workerOptions.poolOptions?.workerOptions
+      ...this.workerOptions.poolOptions?.workerOptions,
     })
     worker.on('message', this.workerOptions.poolOptions?.messageHandler ?? EMPTY_FUNCTION)
     worker.on('message', (message: WorkerMessage<R>) => {
@@ -196,6 +196,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
         this.addWorkerSetElement()
       }
       worker.unref()
+      // eslint-disable-next-line promise/no-promise-in-callback
       worker.terminate().catch((error: unknown) => this.emitter?.emit(WorkerSetEvents.error, error))
     })
     worker.on('online', this.workerOptions.poolOptions?.onlineHandler ?? EMPTY_FUNCTION)
@@ -205,7 +206,7 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
     })
     const workerSetElement: WorkerSetElement = {
       worker,
-      numberOfWorkerElements: 0
+      numberOfWorkerElements: 0,
     }
     this.workerSet.add(workerSetElement)
     this.workerStartup = false
index b180983e8a9594c3e1308fa12679a4fc2cfd4493..6ca9140b2abe65a74bd55cd784fbb56991aeba28 100644 (file)
@@ -29,7 +29,7 @@ export enum WorkerSetEvents {
 
 export const WorkerEvents = {
   ...PoolEvents,
-  ...WorkerSetEvents
+  ...WorkerSetEvents,
 } as const
 // eslint-disable-next-line @typescript-eslint/no-redeclare
 export type WorkerEvents = PoolEvent | WorkerSetEvents
index f36c6046d626d5d4850f1b75dca253edae043b15..8fad34a228296dc1abcd546b7a02171081c33177 100644 (file)
@@ -31,7 +31,6 @@ export const randomizeDelay = (delay: number): number => {
 
 /**
  * Generates a cryptographically secure random number in the [0,1[ range
- *
  * @returns A number in the [0,1[ range
  * @internal
  */
index 190a6a41034d2738ef9b5e434cec82dc29917619..32368203c86c302c24dffa1e5b41f640f3998321 100644 (file)
@@ -4,7 +4,7 @@ export {
   DEFAULT_ELEMENTS_PER_WORKER,
   DEFAULT_POOL_MAX_SIZE,
   DEFAULT_POOL_MIN_SIZE,
-  DEFAULT_WORKER_START_DELAY
+  DEFAULT_WORKER_START_DELAY,
 } from './WorkerConstants.js'
 export { WorkerFactory } from './WorkerFactory.js'
 export {
@@ -13,5 +13,5 @@ export {
   WorkerEvents,
   type WorkerMessage,
   WorkerMessageEvents,
-  WorkerProcessType
+  WorkerProcessType,
 } from './WorkerTypes.js'
index cb5ca2eae3e69b185aa2ea2b3930c5ca0cb06ae3..f564a702b5eebad95f6a30feee3f7ed782aec870 100644 (file)
@@ -5,7 +5,7 @@ import { expect } from 'expect'
 import {
   ApplicationProtocolVersion,
   ConfigurationSection,
-  SupervisionUrlDistribution
+  SupervisionUrlDistribution,
 } from '../../src/types/ConfigurationData.js'
 
 await describe('ConfigurationData test suite', async () => {
index 7bbf4db2d700dc0b7effac670eb4e14668e598b1..1163211f3fac51e61ffe19a4dcc3c528b7deea1b 100644 (file)
@@ -9,19 +9,18 @@ import {
   GenericStatus,
   IncomingRequestCommand,
   MessageType,
-  RequestCommand
+  RequestCommand,
 } from '../../src/types/index.js'
 import {
   handleFileException,
   handleIncomingRequestError,
-  handleSendMessageError
+  handleSendMessageError,
 } from '../../src/utils/ErrorUtils.js'
 import { logger } from '../../src/utils/Logger.js'
 
 await describe('ErrorUtils test suite', async () => {
-  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
   const chargingStation = {
-    logPrefix: () => 'CS-TEST |'
+    logPrefix: () => 'CS-TEST |',
   } as ChargingStation
 
   await it('Verify handleFileException()', t => {
@@ -36,20 +35,20 @@ await describe('ErrorUtils test suite', async () => {
     }).toThrow(error)
     expect(() => {
       handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix |', {
-        throwError: false
+        throwError: false,
       })
     }).not.toThrow()
     expect(logger.warn.mock.calls.length).toBe(1)
     expect(logger.error.mock.calls.length).toBe(1)
     expect(() => {
       handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix |', {
-        consoleOut: true
+        consoleOut: true,
       })
     }).toThrow(error)
     expect(() => {
       handleFileException('path/to/module.js', FileType.Authorization, error, 'log prefix |', {
         throwError: false,
-        consoleOut: true
+        consoleOut: true,
       })
     }).not.toThrow()
     expect(console.warn.mock.calls.length).toBe(1)
@@ -90,16 +89,16 @@ await describe('ErrorUtils test suite', async () => {
     }).toThrow(error)
     expect(() => {
       handleIncomingRequestError(chargingStation, IncomingRequestCommand.CLEAR_CACHE, error, {
-        throwError: false
+        throwError: false,
       })
     }).not.toThrow()
     const errorResponse = {
-      status: GenericStatus.Rejected
+      status: GenericStatus.Rejected,
     }
     expect(
       handleIncomingRequestError(chargingStation, IncomingRequestCommand.CLEAR_CACHE, error, {
         throwError: false,
-        errorResponse
+        errorResponse,
       })
     ).toStrictEqual(errorResponse)
     expect(chargingStation.logPrefix.mock.calls.length).toBe(3)
index 9637858c70448f80d8734e570c8211f2e8f2b6a9..d7ab58f39ade182f6ae004799d63779122e51ced 100644 (file)
@@ -31,7 +31,7 @@ import {
   roundTo,
   secureRandom,
   sleep,
-  validateUUID
+  validateUUID,
 } from '../../src/utils/Utils.js'
 import { runtime, runtimes } from '../../utils/runtime.js'
 
@@ -233,7 +233,6 @@ await describe('Utils test suite', async () => {
     expect(isAsyncFunction('')).toBe(false)
     expect(isAsyncFunction([])).toBe(false)
     expect(isAsyncFunction(new Date())).toBe(false)
-    // eslint-disable-next-line prefer-regex-literals
     expect(isAsyncFunction(/[a-z]/i)).toBe(false)
     expect(isAsyncFunction(new Error())).toBe(false)
     expect(isAsyncFunction(new Map())).toBe(false)
index ae52ed62174be72c4b40a928f0b8af2536ce0b86..d32efe7f66b980569c5de69e5d8d7c5e943ef62f 100644 (file)
@@ -3,7 +3,7 @@ export const runtimes = {
   deno: 'deno',
   node: 'node',
   workerd: 'workerd',
-  browser: 'browser'
+  browser: 'browser',
 }
 
 const isBun = !!globalThis.Bun || !!globalThis.process?.versions?.bun