From 72285e4d6130f9ea1bdc96b25ada7491b265788f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Sun, 1 Oct 2023 07:27:40 +0000 Subject: [PATCH 1/9] fix: Handle relative config file paths When running as Node.js app --- src/globals.js | 2 +- src/lib/util/assert-options.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/globals.js b/src/globals.js index 77c99dd..512dc37 100644 --- a/src/globals.js +++ b/src/globals.js @@ -38,7 +38,7 @@ const logger = winston.createLogger({ // Are we running as standalone app or not? const isPkg = typeof process.pkg !== 'undefined'; -const execPath = isPkg ? upath.dirname(process.execPath) : __dirname; +const execPath = isPkg ? upath.dirname(process.execPath) : process.cwd(); // Functions to get/set current console logging level const getLoggingLevel = () => logTransports.find((transport) => transport.name === 'console').level; diff --git a/src/lib/util/assert-options.js b/src/lib/util/assert-options.js index 7e37d37..cb4a5fb 100644 --- a/src/lib/util/assert-options.js +++ b/src/lib/util/assert-options.js @@ -12,13 +12,19 @@ const sharedParamAssertOptions = async (options) => { process.exit(1); } + // Debug + logger.debug(`Auth type: ${options.authType}`); + logger.debug(`execPath: ${execPath}`); + logger.debug(`authCertFile: ${options.authCertFile}`); + logger.debug(`authCertKeyFile: ${options.authCertKeyFile}`); + // Verify that certificate files exists (if specified) const fileCert = path.resolve(execPath, options.authCertFile); const fileCertKey = path.resolve(execPath, options.authCertKeyFile); const fileCertExists = await verifyFileExists(fileCert); if (fileCertExists === false) { - logger.error(`Missing certificate key file ${fileCert}. Aborting`); + logger.error(`Missing certificate file ${fileCert}. Aborting`); process.exit(1); } else { logger.verbose(`Certificate file ${fileCert} found`); From ac32be00df87fb2016330dd91f2db1a08f12179a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Sun, 1 Oct 2023 07:27:52 +0000 Subject: [PATCH 2/9] Revert back to normal version numbering --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 19e531c..33d2077 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,8 +28,8 @@ jobs: with: # command: manifest # bootstrap-sha: e0fd792f506ad88db030972c1baa201907844d6a - last-release-sha: 707267ad0bda7a666f3823b6c202e6c4fdc417fd - release-as: 3.13.1 + # last-release-sha: 707267ad0bda7a666f3823b6c202e6c4fdc417fd + # release-as: 3.13.1 release-type: node package-name: ctrl-q default-branch: main From ce0f7b42fe53b9bbeb7389345d537ffb0e2ef3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 14:21:25 +0000 Subject: [PATCH 3/9] chore(deps): Update dependencies to stay safe and secure ... --- package-lock.json | 216 +++++++++++++++++++++++----------------------- package.json | 10 +-- 2 files changed, 113 insertions(+), 113 deletions(-) diff --git a/package-lock.json b/package-lock.json index fbe898e..8c1e13d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,12 @@ "version": "3.13.1", "license": "MIT", "dependencies": { - "axios": "^1.5.0", + "axios": "^1.5.1", "commander": "^11.0.0", - "csv-parse": "^5.5.0", - "csv-stringify": "^6.4.2", + "csv-parse": "^5.5.1", + "csv-stringify": "^6.4.3", "enigma.js": "^2.12.0", - "esbuild": "^0.19.3", + "esbuild": "^0.19.4", "eslint": "^8.50.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^9.0.0", @@ -39,7 +39,7 @@ "devDependencies": { "jest": "^29.7.0", "prettier": "^3.0.3", - "snyk": "^1.1227.0" + "snyk": "^1.1232.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -740,9 +740,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.3.tgz", - "integrity": "sha512-Lemgw4io4VZl9GHJmjiBGzQ7ONXRfRPHcUEerndjwiSkbxzrpq0Uggku5MxxrXdwJ+pTj1qyw4jwTu7hkPsgIA==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", + "integrity": "sha512-uBIbiYMeSsy2U0XQoOGVVcpIktjLMEKa7ryz2RLr7L/vTnANNEsPVAh4xOv7ondGz6ac1zVb0F8Jx20rQikffQ==", "cpu": [ "arm" ], @@ -755,9 +755,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.3.tgz", - "integrity": "sha512-w+Akc0vv5leog550kjJV9Ru+MXMR2VuMrui3C61mnysim0gkFCPOUTAfzTP0qX+HpN9Syu3YA3p1hf3EPqObRw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.4.tgz", + "integrity": "sha512-mRsi2vJsk4Bx/AFsNBqOH2fqedxn5L/moT58xgg51DjX1la64Z3Npicut2VbhvDFO26qjWtPMsVxCd80YTFVeg==", "cpu": [ "arm64" ], @@ -770,9 +770,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.3.tgz", - "integrity": "sha512-FKQJKkK5MXcBHoNZMDNUAg1+WcZlV/cuXrWCoGF/TvdRiYS4znA0m5Il5idUwfxrE20bG/vU1Cr5e1AD6IEIjQ==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.4.tgz", + "integrity": "sha512-4iPufZ1TMOD3oBlGFqHXBpa3KFT46aLl6Vy7gwed0ZSYgHaZ/mihbYb4t7Z9etjkC9Al3ZYIoOaHrU60gcMy7g==", "cpu": [ "x64" ], @@ -785,9 +785,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.3.tgz", - "integrity": "sha512-kw7e3FXU+VsJSSSl2nMKvACYlwtvZB8RUIeVShIEY6PVnuZ3c9+L9lWB2nWeeKWNNYDdtL19foCQ0ZyUL7nqGw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.4.tgz", + "integrity": "sha512-Lviw8EzxsVQKpbS+rSt6/6zjn9ashUZ7Tbuvc2YENgRl0yZTktGlachZ9KMJUsVjZEGFVu336kl5lBgDN6PmpA==", "cpu": [ "arm64" ], @@ -800,9 +800,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.3.tgz", - "integrity": "sha512-tPfZiwF9rO0jW6Jh9ipi58N5ZLoSjdxXeSrAYypy4psA2Yl1dAMhM71KxVfmjZhJmxRjSnb29YlRXXhh3GqzYw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.4.tgz", + "integrity": "sha512-YHbSFlLgDwglFn0lAO3Zsdrife9jcQXQhgRp77YiTDja23FrC2uwnhXMNkAucthsf+Psr7sTwYEryxz6FPAVqw==", "cpu": [ "x64" ], @@ -815,9 +815,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.3.tgz", - "integrity": "sha512-ERDyjOgYeKe0Vrlr1iLrqTByB026YLPzTytDTz1DRCYM+JI92Dw2dbpRHYmdqn6VBnQ9Bor6J8ZlNwdZdxjlSg==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.4.tgz", + "integrity": "sha512-vz59ijyrTG22Hshaj620e5yhs2dU1WJy723ofc+KUgxVCM6zxQESmWdMuVmUzxtGqtj5heHyB44PjV/HKsEmuQ==", "cpu": [ "arm64" ], @@ -830,9 +830,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.3.tgz", - "integrity": "sha512-nXesBZ2Ad1qL+Rm3crN7NmEVJ5uvfLFPLJev3x1j3feCQXfAhoYrojC681RhpdOph8NsvKBBwpYZHR7W0ifTTA==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.4.tgz", + "integrity": "sha512-3sRbQ6W5kAiVQRBWREGJNd1YE7OgzS0AmOGjDmX/qZZecq8NFlQsQH0IfXjjmD0XtUYqr64e0EKNFjMUlPL3Cw==", "cpu": [ "x64" ], @@ -845,9 +845,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.3.tgz", - "integrity": "sha512-zr48Cg/8zkzZCzDHNxXO/89bf9e+r4HtzNUPoz4GmgAkF1gFAFmfgOdCbR8zMbzFDGb1FqBBhdXUpcTQRYS1cQ==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.4.tgz", + "integrity": "sha512-z/4ArqOo9EImzTi4b6Vq+pthLnepFzJ92BnofU1jgNlcVb+UqynVFdoXMCFreTK7FdhqAzH0vmdwW5373Hm9pg==", "cpu": [ "arm" ], @@ -860,9 +860,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.3.tgz", - "integrity": "sha512-qXvYKmXj8GcJgWq3aGvxL/JG1ZM3UR272SdPU4QSTzD0eymrM7leiZH77pvY3UetCy0k1xuXZ+VPvoJNdtrsWQ==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.4.tgz", + "integrity": "sha512-ZWmWORaPbsPwmyu7eIEATFlaqm0QGt+joRE9sKcnVUG3oBbr/KYdNE2TnkzdQwX6EDRdg/x8Q4EZQTXoClUqqA==", "cpu": [ "arm64" ], @@ -875,9 +875,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.3.tgz", - "integrity": "sha512-7XlCKCA0nWcbvYpusARWkFjRQNWNGlt45S+Q18UeS///K6Aw8bB2FKYe9mhVWy/XLShvCweOLZPrnMswIaDXQA==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.4.tgz", + "integrity": "sha512-EGc4vYM7i1GRUIMqRZNCTzJh25MHePYsnQfKDexD8uPTCm9mK56NIL04LUfX2aaJ+C9vyEp2fJ7jbqFEYgO9lQ==", "cpu": [ "ia32" ], @@ -890,9 +890,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.3.tgz", - "integrity": "sha512-qGTgjweER5xqweiWtUIDl9OKz338EQqCwbS9c2Bh5jgEH19xQ1yhgGPNesugmDFq+UUSDtWgZ264st26b3de8A==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.4.tgz", + "integrity": "sha512-WVhIKO26kmm8lPmNrUikxSpXcgd6HDog0cx12BUfA2PkmURHSgx9G6vA19lrlQOMw+UjMZ+l3PpbtzffCxFDRg==", "cpu": [ "loong64" ], @@ -905,9 +905,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.3.tgz", - "integrity": "sha512-gy1bFskwEyxVMFRNYSvBauDIWNggD6pyxUksc0MV9UOBD138dKTzr8XnM2R4mBsHwVzeuIH8X5JhmNs2Pzrx+A==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.4.tgz", + "integrity": "sha512-keYY+Hlj5w86hNp5JJPuZNbvW4jql7c1eXdBUHIJGTeN/+0QFutU3GrS+c27L+NTmzi73yhtojHk+lr2+502Mw==", "cpu": [ "mips64el" ], @@ -920,9 +920,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.3.tgz", - "integrity": "sha512-UrYLFu62x1MmmIe85rpR3qou92wB9lEXluwMB/STDzPF9k8mi/9UvNsG07Tt9AqwPQXluMQ6bZbTzYt01+Ue5g==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.4.tgz", + "integrity": "sha512-tQ92n0WMXyEsCH4m32S21fND8VxNiVazUbU4IUGVXQpWiaAxOBvtOtbEt3cXIV3GEBydYsY8pyeRMJx9kn3rvw==", "cpu": [ "ppc64" ], @@ -935,9 +935,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.3.tgz", - "integrity": "sha512-9E73TfyMCbE+1AwFOg3glnzZ5fBAFK4aawssvuMgCRqCYzE0ylVxxzjEfut8xjmKkR320BEoMui4o/t9KA96gA==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.4.tgz", + "integrity": "sha512-tRRBey6fG9tqGH6V75xH3lFPpj9E8BH+N+zjSUCnFOX93kEzqS0WdyJHkta/mmJHn7MBaa++9P4ARiU4ykjhig==", "cpu": [ "riscv64" ], @@ -950,9 +950,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.3.tgz", - "integrity": "sha512-LlmsbuBdm1/D66TJ3HW6URY8wO6IlYHf+ChOUz8SUAjVTuaisfuwCOAgcxo3Zsu3BZGxmI7yt//yGOxV+lHcEA==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.4.tgz", + "integrity": "sha512-152aLpQqKZYhThiJ+uAM4PcuLCAOxDsCekIbnGzPKVBRUDlgaaAfaUl5NYkB1hgY6WN4sPkejxKlANgVcGl9Qg==", "cpu": [ "s390x" ], @@ -965,9 +965,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.3.tgz", - "integrity": "sha512-ogV0+GwEmvwg/8ZbsyfkYGaLACBQWDvO0Kkh8LKBGKj9Ru8VM39zssrnu9Sxn1wbapA2qNS6BiLdwJZGouyCwQ==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.4.tgz", + "integrity": "sha512-Mi4aNA3rz1BNFtB7aGadMD0MavmzuuXNTaYL6/uiYIs08U7YMPETpgNn5oue3ICr+inKwItOwSsJDYkrE9ekVg==", "cpu": [ "x64" ], @@ -980,9 +980,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.3.tgz", - "integrity": "sha512-o1jLNe4uzQv2DKXMlmEzf66Wd8MoIhLNO2nlQBHLtWyh2MitDG7sMpfCO3NTcoTMuqHjfufgUQDFRI5C+xsXQw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.4.tgz", + "integrity": "sha512-9+Wxx1i5N/CYo505CTT7T+ix4lVzEdz0uCoYGxM5JDVlP2YdDC1Bdz+Khv6IbqmisT0Si928eAxbmGkcbiuM/A==", "cpu": [ "x64" ], @@ -995,9 +995,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.3.tgz", - "integrity": "sha512-AZJCnr5CZgZOdhouLcfRdnk9Zv6HbaBxjcyhq0StNcvAdVZJSKIdOiPB9az2zc06ywl0ePYJz60CjdKsQacp5Q==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.4.tgz", + "integrity": "sha512-MFsHleM5/rWRW9EivFssop+OulYVUoVcqkyOkjiynKBCGBj9Lihl7kh9IzrreDyXa4sNkquei5/DTP4uCk25xw==", "cpu": [ "x64" ], @@ -1010,9 +1010,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.3.tgz", - "integrity": "sha512-Acsujgeqg9InR4glTRvLKGZ+1HMtDm94ehTIHKhJjFpgVzZG9/pIcWW/HA/DoMfEyXmANLDuDZ2sNrWcjq1lxw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.4.tgz", + "integrity": "sha512-6Xq8SpK46yLvrGxjp6HftkDwPP49puU4OF0hEL4dTxqCbfx09LyrbUj/D7tmIRMj5D5FCUPksBbxyQhp8tmHzw==", "cpu": [ "x64" ], @@ -1025,9 +1025,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.3.tgz", - "integrity": "sha512-FSrAfjVVy7TifFgYgliiJOyYynhQmqgPj15pzLyJk8BUsnlWNwP/IAy6GAiB1LqtoivowRgidZsfpoYLZH586A==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.4.tgz", + "integrity": "sha512-PkIl7Jq4mP6ke7QKwyg4fD4Xvn8PXisagV/+HntWoDEdmerB2LTukRZg728Yd1Fj+LuEX75t/hKXE2Ppk8Hh1w==", "cpu": [ "arm64" ], @@ -1040,9 +1040,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.3.tgz", - "integrity": "sha512-xTScXYi12xLOWZ/sc5RBmMN99BcXp/eEf7scUC0oeiRoiT5Vvo9AycuqCp+xdpDyAU+LkrCqEpUS9fCSZF8J3Q==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.4.tgz", + "integrity": "sha512-ga676Hnvw7/ycdKB53qPusvsKdwrWzEyJ+AtItHGoARszIqvjffTwaaW3b2L6l90i7MO9i+dlAW415INuRhSGg==", "cpu": [ "ia32" ], @@ -1055,9 +1055,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.3.tgz", - "integrity": "sha512-FbUN+0ZRXsypPyWE2IwIkVjDkDnJoMJARWOcFZn4KPPli+QnKqF0z1anvfaYe3ev5HFCpRDLLBDHyOALLppWHw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.4.tgz", + "integrity": "sha512-HP0GDNla1T3ZL8Ko/SHAS2GgtjOg+VmWnnYLhuTksr++EnduYB0f3Y2LzHsUwb2iQ13JGoY6G3R8h6Du/WG6uA==", "cpu": [ "x64" ], @@ -2043,9 +2043,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", + "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -2534,14 +2534,14 @@ } }, "node_modules/csv-parse": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.0.tgz", - "integrity": "sha512-RxruSK3M4XgzcD7Trm2wEN+SJ26ChIb903+IWxNOcB5q4jT2Cs+hFr6QP39J05EohshRFEvyzEBoZ/466S2sbw==" + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.1.tgz", + "integrity": "sha512-A6DrzSnN7MuOjXOT2tbO08YyYnP9sNDn8zITMHbZN/qt3gUzdGcu3LacYKY7b3RHwKoPwkhhmLeP7SE30cRmgg==" }, "node_modules/csv-stringify": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.4.2.tgz", - "integrity": "sha512-DXIdnnCUQYjDKTu6TgCSzRDiAuLxDjhl4ErFP9FGMF3wzBGOVMg9bZTLaUcYtuvhXgNbeXPKeaRfpgyqE4xySw==" + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.4.3.tgz", + "integrity": "sha512-srC0oI9+WOHecKh0zHoqWWq9zBzwAwzA5IJ6duuM3wNMJ7+2Bv/wRCzRt/BRQI92ar43fgkb/sXjATWBFwUDkw==" }, "node_modules/debug": { "version": "4.3.4", @@ -2939,9 +2939,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.3.tgz", - "integrity": "sha512-UlJ1qUUA2jL2nNib1JTSkifQTcYTroFqRjwCFW4QYEKEsixXD5Tik9xML7zh2gTxkYTBKGHNH9y7txMwVyPbjw==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.4.tgz", + "integrity": "sha512-x7jL0tbRRpv4QUyuDMjONtWFciygUxWaUM1kMX2zWxI0X2YWOt7MSA0g4UdeSiHM8fcYVzpQhKYOycZwxTdZkA==", "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -2950,28 +2950,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.3", - "@esbuild/android-arm64": "0.19.3", - "@esbuild/android-x64": "0.19.3", - "@esbuild/darwin-arm64": "0.19.3", - "@esbuild/darwin-x64": "0.19.3", - "@esbuild/freebsd-arm64": "0.19.3", - "@esbuild/freebsd-x64": "0.19.3", - "@esbuild/linux-arm": "0.19.3", - "@esbuild/linux-arm64": "0.19.3", - "@esbuild/linux-ia32": "0.19.3", - "@esbuild/linux-loong64": "0.19.3", - "@esbuild/linux-mips64el": "0.19.3", - "@esbuild/linux-ppc64": "0.19.3", - "@esbuild/linux-riscv64": "0.19.3", - "@esbuild/linux-s390x": "0.19.3", - "@esbuild/linux-x64": "0.19.3", - "@esbuild/netbsd-x64": "0.19.3", - "@esbuild/openbsd-x64": "0.19.3", - "@esbuild/sunos-x64": "0.19.3", - "@esbuild/win32-arm64": "0.19.3", - "@esbuild/win32-ia32": "0.19.3", - "@esbuild/win32-x64": "0.19.3" + "@esbuild/android-arm": "0.19.4", + "@esbuild/android-arm64": "0.19.4", + "@esbuild/android-x64": "0.19.4", + "@esbuild/darwin-arm64": "0.19.4", + "@esbuild/darwin-x64": "0.19.4", + "@esbuild/freebsd-arm64": "0.19.4", + "@esbuild/freebsd-x64": "0.19.4", + "@esbuild/linux-arm": "0.19.4", + "@esbuild/linux-arm64": "0.19.4", + "@esbuild/linux-ia32": "0.19.4", + "@esbuild/linux-loong64": "0.19.4", + "@esbuild/linux-mips64el": "0.19.4", + "@esbuild/linux-ppc64": "0.19.4", + "@esbuild/linux-riscv64": "0.19.4", + "@esbuild/linux-s390x": "0.19.4", + "@esbuild/linux-x64": "0.19.4", + "@esbuild/netbsd-x64": "0.19.4", + "@esbuild/openbsd-x64": "0.19.4", + "@esbuild/sunos-x64": "0.19.4", + "@esbuild/win32-arm64": "0.19.4", + "@esbuild/win32-ia32": "0.19.4", + "@esbuild/win32-x64": "0.19.4" } }, "node_modules/escalade": { @@ -6143,9 +6143,9 @@ } }, "node_modules/snyk": { - "version": "1.1227.0", - "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.1227.0.tgz", - "integrity": "sha512-+J1dVYBBMxsa4IahYH9hmnQYIVffmg6JKYKZWKpbzRJ4w1MzdS/GqZOryxJwVN7YFLFhCK//AZLcYhNBjbMZuQ==", + "version": "1.1232.0", + "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.1232.0.tgz", + "integrity": "sha512-6mckR8GkhEhfh1yIyrt1nR8KDvS1vjlhgVyS75M66xxrM6TyA55/im4soQWvYPPpvg39ZBKqH48t8usrLI9CAQ==", "dev": true, "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index 3aac645..bf6925a 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,12 @@ }, "license": "MIT", "dependencies": { - "axios": "^1.5.0", + "axios": "^1.5.1", "commander": "^11.0.0", - "csv-parse": "^5.5.0", - "csv-stringify": "^6.4.2", + "csv-parse": "^5.5.1", + "csv-stringify": "^6.4.3", "enigma.js": "^2.12.0", - "esbuild": "^0.19.3", + "esbuild": "^0.19.4", "eslint": "^8.50.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^9.0.0", @@ -59,7 +59,7 @@ "devDependencies": { "jest": "^29.7.0", "prettier": "^3.0.3", - "snyk": "^1.1227.0" + "snyk": "^1.1232.0" }, "pkg": { "assets": [ From 98584b7e0bad97c73e5aaa1015625e2eae5f1aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 14:23:53 +0000 Subject: [PATCH 4/9] fix(task-get): Fix task tree bug when task is triggered by ext program task Task trees with ext program tasks now work as expected. --- .vscode/launch.json | 146 ++++++++++++++++----------------- src/lib/app/class_allapps.js | 26 +++--- src/lib/task/class_alltasks.js | 45 ++++++---- src/lib/util/app.js | 4 +- src/lib/util/task.js | 6 +- 5 files changed, 120 insertions(+), 107 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 8f3c51a..02d0c7e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -76,14 +76,14 @@ // "--file-type", // "excel", - // // "--file-name", - // // "testdata/tasks.xlsx", - // // "--sheet-name", - // // "Ctrl-Q task import 1", + // "--file-name", + // "testdata/tasks.xlsx", + // "--sheet-name", + // "Ctrl-Q task import 1", - // "--import-app", - // "--import-app-sheet-name", - // "App import", + // // "--import-app", + // // "--import-app-sheet-name", + // // "App import", // // "--qvf-overwrite", // // "no", @@ -91,8 +91,8 @@ // // "--limit-import-count", // // "2", - // "--sleep-app-upload", - // "500", + // // "--sleep-app-upload", + // // "500", // // "--dry-run" // ] @@ -187,82 +187,82 @@ // ------------------------------------ // Import apps from Excel file // ------------------------------------ - "args": [ - "app-import", - "--auth-type", - "cert", - "--host", - "192.168.100.109", - "--auth-cert-file", - "./cert/client.pem", - "--auth-cert-key-file", - "./cert/client_key.pem", - "--auth-user-dir", - "LAB", - "--auth-user-id", - "goran", - - // "--file-type", - // "excel", - - "--file-name", - "testdata/tasks.xlsx", - "--sheet-name", - "App-import", - - // "--limit-import-count", - // "2", - - "--sleep-app-upload", - "500" - - // "--dry-run" - ] - - // ------------------------------------ - // Get task tree - // ------------------------------------ // "args": [ - // "task-get", + // "app-import", // "--auth-type", // "cert", // "--host", // "192.168.100.109", - // // "--auth-cert-file", - // // "./cert/client.pem", - // // "--auth-cert-key-file", - // // "./cert/client_key.pem", + // "--auth-cert-file", + // "./cert/client.pem", + // "--auth-cert-key-file", + // "./cert/client_key.pem", // "--auth-user-dir", // "LAB", // "--auth-user-id", // "goran", - // // "--task-id", - // // "82bc3e66-c899-4e44-b52f-552145da5ee0", - // "--task-tag", - // "Test data", - // "--output-format", - // "table", - // // "tree", - // // "--tree-icons", - // // "--tree-details", - // // "taskid", - // // "appname", - // // "--task-type", - // // "reload", - // // "ext-program", - - // // "--output-dest", - // // "screen", - // // "file", - // // "--output-file-name", - // // "tasks.json", - // // "--output-file-format", - // // "json", - // // "--text-color", - // // "no", + // // "--file-type", + // // "excel", + + // "--file-name", + // "testdata/tasks.xlsx", + // "--sheet-name", + // "App-import", + + // // "--limit-import-count", + // // "2", + + // "--sleep-app-upload", + // "500" + + // // "--dry-run" // ] + // ------------------------------------ + // Get task tree + // ------------------------------------ + "args": [ + "task-get", + // "--auth-type", + // "cert", + "--host", + "192.168.100.109", + // "--auth-cert-file", + // "./cert/client.pem", + // "--auth-cert-key-file", + // "./cert/client_key.pem", + "--auth-user-dir", + "LAB", + "--auth-user-id", + "goran", + // "--task-id", + // "82bc3e66-c899-4e44-b52f-552145da5ee0", + // "--task-tag", + // "Test data", + // "--output-format", + // "table", + // "tree", + // "--tree-icons", + // "--tree-details", + // "taskid", + // "appname", + "--task-type", + "reload", + "ext-program", + + // "--output-dest", + // "screen", + // "file", + // "--output-file-name", + // "tasks.json", + // "--output-file-format", + // "json", + + // "--text-color", + // "no", + ] + // ------------------------------------ // Get reload tasks as table // ------------------------------------ diff --git a/src/lib/app/class_allapps.js b/src/lib/app/class_allapps.js index 2638fd9..4194378 100644 --- a/src/lib/app/class_allapps.js +++ b/src/lib/app/class_allapps.js @@ -36,7 +36,7 @@ class QlikSenseApps { logger.error(`QS APP: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`QS APP:\n ${err.stack}`); } } @@ -143,7 +143,7 @@ class QlikSenseApps { logger.error(`GET QS APP 2: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`GET QS APP 2:\n ${err.stack}`); } @@ -583,7 +583,7 @@ class QlikSenseApps { logger.error(`UPDATE UPLOADED APP: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`UPDATE UPLOADED APP:\n ${err.stack}`); } @@ -670,7 +670,7 @@ class QlikSenseApps { logger.error(`(${appCounter}) PUBLISH APP publish-replace: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`(${appCounter}) PUBLISH APP publish-replace:\n ${err.stack}`); } return { res: false, publishedApp: null }; @@ -702,7 +702,7 @@ class QlikSenseApps { logger.error(`(${appCounter}) PUBLISH APP publish-another: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`(${appCounter}) PUBLISH APP publish-another:\n ${err.stack}`); } @@ -771,7 +771,7 @@ class QlikSenseApps { logger.error(`(${appCounter}) PUBLISH APP delete-publish: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`(${appCounter}) PUBLISH APP delete-publish:\n ${err.stack}`); } @@ -813,7 +813,7 @@ class QlikSenseApps { logger.error(`PUBLISH APP NORMAL: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`PUBLISH APP NORMAL:\n ${err.stack}`); } @@ -853,7 +853,7 @@ class QlikSenseApps { logger.error(`PUBLISH APP REPLACE: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`PUBLISH APP REPLACE:\n ${err.stack}`); } @@ -909,7 +909,7 @@ class QlikSenseApps { logger.error(`CHECK IF APP EXISTS IN STREAM: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`CHECK IF APP EXISTS IN STREAM:\n ${err.stack}`); } @@ -959,7 +959,7 @@ class QlikSenseApps { logger.error(`GET APP IN STREAM: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`GET APP IN STREAM:\n ${err.stack}`); } @@ -1042,7 +1042,7 @@ class QlikSenseApps { logger.error(`CHECK IF STREAM EXISTS: Failed: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`CHECK IF STREAM EXISTS:\n ${err.stack}`); } @@ -1146,7 +1146,7 @@ class QlikSenseApps { logger.error(`CREATE RELOAD TASK IN QSEOW 2: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`CREATE RELOAD TASK IN QSEOW 2:\n ${err.stack}`); } @@ -1184,7 +1184,7 @@ class QlikSenseApps { logger.error(`[${err}] Export app step 1`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`[${err}] Export app step 1:\n ${err.stack}`); } diff --git a/src/lib/task/class_alltasks.js b/src/lib/task/class_alltasks.js index df9b61b..152976b 100644 --- a/src/lib/task/class_alltasks.js +++ b/src/lib/task/class_alltasks.js @@ -19,7 +19,7 @@ const { getTagIdByName } = require('../util/tag'); const { getCustomPropertyIdByName } = require('../util/customproperties'); const { taskExistById } = require('../util/task'); const { getAppById } = require('../util/app'); -const { getTaskByName } = require('../util/task'); +const { getTaskById, getTaskByName } = require('../util/task'); class QlikSenseTasks { // eslint-disable-next-line no-useless-constructor @@ -72,6 +72,11 @@ class QlikSenseTasks { this.taskList.push(newTask); } + // Function to read task definitions from disk file (CSV or Excel) + // Parameters: + // - tasksFromFile: Object containing data read from file + // - tagsExisting: Array of existing tags in QSEoW + // - cpExisting: Array of existing custom properties in QSEoW async getTaskModelFromFile(tasksFromFile, tagsExisting, cpExisting) { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { @@ -146,7 +151,7 @@ class QlikSenseTasks { let taskCreationOption; // Get task specific data for the current task - // The row containing task data will have a "Reload" in the task type column + // The row containing task data will have "Reload" in the task type column const taskData = taskRows.filter( (item) => item[taskFileColumnHeaders.taskType.pos] && @@ -612,7 +617,7 @@ class QlikSenseTasks { } else { // Verify task ID exists in QSEoW // eslint-disable-next-line no-await-in-loop - const taskExists = await this.getTaskById(currentTask.id); + const taskExists = await getTaskById(currentTask.id); if (!taskExists) { throw new Error( `Task "${currentTask.id}" does not exist in QSEoW and cannot be updated. ` + @@ -682,13 +687,13 @@ class QlikSenseTasks { resolve(this.taskList); } catch (err) { - if (err.response?.status) { + if (err?.response?.status) { logger.error(`Received error ${err.response?.status}/${err.response?.statusText} from QRS API`); } - if (err.response.data) { + if (err?.response?.data) { logger.error(`Error message from QRS API: ${err.response.data}`); } - if (err.config.data) { + if (err?.config?.data) { logger.error(`Data sent to Sense: ${JSON.stringify(JSON.parse(err.config.data), null, 2)}}`); } logger.error(`PARSE TASKS FROM FILE 1: ${err}`); @@ -869,7 +874,7 @@ class QlikSenseTasks { } async getTasksFromQseow() { - // eslint-disable-next-line no-async-promise-executor + // eslint-disable-next-line no-async-promise-executor, no-unused-vars return new Promise(async (resolve, reject) => { // try { logger.debug('GET TASK: Starting get reload tasks from QSEoW'); @@ -989,10 +994,6 @@ class QlikSenseTasks { } } resolve(this.taskList); - // } catch (err) { - // logger.error(`GET QS TASK 2: ${err}`); - // reject(err); - // } }); } @@ -1007,6 +1008,11 @@ class QlikSenseTasks { const newTreeLevel = parentTreeLevel + 1; let subTree = []; + // Debug + logger.debug( + `GET TASK SUBTREE: Meta node type: ${task.metaNodeType}, task type: ${task.taskType}, tree level: ${newTreeLevel}, task name: ${task.taskName}` + ); + // Does this node (=task) have any downstream connections? const downstreamTasks = self.taskNetwork.edges.filter((edge) => edge.from === task.id); @@ -1161,7 +1167,7 @@ class QlikSenseTasks { return subTree; // console.log('subTree: ' + JSON.stringify(subTree)); } catch (err) { - logger.error(`GET TASK SUBTREE: ${err.stack}`); + logger.error(`GET TASK SUBTREE (tree): ${err.stack}`); return false; } } @@ -1173,6 +1179,9 @@ class QlikSenseTasks { const newTreeLevel = parentTreeLevel + 1; let subTree = []; + // Debug + // logger.debug(`GET TASK SUBTABLE: Tree level: ${newTreeLevel}, task name: ${task.taskName}`); + // Does this node (=task) have any downstream connections? const downstreamTasks = self.taskNetwork.edges.filter((edge) => edge.from === task.id); // console.log('downStreamTasks 1: ' + JSON.stringify(downstreamTasks)); @@ -1232,7 +1241,7 @@ class QlikSenseTasks { return subTree; } catch (err) { - logger.error(`GET TASK SUBTREE: ${err}`); + logger.error(`GET TASK SUBTREE (table): ${err}`); return null; } } @@ -1270,6 +1279,8 @@ class QlikSenseTasks { try { logger.verbose(`Getting schema events from QSEoW...`); const result1 = await this.qlikSenseSchemaEvents.getSchemaEventsFromQseow(); + + logger.silly(`Schema events from QSEoW: ${JSON.stringify(result1, null, 2)}`); } catch (err) { logger.error(`GET TASK MODEL FROM QSEOW 2: ${err}`); return false; @@ -1279,6 +1290,8 @@ class QlikSenseTasks { try { logger.verbose(`Getting composite events from QSEoW...`); const result2 = await this.qlikSenseCompositeEvents.getCompositeEventsFromQseow(); + + logger.silly(`Composite events from QSEoW: ${JSON.stringify(result2, null, 2)}`); } catch (err) { logger.error(`GET TASK MODEL FROM QSEOW 3: ${err}`); return false; @@ -1546,8 +1559,8 @@ class QlikSenseTasks { }); // Keep a note that this node has associated events nodesWithEvents.add(compositeEvent.compositeEvent.compositeRules[0].reloadTask.id); - nodesWithEvents.add(compositeEvent.compositeEvent.reloadTask.id); - } else if (validate(compositeEvent.compositeEvent.compositeRules[0].externalProgramTask.id)) { + nodesWithEvents.add(compositeEvent.compositeEvent.externalProgramTask.id); + } else if (validate(compositeEvent.compositeEvent.compositeRules[0]?.externalProgramTask?.id)) { logger.verbose( `Composite event "${compositeEvent.compositeEvent.name}" has an external program task triggered by external program task with ID=${compositeEvent.compositeEvent.compositeRules[0].externalProgramTask.id}.` ); @@ -1570,7 +1583,7 @@ class QlikSenseTasks { // Keep a note that this node has associated events nodesWithEvents.add(compositeEvent.compositeEvent.compositeRules[0].externalProgramTask.id); - nodesWithEvents.add(compositeEvent.compositeEvent.reloadTask.id); + nodesWithEvents.add(compositeEvent.compositeEvent.externalProgramTask.id); } else { logger.warn(`Composite event "${compositeEvent.compositeEvent.name}" is triggered by an unsupported task type.`); } diff --git a/src/lib/util/app.js b/src/lib/util/app.js index ff0d64d..27d7bf3 100644 --- a/src/lib/util/app.js +++ b/src/lib/util/app.js @@ -142,7 +142,7 @@ async function getAppById(appId, optionsParam) { logger.error(`GET APP BY ID: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`GET APP BY ID:\n ${err.stack}`); } @@ -182,7 +182,7 @@ async function deleteAppById(appId) { logger.error(`DELETE APP: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`DELETE APP:\n ${err.stack}`); } diff --git a/src/lib/util/task.js b/src/lib/util/task.js index 3239af9..c431e4b 100644 --- a/src/lib/util/task.js +++ b/src/lib/util/task.js @@ -65,7 +65,7 @@ async function taskExistById(taskId, optionsParam) { logger.error(`TASK EXIST BY ID: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`TASK EXIST BY ID:\n ${err.stack}`); } @@ -121,7 +121,7 @@ async function getTaskByName(taskName, optionsParam) { logger.error(`GET TASK BY NAME: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`GET TASK BY NAME:\n ${err.stack}`); } @@ -186,7 +186,7 @@ async function getTaskById(taskId, optionsParam) { logger.error(`GET TASK BY ID: ${err}`); // Show stack trace if available - if (err.stack) { + if (err?.stack) { logger.error(`GET TASK BY ID:\n ${err.stack}`); } From 9b13cce142ce07e8e56479f3dfa1b693f55e20da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 14:28:45 +0000 Subject: [PATCH 5/9] fix(task-get): Make "reload" and "ext-program" default for --task-type option Show all tasks by default --- src/ctrl-q.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ctrl-q.js b/src/ctrl-q.js index 28ff9cd..bc8c6e0 100644 --- a/src/ctrl-q.js +++ b/src/ctrl-q.js @@ -530,7 +530,11 @@ const program = new Command(); .option('--auth-cert-key-file ', 'Qlik Sense certificate key file (exported from QMC)', './cert/client_key.pem') .option('--auth-root-cert-file ', 'Qlik Sense root certificate file (exported from QMC)', './cert/root.pem') - .addOption(new Option('--task-type ', 'type of tasks to list').choices(['reload', 'ext-program']).default(['reload'])) + .addOption( + new Option('--task-type ', 'type of tasks to list') + .choices(['reload', 'ext-program']) + .default(['reload', 'ext-program']) + ) .option('--task-id ', 'use task IDs to select which tasks to retrieve. Only allowed when --output-format=table') .option('--task-tag ', 'use tags to select which tasks to retrieve. Only allowed when --output-format=table') From 1fe47642bc8c1e7ac516110febb925e354f907b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 14:46:44 +0000 Subject: [PATCH 6/9] fix(task-get): Warn if --task-type is used in task tree view Implements #319 --- src/lib/util/assert-options.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/util/assert-options.js b/src/lib/util/assert-options.js index cb4a5fb..76023df 100644 --- a/src/lib/util/assert-options.js +++ b/src/lib/util/assert-options.js @@ -135,10 +135,10 @@ const getBookmarkAssertOptions = (options) => { // eslint-disable-next-line no-unused-vars const getTaskAssertOptions = (options) => { - // --task-id and --task-tag only allowed for task tables, not trees + // ---task-id and --task-tag only allowed for task tables, not trees if (options.taskId || options.taskTag) { if (options.outputFormat === 'tree') { - logger.error('Task tree view is not supported when specifying task IDs and/or task tags. Exiting.'); + logger.error('Task tree view is not supported when using --task-id or --task-tag. Exiting.'); process.exit(1); } @@ -156,6 +156,11 @@ const getTaskAssertOptions = (options) => { } } + // Warn if --task-type has been specified when output format is tree + if (options.outputFormat === 'tree' && options.taskType) { + logger.warn('Task tree view is not supported when using --task-type. Ignoring --task-type option.'); + } + // --table-details not allowed when --output-format is set to tree. if (options.outputFormat === 'tree' && options.tableDetails) { logger.error(`--table-details not allowed when --output-format is set to tree. Exiting.`); From f0fae780c4dff16ac993dfe1f41cb49edb4847a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 15:13:43 +0000 Subject: [PATCH 7/9] fix(master-item-dim-get): Get correct colors for drill-down dimensions Fixes #314 --- src/lib/cmd/getdim.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/cmd/getdim.js b/src/lib/cmd/getdim.js index 7dcbd33..a66447a 100644 --- a/src/lib/cmd/getdim.js +++ b/src/lib/cmd/getdim.js @@ -133,7 +133,12 @@ const getMasterDimension = async (options) => { // Find coloring data (if available) for each dimension for (const dimension of getMasterItems) { // Find per-value colors, if defined - if (dimension.qData?.coloring?.hasValueColors === true) { + // Such colors are NOT available for drill-down dimensions, which are identified by dimension.qData.dim.qGrouping="H" + if ( + dimension.qData.dim.qGrouping !== 'H' && + dimension.qData?.coloring?.hasValueColors === true && + dimension.qData?.coloring?.colorMapRef !== undefined + ) { try { const genericColorMapRefModel = await app.getObject(`ColorMapModel_${dimension.qData.coloring.colorMapRef}`); const colorMapRefLayout = await genericColorMapRefModel.getLayout(); From 1547918efca59361e0775ca923ed928f257dbdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 15:13:52 +0000 Subject: [PATCH 8/9] . --- .vscode/launch.json | 108 ++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 02d0c7e..c06c644 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -222,46 +222,46 @@ // ------------------------------------ // Get task tree // ------------------------------------ - "args": [ - "task-get", - // "--auth-type", - // "cert", - "--host", - "192.168.100.109", - // "--auth-cert-file", - // "./cert/client.pem", - // "--auth-cert-key-file", - // "./cert/client_key.pem", - "--auth-user-dir", - "LAB", - "--auth-user-id", - "goran", - // "--task-id", - // "82bc3e66-c899-4e44-b52f-552145da5ee0", - // "--task-tag", - // "Test data", - // "--output-format", - // "table", - // "tree", - // "--tree-icons", - // "--tree-details", - // "taskid", - // "appname", - "--task-type", - "reload", - "ext-program", - - // "--output-dest", - // "screen", - // "file", - // "--output-file-name", - // "tasks.json", - // "--output-file-format", - // "json", - - // "--text-color", - // "no", - ] + // "args": [ + // "task-get", + // // "--auth-type", + // // "cert", + // "--host", + // "192.168.100.109", + // // "--auth-cert-file", + // // "./cert/client.pem", + // // "--auth-cert-key-file", + // // "./cert/client_key.pem", + // "--auth-user-dir", + // "LAB", + // "--auth-user-id", + // "goran", + // // "--task-id", + // // "82bc3e66-c899-4e44-b52f-552145da5ee0", + // // "--task-tag", + // // "Test data", + // // "--output-format", + // // "table", + // // "tree", + // // "--tree-icons", + // // "--tree-details", + // // "taskid", + // // "appname", + // "--task-type", + // "reload", + // "ext-program", + + // // "--output-dest", + // // "screen", + // // "file", + // // "--output-file-name", + // // "tasks.json", + // // "--output-file-format", + // // "json", + + // // "--text-color", + // // "no", + // ] // ------------------------------------ // Get reload tasks as table @@ -505,20 +505,20 @@ // ------------------------------------ // Get dimension // ------------------------------------ - // "args": [ - // "master-item-dim-get", - // "--host", - // "192.168.100.109", - // "--app-id", - // // "a3e0f5d2-000a-464f-998d-33d333b175d7", - // "2933711d-6638-41d4-a2d2-6dd2d965208b", - // "--output-format", - // "table", - // "--auth-user-dir", - // "LAB", - // "--auth-user-id", - // "goran" - // ] + "args": [ + "master-item-dim-get", + "--host", + "192.168.100.109", + "--app-id", + "a3e0f5d2-000a-464f-998d-33d333b175d7", + // "2933711d-6638-41d4-a2d2-6dd2d965208b", + "--output-format", + "table", + "--auth-user-dir", + "LAB", + "--auth-user-id", + "goran" + ] // ------------------------------------ // Delete dimension From 3fbc4d307179476e89068e5db2030b990e6603da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Fri, 6 Oct 2023 15:34:34 +0000 Subject: [PATCH 9/9] fix(task-get): Include all tasks in task trees Fixes #308 --- .vscode/launch.json | 98 +++++++++++++++++----------------- src/lib/cmd/gettask.js | 2 +- src/lib/task/class_alltasks.js | 79 ++++++++++++++------------- 3 files changed, 92 insertions(+), 87 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index c06c644..ac5acdb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -222,46 +222,46 @@ // ------------------------------------ // Get task tree // ------------------------------------ - // "args": [ - // "task-get", - // // "--auth-type", - // // "cert", - // "--host", - // "192.168.100.109", - // // "--auth-cert-file", - // // "./cert/client.pem", - // // "--auth-cert-key-file", - // // "./cert/client_key.pem", - // "--auth-user-dir", - // "LAB", - // "--auth-user-id", - // "goran", - // // "--task-id", - // // "82bc3e66-c899-4e44-b52f-552145da5ee0", - // // "--task-tag", - // // "Test data", - // // "--output-format", - // // "table", - // // "tree", - // // "--tree-icons", - // // "--tree-details", - // // "taskid", - // // "appname", + "args": [ + "task-get", + // "--auth-type", + // "cert", + "--host", + "192.168.100.109", + // "--auth-cert-file", + // "./cert/client.pem", + // "--auth-cert-key-file", + // "./cert/client_key.pem", + "--auth-user-dir", + "LAB", + "--auth-user-id", + "goran", + // "--task-id", + // "82bc3e66-c899-4e44-b52f-552145da5ee0", + // "--task-tag", + // "Test data", + // "--output-format", + // "table", + // "tree", + // "--tree-icons", + // "--tree-details", + // "taskid", + // "appname", // "--task-type", // "reload", // "ext-program", - // // "--output-dest", - // // "screen", - // // "file", - // // "--output-file-name", - // // "tasks.json", - // // "--output-file-format", - // // "json", + // "--output-dest", + // "screen", + // "file", + // "--output-file-name", + // "tasks.json", + // "--output-file-format", + // "json", - // // "--text-color", - // // "no", - // ] + // "--text-color", + // "no", + ] // ------------------------------------ // Get reload tasks as table @@ -505,20 +505,20 @@ // ------------------------------------ // Get dimension // ------------------------------------ - "args": [ - "master-item-dim-get", - "--host", - "192.168.100.109", - "--app-id", - "a3e0f5d2-000a-464f-998d-33d333b175d7", - // "2933711d-6638-41d4-a2d2-6dd2d965208b", - "--output-format", - "table", - "--auth-user-dir", - "LAB", - "--auth-user-id", - "goran" - ] + // "args": [ + // "master-item-dim-get", + // "--host", + // "192.168.100.109", + // "--app-id", + // // "a3e0f5d2-000a-464f-998d-33d333b175d7", + // "2933711d-6638-41d4-a2d2-6dd2d965208b", + // "--output-format", + // "table", + // "--auth-user-dir", + // "LAB", + // "--auth-user-id", + // "goran" + // ] // ------------------------------------ // Delete dimension diff --git a/src/lib/cmd/gettask.js b/src/lib/cmd/gettask.js index 8116db5..840b477 100644 --- a/src/lib/cmd/gettask.js +++ b/src/lib/cmd/gettask.js @@ -153,7 +153,7 @@ const getTask = async (options) => { taskTree = taskTree.concat(subTree); } - // Sort array alfabetically + // Sort tree alfabetically taskTree.sort(compareTree); // Output task tree to correct destination diff --git a/src/lib/task/class_alltasks.js b/src/lib/task/class_alltasks.js index 152976b..2d1f563 100644 --- a/src/lib/task/class_alltasks.js +++ b/src/lib/task/class_alltasks.js @@ -884,49 +884,54 @@ class QlikSenseTasks { // Are there any task filters specified? // If so, build a query string - // Add task id(s) to query string - if (this.options.taskId && this.options?.taskId.length >= 1) { - // At least one task ID specified - // Add first task ID - filter += encodeURIComponent(`(id eq ${this.options.taskId[0]}`); - } - if (this.options.taskId && this.options?.taskId.length >= 2) { - // Add remaining task IDs, if any - for (let i = 1; i < this.options.taskId.length; i += 1) { - filter += encodeURIComponent(` or id eq ${this.options.taskId[i]}`); + // Don't add task id and tag filtering if the output is a task tree + if (this.options.outputFormat !== 'tree') { + + // Add task id(s) to query string + if (this.options.taskId && this.options?.taskId.length >= 1) { + // At least one task ID specified + // Add first task ID + filter += encodeURIComponent(`(id eq ${this.options.taskId[0]}`); + } + if (this.options.taskId && this.options?.taskId.length >= 2) { + // Add remaining task IDs, if any + for (let i = 1; i < this.options.taskId.length; i += 1) { + filter += encodeURIComponent(` or id eq ${this.options.taskId[i]}`); + } } - } - // Add closing parenthesis - if (this.options.taskId && this.options?.taskId.length >= 1) { - filter += encodeURIComponent(')'); - } - logger.debug(`GET TASK: QRS query filter (incl ids): ${filter}`); - - // Add task tag(s) to query string - if (this.options.taskTag && this.options?.taskTag.length >= 1) { - // At least one task ID specified - if (filter.length >= 1) { - // We've previously added some task ids - // Add first task tag - filter += encodeURIComponent(` or (tags.name eq '${this.options.taskTag[0]}'`); - } else { - // No task ids added yet - // Add first task tag - filter += encodeURIComponent(`(tags.name eq '${this.options.taskTag[0]}'`); + // Add closing parenthesis + if (this.options.taskId && this.options?.taskId.length >= 1) { + filter += encodeURIComponent(')'); } - } - if (this.options.taskTag && this.options?.taskTag.length >= 2) { - // Add remaining task tags, if any - for (let i = 1; i < this.options.taskTag.length; i += 1) { - filter += encodeURIComponent(` or tags.name eq '${this.options.taskTag[i]}'`); + logger.debug(`GET TASK: QRS query filter (incl ids): ${filter}`); + + // Add task tag(s) to query string + if (this.options.taskTag && this.options?.taskTag.length >= 1) { + // At least one task ID specified + if (filter.length >= 1) { + // We've previously added some task ids + // Add first task tag + filter += encodeURIComponent(` or (tags.name eq '${this.options.taskTag[0]}'`); + } else { + // No task ids added yet + // Add first task tag + filter += encodeURIComponent(`(tags.name eq '${this.options.taskTag[0]}'`); + } + } + if (this.options.taskTag && this.options?.taskTag.length >= 2) { + // Add remaining task tags, if any + for (let i = 1; i < this.options.taskTag.length; i += 1) { + filter += encodeURIComponent(` or tags.name eq '${this.options.taskTag[i]}'`); + } } - } - // Add closing parenthesis - if (this.options.taskTag && this.options?.taskTag.length >= 1) { - filter += encodeURIComponent(')'); + // Add closing parenthesis + if (this.options.taskTag && this.options?.taskTag.length >= 1) { + filter += encodeURIComponent(')'); + } } + logger.debug(`GET TASK: QRS query filter (incl ids, tags): ${filter}`); let axiosConfig;