fix(simulator): detect string emptyness properly
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 7 Feb 2023 20:20:10 +0000 (21:20 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 7 Feb 2023 20:20:10 +0000 (21:20 +0100)
Close #390

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
16 files changed:
package-lock.json
package.json
src/charging-station/AuthorizedTagsCache.ts
src/charging-station/ChargingStation.ts
src/charging-station/ChargingStationUtils.ts
src/charging-station/SharedLRUCache.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/OCPPServiceUtils.ts
src/charging-station/ui-server/UIHttpServer.ts
src/charging-station/ui-server/UIWebSocketServer.ts
src/utils/FileUtils.ts
src/utils/Logger.ts
src/utils/Utils.ts
test/utils/UtilsTest.ts
ui/web/package-lock.json
ui/web/package.json

index 882f5454901d4edc507f0f4150d5dd8c046830a9..69d682bd7985fddc764e13c845051a672d26d67b 100644 (file)
         "http-status-codes": "^2.2.0",
         "just-clone": "^6.2.0",
         "just-merge": "^3.2.0",
+        "logform": "^2.5.1",
         "mnemonist": "^0.39.5",
         "moment": "^2.29.4",
-        "mongodb": "^5.0.0",
+        "mongodb": "^5.0.1",
         "poolifier": "^2.3.7",
         "proper-lockfile": "^4.1.2",
         "source-map-support": "^0.5.21",
@@ -41,7 +42,7 @@
         "@rollup/plugin-json": "^6.0.0",
         "@types/mocha": "^10.0.1",
         "@types/mochawesome": "^6.2.1",
-        "@types/node": "^18.11.19",
+        "@types/node": "^18.13.0",
         "@types/proper-lockfile": "^4.1.2",
         "@types/tar": "^6.1.3",
         "@types/ws": "^8.5.4",
@@ -59,9 +60,9 @@
         "eslint-plugin-n": "^15.6.1",
         "eslint-plugin-prettier": "^4.2.1",
         "eslint-plugin-tsdoc": "^0.2.17",
-        "expect": "^29.4.1",
+        "expect": "^29.4.2",
         "husky": "^8.0.3",
-        "lint-staged": "^13.1.0",
+        "lint-staged": "^13.1.1",
         "mocha": "^10.2.0",
         "mochawesome": "^7.1.3",
         "prettier": "^2.8.3",
       }
     },
     "node_modules/@jest/expect-utils": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz",
-      "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.2.tgz",
+      "integrity": "sha512-Dd3ilDJpBnqa0GiPN7QrudVs0cczMMHtehSo2CSTjm3zdHx0RcpmhFNVEltuEFeqfLIyWKFI224FsMSQ/nsJQA==",
       "dev": true,
       "dependencies": {
-        "jest-get-type": "^29.2.0"
+        "jest-get-type": "^29.4.2"
       },
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/@jest/schemas": {
-      "version": "29.4.0",
-      "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz",
-      "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.2.tgz",
+      "integrity": "sha512-ZrGzGfh31NtdVH8tn0mgJw4khQuNHiKqdzJAFbCaERbyCP9tHlxWuL/mnMu8P7e/+k4puWjI1NOzi/sFsjce/g==",
       "dev": true,
       "dependencies": {
         "@sinclair/typebox": "^0.25.16"
       }
     },
     "node_modules/@jest/types": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz",
-      "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.2.tgz",
+      "integrity": "sha512-CKlngyGP0fwlgC1BRUtPZSiWLBhyS9dKwKmyGxk8Z6M82LBEGB2aLQSg+U1MyLsU+M7UjnlLllBM2BLWKVm/Uw==",
       "dev": true,
       "dependencies": {
-        "@jest/schemas": "^29.4.0",
+        "@jest/schemas": "^29.4.2",
         "@types/istanbul-lib-coverage": "^2.0.0",
         "@types/istanbul-reports": "^3.0.0",
         "@types/node": "*",
       }
     },
     "node_modules/@types/node": {
-      "version": "18.11.19",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
-      "integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw=="
+      "version": "18.13.0",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
+      "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg=="
     },
     "node_modules/@types/normalize-package-data": {
       "version": "2.4.1",
         "minipass": "^3.3.5"
       }
     },
