From: Jérôme Benoit Date: Sun, 16 Jul 2023 13:11:28 +0000 (+0200) Subject: build(deps-dev): apply updates X-Git-Tag: v1.2.18~28 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e1d9a0f4d6ff1a90048e9a694fd12b7031cc6961;p=e-mobility-charging-stations-simulator.git build(deps-dev): apply updates Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc.json b/.eslintrc.json index 60c8eb08..2b20e8dd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -142,12 +142,13 @@ "files": ["**/*.ts"], "parser": "@typescript-eslint/parser", "parserOptions": { - "project": "./tsconfig.json" + "project": true, + "tsconfigRootDir": "./" }, "plugins": ["@typescript-eslint", "eslint-plugin-tsdoc"], "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", "plugin:import/typescript" ], "rules": { diff --git a/CLONE.md b/CLONE.md index 8f899a06..3a54121b 100644 --- a/CLONE.md +++ b/CLONE.md @@ -1,13 +1,15 @@ +**Markdown** - - **Markdown** - - ```markdown +```markdown [![GitHub Clones](https://img.shields.io/badge/dynamic/json?color=success&label=Clone&query=count&url=https://gist.githubusercontent.com/jerome-benoit/c7c669b881d5b27dc0b44a639504ff93/raw/clone.json&logo=github)](https://github.com/MShawon/github-clone-count-badge) +``` - ``` +**HTML** - **HTML** - ```html -GitHub Clones +```html +GitHub Clones ``` diff --git a/README.md b/README.md index b2a9a633..60c744ec 100644 --- a/README.md +++ b/README.md @@ -393,7 +393,7 @@ make SUBMODULES_INIT=true #### Smart Charging Profile - :white_check_mark: ClearChargingProfile -- :x: GetCompositeSchedule +- :white_check_mark: GetCompositeSchedule - :white_check_mark: SetChargingProfile #### Remote Trigger Profile diff --git a/package.json b/package.json index 2a6efb77..b823ba64 100644 --- a/package.json +++ b/package.json @@ -137,8 +137,8 @@ "@types/sinon": "^10.0.15", "@types/tar": "^6.1.5", "@types/ws": "^8.5.5", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "@web/rollup-plugin-copy": "^0.4.0", "auto-changelog": "^2.4.0", "c8": "^8.0.0", @@ -148,7 +148,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsdoc": "^46.4.3", + "eslint-plugin-jsdoc": "^46.4.4", "eslint-plugin-n": "^16.0.1", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-tsdoc": "^0.2.17", @@ -158,7 +158,7 @@ "mocha": "^10.2.0", "mochawesome": "^7.1.3", "prettier": "^3.0.0", - "release-it": "^16.1.0", + "release-it": "^16.1.2", "rimraf": "^5.0.1", "robohydra": "^0.6.9", "rollup": "^3.26.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 313aff56..214b3c10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,7 +99,7 @@ devDependencies: version: 5.7.12(@mikro-orm/mariadb@5.7.12)(@mikro-orm/sqlite@5.7.12) '@release-it/bumper': specifier: ^5.0.0 - version: 5.0.0(release-it@16.1.0) + version: 5.0.0(release-it@16.1.2) '@rollup/plugin-json': specifier: ^6.0.0 version: 6.0.0(rollup@3.26.2) @@ -128,11 +128,11 @@ devDependencies: specifier: ^8.5.5 version: 8.5.5 '@typescript-eslint/eslint-plugin': - specifier: ^5.62.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.45.0)(typescript@5.1.6) + specifier: ^6.0.0 + version: 6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.45.0)(typescript@5.1.6) '@typescript-eslint/parser': - specifier: ^5.62.0 - version: 5.62.0(eslint@8.45.0)(typescript@5.1.6) + specifier: ^6.0.0 + version: 6.0.0(eslint@8.45.0)(typescript@5.1.6) '@web/rollup-plugin-copy': specifier: ^0.4.0 version: 0.4.0 @@ -156,13 +156,13 @@ devDependencies: version: 8.8.0(eslint@8.45.0) eslint-import-resolver-typescript: specifier: ^3.5.5 - version: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) + version: 3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) eslint-plugin-import: specifier: ^2.27.5 - version: 2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + version: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) eslint-plugin-jsdoc: - specifier: ^46.4.3 - version: 46.4.3(eslint@8.45.0) + specifier: ^46.4.4 + version: 46.4.4(eslint@8.45.0) eslint-plugin-n: specifier: ^16.0.1 version: 16.0.1(eslint@8.45.0) @@ -191,8 +191,8 @@ devDependencies: specifier: ^3.0.0 version: 3.0.0 release-it: - specifier: ^16.1.0 - version: 16.1.0 + specifier: ^16.1.2 + version: 16.1.2 rimraf: specifier: ^5.0.1 version: 5.0.1 @@ -1246,7 +1246,7 @@ packages: config-chain: 1.1.13 dev: true - /@release-it/bumper@5.0.0(release-it@16.1.0): + /@release-it/bumper@5.0.0(release-it@16.1.2): resolution: {integrity: sha512-s5DNaLhM177WSaV8GtHTKbEmkKmszsqChktFUVpAmoLDlUW4WmXq/S92DSfC9BHdM7SFhVTHsjgZBYReRpp3zw==} engines: {node: '>=16'} peerDependencies: @@ -1260,7 +1260,7 @@ packages: lodash.castarray: 4.4.0 lodash.get: 4.4.2 lodash.set: 4.3.2 - release-it: 16.1.0 + release-it: 16.1.2 semver: 7.5.4 dev: true @@ -1331,8 +1331,8 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@sindresorhus/is@5.4.1: - resolution: {integrity: sha512-axlrvsHlHlFmKKMEg4VyvMzFr93JWJj4eIfXY1STVuO2fsImCa7ncaiG5gC8HKOX590AW5RtRsC41/B+OfrSqw==} + /@sindresorhus/is@5.5.0: + resolution: {integrity: sha512-3rO1QIz6mL0MvFVTOxqhDJRVsLfG/vK2VSlKKPghALA6FhJqU7L+RUHnFvH5BP5HhkWiMQqq514i9ZFTcqoGCQ==} engines: {node: '>=14.16'} dev: true @@ -1572,47 +1572,51 @@ packages: '@types/yargs-parser': 21.0.0 dev: true - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/eslint-plugin@6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - '@typescript-eslint/parser': ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.62.0(eslint@8.45.0)(typescript@5.1.6) - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.45.0)(typescript@5.1.6) - '@typescript-eslint/utils': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/type-utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.0.0 debug: 4.3.4(supports-color@8.1.1) eslint: 8.45.0 + grapheme-splitter: 1.0.4 graphemer: 1.4.0 ignore: 5.2.4 + natural-compare: 1.4.0 natural-compare-lite: 1.4.0 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.1.6) + ts-api-utils: 1.0.1(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/parser@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.0.0 debug: 4.3.4(supports-color@8.1.1) eslint: 8.45.0 typescript: 5.1.6 @@ -1620,72 +1624,72 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@5.62.0: - resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/scope-manager@6.0.0: + resolution: {integrity: sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==} + engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 dev: true - /@typescript-eslint/type-utils@5.62.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/type-utils@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: '*' + eslint: ^7.0.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) - '@typescript-eslint/utils': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) + '@typescript-eslint/utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) debug: 4.3.4(supports-color@8.1.1) eslint: 8.45.0 - tsutils: 3.21.0(typescript@5.1.6) + ts-api-utils: 1.0.1(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@5.62.0: - resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/types@6.0.0: + resolution: {integrity: sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==} + engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@5.62.0(typescript@5.1.6): - resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/typescript-estree@6.0.0(typescript@5.1.6): + resolution: {integrity: sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.1.6) + ts-api-utils: 1.0.1(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/utils@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + eslint: ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.45.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) eslint: 8.45.0 eslint-scope: 5.1.1 semver: 7.5.4 @@ -1694,11 +1698,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@5.62.0: - resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/visitor-keys@6.0.0: + resolution: {integrity: sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==} + engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/types': 6.0.0 eslint-visitor-keys: 3.4.1 dev: true @@ -1979,7 +1983,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 get-intrinsic: 1.2.1 is-string: 1.0.7 dev: true @@ -1994,7 +1998,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 es-shim-unscopables: 1.0.0 dev: true @@ -2004,7 +2008,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 es-shim-unscopables: 1.0.0 dev: true @@ -2014,11 +2018,23 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 es-array-method-boxes-properly: 1.0.0 is-string: 1.0.7 dev: true + /arraybuffer.prototype.slice@1.0.1: + resolution: {integrity: sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.2 + define-properties: 1.2.0 + get-intrinsic: 1.2.1 + is-array-buffer: 3.0.2 + is-shared-array-buffer: 1.0.2 + dev: true + /arrify@1.0.1: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} @@ -3721,11 +3737,12 @@ packages: is-arrayish: 0.2.1 dev: true - /es-abstract@1.21.3: - resolution: {integrity: sha512-ZU4miiY1j3sGPFLJ34VJXEqhpmL+HGByCinGHv4HC+Fxl2fI2Z4yR6tl0mORnDr6PA8eihWo4LmSWDbvhALckg==} + /es-abstract@1.22.1: + resolution: {integrity: sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==} engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.1 available-typed-arrays: 1.0.5 call-bind: 1.0.2 es-set-tostringtag: 2.0.1 @@ -3752,10 +3769,13 @@ packages: object-keys: 1.1.1 object.assign: 4.1.4 regexp.prototype.flags: 1.5.0 + safe-array-concat: 1.0.0 safe-regex-test: 1.0.0 string.prototype.trim: 1.2.7 string.prototype.trimend: 1.0.6 string.prototype.trimstart: 1.0.6 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 typed-array-byte-offset: 1.0.0 typed-array-length: 1.0.4 unbox-primitive: 1.0.2 @@ -3922,7 +3942,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0): + /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0): resolution: {integrity: sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -3932,8 +3952,8 @@ packages: debug: 4.3.4(supports-color@8.1.1) enhanced-resolve: 5.15.0 eslint: 8.45.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) get-tsconfig: 4.6.2 globby: 13.2.2 is-core-module: 2.12.1 @@ -3946,7 +3966,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -3967,11 +3987,11 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) debug: 3.2.7 eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) transitivePeerDependencies: - supports-color dev: true @@ -3987,7 +4007,7 @@ packages: eslint: 8.45.0 dev: true - /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): + /eslint-plugin-import@2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -3997,7 +4017,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -4005,7 +4025,7 @@ packages: doctrine: 2.1.0 eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) has: 1.0.3 is-core-module: 2.12.1 is-glob: 4.0.3 @@ -4020,8 +4040,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.4.3(eslint@8.45.0): - resolution: {integrity: sha512-Prc7ol+vCIghPeECpwZq5+P+VZfoi87suywvbYCiCnkI1kTmVSdcOC2M8mioglWxBbd28wbb1OVjg/8OzGzatA==} + /eslint-plugin-jsdoc@46.4.4(eslint@8.45.0): + resolution: {integrity: sha512-D8TGPOkq3bnzmYmA7Q6jdsW+Slx7CunhJk1tlouVq6wJjlP1p6eigZPvxFn7aufud/D66xBsNVMhkDQEuqumMg==} engines: {node: '>=16'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -4594,7 +4614,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 functions-have-names: 1.2.3 dev: true @@ -4835,17 +4855,6 @@ packages: merge2: 1.4.1 slash: 3.0.0 - /globby@13.2.1: - resolution: {integrity: sha512-DPCBxctI7dN4EeIqjW2KGqgdcUMbrhJ9AzON+PlxCtvppWhubTLD4+a0GFxiym14ZvacUydTPjLPc2DlKz7EIg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.0 - ignore: 5.2.4 - merge2: 1.4.1 - slash: 4.0.0 - dev: true - /globby@13.2.2: resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -4867,7 +4876,7 @@ packages: resolution: {integrity: sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==} engines: {node: '>=14.16'} dependencies: - '@sindresorhus/is': 5.4.1 + '@sindresorhus/is': 5.5.0 '@szmarczak/http-timer': 5.0.1 cacheable-lookup: 7.0.0 cacheable-request: 10.2.12 @@ -4887,6 +4896,10 @@ packages: /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + /grapheme-splitter@1.0.4: + resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} + dev: true + /graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true @@ -5289,8 +5302,8 @@ packages: through: 2.3.8 dev: true - /inquirer@9.2.7: - resolution: {integrity: sha512-Bf52lnfvNxGPJPltiNO2tLBp3zC339KNlGMqOkW+dsvNikBhcVDK5kqU2lVX2FTPzuXUFX5WJDlsw//w3ZwoTw==} + /inquirer@9.2.8: + resolution: {integrity: sha512-SJ0fVfgIzZL1AD6WvFhivlh5/3hN6WeAvpvPrpPXH/8MOcQHeXhinmSm5CDJNRC2Q+sLh9YJ5k8F8/5APMXSfw==} engines: {node: '>=14.18.0'} dependencies: ansi-escapes: 4.3.2 @@ -7221,7 +7234,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /obliterator@2.0.4: @@ -7754,7 +7767,7 @@ packages: array.prototype.map: 1.0.5 call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 get-intrinsic: 1.2.1 iterate-value: 1.0.2 dev: true @@ -7799,8 +7812,8 @@ packages: resolution: {integrity: sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==} dev: true - /proxy-agent@6.2.1: - resolution: {integrity: sha512-OIbBKlRAT+ycCm6wAYIzMwPejzRtjy8F3QiDX0eKOA3e4pe3U9F/IvzcHP42bmgQxVv97juG+J8/gx+JIeCX/Q==} + /proxy-agent@6.2.2: + resolution: {integrity: sha512-wPQ+zf4bFG3wtqX9L8xNEK6vfOmaZABbpN2NslLLSlbfTKbUL7X1LqwpPVdbsbloAFvtWAmnVhJQ3vkagxKUTA==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -8077,8 +8090,8 @@ packages: resolution: {integrity: sha512-QIRet3SYrGp0HUHO88jVskiG6seqUGC5iAG7AwI/BV4ypGcuqk9Du6YQBUOUqm9c8pw1eyLoIaONifRua1lsEQ==} dev: true - /release-it@16.1.0: - resolution: {integrity: sha512-d2XpGtPAIUoN/v0nJkfdx9GyFkgTXRj+7HATaZRmS+a0IhnE/qRDQ4kMVuDh8UCX1CKV6SRiFdV/vEpKpzZzxA==} + /release-it@16.1.2: + resolution: {integrity: sha512-dRamWBWMLJcsPl0G3M7q/hkwPv4i0buUEKWwNp/MY9mBIBcUmBSCvm4B1CdN28LUgqrBzWVurnnNCcz6IPeQKQ==} engines: {node: '>=16'} hasBin: true dependencies: @@ -8089,9 +8102,9 @@ packages: cosmiconfig: 8.2.0 execa: 7.1.1 git-url-parse: 13.1.0 - globby: 13.2.1 + globby: 13.2.2 got: 12.6.1 - inquirer: 9.2.7 + inquirer: 9.2.8 is-ci: 3.0.1 issue-parser: 6.0.0 lodash: 4.17.21 @@ -8102,7 +8115,7 @@ packages: ora: 6.3.1 os-name: 5.1.0 promise.allsettled: 1.0.6 - proxy-agent: 6.2.1 + proxy-agent: 6.2.2 semver: 7.5.4 shelljs: 0.8.5 update-notifier: 6.0.2 @@ -8341,6 +8354,16 @@ packages: tslib: 2.6.0 dev: true + /safe-array-concat@1.0.0: + resolution: {integrity: sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} dev: true @@ -8883,7 +8906,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /string.prototype.trimend@1.0.6: @@ -8891,7 +8914,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /string.prototype.trimstart@1.0.6: @@ -8899,7 +8922,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /string_decoder@1.1.1: @@ -9222,6 +9245,15 @@ packages: engines: {node: '>= 14.0.0'} dev: false + /ts-api-utils@1.0.1(typescript@5.1.6): + resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} + engines: {node: '>=16.13.0'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.1.6 + dev: true + /ts-morph@18.0.0: resolution: {integrity: sha512-Kg5u0mk19PIIe4islUI/HWRvm9bC1lHejK4S0oh1zaZ77TMZAEmQC0sHQYiu2RgCQFZKXz1fMVi/7nOOeirznA==} dependencies: @@ -9285,16 +9317,6 @@ packages: /tslib@2.6.0: resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} - /tsutils@3.21.0(typescript@5.1.6): - resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} - engines: {node: '>= 6'} - peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' - dependencies: - tslib: 1.14.1 - typescript: 5.1.6 - dev: true - /ttest@3.0.0: resolution: {integrity: sha512-bLo+LdYokiDZHVFIWJmC5afoh7wZ+o1h++0XXKh01+yprzz8CnaiGNcbcbqP0e3+iyDqclLI+rM0j/9AwmRljw==} dependencies: @@ -9388,6 +9410,25 @@ packages: resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} dev: true + /typed-array-buffer@1.0.0: + resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + is-typed-array: 1.1.10 + dev: true + + /typed-array-byte-length@1.0.0: + resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.10 + dev: true + /typed-array-byte-offset@1.0.0: resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} engines: {node: '>= 0.4'} diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index f2994529..3e7f0716 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -128,7 +128,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { throw new BaseError(`Connector ${connectorId} does not exist`); } if (this.connectorsStatus.get(connectorId)?.start === true) { - this.connectorsStatus.get(connectorId).start = false; + this.connectorsStatus.get(connectorId)!.start = false; } else if (this.connectorsStatus.get(connectorId)?.start === false) { logger.warn(`${this.logPrefix(connectorId)} is already stopped on connector`); } @@ -183,12 +183,12 @@ export class AutomaticTransactionGenerator extends AsyncResource { `${this.logPrefix( connectorId, )} started on connector and will run for ${formatDurationMilliSeconds( - this.connectorsStatus.get(connectorId).stopDate.getTime() - - this.connectorsStatus.get(connectorId).startDate.getTime(), + this.connectorsStatus.get(connectorId)!.stopDate!.getTime() - + this.connectorsStatus.get(connectorId)!.startDate!.getTime(), )}`, ); while (this.connectorsStatus.get(connectorId)?.start === true) { - if (new Date() > this.connectorsStatus.get(connectorId).stopDate) { + if (new Date() > this.connectorsStatus.get(connectorId)!.stopDate!) { this.stopConnector(connectorId); break; } @@ -255,7 +255,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { start < this.chargingStation.getAutomaticTransactionGeneratorConfiguration().probabilityOfStart ) { - this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions = 0; + this.connectorsStatus.get(connectorId)!.skippedConsecutiveTransactions = 0; // Start transaction const startResponse = await this.startTransaction(connectorId); if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { @@ -282,8 +282,8 @@ export class AutomaticTransactionGenerator extends AsyncResource { await this.stopTransaction(connectorId); } } else { - ++this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions; - ++this.connectorsStatus.get(connectorId).skippedTransactions; + ++this.connectorsStatus.get(connectorId)!.skippedConsecutiveTransactions!; + ++this.connectorsStatus.get(connectorId)!.skippedTransactions!; logger.info( `${this.logPrefix(connectorId)} skipped consecutively ${this.connectorsStatus .get(connectorId) @@ -292,15 +292,15 @@ export class AutomaticTransactionGenerator extends AsyncResource { ?.skippedTransactions?.toString()} transaction(s)`, ); } - this.connectorsStatus.get(connectorId).lastRunDate = new Date(); + this.connectorsStatus.get(connectorId)!.lastRunDate = new Date(); } - this.connectorsStatus.get(connectorId).stoppedDate = new Date(); + this.connectorsStatus.get(connectorId)!.stoppedDate = new Date(); logger.info( `${this.logPrefix( connectorId, )} stopped on connector and lasted for ${formatDurationMilliSeconds( - this.connectorsStatus.get(connectorId).stoppedDate.getTime() - - this.connectorsStatus.get(connectorId).startDate.getTime(), + this.connectorsStatus.get(connectorId)!.stoppedDate!.getTime() - + this.connectorsStatus.get(connectorId)!.startDate!.getTime(), )}`, ); logger.debug( @@ -310,22 +310,22 @@ export class AutomaticTransactionGenerator extends AsyncResource { } private setStartConnectorStatus(connectorId: number): void { - this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions = 0; + this.connectorsStatus.get(connectorId)!.skippedConsecutiveTransactions = 0; const previousRunDuration = this.connectorsStatus.get(connectorId)?.startDate && this.connectorsStatus.get(connectorId)?.lastRunDate - ? this.connectorsStatus.get(connectorId).lastRunDate.getTime() - - this.connectorsStatus.get(connectorId).startDate.getTime() + ? this.connectorsStatus.get(connectorId)!.lastRunDate!.getTime() - + this.connectorsStatus.get(connectorId)!.startDate!.getTime() : 0; - this.connectorsStatus.get(connectorId).startDate = new Date(); - this.connectorsStatus.get(connectorId).stopDate = new Date( - this.connectorsStatus.get(connectorId).startDate.getTime() + + this.connectorsStatus.get(connectorId)!.startDate = new Date(); + this.connectorsStatus.get(connectorId)!.stopDate = new Date( + this.connectorsStatus.get(connectorId)!.startDate!.getTime() + this.chargingStation.getAutomaticTransactionGeneratorConfiguration().stopAfterHours * 3600 * 1000 - previousRunDuration, ); - this.connectorsStatus.get(connectorId).start = true; + this.connectorsStatus.get(connectorId)!.start = true; } private initializeConnectorsStatus(): void { @@ -348,7 +348,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { private getConnectorStatus(connectorId: number): Status { const connectorStatus = cloneObject( - this.chargingStation.getAutomaticTransactionGeneratorStatuses(), + this.chargingStation.getAutomaticTransactionGeneratorStatuses()!, )[connectorId]; delete connectorStatus?.startDate; delete connectorStatus?.lastRunDate; @@ -377,10 +377,10 @@ export class AutomaticTransactionGenerator extends AsyncResource { ): Promise { const measureId = 'StartTransaction with ATG'; const beginId = PerformanceStatistics.beginMeasure(measureId); - let startResponse: StartTransactionResponse; + let startResponse: StartTransactionResponse | undefined; if (this.chargingStation.hasIdTags()) { const idTag = IdTagsCache.getInstance().getIdTag( - this.chargingStation.getAutomaticTransactionGeneratorConfiguration()?.idTagDistribution, + this.chargingStation.getAutomaticTransactionGeneratorConfiguration().idTagDistribution!, this.chargingStation, connectorId, ); @@ -388,7 +388,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { connectorId, )} start transaction with an idTag '${idTag}'`; if (this.getRequireAuthorize()) { - this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag; + this.chargingStation.getConnectorStatus(connectorId)!.authorizeIdTag = idTag; // Authorize idTag const authorizeResponse: AuthorizeResponse = await this.chargingStation.ocppRequestService.requestHandler< @@ -397,9 +397,9 @@ export class AutomaticTransactionGenerator extends AsyncResource { >(this.chargingStation, RequestCommand.AUTHORIZE, { idTag, }); - ++this.connectorsStatus.get(connectorId).authorizeRequests; + ++this.connectorsStatus.get(connectorId)!.authorizeRequests!; if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { - ++this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests; + ++this.connectorsStatus.get(connectorId)!.acceptedAuthorizeRequests!; logger.info(startTransactionLogMsg); // Start transaction startResponse = await this.chargingStation.ocppRequestService.requestHandler< @@ -413,7 +413,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } - ++this.connectorsStatus.get(connectorId).rejectedAuthorizeRequests; + ++this.connectorsStatus.get(connectorId)!.rejectedAuthorizeRequests!; PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } @@ -443,17 +443,17 @@ export class AutomaticTransactionGenerator extends AsyncResource { private async stopTransaction( connectorId: number, reason: StopTransactionReason = StopTransactionReason.LOCAL, - ): Promise { + ): Promise { const measureId = 'StopTransaction with ATG'; const beginId = PerformanceStatistics.beginMeasure(measureId); - let stopResponse: StopTransactionResponse; + let stopResponse: StopTransactionResponse | undefined; if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) { stopResponse = await this.chargingStation.stopTransactionOnConnector(connectorId, reason); - ++this.connectorsStatus.get(connectorId).stopTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.stopTransactionRequests!; if (stopResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { - ++this.connectorsStatus.get(connectorId).acceptedStopTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.acceptedStopTransactionRequests!; } else { - ++this.connectorsStatus.get(connectorId).rejectedStopTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.rejectedStopTransactionRequests!; } } else { const transactionId = this.chargingStation.getConnectorStatus(connectorId)?.transactionId; @@ -476,7 +476,7 @@ export class AutomaticTransactionGenerator extends AsyncResource { private logPrefix = (connectorId?: number): string => { return logPrefix( ` ${this.chargingStation.stationInfo.chargingStationId} | ATG${ - !isNullOrUndefined(connectorId) ? ` on connector #${connectorId.toString()}` : '' + !isNullOrUndefined(connectorId) ? ` on connector #${connectorId!.toString()}` : '' }:`, ); }; @@ -485,12 +485,12 @@ export class AutomaticTransactionGenerator extends AsyncResource { connectorId: number, startResponse: StartTransactionResponse, ): void { - ++this.connectorsStatus.get(connectorId).startTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.startTransactionRequests!; if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { - ++this.connectorsStatus.get(connectorId).acceptedStartTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.acceptedStartTransactionRequests!; } else { logger.warn(`${this.logPrefix(connectorId)} start transaction rejected`); - ++this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests; + ++this.connectorsStatus.get(connectorId)!.rejectedStartTransactionRequests!; } } } diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 13774cc6..15eb4fce 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -82,8 +82,8 @@ export class Bootstrap extends EventEmitter { (this.uiServer = UIServerFactory.getUIServerImplementation(Configuration.getUIServer())); Configuration.getPerformanceStorage().enabled === true && (this.storage = StorageFactory.getStorage( - Configuration.getPerformanceStorage().type, - Configuration.getPerformanceStorage().uri, + Configuration.getPerformanceStorage().type!, + Configuration.getPerformanceStorage().uri!, this.logPrefix(), )); Configuration.setConfigurationChangeCallback(async () => Bootstrap.getInstance().restart()); @@ -109,7 +109,7 @@ export class Bootstrap extends EventEmitter { await this.storage?.open(); this.uiServer?.start(); // Start ChargingStation object instance in worker thread - for (const stationTemplateUrl of Configuration.getStationTemplateUrls()) { + for (const stationTemplateUrl of Configuration.getStationTemplateUrls()!) { try { const nbStations = stationTemplateUrl.numberOfStations ?? 0; for (let index = 1; index <= nbStations; index++) { @@ -212,7 +212,7 @@ export class Bootstrap extends EventEmitter { } private initializeWorkerImplementation(): void { - let elementsPerWorker: number; + let elementsPerWorker: number | undefined; if (Configuration.getWorker()?.elementsPerWorker === 'auto') { elementsPerWorker = this.numberOfChargingStations > availableParallelism() @@ -222,12 +222,12 @@ export class Bootstrap extends EventEmitter { this.workerImplementation === null && (this.workerImplementation = WorkerFactory.getWorkerImplementation( this.workerScript, - Configuration.getWorker().processType, + Configuration.getWorker().processType!, { workerStartDelay: Configuration.getWorker().startDelay, elementStartDelay: Configuration.getWorker().elementStartDelay, - poolMaxSize: Configuration.getWorker().poolMaxSize, - poolMinSize: Configuration.getWorker().poolMinSize, + poolMaxSize: Configuration.getWorker().poolMaxSize!, + poolMinSize: Configuration.getWorker().poolMinSize!, elementsPerWorker: elementsPerWorker ?? (Configuration.getWorker().elementsPerWorker as number), poolOptions: { @@ -244,8 +244,8 @@ export class Bootstrap extends EventEmitter { // `${this.logPrefix()} ${moduleName}.messageHandler: Worker channel message received: ${JSON.stringify( // msg, // null, - // 2 - // )}` + // 2, + // )}`, // ); try { switch (msg.id) { @@ -318,7 +318,7 @@ export class Bootstrap extends EventEmitter { private initializeCounters() { if (this.initializedCounters === false) { this.resetCounters(); - const stationTemplateUrls = Configuration.getStationTemplateUrls(); + const stationTemplateUrls = Configuration.getStationTemplateUrls()!; if (isNotEmptyArray(stationTemplateUrls)) { this.numberOfChargingStationTemplates = stationTemplateUrls.length; for (const stationTemplateUrl of stationTemplateUrls) { diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index a966037d..474565ba 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -162,7 +162,7 @@ export class ChargingStation { public readonly evses: Map; public readonly requests: Map; public performanceStatistics!: PerformanceStatistics | undefined; - public heartbeatSetInterval!: NodeJS.Timeout; + public heartbeatSetInterval?: NodeJS.Timeout; public ocppRequestService!: OCPPRequestService; public bootNotificationRequest!: BootNotificationRequest; public bootNotificationResponse!: BootNotificationResponse | undefined; @@ -180,7 +180,7 @@ export class ChargingStation { private templateFileWatcher!: FSWatcher | undefined; private templateFileHash!: string; private readonly sharedLRUCache: SharedLRUCache; - private webSocketPingSetInterval!: NodeJS.Timeout; + private webSocketPingSetInterval?: NodeJS.Timeout; private readonly chargingStationWorkerBroadcastChannel: ChargingStationWorkerBroadcastChannel; private reservationExpirationSetInterval?: NodeJS.Timeout; @@ -221,7 +221,7 @@ export class ChargingStation { ? ChargingStationConfigurationUtils.getConfigurationKey( this, this.getSupervisionUrlOcppKey(), - ).value + )!.value : this.configuredSupervisionUrl.href }/${this.stationInfo.chargingStationId}`, ); @@ -232,14 +232,14 @@ export class ChargingStation { ` ${ (isNotEmptyString(this?.stationInfo?.chargingStationId) ? this?.stationInfo?.chargingStationId - : getChargingStationId(this.index, this.getTemplateFromFile())) ?? + : getChargingStationId(this.index, this.getTemplateFromFile()!)) ?? 'Error at building log prefix' } |`, ); }; public hasIdTags(): boolean { - return isNotEmptyArray(this.idTagsCache.getIdTags(getIdTagsFile(this.stationInfo))); + return isNotEmptyArray(this.idTagsCache.getIdTags(getIdTagsFile(this.stationInfo)!)); } public getEnableStatistics(): boolean { @@ -250,11 +250,11 @@ export class ChargingStation { return this.stationInfo.mustAuthorizeAtRemoteStart ?? true; } - public getNumberOfPhases(stationInfo?: ChargingStationInfo): number | undefined { + public getNumberOfPhases(stationInfo?: ChargingStationInfo): number { const localStationInfo: ChargingStationInfo = stationInfo ?? this.stationInfo; switch (this.getCurrentOutType(stationInfo)) { case CurrentType.AC: - return !isUndefined(localStationInfo.numberOfPhases) ? localStationInfo.numberOfPhases : 3; + return !isUndefined(localStationInfo.numberOfPhases) ? localStationInfo.numberOfPhases! : 3; case CurrentType.DC: return 0; } @@ -351,7 +351,7 @@ export class ChargingStation { return this.stationInfo?.ocppStrictCompliance ?? true; } - public getVoltageOut(stationInfo?: ChargingStationInfo): number | undefined { + public getVoltageOut(stationInfo?: ChargingStationInfo): number { const defaultVoltageOut = getDefaultVoltageOut( this.getCurrentOutType(stationInfo), this.logPrefix(), @@ -362,24 +362,25 @@ export class ChargingStation { public getMaximumPower(stationInfo?: ChargingStationInfo): number { const localStationInfo = stationInfo ?? this.stationInfo; + // eslint-disable-next-line @typescript-eslint/dot-notation return (localStationInfo['maxPower'] as number) ?? localStationInfo.maximumPower; } public getConnectorMaximumAvailablePower(connectorId: number): number { - let connectorAmperageLimitationPowerLimit: number; + let connectorAmperageLimitationPowerLimit: number | undefined; if ( !isNullOrUndefined(this.getAmperageLimitation()) && - this.getAmperageLimitation() < this.stationInfo?.maximumAmperage + this.getAmperageLimitation()! < this.stationInfo.maximumAmperage! ) { connectorAmperageLimitationPowerLimit = (this.getCurrentOutType() === CurrentType.AC ? ACElectricUtils.powerTotal( this.getNumberOfPhases(), this.getVoltageOut(), - this.getAmperageLimitation() * + this.getAmperageLimitation()! * (this.hasEvses ? this.getNumberOfEvses() : this.getNumberOfConnectors()), ) - : DCElectricUtils.power(this.getVoltageOut(), this.getAmperageLimitation())) / + : DCElectricUtils.power(this.getVoltageOut(), this.getAmperageLimitation()!)) / this.powerDivider; } const connectorMaximumPower = this.getMaximumPower() / this.powerDivider; @@ -387,10 +388,10 @@ export class ChargingStation { getChargingStationConnectorChargingProfilesPowerLimit(this, connectorId); return Math.min( isNaN(connectorMaximumPower) ? Infinity : connectorMaximumPower, - isNaN(connectorAmperageLimitationPowerLimit) + isNaN(connectorAmperageLimitationPowerLimit!) ? Infinity - : connectorAmperageLimitationPowerLimit, - isNaN(connectorChargingProfilesPowerLimit) ? Infinity : connectorChargingProfilesPowerLimit, + : connectorAmperageLimitationPowerLimit!, + isNaN(connectorChargingProfilesPowerLimit!) ? Infinity : connectorChargingProfilesPowerLimit!, ); } @@ -486,13 +487,13 @@ export class ChargingStation { rounded = false, ): number { return this.getEnergyActiveImportRegister( - this.getConnectorStatus(this.getConnectorIdByTransactionId(transactionId)), + this.getConnectorStatus(this.getConnectorIdByTransactionId(transactionId)!)!, rounded, ); } public getEnergyActiveImportRegisterByConnectorId(connectorId: number, rounded = false): number { - return this.getEnergyActiveImportRegister(this.getConnectorStatus(connectorId), rounded); + return this.getEnergyActiveImportRegister(this.getConnectorStatus(connectorId)!, rounded); } public getAuthorizeRemoteTxRequests(): boolean { @@ -628,12 +629,12 @@ export class ChargingStation { return; } if (interval > 0) { - this.getConnectorStatus(connectorId).transactionSetInterval = setInterval(() => { + this.getConnectorStatus(connectorId)!.transactionSetInterval = setInterval(() => { // FIXME: Implement OCPP version agnostic helpers const meterValue: MeterValue = OCPP16ServiceUtils.buildMeterValue( this, connectorId, - this.getConnectorStatus(connectorId).transactionId, + this.getConnectorStatus(connectorId)!.transactionId!, interval, ); this.ocppRequestService @@ -696,7 +697,7 @@ export class ChargingStation { this.sharedLRUCache.deleteChargingStationTemplate(this.templateFileHash); // Initialize this.initialize(); - this.idTagsCache.deleteIdTags(getIdTagsFile(this.stationInfo)); + this.idTagsCache.deleteIdTags(getIdTagsFile(this.stationInfo)!); // Restart the ATG this.stopAutomaticTransactionGenerator(); if (this.getAutomaticTransactionGeneratorConfiguration()?.enable === true) { @@ -755,7 +756,7 @@ export class ChargingStation { public async reset(reason?: StopTransactionReason): Promise { await this.stop(reason); - await sleep(this.stationInfo.resetTime); + await sleep(this.stationInfo.resetTime!); this.initialize(); this.start(); } @@ -854,9 +855,7 @@ export class ChargingStation { } } - public getAutomaticTransactionGeneratorConfiguration(): - | AutomaticTransactionGeneratorConfiguration - | undefined { + public getAutomaticTransactionGeneratorConfiguration(): AutomaticTransactionGeneratorConfiguration { let automaticTransactionGeneratorConfiguration: | AutomaticTransactionGeneratorConfiguration | undefined; @@ -885,7 +884,7 @@ export class ChargingStation { public startAutomaticTransactionGenerator(connectorIds?: number[]): void { this.automaticTransactionGenerator = AutomaticTransactionGenerator.getInstance(this); if (isNotEmptyArray(connectorIds)) { - for (const connectorId of connectorIds) { + for (const connectorId of connectorIds!) { this.automaticTransactionGenerator?.startConnector(connectorId); } } else { @@ -897,7 +896,7 @@ export class ChargingStation { public stopAutomaticTransactionGenerator(connectorIds?: number[]): void { if (isNotEmptyArray(connectorIds)) { - for (const connectorId of connectorIds) { + for (const connectorId of connectorIds!) { this.automaticTransactionGenerator?.stopConnector(connectorId); } } else { @@ -921,7 +920,7 @@ export class ChargingStation { const transactionEndMeterValue = OCPP16ServiceUtils.buildTransactionEndMeterValue( this, connectorId, - this.getEnergyActiveImportRegisterByTransactionId(transactionId), + this.getEnergyActiveImportRegisterByTransactionId(transactionId!), ); await this.ocppRequestService.requestHandler( this, @@ -938,7 +937,7 @@ export class ChargingStation { RequestCommand.STOP_TRANSACTION, { transactionId, - meterStop: this.getEnergyActiveImportRegisterByTransactionId(transactionId, true), + meterStop: this.getEnergyActiveImportRegisterByTransactionId(transactionId!, true), reason, }, ); @@ -949,21 +948,24 @@ export class ChargingStation { ChargingStationConfigurationUtils.getConfigurationKey( this, StandardParametersKey.ReserveConnectorZeroSupported, - ).value, + )!.value, ); } public async addReservation(reservation: Reservation): Promise { const [exists, reservationFound] = this.doesReservationExists(reservation); if (exists) { - await this.removeReservation(reservationFound, ReservationTerminationReason.REPLACE_EXISTING); + await this.removeReservation( + reservationFound!, + ReservationTerminationReason.REPLACE_EXISTING, + ); } - this.getConnectorStatus(reservation.connectorId).reservation = reservation; + this.getConnectorStatus(reservation.connectorId)!.reservation = reservation; await OCPPServiceUtils.sendAndSetConnectorStatus( this, reservation.connectorId, ConnectorStatusEnum.Reserved, - null, + undefined, { send: reservation.connectorId !== 0 }, ); } @@ -972,7 +974,7 @@ export class ChargingStation { reservation: Reservation, reason?: ReservationTerminationReason, ): Promise { - const connector = this.getConnectorStatus(reservation.connectorId); + const connector = this.getConnectorStatus(reservation.connectorId)!; switch (reason) { case ReservationTerminationReason.CONNECTOR_STATE_CHANGED: delete connector.reservation; @@ -987,7 +989,7 @@ export class ChargingStation { this, reservation.connectorId, ConnectorStatusEnum.Available, - null, + undefined, { send: reservation.connectorId !== 0 }, ); delete connector.reservation; @@ -1018,12 +1020,14 @@ export class ChargingStation { } } - public doesReservationExists(reservation: Partial): [boolean, Reservation] { + public doesReservationExists( + reservation: Partial, + ): [boolean, Reservation | undefined] { const foundReservation = this.getReservationBy( ReservationFilterKey.RESERVATION_ID, - reservation?.id, + reservation.id!, ); - return isUndefined(foundReservation) ? [false, null] : [true, foundReservation]; + return isUndefined(foundReservation) ? [false, undefined] : [true, foundReservation]; } public startReservationExpirationSetInterval(customInterval?: number): void { @@ -1039,9 +1043,9 @@ export class ChargingStation { if (this.hasEvses) { for (const evseStatus of this.evses.values()) { for (const connectorStatus of evseStatus.connectors.values()) { - if (connectorStatus?.reservation?.expiryDate < now) { + if (connectorStatus.reservation!.expiryDate < now) { await this.removeReservation( - connectorStatus.reservation, + connectorStatus.reservation!, ReservationTerminationReason.EXPIRED, ); } @@ -1049,9 +1053,9 @@ export class ChargingStation { } } else { for (const connectorStatus of this.connectors.values()) { - if (connectorStatus?.reservation?.expiryDate < now) { + if (connectorStatus.reservation!.expiryDate < now) { await this.removeReservation( - connectorStatus.reservation, + connectorStatus.reservation!, ReservationTerminationReason.EXPIRED, ); } @@ -1079,11 +1083,11 @@ export class ChargingStation { return alreadyExists; } const userReservedAlready = isUndefined( - this.getReservationBy(ReservationFilterKey.ID_TAG, idTag), + this.getReservationBy(ReservationFilterKey.ID_TAG, idTag!), ) ? false : true; - const notConnectorZero = isUndefined(connectorId) ? true : connectorId > 0; + const notConnectorZero = isUndefined(connectorId) ? true : connectorId! > 0; const freeConnectorsAvailable = this.getNumberOfReservableConnectors() > 0; return !alreadyExists && !userReservedAlready && notConnectorZero && freeConnectorsAvailable; } @@ -1113,8 +1117,8 @@ export class ChargingStation { private flushMessageBuffer(): void { if (this.messageBuffer.size > 0) { for (const message of this.messageBuffer.values()) { - let beginId: string; - let commandName: RequestCommand; + let beginId: string | undefined; + let commandName: RequestCommand | undefined; const [messageType] = JSON.parse(message) as OutgoingRequest | Response | ErrorResponse; const isRequest = messageType === MessageType.CALL_MESSAGE; if (isRequest) { @@ -1122,7 +1126,7 @@ export class ChargingStation { beginId = PerformanceStatistics.beginMeasure(commandName); } this.wsConnection?.send(message); - isRequest && PerformanceStatistics.endMeasure(commandName, beginId); + isRequest && PerformanceStatistics.endMeasure(commandName!, beginId!); logger.debug( `${this.logPrefix()} >> Buffered ${OCPPServiceUtils.getMessageTypeString( messageType, @@ -1148,7 +1152,7 @@ export class ChargingStation { } private getTemplateFromFile(): ChargingStationTemplate | undefined { - let template: ChargingStationTemplate; + let template: ChargingStationTemplate | undefined; try { if (this.sharedLRUCache.hasChargingStationTemplate(this.templateFileHash)) { template = this.sharedLRUCache.getChargingStationTemplate(this.templateFileHash); @@ -1175,7 +1179,7 @@ export class ChargingStation { } private getStationInfoFromTemplate(): ChargingStationInfo { - const stationTemplate: ChargingStationTemplate | undefined = this.getTemplateFromFile(); + const stationTemplate: ChargingStationTemplate = this.getTemplateFromFile()!; checkTemplate(stationTemplate, this.logPrefix(), this.templateFile); warnTemplateKeysDeprecation(stationTemplate, this.logPrefix(), this.templateFile); if (stationTemplate?.Connectors) { @@ -1204,7 +1208,7 @@ export class ChargingStation { stationTemplate?.firmwareVersionPattern ?? Constants.SEMVER_PATTERN; if ( isNotEmptyString(stationInfo.firmwareVersion) && - new RegExp(stationInfo.firmwareVersionPattern).test(stationInfo.firmwareVersion) === false + new RegExp(stationInfo.firmwareVersionPattern).test(stationInfo.firmwareVersion!) === false ) { logger.warn( `${this.logPrefix()} Firmware version '${stationInfo.firmwareVersion}' in template file ${ @@ -1222,7 +1226,7 @@ export class ChargingStation { stationTemplate?.firmwareUpgrade ?? {}, ); stationInfo.resetTime = !isNullOrUndefined(stationTemplate?.resetTime) - ? stationTemplate.resetTime * 1000 + ? stationTemplate.resetTime! * 1000 : Constants.CHARGING_STATION_DEFAULT_RESET_TIME; stationInfo.maximumAmperage = this.getMaximumAmperage(stationInfo); return stationInfo; @@ -1246,11 +1250,11 @@ export class ChargingStation { // 1. charging station info from template // 2. charging station info from configuration file if (stationInfoFromFile?.templateHash === stationInfoFromTemplate.templateHash) { - return stationInfoFromFile; + return stationInfoFromFile!; } stationInfoFromFile && propagateSerialNumber( - this.getTemplateFromFile(), + this.getTemplateFromFile()!, stationInfoFromFile, stationInfoFromTemplate, ); @@ -1283,7 +1287,7 @@ export class ChargingStation { } private initialize(): void { - const stationTemplate = this.getTemplateFromFile(); + const stationTemplate = this.getTemplateFromFile()!; checkTemplate(stationTemplate, this.logPrefix(), this.templateFile); this.configurationFile = join( dirname(this.templateFile.replace('station-templates', 'configurations')), @@ -1292,6 +1296,7 @@ export class ChargingStation { const chargingStationConfiguration = this.getConfigurationFromFile(); if ( chargingStationConfiguration?.stationInfo?.templateHash === stationTemplate?.templateHash && + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing (chargingStationConfiguration?.connectorsStatus || chargingStationConfiguration?.evsesStatus) ) { this.initializeConnectorsOrEvsesFromFile(chargingStationConfiguration); @@ -1307,13 +1312,13 @@ export class ChargingStation { const patternGroup: number | undefined = this.stationInfo.firmwareUpgrade?.versionUpgrade?.patternGroup ?? this.stationInfo.firmwareVersion?.split('.').length; - const match = this.stationInfo?.firmwareVersion - ?.match(new RegExp(this.stationInfo.firmwareVersionPattern)) - ?.slice(1, patternGroup + 1); + const match = this.stationInfo + .firmwareVersion!.match(new RegExp(this.stationInfo.firmwareVersionPattern!))! + .slice(1, patternGroup! + 1); const patchLevelIndex = match.length - 1; match[patchLevelIndex] = ( convertToInt(match[patchLevelIndex]) + - this.stationInfo.firmwareUpgrade?.versionUpgrade?.step + this.stationInfo.firmwareUpgrade!.versionUpgrade!.step! ).toString(); this.stationInfo.firmwareVersion = match?.join('.'); } @@ -1322,7 +1327,7 @@ export class ChargingStation { if (this.getEnableStatistics() === true) { this.performanceStatistics = PerformanceStatistics.getInstance( this.stationInfo.hashId, - this.stationInfo.chargingStationId, + this.stationInfo.chargingStationId!, this.configuredSupervisionUrl, ); } @@ -1417,14 +1422,14 @@ export class ChargingStation { isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) && !ChargingStationConfigurationUtils.getConfigurationKey( this, - this.stationInfo.amperageLimitationOcppKey, + this.stationInfo.amperageLimitationOcppKey!, ) ) { ChargingStationConfigurationUtils.addConfigurationKey( this, - this.stationInfo.amperageLimitationOcppKey, + this.stationInfo.amperageLimitationOcppKey!, ( - this.stationInfo.maximumAmperage * getAmperageLimitationUnitDivider(this.stationInfo) + this.stationInfo.maximumAmperage! * getAmperageLimitationUnitDivider(this.stationInfo) ).toString(), ); } @@ -1470,14 +1475,14 @@ export class ChargingStation { for (const evseStatus of this.evses.values()) { for (const connectorId of evseStatus.connectors.keys()) { connectorsPhaseRotation.push( - getPhaseRotationValue(connectorId, this.getNumberOfPhases()), + getPhaseRotationValue(connectorId, this.getNumberOfPhases())!, ); } } } else { for (const connectorId of this.connectors.keys()) { connectorsPhaseRotation.push( - getPhaseRotationValue(connectorId, this.getNumberOfPhases()), + getPhaseRotationValue(connectorId, this.getNumberOfPhases())!, ); } } @@ -1542,7 +1547,7 @@ export class ChargingStation { this.evses.set(evseId, { ...(evseStatus as EvseStatus), connectors: new Map( - evseStatusConfiguration.connectorsStatus.map((connectorStatus, connectorId) => [ + evseStatusConfiguration.connectorsStatus!.map((connectorStatus, connectorId) => [ connectorId, connectorStatus, ]), @@ -1582,7 +1587,7 @@ export class ChargingStation { logger.error(`${this.logPrefix()} ${errorMsg}`); throw new BaseError(errorMsg); } - if (!stationTemplate?.Connectors[0]) { + if (!stationTemplate?.Connectors?.[0]) { logger.warn( `${this.logPrefix()} Charging station information from template ${ this.templateFile @@ -1649,14 +1654,14 @@ export class ChargingStation { logger.error(`${this.logPrefix()} ${errorMsg}`); throw new BaseError(errorMsg); } - if (!stationTemplate?.Evses[0]) { + if (!stationTemplate?.Evses?.[0]) { logger.warn( `${this.logPrefix()} Charging station information from template ${ this.templateFile } with no evse id 0 configuration`, ); } - if (!stationTemplate?.Evses[0]?.Connectors[0]) { + if (!stationTemplate?.Evses?.[0]?.Connectors?.[0]) { logger.warn( `${this.logPrefix()} Charging station information from template ${ this.templateFile @@ -1684,7 +1689,7 @@ export class ChargingStation { ), availability: AvailabilityType.Operative, }); - initializeConnectorsMapStatus(this.evses.get(evseId)?.connectors, this.logPrefix()); + initializeConnectorsMapStatus(this.evses.get(evseId)!.connectors, this.logPrefix()); } this.saveEvsesStatus(); } else { @@ -1720,7 +1725,7 @@ export class ChargingStation { ) as ChargingStationConfiguration; PerformanceStatistics.endMeasure(measureId, beginId); this.sharedLRUCache.setChargingStationConfiguration(configuration); - this.configurationFileHash = configuration.configurationHash; + this.configurationFileHash = configuration.configurationHash!; } } catch (error) { handleFileException( @@ -1755,7 +1760,7 @@ export class ChargingStation { mkdirSync(dirname(this.configurationFile), { recursive: true }); } let configurationData: ChargingStationConfiguration = - cloneObject(this.getConfigurationFromFile()) ?? {}; + cloneObject(this.getConfigurationFromFile()!) ?? {}; if (this.getStationInfoPersistentConfiguration() && this.stationInfo) { configurationData.stationInfo = this.stationInfo; } else { @@ -1889,7 +1894,7 @@ export class ChargingStation { } } while ( this.isRegistered() === false && - (registrationRetryCount <= this.getRegistrationMaxRetries() || + (registrationRetryCount <= this.getRegistrationMaxRetries()! || this.getRegistrationMaxRetries() === -1) ); } @@ -1986,7 +1991,7 @@ export class ChargingStation { const [responseCallback, , requestCommandName, requestPayload] = this.getCachedRequest( messageType, messageId, - ); + )!; logger.debug( `${this.logPrefix()} << Command '${ requestCommandName ?? Constants.UNKNOWN_COMMAND @@ -2006,7 +2011,7 @@ export class ChargingStation { { errorType, errorMessage, errorDetails }, ); } - const [, errorCallback, requestCommandName] = this.getCachedRequest(messageType, messageId); + const [, errorCallback, requestCommandName] = this.getCachedRequest(messageType, messageId)!; logger.debug( `${this.logPrefix()} << Command '${ requestCommandName ?? Constants.UNKNOWN_COMMAND @@ -2016,10 +2021,11 @@ export class ChargingStation { } private async onMessage(data: RawData): Promise { - let request: IncomingRequest | Response | ErrorResponse; - let messageType: number; + let request: IncomingRequest | Response | ErrorResponse | undefined; + let messageType: number | undefined; let errorMsg: string; try { + // eslint-disable-next-line @typescript-eslint/no-base-to-string request = JSON.parse(data.toString()) as IncomingRequest | Response | ErrorResponse; if (Array.isArray(request) === true) { [messageType] = request; @@ -2046,15 +2052,20 @@ export class ChargingStation { } parentPort?.postMessage(buildUpdatedMessage(this)); } else { - throw new OCPPError(ErrorType.PROTOCOL_ERROR, 'Incoming message is not an array', null, { - request, - }); + throw new OCPPError( + ErrorType.PROTOCOL_ERROR, + 'Incoming message is not an array', + undefined, + { + request, + }, + ); } } catch (error) { - let commandName: IncomingRequestCommand; - let requestCommandName: RequestCommand | IncomingRequestCommand; + let commandName: IncomingRequestCommand | undefined; + let requestCommandName: RequestCommand | IncomingRequestCommand | undefined; let errorCallback: ErrorCallback; - const [, messageId] = request; + const [, messageId] = request!; switch (messageType) { case MessageType.CALL_MESSAGE: [, , commandName] = request as IncomingRequest; @@ -2064,7 +2075,7 @@ export class ChargingStation { case MessageType.CALL_RESULT_MESSAGE: case MessageType.CALL_ERROR_MESSAGE: if (this.requests.has(messageId) === true) { - [, 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 { @@ -2077,6 +2088,7 @@ export class ChargingStation { logger.warn( `${this.logPrefix()} Error thrown at incoming OCPP command '${ commandName ?? requestCommandName ?? Constants.UNKNOWN_COMMAND + // eslint-disable-next-line @typescript-eslint/no-base-to-string }' message '${data.toString()}' handling is not an OCPPError:`, error, ); @@ -2084,6 +2096,7 @@ export class ChargingStation { logger.error( `${this.logPrefix()} Incoming OCPP command '${ commandName ?? requestCommandName ?? Constants.UNKNOWN_COMMAND + // eslint-disable-next-line @typescript-eslint/no-base-to-string }' message '${data.toString()}'${ messageType !== MessageType.CALL_MESSAGE ? ` matching cached request '${JSON.stringify(this.requests.get(messageId))}'` @@ -2111,13 +2124,13 @@ export class ChargingStation { if (this.getMeteringPerTransaction() === true) { return ( (rounded === true - ? Math.round(connectorStatus?.transactionEnergyActiveImportRegisterValue) + ? Math.round(connectorStatus.transactionEnergyActiveImportRegisterValue!) : connectorStatus?.transactionEnergyActiveImportRegisterValue) ?? 0 ); } return ( (rounded === true - ? Math.round(connectorStatus?.energyActiveImportRegisterValue) + ? Math.round(connectorStatus.energyActiveImportRegisterValue!) : connectorStatus?.energyActiveImportRegisterValue) ?? 0 ); } @@ -2160,7 +2173,7 @@ export class ChargingStation { ChargingStationConfigurationUtils.getConfigurationKey( this, StandardParametersKey.ConnectionTimeOut, - ).value, + )!.value!, ) ?? Constants.DEFAULT_CONNECTION_TIMEOUT ); } @@ -2206,14 +2219,14 @@ export class ChargingStation { isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) && ChargingStationConfigurationUtils.getConfigurationKey( this, - this.stationInfo.amperageLimitationOcppKey, + this.stationInfo.amperageLimitationOcppKey!, ) ) { return ( convertToInt( ChargingStationConfigurationUtils.getConfigurationKey( this, - this.stationInfo.amperageLimitationOcppKey, + this.stationInfo.amperageLimitationOcppKey!, )?.value, ) / getAmperageLimitationUnitDivider(this.stationInfo) ); @@ -2254,7 +2267,7 @@ export class ChargingStation { const connectorBootStatus = getBootConnectorStatus( this, connectorId, - this.getConnectorStatus(connectorId), + this.getConnectorStatus(connectorId)!, ); await OCPPServiceUtils.sendAndSetConnectorStatus(this, connectorId, connectorBootStatus); } @@ -2382,23 +2395,26 @@ export class ChargingStation { let configuredSupervisionUrlIndex: number; switch (Configuration.getSupervisionUrlDistribution()) { case SupervisionUrlDistribution.RANDOM: - configuredSupervisionUrlIndex = Math.floor(secureRandom() * supervisionUrls.length); + configuredSupervisionUrlIndex = Math.floor( + secureRandom() * (supervisionUrls as string[]).length, + ); break; case SupervisionUrlDistribution.ROUND_ROBIN: case SupervisionUrlDistribution.CHARGING_STATION_AFFINITY: default: Object.values(SupervisionUrlDistribution).includes( - Configuration.getSupervisionUrlDistribution(), + Configuration.getSupervisionUrlDistribution()!, ) === false && logger.error( + // eslint-disable-next-line @typescript-eslint/no-base-to-string `${this.logPrefix()} Unknown supervision url distribution '${Configuration.getSupervisionUrlDistribution()}' from values '${SupervisionUrlDistribution.toString()}', defaulting to ${ SupervisionUrlDistribution.CHARGING_STATION_AFFINITY }`, ); - configuredSupervisionUrlIndex = (this.index - 1) % supervisionUrls.length; + configuredSupervisionUrlIndex = (this.index - 1) % (supervisionUrls as string[]).length; break; } - configuredSupervisionUrl = supervisionUrls[configuredSupervisionUrlIndex]; + configuredSupervisionUrl = (supervisionUrls as string[])[configuredSupervisionUrlIndex]; } else { configuredSupervisionUrl = supervisionUrls as string; } @@ -2438,7 +2454,7 @@ export class ChargingStation { this.stopAutomaticTransactionGenerator(); } if ( - this.autoReconnectRetryCount < this.getAutoReconnectMaxRetries() || + this.autoReconnectRetryCount < this.getAutoReconnectMaxRetries()! || this.getAutoReconnectMaxRetries() === -1 ) { ++this.autoReconnectRetryCount; diff --git a/src/charging-station/ChargingStationConfigurationUtils.ts b/src/charging-station/ChargingStationConfigurationUtils.ts index 59e39300..52972a2a 100644 --- a/src/charging-station/ChargingStationConfigurationUtils.ts +++ b/src/charging-station/ChargingStationConfigurationUtils.ts @@ -2,9 +2,19 @@ import type { ChargingStation } from './ChargingStation'; import type { ConfigurationKey, ConfigurationKeyType } from '../types'; import { logger } from '../utils'; -type ConfigurationKeyOptions = { readonly?: boolean; visible?: boolean; reboot?: boolean }; -type DeleteConfigurationKeyParams = { save?: boolean; caseInsensitive?: boolean }; -type AddConfigurationKeyParams = { overwrite?: boolean; save?: boolean }; +interface ConfigurationKeyOptions { + readonly?: boolean; + visible?: boolean; + reboot?: boolean; +} +interface DeleteConfigurationKeyParams { + save?: boolean; + caseInsensitive?: boolean; +} +interface AddConfigurationKeyParams { + overwrite?: boolean; + save?: boolean; +} export class ChargingStationConfigurationUtils { private constructor() { @@ -54,7 +64,7 @@ export class ChargingStationConfigurationUtils { if (!keyFound) { chargingStation.ocppConfiguration?.configurationKey?.push({ key, - readonly: options.readonly, + readonly: options.readonly!, value, visible: options.visible, reboot: options.reboot, @@ -79,7 +89,7 @@ export class ChargingStationConfigurationUtils { key, caseInsensitive, ); - if (keyFound) { + if (keyFound && chargingStation.ocppConfiguration?.configurationKey) { chargingStation.ocppConfiguration.configurationKey[ chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound) ].value = value; diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 51ea7931..4fdfe230 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -181,7 +181,7 @@ export const checkTemplate = ( logger.error(`${logPrefix} ${errorMsg}`); throw new BaseError(errorMsg); } - if (isEmptyObject(stationTemplate.AutomaticTransactionGenerator)) { + if (isEmptyObject(stationTemplate.AutomaticTransactionGenerator!)) { stationTemplate.AutomaticTransactionGenerator = Constants.DEFAULT_ATG_CONFIGURATION; logger.warn( `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default: %j`, @@ -206,9 +206,9 @@ export const checkConnectorsConfiguration = ( } => { const configuredMaxConnectors = getConfiguredNumberOfConnectors(stationTemplate); checkConfiguredMaxConnectors(configuredMaxConnectors, logPrefix, templateFile); - const templateMaxConnectors = getMaxNumberOfConnectors(stationTemplate.Connectors); + const templateMaxConnectors = getMaxNumberOfConnectors(stationTemplate.Connectors!); checkTemplateMaxConnectors(templateMaxConnectors, logPrefix, templateFile); - const templateMaxAvailableConnectors = stationTemplate?.Connectors[0] + const templateMaxAvailableConnectors = stationTemplate.Connectors![0] ? templateMaxConnectors - 1 : templateMaxConnectors; if ( @@ -271,15 +271,15 @@ export const initializeConnectorsMapStatus = ( ); } if (connectorId === 0) { - connectors.get(connectorId).availability = AvailabilityType.Operative; + connectors.get(connectorId)!.availability = AvailabilityType.Operative; if (isUndefined(connectors.get(connectorId)?.chargingProfiles)) { - connectors.get(connectorId).chargingProfiles = []; + connectors.get(connectorId)!.chargingProfiles = []; } } else if ( connectorId > 0 && isNullOrUndefined(connectors.get(connectorId)?.transactionStarted) ) { - initializeConnectorStatus(connectors.get(connectorId)); + initializeConnectorStatus(connectors.get(connectorId)!); } } }; @@ -365,7 +365,7 @@ export const warnTemplateKeysDeprecation = ( templateKey.deprecatedKey, logPrefix, templateFile, - !isUndefined(templateKey.key) && `Use '${templateKey.key}' instead`, + !isUndefined(templateKey.key) ? `Use '${templateKey.key}' instead` : undefined, ); convertDeprecatedTemplateKey(stationTemplate, templateKey.deprecatedKey, templateKey.key); } @@ -377,8 +377,8 @@ export const stationTemplateToStationInfo = ( stationTemplate = cloneObject(stationTemplate); delete stationTemplate.power; delete stationTemplate.powerUnit; - delete stationTemplate?.Connectors; - delete stationTemplate?.Evses; + delete stationTemplate.Connectors; + delete stationTemplate.Evses; delete stationTemplate.Configuration; delete stationTemplate.AutomaticTransactionGenerator; delete stationTemplate.chargeBoxSerialNumberPrefix; @@ -453,17 +453,17 @@ export const getChargingStationConnectorChargingProfilesPowerLimit = ( chargingStation: ChargingStation, connectorId: number, ): number | undefined => { - let limit: number, matchingChargingProfile: ChargingProfile; + let limit: number | undefined, matchingChargingProfile: ChargingProfile | undefined; // Get charging profiles for connector and sort by stack level const chargingProfiles = cloneObject( - chargingStation.getConnectorStatus(connectorId)?.chargingProfiles, + chargingStation.getConnectorStatus(connectorId)!.chargingProfiles!, )?.sort((a, b) => b.stackLevel - a.stackLevel) ?? []; // Get profiles on connector 0 if (chargingStation.getConnectorStatus(0)?.chargingProfiles) { chargingProfiles.push( ...cloneObject( - chargingStation.getConnectorStatus(0).chargingProfiles, + chargingStation.getConnectorStatus(0)!.chargingProfiles!, ).sort((a, b) => b.stackLevel - a.stackLevel), ); } @@ -475,27 +475,27 @@ export const getChargingStationConnectorChargingProfilesPowerLimit = ( switch (chargingStation.getCurrentOutType()) { case CurrentType.AC: limit = - matchingChargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT + matchingChargingProfile?.chargingSchedule?.chargingRateUnit === + ChargingRateUnitType.WATT ? limit : ACElectricUtils.powerTotal( chargingStation.getNumberOfPhases(), chargingStation.getVoltageOut(), - limit, + limit!, ); break; case CurrentType.DC: limit = - matchingChargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT + matchingChargingProfile?.chargingSchedule?.chargingRateUnit === + ChargingRateUnitType.WATT ? limit - : DCElectricUtils.power(chargingStation.getVoltageOut(), limit); + : DCElectricUtils.power(chargingStation.getVoltageOut(), limit!); } const connectorMaximumPower = chargingStation.getMaximumPower() / chargingStation.powerDivider; - if (limit > connectorMaximumPower) { + if (limit! > connectorMaximumPower) { logger.error( - `${chargingStation.logPrefix()} Charging profile id ${ - matchingChargingProfile.chargingProfileId - } limit ${limit} is greater than connector id ${connectorId} maximum ${connectorMaximumPower}: %j`, + `${chargingStation.logPrefix()} Charging profile id ${matchingChargingProfile?.chargingProfileId} limit ${limit} is greater than connector id ${connectorId} maximum ${connectorMaximumPower}: %j`, result, ); limit = connectorMaximumPower; @@ -553,7 +553,7 @@ export const waitChargingStationEvents = async ( }; const getConfiguredNumberOfConnectors = (stationTemplate: ChargingStationTemplate): number => { - let configuredMaxConnectors: number; + let configuredMaxConnectors = 0; if (isNotEmptyArray(stationTemplate.numberOfConnectors) === true) { const numberOfConnectors = stationTemplate.numberOfConnectors as number[]; configuredMaxConnectors = @@ -561,7 +561,7 @@ const getConfiguredNumberOfConnectors = (stationTemplate: ChargingStationTemplat } else if (isUndefined(stationTemplate.numberOfConnectors) === false) { configuredMaxConnectors = stationTemplate.numberOfConnectors as number; } else if (stationTemplate.Connectors && !stationTemplate.Evses) { - configuredMaxConnectors = stationTemplate?.Connectors[0] + configuredMaxConnectors = stationTemplate.Connectors[0] ? getMaxNumberOfConnectors(stationTemplate.Connectors) - 1 : getMaxNumberOfConnectors(stationTemplate.Connectors); } else if (stationTemplate.Evses && !stationTemplate.Connectors) { @@ -636,10 +636,12 @@ const warnDeprecatedTemplateKey = ( const convertDeprecatedTemplateKey = ( template: ChargingStationTemplate, deprecatedKey: string, - key: string, + key?: string, ): void => { if (!isUndefined(template[deprecatedKey])) { - template[key] = template[deprecatedKey] as unknown; + if (!isUndefined(key)) { + template[key!] = template[deprecatedKey] as unknown; + } delete template[deprecatedKey]; } }; @@ -680,7 +682,7 @@ const getLimitFromChargingProfiles = ( logger.warn( `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: startSchedule is not a Date object in charging profile id ${chargingProfile.chargingProfileId}. Trying to convert it to a Date object`, ); - chargingSchedule.startSchedule = new Date(chargingSchedule.startSchedule); + chargingSchedule.startSchedule = new Date(chargingSchedule.startSchedule!); } chargingSchedule.startSchedule.setFullYear( currentDate.getFullYear(), @@ -700,7 +702,7 @@ const getLimitFromChargingProfiles = ( .add(chargingSchedule.duration, 's') .isAfter(currentMoment) ) { - let lastButOneSchedule: ChargingSchedulePeriod; + let lastButOneSchedule: ChargingSchedulePeriod | undefined; // Search the right schedule period for (const schedulePeriod of chargingSchedule.chargingSchedulePeriod) { // Handling of only one period @@ -723,7 +725,7 @@ const getLimitFromChargingProfiles = ( ) { // Found the schedule: last but one is the correct one const result = { - limit: lastButOneSchedule.limit, + limit: lastButOneSchedule!.limit, matchingChargingProfile: chargingProfile, }; logger.debug(debugLogMsg, result); diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index 26ef7131..86214393 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -12,10 +12,10 @@ import { watchJsonFile, } from '../utils'; -type IdTagsCacheValueType = { +interface IdTagsCacheValueType { idTags: string[]; idTagsFileWatcher: FSWatcher | undefined; -}; +} export class IdTagsCache { private static instance: IdTagsCache | null = null; @@ -49,7 +49,7 @@ export class IdTagsCache { connectorId: number, ): string { const hashId = chargingStation.stationInfo.hashId; - const idTagsFile = getIdTagsFile(chargingStation.stationInfo); + const idTagsFile = getIdTagsFile(chargingStation.stationInfo)!; switch (distribution) { case IdTagDistribution.RANDOM: return this.getRandomIdTag(hashId, idTagsFile); @@ -81,17 +81,17 @@ export class IdTagsCache { } private getRandomIdTag(hashId: string, file: string): string { - const idTags = this.getIdTags(file); + const idTags = this.getIdTags(file)!; const addressableKey = this.getIdTagsCacheIndexesAddressableKey(file, hashId); this.idTagsCachesAddressableIndexes.set( addressableKey, Math.floor(secureRandom() * idTags.length), ); - return idTags[this.idTagsCachesAddressableIndexes.get(addressableKey)]; + return idTags[this.idTagsCachesAddressableIndexes.get(addressableKey)!]; } private getRoundRobinIdTag(hashId: string, file: string): string { - const idTags = this.getIdTags(file); + const idTags = this.getIdTags(file)!; const addressableKey = this.getIdTagsCacheIndexesAddressableKey(file, hashId); const idTagIndex = this.idTagsCachesAddressableIndexes.get(addressableKey) ?? 0; const idTag = idTags[idTagIndex]; @@ -103,8 +103,8 @@ export class IdTagsCache { } private getConnectorAffinityIdTag(chargingStation: ChargingStation, connectorId: number): string { - const file = getIdTagsFile(chargingStation.stationInfo); - const idTags = this.getIdTags(file); + const file = getIdTagsFile(chargingStation.stationInfo)!; + const idTags = this.getIdTags(file)!; const addressableKey = this.getIdTagsCacheIndexesAddressableKey( file, chargingStation.stationInfo.hashId, @@ -113,7 +113,7 @@ export class IdTagsCache { addressableKey, (chargingStation.index - 1 + (connectorId - 1)) % idTags.length, ); - return idTags[this.idTagsCachesAddressableIndexes.get(addressableKey)]; + return idTags[this.idTagsCachesAddressableIndexes.get(addressableKey)!]; } private hasIdTagsCache(file: string): boolean { @@ -163,7 +163,7 @@ export class IdTagsCache { } private deleteIdTagsCacheIndexes(file: string): boolean { - let deleted: boolean[]; + const deleted: boolean[] = []; for (const [key] of this.idTagsCachesAddressableIndexes) { if (key.startsWith(file)) { deleted.push(this.idTagsCachesAddressableIndexes.delete(key)); diff --git a/src/charging-station/SharedLRUCache.ts b/src/charging-station/SharedLRUCache.ts index 9fd94079..d55f358e 100644 --- a/src/charging-station/SharedLRUCache.ts +++ b/src/charging-station/SharedLRUCache.ts @@ -38,7 +38,7 @@ export class SharedLRUCache { ): void { if (this.isChargingStationConfigurationCacheable(chargingStationConfiguration)) { this.set( - this.getChargingStationConfigurationKey(chargingStationConfiguration.configurationHash), + this.getChargingStationConfigurationKey(chargingStationConfiguration.configurationHash!), chargingStationConfiguration, ); } @@ -62,7 +62,7 @@ export class SharedLRUCache { public setChargingStationTemplate(chargingStationTemplate: ChargingStationTemplate): void { this.set( - this.getChargingStationTemplateKey(chargingStationTemplate.templateHash), + this.getChargingStationTemplateKey(chargingStationTemplate.templateHash!), chargingStationTemplate, ); } @@ -114,8 +114,8 @@ export class SharedLRUCache { isNullOrUndefined(chargingStationConfiguration?.automaticTransactionGenerator) === false && isNullOrUndefined(chargingStationConfiguration?.configurationHash) === false && isNotEmptyArray(chargingStationConfiguration?.configurationKey) === true && - isEmptyObject(chargingStationConfiguration?.stationInfo) === false && - isEmptyObject(chargingStationConfiguration?.automaticTransactionGenerator) === false && + isEmptyObject(chargingStationConfiguration.stationInfo!) === false && + isEmptyObject(chargingStationConfiguration.automaticTransactionGenerator!) === false && isNotEmptyString(chargingStationConfiguration?.configurationHash) === true ); } diff --git a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts index a7c6e4ad..c9c2d84a 100644 --- a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts @@ -48,10 +48,7 @@ type CommandResponse = | BootNotificationResponse | StatusNotificationResponse | HeartbeatResponse - | MeterValuesResponse - | DataTransferResponse - | DiagnosticsStatusNotificationResponse - | FirmwareStatusNotificationResponse; + | DataTransferResponse; type CommandHandler = ( requestPayload?: BroadcastChannelRequestPayload, @@ -114,7 +111,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne RequestCommand.STOP_TRANSACTION, { meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId( - requestPayload.transactionId, + requestPayload!.transactionId!, true, ), ...requestPayload, @@ -192,9 +189,9 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne // FIXME: Implement OCPP version agnostic helpers OCPP16ServiceUtils.buildMeterValue( this.chargingStation, - requestPayload.connectorId, - this.chargingStation.getConnectorStatus(requestPayload.connectorId) - ?.transactionId, + requestPayload!.connectorId!, + this.chargingStation.getConnectorStatus(requestPayload!.connectorId!)! + .transactionId!, configuredMeterValueSampleInterval ? convertToInt(configuredMeterValueSampleInterval.value) * 1000 : Constants.DEFAULT_METER_VALUES_INTERVAL, @@ -267,8 +264,8 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne ); return; } - let responsePayload: BroadcastChannelResponsePayload; - let commandResponse: CommandResponse | void; + let responsePayload: BroadcastChannelResponsePayload | undefined; + let commandResponse: CommandResponse | void | undefined; try { commandResponse = await this.commandHandler(command, requestPayload); if (isNullOrUndefined(commandResponse) || isEmptyObject(commandResponse as CommandResponse)) { @@ -299,7 +296,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne errorDetails: (error as OCPPError).details, }; } finally { - this.sendResponse([uuid, responsePayload]); + this.sendResponse([uuid, responsePayload!]); } } @@ -316,7 +313,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne ): Promise { if (this.commandHandlers.has(command) === true) { this.cleanRequestPayload(command, requestPayload); - return this.commandHandlers.get(command)(requestPayload); + return this.commandHandlers.get(command)!(requestPayload); } throw new BaseError(`Unknown worker broadcast channel command: ${command}`); } diff --git a/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts index 89058ceb..d94dfe24 100644 --- a/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts @@ -11,11 +11,11 @@ import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIServi const moduleName = 'UIServiceWorkerBroadcastChannel'; -type Responses = { +interface Responses { responsesExpected: number; responsesReceived: number; responses: BroadcastChannelResponsePayload[]; -}; +} export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel { private readonly uiService: AbstractUIService; @@ -45,9 +45,9 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel { responses: [responsePayload], }); } else if ( - this.responses.get(uuid)?.responsesReceived <= this.responses.get(uuid)?.responsesExpected + this.responses.get(uuid)!.responsesReceived <= this.responses.get(uuid)!.responsesExpected ) { - ++this.responses.get(uuid).responsesReceived; + ++this.responses.get(uuid)!.responsesReceived; this.responses.get(uuid)?.responses.push(responsePayload); } if ( @@ -75,7 +75,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel { if (status === ResponseStatus.SUCCESS) { return hashId; } - }), + }) as string[], ...(responsesStatus === ResponseStatus.FAILURE && { hashIdsFailed: this.responses .get(uuid) @@ -84,7 +84,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel { if (status === ResponseStatus.FAILURE) { return hashId; } - }), + }) as string[], }), ...(responsesStatus === ResponseStatus.FAILURE && { responsesFailed: this.responses @@ -94,7 +94,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel { if (response.status === ResponseStatus.FAILURE) { return response; } - }), + }) as BroadcastChannelResponsePayload[], }), }; } diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index c9400e66..b151dc5a 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -341,7 +341,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { try { this.validatePayload(chargingStation, commandName, commandPayload); // Call the method to build the response - response = await this.incomingRequestHandlers.get(commandName)( + response = await this.incomingRequestHandlers.get(commandName)!( chargingStation, commandPayload, ); @@ -397,7 +397,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { return this.validateIncomingRequestPayload( chargingStation, commandName, - this.jsonSchemas.get(commandName), + this.jsonSchemas.get(commandName)!, commandPayload, ); } @@ -425,7 +425,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { `${chargingStation.logPrefix()} ${ commandPayload.type } reset command received, simulating it. The station will be - back online in ${formatDurationMilliSeconds(chargingStation.stationInfo.resetTime)}`, + back online in ${formatDurationMilliSeconds(chargingStation.stationInfo.resetTime!)}`, ); return OCPP16Constants.OCPP_RESPONSE_ACCEPTED; } @@ -472,7 +472,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ): GetConfigurationResponse { const configurationKey: OCPPConfigurationKey[] = []; const unknownKey: string[] = []; - if (isUndefined(commandPayload.key) === true) { + if ( + chargingStation.ocppConfiguration?.configurationKey && + isUndefined(commandPayload.key) === true + ) { for (const configuration of chargingStation.ocppConfiguration.configurationKey) { if (isUndefined(configuration.visible) === true) { configuration.visible = true; @@ -486,7 +489,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { value: configuration.value, }); } - } else if (isNotEmptyArray(commandPayload.key) === true) { + } else if (commandPayload.key && isNotEmptyArray(commandPayload.key) === true) { for (const key of commandPayload.key) { const keyFound = ChargingStationConfigurationUtils.getConfigurationKey( chargingStation, @@ -525,9 +528,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { commandPayload.key, true, ); - if (!keyToChange) { - return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED; - } else if (keyToChange?.readonly === true) { + if (keyToChange?.readonly === true) { return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_REJECTED; } else if (keyToChange?.readonly === false) { let valueChanged = false; @@ -541,7 +542,11 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { valueChanged = true; } let triggerHeartbeatRestart = false; - if (keyToChange.key === OCPP16StandardParametersKey.HeartBeatInterval && valueChanged) { + if ( + (keyToChange.key as OCPP16StandardParametersKey) === + OCPP16StandardParametersKey.HeartBeatInterval && + valueChanged + ) { ChargingStationConfigurationUtils.setConfigurationKeyValue( chargingStation, OCPP16StandardParametersKey.HeartbeatInterval, @@ -549,7 +554,11 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ); triggerHeartbeatRestart = true; } - if (keyToChange.key === OCPP16StandardParametersKey.HeartbeatInterval && valueChanged) { + if ( + (keyToChange.key as OCPP16StandardParametersKey) === + OCPP16StandardParametersKey.HeartbeatInterval && + valueChanged + ) { ChargingStationConfigurationUtils.setConfigurationKeyValue( chargingStation, OCPP16StandardParametersKey.HeartBeatInterval, @@ -560,7 +569,11 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { if (triggerHeartbeatRestart) { chargingStation.restartHeartbeat(); } - if (keyToChange.key === OCPP16StandardParametersKey.WebSocketPingInterval && valueChanged) { + if ( + (keyToChange.key as OCPP16StandardParametersKey) === + OCPP16StandardParametersKey.WebSocketPingInterval && + valueChanged + ) { chargingStation.restartWebSocketPing(); } if (keyToChange.reboot) { @@ -568,6 +581,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_ACCEPTED; } + return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED; } private handleRequestSetChargingProfile( @@ -632,7 +646,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { OCPP16ServiceUtils.checkFeatureProfile( chargingStation, OCPP16SupportedFeatureProfiles.SmartCharging, - OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE, + OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE, ) === false ) { return OCPP16Constants.OCPP_RESPONSE_REJECTED; @@ -651,13 +665,13 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } const startDate = new Date(); const endDate = new Date(startDate.getTime() + commandPayload.duration * 1000); - let compositeSchedule: OCPP16ChargingSchedule; - for (const chargingProfile of chargingStation.getConnectorStatus(commandPayload.connectorId) - .chargingProfiles) { + let compositeSchedule: OCPP16ChargingSchedule | undefined; + for (const chargingProfile of chargingStation.getConnectorStatus(commandPayload.connectorId)! + .chargingProfiles!) { // FIXME: build the composite schedule including the local power limit, the stack level, the charging rate unit, etc. if ( - chargingProfile.chargingSchedule?.startSchedule >= startDate && - chargingProfile.chargingSchedule?.startSchedule <= endDate + chargingProfile.chargingSchedule.startSchedule! >= startDate && + chargingProfile.chargingSchedule.startSchedule! <= endDate ) { compositeSchedule = chargingProfile.chargingSchedule; break; @@ -684,7 +698,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ) { return OCPP16Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN; } - if (chargingStation.hasConnector(commandPayload.connectorId) === false) { + if (chargingStation.hasConnector(commandPayload.connectorId!) === false) { logger.error( `${chargingStation.logPrefix()} Trying to clear a charging profile(s) to a non existing connector id ${commandPayload.connectorId}`, @@ -694,10 +708,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { if ( !isNullOrUndefined(commandPayload.connectorId) && isNotEmptyArray( - chargingStation.getConnectorStatus(commandPayload.connectorId)?.chargingProfiles, + chargingStation.getConnectorStatus(commandPayload.connectorId!)?.chargingProfiles, ) ) { - chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles = []; + chargingStation.getConnectorStatus(commandPayload.connectorId!)!.chargingProfiles = []; logger.debug( `${chargingStation.logPrefix()} Charging profile(s) cleared on connector id ${ commandPayload.connectorId @@ -753,7 +767,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } } else { for (const connectorId of chargingStation.connectors.keys()) { - clearChargingProfiles(chargingStation.getConnectorStatus(connectorId)); + clearChargingProfiles(chargingStation.getConnectorStatus(connectorId)!); } } if (clearedCP) { @@ -803,7 +817,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } } else { for (const id of chargingStation.connectors.keys()) { - await changeAvailability(id, chargingStation.getConnectorStatus(id)); + await changeAvailability(id, chargingStation.getConnectorStatus(id)!); } } return response; @@ -814,10 +828,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { commandPayload.type === OCPP16AvailabilityType.Inoperative)) ) { if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) { - chargingStation.getConnectorStatus(connectorId).availability = commandPayload.type; + chargingStation.getConnectorStatus(connectorId)!.availability = commandPayload.type; return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_SCHEDULED; } - chargingStation.getConnectorStatus(connectorId).availability = commandPayload.type; + chargingStation.getConnectorStatus(connectorId)!.availability = commandPayload.type; await OCPP16ServiceUtils.sendAndSetConnectorStatus( chargingStation, connectorId, @@ -834,10 +848,10 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ): Promise { const { connectorId: transactionConnectorId, idTag, chargingProfile } = commandPayload; const reserved = - chargingStation.getConnectorStatus(transactionConnectorId).status === + chargingStation.getConnectorStatus(transactionConnectorId)!.status === OCPP16ChargePointStatus.Reserved; const reservedOnConnectorZero = - chargingStation.getConnectorStatus(0).status === OCPP16ChargePointStatus.Reserved; + chargingStation.getConnectorStatus(0)!.status === OCPP16ChargePointStatus.Reserved; if ( (reserved && !chargingStation.validateIncomingRequestWithReservation(transactionConnectorId, idTag)) || @@ -871,7 +885,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { transactionConnectorId, OCPP16ChargePointStatus.Preparing, ); - const connectorStatus = chargingStation.getConnectorStatus(transactionConnectorId); + const connectorStatus = chargingStation.getConnectorStatus(transactionConnectorId)!; // Check if authorized if ( chargingStation.getAuthorizeRemoteTxRequests() && @@ -882,7 +896,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { this.setRemoteStartTransactionChargingProfile( chargingStation, transactionConnectorId, - chargingProfile, + chargingProfile!, ) === true ) { connectorStatus.transactionRemoteStarted = true; @@ -894,7 +908,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { const reservation = chargingStation.getReservationBy( ReservationFilterKey.CONNECTOR_ID, reservedOnConnectorZero ? 0 : transactionConnectorId, - ); + )!; startTransactionPayload.reservationId = reservation.id; await chargingStation.removeReservation( reservation, @@ -929,7 +943,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { this.setRemoteStartTransactionChargingProfile( chargingStation, transactionConnectorId, - chargingProfile, + chargingProfile!, ) === true ) { connectorStatus.transactionRemoteStarted = true; @@ -1003,9 +1017,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } charging profile(s) at remote start transaction`, ); return false; - } else if (!cp) { - return true; } + return true; } private async handleRequestRemoteStopTransaction( @@ -1082,7 +1095,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ); return OCPP16Constants.OCPP_RESPONSE_EMPTY; } - const retrieveDate = convertToDate(commandPayload.retrieveDate); + const retrieveDate = convertToDate(commandPayload.retrieveDate)!; const now = Date.now(); if (retrieveDate?.getTime() <= now) { this.runInAsyncScope( @@ -1276,7 +1289,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } const uri = new URL(commandPayload.location); if (uri.protocol.startsWith('ftp:')) { - let ftpClient: Client; + let ftpClient: Client | undefined; try { const logFiles = readdirSync(resolve(dirname(fileURLToPath(import.meta.url)), '../')) .filter((file) => file.endsWith('.log')) @@ -1290,7 +1303,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ...(isNotEmptyString(uri.username) && { user: uri.username }), ...(isNotEmptyString(uri.password) && { password: uri.password }), }); - let uploadResponse: FTPResponse; + let uploadResponse: FTPResponse | undefined; if (accessResponse.code === 220) { ftpClient.trackProgress((info) => { logger.info( @@ -1354,12 +1367,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { if (ftpClient) { ftpClient.close(); } - return this.handleIncomingRequestError( + return this.handleIncomingRequestError( chargingStation, OCPP16IncomingRequestCommand.GET_DIAGNOSTICS, error as Error, { errorResponse: OCPP16Constants.OCPP_RESPONSE_EMPTY }, - ); + )!; } } else { logger.error( @@ -1398,7 +1411,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { !OCPP16ServiceUtils.isConnectorIdValid( chargingStation, OCPP16IncomingRequestCommand.TRIGGER_MESSAGE, - commandPayload.connectorId, + commandPayload.connectorId!, ) ) { return OCPP16Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED; @@ -1444,7 +1457,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { { connectorId: commandPayload.connectorId, errorCode: OCPP16ChargePointErrorCode.NO_ERROR, - status: chargingStation.getConnectorStatus(commandPayload.connectorId)?.status, + status: chargingStation.getConnectorStatus(commandPayload.connectorId!)?.status, }, { triggerMessage: true, @@ -1503,12 +1516,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { return OCPP16Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED; } } catch (error) { - return this.handleIncomingRequestError( + return this.handleIncomingRequestError( chargingStation, OCPP16IncomingRequestCommand.TRIGGER_MESSAGE, error as Error, { errorResponse: OCPP16Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED }, - ); + )!; } } @@ -1522,12 +1535,12 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } return OCPP16Constants.OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID; } catch (error) { - return this.handleIncomingRequestError( + return this.handleIncomingRequestError( chargingStation, OCPP16IncomingRequestCommand.DATA_TRANSFER, error as Error, { errorResponse: OCPP16Constants.OCPP_DATA_TRANSFER_RESPONSE_REJECTED }, - ); + )!; } } @@ -1556,7 +1569,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { if (!(await OCPP16ServiceUtils.isIdTagAuthorized(chargingStation, connectorId, idTag))) { return OCPP16Constants.OCPP_RESERVATION_RESPONSE_REJECTED; } - switch (chargingStation.getConnectorStatus(connectorId).status) { + switch (chargingStation.getConnectorStatus(connectorId)!.status) { case OCPP16ChargePointStatus.Faulted: response = OCPP16Constants.OCPP_RESERVATION_RESPONSE_FAULTED; break; @@ -1590,13 +1603,13 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } return response; } catch (error) { - chargingStation.getConnectorStatus(connectorId).status = OCPP16ChargePointStatus.Available; - return this.handleIncomingRequestError( + chargingStation.getConnectorStatus(connectorId)!.status = OCPP16ChargePointStatus.Available; + return this.handleIncomingRequestError( chargingStation, OCPP16IncomingRequestCommand.RESERVE_NOW, error as Error, { errorResponse: OCPP16Constants.OCPP_RESERVATION_RESPONSE_FAULTED }, - ); + )!; } } @@ -1624,17 +1637,17 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { return OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED; } await chargingStation.removeReservation( - reservation, + reservation!, ReservationTerminationReason.RESERVATION_CANCELED, ); return OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_ACCEPTED; } catch (error) { - return this.handleIncomingRequestError( + return this.handleIncomingRequestError( chargingStation, OCPP16IncomingRequestCommand.CANCEL_RESERVATION, error as Error, { errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED }, - ); + )!; } } } diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index c601b85d..ac1c1ac3 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -157,7 +157,7 @@ export class OCPP16RequestService extends OCPPRequestService { commandName: OCPP16RequestCommand, commandParams?: JsonType, ): Request { - let connectorId: number; + let connectorId: number | undefined; let energyActiveImportRegister: number; commandParams = commandParams as JsonObject; switch (commandName) { @@ -189,7 +189,7 @@ export class OCPP16RequestService extends OCPPRequestService { chargingStation.getTransactionDataMeterValues() && (connectorId = chargingStation.getConnectorIdByTransactionId( commandParams?.transactionId as number, - )); + )!); energyActiveImportRegister = chargingStation.getEnergyActiveImportRegisterByTransactionId( commandParams?.transactionId as number, true, @@ -200,10 +200,10 @@ export class OCPP16RequestService extends OCPPRequestService { timestamp: new Date(), ...(chargingStation.getTransactionDataMeterValues() && { transactionData: OCPP16ServiceUtils.buildTransactionDataMeterValues( - chargingStation.getConnectorStatus(connectorId).transactionBeginMeterValue, + chargingStation.getConnectorStatus(connectorId!)!.transactionBeginMeterValue!, OCPP16ServiceUtils.buildTransactionEndMeterValue( chargingStation, - connectorId, + connectorId!, energyActiveImportRegister, ), ), diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 2550dde9..8ebce4f8 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -330,7 +330,7 @@ export class OCPP16ResponseService extends OCPPResponseService { ) { try { this.validatePayload(chargingStation, commandName, payload); - await this.responseHandlers.get(commandName)(chargingStation, payload, requestPayload); + await this.responseHandlers.get(commandName)!(chargingStation, payload, requestPayload); } catch (error) { logger.error( `${chargingStation.logPrefix()} ${moduleName}.responseHandler: Handle response error:`, @@ -374,7 +374,7 @@ export class OCPP16ResponseService extends OCPPResponseService { return this.validateResponsePayload( chargingStation, commandName, - this.jsonSchemas.get(commandName), + this.jsonSchemas.get(commandName)!, payload, ); } @@ -425,7 +425,7 @@ export class OCPP16ResponseService extends OCPPResponseService { payload: OCPP16AuthorizeResponse, requestPayload: OCPP16AuthorizeRequest, ): void { - let authorizeConnectorId: number; + let authorizeConnectorId: number | undefined; if (chargingStation.hasEvses) { for (const [evseId, evseStatus] of chargingStation.evses) { if (evseId > 0) { @@ -451,7 +451,7 @@ export class OCPP16ResponseService extends OCPPResponseService { const authorizeConnectorIdDefined = !isNullOrUndefined(authorizeConnectorId); if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) { authorizeConnectorIdDefined && - (chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true); + (chargingStation.getConnectorStatus(authorizeConnectorId!)!.idTagAuthorized = true); logger.debug( `${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' accepted${ authorizeConnectorIdDefined ? ` on connector id ${authorizeConnectorId}` : '' @@ -459,8 +459,8 @@ export class OCPP16ResponseService extends OCPPResponseService { ); } else { if (authorizeConnectorIdDefined) { - chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = false; - delete chargingStation.getConnectorStatus(authorizeConnectorId)?.authorizeIdTag; + chargingStation.getConnectorStatus(authorizeConnectorId!)!.idTagAuthorized = false; + delete chargingStation.getConnectorStatus(authorizeConnectorId!)?.authorizeIdTag; } logger.debug( `${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' rejected with status '${ @@ -599,15 +599,15 @@ export class OCPP16ResponseService extends OCPPResponseService { } if (payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) { - chargingStation.getConnectorStatus(transactionConnectorId).transactionStarted = true; - chargingStation.getConnectorStatus(transactionConnectorId).transactionId = + chargingStation.getConnectorStatus(transactionConnectorId)!.transactionStarted = true; + chargingStation.getConnectorStatus(transactionConnectorId)!.transactionId = payload.transactionId; - chargingStation.getConnectorStatus(transactionConnectorId).transactionIdTag = + chargingStation.getConnectorStatus(transactionConnectorId)!.transactionIdTag = requestPayload.idTag; chargingStation.getConnectorStatus( transactionConnectorId, - ).transactionEnergyActiveImportRegisterValue = 0; - chargingStation.getConnectorStatus(transactionConnectorId).transactionBeginMeterValue = + )!.transactionEnergyActiveImportRegisterValue = 0; + chargingStation.getConnectorStatus(transactionConnectorId)!.transactionBeginMeterValue = OCPP16ServiceUtils.buildTransactionBeginMeterValue( chargingStation, transactionConnectorId, @@ -621,9 +621,9 @@ export class OCPP16ResponseService extends OCPPResponseService { connectorId: transactionConnectorId, transactionId: payload.transactionId, meterValue: [ - chargingStation.getConnectorStatus(transactionConnectorId).transactionBeginMeterValue, + chargingStation.getConnectorStatus(transactionConnectorId)!.transactionBeginMeterValue, ], - })); + } as OCPP16MeterValuesRequest)); await OCPP16ServiceUtils.sendAndSetConnectorStatus( chargingStation, transactionConnectorId, @@ -661,7 +661,7 @@ export class OCPP16ResponseService extends OCPPResponseService { chargingStation: ChargingStation, connectorId: number, ): Promise { - resetConnectorStatus(chargingStation.getConnectorStatus(connectorId)); + resetConnectorStatus(chargingStation.getConnectorStatus(connectorId)!); chargingStation.stopMeterValues(connectorId); parentPort?.postMessage(buildUpdatedMessage(chargingStation)); if ( @@ -701,32 +701,32 @@ export class OCPP16ResponseService extends OCPPResponseService { meterValue: [ OCPP16ServiceUtils.buildTransactionEndMeterValue( chargingStation, - transactionConnectorId, + transactionConnectorId!, requestPayload.meterStop, ), ], })); if ( chargingStation.isChargingStationAvailable() === false || - chargingStation.isConnectorAvailable(transactionConnectorId) === false + chargingStation.isConnectorAvailable(transactionConnectorId!) === false ) { await OCPP16ServiceUtils.sendAndSetConnectorStatus( chargingStation, - transactionConnectorId, + transactionConnectorId!, OCPP16ChargePointStatus.Unavailable, ); } else { await OCPP16ServiceUtils.sendAndSetConnectorStatus( chargingStation, - transactionConnectorId, + transactionConnectorId!, OCPP16ChargePointStatus.Available, ); } if (chargingStation.stationInfo.powerSharedByConnectors) { chargingStation.powerDivider--; } - resetConnectorStatus(chargingStation.getConnectorStatus(transactionConnectorId)); - chargingStation.stopMeterValues(transactionConnectorId); + resetConnectorStatus(chargingStation.getConnectorStatus(transactionConnectorId!)!); + chargingStation.stopMeterValues(transactionConnectorId!); parentPort?.postMessage(buildUpdatedMessage(chargingStation)); const logMsg = `${chargingStation.logPrefix()} Transaction with id ${requestPayload.transactionId.toString()} STOPPED on ${ chargingStation.stationInfo.chargingStationId diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index c85ecdd3..f65e0c6e 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -5,6 +5,7 @@ import type { JSONSchemaType } from 'ajv'; import { type ChargingStation, getIdTagsFile } from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { + type ConnectorStatus, CurrentType, ErrorType, type JsonType, @@ -147,7 +148,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { OCPP16MeterValueMeasurand.VOLTAGE, phaseLineToNeutralValue as OCPP16MeterValuePhase, ); - let voltagePhaseLineToNeutralMeasurandValue: number; + let voltagePhaseLineToNeutralMeasurandValue: number | undefined; if (voltagePhaseLineToNeutralSampledValueTemplate) { const voltagePhaseLineToNeutralSampledValueTemplateValue = voltagePhaseLineToNeutralSampledValueTemplate.value @@ -182,7 +183,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { OCPP16MeterValueMeasurand.VOLTAGE, phaseLineToLineValue as OCPP16MeterValuePhase, ); - let voltagePhaseLineToLineMeasurandValue: number; + let voltagePhaseLineToLineMeasurandValue: number | undefined; if (voltagePhaseLineToLineSampledValueTemplate) { const voltagePhaseLineToLineSampledValueTemplateValue = voltagePhaseLineToLineSampledValueTemplate.value @@ -243,7 +244,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { if (powerSampledValueTemplate) { OCPP16ServiceUtils.checkMeasurandPowerDivider( chargingStation, - powerSampledValueTemplate.measurand, + powerSampledValueTemplate.measurand!, ); const errMsg = `MeterValues measurand ${ powerSampledValueTemplate.measurand ?? @@ -254,7 +255,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { powerSampledValueTemplate.measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER } measurand value`; - const powerMeasurandValues = {} as MeasurandValues; + const powerMeasurandValues: MeasurandValues = {} as MeasurandValues; const unitDivider = powerSampledValueTemplate?.unit === MeterValueUnit.KILO_WATT ? 1000 : 1; const connectorMaximumAvailablePower = chargingStation.getConnectorMaximumAvailablePower(connectorId); @@ -262,7 +263,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { const connectorMaximumPowerPerPhase = Math.round( connectorMaximumAvailablePower / chargingStation.getNumberOfPhases(), ); - const connectorMinimumPower = Math.round(powerSampledValueTemplate.minimumValue) ?? 0; + const connectorMinimumPower = Math.round(powerSampledValueTemplate.minimumValue!) ?? 0; const connectorMinimumPowerPerPhase = Math.round( connectorMinimumPower / chargingStation.getNumberOfPhases(), ); @@ -281,7 +282,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase1FluctuatedValue = - powerPerPhaseSampledValueTemplates?.L1?.value && + powerPerPhaseSampledValueTemplates.L1?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( powerPerPhaseSampledValueTemplates.L1.value, @@ -292,7 +293,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase2FluctuatedValue = - powerPerPhaseSampledValueTemplates?.L2?.value && + powerPerPhaseSampledValueTemplates.L2?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( powerPerPhaseSampledValueTemplates.L2.value, @@ -303,7 +304,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase3FluctuatedValue = - powerPerPhaseSampledValueTemplates?.L3?.value && + powerPerPhaseSampledValueTemplates.L3?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( powerPerPhaseSampledValueTemplates.L3.value, @@ -314,22 +315,22 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); powerMeasurandValues.L1 = - phase1FluctuatedValue ?? - defaultFluctuatedPowerPerPhase ?? + (phase1FluctuatedValue as number) ?? + (defaultFluctuatedPowerPerPhase as number) ?? getRandomFloatRounded( connectorMaximumPowerPerPhase / unitDivider, connectorMinimumPowerPerPhase / unitDivider, ); powerMeasurandValues.L2 = - phase2FluctuatedValue ?? - defaultFluctuatedPowerPerPhase ?? + (phase2FluctuatedValue as number) ?? + (defaultFluctuatedPowerPerPhase as number) ?? getRandomFloatRounded( connectorMaximumPowerPerPhase / unitDivider, connectorMinimumPowerPerPhase / unitDivider, ); powerMeasurandValues.L3 = - phase3FluctuatedValue ?? - defaultFluctuatedPowerPerPhase ?? + (phase3FluctuatedValue as number) ?? + (defaultFluctuatedPowerPerPhase as number) ?? getRandomFloatRounded( connectorMaximumPowerPerPhase / unitDivider, connectorMinimumPowerPerPhase / unitDivider, @@ -478,7 +479,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { if (currentSampledValueTemplate) { OCPP16ServiceUtils.checkMeasurandPowerDivider( chargingStation, - currentSampledValueTemplate.measurand, + currentSampledValueTemplate.measurand!, ); const errMsg = `MeterValues measurand ${ currentSampledValueTemplate.measurand ?? @@ -514,7 +515,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase1FluctuatedValue = - currentPerPhaseSampledValueTemplates?.L1?.value && + currentPerPhaseSampledValueTemplates.L1?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( currentPerPhaseSampledValueTemplates.L1.value, @@ -525,7 +526,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase2FluctuatedValue = - currentPerPhaseSampledValueTemplates?.L2?.value && + currentPerPhaseSampledValueTemplates.L2?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( currentPerPhaseSampledValueTemplates.L2.value, @@ -536,7 +537,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); const phase3FluctuatedValue = - currentPerPhaseSampledValueTemplates?.L3?.value && + currentPerPhaseSampledValueTemplates.L3?.value && getRandomFloatFluctuatedRounded( OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue( currentPerPhaseSampledValueTemplates.L3.value, @@ -547,16 +548,16 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { Constants.DEFAULT_FLUCTUATION_PERCENT, ); currentMeasurandValues.L1 = - phase1FluctuatedValue ?? - defaultFluctuatedAmperagePerPhase ?? + (phase1FluctuatedValue as number) ?? + (defaultFluctuatedAmperagePerPhase as number) ?? getRandomFloatRounded(connectorMaximumAmperage, connectorMinimumAmperage); currentMeasurandValues.L2 = - phase2FluctuatedValue ?? - defaultFluctuatedAmperagePerPhase ?? + (phase2FluctuatedValue as number) ?? + (defaultFluctuatedAmperagePerPhase as number) ?? getRandomFloatRounded(connectorMaximumAmperage, connectorMinimumAmperage); currentMeasurandValues.L3 = - phase3FluctuatedValue ?? - defaultFluctuatedAmperagePerPhase ?? + (phase3FluctuatedValue as number) ?? + (defaultFluctuatedAmperagePerPhase as number) ?? getRandomFloatRounded(connectorMaximumAmperage, connectorMinimumAmperage); } else { currentMeasurandValues.L1 = currentSampledValueTemplate.value @@ -667,7 +668,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { if (energySampledValueTemplate) { OCPP16ServiceUtils.checkMeasurandPowerDivider( chargingStation, - energySampledValueTemplate.measurand, + energySampledValueTemplate.measurand!, ); const unitDivider = energySampledValueTemplate?.unit === MeterValueUnit.KILO_WATT_HOUR ? 1000 : 1; @@ -692,18 +693,19 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { ) : getRandomFloatRounded(connectorMaximumEnergyRounded); // Persist previous value on connector - if ( - connector && - isNullOrUndefined(connector.energyActiveImportRegisterValue) === false && - connector.energyActiveImportRegisterValue >= 0 && - isNullOrUndefined(connector.transactionEnergyActiveImportRegisterValue) === false && - connector.transactionEnergyActiveImportRegisterValue >= 0 - ) { - connector.energyActiveImportRegisterValue += energyValueRounded; - connector.transactionEnergyActiveImportRegisterValue += energyValueRounded; - } else { - connector.energyActiveImportRegisterValue = 0; - connector.transactionEnergyActiveImportRegisterValue = 0; + if (connector) { + if ( + isNullOrUndefined(connector.energyActiveImportRegisterValue) === false && + connector.energyActiveImportRegisterValue! >= 0 && + isNullOrUndefined(connector.transactionEnergyActiveImportRegisterValue) === false && + connector.transactionEnergyActiveImportRegisterValue! >= 0 + ) { + connector.energyActiveImportRegisterValue! += energyValueRounded; + connector.transactionEnergyActiveImportRegisterValue! += energyValueRounded; + } else { + connector.energyActiveImportRegisterValue = 0; + connector.transactionEnergyActiveImportRegisterValue = 0; + } } meterValue.sampledValue.push( OCPP16ServiceUtils.buildSampledValue( @@ -748,7 +750,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { const unitDivider = sampledValueTemplate?.unit === MeterValueUnit.KILO_WATT_HOUR ? 1000 : 1; meterValue.sampledValue.push( OCPP16ServiceUtils.buildSampledValue( - sampledValueTemplate, + sampledValueTemplate!, roundTo((meterStart ?? 0) / unitDivider, 4), MeterValueContext.TRANSACTION_BEGIN, ), @@ -773,7 +775,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { const unitDivider = sampledValueTemplate?.unit === MeterValueUnit.KILO_WATT_HOUR ? 1000 : 1; meterValue.sampledValue.push( OCPP16ServiceUtils.buildSampledValue( - sampledValueTemplate, + sampledValueTemplate!, roundTo((meterStop ?? 0) / unitDivider, 4), MeterValueContext.TRANSACTION_END, ), @@ -800,7 +802,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { 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.getConnectorStatus(connectorId).chargingProfiles = []; + chargingStation.getConnectorStatus(connectorId)!.chargingProfiles = []; } if ( Array.isArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles) === false @@ -808,7 +810,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { 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 initialization`, ); - chargingStation.getConnectorStatus(connectorId).chargingProfiles = []; + chargingStation.getConnectorStatus(connectorId)!.chargingProfiles = []; } let cpReplaced = false; if (isNotEmptyArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)) { @@ -820,7 +822,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { (chargingProfile.stackLevel === cp.stackLevel && chargingProfile.chargingProfilePurpose === cp.chargingProfilePurpose) ) { - chargingStation.getConnectorStatus(connectorId).chargingProfiles[index] = cp; + chargingStation.getConnectorStatus(connectorId)!.chargingProfiles![index] = cp; cpReplaced = true; } }); @@ -847,7 +849,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { idTag: string, ): Promise { let authorized = false; - const connectorStatus = chargingStation.getConnectorStatus(connectorId); + const connectorStatus: ConnectorStatus = chargingStation.getConnectorStatus(connectorId)!; if (OCPP16ServiceUtils.isIdTagLocalAuthorized(chargingStation, idTag)) { connectorStatus.localAuthorizeIdTag = idTag; connectorStatus.idTagLocalAuthorized = true; @@ -874,7 +876,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { const sampledValueContext = context ?? sampledValueTemplate?.context ?? null; const sampledValueLocation = sampledValueTemplate?.location ?? - OCPP16ServiceUtils.getMeasurandDefaultLocation(sampledValueTemplate?.measurand ?? null); + OCPP16ServiceUtils.getMeasurandDefaultLocation(sampledValueTemplate.measurand!); const sampledValuePhase = phase ?? sampledValueTemplate?.phase ?? null; return { ...(!isNullOrUndefined(sampledValueTemplate.unit) && { @@ -887,7 +889,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { ...(!isNullOrUndefined(sampledValueLocation) && { location: sampledValueLocation }), ...(!isNullOrUndefined(sampledValueValue) && { value: sampledValueValue.toString() }), ...(!isNullOrUndefined(sampledValuePhase) && { phase: sampledValuePhase }), - }; + } as OCPP16SampledValue; } private static checkMeasurandPowerDivider( @@ -946,7 +948,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { chargingStation.hasIdTags() === true && isNotEmptyString( chargingStation.idTagsCache - .getIdTags(getIdTagsFile(chargingStation.stationInfo)) + .getIdTags(getIdTagsFile(chargingStation.stationInfo)!) ?.find((tag) => tag === idTag), ) ); diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 6cfb4ec1..23ea8c81 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -84,7 +84,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService { try { this.validatePayload(chargingStation, commandName, commandPayload); // Call the method to build the response - response = await this.incomingRequestHandlers.get(commandName)( + response = await this.incomingRequestHandlers.get(commandName)!( chargingStation, commandPayload, ); @@ -139,7 +139,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService { return this.validateIncomingRequestPayload( chargingStation, commandName, - this.jsonSchemas.get(commandName), + this.jsonSchemas.get(commandName)!, commandPayload, ); } diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index aefd93dc..1eec885f 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -103,7 +103,7 @@ export class OCPP20ResponseService extends OCPPResponseService { ) { try { this.validatePayload(chargingStation, commandName, payload); - await this.responseHandlers.get(commandName)(chargingStation, payload, requestPayload); + await this.responseHandlers.get(commandName)!(chargingStation, payload, requestPayload); } catch (error) { logger.error( `${chargingStation.logPrefix()} ${moduleName}.responseHandler: Handle response error:`, @@ -147,7 +147,7 @@ export class OCPP20ResponseService extends OCPPResponseService { return this.validateResponsePayload( chargingStation, commandName, - this.jsonSchemas.get(commandName), + this.jsonSchemas.get(commandName)!, payload, ); } diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index d364f7aa..0ea55a63 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -96,7 +96,7 @@ export abstract class OCPPIncomingRequestService extends AsyncResource { validate.errors, ); throw new OCPPError( - OCPPServiceUtils.ajvErrorsToErrorType(validate.errors), + OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!), 'Incoming request PDU is invalid', commandName, JSON.stringify(validate.errors, null, 2), @@ -104,7 +104,7 @@ export abstract class OCPPIncomingRequestService extends AsyncResource { } protected handleRequestClearCache(chargingStation: ChargingStation): ClearCacheResponse { - if (chargingStation.idTagsCache.deleteIdTags(getIdTagsFile(chargingStation.stationInfo))) { + if (chargingStation.idTagsCache.deleteIdTags(getIdTagsFile(chargingStation.stationInfo)!)) { return OCPPConstants.OCPP_RESPONSE_ACCEPTED; } return OCPPConstants.OCPP_RESPONSE_REJECTED; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 6d0809c5..4e094a21 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -55,6 +55,7 @@ export abstract class OCPPRequestService { ajvFormats(this.ajv); this.ocppResponseService = ocppResponseService; this.requestHandler = this.requestHandler.bind(this) as < + // eslint-disable-next-line @typescript-eslint/no-unused-vars ReqType extends JsonType, ResType extends JsonType, >( @@ -142,6 +143,7 @@ export abstract class OCPPRequestService { handleSendMessageError(chargingStation, commandName, error as Error, { throwError: true, }); + return null; } } @@ -162,6 +164,7 @@ export abstract class OCPPRequestService { ); } catch (error) { handleSendMessageError(chargingStation, commandName, error as Error); + return null; } } @@ -189,6 +192,7 @@ export abstract class OCPPRequestService { handleSendMessageError(chargingStation, commandName, error as Error, { throwError: params.throwError, }); + return null; } } @@ -206,7 +210,7 @@ export abstract class OCPPRequestService { ); return true; } - const validate = this.ajv.compile(this.jsonSchemas.get(commandName as RequestCommand)); + const validate = this.ajv.compile(this.jsonSchemas.get(commandName as RequestCommand)!); payload = cloneObject(payload); OCPPServiceUtils.convertDateToISOString(payload); if (validate(payload)) { @@ -218,7 +222,7 @@ export abstract class OCPPRequestService { ); // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError(). throw new OCPPError( - OCPPServiceUtils.ajvErrorsToErrorType(validate.errors), + OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!), 'Request PDU is invalid', commandName, JSON.stringify(validate.errors, null, 2), @@ -246,7 +250,7 @@ export abstract class OCPPRequestService { const validate = this.ajv.compile( this.ocppResponseService.jsonIncomingRequestResponseSchemas.get( commandName as IncomingRequestCommand, - ), + )!, ); payload = cloneObject(payload); OCPPServiceUtils.convertDateToISOString(payload); @@ -259,7 +263,7 @@ export abstract class OCPPRequestService { ); // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError(). throw new OCPPError( - OCPPServiceUtils.ajvErrorsToErrorType(validate.errors), + OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!), 'Response PDU is invalid', commandName, JSON.stringify(validate.errors, null, 2), @@ -492,6 +496,7 @@ export abstract class OCPPRequestService { public abstract requestHandler( chargingStation: ChargingStation, commandName: RequestCommand, + // FIXME: should be ReqType commandParams?: JsonType, params?: RequestParams, ): Promise; diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index b15b7cd6..b720c0f1 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -70,7 +70,7 @@ export abstract class OCPPResponseService { validate.errors, ); throw new OCPPError( - OCPPServiceUtils.ajvErrorsToErrorType(validate.errors), + OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!), 'Response PDU is invalid', commandName, JSON.stringify(validate.errors, null, 2), diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index f18db3e0..dcd74472 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -144,11 +144,11 @@ export class OCPPServiceUtils { } public static convertDateToISOString(obj: T): void { - for (const key in obj) { - if (obj[key] instanceof Date) { - (obj as JsonObject)[key] = (obj[key] as Date).toISOString(); - } else if (obj[key] !== null && typeof obj[key] === 'object') { - OCPPServiceUtils.convertDateToISOString(obj[key] as T); + for (const key in obj as JsonObject) { + if (obj![key] instanceof Date) { + obj![key] = (obj![key] as Date).toISOString(); + } else if (obj![key] !== null && typeof obj![key] === 'object') { + OCPPServiceUtils.convertDateToISOString(obj![key] as T); } } } @@ -192,7 +192,7 @@ export class OCPPServiceUtils { connectorId: number, status: ConnectorStatusEnum, evseId?: number, - options: { send: boolean } = { send: true }, + options?: { send: boolean }, ) { options = { send: true, ...options }; if (options.send) { @@ -211,7 +211,7 @@ export class OCPPServiceUtils { ), ); } - chargingStation.getConnectorStatus(connectorId).status = status; + chargingStation.getConnectorStatus(connectorId)!.status = status; } protected static checkConnectorStatusTransition( @@ -219,7 +219,7 @@ export class OCPPServiceUtils { connectorId: number, status: ConnectorStatusEnum, ): boolean { - const fromStatus = chargingStation.getConnectorStatus(connectorId).status; + const fromStatus = chargingStation.getConnectorStatus(connectorId)!.status; let transitionAllowed = false; switch (chargingStation.stationInfo.ocppVersion) { case OCPPVersion.VERSION_16: @@ -262,7 +262,7 @@ export class OCPPServiceUtils { `${chargingStation.logPrefix()} OCPP ${ chargingStation.stationInfo.ocppVersion } connector id ${connectorId} status transition from '${ - chargingStation.getConnectorStatus(connectorId).status + chargingStation.getConnectorStatus(connectorId)!.status }' to '${status}' is not allowed`, ); } @@ -286,6 +286,7 @@ export class OCPPServiceUtils { OCPPServiceUtils.logPrefix(ocppVersion, moduleName, methodName), { throwError: false }, ); + return {} as JSONSchemaType; } } @@ -317,7 +318,7 @@ export class OCPPServiceUtils { return; } const sampledValueTemplates: SampledValueTemplate[] = - chargingStation.getConnectorStatus(connectorId)?.MeterValues; + chargingStation.getConnectorStatus(connectorId)!.MeterValues; for ( let index = 0; isNotEmptyArray(sampledValueTemplates) === true && index < sampledValueTemplates.length; @@ -388,8 +389,8 @@ export class OCPPServiceUtils { const parsedInt = parseInt(value); const numberValue = isNaN(parsedInt) ? Infinity : parsedInt; return options?.limitationEnabled - ? Math.min(numberValue * options.unitMultiplier, limit) - : numberValue * options.unitMultiplier; + ? Math.min(numberValue * options.unitMultiplier!, limit) + : numberValue * options.unitMultiplier!; } private static logPrefix = ( diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index 8bd45e68..5dbe5b20 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -49,7 +49,9 @@ export abstract class AbstractUIServer { public async sendInternalRequest(request: ProtocolRequest): Promise { const protocolVersion = ProtocolVersion['0.0.1']; this.registerProtocolVersionUIService(protocolVersion); - return this.uiServices.get(protocolVersion)?.requestHandler(request); + return this.uiServices + .get(protocolVersion) + ?.requestHandler(request) as Promise; } public hasResponseHandler(id: string): boolean { diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index 32b82e9c..cb02d4a5 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -116,9 +116,9 @@ export class UIHttpServer extends AbstractUIServer { ); }); if (req.method === HttpMethods.POST) { - const bodyBuffer = []; + const bodyBuffer: Uint8Array[] = []; req - .on('data', (chunk) => { + .on('data', (chunk: Uint8Array) => { bodyBuffer.push(chunk); }) .on('end', () => { diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index 1bdd9dad..e0f4a78e 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -15,7 +15,7 @@ export class UIServerFactory { public static getUIServerImplementation( uiServerConfiguration?: UIServerConfiguration, ): AbstractUIServer | null { - if (UIServerUtils.isLoopback(uiServerConfiguration.options?.host) === false) { + if (UIServerUtils.isLoopback(uiServerConfiguration!.options!.host!) === false) { console.warn( chalk.yellow( 'Loopback address not detected in UI server configuration. This is not recommended.', diff --git a/src/charging-station/ui-server/UIServerUtils.ts b/src/charging-station/ui-server/UIServerUtils.ts index 2b0bf3de..79f8c34a 100644 --- a/src/charging-station/ui-server/UIServerUtils.ts +++ b/src/charging-station/ui-server/UIServerUtils.ts @@ -13,8 +13,8 @@ export class UIServerUtils { // eslint-disable-next-line @typescript-eslint/no-unused-vars request: IncomingMessage, ): string | false => { - let protocol: Protocol; - let version: ProtocolVersion; + let protocol: Protocol | undefined; + let version: ProtocolVersion | undefined; if (protocols.size === 0) { return false; } diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index 8306be0e..b28b6df7 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -176,10 +176,12 @@ export class UIWebSocketServer extends AbstractUIServer { // logger.debug( // `${this.logPrefix( // moduleName, - // 'validateRawDataRequest' - // )} Raw data received in string format: ${rawData.toString()}` + // 'validateRawDataRequest', + // // eslint-disable-next-line @typescript-eslint/no-base-to-string + // )} Raw data received in string format: ${rawData.toString()}`, // ); + // eslint-disable-next-line @typescript-eslint/no-base-to-string const request = JSON.parse(rawData.toString()) as ProtocolRequest; if (Array.isArray(request) === false) { diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 7da2b62f..fce93c8a 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -67,8 +67,8 @@ export abstract class AbstractUIService { } public async requestHandler(request: ProtocolRequest): Promise { - let messageId: string; - let command: ProcedureName; + let messageId: string | undefined; + let command: ProcedureName | undefined; let requestPayload: RequestPayload | undefined; let responsePayload: ResponsePayload | undefined; try { @@ -85,7 +85,11 @@ export abstract class AbstractUIService { } // Call the request handler to build the response payload - responsePayload = await this.requestHandlers.get(command)(messageId, command, requestPayload); + responsePayload = await this.requestHandlers.get(command)!( + messageId, + command, + requestPayload, + ); } catch (error) { // Log logger.error(`${this.logPrefix(moduleName, 'requestHandler')} Handle request error:`, error); @@ -101,7 +105,7 @@ export abstract class AbstractUIService { }; } if (!isNullOrUndefined(responsePayload)) { - return this.uiServer.buildProtocolResponse(messageId, responsePayload); + return this.uiServer.buildProtocolResponse(messageId!, responsePayload!); } } @@ -154,8 +158,8 @@ export abstract class AbstractUIService { ): void { if (isNotEmptyArray(payload.hashIds)) { payload.hashIds = payload.hashIds - .filter((hashId) => !isNullOrUndefined(hashId)) - .map((hashId) => { + ?.filter((hashId) => !isNullOrUndefined(hashId)) + ?.map((hashId) => { if (this.uiServer.chargingStations.has(hashId) === true) { return hashId; } @@ -165,10 +169,10 @@ export abstract class AbstractUIService { 'sendBroadcastChannelRequest', )} Charging station with hashId '${hashId}' not found`, ); - }); + }) as string[]; } const expectedNumberOfResponses = isNotEmptyArray(payload.hashIds) - ? payload.hashIds.length + ? payload.hashIds!.length : this.uiServer.chargingStations.size; this.uiServiceWorkerBroadcastChannel.sendRequest([uuid, procedureName, payload]); this.broadcastChannelRequests.set(uuid, expectedNumberOfResponses); diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 9672b381..4b19e1d7 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -37,7 +37,7 @@ export class PerformanceStatistics { private readonly objName: string; private performanceObserver!: PerformanceObserver; private readonly statistics: Statistics; - private displayInterval!: NodeJS.Timeout; + private displayInterval?: NodeJS.Timeout; private constructor(objId: string, objName: string, uri: URL) { this.objId = objId; @@ -85,7 +85,7 @@ export class PerformanceStatistics { this.statistics.statisticsData.has(command) && this.statistics.statisticsData.get(command)?.requestCount ) { - ++this.statistics.statisticsData.get(command).requestCount; + ++this.statistics.statisticsData.get(command)!.requestCount!; } else { this.statistics.statisticsData.set(command, { ...this.statistics.statisticsData.get(command), @@ -98,7 +98,7 @@ export class PerformanceStatistics { this.statistics.statisticsData.has(command) && this.statistics.statisticsData.get(command)?.responseCount ) { - ++this.statistics.statisticsData.get(command).responseCount; + ++this.statistics.statisticsData.get(command)!.responseCount!; } else { this.statistics.statisticsData.set(command, { ...this.statistics.statisticsData.get(command), @@ -111,7 +111,7 @@ export class PerformanceStatistics { this.statistics.statisticsData.has(command) && this.statistics.statisticsData.get(command)?.errorCount ) { - ++this.statistics.statisticsData.get(command).errorCount; + ++this.statistics.statisticsData.get(command)!.errorCount!; } else { this.statistics.statisticsData.set(command, { ...this.statistics.statisticsData.get(command), @@ -154,7 +154,7 @@ export class PerformanceStatistics { const lastPerformanceEntry = performanceObserverList.getEntries()[0]; // logger.debug( // `${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, - // lastPerformanceEntry + // lastPerformanceEntry, // ); this.addPerformanceEntryToStatistics(lastPerformanceEntry); }); @@ -170,7 +170,7 @@ export class PerformanceStatistics { private startLogStatisticsInterval(): void { const logStatisticsInterval = Configuration.getLog().enabled - ? Configuration.getLog().statisticsInterval + ? Configuration.getLog().statisticsInterval! : 0; if (logStatisticsInterval > 0 && !this.displayInterval) { this.displayInterval = setInterval(() => { @@ -205,43 +205,47 @@ export class PerformanceStatistics { } // Update current statistics this.statistics.updatedAt = new Date(); - this.statistics.statisticsData.get(entryName).timeMeasurementCount = + this.statistics.statisticsData.get(entryName)!.timeMeasurementCount = (this.statistics.statisticsData.get(entryName)?.timeMeasurementCount ?? 0) + 1; - this.statistics.statisticsData.get(entryName).currentTimeMeasurement = entry.duration; - this.statistics.statisticsData.get(entryName).minTimeMeasurement = Math.min( + this.statistics.statisticsData.get(entryName)!.currentTimeMeasurement = entry.duration; + this.statistics.statisticsData.get(entryName)!.minTimeMeasurement = Math.min( entry.duration, this.statistics.statisticsData.get(entryName)?.minTimeMeasurement ?? Infinity, ); - this.statistics.statisticsData.get(entryName).maxTimeMeasurement = Math.max( + this.statistics.statisticsData.get(entryName)!.maxTimeMeasurement = Math.max( entry.duration, this.statistics.statisticsData.get(entryName)?.maxTimeMeasurement ?? -Infinity, ); - this.statistics.statisticsData.get(entryName).totalTimeMeasurement = + this.statistics.statisticsData.get(entryName)!.totalTimeMeasurement = (this.statistics.statisticsData.get(entryName)?.totalTimeMeasurement ?? 0) + entry.duration; - this.statistics.statisticsData.get(entryName).avgTimeMeasurement = - this.statistics.statisticsData.get(entryName).totalTimeMeasurement / - this.statistics.statisticsData.get(entryName).timeMeasurementCount; + this.statistics.statisticsData.get(entryName)!.avgTimeMeasurement = + this.statistics.statisticsData.get(entryName)!.totalTimeMeasurement! / + this.statistics.statisticsData.get(entryName)!.timeMeasurementCount!; this.statistics.statisticsData.get(entryName)?.measurementTimeSeries instanceof CircularArray ? this.statistics.statisticsData .get(entryName) ?.measurementTimeSeries?.push({ timestamp: entry.startTime, value: entry.duration }) - : (this.statistics.statisticsData.get(entryName).measurementTimeSeries = + : (this.statistics.statisticsData.get(entryName)!.measurementTimeSeries = new CircularArray(Constants.DEFAULT_CIRCULAR_BUFFER_CAPACITY, { timestamp: entry.startTime, value: entry.duration, })); - this.statistics.statisticsData.get(entryName).medTimeMeasurement = median( - extractTimeSeriesValues(this.statistics.statisticsData.get(entryName).measurementTimeSeries), + this.statistics.statisticsData.get(entryName)!.medTimeMeasurement = median( + extractTimeSeriesValues( + this.statistics.statisticsData.get(entryName)!.measurementTimeSeries as TimestampedData[], + ), ); - this.statistics.statisticsData.get(entryName).ninetyFiveThPercentileTimeMeasurement = + this.statistics.statisticsData.get(entryName)!.ninetyFiveThPercentileTimeMeasurement = nthPercentile( extractTimeSeriesValues( - this.statistics.statisticsData.get(entryName).measurementTimeSeries, + this.statistics.statisticsData.get(entryName)!.measurementTimeSeries as TimestampedData[], ), 95, ); - this.statistics.statisticsData.get(entryName).stdDevTimeMeasurement = stdDeviation( - extractTimeSeriesValues(this.statistics.statisticsData.get(entryName).measurementTimeSeries), + this.statistics.statisticsData.get(entryName)!.stdDevTimeMeasurement = stdDeviation( + extractTimeSeriesValues( + this.statistics.statisticsData.get(entryName)!.measurementTimeSeries as TimestampedData[], + ), ); if (Configuration.getPerformanceStorage().enabled) { parentPort?.postMessage(buildPerformanceStatisticsMessage(this.statistics)); diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index e5b09b58..3c4e7fd3 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -29,6 +29,7 @@ export class MikroOrmStorage extends Storage { this.dbName = this.getDBName(); } + // eslint-disable-next-line @typescript-eslint/no-unused-vars public async storePerformanceStatistics(performanceStatistics: Statistics): Promise { try { const performanceRecord = new PerformanceRecord(); diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index 1c109e1b..cecaa489 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -1,6 +1,7 @@ // Copyright Jerome Benoit. 2021-2023. All Rights Reserved. import { JsonFileStorage } from './JsonFileStorage'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { MikroOrmStorage } from './MikroOrmStorage'; import { MongoDBStorage } from './MongoDBStorage'; import type { Storage } from './Storage'; diff --git a/src/types/AutomaticTransactionGenerator.ts b/src/types/AutomaticTransactionGenerator.ts index a91c9067..2ae3abd7 100644 --- a/src/types/AutomaticTransactionGenerator.ts +++ b/src/types/AutomaticTransactionGenerator.ts @@ -4,7 +4,7 @@ export enum IdTagDistribution { CONNECTOR_AFFINITY = 'connector-affinity', } -export type AutomaticTransactionGeneratorConfiguration = { +export interface AutomaticTransactionGeneratorConfiguration { enable: boolean; minDuration: number; maxDuration: number; @@ -15,9 +15,9 @@ export type AutomaticTransactionGeneratorConfiguration = { stopOnConnectionFailure: boolean; requireAuthorize?: boolean; idTagDistribution?: IdTagDistribution; -}; +} -export type Status = { +export interface Status { start: boolean; startDate?: Date; lastRunDate?: Date; @@ -34,9 +34,9 @@ export type Status = { rejectedStopTransactionRequests?: number; skippedConsecutiveTransactions?: number; skippedTransactions?: number; -}; +} -export type ChargingStationAutomaticTransactionGeneratorConfiguration = { +export interface ChargingStationAutomaticTransactionGeneratorConfiguration { automaticTransactionGenerator?: AutomaticTransactionGeneratorConfiguration; automaticTransactionGeneratorStatuses?: Status[]; -}; +} diff --git a/src/types/ChargingStationConfiguration.ts b/src/types/ChargingStationConfiguration.ts index ff855650..7480459e 100644 --- a/src/types/ChargingStationConfiguration.ts +++ b/src/types/ChargingStationConfiguration.ts @@ -4,17 +4,17 @@ import type { ChargingStationOcppConfiguration } from './ChargingStationOcppConf import type { ConnectorStatus } from './ConnectorStatus'; import type { EvseStatus } from './Evse'; -type ConnectorsConfiguration = { +interface ConnectorsConfiguration { connectorsStatus?: ConnectorStatus[]; -}; +} export type EvseStatusConfiguration = Omit & { connectorsStatus?: ConnectorStatus[]; }; -type EvsesConfiguration = { +interface EvsesConfiguration { evsesStatus?: EvseStatusConfiguration[]; -}; +} export type ChargingStationConfiguration = ChargingStationInfoConfiguration & ChargingStationOcppConfiguration & diff --git a/src/types/ChargingStationInfo.ts b/src/types/ChargingStationInfo.ts index 2f9a07fc..c66092c5 100644 --- a/src/types/ChargingStationInfo.ts +++ b/src/types/ChargingStationInfo.ts @@ -25,6 +25,6 @@ export type ChargingStationInfo = Omit< firmwareStatus?: FirmwareStatus; }; -export type ChargingStationInfoConfiguration = { +export interface ChargingStationInfoConfiguration { stationInfo?: ChargingStationInfo; -}; +} diff --git a/src/types/ChargingStationOcppConfiguration.ts b/src/types/ChargingStationOcppConfiguration.ts index 834b1d1d..7bc47aae 100644 --- a/src/types/ChargingStationOcppConfiguration.ts +++ b/src/types/ChargingStationOcppConfiguration.ts @@ -5,6 +5,6 @@ export type ConfigurationKey = OCPPConfigurationKey & { reboot?: boolean; }; -export type ChargingStationOcppConfiguration = { +export interface ChargingStationOcppConfiguration { configurationKey?: ConfigurationKey[]; -}; +} diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index b9bd389b..78078375 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -41,19 +41,19 @@ export enum Voltage { export type WsOptions = ClientOptions & ClientRequestArgs; -export type FirmwareUpgrade = { +export interface FirmwareUpgrade { versionUpgrade?: { patternGroup?: number; step?: number; }; reset?: boolean; failureStatus?: FirmwareStatus; -}; +} -type CommandsSupport = { +interface CommandsSupport { incomingCommands: Record; outgoingCommands?: Record; -}; +} enum x509CertificateType { V2GRootCertificate = 'V2GRootCertificate', @@ -64,7 +64,7 @@ enum x509CertificateType { V2GCertificate = 'V2GCertificate', } -export type ChargingStationTemplate = { +export interface ChargingStationTemplate { templateHash?: string; supervisionUrls?: string | string[]; supervisionUrlOcppConfiguration?: boolean; @@ -93,9 +93,9 @@ export type ChargingStationTemplate = { imsi?: string; meterSerialNumberPrefix?: string; meterType?: string; - power: number | number[]; + power?: number | number[]; + powerUnit?: PowerUnits; powerSharedByConnectors?: boolean; - powerUnit: PowerUnits; currentOutType?: CurrentType; voltageOut?: Voltage; numberOfPhases?: number; @@ -127,4 +127,4 @@ export type ChargingStationTemplate = { Evses?: Record; Connectors?: Record; x509Certificates?: Record; -}; +} diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index accdcc21..41d45e4a 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -14,12 +14,12 @@ export enum SupervisionUrlDistribution { CHARGING_STATION_AFFINITY = 'charging-station-affinity', } -export type StationTemplateUrl = { +export interface StationTemplateUrl { file: string; numberOfStations: number; -}; +} -export type LogConfiguration = { +export interface LogConfiguration { enabled?: boolean; file?: string; errorFile?: string; @@ -30,9 +30,9 @@ export type LogConfiguration = { rotate?: boolean; maxFiles?: string | number; maxSize?: string | number; -}; +} -export type UIServerConfiguration = { +export interface UIServerConfiguration { enabled?: boolean; type?: ApplicationProtocol; options?: ServerOptions; @@ -42,15 +42,15 @@ export type UIServerConfiguration = { username?: string; password?: string; }; -}; +} -export type StorageConfiguration = { +export interface StorageConfiguration { enabled?: boolean; type?: StorageType; uri?: string; -}; +} -export type WorkerConfiguration = { +export interface WorkerConfiguration { processType?: WorkerProcessType; startDelay?: number; elementsPerWorker?: number | 'auto'; @@ -59,9 +59,9 @@ export type WorkerConfiguration = { poolMaxSize?: number; /** @deprecated Not publicly exposed to end users. */ poolStrategy?: WorkerChoiceStrategy; -}; +} -export type ConfigurationData = { +export interface ConfigurationData { supervisionUrls?: string | string[]; supervisionUrlDistribution?: SupervisionUrlDistribution; stationTemplateUrls: StationTemplateUrl[]; @@ -104,4 +104,4 @@ export type ConfigurationData = { logFile?: string; /** @deprecated Moved to log configuration section. */ logErrorFile?: string; -}; +} diff --git a/src/types/ConnectorStatus.ts b/src/types/ConnectorStatus.ts index 33c72242..45ac6807 100644 --- a/src/types/ConnectorStatus.ts +++ b/src/types/ConnectorStatus.ts @@ -5,7 +5,7 @@ import type { MeterValue } from './ocpp/MeterValues'; import type { AvailabilityType } from './ocpp/Requests'; import type { Reservation } from './ocpp/Reservation'; -export type ConnectorStatus = { +export interface ConnectorStatus { availability: AvailabilityType; bootStatus?: ConnectorStatusEnum; status?: ConnectorStatusEnum; @@ -24,4 +24,4 @@ export type ConnectorStatus = { transactionBeginMeterValue?: MeterValue; chargingProfiles?: ChargingProfile[]; reservation?: Reservation; -}; +} diff --git a/src/types/Error.ts b/src/types/Error.ts index 885edfdb..6a7c04e2 100644 --- a/src/types/Error.ts +++ b/src/types/Error.ts @@ -1,7 +1,7 @@ import type { JsonType } from './JsonType'; -export type HandleErrorParams = { +export interface HandleErrorParams { throwError?: boolean; consoleOut?: boolean; errorResponse?: T; -}; +} diff --git a/src/types/Evse.ts b/src/types/Evse.ts index 4b200c20..f47eb18a 100644 --- a/src/types/Evse.ts +++ b/src/types/Evse.ts @@ -1,11 +1,11 @@ import type { ConnectorStatus } from './ConnectorStatus'; import type { AvailabilityType } from './ocpp/Requests'; -export type EvseTemplate = { +export interface EvseTemplate { Connectors: Record; -}; +} -export type EvseStatus = { +export interface EvseStatus { connectors: Map; availability: AvailabilityType; -}; +} diff --git a/src/types/MeasurandPerPhaseSampledValueTemplates.ts b/src/types/MeasurandPerPhaseSampledValueTemplates.ts index 73df20be..2922db4d 100644 --- a/src/types/MeasurandPerPhaseSampledValueTemplates.ts +++ b/src/types/MeasurandPerPhaseSampledValueTemplates.ts @@ -5,8 +5,8 @@ export type SampledValueTemplate = SampledValue & { minimumValue?: number; }; -export type MeasurandPerPhaseSampledValueTemplates = { +export interface MeasurandPerPhaseSampledValueTemplates { L1?: SampledValueTemplate; L2?: SampledValueTemplate; L3?: SampledValueTemplate; -}; +} diff --git a/src/types/MeasurandValues.ts b/src/types/MeasurandValues.ts index 9adfbf05..f907cc80 100644 --- a/src/types/MeasurandValues.ts +++ b/src/types/MeasurandValues.ts @@ -1,6 +1,6 @@ -export type MeasurandValues = { +export interface MeasurandValues { L1: number; L2: number; L3: number; allPhases: number; -}; +} diff --git a/src/types/Statistics.ts b/src/types/Statistics.ts index 44c941e7..60b2379b 100644 --- a/src/types/Statistics.ts +++ b/src/types/Statistics.ts @@ -2,12 +2,12 @@ import type { IncomingRequestCommand, RequestCommand } from './ocpp/Requests'; import type { CircularArray } from '../utils'; import type { WorkerData } from '../worker'; -export type TimestampedData = { +export interface TimestampedData { timestamp: number; value: number; -}; +} -type StatisticsData = Partial<{ +export type StatisticsData = Partial<{ requestCount: number; responseCount: number; errorCount: number; diff --git a/src/types/WorkerBroadcastChannel.ts b/src/types/WorkerBroadcastChannel.ts index 21671fbb..abc33752 100644 --- a/src/types/WorkerBroadcastChannel.ts +++ b/src/types/WorkerBroadcastChannel.ts @@ -37,4 +37,6 @@ export interface BroadcastChannelResponsePayload hashId: string; } -export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse }; +export interface MessageEvent { + data: BroadcastChannelRequest | BroadcastChannelResponse; +} diff --git a/src/types/ocpp/2.0/Variables.ts b/src/types/ocpp/2.0/Variables.ts index 59b1b023..c08e00f0 100644 --- a/src/types/ocpp/2.0/Variables.ts +++ b/src/types/ocpp/2.0/Variables.ts @@ -110,7 +110,7 @@ export type OCPP20SetVariableResultType = { attributeStatusInfo?: StatusInfoType; } & JsonObject; -type OCPP20ComponentVariableType = { +export type OCPP20ComponentVariableType = { component: ComponentType; variable?: VariableType; } & JsonObject; diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index 38cb22fc..a2407476 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -35,11 +35,11 @@ export type RequestCommand = OCPP16RequestCommand | OCPP20RequestCommand; export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType]; -export type RequestParams = { +export interface RequestParams { skipBufferingOnError?: boolean; triggerMessage?: boolean; throwError?: boolean; -}; +} export const IncomingRequestCommand = { ...OCPP16IncomingRequestCommand, diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index d36a5478..2cd2f369 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -15,15 +15,11 @@ import { OCPP16TriggerMessageStatus, OCPP16UnlockStatus, } from './1.6/Responses'; -import type { - OCPP20BootNotificationResponse, - OCPP20ClearCacheResponse, - OCPP20StatusNotificationResponse, -} from './2.0/Responses'; +import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from './2.0/Responses'; import type { ErrorType } from './ErrorType'; import type { MessageType } from './MessageType'; import type { ChargingStation } from '../../charging-station'; -import type { JsonType } from '../JsonType'; +import type { JsonObject, JsonType } from '../JsonType'; export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType]; @@ -43,9 +39,7 @@ export type HeartbeatResponse = OCPP16HeartbeatResponse; export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse; -export type StatusNotificationResponse = - | OCPP16StatusNotificationResponse - | OCPP20StatusNotificationResponse; +export type StatusNotificationResponse = OCPP16StatusNotificationResponse; export type MeterValuesResponse = OCPP16MeterValuesResponse; @@ -60,9 +54,9 @@ export enum GenericStatus { Rejected = 'Rejected', } -export type GenericResponse = { +export interface GenericResponse extends JsonObject { status: GenericStatus; -}; +} export enum RegistrationStatusEnumType { ACCEPTED = 'Accepted', diff --git a/src/types/orm/entities/PerformanceData.ts b/src/types/orm/entities/PerformanceData.ts index fc7268aa..444241ff 100644 --- a/src/types/orm/entities/PerformanceData.ts +++ b/src/types/orm/entities/PerformanceData.ts @@ -1,5 +1,7 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import type { PerformanceRecord } from './PerformanceRecord'; @Entity() diff --git a/src/types/orm/entities/PerformanceRecord.ts b/src/types/orm/entities/PerformanceRecord.ts index 06114da6..997d0100 100644 --- a/src/types/orm/entities/PerformanceRecord.ts +++ b/src/types/orm/entities/PerformanceRecord.ts @@ -1,5 +1,7 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import type { PerformanceData } from './PerformanceData'; @Entity() diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index 16ad4f2b..b396e49b 100644 --- a/src/utils/AsyncLock.ts +++ b/src/utils/AsyncLock.ts @@ -36,7 +36,7 @@ export class AsyncLock { asyncLock.acquired = false; return; } - const queuedResolve = asyncLock.resolveQueue.dequeue(); + const queuedResolve = asyncLock.resolveQueue.dequeue()!; return new Promise((resolve) => { queuedResolve(); resolve(); @@ -47,6 +47,6 @@ export class AsyncLock { if (!AsyncLock.asyncLocks.has(type)) { AsyncLock.asyncLocks.set(type, new AsyncLock()); } - return AsyncLock.asyncLocks.get(type); + return AsyncLock.asyncLocks.get(type)!; } } diff --git a/src/utils/ChargingStationConfigurationUtils.ts b/src/utils/ChargingStationConfigurationUtils.ts index 08dbdbde..34d859c7 100644 --- a/src/utils/ChargingStationConfigurationUtils.ts +++ b/src/utils/ChargingStationConfigurationUtils.ts @@ -14,7 +14,7 @@ export const buildChargingStationAutomaticTransactionGeneratorConfiguration = ( automaticTransactionGenerator: chargingStation.getAutomaticTransactionGeneratorConfiguration(), ...(!isNullOrUndefined(chargingStation.automaticTransactionGenerator?.connectorsStatus) && { automaticTransactionGeneratorStatuses: [ - ...chargingStation.automaticTransactionGenerator.connectorsStatus.values(), + ...chargingStation.automaticTransactionGenerator!.connectorsStatus.values(), ], }), }; diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 691721e9..c58fdb0f 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -59,12 +59,12 @@ export class Configuration { if (hasOwnProp(Configuration.getConfig(), 'uiServer')) { uiServerConfiguration = merge( uiServerConfiguration, - Configuration.getConfig()?.uiServer, + Configuration.getConfig()!.uiServer!, ); } if (isCFEnvironment() === true) { delete uiServerConfiguration.options?.host; - uiServerConfiguration.options.port = parseInt(process.env.PORT); + uiServerConfiguration.options!.port = parseInt(process.env.PORT!); } return uiServerConfiguration; } @@ -83,7 +83,7 @@ export class Configuration { ...(Configuration.getConfig()?.performanceStorage?.type === StorageType.JSON_FILE && Configuration.getConfig()?.performanceStorage?.uri && { uri: Configuration.buildPerformanceUriFilePath( - new URL(Configuration.getConfig()?.performanceStorage?.uri).pathname, + new URL(Configuration.getConfig()!.performanceStorage!.uri!).pathname, ), }), }; @@ -119,12 +119,15 @@ export class Configuration { undefined, "Use 'stationTemplateUrls' instead", ); - !isUndefined(Configuration.getConfig()['stationTemplateURLs']) && - (Configuration.getConfig().stationTemplateUrls = Configuration.getConfig()[ + // eslint-disable-next-line @typescript-eslint/dot-notation + !isUndefined(Configuration.getConfig()!['stationTemplateURLs']) && + (Configuration.getConfig()!.stationTemplateUrls = Configuration.getConfig()![ + // eslint-disable-next-line @typescript-eslint/dot-notation 'stationTemplateURLs' ] as StationTemplateUrl[]); - Configuration.getConfig().stationTemplateUrls.forEach( + Configuration.getConfig()!.stationTemplateUrls.forEach( (stationTemplateUrl: StationTemplateUrl) => { + // eslint-disable-next-line @typescript-eslint/dot-notation if (!isUndefined(stationTemplateUrl['numberOfStation'])) { console.error( `${chalk.green(Configuration.logPrefix())} ${chalk.red( @@ -329,7 +332,7 @@ export class Configuration { public static workerPoolInUse(): boolean { return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes( - Configuration.getWorker().processType, + Configuration.getWorker().processType!, ); } @@ -343,10 +346,13 @@ export class Configuration { undefined, "Use 'supervisionUrls' instead", ); - !isUndefined(Configuration.getConfig()['supervisionURLs']) && - (Configuration.getConfig().supervisionUrls = Configuration.getConfig()['supervisionURLs'] as + // eslint-disable-next-line @typescript-eslint/dot-notation + if (!isUndefined(Configuration.getConfig()!['supervisionURLs'])) { + // eslint-disable-next-line @typescript-eslint/dot-notation + Configuration.getConfig()!.supervisionUrls = Configuration.getConfig()!['supervisionURLs'] as | string - | string[]); + | string[]; + } // Read conf return Configuration.getConfig()?.supervisionUrls; } @@ -378,8 +384,8 @@ export class Configuration { ) { if ( sectionName && - !isUndefined(Configuration.getConfig()[sectionName]) && - !isUndefined((Configuration.getConfig()[sectionName] as Record)[key]) + !isUndefined(Configuration.getConfig()![sectionName]) && + !isUndefined((Configuration.getConfig()![sectionName] as object)[key]) ) { console.error( `${chalk.green(Configuration.logPrefix())} ${chalk.red( @@ -388,7 +394,7 @@ export class Configuration { }`, )}`, ); - } else if (!isUndefined(Configuration.getConfig()[key])) { + } else if (!isUndefined(Configuration.getConfig()![key])) { console.error( `${chalk.green(Configuration.logPrefix())} ${chalk.red( `Deprecated configuration key '${key}' usage${ @@ -424,7 +430,7 @@ export class Configuration { private static getConfigurationFileWatcher(): FSWatcher | undefined { try { return watch(Configuration.configurationFile, (event, filename): void => { - if (filename?.trim().length > 0 && event === 'change') { + if (filename!.trim()!.length > 0 && event === 'change') { // Nullify to force configuration file reading Configuration.configuration = null; if (!isUndefined(Configuration.configurationChangeCallback)) { diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index c4db93c0..a456fa73 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -13,9 +13,9 @@ if (Configuration.getLog().rotate === true) { transports = [ new DailyRotateFile({ filename: insertAt( - Configuration.getLog().errorFile, + Configuration.getLog().errorFile!, '-%DATE%', - Configuration.getLog().errorFile?.indexOf('.log'), + Configuration.getLog().errorFile!.indexOf('.log'), ), level: 'error', ...(logMaxFiles && { maxFiles: logMaxFiles }), @@ -23,9 +23,9 @@ if (Configuration.getLog().rotate === true) { }), new DailyRotateFile({ filename: insertAt( - Configuration.getLog().file, + Configuration.getLog().file!, '-%DATE%', - Configuration.getLog().file?.indexOf('.log'), + Configuration.getLog().file!.indexOf('.log'), ), ...(logMaxFiles && { maxFiles: logMaxFiles }), ...(logMaxSize && { maxSize: logMaxSize }), @@ -41,7 +41,7 @@ if (Configuration.getLog().rotate === true) { export const logger = createLogger({ silent: !Configuration.getLog().enabled, level: Configuration.getLog().level, - format: format.combine(format.splat(), (format[Configuration.getLog().format] as FormatWrap)()), + format: format.combine(format.splat(), (format[Configuration.getLog().format!] as FormatWrap)()), transports, }); @@ -54,7 +54,7 @@ if (Configuration.getLog().console) { new TransportType.Console({ format: format.combine( format.splat(), - (format[Configuration.getLog().format] as FormatWrap)(), + (format[Configuration.getLog().format!] as FormatWrap)(), ), }), ); diff --git a/src/utils/MessageChannelUtils.ts b/src/utils/MessageChannelUtils.ts index 39c8b819..edaaa49e 100644 --- a/src/utils/MessageChannelUtils.ts +++ b/src/utils/MessageChannelUtils.ts @@ -54,7 +54,7 @@ const buildChargingStationDataPayload = (chargingStation: ChargingStation): Char stationInfo: chargingStation.stationInfo, connectors: buildConnectorsStatus(chargingStation), evses: buildEvsesStatus(chargingStation, OutputFormat.worker), - ocppConfiguration: chargingStation.ocppConfiguration, + ocppConfiguration: chargingStation.ocppConfiguration!, wsState: chargingStation?.wsConnection?.readyState, bootNotificationResponse: chargingStation.bootNotificationResponse, ...(chargingStation.automaticTransactionGenerator && { diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index eba8ca44..49a5fdf9 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -59,7 +59,7 @@ export const convertToDate = ( return value; } if (isString(value) || typeof value === 'number') { - return new Date(value); + return new Date(value!); } return null; }; @@ -79,6 +79,7 @@ export const convertToInt = (value: unknown): number => { changedValue = parseInt(value as string); } if (isNaN(changedValue)) { + // eslint-disable-next-line @typescript-eslint/no-base-to-string throw new Error(`Cannot convert to integer: ${value.toString()}`); } return changedValue; @@ -93,6 +94,7 @@ export const convertToFloat = (value: unknown): number => { changedValue = parseFloat(value as string); } if (isNaN(changedValue)) { + // eslint-disable-next-line @typescript-eslint/no-base-to-string throw new Error(`Cannot convert to float: ${value.toString()}`); } return changedValue; diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 2f9093f2..75fc2f6b 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -45,11 +45,11 @@ export abstract class WorkerAbstract { this.workerScript = workerScript; this.workerOptions = workerOptions; this.workerOptions.poolOptions?.messageHandler?.bind(this); - this.workerOptions.poolOptions.errorHandler = ( + this.workerOptions.poolOptions!.errorHandler = ( this.workerOptions?.poolOptions?.errorHandler ?? defaultErrorHandler ).bind(this) as ErrorHandler; this.workerOptions.poolOptions?.onlineHandler?.bind(this); - this.workerOptions.poolOptions.exitHandler = ( + this.workerOptions.poolOptions!.exitHandler = ( this.workerOptions?.poolOptions?.exitHandler ?? defaultExitHandler ).bind(this) as ExitHandler; } diff --git a/src/worker/WorkerDynamicPool.ts b/src/worker/WorkerDynamicPool.ts index eebc8fbb..c828c0a9 100644 --- a/src/worker/WorkerDynamicPool.ts +++ b/src/worker/WorkerDynamicPool.ts @@ -53,6 +53,7 @@ export class WorkerDynamicPool extends WorkerAbstract { public async addElement(elementData: WorkerData): Promise { await this.pool.execute(elementData); // Start element sequentially to optimize memory at startup - this.workerOptions.elementStartDelay > 0 && (await sleep(this.workerOptions.elementStartDelay)); + this.workerOptions.elementStartDelay! > 0 && + (await sleep(this.workerOptions.elementStartDelay!)); } } diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index d066ce9e..03d52625 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -50,7 +50,7 @@ export class WorkerSet extends WorkerAbstract { (accumulator, workerSetElement) => accumulator + workerSetElement.numberOfWorkerElements, 0, ), - elementsPerWorker: this.maxElementsPerWorker, + elementsPerWorker: this.maxElementsPerWorker!, }; } @@ -66,7 +66,7 @@ export class WorkerSet extends WorkerAbstract { public async start(): Promise { this.addWorkerSetElement(); // Add worker set element sequentially to optimize memory at startup - this.workerOptions.workerStartDelay > 0 && (await sleep(this.workerOptions.workerStartDelay)); + this.workerOptions.workerStartDelay! > 0 && (await sleep(this.workerOptions.workerStartDelay!)); } /** @inheritDoc */ @@ -95,8 +95,8 @@ export class WorkerSet extends WorkerAbstract { }); ++workerSetElement.numberOfWorkerElements; // Add element sequentially to optimize memory at startup - if (this.workerOptions.elementStartDelay > 0) { - await sleep(this.workerOptions.elementStartDelay); + if (this.workerOptions.elementStartDelay! > 0) { + await sleep(this.workerOptions.elementStartDelay!); } } @@ -106,7 +106,7 @@ export class WorkerSet extends WorkerAbstract { private addWorkerSetElement(): WorkerSetElement { const worker = new Worker(this.workerScript, { env: SHARE_ENV, - ...this.workerOptions.poolOptions.workerOptions, + ...this.workerOptions.poolOptions?.workerOptions, }); worker.on( 'message', @@ -131,7 +131,7 @@ export class WorkerSet extends WorkerAbstract { this.workerOptions?.poolOptions?.exitHandler ?? WorkerConstants.EMPTY_FUNCTION, ); worker.once('exit', () => - this.removeWorkerSetElement(this.getWorkerSetElementByWorker(worker)), + this.removeWorkerSetElement(this.getWorkerSetElementByWorker(worker)!), ); const workerSetElement: WorkerSetElement = { worker, numberOfWorkerElements: 0 }; this.workerSet.add(workerSetElement); @@ -143,9 +143,9 @@ export class WorkerSet extends WorkerAbstract { } private async getWorkerSetElement(): Promise { - let chosenWorkerSetElement: WorkerSetElement; + let chosenWorkerSetElement: WorkerSetElement | undefined; for (const workerSetElement of this.workerSet) { - if (workerSetElement.numberOfWorkerElements < this.workerOptions.elementsPerWorker) { + if (workerSetElement.numberOfWorkerElements < this.workerOptions.elementsPerWorker!) { chosenWorkerSetElement = workerSetElement; break; } @@ -153,13 +153,14 @@ export class WorkerSet extends WorkerAbstract { if (!chosenWorkerSetElement) { chosenWorkerSetElement = this.addWorkerSetElement(); // Add worker set element sequentially to optimize memory at startup - this.workerOptions.workerStartDelay > 0 && (await sleep(this.workerOptions.workerStartDelay)); + this.workerOptions.workerStartDelay! > 0 && + (await sleep(this.workerOptions.workerStartDelay!)); } return chosenWorkerSetElement; } private getWorkerSetElementByWorker(worker: Worker): WorkerSetElement | undefined { - let workerSetElt: WorkerSetElement; + let workerSetElt: WorkerSetElement | undefined; for (const workerSetElement of this.workerSet) { if (workerSetElement.worker.threadId === worker.threadId) { workerSetElt = workerSetElement; diff --git a/src/worker/WorkerStaticPool.ts b/src/worker/WorkerStaticPool.ts index 7000ac9a..b1cc7189 100644 --- a/src/worker/WorkerStaticPool.ts +++ b/src/worker/WorkerStaticPool.ts @@ -52,6 +52,7 @@ export class WorkerStaticPool extends WorkerAbstract { public async addElement(elementData: WorkerData): Promise { await this.pool.execute(elementData); // Start element sequentially to optimize memory at startup - this.workerOptions.elementStartDelay > 0 && (await sleep(this.workerOptions.elementStartDelay)); + this.workerOptions.elementStartDelay! > 0 && + (await sleep(this.workerOptions.elementStartDelay!)); } } diff --git a/src/worker/WorkerTypes.ts b/src/worker/WorkerTypes.ts index 5bf339fb..b7b21ba3 100644 --- a/src/worker/WorkerTypes.ts +++ b/src/worker/WorkerTypes.ts @@ -9,14 +9,14 @@ export enum WorkerProcessType { staticPool = 'staticPool', } -export type SetInfo = { +export interface SetInfo { version: string; type: string; worker: string; size: number; elementsExecuting: number; elementsPerWorker: number; -}; +} export enum WorkerSetEvents { error = 'error', @@ -28,26 +28,26 @@ export const WorkerEvents = { } as const; export type WorkerEvents = PoolEvent | WorkerSetEvents; -export type WorkerOptions = { +export interface WorkerOptions { workerStartDelay?: number; elementStartDelay?: number; poolMaxSize: number; poolMinSize: number; elementsPerWorker?: number; poolOptions?: ThreadPoolOptions; -}; +} export type WorkerData = Record; -export type WorkerSetElement = { +export interface WorkerSetElement { worker: Worker; numberOfWorkerElements: number; -}; +} -export type WorkerMessage = { +export interface WorkerMessage { id: WorkerMessageEvents; data: T; -}; +} export enum WorkerMessageEvents { startWorkerElement = 'startWorkerElement', diff --git a/test/utils/Utils.test.ts b/test/utils/Utils.test.ts index e3b8cc3e..4677fcda 100644 --- a/test/utils/Utils.test.ts +++ b/test/utils/Utils.test.ts @@ -360,8 +360,6 @@ describe('Utils test suite', () => { it('Verify isEmptyObject()', () => { expect(isEmptyObject({})).toBe(true); expect(isEmptyObject({ 1: 1, 2: 2 })).toBe(false); - expect(isEmptyObject(undefined)).toBe(false); - expect(isEmptyObject(null)).toBe(false); expect(isEmptyObject(new Map())).toBe(false); expect(isEmptyObject(new Set())).toBe(false); expect(isEmptyObject(new WeakMap())).toBe(false); diff --git a/tsconfig-base.json b/tsconfig-base.json index 1dd0b7ca..e4810932 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -30,7 +30,7 @@ /* Strict Type-Checking Options */ // "strict": true, /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ + "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ diff --git a/ui/web/package.json b/ui/web/package.json index 1a662cb5..11964a47 100644 --- a/ui/web/package.json +++ b/ui/web/package.json @@ -36,11 +36,11 @@ "vue-router": "^4.2.4" }, "devDependencies": { - "@tsconfig/node20": "^1.0.2", + "@tsconfig/node20": "^20.1.0", "@types/jsdom": "^21.1.1", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue-jsx": "^3.0.1", "@vitest/coverage-c8": "^0.33.0", diff --git a/ui/web/pnpm-lock.yaml b/ui/web/pnpm-lock.yaml index d2d8969b..251221cf 100644 --- a/ui/web/pnpm-lock.yaml +++ b/ui/web/pnpm-lock.yaml @@ -23,8 +23,8 @@ dependencies: devDependencies: '@tsconfig/node20': - specifier: ^1.0.2 - version: 1.0.2 + specifier: ^20.1.0 + version: 20.1.0 '@types/jsdom': specifier: ^21.1.1 version: 21.1.1 @@ -32,11 +32,11 @@ devDependencies: specifier: ^20.4.2 version: 20.4.2 '@typescript-eslint/eslint-plugin': - specifier: ^5.62.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.45.0)(typescript@5.1.6) + specifier: ^6.0.0 + version: 6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.45.0)(typescript@5.1.6) '@typescript-eslint/parser': - specifier: ^5.62.0 - version: 5.62.0(eslint@8.45.0)(typescript@5.1.6) + specifier: ^6.0.0 + version: 6.0.0(eslint@8.45.0)(typescript@5.1.6) '@vitejs/plugin-vue': specifier: ^4.2.3 version: 4.2.3(vite@4.4.4)(vue@3.3.4) @@ -69,10 +69,10 @@ devDependencies: version: 1.21.0 eslint-import-resolver-typescript: specifier: ^3.5.5 - version: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) + version: 3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) eslint-plugin-import: specifier: ^2.27.5 - version: 2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + version: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) eslint-plugin-vue: specifier: ^9.15.1 version: 9.15.1(eslint@8.45.0) @@ -399,8 +399,8 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@esbuild/android-arm64@0.18.12: - resolution: {integrity: sha512-BMAlczRqC/LUt2P97E4apTBbkvS9JTJnp2DKFbCwpZ8vBvXVbNdqmvzW/OsdtI/+mGr+apkkpqGM8WecLkPgrA==} + /@esbuild/android-arm64@0.18.13: + resolution: {integrity: sha512-j7NhycJUoUAG5kAzGf4fPWfd17N6SM3o1X6MlXVqfHvs2buFraCJzos9vbeWjLxOyBKHyPOnuCuipbhvbYtTAg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -408,8 +408,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.18.12: - resolution: {integrity: sha512-LIxaNIQfkFZbTLb4+cX7dozHlAbAshhFE5PKdro0l+FnCpx1GDJaQ2WMcqm+ToXKMt8p8Uojk/MFRuGyz3V5Sw==} + /@esbuild/android-arm@0.18.13: + resolution: {integrity: sha512-KwqFhxRFMKZINHzCqf8eKxE0XqWlAVPRxwy6rc7CbVFxzUWB2sA/s3hbMZeemPdhN3fKBkqOaFhTbS8xJXYIWQ==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -417,8 +417,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.18.12: - resolution: {integrity: sha512-zU5MyluNsykf5cOJ0LZZZjgAHbhPJ1cWfdH1ZXVMXxVMhEV0VZiZXQdwBBVvmvbF28EizeK7obG9fs+fpmS0eQ==} + /@esbuild/android-x64@0.18.13: + resolution: {integrity: sha512-M2eZkRxR6WnWfVELHmv6MUoHbOqnzoTVSIxgtsyhm/NsgmL+uTmag/VVzdXvmahak1I6sOb1K/2movco5ikDJg==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -426,8 +426,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.18.12: - resolution: {integrity: sha512-zUZMep7YONnp6954QOOwEBwFX9svlKd3ov6PkxKd53LGTHsp/gy7vHaPGhhjBmEpqXEXShi6dddjIkmd+NgMsA==} + /@esbuild/darwin-arm64@0.18.13: + resolution: {integrity: sha512-f5goG30YgR1GU+fxtaBRdSW3SBG9pZW834Mmhxa6terzcboz7P2R0k4lDxlkP7NYRIIdBbWp+VgwQbmMH4yV7w==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -435,8 +435,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.18.12: - resolution: {integrity: sha512-ohqLPc7i67yunArPj1+/FeeJ7AgwAjHqKZ512ADk3WsE3FHU9l+m5aa7NdxXr0HmN1bjDlUslBjWNbFlD9y12Q==} + /@esbuild/darwin-x64@0.18.13: + resolution: {integrity: sha512-RIrxoKH5Eo+yE5BtaAIMZaiKutPhZjw+j0OCh8WdvKEKJQteacq0myZvBDLU+hOzQOZWJeDnuQ2xgSScKf1Ovw==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -444,8 +444,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.18.12: - resolution: {integrity: sha512-GIIHtQXqgeOOqdG16a/A9N28GpkvjJnjYMhOnXVbn3EDJcoItdR58v/pGN31CHjyXDc8uCcRnFWmqaJt24AYJg==} + /@esbuild/freebsd-arm64@0.18.13: + resolution: {integrity: sha512-AfRPhHWmj9jGyLgW/2FkYERKmYR+IjYxf2rtSLmhOrPGFh0KCETFzSjx/JX/HJnvIqHt/DRQD/KAaVsUKoI3Xg==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -453,8 +453,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.18.12: - resolution: {integrity: sha512-zK0b9a1/0wZY+6FdOS3BpZcPc1kcx2G5yxxfEJtEUzVxI6n/FrC2Phsxj/YblPuBchhBZ/1wwn7AyEBUyNSa6g==} + /@esbuild/freebsd-x64@0.18.13: + resolution: {integrity: sha512-pGzWWZJBInhIgdEwzn8VHUBang8UvFKsvjDkeJ2oyY5gZtAM6BaxK0QLCuZY+qoj/nx/lIaItH425rm/hloETA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -462,8 +462,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.18.12: - resolution: {integrity: sha512-JKgG8Q/LL/9sw/iHHxQyVMoQYu3rU3+a5Z87DxC+wAu3engz+EmctIrV+FGOgI6gWG1z1+5nDDbXiRMGQZXqiw==} + /@esbuild/linux-arm64@0.18.13: + resolution: {integrity: sha512-hCzZbVJEHV7QM77fHPv2qgBcWxgglGFGCxk6KfQx6PsVIdi1u09X7IvgE9QKqm38OpkzaAkPnnPqwRsltvLkIQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -471,8 +471,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.18.12: - resolution: {integrity: sha512-y75OijvrBE/1XRrXq1jtrJfG26eHeMoqLJ2dwQNwviwTuTtHGCojsDO6BJNF8gU+3jTn1KzJEMETytwsFSvc+Q==} + /@esbuild/linux-arm@0.18.13: + resolution: {integrity: sha512-4iMxLRMCxGyk7lEvkkvrxw4aJeC93YIIrfbBlUJ062kilUUnAiMb81eEkVvCVoh3ON283ans7+OQkuy1uHW+Hw==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -480,8 +480,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.18.12: - resolution: {integrity: sha512-yoRIAqc0B4lDIAAEFEIu9ttTRFV84iuAl0KNCN6MhKLxNPfzwCBvEMgwco2f71GxmpBcTtn7KdErueZaM2rEvw==} + /@esbuild/linux-ia32@0.18.13: + resolution: {integrity: sha512-I3OKGbynl3AAIO6onXNrup/ttToE6Rv2XYfFgLK/wnr2J+1g+7k4asLrE+n7VMhaqX+BUnyWkCu27rl+62Adug==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -489,8 +489,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.18.12: - resolution: {integrity: sha512-qYgt3dHPVvf/MgbIBpJ4Sup/yb9DAopZ3a2JgMpNKIHUpOdnJ2eHBo/aQdnd8dJ21X/+sS58wxHtA9lEazYtXQ==} + /@esbuild/linux-loong64@0.18.13: + resolution: {integrity: sha512-8pcKDApAsKc6WW51ZEVidSGwGbebYw2qKnO1VyD8xd6JN0RN6EUXfhXmDk9Vc4/U3Y4AoFTexQewQDJGsBXBpg==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -498,8 +498,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.18.12: - resolution: {integrity: sha512-wHphlMLK4ufNOONqukELfVIbnGQJrHJ/mxZMMrP2jYrPgCRZhOtf0kC4yAXBwnfmULimV1qt5UJJOw4Kh13Yfg==} + /@esbuild/linux-mips64el@0.18.13: + resolution: {integrity: sha512-6GU+J1PLiVqWx8yoCK4Z0GnfKyCGIH5L2KQipxOtbNPBs+qNDcMJr9euxnyJ6FkRPyMwaSkjejzPSISD9hb+gg==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -507,8 +507,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.18.12: - resolution: {integrity: sha512-TeN//1Ft20ZZW41+zDSdOI/Os1bEq5dbvBvYkberB7PHABbRcsteeoNVZFlI0YLpGdlBqohEpjrn06kv8heCJg==} + /@esbuild/linux-ppc64@0.18.13: + resolution: {integrity: sha512-pfn/OGZ8tyR8YCV7MlLl5hAit2cmS+j/ZZg9DdH0uxdCoJpV7+5DbuXrR+es4ayRVKIcfS9TTMCs60vqQDmh+w==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -516,8 +516,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.18.12: - resolution: {integrity: sha512-AgUebVS4DoAblBgiB2ACQ/8l4eGE5aWBb8ZXtkXHiET9mbj7GuWt3OnsIW/zX+XHJt2RYJZctbQ2S/mDjbp0UA==} + /@esbuild/linux-riscv64@0.18.13: + resolution: {integrity: sha512-aIbhU3LPg0lOSCfVeGHbmGYIqOtW6+yzO+Nfv57YblEK01oj0mFMtvDJlOaeAZ6z0FZ9D13oahi5aIl9JFphGg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -525,8 +525,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.18.12: - resolution: {integrity: sha512-dJ3Rb3Ei2u/ysSXd6pzleGtfDdc2MuzKt8qc6ls8vreP1G3B7HInX3i7gXS4BGeVd24pp0yqyS7bJ5NHaI9ing==} + /@esbuild/linux-s390x@0.18.13: + resolution: {integrity: sha512-Pct1QwF2sp+5LVi4Iu5Y+6JsGaV2Z2vm4O9Dd7XZ5tKYxEHjFtb140fiMcl5HM1iuv6xXO8O1Vrb1iJxHlv8UA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -534,8 +534,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.18.12: - resolution: {integrity: sha512-OrNJMGQbPaVyHHcDF8ybNSwu7TDOfX8NGpXCbetwOSP6txOJiWlgQnRymfC9ocR1S0Y5PW0Wb1mV6pUddqmvmQ==} + /@esbuild/linux-x64@0.18.13: + resolution: {integrity: sha512-zTrIP0KzYP7O0+3ZnmzvUKgGtUvf4+piY8PIO3V8/GfmVd3ZyHJGz7Ht0np3P1wz+I8qJ4rjwJKqqEAbIEPngA==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -543,8 +543,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.18.12: - resolution: {integrity: sha512-55FzVCAiwE9FK8wWeCRuvjazNRJ1QqLCYGZVB6E8RuQuTeStSwotpSW4xoRGwp3a1wUsaVCdYcj5LGCASVJmMg==} + /@esbuild/netbsd-x64@0.18.13: + resolution: {integrity: sha512-I6zs10TZeaHDYoGxENuksxE1sxqZpCp+agYeW039yqFwh3MgVvdmXL5NMveImOC6AtpLvE4xG5ujVic4NWFIDQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -552,8 +552,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.18.12: - resolution: {integrity: sha512-qnluf8rfb6Y5Lw2tirfK2quZOBbVqmwxut7GPCIJsM8lc4AEUj9L8y0YPdLaPK0TECt4IdyBdBD/KRFKorlK3g==} + /@esbuild/openbsd-x64@0.18.13: + resolution: {integrity: sha512-W5C5nczhrt1y1xPG5bV+0M12p2vetOGlvs43LH8SopQ3z2AseIROu09VgRqydx5qFN7y9qCbpgHLx0kb0TcW7g==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -561,8 +561,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.18.12: - resolution: {integrity: sha512-+RkKpVQR7bICjTOPUpkTBTaJ4TFqQBX5Ywyd/HSdDkQGn65VPkTsR/pL4AMvuMWy+wnXgIl4EY6q4mVpJal8Kg==} + /@esbuild/sunos-x64@0.18.13: + resolution: {integrity: sha512-X/xzuw4Hzpo/yq3YsfBbIsipNgmsm8mE/QeWbdGdTTeZ77fjxI2K0KP3AlhZ6gU3zKTw1bKoZTuKLnqcJ537qw==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -570,8 +570,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.18.12: - resolution: {integrity: sha512-GNHuciv0mFM7ouzsU0+AwY+7eV4Mgo5WnbhfDCQGtpvOtD1vbOiRjPYG6dhmMoFyBjj+pNqQu2X+7DKn0KQ/Gw==} + /@esbuild/win32-arm64@0.18.13: + resolution: {integrity: sha512-4CGYdRQT/ILd+yLLE5i4VApMPfGE0RPc/wFQhlluDQCK09+b4JDbxzzjpgQqTPrdnP7r5KUtGVGZYclYiPuHrw==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -579,8 +579,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.18.12: - resolution: {integrity: sha512-kR8cezhYipbbypGkaqCTWIeu4zID17gamC8YTPXYtcN3E5BhhtTnwKBn9I0PJur/T6UVwIEGYzkffNL0lFvxEw==} + /@esbuild/win32-ia32@0.18.13: + resolution: {integrity: sha512-D+wKZaRhQI+MUGMH+DbEr4owC2D7XnF+uyGiZk38QbgzLcofFqIOwFs7ELmIeU45CQgfHNy9Q+LKW3cE8g37Kg==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -588,8 +588,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.18.12: - resolution: {integrity: sha512-O0UYQVkvfM/jO8a4OwoV0mAKSJw+mjWTAd1MJd/1FCX6uiMdLmMRPK/w6e9OQ0ob2WGxzIm9va/KG0Ja4zIOgg==} + /@esbuild/win32-x64@0.18.13: + resolution: {integrity: sha512-iVl6lehAfJS+VmpF3exKpNQ8b0eucf5VWfzR8S7xFve64NBNz2jPUgx1X93/kfnkfgP737O+i1k54SVQS7uVZA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -760,8 +760,8 @@ packages: engines: {node: '>= 10'} dev: true - /@tsconfig/node20@1.0.2: - resolution: {integrity: sha512-pw0MmECiSTbBfIlT0x3iQLuJ8s3i2mwYoGxJ3vzqTNMdc4nO2VeqfCOQ/doGFa8iyPlqmBd98/5pBctWz7uN2A==} + /@tsconfig/node20@20.1.0: + resolution: {integrity: sha512-7Yz1xDv3sot8+NwiYA8wkx60qr3Tr+soJwlqVQSkiEqqgYoNmMmqSPiYs1vMmTxneB3igHAD11dGOR2+BShzTA==} dev: true /@types/chai-subset@1.3.3: @@ -834,6 +834,37 @@ packages: - supports-color dev: true + /@typescript-eslint/eslint-plugin@6.0.0(@typescript-eslint/parser@6.0.0)(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.5.1 + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/type-utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.0.0 + debug: 4.3.4 + eslint: 8.45.0 + grapheme-splitter: 1.0.4 + graphemer: 1.4.0 + ignore: 5.2.4 + natural-compare: 1.4.0 + natural-compare-lite: 1.4.0 + semver: 7.5.4 + ts-api-utils: 1.0.1(typescript@5.1.6) + typescript: 5.1.6 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/parser@5.62.0(eslint@8.45.0)(typescript@5.1.6): resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -854,6 +885,27 @@ packages: - supports-color dev: true + /@typescript-eslint/parser@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.0.0 + debug: 4.3.4 + eslint: 8.45.0 + typescript: 5.1.6 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/scope-manager@5.62.0: resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -862,6 +914,14 @@ packages: '@typescript-eslint/visitor-keys': 5.62.0 dev: true + /@typescript-eslint/scope-manager@6.0.0: + resolution: {integrity: sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 + dev: true + /@typescript-eslint/type-utils@5.62.0(eslint@8.45.0)(typescript@5.1.6): resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -882,11 +942,36 @@ packages: - supports-color dev: true + /@typescript-eslint/type-utils@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) + '@typescript-eslint/utils': 6.0.0(eslint@8.45.0)(typescript@5.1.6) + debug: 4.3.4 + eslint: 8.45.0 + ts-api-utils: 1.0.1(typescript@5.1.6) + typescript: 5.1.6 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/types@5.62.0: resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@typescript-eslint/types@6.0.0: + resolution: {integrity: sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/typescript-estree@5.62.0(typescript@5.1.6): resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -908,6 +993,27 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@6.0.0(typescript@5.1.6): + resolution: {integrity: sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/visitor-keys': 6.0.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.4 + ts-api-utils: 1.0.1(typescript@5.1.6) + typescript: 5.1.6 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@5.62.0(eslint@8.45.0)(typescript@5.1.6): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -928,6 +1034,26 @@ packages: - typescript dev: true + /@typescript-eslint/utils@6.0.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.45.0) + '@types/json-schema': 7.0.12 + '@types/semver': 7.5.0 + '@typescript-eslint/scope-manager': 6.0.0 + '@typescript-eslint/types': 6.0.0 + '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) + eslint: 8.45.0 + eslint-scope: 5.1.1 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/visitor-keys@5.62.0: resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -936,6 +1062,14 @@ packages: eslint-visitor-keys: 3.4.1 dev: true + /@typescript-eslint/visitor-keys@6.0.0: + resolution: {integrity: sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.0.0 + eslint-visitor-keys: 3.4.1 + dev: true + /@vitejs/plugin-vue-jsx@3.0.1(vite@4.4.4)(vue@3.3.4): resolution: {integrity: sha512-+Jb7ggL48FSPS1uhPnJbJwWa9Sr90vQ+d0InW+AhBM22n+cfuYqJZDckBc+W3QSHe1WDvewMZfa4wZOtk5pRgw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -1264,7 +1398,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 get-intrinsic: 1.2.1 is-string: 1.0.7 dev: true @@ -1280,7 +1414,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 es-shim-unscopables: 1.0.0 dev: true @@ -1290,10 +1424,22 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 es-shim-unscopables: 1.0.0 dev: true + /arraybuffer.prototype.slice@1.0.1: + resolution: {integrity: sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.2 + define-properties: 1.2.0 + get-intrinsic: 1.2.1 + is-array-buffer: 3.0.2 + is-shared-array-buffer: 1.0.2 + dev: true + /assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} dev: true @@ -1352,7 +1498,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001515 + caniuse-lite: 1.0.30001516 electron-to-chromium: 1.4.461 node-releases: 2.0.13 update-browserslist-db: 1.0.11(browserslist@4.21.9) @@ -1406,8 +1552,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001515: - resolution: {integrity: sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==} + /caniuse-lite@1.0.30001516: + resolution: {integrity: sha512-Wmec9pCBY8CWbmI4HsjBeQLqDTqV91nFVR83DnZpYyRnPI1wePDsTg0bGLPC5VU/3OIZV1fmxEea1b+tFKe86g==} dev: true /chai@4.3.7: @@ -1717,11 +1863,12 @@ packages: engines: {node: '>=0.12'} dev: true - /es-abstract@1.21.3: - resolution: {integrity: sha512-ZU4miiY1j3sGPFLJ34VJXEqhpmL+HGByCinGHv4HC+Fxl2fI2Z4yR6tl0mORnDr6PA8eihWo4LmSWDbvhALckg==} + /es-abstract@1.22.1: + resolution: {integrity: sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==} engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.1 available-typed-arrays: 1.0.5 call-bind: 1.0.2 es-set-tostringtag: 2.0.1 @@ -1748,10 +1895,13 @@ packages: object-keys: 1.1.1 object.assign: 4.1.4 regexp.prototype.flags: 1.5.0 + safe-array-concat: 1.0.0 safe-regex-test: 1.0.0 string.prototype.trim: 1.2.7 string.prototype.trimend: 1.0.6 string.prototype.trimstart: 1.0.6 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 typed-array-byte-offset: 1.0.0 typed-array-length: 1.0.4 unbox-primitive: 1.0.2 @@ -1782,34 +1932,34 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild@0.18.12: - resolution: {integrity: sha512-XuOVLDdtsDslXStStduT41op21Ytmf4/BDS46aa3xPJ7X5h2eMWBF1oAe3QjUH3bDksocNXgzGUZ7XHIBya6Tg==} + /esbuild@0.18.13: + resolution: {integrity: sha512-vhg/WR/Oiu4oUIkVhmfcc23G6/zWuEQKFS+yiosSHe4aN6+DQRXIfeloYGibIfVhkr4wyfuVsGNLr+sQU1rWWw==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.12 - '@esbuild/android-arm64': 0.18.12 - '@esbuild/android-x64': 0.18.12 - '@esbuild/darwin-arm64': 0.18.12 - '@esbuild/darwin-x64': 0.18.12 - '@esbuild/freebsd-arm64': 0.18.12 - '@esbuild/freebsd-x64': 0.18.12 - '@esbuild/linux-arm': 0.18.12 - '@esbuild/linux-arm64': 0.18.12 - '@esbuild/linux-ia32': 0.18.12 - '@esbuild/linux-loong64': 0.18.12 - '@esbuild/linux-mips64el': 0.18.12 - '@esbuild/linux-ppc64': 0.18.12 - '@esbuild/linux-riscv64': 0.18.12 - '@esbuild/linux-s390x': 0.18.12 - '@esbuild/linux-x64': 0.18.12 - '@esbuild/netbsd-x64': 0.18.12 - '@esbuild/openbsd-x64': 0.18.12 - '@esbuild/sunos-x64': 0.18.12 - '@esbuild/win32-arm64': 0.18.12 - '@esbuild/win32-ia32': 0.18.12 - '@esbuild/win32-x64': 0.18.12 + '@esbuild/android-arm': 0.18.13 + '@esbuild/android-arm64': 0.18.13 + '@esbuild/android-x64': 0.18.13 + '@esbuild/darwin-arm64': 0.18.13 + '@esbuild/darwin-x64': 0.18.13 + '@esbuild/freebsd-arm64': 0.18.13 + '@esbuild/freebsd-x64': 0.18.13 + '@esbuild/linux-arm': 0.18.13 + '@esbuild/linux-arm64': 0.18.13 + '@esbuild/linux-ia32': 0.18.13 + '@esbuild/linux-loong64': 0.18.13 + '@esbuild/linux-mips64el': 0.18.13 + '@esbuild/linux-ppc64': 0.18.13 + '@esbuild/linux-riscv64': 0.18.13 + '@esbuild/linux-s390x': 0.18.13 + '@esbuild/linux-x64': 0.18.13 + '@esbuild/netbsd-x64': 0.18.13 + '@esbuild/openbsd-x64': 0.18.13 + '@esbuild/sunos-x64': 0.18.13 + '@esbuild/win32-arm64': 0.18.13 + '@esbuild/win32-ia32': 0.18.13 + '@esbuild/win32-x64': 0.18.13 dev: true /escalade@3.1.1: @@ -1855,7 +2005,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0): + /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0): resolution: {integrity: sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -1865,8 +2015,8 @@ packages: debug: 4.3.4 enhanced-resolve: 5.15.0 eslint: 8.45.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) get-tsconfig: 4.6.2 globby: 13.2.2 is-core-module: 2.12.1 @@ -1879,7 +2029,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -1900,16 +2050,16 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) debug: 3.2.7 eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@6.0.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): + /eslint-plugin-import@2.27.5(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -1919,7 +2069,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/parser': 6.0.0(eslint@8.45.0)(typescript@5.1.6) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -1927,7 +2077,7 @@ packages: doctrine: 2.1.0 eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.0.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.45.0) has: 1.0.3 is-core-module: 2.12.1 is-glob: 4.0.3 @@ -2260,7 +2410,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 functions-have-names: 1.2.3 dev: true @@ -2410,6 +2560,10 @@ packages: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true + /grapheme-splitter@1.0.4: + resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} + dev: true + /graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true @@ -2729,6 +2883,10 @@ packages: is-docker: 2.2.1 dev: true + /isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + dev: true + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -3095,7 +3253,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /on-finished@2.4.1: @@ -3405,6 +3563,16 @@ packages: queue-microtask: 1.2.3 dev: true + /safe-array-concat@1.0.0: + resolution: {integrity: sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-regex-test@1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} dependencies: @@ -3557,7 +3725,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /string.prototype.trimend@1.0.6: @@ -3565,7 +3733,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /string.prototype.trimstart@1.0.6: @@ -3573,7 +3741,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.2.0 - es-abstract: 1.21.3 + es-abstract: 1.22.1 dev: true /strip-ansi@6.0.1: @@ -3721,6 +3889,15 @@ packages: punycode: 2.3.0 dev: true + /ts-api-utils@1.0.1(typescript@5.1.6): + resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} + engines: {node: '>=16.13.0'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.1.6 + dev: true + /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -3765,6 +3942,25 @@ packages: engines: {node: '>=10'} dev: true + /typed-array-buffer@1.0.0: + resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + is-typed-array: 1.1.10 + dev: true + + /typed-array-byte-length@1.0.0: + resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.10 + dev: true + /typed-array-byte-offset@1.0.0: resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} engines: {node: '>= 0.4'} @@ -3906,7 +4102,7 @@ packages: optional: true dependencies: '@types/node': 20.4.2 - esbuild: 0.18.12 + esbuild: 0.18.13 postcss: 8.4.26 rollup: 3.26.2 optionalDependencies: