From e3822d6f1b40477f7308ad70c290ed2c4106c585 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 6 May 2022 08:53:56 +0200 Subject: [PATCH] Fix Json type definition naming MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 189 +++++++++++++----- package.json | 2 +- src/charging-station/ChargingStation.ts | 14 +- .../ocpp/1.6/OCPP16IncomingRequestService.ts | 6 +- .../ocpp/1.6/OCPP16RequestService.ts | 10 +- .../ocpp/1.6/OCPP16ResponseService.ts | 6 +- .../ocpp/OCPPIncomingRequestService.ts | 4 +- .../ocpp/OCPPRequestService.ts | 28 +-- .../ocpp/OCPPResponseService.ts | 6 +- .../AbstractUIService.ts | 10 +- .../ui-websocket-services/UIService001.ts | 6 +- src/exception/OCPPError.ts | 6 +- src/types/ChargingStationWorker.ts | 4 +- src/types/JsonType.ts | 10 +- src/types/UIProtocol.ts | 8 +- src/types/Worker.ts | 4 +- src/types/ocpp/1.6/ChargingProfile.ts | 8 +- src/types/ocpp/1.6/MeterValues.ts | 8 +- src/types/ocpp/1.6/Requests.ts | 30 +-- src/types/ocpp/1.6/Responses.ts | 22 +- src/types/ocpp/1.6/Transaction.ts | 16 +- src/types/ocpp/Configuration.ts | 4 +- src/types/ocpp/Requests.ts | 21 +- src/types/ocpp/Responses.ts | 10 +- src/utils/FileUtils.ts | 4 +- 25 files changed, 261 insertions(+), 175 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2b25d51..d384252c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,7 @@ "prettier": "^2.6.2", "release-it": "^15.0.0", "robohydra": "^0.6.9", - "rollup": "^2.71.1", + "rollup": "^2.72.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", @@ -994,33 +994,33 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz", + "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.12", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", - "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.10.tgz", + "integrity": "sha512-Q0YbBd6OTsXm8Y21+YUSDXupHnodNC2M4O18jtd3iwJ3+vMZNdKGols0a9G6JOK0dcJ3IdUUHoh908ZI6qhk8Q==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -3559,9 +3559,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001335", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001335.tgz", - "integrity": "sha512-ddP1Tgm7z2iIxu6QTtbZUv6HJxSaV/PZeSrWFZtbY4JZ69tOeNhBCl3HyRQgeNZKE5AOn1kpV7fhljigy0Ty3w==", + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", "dev": true, "funding": [ { @@ -5148,9 +5148,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.133", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.133.tgz", - "integrity": "sha512-ZiIO/VXWqY9WME7vztTySSqwm4+A8o66upAb4AmxPwOLejUM8dffcDKY+Hj6oBq/1de7w75n4GxYFxF52ewnUQ==", + "version": "1.4.136", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.136.tgz", + "integrity": "sha512-GnITX8rHnUrIVnTxU9UlsTnSemHUA2iF+6QrRqxFbp/mf0vfuSc/goEyyQhUX3TUUCE3mv/4BNuXOtaJ4ur0eA==", "dev": true }, "node_modules/elliptic": { @@ -5262,17 +5262,19 @@ } }, "node_modules/es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.0.tgz", + "integrity": "sha512-URbD8tgRthKD3YcC39vbvSDrX23upXnPcnGAjQfgxXF5ID75YcENawc9ZX/9iTP9ptUyfCLIxTTuMYoRfiOVKA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", @@ -5284,9 +5286,10 @@ "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.1", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -6735,12 +6738,39 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gauge": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", @@ -12744,6 +12774,23 @@ "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" }, + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", @@ -13822,9 +13869,9 @@ } }, "node_modules/rollup": { - "version": "2.71.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.71.1.tgz", - "integrity": "sha512-lMZk3XfUBGjrrZQpvPSoXcZSfKcJ2Bgn+Z0L1MoW2V8Wh7BVM+LOBJTPo16yul2MwL59cXedzW1ruq3rCjSRgw==", + "version": "2.72.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.72.0.tgz", + "integrity": "sha512-KqtR2YcO35/KKijg4nx4STO3569aqCUeGRkKWnJ6r+AvBBrVY9L4pmf4NHVrQr4mTOq6msbohflxr2kpihhaOA==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -17888,27 +17935,27 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", + "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", "dev": true }, "@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz", + "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.12", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz", - "integrity": "sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==", + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", + "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.10.tgz", + "integrity": "sha512-Q0YbBd6OTsXm8Y21+YUSDXupHnodNC2M4O18jtd3iwJ3+vMZNdKGols0a9G6JOK0dcJ3IdUUHoh908ZI6qhk8Q==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -19868,9 +19915,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001335", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001335.tgz", - "integrity": "sha512-ddP1Tgm7z2iIxu6QTtbZUv6HJxSaV/PZeSrWFZtbY4JZ69tOeNhBCl3HyRQgeNZKE5AOn1kpV7fhljigy0Ty3w==", + "version": "1.0.30001336", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz", + "integrity": "sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw==", "dev": true }, "caseless": { @@ -21170,9 +21217,9 @@ } }, "electron-to-chromium": { - "version": "1.4.133", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.133.tgz", - "integrity": "sha512-ZiIO/VXWqY9WME7vztTySSqwm4+A8o66upAb4AmxPwOLejUM8dffcDKY+Hj6oBq/1de7w75n4GxYFxF52ewnUQ==", + "version": "1.4.136", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.136.tgz", + "integrity": "sha512-GnITX8rHnUrIVnTxU9UlsTnSemHUA2iF+6QrRqxFbp/mf0vfuSc/goEyyQhUX3TUUCE3mv/4BNuXOtaJ4ur0eA==", "dev": true }, "elliptic": { @@ -21279,17 +21326,19 @@ } }, "es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.0.tgz", + "integrity": "sha512-URbD8tgRthKD3YcC39vbvSDrX23upXnPcnGAjQfgxXF5ID75YcENawc9ZX/9iTP9ptUyfCLIxTTuMYoRfiOVKA==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", @@ -21301,9 +21350,10 @@ "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.1", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" } }, "es-array-method-boxes-properly": { @@ -22473,12 +22523,30 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "gauge": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", @@ -27140,6 +27208,17 @@ "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" }, + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + } + }, "regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", @@ -27901,9 +27980,9 @@ } }, "rollup": { - "version": "2.71.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.71.1.tgz", - "integrity": "sha512-lMZk3XfUBGjrrZQpvPSoXcZSfKcJ2Bgn+Z0L1MoW2V8Wh7BVM+LOBJTPo16yul2MwL59cXedzW1ruq3rCjSRgw==", + "version": "2.72.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.72.0.tgz", + "integrity": "sha512-KqtR2YcO35/KKijg4nx4STO3569aqCUeGRkKWnJ6r+AvBBrVY9L4pmf4NHVrQr4mTOq6msbohflxr2kpihhaOA==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/package.json b/package.json index 136ad822..e6664dd1 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "prettier": "^2.6.2", "release-it": "^15.0.0", "robohydra": "^0.6.9", - "rollup": "^2.71.1", + "rollup": "^2.72.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index e5759c33..d0707043 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -64,7 +64,7 @@ import Constants from '../utils/Constants'; import { ErrorType } from '../types/ocpp/ErrorType'; import { FileType } from '../types/FileType'; import FileUtils from '../utils/FileUtils'; -import { JsonType } from '../types/JsonType'; +import { JsonObject } from '../types/JsonType'; import { MessageType } from '../types/ocpp/MessageType'; import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestService'; import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService'; @@ -1572,14 +1572,14 @@ export default class ChargingStation { let messageType: number; let messageId: string; let commandName: IncomingRequestCommand; - let commandPayload: JsonType; + let commandPayload: JsonObject; let errorType: ErrorType; let errorMessage: string; - let errorDetails: JsonType; - let responseCallback: (payload: JsonType, requestPayload: JsonType) => void; + let errorDetails: JsonObject; + let responseCallback: (payload: JsonObject, requestPayload: JsonObject) => void; let errorCallback: (error: OCPPError, requestStatistic?: boolean) => void; let requestCommandName: RequestCommand | IncomingRequestCommand; - let requestPayload: JsonType; + let requestPayload: JsonObject; let cachedRequest: CachedRequest; let errMsg: string; try { @@ -1627,7 +1627,7 @@ export default class ChargingStation { ErrorType.PROTOCOL_ERROR, `Cached request for message id ${messageId} response is not iterable`, null, - cachedRequest as unknown as JsonType + cachedRequest as unknown as JsonObject ); } logger.debug( @@ -1657,7 +1657,7 @@ export default class ChargingStation { ErrorType.PROTOCOL_ERROR, `Cached request for message id ${messageId} error response is not iterable`, null, - cachedRequest as unknown as JsonType + cachedRequest as unknown as JsonObject ); } logger.debug( diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 8dc9135f..0241e177 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -64,7 +64,7 @@ import Constants from '../../../utils/Constants'; import { DefaultResponse } from '../../../types/ocpp/Responses'; import { ErrorType } from '../../../types/ocpp/ErrorType'; import { IncomingRequestHandler } from '../../../types/ocpp/Requests'; -import { JsonType } from '../../../types/JsonType'; +import { JsonObject } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus'; import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus'; @@ -129,9 +129,9 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer public async incomingRequestHandler( messageId: string, commandName: OCPP16IncomingRequestCommand, - commandPayload: JsonType + commandPayload: JsonObject ): Promise { - let response: JsonType; + let response: JsonObject; if ( this.chargingStation.getOcppStrictCompliance() && this.chargingStation.isInPendingState() && diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 75e113d2..2a4165c4 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -3,7 +3,7 @@ import type ChargingStation from '../../ChargingStation'; import Constants from '../../../utils/Constants'; import { ErrorType } from '../../../types/ocpp/ErrorType'; -import { JsonType } from '../../../types/JsonType'; +import { JsonObject } from '../../../types/JsonType'; import { OCPP16RequestCommand } from '../../../types/ocpp/1.6/Requests'; import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; @@ -22,9 +22,9 @@ export default class OCPP16RequestService extends OCPPRequestService { super(chargingStation, ocppResponseService); } - public async requestHandler( + public async requestHandler( commandName: OCPP16RequestCommand, - commandParams?: JsonType, + commandParams?: JsonObject, params?: RequestParams ): Promise { if (Object.values(OCPP16RequestCommand).includes(commandName)) { @@ -43,9 +43,9 @@ export default class OCPP16RequestService extends OCPPRequestService { ); } - private buildRequestPayload( + private buildRequestPayload( commandName: OCPP16RequestCommand, - commandParams?: JsonType + commandParams?: JsonObject ): Request { let connectorId: number; switch (commandName) { diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 5a60af63..c8946d43 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -26,7 +26,7 @@ import { import type ChargingStation from '../../ChargingStation'; import { ErrorType } from '../../../types/ocpp/ErrorType'; -import { JsonType } from '../../../types/JsonType'; +import { JsonObject } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus'; import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; @@ -60,8 +60,8 @@ export default class OCPP16ResponseService extends OCPPResponseService { public async responseHandler( commandName: OCPP16RequestCommand, - payload: JsonType, - requestPayload: JsonType + payload: JsonObject, + requestPayload: JsonObject ): Promise { if ( this.chargingStation.isRegistered() || diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index b5f607f5..d7d14c2e 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -1,7 +1,7 @@ import type ChargingStation from '../ChargingStation'; import { HandleErrorParams } from '../../types/Error'; import { IncomingRequestCommand } from '../../types/ocpp/Requests'; -import { JsonType } from '../../types/JsonType'; +import { JsonObject } from '../../types/JsonType'; import logger from '../../utils/Logger'; export default abstract class OCPPIncomingRequestService { @@ -50,6 +50,6 @@ export default abstract class OCPPIncomingRequestService { public abstract incomingRequestHandler( messageId: string, commandName: IncomingRequestCommand, - commandPayload: JsonType + commandPayload: JsonObject ): Promise; } diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index e906daf8..c19944ba 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -12,7 +12,7 @@ import Constants from '../../utils/Constants'; import { EmptyObject } from '../../types/EmptyObject'; import { ErrorType } from '../../types/ocpp/ErrorType'; import { HandleErrorParams } from '../../types/Error'; -import { JsonType } from '../../types/JsonType'; +import { JsonObject } from '../../types/JsonType'; import { MessageType } from '../../types/ocpp/MessageType'; import OCPPError from '../../exception/OCPPError'; import type OCPPResponseService from './OCPPResponseService'; @@ -56,7 +56,7 @@ export default abstract class OCPPRequestService { public async sendResponse( messageId: string, - messagePayload: JsonType, + messagePayload: JsonObject, commandName: IncomingRequestCommand ): Promise { try { @@ -92,7 +92,7 @@ export default abstract class OCPPRequestService { protected async sendMessage( messageId: string, - messagePayload: JsonType, + messagePayload: JsonObject, commandName: RequestCommand, params: RequestParams = { skipBufferingOnError: false, @@ -114,7 +114,7 @@ export default abstract class OCPPRequestService { private async internalSendMessage( messageId: string, - messagePayload: JsonType | OCPPError, + messagePayload: JsonObject | OCPPError, messageType: MessageType, commandName?: RequestCommand | IncomingRequestCommand, params: RequestParams = { @@ -169,7 +169,7 @@ export default abstract class OCPPRequestService { ErrorType.GENERIC_ERROR, `WebSocket closed for buffered message id '${messageId}' with content '${messageToSend}'`, commandName, - (messagePayload?.details as JsonType) ?? {} + (messagePayload?.details as JsonObject) ?? {} ); if (messageType === MessageType.CALL_MESSAGE) { // Reject it but keep the request in the cache @@ -183,7 +183,7 @@ export default abstract class OCPPRequestService { ErrorType.GENERIC_ERROR, `WebSocket closed for non buffered message id '${messageId}' with content '${messageToSend}'`, commandName, - (messagePayload?.details as JsonType) ?? {} + (messagePayload?.details as JsonObject) ?? {} ), false ); @@ -201,8 +201,8 @@ export default abstract class OCPPRequestService { * @param requestPayload */ async function responseCallback( - payload: JsonType, - requestPayload: JsonType + payload: JsonObject, + requestPayload: JsonObject ): Promise { if (self.chargingStation.getEnableStatistics()) { self.chargingStation.performanceStatistics.addRequestStatistic( @@ -253,7 +253,7 @@ export default abstract class OCPPRequestService { ErrorType.GENERIC_ERROR, `Timeout for message id '${messageId}'`, commandName, - (messagePayload?.details as JsonType) ?? {} + (messagePayload?.details as JsonObject) ?? {} ), () => { messageType === MessageType.CALL_MESSAGE && @@ -270,10 +270,10 @@ export default abstract class OCPPRequestService { private buildMessageToSend( messageId: string, - messagePayload: JsonType | OCPPError, + messagePayload: JsonObject | OCPPError, messageType: MessageType, commandName?: RequestCommand | IncomingRequestCommand, - responseCallback?: (payload: JsonType, requestPayload: JsonType) => Promise, + responseCallback?: (payload: JsonObject, requestPayload: JsonObject) => Promise, errorCallback?: (error: OCPPError, requestStatistic?: boolean) => void ): string { let messageToSend: string; @@ -286,7 +286,7 @@ export default abstract class OCPPRequestService { responseCallback, errorCallback, commandName, - messagePayload as JsonType, + messagePayload as JsonObject, ]); messageToSend = JSON.stringify([ messageType, @@ -342,9 +342,9 @@ export default abstract class OCPPRequestService { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public abstract requestHandler( + public abstract requestHandler( commandName: RequestCommand, - commandParams?: JsonType, + commandParams?: JsonObject, params?: RequestParams ): Promise; } diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index e838bd9f..f45d1b43 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,5 +1,5 @@ import type ChargingStation from '../ChargingStation'; -import { JsonType } from '../../types/JsonType'; +import { JsonObject } from '../../types/JsonType'; import { RequestCommand } from '../../types/ocpp/Requests'; export default abstract class OCPPResponseService { @@ -26,7 +26,7 @@ export default abstract class OCPPResponseService { public abstract responseHandler( commandName: RequestCommand, - payload: JsonType, - requestPayload: JsonType + payload: JsonObject, + requestPayload: JsonObject ): Promise; } diff --git a/src/charging-station/ui-websocket-services/AbstractUIService.ts b/src/charging-station/ui-websocket-services/AbstractUIService.ts index 42cfa428..9fd577cd 100644 --- a/src/charging-station/ui-websocket-services/AbstractUIService.ts +++ b/src/charging-station/ui-websocket-services/AbstractUIService.ts @@ -1,7 +1,7 @@ import { ProtocolCommand, ProtocolRequestHandler } from '../../types/UIProtocol'; import BaseError from '../../exception/BaseError'; -import { JsonType } from '../../types/JsonType'; +import { JsonObject } from '../../types/JsonType'; import UIWebSocketServer from '../UIWebSocketServer'; import logger from '../../utils/Logger'; @@ -16,12 +16,12 @@ export default abstract class AbstractUIService { ]); } - public async messageHandler(command: ProtocolCommand, payload: JsonType): Promise { - let messageResponse: JsonType; + public async messageHandler(command: ProtocolCommand, payload: JsonObject): Promise { + let messageResponse: JsonObject; if (this.messageHandlers.has(command)) { try { // Call the method to build the message response - messageResponse = (await this.messageHandlers.get(command)(payload)) as JsonType; + messageResponse = (await this.messageHandlers.get(command)(payload)) as JsonObject; } catch (error) { // Log logger.error(this.uiWebSocketServer.logPrefix() + ' Handle message error: %j', error); @@ -41,7 +41,7 @@ export default abstract class AbstractUIService { this.uiWebSocketServer.broadcastToClients(this.buildProtocolMessage(command, messageResponse)); } - protected buildProtocolMessage(command: ProtocolCommand, payload: JsonType): string { + protected buildProtocolMessage(command: ProtocolCommand, payload: JsonObject): string { return JSON.stringify([command, payload]); } diff --git a/src/charging-station/ui-websocket-services/UIService001.ts b/src/charging-station/ui-websocket-services/UIService001.ts index 18fb66a9..82bafd78 100644 --- a/src/charging-station/ui-websocket-services/UIService001.ts +++ b/src/charging-station/ui-websocket-services/UIService001.ts @@ -1,7 +1,7 @@ import { ProtocolCommand, ProtocolRequestHandler } from '../../types/UIProtocol'; import AbstractUIService from './AbstractUIService'; -import { JsonType } from '../../types/JsonType'; +import { JsonObject } from '../../types/JsonType'; import UIWebSocketServer from '../UIWebSocketServer'; export default class UIService001 extends AbstractUIService { @@ -17,6 +17,6 @@ export default class UIService001 extends AbstractUIService { ); } - private handleStartTransaction(payload: JsonType): void {} - private handleStopTransaction(payload: JsonType): void {} + private handleStartTransaction(payload: JsonObject): void {} + private handleStopTransaction(payload: JsonObject): void {} } diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index e67f3c95..bfe64fb4 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -4,18 +4,18 @@ import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; import BaseError from './BaseError'; import { ErrorType } from '../types/ocpp/ErrorType'; -import { JsonType } from '../types/JsonType'; +import { JsonObject } from '../types/JsonType'; export default class OCPPError extends BaseError { code: ErrorType; command?: RequestCommand | IncomingRequestCommand; - details?: JsonType; + details?: JsonObject; constructor( code: ErrorType, message: string, command?: RequestCommand | IncomingRequestCommand, - details?: JsonType + details?: JsonObject ) { super(message); diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index f5a0206d..fe09514f 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -1,8 +1,8 @@ import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; -import { JsonType } from './JsonType'; +import { JsonObject } from './JsonType'; -export interface ChargingStationWorkerOptions extends JsonType { +export interface ChargingStationWorkerOptions extends JsonObject { elementStartDelay?: number; } diff --git a/src/types/JsonType.ts b/src/types/JsonType.ts index 4e4aedc0..5b6c9f6f 100644 --- a/src/types/JsonType.ts +++ b/src/types/JsonType.ts @@ -1,7 +1,7 @@ -type JsonArray = Array; +type JsonPrimitive = string | number | boolean | Date | null; -export type JsonValue = string | number | boolean | Date | JsonType | JsonArray; - -export type JsonType = { - [key in string]: JsonValue; +export type JsonObject = { + [key in string]: JsonType; }; + +export type JsonType = JsonPrimitive | JsonType[] | JsonObject; diff --git a/src/types/UIProtocol.ts b/src/types/UIProtocol.ts index 6d247892..4ff499b4 100644 --- a/src/types/UIProtocol.ts +++ b/src/types/UIProtocol.ts @@ -1,4 +1,4 @@ -import { JsonType } from './JsonType'; +import { JsonObject } from './JsonType'; export enum Protocol { UI = 'ui', @@ -15,8 +15,8 @@ export enum ProtocolCommand { UNKNOWN = 'unknown', } -export type ProtocolRequest = [ProtocolCommand, JsonType]; +export type ProtocolRequest = [ProtocolCommand, JsonObject]; export type ProtocolRequestHandler = ( - payload: JsonType -) => void | Promise | JsonType | Promise; + payload: JsonObject +) => void | Promise | JsonObject | Promise; diff --git a/src/types/Worker.ts b/src/types/Worker.ts index 83d62f3f..05dc4158 100644 --- a/src/types/Worker.ts +++ b/src/types/Worker.ts @@ -1,4 +1,4 @@ -import { JsonType } from './JsonType'; +import { JsonObject } from './JsonType'; import { PoolOptions } from 'poolifier'; import { Worker } from 'worker_threads'; @@ -18,7 +18,7 @@ export interface WorkerOptions { messageHandler?: (message: unknown) => void | Promise; } -export type WorkerData = JsonType; +export type WorkerData = JsonObject; export interface WorkerSetElement { worker: Worker; diff --git a/src/types/ocpp/1.6/ChargingProfile.ts b/src/types/ocpp/1.6/ChargingProfile.ts index e39c2137..b33bf066 100644 --- a/src/types/ocpp/1.6/ChargingProfile.ts +++ b/src/types/ocpp/1.6/ChargingProfile.ts @@ -1,6 +1,6 @@ -import { JsonType } from '../../JsonType'; +import { JsonObject } from '../../JsonType'; -export interface OCPP16ChargingProfile extends JsonType { +export interface OCPP16ChargingProfile extends JsonObject { chargingProfileId: number; transactionId?: number; stackLevel: number; @@ -12,7 +12,7 @@ export interface OCPP16ChargingProfile extends JsonType { chargingSchedule: ChargingSchedule; } -export interface ChargingSchedule extends JsonType { +export interface ChargingSchedule extends JsonObject { duration?: number; startSchedule?: Date; chargingRateUnit: OCPP16ChargingRateUnitType; @@ -20,7 +20,7 @@ export interface ChargingSchedule extends JsonType { minChargeRate?: number; } -export interface OCPP16ChargingSchedulePeriod extends JsonType { +export interface OCPP16ChargingSchedulePeriod extends JsonObject { startPeriod: number; limit: number; numberPhases?: number; diff --git a/src/types/ocpp/1.6/MeterValues.ts b/src/types/ocpp/1.6/MeterValues.ts index 54c283fb..f8137c36 100644 --- a/src/types/ocpp/1.6/MeterValues.ts +++ b/src/types/ocpp/1.6/MeterValues.ts @@ -1,5 +1,5 @@ import { EmptyObject } from '../../EmptyObject'; -import { JsonType } from '../../JsonType'; +import { JsonObject } from '../../JsonType'; export enum MeterValueUnit { WATT_HOUR = 'Wh', @@ -82,7 +82,7 @@ export enum MeterValueFormat { SIGNED_DATA = 'SignedData', } -export interface OCPP16SampledValue extends JsonType { +export interface OCPP16SampledValue extends JsonObject { value?: string; unit?: MeterValueUnit; context?: MeterValueContext; @@ -92,12 +92,12 @@ export interface OCPP16SampledValue extends JsonType { format?: MeterValueFormat; } -export interface OCPP16MeterValue extends JsonType { +export interface OCPP16MeterValue extends JsonObject { timestamp: string; sampledValue: OCPP16SampledValue[]; } -export interface OCPP16MeterValuesRequest extends JsonType { +export interface OCPP16MeterValuesRequest extends JsonObject { connectorId: number; transactionId?: number; meterValue: OCPP16MeterValue[]; diff --git a/src/types/ocpp/1.6/Requests.ts b/src/types/ocpp/1.6/Requests.ts index 6518213c..31825e16 100644 --- a/src/types/ocpp/1.6/Requests.ts +++ b/src/types/ocpp/1.6/Requests.ts @@ -1,7 +1,7 @@ import { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile'; import { EmptyObject } from '../../EmptyObject'; -import { JsonType } from '../../JsonType'; +import { JsonObject } from '../../JsonType'; import { OCPP16ChargePointErrorCode } from './ChargePointErrorCode'; import { OCPP16ChargePointStatus } from './ChargePointStatus'; import { OCPP16DiagnosticsStatus } from './DiagnosticsStatus'; @@ -35,7 +35,7 @@ export enum OCPP16IncomingRequestCommand { export type OCPP16HeartbeatRequest = EmptyObject; -export interface OCPP16BootNotificationRequest extends JsonType { +export interface OCPP16BootNotificationRequest extends JsonObject { chargeBoxSerialNumber?: string; chargePointModel: string; chargePointSerialNumber?: string; @@ -47,7 +47,7 @@ export interface OCPP16BootNotificationRequest extends JsonType { meterType?: string; } -export interface OCPP16StatusNotificationRequest extends JsonType { +export interface OCPP16StatusNotificationRequest extends JsonObject { connectorId: number; errorCode: OCPP16ChargePointErrorCode; info?: string; @@ -57,26 +57,26 @@ export interface OCPP16StatusNotificationRequest extends JsonType { vendorErrorCode?: string; } -export interface ChangeConfigurationRequest extends JsonType { +export interface ChangeConfigurationRequest extends JsonObject { key: string | OCPP16StandardParametersKey; value: string; } -export interface RemoteStartTransactionRequest extends JsonType { +export interface RemoteStartTransactionRequest extends JsonObject { connectorId: number; idTag: string; chargingProfile?: OCPP16ChargingProfile; } -export interface RemoteStopTransactionRequest extends JsonType { +export interface RemoteStopTransactionRequest extends JsonObject { transactionId: number; } -export interface UnlockConnectorRequest extends JsonType { +export interface UnlockConnectorRequest extends JsonObject { connectorId: number; } -export interface GetConfigurationRequest extends JsonType { +export interface GetConfigurationRequest extends JsonObject { key?: string | OCPP16StandardParametersKey[]; } @@ -85,11 +85,11 @@ export enum ResetType { SOFT = 'Soft', } -export interface ResetRequest extends JsonType { +export interface ResetRequest extends JsonObject { type: ResetType; } -export interface SetChargingProfileRequest extends JsonType { +export interface SetChargingProfileRequest extends JsonObject { connectorId: number; csChargingProfiles: OCPP16ChargingProfile; } @@ -99,19 +99,19 @@ export enum OCPP16AvailabilityType { OPERATIVE = 'Operative', } -export interface ChangeAvailabilityRequest extends JsonType { +export interface ChangeAvailabilityRequest extends JsonObject { connectorId: number; type: OCPP16AvailabilityType; } -export interface ClearChargingProfileRequest extends JsonType { +export interface ClearChargingProfileRequest extends JsonObject { id?: number; connectorId?: number; chargingProfilePurpose?: ChargingProfilePurposeType; stackLevel?: number; } -export interface GetDiagnosticsRequest extends JsonType { +export interface GetDiagnosticsRequest extends JsonObject { location: string; retries?: number; retryInterval?: number; @@ -119,7 +119,7 @@ export interface GetDiagnosticsRequest extends JsonType { stopTime?: Date; } -export interface DiagnosticsStatusNotificationRequest extends JsonType { +export interface DiagnosticsStatusNotificationRequest extends JsonObject { status: OCPP16DiagnosticsStatus; } @@ -132,7 +132,7 @@ export enum MessageTrigger { StatusNotification = 'StatusNotification', } -export interface OCPP16TriggerMessageRequest extends JsonType { +export interface OCPP16TriggerMessageRequest extends JsonObject { requestedMessage: MessageTrigger; connectorId?: number; } diff --git a/src/types/ocpp/1.6/Responses.ts b/src/types/ocpp/1.6/Responses.ts index ac59c291..08076964 100644 --- a/src/types/ocpp/1.6/Responses.ts +++ b/src/types/ocpp/1.6/Responses.ts @@ -1,8 +1,8 @@ import { EmptyObject } from '../../EmptyObject'; -import { JsonType } from '../../JsonType'; +import { JsonObject } from '../../JsonType'; import { OCPPConfigurationKey } from '../Configuration'; -export interface OCPP16HeartbeatResponse extends JsonType { +export interface OCPP16HeartbeatResponse extends JsonObject { currentTime: string; } @@ -12,7 +12,7 @@ export enum OCPP16UnlockStatus { NOT_SUPPORTED = 'NotSupported', } -export interface UnlockConnectorResponse extends JsonType { +export interface UnlockConnectorResponse extends JsonObject { status: OCPP16UnlockStatus; } @@ -23,7 +23,7 @@ export enum OCPP16ConfigurationStatus { NOT_SUPPORTED = 'NotSupported', } -export interface ChangeConfigurationResponse extends JsonType { +export interface ChangeConfigurationResponse extends JsonObject { status: OCPP16ConfigurationStatus; } @@ -33,7 +33,7 @@ export enum OCPP16RegistrationStatus { REJECTED = 'Rejected', } -export interface OCPP16BootNotificationResponse extends JsonType { +export interface OCPP16BootNotificationResponse extends JsonObject { status: OCPP16RegistrationStatus; currentTime: string; interval: number; @@ -41,7 +41,7 @@ export interface OCPP16BootNotificationResponse extends JsonType { export type OCPP16StatusNotificationResponse = EmptyObject; -export interface GetConfigurationResponse extends JsonType { +export interface GetConfigurationResponse extends JsonObject { configurationKey: OCPPConfigurationKey[]; unknownKey: string[]; } @@ -52,7 +52,7 @@ export enum OCPP16ChargingProfileStatus { NOT_SUPPORTED = 'NotSupported', } -export interface SetChargingProfileResponse extends JsonType { +export interface SetChargingProfileResponse extends JsonObject { status: OCPP16ChargingProfileStatus; } @@ -62,7 +62,7 @@ export enum OCPP16AvailabilityStatus { SCHEDULED = 'Scheduled', } -export interface ChangeAvailabilityResponse extends JsonType { +export interface ChangeAvailabilityResponse extends JsonObject { status: OCPP16AvailabilityStatus; } @@ -71,11 +71,11 @@ export enum OCPP16ClearChargingProfileStatus { UNKNOWN = 'Unknown', } -export interface ClearChargingProfileResponse extends JsonType { +export interface ClearChargingProfileResponse extends JsonObject { status: OCPP16ClearChargingProfileStatus; } -export interface GetDiagnosticsResponse extends JsonType { +export interface GetDiagnosticsResponse extends JsonObject { fileName?: string; } @@ -87,6 +87,6 @@ export enum OCPP16TriggerMessageStatus { NOT_IMPLEMENTED = 'NotImplemented', } -export interface OCPP16TriggerMessageResponse extends JsonType { +export interface OCPP16TriggerMessageResponse extends JsonObject { status: OCPP16TriggerMessageStatus; } diff --git a/src/types/ocpp/1.6/Transaction.ts b/src/types/ocpp/1.6/Transaction.ts index 13d6df64..7e9059c3 100644 --- a/src/types/ocpp/1.6/Transaction.ts +++ b/src/types/ocpp/1.6/Transaction.ts @@ -1,4 +1,4 @@ -import { JsonType } from '../../JsonType'; +import { JsonObject } from '../../JsonType'; import { OCPP16MeterValue } from './MeterValues'; export enum OCPP16StopTransactionReason { @@ -24,21 +24,21 @@ export enum OCPP16AuthorizationStatus { CONCURRENT_TX = 'ConcurrentTx', } -export interface IdTagInfo extends JsonType { +export interface IdTagInfo extends JsonObject { status: OCPP16AuthorizationStatus; parentIdTag?: string; expiryDate?: Date; } -export interface OCPP16AuthorizeRequest extends JsonType { +export interface OCPP16AuthorizeRequest extends JsonObject { idTag: string; } -export interface OCPP16AuthorizeResponse extends JsonType { +export interface OCPP16AuthorizeResponse extends JsonObject { idTagInfo: IdTagInfo; } -export interface OCPP16StartTransactionRequest extends JsonType { +export interface OCPP16StartTransactionRequest extends JsonObject { connectorId: number; idTag: string; meterStart: number; @@ -46,12 +46,12 @@ export interface OCPP16StartTransactionRequest extends JsonType { timestamp: string; } -export interface OCPP16StartTransactionResponse extends JsonType { +export interface OCPP16StartTransactionResponse extends JsonObject { idTagInfo: IdTagInfo; transactionId: number; } -export interface OCPP16StopTransactionRequest extends JsonType { +export interface OCPP16StopTransactionRequest extends JsonObject { idTag?: string; meterStop: number; timestamp: string; @@ -60,6 +60,6 @@ export interface OCPP16StopTransactionRequest extends JsonType { transactionData?: OCPP16MeterValue[]; } -export interface OCPP16StopTransactionResponse extends JsonType { +export interface OCPP16StopTransactionResponse extends JsonObject { idTagInfo?: IdTagInfo; } diff --git a/src/types/ocpp/Configuration.ts b/src/types/ocpp/Configuration.ts index 5747663c..5aa96818 100644 --- a/src/types/ocpp/Configuration.ts +++ b/src/types/ocpp/Configuration.ts @@ -4,7 +4,7 @@ import { OCPP16VendorDefaultParametersKey, } from './1.6/Configuration'; -import { JsonType } from '../JsonType'; +import { JsonObject } from '../JsonType'; export type StandardParametersKey = OCPP16StandardParametersKey; @@ -35,7 +35,7 @@ export enum ConnectorPhaseRotation { TSR = 'TSR', } -export interface OCPPConfigurationKey extends JsonType { +export interface OCPPConfigurationKey extends JsonObject { key: string | StandardParametersKey; readonly: boolean; value?: string; diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index 16a79c05..60724254 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -7,26 +7,33 @@ import { OCPP16StatusNotificationRequest, } from './1.6/Requests'; -import { JsonType } from '../JsonType'; +import { JsonObject } from '../JsonType'; import { MessageType } from './MessageType'; import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; import { OCPP16MeterValuesRequest } from './1.6/MeterValues'; import OCPPError from '../../exception/OCPPError'; -export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType]; +export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonObject]; -export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType]; +export type IncomingRequest = [ + MessageType.CALL_MESSAGE, + string, + IncomingRequestCommand, + JsonObject +]; export type CachedRequest = [ - (payload: JsonType, requestPayload: JsonType) => void, + (payload: JsonObject, requestPayload: JsonObject) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, - JsonType + JsonObject ]; -export type IncomingRequestHandler = (commandPayload: JsonType) => JsonType | Promise; +export type IncomingRequestHandler = ( + commandPayload: JsonObject +) => JsonObject | Promise; -export type ResponseType = JsonType | OCPPError; +export type ResponseType = JsonObject | OCPPError; export interface RequestParams { skipBufferingOnError?: boolean; diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index baefc637..db44800c 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -12,17 +12,17 @@ import { } from './1.6/Responses'; import { ErrorType } from './ErrorType'; -import { JsonType } from '../JsonType'; +import { JsonObject } from '../JsonType'; import { MessageType } from './MessageType'; import { OCPP16MeterValuesResponse } from './1.6/MeterValues'; -export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType]; +export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonObject]; -export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType]; +export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonObject]; export type ResponseHandler = ( - payload: JsonType, - requestPayload?: JsonType + payload: JsonObject, + requestPayload?: JsonObject ) => void | Promise; export type BootNotificationResponse = OCPP16BootNotificationResponse; diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index 5c15734b..c61ff8f4 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -1,4 +1,4 @@ -import { JsonType, JsonValue } from '../types/JsonType'; +import { JsonObject, JsonType } from '../types/JsonType'; import { EmptyObject } from '../types/EmptyObject'; import { FileType } from '../types/FileType'; @@ -9,7 +9,7 @@ import fs from 'fs'; import logger from './Logger'; export default class FileUtils { - static watchJsonFile( + static watchJsonFile( logPrefix: string, fileType: FileType, file: string, -- 2.34.1