+    "node_modules/@types/triple-beam": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.2.tgz",
+      "integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g=="
+    },
     "node_modules/@types/ua-parser-js": {
       "version": "0.7.36",
       "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.36.tgz",
       }
     },
     "node_modules/@types/yargs": {
-      "version": "17.0.20",
-      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.20.tgz",
-      "integrity": "sha512-eknWrTHofQuPk2iuqDm1waA7V6xPlbgBoaaXEgYkClhLOnB0TtbW+srJaOToAgawPxPlHQzwypFA2bhZaUGP5A==",
+      "version": "17.0.22",
+      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
+      "integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==",
       "dev": true,
       "dependencies": {
         "@types/yargs-parser": "*"
       }
     },
     "node_modules/diff-sequences": {
-      "version": "29.3.1",
-      "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz",
-      "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.2.tgz",
+      "integrity": "sha512-R6P0Y6PrsH3n4hUXxL3nns0rbRk6Q33js3ygJBeEpbzLzgcNuJ61+u0RXasFpTKISw99TxUzFnumSnRLsjhLaw==",
       "dev": true,
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/expect": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz",
-      "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.2.tgz",
+      "integrity": "sha512-+JHYg9O3hd3RlICG90OPVjRkPBoiUH7PxvDVMnRiaq1g6JUgZStX514erMl0v2Dc5SkfVbm7ztqbd6qHHPn+mQ==",
       "dev": true,
       "dependencies": {
-        "@jest/expect-utils": "^29.4.1",
-        "jest-get-type": "^29.2.0",
-        "jest-matcher-utils": "^29.4.1",
-        "jest-message-util": "^29.4.1",
-        "jest-util": "^29.4.1"
+        "@jest/expect-utils": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "jest-matcher-utils": "^29.4.2",
+        "jest-message-util": "^29.4.2",
+        "jest-util": "^29.4.2"
       },
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/jest-diff": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz",
-      "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.2.tgz",
+      "integrity": "sha512-EK8DSajVtnjx9sa1BkjZq3mqChm2Cd8rIzdXkQMA8e0wuXq53ypz6s5o5V8HRZkoEt2ywJ3eeNWFKWeYr8HK4g==",
       "dev": true,
       "dependencies": {
         "chalk": "^4.0.0",
-        "diff-sequences": "^29.3.1",
-        "jest-get-type": "^29.2.0",
-        "pretty-format": "^29.4.1"
+        "diff-sequences": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "pretty-format": "^29.4.2"
       },
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/jest-get-type": {
-      "version": "29.2.0",
-      "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz",
-      "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.2.tgz",
+      "integrity": "sha512-vERN30V5i2N6lqlFu4ljdTqQAgrkTFMC9xaIIfOPYBw04pufjXRty5RuXBiB1d72tGbURa/UgoiHB90ruOSivg==",
       "dev": true,
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/jest-matcher-utils": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz",
-      "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.2.tgz",
+      "integrity": "sha512-EZaAQy2je6Uqkrm6frnxBIdaWtSYFoR8SVb2sNLAtldswlR/29JAgx+hy67llT3+hXBaLB0zAm5UfeqerioZyg==",
       "dev": true,
       "dependencies": {
         "chalk": "^4.0.0",
-        "jest-diff": "^29.4.1",
-        "jest-get-type": "^29.2.0",
-        "pretty-format": "^29.4.1"
+        "jest-diff": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "pretty-format": "^29.4.2"
       },
       "engines": {
         "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
       }
     },
     "node_modules/jest-message-util": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz",
-      "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.2.tgz",
+      "integrity": "sha512-SElcuN4s6PNKpOEtTInjOAA8QvItu0iugkXqhYyguRvQoXapg5gN+9RQxLAkakChZA7Y26j6yUCsFWN+hlKD6g==",
       "dev": true,
       "dependencies": {
         "@babel/code-frame": "^7.12.13",
-        "@jest/types": "^29.4.1",
+        "@jest/types": "^29.4.2",
         "@types/stack-utils": "^2.0.0",
         "chalk": "^4.0.0",
         "graceful-fs": "^4.2.9",
         "micromatch": "^4.0.4",
-        "pretty-format": "^29.4.1",
+        "pretty-format": "^29.4.2",
         "slash": "^3.0.0",
         "stack-utils": "^2.0.3"
       },
       }
     },
     "node_modules/jest-util": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz",
-      "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.2.tgz",
+      "integrity": "sha512-wKnm6XpJgzMUSRFB7YF48CuwdzuDIHenVuoIb1PLuJ6F+uErZsuDkU+EiExkChf6473XcawBrSfDSnXl+/YG4g==",
       "dev": true,
       "dependencies": {
-        "@jest/types": "^29.4.1",
+        "@jest/types": "^29.4.2",
         "@types/node": "*",
         "chalk": "^4.0.0",
         "ci-info": "^3.2.0",
       "dev": true
     },
     "node_modules/lint-staged": {
-      "version": "13.1.0",
-      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.1.0.tgz",
-      "integrity": "sha512-pn/sR8IrcF/T0vpWLilih8jmVouMlxqXxKuAojmbiGX5n/gDnz+abdPptlj0vYnbfE0SQNl3CY/HwtM0+yfOVQ==",
+      "version": "13.1.1",
+      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.1.1.tgz",
+      "integrity": "sha512-LLJLO0Kdbcv2a+CvSF4p1M7jBZOajKSMpBUvyR8+bXccsqPER0/NxTFQSpNHjqwV9kM3tkHczYerTB5wI+bksQ==",
       "dev": true,
       "dependencies": {
         "cli-truncate": "^3.1.0",
       }
     },
     "node_modules/logform": {
-      "version": "2.4.2",
-      "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.2.tgz",
-      "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==",
+      "version": "2.5.1",
+      "resolved": "https://registry.npmjs.org/logform/-/logform-2.5.1.tgz",
+      "integrity": "sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==",
       "dependencies": {
         "@colors/colors": "1.5.0",
+        "@types/triple-beam": "^1.3.2",
         "fecha": "^4.2.0",
         "ms": "^2.1.1",
         "safe-stable-stringify": "^2.3.1",
       }
     },
     "node_modules/mongodb": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.0.0.tgz",
