Apply dependencies update
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Dec 2022 20:40:56 +0000 (21:40 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Dec 2022 20:40:56 +0000 (21:40 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package-lock.json
package.json
src/utils/Configuration.ts
src/utils/Utils.ts
test/utils/UtilsTest.ts
ui/web/package-lock.json
ui/web/package.json

index 237fd74b37d68d651e49e9028a02e8d8197c8599..7fde64e83bd7147fc427058e2237dad50e7d161f 100644 (file)
@@ -38,7 +38,7 @@
         "@rollup/plugin-json": "^5.0.2",
         "@types/mocha": "^10.0.1",
         "@types/mochawesome": "^6.2.1",
-        "@types/node": "^18.11.12",
+        "@types/node": "^18.11.13",
         "@types/proper-lockfile": "^4.1.2",
         "@types/tar": "^6.1.3",
         "@types/ws": "^8.5.3",
         "expect": "^29.3.1",
         "husky": "^8.0.2",
         "lint-staged": "^13.1.0",
-        "mocha": "^10.1.0",
+        "mocha": "^10.2.0",
         "mochawesome": "^7.1.3",
         "prettier": "^2.8.1",
         "release-it": "^15.5.1",
         "robohydra": "^0.6.9",
-        "rollup": "^3.7.0",
+        "rollup": "^3.7.3",
         "rollup-plugin-analyzer": "^4.0.0",
         "rollup-plugin-copy": "^3.4.0",
         "rollup-plugin-delete": "^2.0.0",
       }
     },
     "node_modules/@types/node": {
-      "version": "18.11.12",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.12.tgz",
-      "integrity": "sha512-FgD3NtTAKvyMmD44T07zz2fEf+OKwutgBCEVM8GcvMGVGaDktiLNTDvPwC/LUe3PinMW+X6CuLOF2Ui1mAlSXg=="
+      "version": "18.11.13",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
+      "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w=="
     },
     "node_modules/@types/object-path": {
       "version": "0.11.1",
       }
     },
     "node_modules/mocha": {
-      "version": "10.1.0",
-      "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
-      "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
+      "version": "10.2.0",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
+      "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
       "dev": true,
       "dependencies": {
         "ansi-colors": "4.1.1",
       }
     },
     "node_modules/rollup": {
-      "version": "3.7.0",
-      "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.7.0.tgz",
-      "integrity": "sha512-FIJe0msW9P7L9BTfvaJyvn1U1BVCNTL3w8O+PKIrCyiMLg+rIUGb4MbcgVZ10Lnm1uWXOTOWRNARjfXC1+M12Q==",
+      "version": "3.7.3",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.7.3.tgz",
+      "integrity": "sha512-7e68MQbAWCX6mI4/0lG1WHd+NdNAlVamg0Zkd+8LZ/oXojligdGnCNyHlzXqXCZObyjs5FRc3AH0b17iJESGIQ==",
       "dev": true,
       "bin": {
         "rollup": "dist/bin/rollup"
       }
     },
     "@types/node": {
-      "version": "18.11.12",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.12.tgz",
-      "integrity": "sha512-FgD3NtTAKvyMmD44T07zz2fEf+OKwutgBCEVM8GcvMGVGaDktiLNTDvPwC/LUe3PinMW+X6CuLOF2Ui1mAlSXg=="
+      "version": "18.11.13",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
+      "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w=="
     },
     "@types/object-path": {
       "version": "0.11.1",
       }
     },
     "mocha": {
-      "version": "10.1.0",
-      "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz",
-      "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==",
+      "version": "10.2.0",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
+      "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
       "dev": true,
       "requires": {
         "ansi-colors": "4.1.1",
       }
     },
     "rollup": {
-      "version": "3.7.0",
-      "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.7.0.tgz",
-      "integrity": "sha512-FIJe0msW9P7L9BTfvaJyvn1U1BVCNTL3w8O+PKIrCyiMLg+rIUGb4MbcgVZ10Lnm1uWXOTOWRNARjfXC1+M12Q==",
+      "version": "3.7.3",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.7.3.tgz",
+      "integrity": "sha512-7e68MQbAWCX6mI4/0lG1WHd+NdNAlVamg0Zkd+8LZ/oXojligdGnCNyHlzXqXCZObyjs5FRc3AH0b17iJESGIQ==",
       "dev": true,
       "requires": {
         "fsevents": "~2.3.2"
index 5d0c2dcfda9a4786b52d09af2c51dbcecce74eb3..6c47903cb561af3dfbbe4cb99bc56636af061dc2 100644 (file)
     "@rollup/plugin-json": "^5.0.2",
     "@types/mocha": "^10.0.1",
     "@types/mochawesome": "^6.2.1",
-    "@types/node": "^18.11.12",
+    "@types/node": "^18.11.13",
     "@types/proper-lockfile": "^4.1.2",
     "@types/tar": "^6.1.3",
     "@types/ws": "^8.5.3",
     "expect": "^29.3.1",
     "husky": "^8.0.2",
     "lint-staged": "^13.1.0",
-    "mocha": "^10.1.0",
+    "mocha": "^10.2.0",
     "mochawesome": "^7.1.3",
     "prettier": "^2.8.1",
     "release-it": "^15.5.1",
     "robohydra": "^0.6.9",
-    "rollup": "^3.7.0",
+    "rollup": "^3.7.3",
     "rollup-plugin-analyzer": "^4.0.0",
     "rollup-plugin-copy": "^3.4.0",
     "rollup-plugin-delete": "^2.0.0",
index 8c13db91fa84c0425eb1d5ebcd0c3d0cce46bbea..f18935313ee37e76b6f4869939d8f8e5fcc4be91 100644 (file)
@@ -401,7 +401,7 @@ export default class Configuration {
     }
   }
 
-  private static isObject(item): boolean {
+  private static isObject(item: unknown): boolean {
     return item && typeof item === 'object' && Array.isArray(item) === false;
   }
 
index 8dda95a699b362c66c5bb195e96de4abf30e39c1..006e9ddd40278c8f3e84d75f4e4306267c3fcfed 100644 (file)
@@ -50,16 +50,17 @@ export default class Utils {
     return Utils.formatDurationMilliSeconds(duration * 1000);
   }
 
-  public static convertToDate(value: unknown): Date {
-    // Check
-    if (!value) {
-      return value as Date;
+  public static convertToDate(value: unknown): Date | null | undefined {
+    if (Utils.isNullOrUndefined(value)) {
+      return value as null | undefined;
+    }
+    if (value instanceof Date) {
+      return value;
     }
-    // Check Type
-    if (!(value instanceof Date)) {
-      return new Date(value as string);
+    if (Utils.isString(value) || typeof value === 'number') {
+      return new Date(value as string | number);
     }
-    return value;
+    return null;
   }
 
   public static convertToInt(value: unknown): number {
index 36d06ddb2ebb2a5240832b9a31214f4ab77f8a85..8093d5e759346baabfe634d0db575e863c8a65e0 100644 (file)
@@ -25,26 +25,22 @@ describe('Utils test suite', () => {
   it('Verify convertToDate()', () => {
     expect(Utils.convertToDate(undefined)).toBe(undefined);
     expect(Utils.convertToDate(null)).toBe(null);
-    expect(Utils.convertToDate(0)).toBe(0);
+    const invalidDate = Utils.convertToDate('');
+    expect(invalidDate instanceof Date && !isNaN(invalidDate.getTime())).toBe(false);
+    expect(Utils.convertToDate(0)).toStrictEqual(new Date('1970-01-01T00:00:00.000Z'));
+    expect(Utils.convertToDate([])).toBe(null);
+    expect(Utils.convertToDate({})).toBe(null);
+    expect(Utils.convertToDate(new Map())).toBe(null);
+    expect(Utils.convertToDate(new Set())).toBe(null);
+    expect(Utils.convertToDate(new WeakMap())).toBe(null);
+    expect(Utils.convertToDate(new WeakSet())).toBe(null);
     const dateStr = '2020-01-01T00:00:00.000Z';
     let date = Utils.convertToDate(dateStr);
     expect(date).toBeInstanceOf(Date);
-    expect(date.getUTCFullYear()).toBe(2020);
-    expect(date.getUTCMonth()).toBe(0);
-    expect(date.getUTCDate()).toBe(1);
-    expect(date.getUTCHours()).toBe(0);
-    expect(date.getUTCMinutes()).toBe(0);
-    expect(date.getUTCSeconds()).toBe(0);
-    expect(date.getUTCMilliseconds()).toBe(0);
+    expect(date).toStrictEqual(new Date(dateStr));
     date = Utils.convertToDate(new Date(dateStr));
     expect(date).toBeInstanceOf(Date);
-    expect(date.getUTCFullYear()).toBe(2020);
-    expect(date.getUTCMonth()).toBe(0);
-    expect(date.getUTCDate()).toBe(1);
-    expect(date.getUTCHours()).toBe(0);
-    expect(date.getUTCMinutes()).toBe(0);
-    expect(date.getUTCSeconds()).toBe(0);
-    expect(date.getUTCMilliseconds()).toBe(0);
+    expect(date).toStrictEqual(new Date(dateStr));
   });
 
   it('Verify convertToInt()', () => {
index b7c038f0a917b8a4f009be5b906c7d98f2fafef4..a8895268d5b1e8f4772d60fd4d59774d444ed558 100644 (file)
@@ -18,7 +18,7 @@
       "devDependencies": {
         "@types/chai": "^4.3.4",
         "@types/mocha": "^10.0.1",
-        "@types/node": "^18.11.12",
+        "@types/node": "^18.11.13",
         "@typescript-eslint/eslint-plugin": "^5.46.0",
         "@typescript-eslint/parser": "^5.46.0",
         "@vue/cli": "~5.0.8",
       "dev": true
     },
     "node_modules/@types/node": {
-      "version": "18.11.12",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.12.tgz",
-      "integrity": "sha512-FgD3NtTAKvyMmD44T07zz2fEf+OKwutgBCEVM8GcvMGVGaDktiLNTDvPwC/LUe3PinMW+X6CuLOF2Ui1mAlSXg==",
+      "version": "18.11.13",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
+      "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==",
       "dev": true
     },
     "node_modules/@types/normalize-package-data": {
       }
     },
     "node_modules/postcss": {
-      "version": "8.4.19",
-      "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz",
-      "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==",
+      "version": "8.4.20",
+      "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
+      "integrity": "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==",
       "funding": [
         {
           "type": "opencollective",
       "dev": true
     },
     "@types/node": {
-      "version": "18.11.12",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.12.tgz",
-      "integrity": "sha512-FgD3NtTAKvyMmD44T07zz2fEf+OKwutgBCEVM8GcvMGVGaDktiLNTDvPwC/LUe3PinMW+X6CuLOF2Ui1mAlSXg==",
+      "version": "18.11.13",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
+      "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==",
       "dev": true
     },
     "@types/normalize-package-data": {
       "dev": true
     },
     "postcss": {
-      "version": "8.4.19",
-      "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz",
-      "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==",
+      "version": "8.4.20",
+      "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
+      "integrity": "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==",
       "requires": {
         "nanoid": "^3.3.4",
         "picocolors": "^1.0.0",
index dd5426a0cfb552ca93812a22957ef0cfba5d9199..702e871dfccc9f8ee08306573740729ca8876498 100644 (file)
@@ -21,7 +21,7 @@
   "devDependencies": {
     "@types/chai": "^4.3.4",
     "@types/mocha": "^10.0.1",
-    "@types/node": "^18.11.12",
+    "@types/node": "^18.11.13",
     "@typescript-eslint/eslint-plugin": "^5.46.0",
     "@typescript-eslint/parser": "^5.46.0",
     "@vue/cli": "~5.0.8",