-      "integrity": "sha512-WHmlbefKp/iAX2LlSZ56iKt4pRftib/dD3mDaji8R7IJcRoKPc5+/kSn3mIBxKPLVxcl73KdDKBLkQTxj1OjaA==",
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.0.1.tgz",
+      "integrity": "sha512-KpjtY+NWFmcic6UDYEdfn768ZTuKyv7CRaui7ZSd6q/0/o1AURMC7KygTUwB1Cl8V10Pe5NiP+Y2eBMCDs/ygQ==",
       "dependencies": {
         "bson": "^5.0.0",
         "mongodb-connection-string-url": "^2.6.0",
       }
     },
     "node_modules/pretty-format": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz",
-      "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.2.tgz",
+      "integrity": "sha512-qKlHR8yFVCbcEWba0H0TOC8dnLlO4vPlyEjRPw31FZ2Rupy9nLa8ZLbYny8gWEl8CkEhJqAE6IzdNELTBVcBEg==",
       "dev": true,
       "dependencies": {
-        "@jest/schemas": "^29.4.0",
+        "@jest/schemas": "^29.4.2",
         "ansi-styles": "^5.0.0",
         "react-is": "^18.0.0"
       },
       }
     },
     "node_modules/release-it/node_modules/ansi-escapes/node_modules/type-fest": {
-      "version": "3.5.5",
-      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.5.tgz",
-      "integrity": "sha512-Nudle2CLcCaf9/1bVQunwzX1/ZH4Z6mvP8hkWWZCbKrxtnN52QwD5Xn/mo68aofQhGU4be1GlEC6LQCTKGXkRw==",
+      "version": "3.5.6",
+      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.6.tgz",
+      "integrity": "sha512-6bd2bflx8ed7c99tc6zSTIzHr1/QG29bQoK4Qh8MYGnlPbODUzGxklLShjwc/xWQQFHgIci+y5Arv7Rbb0LjXw==",
       "dev": true,
       "engines": {
         "node": ">=14.16"
       }
     },
     "@jest/expect-utils": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz",
-      "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.2.tgz",
+      "integrity": "sha512-Dd3ilDJpBnqa0GiPN7QrudVs0cczMMHtehSo2CSTjm3zdHx0RcpmhFNVEltuEFeqfLIyWKFI224FsMSQ/nsJQA==",
       "dev": true,
       "requires": {
-        "jest-get-type": "^29.2.0"
+        "jest-get-type": "^29.4.2"
       }
     },
     "@jest/schemas": {
-      "version": "29.4.0",
-      "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz",
-      "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.2.tgz",
+      "integrity": "sha512-ZrGzGfh31NtdVH8tn0mgJw4khQuNHiKqdzJAFbCaERbyCP9tHlxWuL/mnMu8P7e/+k4puWjI1NOzi/sFsjce/g==",
       "dev": true,
       "requires": {
         "@sinclair/typebox": "^0.25.16"
       }
     },
     "@jest/types": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz",
-      "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.2.tgz",
+      "integrity": "sha512-CKlngyGP0fwlgC1BRUtPZSiWLBhyS9dKwKmyGxk8Z6M82LBEGB2aLQSg+U1MyLsU+M7UjnlLllBM2BLWKVm/Uw==",
       "dev": true,
       "requires": {
-        "@jest/schemas": "^29.4.0",
+        "@jest/schemas": "^29.4.2",
         "@types/istanbul-lib-coverage": "^2.0.0",
         "@types/istanbul-reports": "^3.0.0",
         "@types/node": "*",
       }
     },
     "@types/node": {
-      "version": "18.11.19",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
-      "integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw=="
+      "version": "18.13.0",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
+      "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg=="
     },
     "@types/normalize-package-data": {
       "version": "2.4.1",
         "minipass": "^3.3.5"
       }
     },
+    "@types/triple-beam": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.2.tgz",
+      "integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g=="
+    },
     "@types/ua-parser-js": {
       "version": "0.7.36",
       "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.36.tgz",
       }
     },
     "@types/yargs": {
-      "version": "17.0.20",
-      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.20.tgz",
-      "integrity": "sha512-eknWrTHofQuPk2iuqDm1waA7V6xPlbgBoaaXEgYkClhLOnB0TtbW+srJaOToAgawPxPlHQzwypFA2bhZaUGP5A==",
+      "version": "17.0.22",
+      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
+      "integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==",
       "dev": true,
       "requires": {
         "@types/yargs-parser": "*"
       "dev": true
     },
     "diff-sequences": {
-      "version": "29.3.1",
-      "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz",
-      "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.2.tgz",
+      "integrity": "sha512-R6P0Y6PrsH3n4hUXxL3nns0rbRk6Q33js3ygJBeEpbzLzgcNuJ61+u0RXasFpTKISw99TxUzFnumSnRLsjhLaw==",
       "dev": true
     },
     "diffie-hellman": {
       }
     },
     "expect": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz",
-      "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.2.tgz",
+      "integrity": "sha512-+JHYg9O3hd3RlICG90OPVjRkPBoiUH7PxvDVMnRiaq1g6JUgZStX514erMl0v2Dc5SkfVbm7ztqbd6qHHPn+mQ==",
       "dev": true,
       "requires": {
-        "@jest/expect-utils": "^29.4.1",
-        "jest-get-type": "^29.2.0",
-        "jest-matcher-utils": "^29.4.1",
-        "jest-message-util": "^29.4.1",
-        "jest-util": "^29.4.1"
+        "@jest/expect-utils": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "jest-matcher-utils": "^29.4.2",
+        "jest-message-util": "^29.4.2",
+        "jest-util": "^29.4.2"
       }
     },
     "ext": {
       }
     },
     "jest-diff": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz",
-      "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.2.tgz",
+      "integrity": "sha512-EK8DSajVtnjx9sa1BkjZq3mqChm2Cd8rIzdXkQMA8e0wuXq53ypz6s5o5V8HRZkoEt2ywJ3eeNWFKWeYr8HK4g==",
       "dev": true,
       "requires": {
         "chalk": "^4.0.0",
-        "diff-sequences": "^29.3.1",
-        "jest-get-type": "^29.2.0",
-        "pretty-format": "^29.4.1"
+        "diff-sequences": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "pretty-format": "^29.4.2"
       }
     },
     "jest-get-type": {
-      "version": "29.2.0",
-      "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz",
-      "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.2.tgz",
+      "integrity": "sha512-vERN30V5i2N6lqlFu4ljdTqQAgrkTFMC9xaIIfOPYBw04pufjXRty5RuXBiB1d72tGbURa/UgoiHB90ruOSivg==",
       "dev": true
     },
     "jest-matcher-utils": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz",
-      "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.2.tgz",
+      "integrity": "sha512-EZaAQy2je6Uqkrm6frnxBIdaWtSYFoR8SVb2sNLAtldswlR/29JAgx+hy67llT3+hXBaLB0zAm5UfeqerioZyg==",
       "dev": true,
       "requires": {
         "chalk": "^4.0.0",
-        "jest-diff": "^29.4.1",
-        "jest-get-type": "^29.2.0",
-        "pretty-format": "^29.4.1"
+        "jest-diff": "^29.4.2",
+        "jest-get-type": "^29.4.2",
+        "pretty-format": "^29.4.2"
       }
     },
     "jest-message-util": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz",
-      "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.2.tgz",
+      "integrity": "sha512-SElcuN4s6PNKpOEtTInjOAA8QvItu0iugkXqhYyguRvQoXapg5gN+9RQxLAkakChZA7Y26j6yUCsFWN+hlKD6g==",
       "dev": true,
       "requires": {
         "@babel/code-frame": "^7.12.13",
-        "@jest/types": "^29.4.1",
+        "@jest/types": "^29.4.2",
         "@types/stack-utils": "^2.0.0",
         "chalk": "^4.0.0",
         "graceful-fs": "^4.2.9",
         "micromatch": "^4.0.4",
-        "pretty-format": "^29.4.1",
+        "pretty-format": "^29.4.2",
         "slash": "^3.0.0",
         "stack-utils": "^2.0.3"
       }
     },
     "jest-util": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz",
-      "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.2.tgz",
+      "integrity": "sha512-wKnm6XpJgzMUSRFB7YF48CuwdzuDIHenVuoIb1PLuJ6F+uErZsuDkU+EiExkChf6473XcawBrSfDSnXl+/YG4g==",
       "dev": true,
       "requires": {
-        "@jest/types": "^29.4.1",
+        "@jest/types": "^29.4.2",
         "@types/node": "*",
         "chalk": "^4.0.0",
         "ci-info": "^3.2.0",
       "dev": true
     },
     "lint-staged": {
-      "version": "13.1.0",
-      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.1.0.tgz",
-      "integrity": "sha512-pn/sR8IrcF/T0vpWLilih8jmVouMlxqXxKuAojmbiGX5n/gDnz+abdPptlj0vYnbfE0SQNl3CY/HwtM0+yfOVQ==",
+      "version": "13.1.1",
+      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.1.1.tgz",
+      "integrity": "sha512-LLJLO0Kdbcv2a+CvSF4p1M7jBZOajKSMpBUvyR8+bXccsqPER0/NxTFQSpNHjqwV9kM3tkHczYerTB5wI+bksQ==",
       "dev": true,
       "requires": {
         "cli-truncate": "^3.1.0",
       }
     },
     "logform": {
-      "version": "2.4.2",
-      "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.2.tgz",
-      "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==",
+      "version": "2.5.1",
+      "resolved": "https://registry.npmjs.org/logform/-/logform-2.5.1.tgz",
+      "integrity": "sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==",
       "requires": {
         "@colors/colors": "1.5.0",
+        "@types/triple-beam": "^1.3.2",
         "fecha": "^4.2.0",
         "ms": "^2.1.1",
         "safe-stable-stringify": "^2.3.1",
       }
     },
     "mongodb": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.0.0.tgz",
-      "integrity": "sha512-WHmlbefKp/iAX2LlSZ56iKt4pRftib/dD3mDaji8R7IJcRoKPc5+/kSn3mIBxKPLVxcl73KdDKBLkQTxj1OjaA==",
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.0.1.tgz",
+      "integrity": "sha512-KpjtY+NWFmcic6UDYEdfn768ZTuKyv7CRaui7ZSd6q/0/o1AURMC7KygTUwB1Cl8V10Pe5NiP+Y2eBMCDs/ygQ==",
       "requires": {
         "bson": "^5.0.0",
         "mongodb-connection-string-url": "^2.6.0",
       "dev": true
     },
     "pretty-format": {
-      "version": "29.4.1",
-      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz",
-      "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==",
+      "version": "29.4.2",
+      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.2.tgz",
+      "integrity": "sha512-qKlHR8yFVCbcEWba0H0TOC8dnLlO4vPlyEjRPw31FZ2Rupy9nLa8ZLbYny8gWEl8CkEhJqAE6IzdNELTBVcBEg==",
       "dev": true,
       "requires": {
-        "@jest/schemas": "^29.4.0",
+        "@jest/schemas": "^29.4.2",
         "ansi-styles": "^5.0.0",
         "react-is": "^18.0.0"
       },
           },
           "dependencies": {
             "type-fest": {
-              "version": "3.5.5",
-              "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.5.tgz",
-              "integrity": "sha512-Nudle2CLcCaf9/1bVQunwzX1/ZH4Z6mvP8hkWWZCbKrxtnN52QwD5Xn/mo68aofQhGU4be1GlEC6LQCTKGXkRw==",
+              "version": "3.5.6",
+              "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.6.tgz",
+              "integrity": "sha512-6bd2bflx8ed7c99tc6zSTIzHr1/QG29bQoK4Qh8MYGnlPbODUzGxklLShjwc/xWQQFHgIci+y5Arv7Rbb0LjXw==",
               "dev": true
             }
           }
index a98354ed1be54067cc6d9fa3ddb22a6a94378d90..6e75c629ae822663bdf44f2c6c429741fcd1e877 100644 (file)
     "http-status-codes": "^2.2.0",
     "just-clone": "^6.2.0",
     "just-merge": "^3.2.0",
+    "logform": "^2.5.1",
     "mnemonist": "^0.39.5",
     "moment": "^2.29.4",
-    "mongodb": "^5.0.0",
+    "mongodb": "^5.0.1",
     "poolifier": "^2.3.7",
     "proper-lockfile": "^4.1.2",
     "source-map-support": "^0.5.21",
     "@rollup/plugin-json": "^6.0.0",
     "@types/mocha": "^10.0.1",
     "@types/mochawesome": "^6.2.1",
-    "@types/node": "^18.11.19",
+    "@types/node": "^18.13.0",
     "@types/proper-lockfile": "^4.1.2",
     "@types/tar": "^6.1.3",
     "@types/ws": "^8.5.4",
     "eslint-plugin-n": "^15.6.1",
     "eslint-plugin-prettier": "^4.2.1",
     "eslint-plugin-tsdoc": "^0.2.17",
-    "expect": "^29.4.1",
+    "expect": "^29.4.2",
     "husky": "^8.0.3",
-    "lint-staged": "^13.1.0",
+    "lint-staged": "^13.1.1",
     "mocha": "^10.2.0",
     "mochawesome": "^7.1.3",
     "prettier": "^2.8.3",
index fd085890f2359af34b8ff1a5580f9d3323c84137..a3c8e5cdc42c7bfc1f9e978bb59067f856783fd3 100644 (file)
@@ -35,7 +35,7 @@ export default class AuthorizedTagsCache {
             this.logPrefix(file),
             undefined,
             (event, filename) => {
-              if (!Utils.isEmptyString(filename) && event === 'change') {
+              if (Utils.isNotEmptyString(filename) && event === 'change') {
                 try {
                   logger.debug(
                     `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload`
index 0de7ab93e822eadae107c678d46f2269ed58c34f..65ea08736287d65bb7137bfa236402b8a1c801a7 100644 (file)
@@ -161,7 +161,7 @@ export default class ChargingStation {
   public logPrefix = (): string => {
     return Utils.logPrefix(
       ` ${
-        (!Utils.isEmptyString(this?.stationInfo?.chargingStationId) &&
+        (Utils.isNotEmptyString(this?.stationInfo?.chargingStationId) &&
           this?.stationInfo?.chargingStationId) ??
         ChargingStationUtils.getChargingStationId(this.index, this.getTemplateFromFile()) ??
         ''
@@ -514,7 +514,7 @@ export default class ChargingStation {
           this.logPrefix(),
           undefined,
           (event, filename): void => {
-            if (!Utils.isEmptyString(filename) && event === 'change') {
+            if (Utils.isNotEmptyString(filename) && event === 'change') {
               try {
                 logger.debug(
                   `${this.logPrefix()} ${FileType.ChargingStationTemplate} ${
@@ -882,7 +882,7 @@ export default class ChargingStation {
     stationInfo.firmwareVersionPattern =
       stationTemplate?.firmwareVersionPattern ?? Constants.SEMVER_PATTERN;
     if (
-      !Utils.isEmptyString(stationInfo.firmwareVersion) &&
+      Utils.isNotEmptyString(stationInfo.firmwareVersion) &&
       new RegExp(stationInfo.firmwareVersionPattern).test(stationInfo.firmwareVersion) === false
     ) {
       logger.warn(
@@ -1037,8 +1037,8 @@ export default class ChargingStation {
     }
     if (
       this.stationInfo.firmwareStatus === FirmwareStatus.Installing &&
-      !Utils.isEmptyString(this.stationInfo.firmwareVersion) &&
-      !Utils.isEmptyString(this.stationInfo.firmwareVersionPattern)
+      Utils.isNotEmptyString(this.stationInfo.firmwareVersion) &&
+      Utils.isNotEmptyString(this.stationInfo.firmwareVersionPattern)
     ) {
       const patternGroup: number | undefined =
         this.stationInfo.firmwareUpgrade?.versionUpgrade?.patternGroup ??
@@ -1102,7 +1102,7 @@ export default class ChargingStation {
       );
     }
     if (
-      !Utils.isEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
+      Utils.isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
       !ChargingStationConfigurationUtils.getConfigurationKey(
         this,
         this.stationInfo.amperageLimitationOcppKey
@@ -1767,7 +1767,7 @@ export default class ChargingStation {
 
   private getAmperageLimitation(): number | undefined {
     if (
-      !Utils.isEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
+      Utils.isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
       ChargingStationConfigurationUtils.getConfigurationKey(
         this,
         this.stationInfo.amperageLimitationOcppKey
index 534a3786e210953acdbdede1c63e6846bb6618f7..2d1adb5d9bebdb274607e7351dd29967352d6db6 100644 (file)
@@ -210,7 +210,7 @@ export class ChargingStationUtils {
     if (!Utils.isUndefined(template[key])) {
       logger.warn(
         `${logPrefix} Deprecated template key '${key}' usage in file '${templateFile}'${
-          !Utils.isEmptyString(logMsgToAppend) && `. ${logMsgToAppend}`
+          Utils.isNotEmptyString(logMsgToAppend) && `. ${logMsgToAppend}`
         }`
       );
     }
@@ -269,13 +269,13 @@ export class ChargingStationUtils {
         })
       : '';
     stationInfo.chargePointSerialNumber =
-      !Utils.isEmptyString(stationTemplate?.chargePointSerialNumberPrefix) &&
+      Utils.isNotEmptyString(stationTemplate?.chargePointSerialNumberPrefix) &&
       `${stationTemplate.chargePointSerialNumberPrefix}${serialNumberSuffix}`;
     stationInfo.chargeBoxSerialNumber =
-      !Utils.isEmptyString(stationTemplate?.chargeBoxSerialNumberPrefix) &&
+      Utils.isNotEmptyString(stationTemplate?.chargeBoxSerialNumberPrefix) &&
       `${stationTemplate.chargeBoxSerialNumberPrefix}${serialNumberSuffix}`;
     stationInfo.meterSerialNumber =
-      !Utils.isEmptyString(stationTemplate?.meterSerialNumberPrefix) &&
+      Utils.isNotEmptyString(stationTemplate?.meterSerialNumberPrefix) &&
       `${stationTemplate.meterSerialNumberPrefix}${serialNumberSuffix}`;
   }
 
index 6b6df2049117f96a6c3df3881a73a1f4c5ae28fa..97ed4cd1806e9ac45d5a1fd28b52cd1acdc63494 100644 (file)
@@ -115,7 +115,7 @@ export default class SharedLRUCache {
       Utils.isNullOrUndefined(chargingStationConfiguration?.configurationHash) === false &&
       Utils.isEmptyArray(chargingStationConfiguration?.configurationKey) === false &&
       Utils.isEmptyObject(chargingStationConfiguration?.stationInfo) === false &&
-      Utils.isEmptyString(chargingStationConfiguration?.configurationHash) === false
+      Utils.isNotEmptyString(chargingStationConfiguration?.configurationHash) === true
     );
   }
 }
index fa3d83284a37342316dd2c234ed7e84eead1695e..1340d8acba6199c907426f706acbf39db6db028f 100644 (file)
@@ -749,7 +749,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
           if (
             chargingStation.getLocalAuthListEnabled() === true &&
             chargingStation.hasAuthorizedTags() === true &&
-            !Utils.isEmptyString(
+            Utils.isNotEmptyString(
               chargingStation.authorizedTagsCache
                 .getAuthorizedTags(
                   ChargingStationUtils.getAuthorizationFile(chargingStation.stationInfo)
@@ -1027,7 +1027,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
     }
     if (
       chargingStation.stationInfo?.firmwareUpgrade?.failureStatus &&
-      !Utils.isEmptyString(chargingStation.stationInfo?.firmwareUpgrade?.failureStatus)
+      Utils.isNotEmptyString(chargingStation.stationInfo?.firmwareUpgrade?.failureStatus)
     ) {
       await chargingStation.ocppRequestService.requestHandler<
         OCPP16FirmwareStatusNotificationRequest,
@@ -1095,9 +1095,9 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
         ftpClient = new Client();
         const accessResponse = await ftpClient.access({
           host: uri.host,
-          ...(!Utils.isEmptyString(uri.port) && { port: Utils.convertToInt(uri.port) }),
-          ...(!Utils.isEmptyString(uri.username) && { user: uri.username }),
-          ...(!Utils.isEmptyString(uri.password) && { password: uri.password }),
+          ...(Utils.isNotEmptyString(uri.port) && { port: Utils.convertToInt(uri.port) }),
+          ...(Utils.isNotEmptyString(uri.username) && { user: uri.username }),
+          ...(Utils.isNotEmptyString(uri.password) && { password: uri.password }),
         });
         let uploadResponse: FTPResponse;
         if (accessResponse.code === 220) {
index 308f6b41239c10a5bde0eadd5bb4414595eba1ce..178e4be7fd8057de90284c8362bea157d3c4c562 100644 (file)
@@ -291,7 +291,7 @@ export class OCPPServiceUtils {
     methodName?: string
   ): string => {
     const logMsg =
-      !Utils.isEmptyString(moduleName) && !Utils.isEmptyString(methodName)
+      Utils.isNotEmptyString(moduleName) && Utils.isNotEmptyString(methodName)
         ? ` OCPP ${ocppVersion} | ${moduleName}.${methodName}:`
         : ` OCPP ${ocppVersion} |`;
     return Utils.logPrefix(logMsg);
index f339dc3f858687ddbb6a46385f8a64d005bd7136..48dfadbdddc8f611ec5fd5150c6ffda83f8c1b41 100644 (file)
@@ -63,7 +63,7 @@ export default class UIHttpServer extends AbstractUIServer {
   public logPrefix = (modName?: string, methodName?: string, prefixSuffix?: string): string => {
     const logMsgPrefix = prefixSuffix ? `UI HTTP Server ${prefixSuffix}` : 'UI HTTP Server';
     const logMsg =
-      !Utils.isEmptyString(modName) && !Utils.isEmptyString(methodName)
+      Utils.isNotEmptyString(modName) && Utils.isNotEmptyString(methodName)
         ? ` ${logMsgPrefix} | ${modName}.${methodName}:`
         : ` ${logMsgPrefix} |`;
     return Utils.logPrefix(logMsg);
index a8abad0b6f6d85b14d06c0b6195853d0e51ae290..9e8ad84b08c9a3da734f2d00ae5962f48fcf73c3 100644 (file)
@@ -150,7 +150,7 @@ export default class UIWebSocketServer extends AbstractUIServer {
       ? `UI WebSocket Server ${prefixSuffix}`
       : 'UI WebSocket Server';
     const logMsg =
-      !Utils.isEmptyString(modName) && !Utils.isEmptyString(methodName)
+      Utils.isNotEmptyString(modName) && Utils.isNotEmptyString(methodName)
         ? ` ${logMsgPrefix} | ${modName}.${methodName}:`
         : ` ${logMsgPrefix} |`;
     return Utils.logPrefix(logMsg);
index 8ef8168039b449e3bbd3d36c727852b07b413af8..ee8f053c59e5d23c579d4d31234e0e255cb64cad 100644 (file)
@@ -20,7 +20,7 @@ export default class FileUtils {
     logPrefix: string,
     refreshedVariable?: T,
     listener: fs.WatchListener<string> = (event, filename) => {
-      if (!Utils.isEmptyString(filename) && event === 'change') {
+      if (Utils.isNotEmptyString(filename) && event === 'change') {
         try {
           logger.debug(`${logPrefix} ${fileType} file ${file} have changed, reload`);
           refreshedVariable && (refreshedVariable = JSON.parse(fs.readFileSync(file, 'utf8')) as T);
@@ -32,7 +32,7 @@ export default class FileUtils {
       }
     }
   ): fs.FSWatcher | undefined {
-    if (!Utils.isEmptyString(file)) {
+    if (Utils.isNotEmptyString(file)) {
       try {
         return fs.watch(file, listener);
       } catch (error) {
@@ -52,7 +52,7 @@ export default class FileUtils {
     logPrefix: string,
     params: HandleErrorParams<EmptyObject> = { throwError: true, consoleOut: false }
   ): void {
-    const prefix = !Utils.isEmptyString(logPrefix) ? `${logPrefix} ` : '';
+    const prefix = Utils.isNotEmptyString(logPrefix) ? `${logPrefix} ` : '';
     let logMsg: string;
     switch (error.code) {
       case 'ENOENT':
index 46897bb9ba20acb467a27ba6bd33d0440f60d6f4..4b884638a5388279eee1a3cce8c7f98d72aaffe8 100644 (file)
@@ -1,5 +1,5 @@
 import type { Format } from 'logform';
-import { Logger, createLogger, format, transport } from 'winston';
+import { type Logger, createLogger, format, type transport } from 'winston';
 import TransportType from 'winston/lib/winston/transports';
 import DailyRotateFile from 'winston-daily-rotate-file';
 
index 810267200fb1e3b1a4949918f264d8f57e085455..433891550f1a222ba474aa2dd83f5edf08f46842 100644 (file)
@@ -193,7 +193,14 @@ export default class Utils {
   }
 
   public static isEmptyString(value: unknown): boolean {
-    return Utils.isString(value) && (value as string).trim().length === 0;
+    return (
+      Utils.isNullOrUndefined(value) ||
+      (Utils.isString(value) && (value as string).trim().length === 0)
+    );
+  }
+
+  public static isNotEmptyString(value: unknown): boolean {
+    return Utils.isString(value) && (value as string).trim().length > 0;
   }
 
   public static isUndefined(value: unknown): boolean {
index 293c24d38407a82b3d0c86ac09ec460fe9dde341..9d694308fdda835948be94afc7c7c8e98656ec13 100644 (file)
@@ -167,8 +167,8 @@ describe('Utils test suite', () => {
     expect(Utils.isEmptyString('test')).toBe(false);
     expect(Utils.isEmptyString(' test')).toBe(false);
     expect(Utils.isEmptyString('test ')).toBe(false);
-    expect(Utils.isEmptyString(undefined)).toBe(false);
-    expect(Utils.isEmptyString(null)).toBe(false);
+    expect(Utils.isEmptyString(undefined)).toBe(true);
+    expect(Utils.isEmptyString(null)).toBe(true);
     expect(Utils.isEmptyString(0)).toBe(false);
     expect(Utils.isEmptyString({})).toBe(false);
     expect(Utils.isEmptyString([])).toBe(false);
@@ -178,6 +178,24 @@ describe('Utils test suite', () => {
     expect(Utils.isEmptyString(new WeakSet())).toBe(false);
   });
 
+  it('Verify isNotEmptyString()', () => {
+    expect(Utils.isNotEmptyString('')).toBe(false);
+    expect(Utils.isNotEmptyString(' ')).toBe(false);
+    expect(Utils.isNotEmptyString('     ')).toBe(false);
+    expect(Utils.isNotEmptyString('test')).toBe(true);
+    expect(Utils.isNotEmptyString(' test')).toBe(true);
+    expect(Utils.isNotEmptyString('test ')).toBe(true);
+    expect(Utils.isNotEmptyString(undefined)).toBe(false);
+    expect(Utils.isNotEmptyString(null)).toBe(false);
+    expect(Utils.isNotEmptyString(0)).toBe(false);
+    expect(Utils.isNotEmptyString({})).toBe(false);
+    expect(Utils.isNotEmptyString([])).toBe(false);
+    expect(Utils.isNotEmptyString(new Map())).toBe(false);
+    expect(Utils.isNotEmptyString(new Set())).toBe(false);
+    expect(Utils.isNotEmptyString(new WeakMap())).toBe(false);
+    expect(Utils.isNotEmptyString(new WeakSet())).toBe(false);
+  });
+
   it('Verify isUndefined()', () => {
     expect(Utils.isUndefined(undefined)).toBe(true);
     expect(Utils.isUndefined(null)).toBe(false);
index f56c164b0c4facfad124e0dc38914d30b731e62e..54ab10fe7066229bc5ff14bd5eab6948f809c4af 100644 (file)
@@ -18,7 +18,7 @@
       "devDependencies": {
         "@types/chai": "^4.3.4",
         "@types/mocha": "^10.0.1",
-        "@types/node": "^18.11.19",
+        "@types/node": "^18.13.0",
         "@typescript-eslint/eslint-plugin": "^5.51.0",
         "@typescript-eslint/parser": "^5.51.0",
         "@vue/cli": "~5.0.8",
       "dev": true
     },
     "node_modules/@types/node": {
-      "version": "18.11.19",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
-      "integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==",
+      "version": "18.13.0",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
+      "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==",
       "dev": true
     },
     "node_modules/@types/normalize-package-data": {
       "dev": true
     },
     "@types/node": {
-      "version": "18.11.19",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.19.tgz",
-      "integrity": "sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==",
+      "version": "18.13.0",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
+      "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==",
       "dev": true
     },
     "@types/normalize-package-data": {
index a66eae7a07819d1cae0d28a3762420adb88df1ea..746ef238bdf125a18ebd018cf213481f11c7798e 100644 (file)
@@ -21,7 +21,7 @@
   "devDependencies": {
     "@types/chai": "^4.3.4",
     "@types/mocha": "^10.0.1",
-    "@types/node": "^18.11.19",
+    "@types/node": "^18.13.0",
     "@typescript-eslint/eslint-plugin": "^5.51.0",
     "@typescript-eslint/parser": "^5.51.0",
     "@vue/cli": "~5.0.8",