From dc0eea390bb92191e0ae29a2e82110f74a9b8327 Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Fri, 1 Mar 2024 09:14:04 +0100 Subject: [PATCH] fix: update axios dependency [IDE-155] (#432) * fix: address vulnerabilities * chore: update .gitignore --- .gitignore | 1 + .vscode/settings.json | 21 - package-lock.json | 560 ++------ package.json | 27 +- src/ampli/index.ts | 1280 ----------------- src/snyk/advisor/advisorTypes.ts | 15 - src/snyk/advisor/editor/editorDecorator.ts | 94 -- src/snyk/advisor/messages/messages.ts | 3 - src/snyk/advisor/services/advisorApiClient.ts | 55 - src/snyk/advisor/services/advisorProvider.ts | 48 - src/snyk/advisor/services/advisorService.ts | 132 -- src/snyk/base/modules/baseSnykModule.ts | 14 +- src/snyk/base/modules/snykLib.ts | 44 +- .../base/services/authenticationService.ts | 3 - src/snyk/base/services/scanModeService.ts | 3 +- src/snyk/cli/process.ts | 4 - src/snyk/common/analytics/itly.ts | 268 ---- src/snyk/common/analytics/itlyErrorPlugin.ts | 51 - "src/snyk/common/api/api\320\241lient.ts" | 71 - src/snyk/common/commands/commandController.ts | 26 +- .../common/configuration/configuration.ts | 24 +- src/snyk/common/constants/settings.ts | 1 - src/snyk/common/editor/codeActionsProvider.ts | 33 +- .../experiment/services/experimentService.ts | 8 +- src/snyk/common/languageServer/settings.ts | 2 - .../common/services/notificationService.ts | 3 - src/snyk/common/user.ts | 7 +- .../common/watchers/configurationWatcher.ts | 7 +- src/snyk/extension.ts | 62 +- .../codeActions/codeIssuesActionsProvider.ts | 8 +- src/snyk/snykCode/codeService.ts | 4 +- .../snykCode/hoverProvider/hoverProvider.ts | 21 +- .../codeActions/iacCodeActionsProvider.ts | 8 +- src/snyk/snykIac/iacService.ts | 4 +- src/snyk/snykOss/ossService.ts | 4 +- .../providers/ossCodeActionsProvider.ts | 24 +- .../ossVulnerabilityCountService.ts | 2 - src/test/integration/analytics.test.ts | 45 - src/test/integration/configuration.test.ts | 2 - .../services/authenticationService.test.ts | 25 - src/test/unit/cli/process.test.ts | 30 - src/test/unit/common/analytics/itly.test.ts | 214 --- .../common/commands/commandController.test.ts | 2 - .../common/editor/codeActionsProvider.test.ts | 27 +- .../languageServer/languageServer.test.ts | 2 - .../common/languageServer/middleware.test.ts | 2 - .../common/languageServer/settings.test.ts | 2 - .../services/notificationService.test.ts | 43 - src/test/unit/common/user.test.ts | 18 - .../codeIssuesActionsProvider.test.ts | 23 - src/test/unit/snykCode/codeService.test.ts | 2 - .../hoverProvider/hoverProvider.test.ts | 59 - .../iacCodeActionsProvider.test.ts | 22 - src/test/unit/snykIac/iacService.test.ts | 2 - src/test/unit/snykOss/ossService.test.ts | 2 - .../providers/ossCodeActionsProvider.test.ts | 9 - .../ossVulnerabilityCountService.test.ts | 3 - 57 files changed, 129 insertions(+), 3347 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 src/ampli/index.ts delete mode 100644 src/snyk/advisor/advisorTypes.ts delete mode 100644 src/snyk/advisor/editor/editorDecorator.ts delete mode 100644 src/snyk/advisor/messages/messages.ts delete mode 100644 src/snyk/advisor/services/advisorApiClient.ts delete mode 100644 src/snyk/advisor/services/advisorProvider.ts delete mode 100644 src/snyk/advisor/services/advisorService.ts delete mode 100644 src/snyk/common/analytics/itly.ts delete mode 100644 src/snyk/common/analytics/itlyErrorPlugin.ts delete mode 100644 "src/snyk/common/api/api\320\241lient.ts" delete mode 100644 src/test/integration/analytics.test.ts delete mode 100644 src/test/unit/common/analytics/itly.test.ts delete mode 100644 src/test/unit/common/services/notificationService.test.ts delete mode 100644 src/test/unit/snykCode/hoverProvider/hoverProvider.test.ts diff --git a/.gitignore b/.gitignore index 8df088185..ee0dab6e3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ yarn-error.log ################################# .idea/ *.iml +.vscode/ ################################# # Logs and temp files # diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f349f8625..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,21 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.exclude": { - "out": false, // set this to true to hide the "out" folder with the compiled JS files - "media/**/*.css": true // exclude css to prevent from editing CSS instead of SASS accidentally - }, - "search.exclude": { - "out": true, // set this to false to include "out" folder in search results - "media/**/*.css": true // exclude css to prevent from editing CSS instead of SASS accidentally - }, - // Turn off tsc task auto detection since we have the necessary tasks as npm scripts - "typescript.tsc.autoDetect": "off", - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": true - }, - "[scss]": { - "editor.defaultFormatter": "michelemelluso.code-beautifier" - } -} diff --git a/package-lock.json b/package-lock.json index 656ed6b73..2a16c4cf0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,15 +12,10 @@ "@babel/parser": "^7.12.11", "@babel/traverse": "^7.12.12", "@babel/types": "^7.12.12", - "@itly/plugin-amplitude-node": "^2.5.0", - "@itly/plugin-schema-validator": "^2.4.0", - "@itly/plugin-segment-node": "^2.4.0", - "@itly/sdk": "^2.3.1", "@sentry/node": "^6.16.1", "@sentry/tracing": "^6.19.7", "@snyk/code-client": "^4.23.2", - "analytics-node": "^4.0.1", - "axios": "^1.6.3", + "axios": "^1.6.7", "glob": "^9.3.5", "he": "^1.2.0", "htmlparser2": "^7.2.0", @@ -38,7 +33,6 @@ }, "devDependencies": { "@amplitude/ampli": "^1.29.0", - "@types/analytics-node": "^3.1.4", "@types/babel__traverse": "^7.12.2", "@types/find-package-json": "^1.2.2", "@types/glob": "^8.1.0", @@ -252,11 +246,11 @@ } }, "node_modules/@amplitude/analytics-core": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.4.tgz", - "integrity": "sha512-i4wx7hhjx0vjpudx21UTIM0Uxn+yL7P82Uh4NHxIGVVrTmPG9f9lZvdLQRbYg229CwH9FnmLCAiicRtTTtnq7g==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.5.tgz", + "integrity": "sha512-V7CVlHVN+1diKiOpdp2bCPZ0mbS4CmUYF+v+eXDwVfJL3M/t3sVcT1apXnmVYGYi14cGu9hQOD11rD6qKbUOsw==", "dependencies": { - "@amplitude/analytics-types": "^1.3.3", + "@amplitude/analytics-types": "^1.3.4", "tslib": "^2.4.1" } }, @@ -266,12 +260,12 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/@amplitude/analytics-node": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-node/-/analytics-node-1.3.4.tgz", - "integrity": "sha512-R0H+fYV5KIfl1Q1symBynfTDiylLD7JfvIOFl0oZBynvFwg6v93xh09nG/oDqIQcnvn5fzlSjusXcMGebPjRYw==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-node/-/analytics-node-1.3.5.tgz", + "integrity": "sha512-PVdCs3duu4OQNIQ3ENCKdm6wnoMAOdpSZD3tpWbEQVKh08FlxWLrR8eQN48nvhs+i6yEwGGVr1SfRDPpsMog1w==", "dependencies": { - "@amplitude/analytics-core": "^1.2.4", - "@amplitude/analytics-types": "^1.3.3", + "@amplitude/analytics-core": "^1.2.5", + "@amplitude/analytics-types": "^1.3.4", "tslib": "^2.4.1" } }, @@ -281,29 +275,33 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/@amplitude/analytics-types": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.3.3.tgz", - "integrity": "sha512-V4/h+izhG7NyVfIva1uhe6bToI/l5n+UnEomL3KEO9DkFoKiOG7KmXo/fmzfU6UmD1bUEWmy//hUFF16BfrEww==" + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.3.4.tgz", + "integrity": "sha512-tR70gzqFkEzX9QpxvWYMfLCledT7vMhgd3d4/bkp3nnGXTOORaVUOCcSgOyxyuFdSx84T61aP/eZPKIcZcaP+A==" }, - "node_modules/@amplitude/evaluation-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@amplitude/evaluation-js/-/evaluation-js-1.1.1.tgz", - "integrity": "sha512-YWvaWf2zMHFJQOomu1RJT+KzzWrAy7GVbvyCj16gktEUi98yM7QPvEBUMW8jVLKSqi5mdZOMivxjBC3yF171dQ==" + "node_modules/@amplitude/experiment-core": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@amplitude/experiment-core/-/experiment-core-0.7.2.tgz", + "integrity": "sha512-Wc2NWvgQ+bLJLeF0A9wBSPIaw0XuqqgkPKsoNFQrmS7r5Djd56um75In05tqmVntPJZRvGKU46pAp8o5tdf4mA==", + "dependencies": { + "js-base64": "^3.7.5" + } }, "node_modules/@amplitude/experiment-node-server": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@amplitude/experiment-node-server/-/experiment-node-server-1.7.8.tgz", - "integrity": "sha512-MixT70TGYzeqOz9UWMQgnbCuNz31FQ5JRQY8AumubLsl1XWXXB4VBefE0OySPD95fK4cCsCMl6vurf1lZqcuTg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@amplitude/experiment-node-server/-/experiment-node-server-1.8.2.tgz", + "integrity": "sha512-R1+eDUb/Syn70f+TbFUF4/+Mg8aCBRx4mvAIB7JE0ICCrYpb351hAF7wnLKAZcScY0cKJ45/JF517WW757JwmA==", "dependencies": { "@amplitude/analytics-node": "^1.3.4", "@amplitude/analytics-types": "^1.3.1", - "@amplitude/evaluation-js": "1.1.1" + "@amplitude/experiment-core": "^0.7.2" } }, "node_modules/@amplitude/identify": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/identify/-/identify-1.10.2.tgz", "integrity": "sha512-ywxeabS8ukMdJWNwx3rG/EBngXFg/4NsPhlyAxbBUcI7HzBXEJUKepiZfkz8K6Y7f0mpc23Qz1aBf48ZJDZmkQ==", + "dev": true, "dependencies": { "@amplitude/types": "^1.10.2", "@amplitude/utils": "^1.10.2", @@ -316,12 +314,14 @@ "node_modules/@amplitude/identify/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true }, "node_modules/@amplitude/node": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/node/-/node-1.10.2.tgz", "integrity": "sha512-E3xp8DOpkF5ThjrRlAmSocnrEYsTPpd3Zg4WdBLms0ackQSgQpw6z84+YMcoPerZHJJ/LEqdo4Cg4Z5Za3D+3Q==", + "dev": true, "dependencies": { "@amplitude/identify": "^1.10.2", "@amplitude/types": "^1.10.2", @@ -335,12 +335,14 @@ "node_modules/@amplitude/node/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true }, "node_modules/@amplitude/types": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/types/-/types-1.10.2.tgz", "integrity": "sha512-I8qenRI7uU6wKNb9LiZrAosSHVoNHziXouKY81CrqxH9xhVTEIJFXeuCV0hbtBr0Al/8ejnGjQRx+S2SvU/pPg==", + "dev": true, "engines": { "node": ">=10" } @@ -349,6 +351,7 @@ "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/utils/-/utils-1.10.2.tgz", "integrity": "sha512-tVsHXu61jITEtRjB7NugQ5cVDd4QDzne8T3ifmZye7TiJeUfVRvqe44gDtf55A+7VqhDhyEIIXTA1iVcDGqlEw==", + "dev": true, "dependencies": { "@amplitude/types": "^1.10.2", "tslib": "^2.0.0" @@ -360,7 +363,8 @@ "node_modules/@amplitude/utils/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true }, "node_modules/@babel/code-frame": { "version": "7.22.13", @@ -634,82 +638,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@itly/plugin-amplitude-node": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-amplitude-node/-/plugin-amplitude-node-2.5.0.tgz", - "integrity": "sha512-STWJgTLykMPW8uUtix0qlrX96E+aICN6IDA/gdbxsGaT2Ul30zrSVH+CEsrB6vttOdAIER3ukV7nKB+QRP173g==", - "dependencies": { - "@amplitude/identify": "^1.8.4", - "@amplitude/node": "^1.8.4" - }, - "peerDependencies": { - "@itly/sdk": "^2.0.0" - } - }, - "node_modules/@itly/plugin-schema-validator": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-schema-validator/-/plugin-schema-validator-2.4.0.tgz", - "integrity": "sha512-qh1q4cMp0tPmHRMAJzKe2Fmh21a4cekyCtxVEzXJrjuwZzo6JxA1SAgt9dZKugZzsx209VFp2tJRoJ9kIeI8bw==", - "dependencies": { - "jsonschema": "^1.4.0", - "url": "^0.11.0" - }, - "peerDependencies": { - "@itly/sdk": "^2.0.0" - } - }, - "node_modules/@itly/plugin-segment-node": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-segment-node/-/plugin-segment-node-2.4.0.tgz", - "integrity": "sha512-22ZMkofNy96DJv8FQ20bLf5s/A+IC8nkyT4kCVgDkn3uM5z86BUcpMSfWVijRpIeIUp2hZekpXrUVUcoFv/C9g==", - "dependencies": { - "@types/analytics-node": "^3.1.4", - "analytics-node": "^3.4.0-beta.3" - }, - "peerDependencies": { - "@itly/sdk": "^2.0.0" - } - }, - "node_modules/@itly/plugin-segment-node/node_modules/analytics-node": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/analytics-node/-/analytics-node-3.5.0.tgz", - "integrity": "sha512-XgQq6ejZHCehUSnZS4V7QJPLIP7S9OAWwQDYl4WTLtsRvc5fCxIwzK/yihzmIW51v9PnyBmrl9dMcqvwfOE8WA==", - "dependencies": { - "@segment/loosely-validate-event": "^2.0.0", - "axios": "^0.21.1", - "axios-retry": "^3.0.2", - "lodash.isstring": "^4.0.1", - "md5": "^2.2.1", - "ms": "^2.0.0", - "remove-trailing-slash": "^0.1.0", - "uuid": "^3.2.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@itly/plugin-segment-node/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/@itly/plugin-segment-node/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/@itly/sdk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/sdk/-/sdk-2.4.0.tgz", - "integrity": "sha512-EnJii6kCCNVgjRmDEzGi+E5CnSkqHvTiUGMyyt2CuzFjp0ipULP5VRNi42mRzGYF02qbYUiBhAXcJtPbm3wX7A==" - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -1435,15 +1363,6 @@ "typescript": "^3" } }, - "node_modules/@segment/loosely-validate-event": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz", - "integrity": "sha512-ZMCSfztDBqwotkl848ODgVcAmN4OItEWDCkshcKz0/W6gGSQayuuCtWV/MlodFivAZD793d6UgANd6wCXUfrIw==", - "dependencies": { - "component-type": "^1.2.1", - "join-component": "^1.1.0" - } - }, "node_modules/@sentry/core": { "version": "6.16.1", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.16.1.tgz", @@ -1697,11 +1616,6 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, - "node_modules/@types/analytics-node": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/analytics-node/-/analytics-node-3.1.4.tgz", - "integrity": "sha512-i6cqjFotMq1dEwXxyXRqnzp/HmWPCskptrVUQ1UzRIGs/zICFWM2bIJyLt6f9A9/+qE98wls1AHWPQ4WXYS0HA==" - }, "node_modules/@types/babel__traverse": { "version": "7.14.2", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.14.2.tgz", @@ -2353,41 +2267,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/analytics-node": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/analytics-node/-/analytics-node-4.0.1.tgz", - "integrity": "sha512-+zXOOTB+eTRW6R9+pfvPfk1dHraFJzhNnAyZiYJIDGOjHQgfk9qfqgoJX9MfR4qY0J/E1YJ3FBncrLGadTDW1A==", - "dependencies": { - "@segment/loosely-validate-event": "^2.0.0", - "axios": "^0.21.1", - "axios-retry": "^3.0.2", - "lodash.isstring": "^4.0.1", - "md5": "^2.2.1", - "ms": "^2.0.0", - "remove-trailing-slash": "^0.1.0", - "uuid": "^3.2.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/analytics-node/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/analytics-node/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -2574,23 +2453,15 @@ } }, "node_modules/axios": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", - "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", + "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, - "node_modules/axios-retry": { - "version": "3.1.9", - "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.1.9.tgz", - "integrity": "sha512-NFCoNIHq8lYkJa6ku4m+V1837TP6lCa7n79Iuf8/AqATAHYB0ISaAS1eyIenDOfHOLtym34W65Sjke2xjg2fsA==", - "dependencies": { - "is-retry-allowed": "^1.1.0" - } - }, "node_modules/axios/node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -2954,14 +2825,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=", - "engines": { - "node": "*" - } - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -3232,11 +3095,6 @@ "node": ">= 0.8" } }, - "node_modules/component-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-type/-/component-type-1.2.1.tgz", - "integrity": "sha1-ikeQFwAjjk/DIml3EjAibyS0Fak=" - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -3403,14 +3261,6 @@ "node": ">= 8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=", - "engines": { - "node": "*" - } - }, "node_modules/date-fns": { "version": "2.28.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", @@ -4472,9 +4322,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -5270,11 +5120,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "node_modules/is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", @@ -5438,6 +5283,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -5543,10 +5389,10 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "node_modules/join-component": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz", - "integrity": "sha1-uEF7dQZho5K+4sJTfGiyqdSXfNU=" + "node_modules/js-base64": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", + "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -5622,14 +5468,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonschema": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", - "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==", - "engines": { - "node": "*" - } - }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -5685,11 +5523,6 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -5824,16 +5657,6 @@ "node": ">= 18" } }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -7182,15 +7005,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -7319,11 +7133,6 @@ "url": "https://github.com/sponsors/mysticatea" } }, - "node_modules/remove-trailing-slash": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/remove-trailing-slash/-/remove-trailing-slash-0.1.1.tgz", - "integrity": "sha512-o4S4Qh6L2jpnCy83ysZDau+VORNvnFw07CKSAymkd6ICNVEPisMyzlc00KlvvicsxKck94SEwhDnMNdICzO+tA==" - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -8258,20 +8067,6 @@ "punycode": "^2.1.0" } }, - "node_modules/url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -8860,11 +8655,11 @@ } }, "@amplitude/analytics-core": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.4.tgz", - "integrity": "sha512-i4wx7hhjx0vjpudx21UTIM0Uxn+yL7P82Uh4NHxIGVVrTmPG9f9lZvdLQRbYg229CwH9FnmLCAiicRtTTtnq7g==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-1.2.5.tgz", + "integrity": "sha512-V7CVlHVN+1diKiOpdp2bCPZ0mbS4CmUYF+v+eXDwVfJL3M/t3sVcT1apXnmVYGYi14cGu9hQOD11rD6qKbUOsw==", "requires": { - "@amplitude/analytics-types": "^1.3.3", + "@amplitude/analytics-types": "^1.3.4", "tslib": "^2.4.1" }, "dependencies": { @@ -8876,12 +8671,12 @@ } }, "@amplitude/analytics-node": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-node/-/analytics-node-1.3.4.tgz", - "integrity": "sha512-R0H+fYV5KIfl1Q1symBynfTDiylLD7JfvIOFl0oZBynvFwg6v93xh09nG/oDqIQcnvn5fzlSjusXcMGebPjRYw==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-node/-/analytics-node-1.3.5.tgz", + "integrity": "sha512-PVdCs3duu4OQNIQ3ENCKdm6wnoMAOdpSZD3tpWbEQVKh08FlxWLrR8eQN48nvhs+i6yEwGGVr1SfRDPpsMog1w==", "requires": { - "@amplitude/analytics-core": "^1.2.4", - "@amplitude/analytics-types": "^1.3.3", + "@amplitude/analytics-core": "^1.2.5", + "@amplitude/analytics-types": "^1.3.4", "tslib": "^2.4.1" }, "dependencies": { @@ -8893,29 +8688,33 @@ } }, "@amplitude/analytics-types": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.3.3.tgz", - "integrity": "sha512-V4/h+izhG7NyVfIva1uhe6bToI/l5n+UnEomL3KEO9DkFoKiOG7KmXo/fmzfU6UmD1bUEWmy//hUFF16BfrEww==" + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-1.3.4.tgz", + "integrity": "sha512-tR70gzqFkEzX9QpxvWYMfLCledT7vMhgd3d4/bkp3nnGXTOORaVUOCcSgOyxyuFdSx84T61aP/eZPKIcZcaP+A==" }, - "@amplitude/evaluation-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@amplitude/evaluation-js/-/evaluation-js-1.1.1.tgz", - "integrity": "sha512-YWvaWf2zMHFJQOomu1RJT+KzzWrAy7GVbvyCj16gktEUi98yM7QPvEBUMW8jVLKSqi5mdZOMivxjBC3yF171dQ==" + "@amplitude/experiment-core": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@amplitude/experiment-core/-/experiment-core-0.7.2.tgz", + "integrity": "sha512-Wc2NWvgQ+bLJLeF0A9wBSPIaw0XuqqgkPKsoNFQrmS7r5Djd56um75In05tqmVntPJZRvGKU46pAp8o5tdf4mA==", + "requires": { + "js-base64": "^3.7.5" + } }, "@amplitude/experiment-node-server": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@amplitude/experiment-node-server/-/experiment-node-server-1.7.8.tgz", - "integrity": "sha512-MixT70TGYzeqOz9UWMQgnbCuNz31FQ5JRQY8AumubLsl1XWXXB4VBefE0OySPD95fK4cCsCMl6vurf1lZqcuTg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@amplitude/experiment-node-server/-/experiment-node-server-1.8.2.tgz", + "integrity": "sha512-R1+eDUb/Syn70f+TbFUF4/+Mg8aCBRx4mvAIB7JE0ICCrYpb351hAF7wnLKAZcScY0cKJ45/JF517WW757JwmA==", "requires": { "@amplitude/analytics-node": "^1.3.4", "@amplitude/analytics-types": "^1.3.1", - "@amplitude/evaluation-js": "1.1.1" + "@amplitude/experiment-core": "^0.7.2" } }, "@amplitude/identify": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/identify/-/identify-1.10.2.tgz", "integrity": "sha512-ywxeabS8ukMdJWNwx3rG/EBngXFg/4NsPhlyAxbBUcI7HzBXEJUKepiZfkz8K6Y7f0mpc23Qz1aBf48ZJDZmkQ==", + "dev": true, "requires": { "@amplitude/types": "^1.10.2", "@amplitude/utils": "^1.10.2", @@ -8925,7 +8724,8 @@ "tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true } } }, @@ -8933,6 +8733,7 @@ "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/node/-/node-1.10.2.tgz", "integrity": "sha512-E3xp8DOpkF5ThjrRlAmSocnrEYsTPpd3Zg4WdBLms0ackQSgQpw6z84+YMcoPerZHJJ/LEqdo4Cg4Z5Za3D+3Q==", + "dev": true, "requires": { "@amplitude/identify": "^1.10.2", "@amplitude/types": "^1.10.2", @@ -8943,19 +8744,22 @@ "tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true } } }, "@amplitude/types": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/types/-/types-1.10.2.tgz", - "integrity": "sha512-I8qenRI7uU6wKNb9LiZrAosSHVoNHziXouKY81CrqxH9xhVTEIJFXeuCV0hbtBr0Al/8ejnGjQRx+S2SvU/pPg==" + "integrity": "sha512-I8qenRI7uU6wKNb9LiZrAosSHVoNHziXouKY81CrqxH9xhVTEIJFXeuCV0hbtBr0Al/8ejnGjQRx+S2SvU/pPg==", + "dev": true }, "@amplitude/utils": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/@amplitude/utils/-/utils-1.10.2.tgz", "integrity": "sha512-tVsHXu61jITEtRjB7NugQ5cVDd4QDzne8T3ifmZye7TiJeUfVRvqe44gDtf55A+7VqhDhyEIIXTA1iVcDGqlEw==", + "dev": true, "requires": { "@amplitude/types": "^1.10.2", "tslib": "^2.0.0" @@ -8964,7 +8768,8 @@ "tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true } } }, @@ -9182,68 +8987,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "@itly/plugin-amplitude-node": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-amplitude-node/-/plugin-amplitude-node-2.5.0.tgz", - "integrity": "sha512-STWJgTLykMPW8uUtix0qlrX96E+aICN6IDA/gdbxsGaT2Ul30zrSVH+CEsrB6vttOdAIER3ukV7nKB+QRP173g==", - "requires": { - "@amplitude/identify": "^1.8.4", - "@amplitude/node": "^1.8.4" - } - }, - "@itly/plugin-schema-validator": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-schema-validator/-/plugin-schema-validator-2.4.0.tgz", - "integrity": "sha512-qh1q4cMp0tPmHRMAJzKe2Fmh21a4cekyCtxVEzXJrjuwZzo6JxA1SAgt9dZKugZzsx209VFp2tJRoJ9kIeI8bw==", - "requires": { - "jsonschema": "^1.4.0", - "url": "^0.11.0" - } - }, - "@itly/plugin-segment-node": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/plugin-segment-node/-/plugin-segment-node-2.4.0.tgz", - "integrity": "sha512-22ZMkofNy96DJv8FQ20bLf5s/A+IC8nkyT4kCVgDkn3uM5z86BUcpMSfWVijRpIeIUp2hZekpXrUVUcoFv/C9g==", - "requires": { - "@types/analytics-node": "^3.1.4", - "analytics-node": "^3.4.0-beta.3" - }, - "dependencies": { - "analytics-node": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/analytics-node/-/analytics-node-3.5.0.tgz", - "integrity": "sha512-XgQq6ejZHCehUSnZS4V7QJPLIP7S9OAWwQDYl4WTLtsRvc5fCxIwzK/yihzmIW51v9PnyBmrl9dMcqvwfOE8WA==", - "requires": { - "@segment/loosely-validate-event": "^2.0.0", - "axios": "^0.21.1", - "axios-retry": "^3.0.2", - "lodash.isstring": "^4.0.1", - "md5": "^2.2.1", - "ms": "^2.0.0", - "remove-trailing-slash": "^0.1.0", - "uuid": "^3.2.1" - } - }, - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - } - } - }, - "@itly/sdk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@itly/sdk/-/sdk-2.4.0.tgz", - "integrity": "sha512-EnJii6kCCNVgjRmDEzGi+E5CnSkqHvTiUGMyyt2CuzFjp0ipULP5VRNi42mRzGYF02qbYUiBhAXcJtPbm3wX7A==" - }, "@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -9819,15 +9562,6 @@ "esquery": "^1.0.1" } }, - "@segment/loosely-validate-event": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz", - "integrity": "sha512-ZMCSfztDBqwotkl848ODgVcAmN4OItEWDCkshcKz0/W6gGSQayuuCtWV/MlodFivAZD793d6UgANd6wCXUfrIw==", - "requires": { - "component-type": "^1.2.1", - "join-component": "^1.1.0" - } - }, "@sentry/core": { "version": "6.16.1", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.16.1.tgz", @@ -10046,11 +9780,6 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, - "@types/analytics-node": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/analytics-node/-/analytics-node-3.1.4.tgz", - "integrity": "sha512-i6cqjFotMq1dEwXxyXRqnzp/HmWPCskptrVUQ1UzRIGs/zICFWM2bIJyLt6f9A9/+qE98wls1AHWPQ4WXYS0HA==" - }, "@types/babel__traverse": { "version": "7.14.2", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.14.2.tgz", @@ -10515,36 +10244,6 @@ "uri-js": "^4.2.2" } }, - "analytics-node": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/analytics-node/-/analytics-node-4.0.1.tgz", - "integrity": "sha512-+zXOOTB+eTRW6R9+pfvPfk1dHraFJzhNnAyZiYJIDGOjHQgfk9qfqgoJX9MfR4qY0J/E1YJ3FBncrLGadTDW1A==", - "requires": { - "@segment/loosely-validate-event": "^2.0.0", - "axios": "^0.21.1", - "axios-retry": "^3.0.2", - "lodash.isstring": "^4.0.1", - "md5": "^2.2.1", - "ms": "^2.0.0", - "remove-trailing-slash": "^0.1.0", - "uuid": "^3.2.1" - }, - "dependencies": { - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - } - } - }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -10682,11 +10381,11 @@ "dev": true }, "axios": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", - "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", + "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", "requires": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" }, @@ -10703,14 +10402,6 @@ } } }, - "axios-retry": { - "version": "3.1.9", - "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.1.9.tgz", - "integrity": "sha512-NFCoNIHq8lYkJa6ku4m+V1837TP6lCa7n79Iuf8/AqATAHYB0ISaAS1eyIenDOfHOLtym34W65Sjke2xjg2fsA==", - "requires": { - "is-retry-allowed": "^1.1.0" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -10977,11 +10668,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" - }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -11187,11 +10873,6 @@ "delayed-stream": "~1.0.0" } }, - "component-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-type/-/component-type-1.2.1.tgz", - "integrity": "sha1-ikeQFwAjjk/DIml3EjAibyS0Fak=" - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -11323,11 +11004,6 @@ "which": "^2.0.1" } }, - "crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" - }, "date-fns": { "version": "2.28.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", @@ -12146,9 +11822,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==" }, "form-data": { "version": "3.0.1", @@ -12725,11 +12401,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", @@ -12829,7 +12500,8 @@ "is-retry-allowed": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", - "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==" + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true }, "is-shared-array-buffer": { "version": "1.0.1", @@ -12902,10 +12574,10 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "join-component": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz", - "integrity": "sha1-uEF7dQZho5K+4sJTfGiyqdSXfNU=" + "js-base64": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", + "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==" }, "js-tokens": { "version": "4.0.0", @@ -12969,11 +12641,6 @@ "graceful-fs": "^4.1.6" } }, - "jsonschema": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", - "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==" - }, "just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -13023,11 +12690,6 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -13137,16 +12799,6 @@ "resolved": "https://registry.npmjs.org/marked/-/marked-11.1.0.tgz", "integrity": "sha512-fvKJWAPEafVj1dwGwcPI5mBB/0pvViL6NlCbNDG1HOIRwwAU/jeMoFxfbRLuirO1wRH7m4yPvBqD/O1wyWvayw==" }, - "md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "requires": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -14163,11 +13815,6 @@ "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", "dev": true }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -14265,11 +13912,6 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, - "remove-trailing-slash": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/remove-trailing-slash/-/remove-trailing-slash-0.1.1.tgz", - "integrity": "sha512-o4S4Qh6L2jpnCy83ysZDau+VORNvnFw07CKSAymkd6ICNVEPisMyzlc00KlvvicsxKck94SEwhDnMNdICzO+tA==" - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -14980,22 +14622,6 @@ "punycode": "^2.1.0" } }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - } - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 3b480e532..55c03d78c 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,7 @@ ], "activationEvents": [ "onWebviewPanel:snyk.views.suggestion.code", - "onWebviewPanel:snyk.views.suggestion.oss", - "*" + "onWebviewPanel:snyk.views.suggestion.oss" ], "main": "./out/extension.js", "types": "./out/extension.d.ts", @@ -62,13 +61,6 @@ "markdownDescription": "Send error reports to Snyk", "scope": "application" }, - "snyk.yesTelemetry": { - "//": "Name starts with y to put it at the end, as configs are sorted alphabetically", - "type": "boolean", - "default": true, - "markdownDescription": "Send usage statistics to Snyk", - "scope": "application" - }, "snyk.yesWelcomeNotification": { "//": "Name starts with y to put it at the end, as configs are sorted alphabetically", "type": "boolean", @@ -207,14 +199,7 @@ "title": "Preview feature toggles", "description": "Preview features that are currently in development. Setting keys will be removed when features become stable.", "propertyNames": true, - "properties": { - "advisor": { - "type": "boolean", - "title": "Enable \"Snyk Advisor\"", - "description": "Discover the health (maintenance, community, popularity & security) status of your open source packages.", - "default": false - } - } + "properties": {} } } } @@ -395,7 +380,6 @@ }, "devDependencies": { "@amplitude/ampli": "^1.29.0", - "@types/analytics-node": "^3.1.4", "@types/babel__traverse": "^7.12.2", "@types/find-package-json": "^1.2.2", "@types/glob": "^8.1.0", @@ -432,15 +416,10 @@ "@babel/parser": "^7.12.11", "@babel/traverse": "^7.12.12", "@babel/types": "^7.12.12", - "@itly/plugin-amplitude-node": "^2.5.0", - "@itly/plugin-schema-validator": "^2.4.0", - "@itly/plugin-segment-node": "^2.4.0", - "@itly/sdk": "^2.3.1", "@sentry/node": "^6.16.1", "@sentry/tracing": "^6.19.7", "@snyk/code-client": "^4.23.2", - "analytics-node": "^4.0.1", - "axios": "^1.6.3", + "axios": "^1.6.7", "glob": "^9.3.5", "he": "^1.2.0", "htmlparser2": "^7.2.0", diff --git a/src/ampli/index.ts b/src/ampli/index.ts deleted file mode 100644 index 5fe2b2e1c..000000000 --- a/src/ampli/index.ts +++ /dev/null @@ -1,1280 +0,0 @@ -/** - * This file is auto-generated by Amplitude. - * To update run 'ampli pull visual-studio-code' - * - * Works with versions ^2.0.8 of @itly/sdk and @itly/plugin's - * https://www.npmjs.com/search?q=%40itly - */ - -/* tslint:disable */ -/* eslint-disable */ -import { - ItlyNode, - Options as OptionsBase, - Event as EventBase, - Plugin, - Environment as EnvironmentBase, - Properties as PropertiesBase, - ValidationResponse as ValidationResponseBase, - CallOptions as CallOptionsBase, - PluginCallOptions as PluginCallOptionsBase, -} from '@itly/sdk'; -import SchemaValidatorPlugin from '@itly/plugin-schema-validator'; - -export type Options = OptionsBase; -export type Environment = EnvironmentBase; -export type Event = EventBase; -export type Properties = PropertiesBase; -export type ValidationResponse = ValidationResponseBase; -export type CallOptions = CallOptionsBase; -export type PluginCallOptions = PluginCallOptionsBase; -export { Plugin, Validation, Loggers } from '@itly/sdk'; - -export interface AliasOptions extends CallOptions { -} - -export interface IdentifyOptions extends CallOptions { -} - -export interface GroupOptions extends CallOptions { -} - -export interface PageOptions extends CallOptions { -} - -export interface TrackOptions extends CallOptions { -} - -export interface IdentifyProperties { - /** - * when a User record is an actual user or when it’s a “service account” - */ - accountType?: "user" | "service" | "app-instance" | "automated-test-user"; - /** - * Link to access more information about the user - */ - adminLink?: string; - /** - * Company name as provided by the user in Appcues user profile survey - */ - appcuesCompanyName?: string; - /** - * First name as provided by the user in Appcues user profile survey - */ - appcuesFirstName?: string; - /** - * Job title as provided by the user in Appcues user profile survey - */ - appcuesJobTitle?: string; - /** - * Last name as provided by the user in Appcues user profile survey - */ - appcuesLastName?: string; - /** - * Current goal as provided by the user in Appcues user profile survey - */ - appcuesUserGoal?: string; - /** - * Work email as provided by the user in Appcues user profile survey - */ - appcuesWorkEmail?: string; - /** - * Auth provider (login method) - */ - authProvider?: string; - createdAt?: { - [k: string]: unknown; - }; - /** - * Email address for the user - */ - email?: string; - /** - * User's first name - */ - firstName?: string; - /** - * Whether or not the user has their first integration set up - */ - hasFirstIntegration?: boolean; - /** - * Whether or not the user has their first project imported - */ - hasFirstProject?: boolean; - /** - * Indicates whether user has a personal or business email address - */ - hasPersonalEmail?: boolean; - /** - * Is a user opted in to the new App UI navigation while still in beta (Oct 2022)? - */ - isAppUIBetaEnabled?: boolean; - /** - * Applies to non-user identities, such as Snyk Orgs - */ - isNonUser?: boolean; - /** - * Whether or not the user belongs to the Snyk org (determined by the email address ending with @snyk.io) - */ - isSnyk?: boolean; - /** - * Whether or not the user should be considered a Snyk administrator - */ - isSnykAdmin?: boolean; - /** - * User's last name - */ - lastName?: string; - /** - * An array of the ecosystems(eg: javascript, java, docker, kubernetes) that the user selects as their favorites on the snyk learn app. - */ - learnPreferredEcosystems?: string[]; - /** - * Used by Marketo to determine whether to send product updates emails to users. We are setting this value during product updates consent flow after registration. - */ - productUpdatesConsent?: boolean; - /** - * A trait for users who got redirected to `/product-updates` consent page. - * - * - * Will allow us to differentiate these users in Marketo and ensure they don't receive product updates emails without explicitly opting in. - */ - productUpdatesConsentIsDisplayed?: boolean; - /** - * Public ID of user - */ - user_id?: string; - /** - * Username of the user - */ - username?: string; - /** - * Query utmcampaign. All UTM properties must be in snake\_case. - */ - utm_campaign?: string; - /** - * Query utm\_content. All UTM properties must be in snake\_case. - */ - utm_content?: string; - /** - * Query utm\_medium. All UTM properties must be in snake\_case. - */ - utm_medium?: string; - /** - * Query utm\_source. All UTM properties must be in snake\_case. - */ - utm_source?: string; - /** - * Query utm\_term. All UTM properties must be in snake\_case. - */ - utm_term?: string; -} - -export interface GroupProperties { - "[Amplitude] Group ID"?: { - [k: string]: unknown; - }; - "[Amplitude] Group name"?: { - [k: string]: unknown; - }; - $set?: { - [k: string]: unknown; - }; - $unset?: { - [k: string]: unknown; - }; - "Account ARR"?: { - [k: string]: unknown; - }; - "Account Plan"?: { - [k: string]: unknown; - }; - "Billing Frequency"?: { - [k: string]: unknown; - }; - "Code Licenses"?: { - [k: string]: unknown; - }; - "Container Licenses"?: { - [k: string]: unknown; - }; - countFixesFirst30Days?: { - [k: string]: unknown; - }; - countFixesFirst7Days?: { - [k: string]: unknown; - }; - countFixesPast30Days?: { - [k: string]: unknown; - }; - countFixesPast7Days?: { - [k: string]: unknown; - }; - countFixesTotal?: { - [k: string]: unknown; - }; - currentEngagementState?: { - [k: string]: unknown; - }; - dateLastEngagementStateChange?: { - [k: string]: unknown; - }; - daysSinceLastEngagementStateChange?: { - [k: string]: unknown; - }; - "DB Feed Licenses"?: { - [k: string]: unknown; - }; - "Free Trial End Date"?: { - [k: string]: unknown; - }; - "Free Trial Start Date"?: { - [k: string]: unknown; - }; - /** - * ID that is used in conjunction with a groupType to specify an Org or a Group association: {groupId: 1234, groupType: "org"} - */ - groupId?: string; - /** - * The name of the group associated with the org - */ - groupName?: string; - /** - * Key that is used to specify the name of the Segment Group that a groupId is being set for. - */ - groupType?: "org" | "group" | "account"; - hasFixFirst30Days?: { - [k: string]: unknown; - }; - hasFixFirst7Days?: { - [k: string]: unknown; - }; - hasFixPast30Days?: { - [k: string]: unknown; - }; - hasFixPast7Days?: { - [k: string]: unknown; - }; - "IAC Licenses"?: { - [k: string]: unknown; - }; - id?: { - [k: string]: unknown; - }; - internalName?: { - [k: string]: unknown; - }; - isPassthrough?: { - [k: string]: unknown; - }; - name?: { - [k: string]: unknown; - }; - "Open Source Licenses"?: { - [k: string]: unknown; - }; - /** - * The plan of the org - */ - plan?: string; - priorEngagementState?: { - [k: string]: unknown; - }; - /** - * The types of projects in the org - */ - projectTypes?: string[]; -} - -export interface PageProperties { - /** - * Name of the ecosystem (npm|python|docker...) - */ - ecosystem?: string; - /** - * The name of the package - */ - package?: string; - /** - * cocoapods , composer , golang , hex , maven , npm , nuget , pip , rubygems - */ - packageManager?: string; - /** - * Package version, for example 18.0.1 - */ - packageVersion?: string; - /** - * The canonical path of the page - */ - path?: string; - /** - * The page that linked to this page. - */ - referrer?: string; - /** - * Query parameters in url. - */ - search?: string; - /** - * The page title. - */ - title?: string; - /** - * The url of the page. - */ - url?: string; - /** - * Used for page views on individual vulnerability pages - */ - vulnerabilityId?: string; -} - -export interface AnalysisIsReadyProperties { - /** - * Analysis types selected by the user for the scan: - * - * * open source vulnerabilities - * - * * code quality issues - * - * * code security vulnerabilities - * - * * advisor issues - * - * * infrastructure as code issues - * - * * container vulnerabilities - * - * | Rule | Value | - * |---|---| - * | Enum Values | Snyk Advisor, Snyk Code Quality, Snyk Code Security, Snyk Open Source, Snyk Container, Snyk Infrastructure as Code | - */ - analysisType: - | "Snyk Advisor" - | "Snyk Code Quality" - | "Snyk Code Security" - | "Snyk Open Source" - | "Snyk Container" - | "Snyk Infrastructure as Code"; - /** - * | Rule | Value | - * |---|---| - * | Type | number | - */ - durationInSeconds?: number; - /** - * | Rule | Value | - * |---|---| - * | Type | integer | - */ - fileCount?: number; - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * | Rule | Value | - * |---|---| - * | Enum Values | Success, Error | - */ - result: "Success" | "Error"; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export interface AnalysisIsTriggeredProperties { - /** - * Analysis types selected by the user for the scan: open source vulnerabilities, code quality issues and/or code security vulnerabilities. - * - * | Rule | Value | - * |---|---| - * | Min Items | 1 | - * | Unique Items | true | - * | Item Type | string | - * - * @minItems 1 - */ - analysisType: [string, ...string[]]; - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; - /** - * * True means that the analysis was triggered by the User. - * - * * False means that the analysis was triggered automatically by the plugin. - */ - triggeredByUser: boolean; -} - -export interface AuthenticateButtonIsClickedProperties { - /** - * Used to identify the source for multi-source events. - * - * For example, if a given event is shared between Snyk Advisor and Snyk Learn, this property helps to differentiate between the two. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Advisor, App, Learn, IDE, Website, CodeSnippets | - */ - eventSource?: "Advisor" | "App" | "Learn" | "IDE" | "Website" | "CodeSnippets"; - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export interface IssueHoverIsDisplayedProperties { - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Issue ID as received from the backend. - */ - issueId?: string; - /** - * Issue type - * - * | Rule | Value | - * |---|---| - * | Enum Values | Advisor, Code Quality Issue, Code Security Vulnerability, Licence Issue, Open Source Vulnerability, Infrastructure as Code Issue, Container Vulnerability | - */ - issueType?: - | "Advisor" - | "Code Quality Issue" - | "Code Security Vulnerability" - | "Licence Issue" - | "Open Source Vulnerability" - | "Infrastructure as Code Issue" - | "Container Vulnerability"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; - /** - * Severity of the issue - * - * | Rule | Value | - * |---|---| - * | Enum Values | High, Medium, Low, Critical | - */ - severity?: "High" | "Medium" | "Low" | "Critical"; -} - -export interface IssueInTreeIsClickedProperties { - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Issue ID as received from the backend. - */ - issueId?: string; - /** - * Issue type - * - * | Rule | Value | - * |---|---| - * | Enum Values | Advisor, Code Quality Issue, Code Security Vulnerability, Licence Issue, Open Source Vulnerability, Infrastructure as Code Issue, Container Vulnerability | - */ - issueType?: - | "Advisor" - | "Code Quality Issue" - | "Code Security Vulnerability" - | "Licence Issue" - | "Open Source Vulnerability" - | "Infrastructure as Code Issue" - | "Container Vulnerability"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; - /** - * Severity of the issue - * - * | Rule | Value | - * |---|---| - * | Enum Values | High, Medium, Low, Critical | - */ - severity?: "High" | "Medium" | "Low" | "Critical"; -} - -export interface PluginIsInstalledProperties { - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export interface QuickFixIsDisplayedProperties { - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * Quick fix types displayed to the user: - * - * * Show this suggestion - * - * * Ignore this particular suggestion - * - * * Ignore this suggestion in current file - * - * Due to array type definition limitation in Iteratively, the type is enforced in the code as follows: - * - * ``` - * type SupportedQuickFixProperties = - * | 'Show Suggestion' - * | 'Ignore Suggestion In Line' - * | 'Ignore Suggestion In File'; - * ``` - * - * | Rule | Value | - * |---|---| - * | Min Items | 1 | - * | Unique Items | true | - * | Item Type | string | - * - * @minItems 1 - */ - quickFixType: [string, ...string[]]; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export interface ScanModeIsSelectedProperties { - /** - * Used to identify the source for multi-source events. - * - * For example, if a given event is shared between Snyk Advisor and Snyk Learn, this property helps to differentiate between the two. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Advisor, App, Learn, IDE, Website, CodeSnippets | - */ - eventSource?: "Advisor" | "App" | "Learn" | "IDE" | "Website" | "CodeSnippets"; - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; - /** - * | Rule | Value | - * |---|---| - * | Enum Values | paused, auto, manual, throttled | - */ - scanMode: "paused" | "auto" | "manual" | "throttled"; -} - -export interface WelcomeButtonIsClickedProperties { - /** - * Used to identify the source for multi-source events. - * - * For example, if a given event is shared between Snyk Advisor and Snyk Learn, this property helps to differentiate between the two. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Advisor, App, Learn, IDE, Website, CodeSnippets | - */ - eventSource?: "Advisor" | "App" | "Learn" | "IDE" | "Website" | "CodeSnippets"; - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export interface WelcomeIsViewedProperties { - /** - * Ide family. - * - * | Rule | Value | - * |---|---| - * | Enum Values | Visual Studio Code, Visual Studio, Eclipse, JetBrains, Other | - */ - ide: "Visual Studio Code" | "Visual Studio" | "Eclipse" | "JetBrains" | "Other"; - /** - * Operating system architecture - */ - osArch?: string; - /** - * Operating system platform - */ - osPlatform?: string; - /** - * IDE plugin runtime name. - */ - runtimeName?: string; - /** - * IDE plugin runtime version. - * - * | Rule | Value | - * |---|---| - * | Min Length | 1 | - */ - runtimeVersion?: string; -} - -export class AnalysisIsReady implements Event { - name = 'Analysis Is Ready'; - id = 'c9337edb-27a3-416e-a654-092fa4375feb'; - version = '3.0.0'; - properties: AnalysisIsReadyProperties & { - 'itly': true; - }; - - constructor( - properties: AnalysisIsReadyProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class AnalysisIsTriggered implements Event { - name = 'Analysis Is Triggered'; - id = 'dabf569e-219c-470f-8e31-6e029723f0cd'; - version = '3.0.0'; - properties: AnalysisIsTriggeredProperties & { - 'itly': true; - }; - - constructor( - properties: AnalysisIsTriggeredProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class AuthenticateButtonIsClicked implements Event { - name = 'Authenticate Button Is Clicked'; - id = '2220c25f-ba76-4d5b-92f7-6d0e1c6165be'; - version = '4.0.0'; - properties: AuthenticateButtonIsClickedProperties & { - 'itly': true; - }; - - constructor( - properties: AuthenticateButtonIsClickedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class IssueHoverIsDisplayed implements Event { - name = 'Issue Hover Is Displayed'; - id = '5bcc7fd8-6118-4777-b719-366cda263a13'; - version = '3.0.0'; - properties: IssueHoverIsDisplayedProperties & { - 'itly': true; - }; - - constructor( - properties: IssueHoverIsDisplayedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class IssueInTreeIsClicked implements Event { - name = 'Issue In Tree Is Clicked'; - id = 'fae15d02-eab9-49bb-9833-18414e26058b'; - version = '3.0.0'; - properties: IssueInTreeIsClickedProperties & { - 'itly': true; - }; - - constructor( - properties: IssueInTreeIsClickedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class PluginIsInstalled implements Event { - name = 'Plugin Is Installed'; - id = '7bb34693-366e-460e-8f4c-5b3f1c71888a'; - version = '2.0.0'; - properties: PluginIsInstalledProperties & { - 'itly': true; - }; - - constructor( - properties: PluginIsInstalledProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class QuickFixIsDisplayed implements Event { - name = 'Quick Fix Is Displayed'; - id = '170c1284-9ee6-457f-aa82-6c49e49cde93'; - version = '2.0.0'; - properties: QuickFixIsDisplayedProperties & { - 'itly': true; - }; - - constructor( - properties: QuickFixIsDisplayedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class ScanModeIsSelected implements Event { - name = 'Scan Mode Is Selected'; - id = '41d49045-d336-46ac-b4c2-1a3ebb5c688a'; - version = '4.0.0'; - properties: ScanModeIsSelectedProperties & { - 'itly': true; - }; - - constructor( - properties: ScanModeIsSelectedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class WelcomeButtonIsClicked implements Event { - name = 'Welcome Button Is Clicked'; - id = 'e570e72e-4974-481a-9838-66cca471656b'; - version = '4.0.0'; - properties: WelcomeButtonIsClickedProperties & { - 'itly': true; - }; - - constructor( - properties: WelcomeButtonIsClickedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -export class WelcomeIsViewed implements Event { - name = 'Welcome Is Viewed'; - id = '91114669-bbab-4f58-a7dd-ea7c98c79221'; - version = '2.0.0'; - properties: WelcomeIsViewedProperties & { - 'itly': true; - }; - - constructor( - properties: WelcomeIsViewedProperties, - ) { - this.properties = { - ...properties, - 'itly': true, - }; - } -} - -// prettier-ignore -interface DestinationOptions { - - all?: { - disabled?: boolean; - }; -} - -export interface LoadOptions extends OptionsBase { - /** - * Analytics provider-specific configuration. - */ - destinations?: DestinationOptions; -} - -// prettier-ignore -class Itly { - private itly: ItlyNode; - - constructor() { - this.itly = new ItlyNode(); - } - - /** - * Initialize the Itly SDK. Call once when your application starts. - * @param loadOptions Configuration options to initialize the Itly SDK with. - */ - load(loadOptions: LoadOptions = {}) { - const { - destinations = {} as DestinationOptions, - plugins = [] as Plugin[], - ...options - } = loadOptions; - - const destinationPlugins = destinations.all && destinations.all.disabled - ? [] - : [ - - ]; - - this.itly.load({ - ...options, - plugins: [ - new SchemaValidatorPlugin({ - 'group': {"type":"object","properties":{"[Amplitude] Group ID":{"type":"object"},"[Amplitude] Group name":{"type":"object"},"$set":{"type":"object"},"$unset":{"type":"object"},"Account ARR":{"type":"object"},"Account Plan":{"type":"object"},"Billing Frequency":{"type":"object"},"Code Licenses":{"type":"object"},"Container Licenses":{"type":"object"},"countFixesFirst30Days":{"type":"object"},"countFixesFirst7Days":{"type":"object"},"countFixesPast30Days":{"type":"object"},"countFixesPast7Days":{"type":"object"},"countFixesTotal":{"type":"object"},"currentEngagementState":{"type":"object"},"dateLastEngagementStateChange":{"type":"object"},"daysSinceLastEngagementStateChange":{"type":"object"},"DB Feed Licenses":{"type":"object"},"Free Trial End Date":{"type":"object"},"Free Trial Start Date":{"type":"object"},"groupId":{"type":"string"},"groupName":{"type":"string"},"groupType":{"enum":["org","group","account"]},"hasFixFirst30Days":{"type":"object"},"hasFixFirst7Days":{"type":"object"},"hasFixPast30Days":{"type":"object"},"hasFixPast7Days":{"type":"object"},"IAC Licenses":{"type":"object"},"id":{"type":"object"},"internalName":{"type":"object"},"isPassthrough":{"type":"object"},"name":{"type":"object"},"Open Source Licenses":{"type":"object"},"plan":{"type":"string"},"priorEngagementState":{"type":"object"},"projectTypes":{"items":{"type":"string"},"uniqueItems":true,"type":"array"}},"additionalProperties":false,"required":[]}, - 'identify': {"type":"object","properties":{"accountType":{"enum":["user","service","app-instance","automated-test-user"]},"adminLink":{"type":"string"},"appcuesCompanyName":{"type":"string"},"appcuesFirstName":{"type":"string"},"appcuesJobTitle":{"type":"string"},"appcuesLastName":{"type":"string"},"appcuesUserGoal":{"type":"string"},"appcuesWorkEmail":{"type":"string"},"authProvider":{"type":"string"},"createdAt":{"type":"object"},"email":{"type":"string"},"firstName":{"type":"string"},"hasFirstIntegration":{"type":"boolean"},"hasFirstProject":{"type":"boolean"},"hasPersonalEmail":{"type":"boolean"},"isAppUIBetaEnabled":{"type":"boolean"},"isNonUser":{"type":"boolean"},"isSnyk":{"type":"boolean"},"isSnykAdmin":{"type":"boolean"},"lastName":{"type":"string"},"learnPreferredEcosystems":{"items":{"type":"string"},"uniqueItems":true,"type":"array"},"productUpdatesConsent":{"type":"boolean"},"productUpdatesConsentIsDisplayed":{"type":"boolean"},"user_id":{"type":"string"},"username":{"type":"string"},"utm_campaign":{"type":"string"},"utm_content":{"type":"string"},"utm_medium":{"type":"string"},"utm_source":{"type":"string"},"utm_term":{"type":"string"}},"additionalProperties":false,"required":[]}, - 'page': {"type":"object","properties":{"ecosystem":{"type":"string"},"package":{"type":"string"},"packageManager":{"type":"string"},"packageVersion":{"type":"string"},"path":{"type":"string"},"referrer":{"type":"string"},"search":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"vulnerabilityId":{"type":"string"}},"additionalProperties":false,"required":[]}, - 'Analysis Is Ready': {"type":"object","properties":{"analysisType":{"enum":["Snyk Advisor","Snyk Code Quality","Snyk Code Security","Snyk Open Source","Snyk Container","Snyk Infrastructure as Code"]},"durationInSeconds":{"type":"number"},"fileCount":{"type":"integer"},"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"result":{"enum":["Success","Error"]},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["analysisType","ide","itly","result"]}, - 'Analysis Is Triggered': {"type":"object","properties":{"analysisType":{"items":{"type":"string"},"minItems":1,"uniqueItems":true,"type":"array"},"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"},"triggeredByUser":{"type":"boolean"}},"additionalProperties":false,"required":["analysisType","ide","itly","triggeredByUser"]}, - 'Authenticate Button Is Clicked': {"type":"object","properties":{"eventSource":{"enum":["Advisor","App","Learn","IDE","Website","CodeSnippets"]},"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["ide","itly"]}, - 'Issue Hover Is Displayed': {"type":"object","properties":{"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"issueId":{"type":"string"},"issueType":{"enum":["Advisor","Code Quality Issue","Code Security Vulnerability","Licence Issue","Open Source Vulnerability","Infrastructure as Code Issue","Container Vulnerability"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"},"severity":{"enum":["High","Medium","Low","Critical"]}},"additionalProperties":false,"required":["ide","itly"]}, - 'Issue In Tree Is Clicked': {"type":"object","properties":{"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"issueId":{"type":"string"},"issueType":{"enum":["Advisor","Code Quality Issue","Code Security Vulnerability","Licence Issue","Open Source Vulnerability","Infrastructure as Code Issue","Container Vulnerability"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"},"severity":{"enum":["High","Medium","Low","Critical"]}},"additionalProperties":false,"required":["ide","itly"]}, - 'Plugin Is Installed': {"type":"object","properties":{"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["ide","itly"]}, - 'Quick Fix Is Displayed': {"type":"object","properties":{"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"quickFixType":{"items":{"type":"string"},"minItems":1,"uniqueItems":true,"type":"array"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["ide","itly","quickFixType"]}, - 'Scan Mode Is Selected': {"type":"object","properties":{"eventSource":{"enum":["Advisor","App","Learn","IDE","Website","CodeSnippets"]},"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"},"scanMode":{"enum":["paused","auto","manual","throttled"]}},"additionalProperties":false,"required":["ide","itly","scanMode"]}, - 'Welcome Button Is Clicked': {"type":"object","properties":{"eventSource":{"enum":["Advisor","App","Learn","IDE","Website","CodeSnippets"]},"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["ide","itly"]}, - 'Welcome Is Viewed': {"type":"object","properties":{"ide":{"enum":["Visual Studio Code","Visual Studio","Eclipse","JetBrains","Other"]},"itly":{"const":true},"osArch":{"type":"string"},"osPlatform":{"type":"string"},"runtimeName":{"type":"string"},"runtimeVersion":{"minLength":1,"type":"string"}},"additionalProperties":false,"required":["ide","itly"]}, - }), - ...destinationPlugins, - ...plugins, - ], - }); - } - - /** - * Alias a user ID to another user ID. - * @param userId The user's new ID. - * @param previousId The user's previous ID. - * @param options Options for this alias call. - */ - alias(userId: string, previousId: string, options?: AliasOptions) { - this.itly.alias(userId, previousId, options); - } - - /** - * Identify a user and set or update that user's properties. - * @param userId The user's ID. - * @param properties The user's properties. - * @param options Options for this identify call. - */ - identify( - userId: string, - properties?: IdentifyProperties, - options?: IdentifyOptions, - ) { - this.itly.identify(userId, properties, options) - } - - /** - * Associate a user with a group and set or update that group's properties. - * @param userId The user's ID. - * @param groupId The group's ID. - * @param properties The group's properties. - * @param options Options for this group call. - */ - group( - userId: string, - groupId: string, - properties?: GroupProperties, - options?: GroupOptions, - ) { - this.itly.group(userId, groupId, properties, options) - } - - /** - * Triggered when the analysis is loaded within the IDE. - * - * Owner: Georgi Mitev - * @param userId The user's ID. - * @param properties The event's properties (e.g. analysisType) - * @param options Options for this track call. - */ - analysisIsReady( - userId: string, - properties: AnalysisIsReadyProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new AnalysisIsReady(properties), options); - } - - /** - * User triggers an analysis or analysis is automatically triggered. - * - * Owner: Georgi Mitev - * @param userId The user's ID. - * @param properties The event's properties (e.g. analysisType) - * @param options Options for this track call. - */ - analysisIsTriggered( - userId: string, - properties: AnalysisIsTriggeredProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new AnalysisIsTriggered(properties), options); - } - - /** - * This Event fires when the authenticate button is clicked. - * - * Owner: Bastian Doetsch - * @param userId The user's ID. - * @param properties The event's properties (e.g. eventSource) - * @param options Options for this track call. - */ - authenticateButtonIsClicked( - userId: string, - properties: AuthenticateButtonIsClickedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new AuthenticateButtonIsClicked(properties), options); - } - - /** - * Triggered when issue hover is displayed in the IDE editor. - * - * Owner: Michel Kaporin - * @param userId The user's ID. - * @param properties The event's properties (e.g. ide) - * @param options Options for this track call. - */ - issueHoverIsDisplayed( - userId: string, - properties: IssueHoverIsDisplayedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new IssueHoverIsDisplayed(properties), options); - } - - /** - * Triggered when the user selects an issue from the issues list and the issue is loaded. - * - * Owner: Georgi Mitev - * @param userId The user's ID. - * @param properties The event's properties (e.g. ide) - * @param options Options for this track call. - */ - issueInTreeIsClicked( - userId: string, - properties: IssueInTreeIsClickedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new IssueInTreeIsClicked(properties), options); - } - - /** - * Triggered when the user installs the plugin. - * - * Owner: Georgi Mitev - * @param userId The user's ID. - * @param properties The event's properties (e.g. ide) - * @param options Options for this track call. - */ - pluginIsInstalled( - userId: string, - properties: PluginIsInstalledProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new PluginIsInstalled(properties), options); - } - - /** - * Triggered when quick fix options are displayed to the user in IDE. - * - * Owner: Michel Kaporin - * @param userId The user's ID. - * @param properties The event's properties (e.g. ide) - * @param options Options for this track call. - */ - quickFixIsDisplayed( - userId: string, - properties: QuickFixIsDisplayedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new QuickFixIsDisplayed(properties), options); - } - - /** - * Owner: Michel Kaporin - * @param userId The user's ID. - * @param properties The event's properties (e.g. eventSource) - * @param options Options for this track call. - */ - scanModeIsSelected( - userId: string, - properties: ScanModeIsSelectedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new ScanModeIsSelected(properties), options); - } - - /** - * This event fires when the "Check it out" button is clicked in welcome notification. - * - * Owner: Michel Kaporin - * @param userId The user's ID. - * @param properties The event's properties (e.g. eventSource) - * @param options Options for this track call. - */ - welcomeButtonIsClicked( - userId: string, - properties: WelcomeButtonIsClickedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new WelcomeButtonIsClicked(properties), options); - } - - /** - * User installs the IDE plugin and see Snyk's welcome screen. - * - * Owner: Georgi Mitev - * @param userId The user's ID. - * @param properties The event's properties (e.g. ide) - * @param options Options for this track call. - */ - welcomeIsViewed( - userId: string, - properties: WelcomeIsViewedProperties, - options?: TrackOptions, - ) { - this.itly.track(userId, new WelcomeIsViewed(properties), options); - } - - /** - * Track any event. - * @param userId The user's ID. - * @param event The event to track. - * @param options Options for this track call. - */ - track(userId: string, event: Event, options?: TrackOptions) { - this.itly.track(userId, event, options); - } - - // reset() N/A for Node.js - - async flush() { - await this.itly.flush(); - } -} - -export default new Itly(); diff --git a/src/snyk/advisor/advisorTypes.ts b/src/snyk/advisor/advisorTypes.ts deleted file mode 100644 index 43f9e167f..000000000 --- a/src/snyk/advisor/advisorTypes.ts +++ /dev/null @@ -1,15 +0,0 @@ -export type AdvisorScoreLabel = { - popularity: string; - maintenance: string; - community: string; - security: string; -}; - -export type AdvisorScore = { - name: string; - score: number; - pending: boolean; - labels: AdvisorScoreLabel; -} | null; - -export type AdvisorRegistry = 'npm-package' | 'python'; diff --git a/src/snyk/advisor/editor/editorDecorator.ts b/src/snyk/advisor/editor/editorDecorator.ts deleted file mode 100644 index 0699f5a9e..000000000 --- a/src/snyk/advisor/editor/editorDecorator.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { getRenderOptions, LineDecorations, updateDecorations } from '../../common/editor/editorDecorator'; -import { HoverAdapter } from '../../common/vscode/hover'; -import { IVSCodeLanguages } from '../../common/vscode/languages'; -import { IMarkdownStringAdapter } from '../../common/vscode/markdownString'; -import { IThemeColorAdapter } from '../../common/vscode/theme'; -import { Hover, TextEditorDecorationType } from '../../common/vscode/types'; -import { IVSCodeWindow } from '../../common/vscode/window'; -import { AdvisorScore } from '../advisorTypes'; -import { messages } from '../messages/messages'; -import { IAdvisorApiClient } from '../services/advisorApiClient'; - -const { SCORE_PREFIX } = messages; - -export default class EditorDecorator { - private readonly decorationType: TextEditorDecorationType; - private readonly editorLastCharacterIndex = Number.MAX_SAFE_INTEGER; - private readonly fileDecorationLines: Map = new Map(); - - constructor( - private readonly window: IVSCodeWindow, - private readonly languages: IVSCodeLanguages, - private readonly themeColorAdapter: IThemeColorAdapter, - private readonly advisorApiClient: IAdvisorApiClient, - private readonly hoverAdapter: HoverAdapter, - private readonly markdownStringAdapter: IMarkdownStringAdapter, - ) { - this.decorationType = this.window.createTextEditorDecorationType({ - after: { margin: '0 0 0 1rem' }, - }); - } - - addScoresDecorations( - filePath: string, - packageScore: AdvisorScore, - line: number, - decorations: LineDecorations = [], - ): void { - if (!packageScore) { - return; - } - decorations[line] = { - range: this.languages.createRange( - line - 1, - this.editorLastCharacterIndex, - line - 1, - this.editorLastCharacterIndex, - ), - renderOptions: getRenderOptions( - `${SCORE_PREFIX} ${Math.round(packageScore.score * 100)}/100`, - this.themeColorAdapter, - ), - hoverMessage: this.getHoverMessage(packageScore)?.contents, - }; - - this.fileDecorationLines.set(filePath, decorations); - updateDecorations(this.window, filePath, decorations, this.decorationType); - } - - getHoverMessage(score: AdvisorScore): Hover | null { - if (!score) { - return null; - } - const hoverMessageMarkdown = this.markdownStringAdapter.get(``); - hoverMessageMarkdown.isTrusted = true; - const hoverMessage = this.hoverAdapter.create(hoverMessageMarkdown); - hoverMessageMarkdown.appendMarkdown('| | | | |'); - hoverMessageMarkdown.appendMarkdown('\n'); - hoverMessageMarkdown.appendMarkdown('| ---- | ---- | ---- | :---- |'); - hoverMessageMarkdown.appendMarkdown('\n'); - Object.keys(score.labels).forEach(label => { - hoverMessageMarkdown.appendMarkdown(`| ${label}: | | | ${score?.labels[label]} |`); - hoverMessageMarkdown.appendMarkdown('\n'); - }); - hoverMessageMarkdown.appendMarkdown( - `[More Details](${this.advisorApiClient.getAdvisorUrl('npm-package')}/${score.name})`, - ); - - return hoverMessage; - } - - resetDecorations(filePath: string): void { - const decorations: LineDecorations | undefined = this.fileDecorationLines.get(filePath); - if (!decorations) { - return; - } - - const emptyDecorations = decorations.map(d => ({ - ...d, - renderOptions: getRenderOptions('', this.themeColorAdapter), - })); - - updateDecorations(this.window, filePath, emptyDecorations, this.decorationType); - } -} diff --git a/src/snyk/advisor/messages/messages.ts b/src/snyk/advisor/messages/messages.ts deleted file mode 100644 index d05345c16..000000000 --- a/src/snyk/advisor/messages/messages.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const messages = { - SCORE_PREFIX: 'Advisor Score', -}; diff --git a/src/snyk/advisor/services/advisorApiClient.ts b/src/snyk/advisor/services/advisorApiClient.ts deleted file mode 100644 index 9a068857d..000000000 --- a/src/snyk/advisor/services/advisorApiClient.ts +++ /dev/null @@ -1,55 +0,0 @@ -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; -import { DEFAULT_API_HEADERS } from '../../common/api/headers'; -import { IConfiguration } from '../../common/configuration/configuration'; -import { ILog } from '../../common/logger/interfaces'; -import { AdvisorRegistry } from '../advisorTypes'; - -export interface IAdvisorApiClient { - post>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise; - apiPath: string; - getAdvisorUrl(registry: AdvisorRegistry): string; -} - -export class AdvisorApiClient implements IAdvisorApiClient { - private instance: AxiosInstance | null = null; - private readonly advisorBaseUrl = 'https://snyk.io/advisor'; - apiPath = `/unstable/advisor/scores/npm-package`; - - constructor(private readonly configuration: IConfiguration, private readonly logger: ILog) {} - - getAdvisorUrl(registry: AdvisorRegistry): string { - return `${this.advisorBaseUrl}/${registry}`; - } - - private get http(): AxiosInstance { - return this.instance != null ? this.instance : this.initHttp(); - } - - initHttp(): AxiosInstance { - const http = axios.create({ - headers: DEFAULT_API_HEADERS, - responseType: 'json', - }); - - http.interceptors.response.use( - response => response, - (error: Error) => { - this.logger.error(`Call to Advisor API failed: ${error.message}`); - return Promise.reject(error); - }, - ); - - this.instance = http; - return http; - } - - async post>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise { - const token = await this.configuration.getToken(); - this.http.interceptors.request.use(req => { - req.baseURL = this.configuration.baseApiUrl; - req.headers['Authorization'] = `token ${token}`; - return req; - }); - return this.http.post(url, data, config); - } -} diff --git a/src/snyk/advisor/services/advisorProvider.ts b/src/snyk/advisor/services/advisorProvider.ts deleted file mode 100644 index 4d3efb835..000000000 --- a/src/snyk/advisor/services/advisorProvider.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { AxiosResponse } from 'axios'; -import { ILog } from '../../common/logger/interfaces'; -import { ImportedModule } from '../../common/types'; -import { AdvisorScore } from '../advisorTypes'; -import { IAdvisorApiClient } from './advisorApiClient'; - -export default class AdvisorProvider { - protected scores: AdvisorScore[]; - private cachePackages: string[] = []; - - constructor(private readonly advisorApiClient: IAdvisorApiClient, private readonly logger: ILog) {} - - public async getScores(modules: ImportedModule[]): Promise { - const scores: AdvisorScore[] = []; - try { - const packages = modules.map(({ name }) => name); - if (!packages.filter(pkg => !this.cachePackages.includes(pkg)).length) { - return this.scores; - } - if (!packages.length) { - return scores; - } - const res: AxiosResponse = await this.advisorApiClient.post( - this.advisorApiClient.apiPath, - modules.map(({ name }) => name), - ); - - if (res.data) { - this.scores = res.data as AdvisorScore[]; - this.cachePackages = this.scores.map(advisorScore => { - if (!advisorScore) { - return ''; - } - if (!advisorScore.name) { - return ''; - } - return advisorScore.name; - }); - return res.data as AdvisorScore[]; - } - } catch (err) { - if (err instanceof Error) { - this.logger.error(`Failed to get scores: ${err.message}`); - } - } - return scores; - } -} diff --git a/src/snyk/advisor/services/advisorService.ts b/src/snyk/advisor/services/advisorService.ts deleted file mode 100644 index 74a08946a..000000000 --- a/src/snyk/advisor/services/advisorService.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { Subscription } from 'rxjs'; -import { IConfiguration } from '../../common/configuration/configuration'; -import { LineDecorations } from '../../common/editor/editorDecorator'; -import { ILog } from '../../common/logger/interfaces'; -import { getSupportedLanguage, isValidModuleName } from '../../common/parsing'; -import { ModuleParserProvider } from '../../common/services/moduleParserProvider'; -import { ImportedModule, Language } from '../../common/types'; -import { HoverAdapter } from '../../common/vscode/hover'; -import { IVSCodeLanguages } from '../../common/vscode/languages'; -import { IMarkdownStringAdapter } from '../../common/vscode/markdownString'; -import { IThemeColorAdapter } from '../../common/vscode/theme'; -import { Disposable, TextDocument, TextEditor } from '../../common/vscode/types'; -import { IVSCodeWindow } from '../../common/vscode/window'; -import { IVSCodeWorkspace } from '../../common/vscode/workspace'; -import { AdvisorScore } from '../advisorTypes'; -import EditorDecorator from '../editor/editorDecorator'; -import { IAdvisorApiClient } from './advisorApiClient'; -import AdvisorProvider from './advisorProvider'; - -const SCORE_THRESHOLD = 0.7; -export class AdvisorService implements Disposable { - protected disposables: Disposable[] = []; - protected advisorScanFinishedSubscription: Subscription; - protected activeEditor: TextEditor | undefined; - - private readonly editorDecorator: EditorDecorator; - - constructor( - private readonly window: IVSCodeWindow, - private readonly languages: IVSCodeLanguages, - private readonly advisorProvider: AdvisorProvider, - private readonly logger: ILog, - private readonly workspace: IVSCodeWorkspace, - private readonly advisorApiClient: IAdvisorApiClient, - private readonly themeColorAdapter: IThemeColorAdapter, - private readonly hoverAdapter: HoverAdapter, - private readonly markdownStringAdapter: IMarkdownStringAdapter, - private readonly configuration: IConfiguration, - ) { - this.editorDecorator = new EditorDecorator( - window, - this.languages, - this.themeColorAdapter, - this.advisorApiClient, - this.hoverAdapter, - this.markdownStringAdapter, - ); - } - - async activate(): Promise { - if (!this.configuration.getPreviewFeatures().advisor) { - return; - } - - this.activeEditor = this.window.getActiveTextEditor(); - this.registerEditorListeners(); - if (!this.activeEditor) { - return; - } - - await this.handleEditorEvent(this.activeEditor.document); - } - - registerEditorListeners(): void { - this.disposables.push( - this.workspace.onDidChangeTextDocument(async ev => { - if (ev?.contentChanges.length) { - this.editorDecorator.resetDecorations(ev.document.fileName); - } - await this.handleEditorEvent(ev.document); - }), - this.window.onDidChangeActiveTextEditor(async ev => { - if (!ev) { - return; - } - await this.handleEditorEvent(ev.document); - }), - ); - } - - async handleEditorEvent(document: TextDocument): Promise { - const { fileName, languageId } = document; - const supportedLanguage = getSupportedLanguage(fileName, languageId); - if (document.isDirty || !supportedLanguage) { - return; - } - - const modules = this.getModules(fileName, document.getText(), supportedLanguage, this.logger).filter( - isValidModuleName, - ); - - const scores = await this.advisorProvider.getScores(modules); - this.processScores(scores, modules, fileName); - } - - processScores(scores: AdvisorScore[], modules: ImportedModule[], fileName: string): void { - const vulnsLineDecorations: Map = new Map(); - modules.forEach(({ name, line }) => { - vulnsLineDecorations.set(name, line || -1); - }); - const decorations: LineDecorations = []; - for (const [packageName, line] of vulnsLineDecorations) { - if (line < 0) { - continue; - } - const packageScore = scores.find(score => score && score.name === packageName); - if (!packageScore || packageScore.score >= SCORE_THRESHOLD) { - continue; - } - - this.editorDecorator.addScoresDecorations(fileName, packageScore, line, decorations); - } - } - - private getModules(fileName: string, source: string, language: Language, logger: ILog): ImportedModule[] { - const parser = ModuleParserProvider.getInstance(language, logger, this.configuration); - if (!parser) { - return []; - } - - return parser.getModules(fileName, source, language); - } - - dispose(): void { - while (this.disposables.length) { - const disposable = this.disposables.pop(); - if (disposable) { - disposable.dispose(); - } - } - } -} diff --git a/src/snyk/base/modules/baseSnykModule.ts b/src/snyk/base/modules/baseSnykModule.ts index 14ed435b2..9722c0ad5 100644 --- a/src/snyk/base/modules/baseSnykModule.ts +++ b/src/snyk/base/modules/baseSnykModule.ts @@ -1,14 +1,8 @@ -import { AdvisorApiClient, IAdvisorApiClient } from '../../advisor/services/advisorApiClient'; -import AdvisorProvider from '../../advisor/services/advisorProvider'; -import { AdvisorService } from '../../advisor/services/advisorService'; -import { IAnalytics } from '../../common/analytics/itly'; import { CommandController } from '../../common/commands/commandController'; -import { configuration } from '../../common/configuration/instance'; import { IWorkspaceTrust, WorkspaceTrust } from '../../common/configuration/trustedFolders'; import { ExperimentService } from '../../common/experiment/services/experimentService'; import { ILanguageServer } from '../../common/languageServer/languageServer'; import { CodeIssueData, IacIssueData } from '../../common/languageServer/types'; -import { Logger } from '../../common/logger/logger'; import { ContextService, IContextService } from '../../common/services/contextService'; import { DownloadService } from '../../common/services/downloadService'; import { LearnService } from '../../common/services/learnService'; @@ -45,17 +39,14 @@ export default abstract class BaseSnykModule implements IBaseSnykModule { protected authService: IAuthenticationService; protected downloadService: DownloadService; protected ossService?: OssService; - protected advisorService?: AdvisorProvider; + protected commandController: CommandController; protected scanModeService: ScanModeService; protected ossVulnerabilityCountService: OssVulnerabilityCountService; - protected advisorScoreDisposable: AdvisorService; + protected languageServer: ILanguageServer; protected notificationService: INotificationService; - protected analytics: IAnalytics; - - protected advisorApiClient: IAdvisorApiClient; snykCode: IProductService; protected codeSettings: ICodeSettings; @@ -78,7 +69,6 @@ export default abstract class BaseSnykModule implements IBaseSnykModule { this.contextService = new ContextService(); this.openerService = new OpenerService(); this.loadingBadge = new LoadingBadge(); - this.advisorApiClient = new AdvisorApiClient(configuration, Logger); this.markdownStringAdapter = new MarkdownStringAdapter(); this.workspaceTrust = new WorkspaceTrust(); this.codeActionKindAdapter = new CodeActionKindAdapter(); diff --git a/src/snyk/base/modules/snykLib.ts b/src/snyk/base/modules/snykLib.ts index 640b8e2fc..e3469ce8b 100644 --- a/src/snyk/base/modules/snykLib.ts +++ b/src/snyk/base/modules/snykLib.ts @@ -1,17 +1,15 @@ import * as _ from 'lodash'; -import { SupportedAnalysisProperties } from '../../common/analytics/itly'; import { configuration } from '../../common/configuration/instance'; -import { DEFAULT_SCAN_DEBOUNCE_INTERVAL, IDE_NAME } from '../../common/constants/general'; +import { DEFAULT_SCAN_DEBOUNCE_INTERVAL } from '../../common/constants/general'; import { SNYK_CONTEXT } from '../../common/constants/views'; import { ErrorHandler } from '../../common/error/errorHandler'; import { Logger } from '../../common/logger/logger'; import { vsCodeCommands } from '../../common/vscode/commands'; -import { vsCodeWorkspace } from '../../common/vscode/workspace'; import BaseSnykModule from './baseSnykModule'; import { ISnykLib } from './interfaces'; export default class SnykLib extends BaseSnykModule implements ISnykLib { - private async runFullScan_(manual = false): Promise { + private async runFullScan_(): Promise { await this.contextService.setContext(SNYK_CONTEXT.ERROR, false); this.loadingBadge.setLoadingBadge(false); @@ -31,12 +29,7 @@ export default class SnykLib extends BaseSnykModule implements ISnykLib { return; } - await this.user.identify(vsCodeCommands, this.analytics); - - const workspacePaths = vsCodeWorkspace.getWorkspaceFolders(); - if (workspacePaths.length) { - this.logFullAnalysisIsTriggered(manual); - } + await this.user.identify(vsCodeCommands); } catch (err) { await ErrorHandler.handleGlobal(err, Logger, this.contextService, this.loadingBadge); } @@ -52,13 +45,6 @@ export default class SnykLib extends BaseSnykModule implements ISnykLib { Logger.info(wasEnabled ? 'Snyk Code was enabled' : 'Failed to enable Snyk Code'); } - async onDidChangeWelcomeViewVisibility(visible: boolean): Promise { - if (visible && !(await configuration.getToken())) { - // Track if a user is not authenticated and expanded the analysis view - this.analytics.logWelcomeViewIsViewed(); - } - } - async checkAdvancedMode(): Promise { await this.contextService.setContext(SNYK_CONTEXT.ADVANCED, configuration.shouldShowAdvancedView); } @@ -67,28 +53,4 @@ export default class SnykLib extends BaseSnykModule implements ISnykLib { const workspaceFound = !!workspacePaths.length; await this.contextService.setContext(SNYK_CONTEXT.WORKSPACE_FOUND, workspaceFound); } - - private isSnykCodeAutoscanSuspended(manual: boolean) { - return !manual && !this.scanModeService.isCodeAutoScanAllowed(); - } - - private logFullAnalysisIsTriggered(manual: boolean) { - const analysisType: SupportedAnalysisProperties[] = []; - const enabledFeatures = configuration.getFeaturesConfiguration(); - - // Ensure preconditions are the same as within running specific analysis - if (!this.isSnykCodeAutoscanSuspended(manual)) { - if (enabledFeatures?.codeSecurityEnabled) analysisType.push('Snyk Code Security'); - if (enabledFeatures?.codeQualityEnabled) analysisType.push('Snyk Code Quality'); - } - if (enabledFeatures?.ossEnabled) analysisType.push('Snyk Open Source'); - - if (analysisType.length) { - this.analytics.logAnalysisIsTriggered({ - analysisType: analysisType as [SupportedAnalysisProperties, ...SupportedAnalysisProperties[]], - ide: IDE_NAME, - triggeredByUser: manual, - }); - } - } } diff --git a/src/snyk/base/services/authenticationService.ts b/src/snyk/base/services/authenticationService.ts index b27f574c4..77730cdf3 100644 --- a/src/snyk/base/services/authenticationService.ts +++ b/src/snyk/base/services/authenticationService.ts @@ -1,5 +1,4 @@ import { validate as uuidValidate } from 'uuid'; -import { IAnalytics } from '../../common/analytics/itly'; import { IConfiguration } from '../../common/configuration/configuration'; import { SNYK_WORKSPACE_SCAN_COMMAND } from '../../common/constants/commands'; import { DID_CHANGE_CONFIGURATION_METHOD } from '../../common/constants/languageServer'; @@ -33,14 +32,12 @@ export class AuthenticationService implements IAuthenticationService { private readonly baseModule: IBaseSnykModule, private readonly configuration: IConfiguration, private readonly window: IVSCodeWindow, - private readonly analytics: IAnalytics, private readonly logger: ILog, private readonly clientAdapter: ILanguageClientAdapter, private commands: IVSCodeCommands, ) {} async initiateLogin(): Promise { - this.analytics.logAuthenticateButtonIsClicked(); await this.contextService.setContext(SNYK_CONTEXT.LOGGEDIN, false); await this.contextService.setContext(SNYK_CONTEXT.AUTHENTICATING, true); } diff --git a/src/snyk/base/services/scanModeService.ts b/src/snyk/base/services/scanModeService.ts index 3c1cc3136..7db72eeca 100644 --- a/src/snyk/base/services/scanModeService.ts +++ b/src/snyk/base/services/scanModeService.ts @@ -1,4 +1,3 @@ -import { IAnalytics } from '../../common/analytics/itly'; import { IConfiguration } from '../../common/configuration/configuration'; import { IContextService } from '../../common/services/contextService'; import { CodeScanMode } from '../../snykCode/constants/modes'; @@ -7,7 +6,7 @@ export class ScanModeService { private _mode = CodeScanMode.AUTO; private _lastThrottledExecution: number | undefined; - constructor(private contextService: IContextService, private config: IConfiguration, private analytics: IAnalytics) {} + constructor(private contextService: IContextService, private config: IConfiguration) {} isOssAutoScanAllowed(): boolean { return this.config.shouldAutoScanOss; diff --git a/src/snyk/cli/process.ts b/src/snyk/cli/process.ts index 793335386..ac0d3e563 100644 --- a/src/snyk/cli/process.ts +++ b/src/snyk/cli/process.ts @@ -63,10 +63,6 @@ export class CliProcess { SNYK_CFG_ORG: this.config.organization, } as NodeJS.ProcessEnv; - if (!this.config.shouldReportEvents) { - env = { ...env, SNYK_CFG_DISABLE_ANALYTICS: '1' }; - } - const vscodeProxy = getVsCodeProxy(this.workspace); if (vscodeProxy && !process.env.HTTP_PROXY && !process.env.HTTPS_PROXY) { env = { diff --git a/src/snyk/common/analytics/itly.ts b/src/snyk/common/analytics/itly.ts deleted file mode 100644 index e2f8c605f..000000000 --- a/src/snyk/common/analytics/itly.ts +++ /dev/null @@ -1,268 +0,0 @@ -import SegmentPlugin from '@itly/plugin-segment-node'; -import itly, { - AnalysisIsReadyProperties, - IssueHoverIsDisplayedProperties, - IssueInTreeIsClickedProperties, - ScanModeIsSelectedProperties, - TrackOptions, - AnalysisIsTriggeredProperties as _AnalysisIsTriggeredProperties, - QuickFixIsDisplayedProperties as _QuickFixIsDisplayedProperties, -} from '../../../ampli'; -import { Configuration, IConfiguration } from '../configuration/configuration'; -import { SnykConfiguration } from '../configuration/snykConfiguration'; -import { IDE_NAME } from '../constants/general'; -import { ErrorHandler } from '../error/errorHandler'; -import { ILog } from '../logger/interfaces'; -import { User } from '../user'; -import { ItlyErrorPlugin } from './itlyErrorPlugin'; - -export type SupportedAnalysisProperties = - | 'Snyk Advisor' - | 'Snyk Code Quality' - | 'Snyk Code Security' - | 'Snyk Open Source'; -export type AnalysisIsTriggeredProperties = _AnalysisIsTriggeredProperties & { - analysisType: [SupportedAnalysisProperties, ...SupportedAnalysisProperties[]]; -}; - -export type SupportedQuickFixProperties = - | 'Show Suggestion' - | 'Ignore Suggestion In Line' - | 'Ignore Suggestion In File' - | 'Show Most Severe Vulnerability'; -export type QuickFixIsDisplayedProperties = _QuickFixIsDisplayedProperties & { - quickFixType: [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]]; -}; - -export interface IAnalytics { - load(): Iteratively | null; - flush(): Promise; - identify(userId: string): Promise; - logIssueInTreeIsClicked(properties: IssueInTreeIsClickedProperties): void; - logAnalysisIsReady(properties: AnalysisIsReadyProperties): void; - logAnalysisIsTriggered(properties: AnalysisIsTriggeredProperties): void; - logWelcomeViewIsViewed(): void; - logAuthenticateButtonIsClicked(): void; - logWelcomeButtonIsClicked(): void; - logPluginIsInstalled(): void; - logQuickFixIsDisplayed(properties: QuickFixIsDisplayedProperties): void; - logIssueHoverIsDisplayed(properties: IssueHoverIsDisplayedProperties): void; - logScanModeIsSelected(properties: Omit): void; -} - -/** - * Do not have any dependencies on 'vscode' module to prevent uninstall hook from breaking. - * Import required dependencies dynamically, if needed. - */ -export class Iteratively implements IAnalytics { - private readonly ide = IDE_NAME; - - private loaded = false; - - constructor( - private readonly user: User, - private logger: ILog, - private configuration: IConfiguration, - private snykConfiguration?: SnykConfiguration, - ) {} - - load(): Iteratively | null { - if (!this.configuration.shouldReportEvents) { - this.logger.debug(`Analytics are disabled in Settings.`); - return null; - } - - const segmentWriteKey = this.snykConfiguration?.segmentWriteKey; - if (!segmentWriteKey) { - this.logger.debug('Segment analytics write key is empty. No analytics will be collected.'); - return this; - } - - const segment = new SegmentPlugin(segmentWriteKey); - const isDevelopment = this.configuration.isDevelopment; - - if (!this.loaded) { - try { - itly.load({ - disabled: !this.configuration.shouldReportEvents, - environment: isDevelopment ? 'development' : 'production', - plugins: [segment, new ItlyErrorPlugin(this.logger)], - }); - } catch (err) { - this.logger.warn(`Failed to load analytics: ${err}`); - } - - this.loaded = true; - } - - return this; - } - - public flush = (): Promise => itly.flush(); - - async identify(userId: string): Promise { - if (!this.allowedToReportEvents()) { - return; - } - - // Calling identify is the preferred way to merge authenticated user with anonymous one, - // see https://snyk.slack.com/archives/C01U2SPRB3Q/p1624276750134700?thread_ts=1624030602.128900&cid=C01U2SPRB3Q - itly.identify(userId, undefined, { - segment: { - options: { - anonymousId: this.user.anonymousId, - context: { - app: { - name: this.ide, - version: await Configuration.getVersion(), - }, - }, - }, - }, - }); - } - - public logIssueInTreeIsClicked(properties: IssueInTreeIsClickedProperties): void { - this.enqueueEvent(() => { - itly.issueInTreeIsClicked(this.getAuthenticatedUserId(), properties); - }); - } - - public logAnalysisIsReady(properties: AnalysisIsReadyProperties): void { - this.enqueueEvent(() => { - itly.analysisIsReady(this.getAuthenticatedUserId(), properties); - }); - } - - public logAnalysisIsTriggered(properties: AnalysisIsTriggeredProperties): void { - this.enqueueEvent(() => { - itly.analysisIsTriggered(this.getAuthenticatedUserId(), properties); - }); - } - - public logWelcomeViewIsViewed(): void { - this.enqueueEvent(() => { - itly.welcomeIsViewed( - '', - { - ide: this.ide, - }, - this.getAnonymousSegmentOptions(), - ); - }, false); - } - - public logAuthenticateButtonIsClicked(): void { - this.enqueueEvent(() => { - itly.authenticateButtonIsClicked( - '', - { - ide: this.ide, - eventSource: 'IDE', - }, - this.getAnonymousSegmentOptions(), - ); - }, false); - } - - public logWelcomeButtonIsClicked(): void { - this.enqueueEvent(() => { - itly.welcomeButtonIsClicked( - this.user.authenticatedId ?? '', - { - ide: this.ide, - eventSource: 'IDE', - }, - this.getAnonymousSegmentOptions(), - ); - }, false); - } - - public logPluginIsInstalled(): void { - this.enqueueEvent(() => { - itly.pluginIsInstalled( - '', - { - ide: this.ide, - }, - { - segment: { - options: { - anonymousId: this.user.anonymousId, - }, - }, - }, - ); - }); - } - - public logQuickFixIsDisplayed(properties: QuickFixIsDisplayedProperties): void { - this.enqueueEvent(() => { - itly.quickFixIsDisplayed(this.getAuthenticatedUserId(), properties); - }); - } - - public logIssueHoverIsDisplayed(properties: IssueHoverIsDisplayedProperties): void { - this.enqueueEvent(() => { - itly.issueHoverIsDisplayed(this.getAuthenticatedUserId(), properties); - }); - } - - public logScanModeIsSelected(properties: Omit): void { - this.enqueueEvent(() => { - itly.scanModeIsSelected(this.getAuthenticatedUserId(), { - ...properties, - ide: this.ide, - eventSource: 'IDE', - }); - }); - } - - enqueueEvent(eventFunction: () => void, mustBeAuthenticated = true): void { - if (!this.allowedToReportEvents()) { - return; - } - if (mustBeAuthenticated && !this.user.authenticatedId) { - return; - } - - eventFunction(); - } - - private canReportEvents(): boolean { - if (!this.loaded) { - this.logger.debug('Cannot report events because Iteratively not loaded.'); - return false; - } - - if (!this.configuration.shouldReportEvents) { - return false; - } - - return true; - } - - private allowedToReportEvents(): boolean { - return this.canReportEvents() && this.configuration.analyticsPermitted; - } - - private getAnonymousSegmentOptions(): TrackOptions { - return { - segment: { - options: { - anonymousId: this.user.anonymousId, - }, - }, - }; - } - - private getAuthenticatedUserId(): string { - if (!this.user.authenticatedId) { - const err = new Error('User must be authenticated for analytics'); - ErrorHandler.handle(err, this.logger); - throw err; - } - - return this.user.authenticatedId; - } -} diff --git a/src/snyk/common/analytics/itlyErrorPlugin.ts b/src/snyk/common/analytics/itlyErrorPlugin.ts deleted file mode 100644 index 76519e886..000000000 --- a/src/snyk/common/analytics/itlyErrorPlugin.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ILog } from '../logger/interfaces'; -import { Event, Plugin, Properties, ValidationResponse } from '../../../ampli'; - -export class ItlyErrorPlugin extends Plugin { - constructor(private logger: ILog) { - super('snyk-itly-error-plugin'); - } - - postIdentify( - _userId: string | undefined, - _properties: Properties | undefined, - validationResponses: ValidationResponse[], - ): void { - this.reportError(validationResponses); - } - - postGroup( - _userId: string | undefined, - _groupId: string, - _properties: Properties | undefined, - validationResponses: ValidationResponse[], - ): void { - this.reportError(validationResponses); - } - - postPage( - _userId: string | undefined, - _category: string | undefined, - _name: string | undefined, - _properties: Properties | undefined, - validationResponses: ValidationResponse[], - ): void { - this.reportError(validationResponses); - } - - postTrack(_userId: string | undefined, _event: Event, validationResponses: ValidationResponse[]): void { - this.reportError(validationResponses); - } - - reportError(validationResponses: ValidationResponse[]): void { - const errorMessage = validationResponses - .filter(r => !r.valid) - .map(r => r.message) - .join('\n'); - if (errorMessage) { - // deepcode ignore ExceptionIsNotThrown: - const err = new Error(errorMessage); - this.logger.debug(`Iteratively validation error: ${err}`); - } - } -} diff --git "a/src/snyk/common/api/api\320\241lient.ts" "b/src/snyk/common/api/api\320\241lient.ts" deleted file mode 100644 index d866a5ecd..000000000 --- "a/src/snyk/common/api/api\320\241lient.ts" +++ /dev/null @@ -1,71 +0,0 @@ -import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; -import { IConfiguration } from '../configuration/configuration'; -import { configuration } from '../configuration/instance'; -import { ILog } from '../logger/interfaces'; -import { getAxiosConfig } from '../proxy'; -import { IVSCodeWorkspace } from '../vscode/workspace'; -import { DEFAULT_API_HEADERS } from './headers'; - -export interface ISnykApiClient { - get>(url: string, config?: AxiosRequestConfig): Promise; -} - -export class SnykApiClient implements ISnykApiClient { - private instance: Promise | null = null; - - constructor( - private readonly configuration: IConfiguration, - private readonly workspace: IVSCodeWorkspace, - private readonly logger: ILog, - ) {} - - private get http(): Promise { - return this.instance != null ? this.instance : this.initHttp(); - } - - async initHttp(): Promise { - const axiosRequestConfig: AxiosRequestConfig = { - headers: DEFAULT_API_HEADERS, - responseType: 'json', - ...(await getAxiosConfig(this.workspace, this.configuration, this.logger)), - }; - - const http = axios.create(axiosRequestConfig); - - http.interceptors.response.use( - response => response, - async (error: AxiosError) => { - if (error.response?.status === 401) { - await configuration.clearToken(); - this.logger.warn('Call to Snyk API failed - Invalid token'); - return; - } - this.logger.error(`Call to Snyk API failed: ${error}`); - return Promise.reject(error); - }, - ); - - this.instance = Promise.resolve(http); - return http; - } - - async get>(url: string, config?: AxiosRequestConfig): Promise { - return (await this.http).get(url, await this.getRequestConfigWithAuth(config)); - } - - async post>(url: string, data: unknown, config?: AxiosRequestConfig): Promise { - return (await this.http).post(url, data, await this.getRequestConfigWithAuth(config)); - } - - private async getRequestConfigWithAuth(config?: AxiosRequestConfig) { - const token = await this.configuration.getToken(); - return { - ...config, - baseURL: `${this.configuration.authHost}/api/`, - headers: { - ...config?.headers, - Authorization: `token ${token}`, - } as { [header: string]: string }, - }; - } -} diff --git a/src/snyk/common/commands/commandController.ts b/src/snyk/common/commands/commandController.ts index 630ec0e26..c96b1b6c3 100644 --- a/src/snyk/common/commands/commandController.ts +++ b/src/snyk/common/commands/commandController.ts @@ -3,11 +3,9 @@ import _ from 'lodash'; import { IAuthenticationService } from '../../base/services/authenticationService'; import { ScanModeService } from '../../base/services/scanModeService'; import { createDCIgnore as createDCIgnoreUtil } from '../../snykCode/utils/ignoreFileUtils'; -import { IssueUtils } from '../../snykCode/utils/issueUtils'; import { CodeIssueCommandArg } from '../../snykCode/views/interfaces'; import { IacIssueCommandArg } from '../../snykIac/views/interfaces'; import { OssService } from '../../snykOss/ossService'; -import { IAnalytics } from '../analytics/itly'; import { SNYK_INITIATE_LOGIN_COMMAND, SNYK_LOGIN_COMMAND, @@ -16,7 +14,7 @@ import { SNYK_TRUST_WORKSPACE_FOLDERS_COMMAND, VSCODE_GO_TO_SETTINGS_COMMAND, } from '../constants/commands'; -import { COMMAND_DEBOUNCE_INTERVAL, IDE_NAME, SNYK_NAME_EXTENSION, SNYK_PUBLISHER } from '../constants/general'; +import { COMMAND_DEBOUNCE_INTERVAL, SNYK_NAME_EXTENSION, SNYK_PUBLISHER } from '../constants/general'; import { ErrorHandler } from '../error/errorHandler'; import { ILanguageServer } from '../languageServer/languageServer'; import { CodeIssueData, IacIssueData } from '../languageServer/types'; @@ -45,7 +43,6 @@ export class CommandController { private window: IVSCodeWindow, private languageServer: ILanguageServer, private logger: ILog, - private analytics: IAnalytics, ) {} openBrowser(url: string): unknown { @@ -112,13 +109,6 @@ export class CommandController { } catch (e) { ErrorHandler.handle(e, this.logger); } - - this.analytics.logIssueInTreeIsClicked({ - ide: IDE_NAME, - issueId: decodeURIComponent(issue.id), - issueType: IssueUtils.getIssueType(issue.additionalData.isSecurityType), - severity: IssueUtils.issueSeverityAsText(issue.severity), - }); } else if (arg.issueType == OpenCommandIssueType.OssVulnerability) { const issueArgs = arg.issue as CodeIssueCommandArg; const folderPath = issueArgs.folderPath; @@ -136,13 +126,6 @@ export class CommandController { } catch (e) { ErrorHandler.handle(e, this.logger); } - - this.analytics.logIssueInTreeIsClicked({ - ide: IDE_NAME, - issueId: issue.id, - issueType: 'Open Source Vulnerability', - severity: IssueUtils.issueSeverityAsText(issue.severity), - }); } else if (arg.issueType == OpenCommandIssueType.IacIssue) { const issueArgs = arg.issue as IacIssueCommandArg; const issue = this.iacService.getIssue(issueArgs.folderPath, issueArgs.id); @@ -158,13 +141,6 @@ export class CommandController { } catch (e) { ErrorHandler.handle(e, this.logger); } - - this.analytics.logIssueInTreeIsClicked({ - ide: IDE_NAME, - issueId: issue.id, - issueType: 'Infrastructure as Code Issue', - severity: IssueUtils.issueSeverityAsText(issue.severity), - }); } } diff --git a/src/snyk/common/configuration/configuration.ts b/src/snyk/common/configuration/configuration.ts index 9743139d6..fec4f0e08 100644 --- a/src/snyk/common/configuration/configuration.ts +++ b/src/snyk/common/configuration/configuration.ts @@ -22,7 +22,6 @@ import { TRUSTED_FOLDERS, YES_BACKGROUND_OSS_NOTIFICATION_SETTING, YES_CRASH_REPORT_SETTING, - YES_TELEMETRY_SETTING, YES_WELCOME_NOTIFICATION_SETTING, } from '../constants/settings'; import SecretStorageAdapter from '../vscode/secretStorage'; @@ -80,7 +79,6 @@ export interface IConfiguration { shouldAutoScanOss: boolean; shouldReportErrors: boolean; - shouldReportEvents: boolean; shouldShowWelcomeNotification: boolean; hideWelcomeNotification(): Promise; @@ -107,8 +105,6 @@ export interface IConfiguration { getSnykLanguageServerPath(): string | undefined; - setShouldReportEvents(b: boolean): Promise; - getTrustedFolders(): string[]; setTrustedFolders(trustedFolders: string[]): Promise; @@ -205,8 +201,7 @@ export class Configuration implements IConfiguration { const hostnameParts = endpoint.hostname.split('.'); if (hostnameParts.length < 3) return false; - const isFedrampDomain = `${hostnameParts[2]}.${hostnameParts[3]}`.includes('snykgov.io'); - return isFedrampDomain; + return `${hostnameParts[2]}.${hostnameParts[3]}`.includes('snykgov.io'); } get analyticsPermitted(): boolean { @@ -359,22 +354,6 @@ export class Configuration implements IConfiguration { ); } - get shouldReportEvents(): boolean { - return !!this.workspace.getConfiguration( - CONFIGURATION_IDENTIFIER, - this.getConfigName(YES_TELEMETRY_SETTING), - ); - } - - async setShouldReportEvents(yesTelemetry: boolean): Promise { - await this.workspace.updateConfiguration( - CONFIGURATION_IDENTIFIER, - this.getConfigName(YES_TELEMETRY_SETTING), - yesTelemetry, - true, - ); - } - get shouldShowWelcomeNotification(): boolean { return !!this.workspace.getConfiguration( CONFIGURATION_IDENTIFIER, @@ -494,6 +473,7 @@ export class Configuration implements IConfiguration { true, ); } + private getConfigName = (setting: string) => setting.replace(`${CONFIGURATION_IDENTIFIER}.`, ''); private static isSingleTenant(url: URL): boolean { diff --git a/src/snyk/common/constants/settings.ts b/src/snyk/common/constants/settings.ts index 4e831c765..ab1440629 100644 --- a/src/snyk/common/constants/settings.ts +++ b/src/snyk/common/constants/settings.ts @@ -9,7 +9,6 @@ export const IAC_ENABLED_SETTING = `${CONFIGURATION_IDENTIFIER}.features.infrast export const FEATURES_PREVIEW_SETTING = `${CONFIGURATION_IDENTIFIER}.features.preview`; export const YES_CRASH_REPORT_SETTING = `${CONFIGURATION_IDENTIFIER}.yesCrashReport`; -export const YES_TELEMETRY_SETTING = `${CONFIGURATION_IDENTIFIER}.yesTelemetry`; export const YES_WELCOME_NOTIFICATION_SETTING = `${CONFIGURATION_IDENTIFIER}.yesWelcomeNotification`; export const YES_BACKGROUND_OSS_NOTIFICATION_SETTING = `${CONFIGURATION_IDENTIFIER}.yesBackgroundOssNotification`; diff --git a/src/snyk/common/editor/codeActionsProvider.ts b/src/snyk/common/editor/codeActionsProvider.ts index 8181c39b3..714423520 100644 --- a/src/snyk/common/editor/codeActionsProvider.ts +++ b/src/snyk/common/editor/codeActionsProvider.ts @@ -1,15 +1,6 @@ -import { IAnalytics, SupportedQuickFixProperties } from '../../common/analytics/itly'; -import { IDE_NAME } from '../../common/constants/general'; -import { Issue } from '../../common/languageServer/types'; -import { ICodeActionKindAdapter } from '../../common/vscode/codeAction'; -import { - CodeAction, - CodeActionContext, - CodeActionKind, - CodeActionProvider, - Range, - TextDocument, -} from '../../common/vscode/types'; +import { Issue } from '../languageServer/types'; +import { ICodeActionKindAdapter } from '../vscode/codeAction'; +import { CodeAction, CodeActionContext, CodeActionProvider, Range, TextDocument } from '../vscode/types'; import { ProductResult } from '../services/productService'; export abstract class CodeActionsProvider implements CodeActionProvider { @@ -18,20 +9,12 @@ export abstract class CodeActionsProvider implements CodeActionProvider { constructor( protected readonly issues: ProductResult, private readonly codeActionKindAdapter: ICodeActionKindAdapter, - protected readonly analytics: IAnalytics, ) {} abstract getActions(folderPath: string, document: TextDocument, issue: Issue, issueRange?: Range): CodeAction[]; - abstract getAnalyticsActionTypes(): [string, ...string[]] & - [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]]; - abstract getIssueRange(issue: Issue): Range; - getProvidedCodeActionKinds(): CodeActionKind[] { - return this.providedCodeActionKinds; - } - public provideCodeActions( document: TextDocument, clickedRange: Range, @@ -53,16 +36,8 @@ export abstract class CodeActionsProvider implements CodeActionProvider { continue; } - const codeActions = this.getActions(folderPath, document, issue, range); - const analyticsType = this.getAnalyticsActionTypes(); - - this.analytics.logQuickFixIsDisplayed({ - quickFixType: analyticsType, - ide: IDE_NAME, - }); - // returns list of actions, all new actions should be added to this list - return codeActions; + return this.getActions(folderPath, document, issue, range); } return undefined; diff --git a/src/snyk/common/experiment/services/experimentService.ts b/src/snyk/common/experiment/services/experimentService.ts index 0edceb5e4..1cde157aa 100644 --- a/src/snyk/common/experiment/services/experimentService.ts +++ b/src/snyk/common/experiment/services/experimentService.ts @@ -42,11 +42,7 @@ export class ExperimentService { const variants = await this.fetchVariants(forceFetchVariants); const variant = variants[variantFlag]; - if (variant?.value === 'on') { - return true; - } - - return false; + return variant?.value === 'on'; } private async fetchVariants(forceFetchVariants: boolean): Promise { @@ -67,5 +63,5 @@ export class ExperimentService { return this.variants; } - private canExperiment = this.configuration.shouldReportEvents; + private canExperiment = true; } diff --git a/src/snyk/common/languageServer/settings.ts b/src/snyk/common/languageServer/settings.ts index af55f094c..50b34e04e 100644 --- a/src/snyk/common/languageServer/settings.ts +++ b/src/snyk/common/languageServer/settings.ts @@ -24,7 +24,6 @@ export type ServerSettings = { // Reporting and telemetry sendErrorReports?: string; - enableTelemetry?: string; // Security and scanning settings filterSeverity?: SeverityFilter; @@ -73,7 +72,6 @@ export class LanguageServerSettings { activateSnykCodeQuality: `${codeQualityEnabled}`, activateSnykOpenSource: `${ossEnabled}`, activateSnykIac: `${iacEnabled}`, - enableTelemetry: `${configuration.shouldReportEvents}`, sendErrorReports: `${configuration.shouldReportErrors}`, cliPath: configuration.getCliPath(), endpoint: configuration.snykOssApiEndpoint, diff --git a/src/snyk/common/services/notificationService.ts b/src/snyk/common/services/notificationService.ts index 4eed79d39..d8be2d8f7 100644 --- a/src/snyk/common/services/notificationService.ts +++ b/src/snyk/common/services/notificationService.ts @@ -1,5 +1,4 @@ import { snykMessages } from '../../base/messages/snykMessages'; -import { IAnalytics } from '../analytics/itly'; import { IConfiguration } from '../configuration/configuration'; import { VSCODE_VIEW_CONTAINER_COMMAND } from '../constants/commands'; import { ErrorHandler } from '../error/errorHandler'; @@ -18,7 +17,6 @@ export class NotificationService implements INotificationService { private readonly window: IVSCodeWindow, private readonly commands: IVSCodeCommands, private readonly configuration: IConfiguration, - private readonly analytics: IAnalytics, private readonly logger: ILog, ) {} @@ -40,7 +38,6 @@ export class NotificationService implements INotificationService { if (pressedButton === snykMessages.welcome.button) { await this.commands.executeCommand(VSCODE_VIEW_CONTAINER_COMMAND); - this.analytics.logWelcomeButtonIsClicked(); } await this.configuration.hideWelcomeNotification(); diff --git a/src/snyk/common/user.ts b/src/snyk/common/user.ts index e6b49a5c8..cd991e271 100644 --- a/src/snyk/common/user.ts +++ b/src/snyk/common/user.ts @@ -1,6 +1,5 @@ import * as crypto from 'crypto'; import { v4 as uuidv4 } from 'uuid'; -import { IAnalytics } from './analytics/itly'; import { SNYK_GET_ACTIVE_USER } from './constants/commands'; import { MEMENTO_ANONYMOUS_ID } from './constants/globalState'; import { ErrorReporter } from './error/errorReporter'; @@ -15,7 +14,7 @@ export type UserDto = { export class User { private _authenticatedId?: string; - private logger?: ILog; + private readonly logger?: ILog; readonly anonymousId: string; @@ -47,12 +46,10 @@ export class User { return crypto.createHash('sha256').update(this._authenticatedId).digest('hex'); } - async identify(commandExecutor: IVSCodeCommands, analytics: IAnalytics): Promise { + async identify(commandExecutor: IVSCodeCommands): Promise { const user = await this.userMe(commandExecutor); if (user && user.id) { this._authenticatedId = user.id; - - await analytics.identify(this._authenticatedId); // map the anonymousId onto authenticatedId ErrorReporter.identify(this); } } diff --git a/src/snyk/common/watchers/configurationWatcher.ts b/src/snyk/common/watchers/configurationWatcher.ts index 260b8e6f0..265611129 100644 --- a/src/snyk/common/watchers/configurationWatcher.ts +++ b/src/snyk/common/watchers/configurationWatcher.ts @@ -1,7 +1,6 @@ import * as _ from 'lodash'; import * as vscode from 'vscode'; import { IExtension } from '../../base/modules/interfaces'; -import { IAnalytics } from '../analytics/itly'; import { configuration } from '../configuration/instance'; import { DEFAULT_LS_DEBOUNCE_INTERVAL, SNYK_TOKEN_KEY } from '../constants/general'; import { @@ -15,7 +14,6 @@ import { OSS_ENABLED_SETTING, SEVERITY_FILTER_SETTING, TRUSTED_FOLDERS, - YES_TELEMETRY_SETTING, } from '../constants/settings'; import { ErrorHandler } from '../error/errorHandler'; import { ILog } from '../logger/interfaces'; @@ -24,13 +22,11 @@ import SecretStorageAdapter from '../vscode/secretStorage'; import { IWatcher } from './interfaces'; class ConfigurationWatcher implements IWatcher { - constructor(private readonly analytics: IAnalytics, private readonly logger: ILog) {} + constructor(private readonly logger: ILog) {} private async onChangeConfiguration(extension: IExtension, key: string): Promise { if (key === ADVANCED_ADVANCED_MODE_SETTING) { return extension.checkAdvancedMode(); - } else if (key === YES_TELEMETRY_SETTING) { - this.analytics.load(); } else if (key === OSS_ENABLED_SETTING) { extension.viewManagerService.refreshOssView(); } else if (key === CODE_SECURITY_ENABLED_SETTING || key === CODE_QUALITY_ENABLED_SETTING) { @@ -67,7 +63,6 @@ class ConfigurationWatcher implements IWatcher { const change = [ ADVANCED_ADVANCED_MODE_SETTING, ADVANCED_AUTOSCAN_OSS_SETTING, - YES_TELEMETRY_SETTING, OSS_ENABLED_SETTING, CODE_SECURITY_ENABLED_SETTING, CODE_QUALITY_ENABLED_SETTING, diff --git a/src/snyk/extension.ts b/src/snyk/extension.ts index 925dfdfd2..99a102d4c 100644 --- a/src/snyk/extension.ts +++ b/src/snyk/extension.ts @@ -1,6 +1,4 @@ import * as vscode from 'vscode'; -import AdvisorProvider from './advisor/services/advisorProvider'; -import { AdvisorService } from './advisor/services/advisorService'; import { IExtension } from './base/modules/interfaces'; import SnykLib from './base/modules/snykLib'; import { AuthenticationService } from './base/services/authenticationService'; @@ -8,7 +6,6 @@ import { ScanModeService } from './base/services/scanModeService'; import { EmptyTreeDataProvider } from './base/views/emptyTreeDataProvider'; import { SupportProvider } from './base/views/supportProvider'; import { messages } from './cli/messages/messages'; -import { Iteratively } from './common/analytics/itly'; import { CommandController } from './common/commands/commandController'; import { OpenIssueCommandArg } from './common/commands/types'; import { configuration } from './common/configuration/instance'; @@ -21,14 +18,13 @@ import { SNYK_OPEN_BROWSER_COMMAND, SNYK_OPEN_ISSUE_COMMAND, SNYK_OPEN_LOCAL_COMMAND, - SNYK_SETTINGS_COMMAND, SNYK_SET_TOKEN_COMMAND, + SNYK_SETTINGS_COMMAND, SNYK_SHOW_LS_OUTPUT_COMMAND, SNYK_SHOW_OUTPUT_COMMAND, SNYK_START_COMMAND, SNYK_WORKSPACE_SCAN_COMMAND, } from './common/constants/commands'; -import { MEMENTO_FIRST_INSTALL_DATE_KEY } from './common/constants/globalState'; import { SNYK_CONTEXT, SNYK_VIEW_ANALYSIS_CODE_ENABLEMENT, @@ -53,7 +49,6 @@ import { CodeActionAdapter } from './common/vscode/codeAction'; import { vsCodeCommands } from './common/vscode/commands'; import { vsCodeEnv } from './common/vscode/env'; import { extensionContext } from './common/vscode/extensionContext'; -import { HoverAdapter } from './common/vscode/hover'; import { LanguageClientAdapter } from './common/vscode/languageClient'; import { vsCodeLanguages } from './common/vscode/languages'; import SecretStorageAdapter from './common/vscode/secretStorage'; @@ -121,18 +116,10 @@ class SnykExtension extends SnykLib implements IExtension { this.user = await User.getAnonymous(this.context, Logger); - this.analytics = new Iteratively(this.user, Logger, configuration, snykConfiguration); - SecretStorageAdapter.init(vscodeContext); - this.configurationWatcher = new ConfigurationWatcher(this.analytics, Logger); - this.notificationService = new NotificationService( - vsCodeWindow, - vsCodeCommands, - configuration, - this.analytics, - Logger, - ); + this.configurationWatcher = new ConfigurationWatcher(Logger); + this.notificationService = new NotificationService(vsCodeWindow, vsCodeCommands, configuration, Logger); this.statusBarItem.show(); @@ -142,7 +129,6 @@ class SnykExtension extends SnykLib implements IExtension { this, configuration, vsCodeWindow, - this.analytics, Logger, languageClientAdapter, vsCodeCommands, @@ -152,9 +138,8 @@ class SnykExtension extends SnykLib implements IExtension { this.codeSettings = new CodeSettings(this.contextService, configuration, this.openerService, vsCodeCommands); - this.scanModeService = new ScanModeService(this.contextService, configuration, this.analytics); + this.scanModeService = new ScanModeService(this.contextService, configuration); - this.advisorService = new AdvisorProvider(this.advisorApiClient, Logger); this.downloadService = new DownloadService( this.context, configuration, @@ -197,7 +182,6 @@ class SnykExtension extends SnykLib implements IExtension { this.languageServer, vsCodeLanguages, Logger, - this.analytics, ); const ossSuggestionProvider = new OssDetailPanelProvider( @@ -220,7 +204,6 @@ class SnykExtension extends SnykLib implements IExtension { this.languageServer, vsCodeLanguages, Logger, - this.analytics, ); const iacSuggestionProvider = new IacSuggestionWebviewProvider( @@ -243,7 +226,6 @@ class SnykExtension extends SnykLib implements IExtension { this.languageServer, vsCodeLanguages, Logger, - this.analytics, ); this.commandController = new CommandController( @@ -258,7 +240,6 @@ class SnykExtension extends SnykLib implements IExtension { vsCodeWindow, this.languageServer, Logger, - this.analytics, ); this.registerCommands(vscodeContext); @@ -301,10 +282,7 @@ class SnykExtension extends SnykLib implements IExtension { treeDataProvider: new EmptyTreeDataProvider(), }); - vscodeContext.subscriptions.push( - welcomeTree.onDidChangeVisibility(e => this.onDidChangeWelcomeViewVisibility(e.visible)), - codeEnablementTree, - ); + vscodeContext.subscriptions.push(codeEnablementTree); const ossIssueProvider = new OssIssueTreeProvider( this.viewManagerService, @@ -363,11 +341,8 @@ class SnykExtension extends SnykLib implements IExtension { this.checkAdvancedMode().catch(err => ErrorReporter.capture(err)); - this.analytics.load(); this.experimentService.load(); - this.logPluginIsInstalled(); - this.initDependencyDownload(); this.ossVulnerabilityCountService = new OssVulnerabilityCountService( @@ -383,27 +358,10 @@ class SnykExtension extends SnykLib implements IExtension { this.ossService, Logger, new EditorDecorator(vsCodeWindow, vsCodeLanguages, new ThemeColorAdapter()), - this.analytics, configuration, ); this.ossVulnerabilityCountService.activate(); - this.advisorScoreDisposable = new AdvisorService( - vsCodeWindow, - vsCodeLanguages, - this.advisorService, - Logger, - vsCodeWorkspace, - this.advisorApiClient, - new ThemeColorAdapter(), - new HoverAdapter(), - this.markdownStringAdapter, - configuration, - ); - - // noinspection ES6MissingAwait - void this.advisorScoreDisposable.activate(); - // Wait for LS startup to finish before updating the codeEnabled context // The codeEnabled context depends on an LS command await this.languageServer.start(); @@ -418,7 +376,6 @@ class SnykExtension extends SnykLib implements IExtension { public async deactivate(): Promise { this.ossVulnerabilityCountService.dispose(); await this.languageServer.stop(); - await this.analytics.flush(); await ErrorReporter.flush(); } @@ -427,15 +384,6 @@ class SnykExtension extends SnykLib implements IExtension { await this.languageServer.start(); } - private logPluginIsInstalled(): void { - // Use memento until lifecycle hooks are implemented - // https://github.com/microsoft/vscode/issues/98732 - if (!this.context.getGlobalStateValue(MEMENTO_FIRST_INSTALL_DATE_KEY)) { - this.analytics.logPluginIsInstalled(); - void this.context.updateGlobalStateValue(MEMENTO_FIRST_INSTALL_DATE_KEY, Date.now()); - } - } - private initDependencyDownload(): DownloadService { this.downloadService.downloadOrUpdate().catch(err => { Logger.error(`${messages.lsDownloadFailed} ${ErrorHandler.stringifyError(err)}`); diff --git a/src/snyk/snykCode/codeActions/codeIssuesActionsProvider.ts b/src/snyk/snykCode/codeActions/codeIssuesActionsProvider.ts index 7a6c52d93..229c24b5f 100644 --- a/src/snyk/snykCode/codeActions/codeIssuesActionsProvider.ts +++ b/src/snyk/snykCode/codeActions/codeIssuesActionsProvider.ts @@ -1,5 +1,4 @@ import { CodeAction, Range, TextDocument } from 'vscode'; -import { IAnalytics, SupportedQuickFixProperties } from '../../common/analytics/itly'; import { OpenCommandIssueType, OpenIssueCommandArg } from '../../common/commands/types'; import { SNYK_IGNORE_ISSUE_COMMAND, SNYK_OPEN_ISSUE_COMMAND } from '../../common/constants/commands'; import { CodeActionsProvider } from '../../common/editor/codeActionsProvider'; @@ -18,9 +17,8 @@ export class SnykCodeActionsProvider extends CodeActionsProvider private readonly codeActionAdapter: ICodeActionAdapter, codeActionKindAdapter: ICodeActionKindAdapter, private readonly languages: IVSCodeLanguages, - analytics: IAnalytics, ) { - super(issues, codeActionKindAdapter, analytics); + super(issues, codeActionKindAdapter); } getActions(folderPath: string, document: TextDocument, issue: Issue, range: Range): CodeAction[] { @@ -32,10 +30,6 @@ export class SnykCodeActionsProvider extends CodeActionsProvider return [openIssueAction, ignoreIssueAction, fileIgnoreIssueAction]; } - getAnalyticsActionTypes(): [string, ...string[]] & [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]] { - return ['Show Suggestion', 'Ignore Suggestion In Line', 'Ignore Suggestion In File']; - } - getIssueRange(issue: Issue): Range { return IssueUtils.createVsCodeRange(issue.additionalData, this.languages); } diff --git a/src/snyk/snykCode/codeService.ts b/src/snyk/snykCode/codeService.ts index ec4174f44..946a2fdb9 100644 --- a/src/snyk/snykCode/codeService.ts +++ b/src/snyk/snykCode/codeService.ts @@ -1,5 +1,4 @@ import { Subscription } from 'rxjs'; -import { IAnalytics } from '../common/analytics/itly'; import { IConfiguration } from '../common/configuration/configuration'; import { IWorkspaceTrust } from '../common/configuration/trustedFolders'; import { ILanguageServer } from '../common/languageServer/languageServer'; @@ -27,7 +26,6 @@ export class SnykCodeService extends ProductService { languageServer: ILanguageServer, languages: IVSCodeLanguages, logger: ILog, - readonly analytics: IAnalytics, ) { super( extensionContext, @@ -42,7 +40,7 @@ export class SnykCodeService extends ProductService { ); this.registerCodeActionsProvider( - new SnykCodeActionsProvider(this.result, codeActionAdapter, codeActionKindAdapter, languages, analytics), + new SnykCodeActionsProvider(this.result, codeActionAdapter, codeActionKindAdapter, languages), ); } diff --git a/src/snyk/snykCode/hoverProvider/hoverProvider.ts b/src/snyk/snykCode/hoverProvider/hoverProvider.ts index cafb460e9..401252bc9 100644 --- a/src/snyk/snykCode/hoverProvider/hoverProvider.ts +++ b/src/snyk/snykCode/hoverProvider/hoverProvider.ts @@ -1,10 +1,8 @@ -import { IAnalytics } from '../../common/analytics/itly'; -import { IDE_NAME } from '../../common/constants/general'; import { ILog } from '../../common/logger/interfaces'; import { IHoverAdapter } from '../../common/vscode/hover'; import { IVSCodeLanguages } from '../../common/vscode/languages'; import { IMarkdownStringAdapter } from '../../common/vscode/markdownString'; -import { Diagnostic, DiagnosticCollection, Disposable, Hover, Position, TextDocument } from '../../common/vscode/types'; +import { DiagnosticCollection, Disposable, Hover, Position, TextDocument } from '../../common/vscode/types'; import { IGNORE_TIP_FOR_USER } from '../constants/analysis'; import { ISnykCodeAnalyzer } from '../interfaces'; import { IssueUtils } from '../utils/issueUtils'; @@ -16,7 +14,6 @@ export class DisposableHoverProvider implements Disposable { private readonly analyzer: ISnykCodeAnalyzer, private readonly logger: ILog, private readonly vscodeLanguages: IVSCodeLanguages, - private readonly analytics: IAnalytics, private readonly markdownStringAdapter: IMarkdownStringAdapter, ) {} @@ -38,28 +35,12 @@ export class DisposableHoverProvider implements Disposable { const currentFileReviewIssues = snykReview.get(document.uri); const issue = IssueUtils.findIssueWithRange(position, currentFileReviewIssues); if (issue) { - this.logIssueHoverIsDisplayed(issue); const ignoreMarkdown = this.markdownStringAdapter.get(IGNORE_TIP_FOR_USER); return hoverAdapter.create(ignoreMarkdown); } }; } - private logIssueHoverIsDisplayed(issue: Diagnostic): void { - const suggestion = this.analyzer.findSuggestion(issue); - if (!suggestion) { - this.logger.debug('Failed to log hover displayed analytical event.'); - return; - } - - this.analytics.logIssueHoverIsDisplayed({ - issueId: suggestion.id, - issueType: IssueUtils.getIssueType(suggestion.isSecurityType), - severity: IssueUtils.severityAsText(suggestion.severity), - ide: IDE_NAME, - }); - } - dispose(): void { if (this.hoverProvider) { this.hoverProvider.dispose(); diff --git a/src/snyk/snykIac/codeActions/iacCodeActionsProvider.ts b/src/snyk/snykIac/codeActions/iacCodeActionsProvider.ts index ea3bfda5b..a3d731e13 100644 --- a/src/snyk/snykIac/codeActions/iacCodeActionsProvider.ts +++ b/src/snyk/snykIac/codeActions/iacCodeActionsProvider.ts @@ -1,5 +1,4 @@ import { CodeAction, Range, TextDocument } from 'vscode'; -import { IAnalytics, SupportedQuickFixProperties } from '../../common/analytics/itly'; import { OpenCommandIssueType, OpenIssueCommandArg } from '../../common/commands/types'; import { SNYK_OPEN_ISSUE_COMMAND } from '../../common/constants/commands'; import { CodeActionsProvider } from '../../common/editor/codeActionsProvider'; @@ -17,9 +16,8 @@ export class IacCodeActionsProvider extends CodeActionsProvider { private readonly codeActionAdapter: ICodeActionAdapter, codeActionKindAdapter: ICodeActionKindAdapter, private readonly languages: IVSCodeLanguages, - analytics: IAnalytics, ) { - super(issues, codeActionKindAdapter, analytics); + super(issues, codeActionKindAdapter); } getActions(folderPath: string, _: TextDocument, issue: Issue, range: Range): CodeAction[] { @@ -29,10 +27,6 @@ export class IacCodeActionsProvider extends CodeActionsProvider { return [openIssueAction]; } - getAnalyticsActionTypes(): [string, ...string[]] & [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]] { - return ['Show Suggestion']; - } - getIssueRange(issue: Issue): Range { return IacIssue.getRange(issue, this.languages); } diff --git a/src/snyk/snykIac/iacService.ts b/src/snyk/snykIac/iacService.ts index 9c640c59c..137a07755 100644 --- a/src/snyk/snykIac/iacService.ts +++ b/src/snyk/snykIac/iacService.ts @@ -1,5 +1,4 @@ import { Subscription } from 'rxjs'; -import { IAnalytics } from '../common/analytics/itly'; import { IConfiguration } from '../common/configuration/configuration'; import { IWorkspaceTrust } from '../common/configuration/trustedFolders'; import { ILanguageServer } from '../common/languageServer/languageServer'; @@ -27,7 +26,6 @@ export class IacService extends ProductService { languageServer: ILanguageServer, languages: IVSCodeLanguages, logger: ILog, - readonly analytics: IAnalytics, ) { super( extensionContext, @@ -42,7 +40,7 @@ export class IacService extends ProductService { ); this.registerCodeActionsProvider( - new IacCodeActionsProvider(this.result, codeActionAdapter, codeActionKindAdapter, languages, analytics), + new IacCodeActionsProvider(this.result, codeActionAdapter, codeActionKindAdapter, languages), ); } diff --git a/src/snyk/snykOss/ossService.ts b/src/snyk/snykOss/ossService.ts index b0394567f..c88b20cc0 100644 --- a/src/snyk/snykOss/ossService.ts +++ b/src/snyk/snykOss/ossService.ts @@ -1,5 +1,4 @@ import { Subscription } from 'rxjs'; -import { IAnalytics } from '../common/analytics/itly'; import { IConfiguration } from '../common/configuration/configuration'; import { IWorkspaceTrust } from '../common/configuration/trustedFolders'; import { ILanguageServer } from '../common/languageServer/languageServer'; @@ -27,7 +26,6 @@ export class OssService extends ProductService { languageServer: ILanguageServer, languages: IVSCodeLanguages, logger: ILog, - readonly analytics: IAnalytics, ) { super( extensionContext, @@ -42,7 +40,7 @@ export class OssService extends ProductService { ); this.registerCodeActionsProvider( - new OssCodeActionsProvider(languages, codeActionAdapter, codeActionKindAdapter, this.result, analytics), + new OssCodeActionsProvider(languages, codeActionAdapter, codeActionKindAdapter, this.result), ); } diff --git a/src/snyk/snykOss/providers/ossCodeActionsProvider.ts b/src/snyk/snykOss/providers/ossCodeActionsProvider.ts index 7c0141db2..6201425f2 100644 --- a/src/snyk/snykOss/providers/ossCodeActionsProvider.ts +++ b/src/snyk/snykOss/providers/ossCodeActionsProvider.ts @@ -1,8 +1,6 @@ import { CodeAction, Range, TextDocument, Uri } from 'vscode'; -import { IAnalytics, SupportedQuickFixProperties } from '../../common/analytics/itly'; import { OpenCommandIssueType, OpenIssueCommandArg } from '../../common/commands/types'; import { SNYK_OPEN_ISSUE_COMMAND } from '../../common/constants/commands'; -import { IDE_NAME } from '../../common/constants/general'; import { CodeActionsProvider } from '../../common/editor/codeActionsProvider'; import { Issue, IssueSeverity, OssIssueData } from '../../common/languageServer/types'; import { ProductResult } from '../../common/services/productService'; @@ -18,9 +16,8 @@ export class OssCodeActionsProvider extends CodeActionsProvider { private readonly codeActionAdapter: ICodeActionAdapter, codeActionKindAdapter: ICodeActionKindAdapter, issues: Readonly>, - analytics: IAnalytics, ) { - super(issues, codeActionKindAdapter, analytics); + super(issues, codeActionKindAdapter); } override provideCodeActions( @@ -44,20 +41,7 @@ export class OssCodeActionsProvider extends CodeActionsProvider { return; } - const codeActions = this.getActions( - folderPath, - document, - mostSevereVulnerability, - this.getIssueRange(mostSevereVulnerability), - ); - const analyticsType = this.getAnalyticsActionTypes(); - - this.analytics.logQuickFixIsDisplayed({ - quickFixType: analyticsType, - ide: IDE_NAME, - }); - - return codeActions; + return this.getActions(folderPath, document, mostSevereVulnerability, this.getIssueRange(mostSevereVulnerability)); } getActions( @@ -72,10 +56,6 @@ export class OssCodeActionsProvider extends CodeActionsProvider { return [openIssueAction]; } - getAnalyticsActionTypes(): [string, ...string[]] & [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]] { - return ['Show Suggestion']; - } - // noop getIssueRange(_issue: Issue): Range { return this.languages.createRange(0, 0, 0, 0); diff --git a/src/snyk/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.ts b/src/snyk/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.ts index 844c0339a..8f1311f2f 100644 --- a/src/snyk/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.ts +++ b/src/snyk/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.ts @@ -1,5 +1,4 @@ import { Subscription } from 'rxjs'; -import { IAnalytics } from '../../../common/analytics/itly'; import { IConfiguration } from '../../../common/configuration/configuration'; import { ILog } from '../../../common/logger/interfaces'; import { getSupportedLanguage, isValidModuleName } from '../../../common/parsing'; @@ -45,7 +44,6 @@ export class OssVulnerabilityCountService implements Disposable { private readonly ossService: OssService, private readonly logger: ILog, private readonly editorDecorator: EditorDecorator, - private readonly analytics: IAnalytics, private readonly configuration: IConfiguration, ) {} activate(): boolean { diff --git a/src/test/integration/analytics.test.ts b/src/test/integration/analytics.test.ts deleted file mode 100644 index 8edadf5bf..000000000 --- a/src/test/integration/analytics.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { strictEqual } from 'assert'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import itly from '../../ampli'; -import { configuration } from '../../snyk/common/configuration/instance'; -import { VSCODE_VIEW_CONTAINER_COMMAND } from '../../snyk/common/constants/commands'; - -suite('Analytics', () => { - let welcomeIsViewed: sinon.SinonSpy; - - setup(async () => { - await configuration.clearToken(); - await configuration.setShouldReportEvents(true); - - welcomeIsViewed = sinon.spy(itly, 'welcomeIsViewed'); - }); - - teardown(() => { - welcomeIsViewed.restore(); - }); - - test('"Welcome Is Viewed" is tracked if telemetry is on', async () => { - await vscode.commands.executeCommand(VSCODE_VIEW_CONTAINER_COMMAND); - - strictEqual(welcomeIsViewed.called, true); - strictEqual(welcomeIsViewed.calledOnce, true); - }); - - test('"Welcome Is Viewed" not tracked if telemetry is off', async () => { - await configuration.setShouldReportEvents(false); - - await vscode.commands.executeCommand('workbench.action.toggleSidebarVisibility'); - await vscode.commands.executeCommand(VSCODE_VIEW_CONTAINER_COMMAND); - - strictEqual(welcomeIsViewed.notCalled, true); - }); - - test('"Welcome Is Viewed" not tracked if using fedramp endpoint', async () => { - await configuration.setEndpoint('https://api.feddramp.snykgov.io'); - await vscode.commands.executeCommand('workbench.action.toggleSidebarVisibility'); - await vscode.commands.executeCommand(VSCODE_VIEW_CONTAINER_COMMAND); - - strictEqual(welcomeIsViewed.notCalled, true); - }); -}); diff --git a/src/test/integration/configuration.test.ts b/src/test/integration/configuration.test.ts index 1e6f92607..8d82dd17e 100644 --- a/src/test/integration/configuration.test.ts +++ b/src/test/integration/configuration.test.ts @@ -23,11 +23,9 @@ suite('Configuration', () => { await configuration.setToken(token); await configuration.setFeaturesConfiguration(featuresConfig); - await configuration.setShouldReportEvents(false); strictEqual(await configuration.getToken(), token); deepStrictEqual(configuration.getFeaturesConfiguration(), featuresConfig); - strictEqual(configuration.shouldReportEvents, false); await configuration.setToken(''); }); }); diff --git a/src/test/unit/base/services/authenticationService.test.ts b/src/test/unit/base/services/authenticationService.test.ts index 51bd29a84..2fecf94b7 100644 --- a/src/test/unit/base/services/authenticationService.test.ts +++ b/src/test/unit/base/services/authenticationService.test.ts @@ -5,7 +5,6 @@ import sinon from 'sinon'; import { IBaseSnykModule } from '../../../../snyk/base/modules/interfaces'; import { AuthenticationService, OAuthToken } from '../../../../snyk/base/services/authenticationService'; import { ILoadingBadge } from '../../../../snyk/base/views/loadingBadge'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; import { IConfiguration } from '../../../../snyk/common/configuration/configuration'; import { DID_CHANGE_CONFIGURATION_METHOD } from '../../../../snyk/common/constants/languageServer'; import { SNYK_CONTEXT } from '../../../../snyk/common/constants/views'; @@ -68,27 +67,6 @@ suite('AuthenticationService', () => { teardown(() => sinon.restore()); - test("Logs 'Authentication Button is Clicked' analytical event", async () => { - const logAuthenticateButtonIsClickedFake = sinon.fake(); - const analytics = { - logAuthenticateButtonIsClicked: logAuthenticateButtonIsClickedFake, - } as unknown as IAnalytics; - const service = new AuthenticationService( - contextService, - baseModule, - config, - windowMock, - analytics, - new LoggerMock(), - languageClientAdapter, - {} as IVSCodeCommands, - ); - - await service.initiateLogin(); - - strictEqual(logAuthenticateButtonIsClickedFake.calledOnce, true); - }); - // TODO: the following two tests are more of integration tests, since the second requires access to the network layer. Move it to integration test as part of ROAD-625. test('getIpFamily returns undefined when IPv6 not supported', async () => { const ipv6ErrorCode = 'EADDRNOTAVAIL'; @@ -141,7 +119,6 @@ suite('AuthenticationService', () => { baseModule, config, windowMock, - {} as IAnalytics, new LoggerMock(), languageClientAdapter, {} as IVSCodeCommands, @@ -160,7 +137,6 @@ suite('AuthenticationService', () => { baseModule, config, windowMock, - {} as IAnalytics, new LoggerMock(), languageClientAdapter, {} as IVSCodeCommands, @@ -190,7 +166,6 @@ suite('AuthenticationService', () => { baseModule, config, windowMock, - {} as IAnalytics, new LoggerMock(), languageClientAdapter, { diff --git a/src/test/unit/cli/process.test.ts b/src/test/unit/cli/process.test.ts index ec8104cfb..31a260e05 100644 --- a/src/test/unit/cli/process.test.ts +++ b/src/test/unit/cli/process.test.ts @@ -19,35 +19,6 @@ suite('CliProcess', () => { logger = new LoggerMock(); }); - test('Sets DISABLE_ANALYTICS when telemetry is off ', async () => { - const process = new CliProcess( - logger, - { - shouldReportEvents: false, - getToken: () => Promise.resolve(), - snykOssApiEndpoint: snykOssApiEndpoint, - } as IConfiguration, - emptyWorkspace, - ); - const vars = await process.getProcessEnv(); - strictEqual(Object.keys(vars).includes('SNYK_CFG_DISABLE_ANALYTICS'), true); - }); - - test("Doesn't set DISABLE_ANALYTICS when telemetry is on ", async () => { - const process = new CliProcess( - logger, - { - shouldReportEvents: true, - getToken: () => Promise.resolve(), - snykOssApiEndpoint: snykOssApiEndpoint, - } as IConfiguration, - emptyWorkspace, - ); - const vars = await process.getProcessEnv(); - - strictEqual(Object.keys(vars).includes('SNYK_CFG_DISABLE_ANALYTICS'), false); - }); - test('Sets correct integration name, version, token, API endpoint and organization', async () => { const token = 'fake-token'; const snykOssApiEndpoint = 'https://snyk.io/api/'; @@ -102,7 +73,6 @@ suite('CliProcess', () => { const process = new CliProcess( logger, { - shouldReportEvents: true, getToken: () => Promise.resolve(), snykOssApiEndpoint: snykOssApiEndpoint, } as IConfiguration, diff --git a/src/test/unit/common/analytics/itly.test.ts b/src/test/unit/common/analytics/itly.test.ts deleted file mode 100644 index 046db489b..000000000 --- a/src/test/unit/common/analytics/itly.test.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { strictEqual } from 'assert'; -import * as sinon from 'sinon'; -import itly from '../../../../ampli'; -import { Iteratively } from '../../../../snyk/common/analytics/itly'; -import { IConfiguration } from '../../../../snyk/common/configuration/configuration'; -import { SnykConfiguration } from '../../../../snyk/common/configuration/snykConfiguration'; -import { User } from '../../../../snyk/common/user'; -import { LoggerMock } from '../../mocks/logger.mock'; - -suite('Iteratively', () => { - const config = { - shouldReportEvents: false, - analyticsPermitted: false, - isDevelopment: false, - } as IConfiguration; - const snykConfig = { - segmentWriteKey: 'test', - } as SnykConfiguration; - - suite('.load()', () => { - suite('when analytics are permitted', () => { - test('Returns "null" when shouldReportEvents == false', () => { - const iteratively = new Iteratively(new User(), new LoggerMock(), config, snykConfig); - - const result = iteratively.load(); - - strictEqual(result, null); - }); - - test('Returns "Iteratively" when shouldReportEvents == true', () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: true, - }, - snykConfig, - ); - - const result = iteratively.load(); - - strictEqual(result instanceof Iteratively, true); - }); - }); - }); - - suite('.enqueueEvent', () => { - test('Enqueues event if shouldReportEvents === true and analyticsPermitted === true', () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: true, - analyticsPermitted: true, - }, - snykConfig, - ); - iteratively.load(); - - let eventFunctionWasCalled = false; - iteratively.enqueueEvent(() => { - eventFunctionWasCalled = true; - }, false); - strictEqual(eventFunctionWasCalled, true); - }); - - test('Does not enqueue event if shouldReportEvents === false and analyticsPermitted === true', () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: false, - analyticsPermitted: true, - }, - snykConfig, - ); - iteratively.load(); - - let eventFunctionWasCalled = false; - iteratively.enqueueEvent(() => { - eventFunctionWasCalled = true; - }, false); - strictEqual(eventFunctionWasCalled, false); - }); - - test('Does not enqueue event if shouldReportEvents === true and analyticsPermitted === false', () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: true, - analyticsPermitted: false, - }, - snykConfig, - ); - iteratively.load(); - - let eventFunctionWasCalled = false; - iteratively.enqueueEvent(() => { - eventFunctionWasCalled = true; - }, false); - strictEqual(eventFunctionWasCalled, false); - }); - - test('Does not enqueue event if shouldReportEvents === false and analyticsPermitted === false', () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: false, - analyticsPermitted: false, - }, - snykConfig, - ); - iteratively.load(); - - let eventFunctionWasCalled = false; - iteratively.enqueueEvent(() => { - eventFunctionWasCalled = true; - }, false); - strictEqual(eventFunctionWasCalled, false); - }); - }); - - suite('.identify', () => { - let identify: sinon.SinonSpy; - const user = new User(); - - setup(() => { - identify = sinon.spy(itly, 'identify'); - }); - - teardown(() => { - identify.restore(); - }); - - test('Identifies a user if shouldReportEvents === true and analyticsPermitted === true', async () => { - const iteratively = new Iteratively( - user, - new LoggerMock(), - { - ...config, - shouldReportEvents: true, - analyticsPermitted: true, - }, - snykConfig, - ); - iteratively.load(); - - await iteratively.identify('test'); - strictEqual(identify.called, true); - strictEqual(identify.calledOnce, true); - }); - - test('Does not identify a user if shouldReportEvents === true and analyticsPermitted === false', async () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: true, - analyticsPermitted: false, - }, - snykConfig, - ); - iteratively.load(); - - await iteratively.identify('test'); - strictEqual(identify.called, false); - strictEqual(identify.calledOnce, false); - }); - - test('Does not identify a user if shouldReportEvents === false and analyticsPermitted === true', async () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: false, - analyticsPermitted: true, - }, - snykConfig, - ); - iteratively.load(); - - await iteratively.identify('test'); - strictEqual(identify.called, false); - strictEqual(identify.calledOnce, false); - }); - - test('Does not identify a user if shouldReportEvents === false and analyticsPermitted === false', async () => { - const iteratively = new Iteratively( - new User(), - new LoggerMock(), - { - ...config, - shouldReportEvents: false, - analyticsPermitted: false, - }, - snykConfig, - ); - iteratively.load(); - - await iteratively.identify('test'); - strictEqual(identify.called, false); - strictEqual(identify.calledOnce, false); - }); - }); -}); diff --git a/src/test/unit/common/commands/commandController.test.ts b/src/test/unit/common/commands/commandController.test.ts index 4a13ede58..45e6e6317 100644 --- a/src/test/unit/common/commands/commandController.test.ts +++ b/src/test/unit/common/commands/commandController.test.ts @@ -2,7 +2,6 @@ import sinon from 'sinon'; import * as util from 'util'; import { IAuthenticationService } from '../../../../snyk/base/services/authenticationService'; import { ScanModeService } from '../../../../snyk/base/services/scanModeService'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; import { CommandController } from '../../../../snyk/common/commands/commandController'; import { COMMAND_DEBOUNCE_INTERVAL } from '../../../../snyk/common/constants/general'; import { CodeIssueData, IacIssueData } from '../../../../snyk/common/languageServer/types'; @@ -33,7 +32,6 @@ suite('CommandController', () => { windowMock, new LanguageServerMock(), new LoggerMock(), - {} as IAnalytics, ); }); diff --git a/src/test/unit/common/editor/codeActionsProvider.test.ts b/src/test/unit/common/editor/codeActionsProvider.test.ts index e6a2fe81b..e6340782b 100644 --- a/src/test/unit/common/editor/codeActionsProvider.test.ts +++ b/src/test/unit/common/editor/codeActionsProvider.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics, SupportedQuickFixProperties } from '../../../../snyk/common/analytics/itly'; import { SNYK_OPEN_ISSUE_COMMAND, SNYK_OPEN_LOCAL_COMMAND } from '../../../../snyk/common/constants/commands'; import { CodeActionsProvider } from '../../../../snyk/common/editor/codeActionsProvider'; import { Issue } from '../../../../snyk/common/languageServer/types'; @@ -34,9 +33,6 @@ class MockProductService extends CodeActionsProvider { } as unknown as CodeAction, ]; } - getAnalyticsActionTypes(): [string, ...string[]] & [SupportedQuickFixProperties, ...SupportedQuickFixProperties[]] { - return ['Show Suggestion']; - } getIssueRange(_: Issue): Range { return { contains: () => true, @@ -46,7 +42,6 @@ class MockProductService extends CodeActionsProvider { suite('Code Actions Provider', () => { let issuesActionsProvider: CodeActionsProvider; - let logQuickFixIsDisplayed: sinon.SinonSpy; setup(() => { const codeResults = new Map>(); @@ -59,16 +54,11 @@ suite('Code Actions Provider', () => { } as unknown as Issue, ]); - logQuickFixIsDisplayed = sinon.fake(); - const analytics = { - logQuickFixIsDisplayed, - } as unknown as IAnalytics; - const codeActionKindAdapter = { getQuickFix: sinon.fake(), } as ICodeActionKindAdapter; - issuesActionsProvider = new MockProductService(codeResults, codeActionKindAdapter, analytics); + issuesActionsProvider = new MockProductService(codeResults, codeActionKindAdapter); }); teardown(() => { @@ -91,19 +81,4 @@ suite('Code Actions Provider', () => { strictEqual(codeActions[0].command?.command, SNYK_OPEN_ISSUE_COMMAND); strictEqual(codeActions[1].command?.command, SNYK_OPEN_LOCAL_COMMAND); }); - - test("Logs 'Quick Fix is Displayed' analytical event", () => { - // arrange - const document = { - uri: { - fsPath: '//folderName//test.js', - }, - } as unknown as TextDocument; - - // act - issuesActionsProvider.provideCodeActions(document, {} as Range, {} as CodeActionContext); - - // verify - strictEqual(logQuickFixIsDisplayed.calledOnce, true); - }); }); diff --git a/src/test/unit/common/languageServer/languageServer.test.ts b/src/test/unit/common/languageServer/languageServer.test.ts index 6155e161c..18c6a4b00 100644 --- a/src/test/unit/common/languageServer/languageServer.test.ts +++ b/src/test/unit/common/languageServer/languageServer.test.ts @@ -45,7 +45,6 @@ suite('Language Server', () => { getToken(): Promise { return Promise.resolve('testToken'); }, - shouldReportEvents: true, shouldReportErrors: true, getSnykLanguageServerPath(): string { return path; @@ -205,7 +204,6 @@ suite('Language Server', () => { activateSnykIac: 'true', token: 'testToken', cliPath: 'testPath', - enableTelemetry: 'true', sendErrorReports: 'true', integrationName: 'VS_CODE', integrationVersion: '0.0.0', diff --git a/src/test/unit/common/languageServer/middleware.test.ts b/src/test/unit/common/languageServer/middleware.test.ts index 082a383c1..dc13aaed2 100644 --- a/src/test/unit/common/languageServer/middleware.test.ts +++ b/src/test/unit/common/languageServer/middleware.test.ts @@ -21,7 +21,6 @@ suite('Language Server: Middleware', () => { setup(() => { user = { anonymousId: 'anonymous-id' } as User; configuration = { - shouldReportEvents: false, shouldReportErrors: false, snykOssApiEndpoint: 'https://dev.snyk.io/api', getAdditionalCliParameters: () => '', @@ -86,7 +85,6 @@ suite('Language Server: Middleware', () => { assert.strictEqual(serverResult.additionalParams, configuration.getAdditionalCliParameters()); assert.strictEqual(serverResult.sendErrorReports, `${configuration.shouldReportErrors}`); assert.strictEqual(serverResult.organization, `${configuration.organization}`); - assert.strictEqual(serverResult.enableTelemetry, `${configuration.shouldReportEvents}`); assert.strictEqual( serverResult.manageBinariesAutomatically, `${configuration.isAutomaticDependencyManagementEnabled()}`, diff --git a/src/test/unit/common/languageServer/settings.test.ts b/src/test/unit/common/languageServer/settings.test.ts index a85a486f3..9dadf634c 100644 --- a/src/test/unit/common/languageServer/settings.test.ts +++ b/src/test/unit/common/languageServer/settings.test.ts @@ -22,7 +22,6 @@ suite('LanguageServerSettings', () => { test('should generate server settings with default true values for undefined feature toggles', async () => { const mockUser = { anonymousId: 'anonymous-id' } as User; const mockConfiguration: IConfiguration = { - shouldReportEvents: true, shouldReportErrors: false, snykOssApiEndpoint: 'https://dev.snyk.io/api', organization: 'my-org', @@ -45,7 +44,6 @@ suite('LanguageServerSettings', () => { assert.strictEqual(serverSettings.activateSnykIac, 'true'); assert.strictEqual(serverSettings.deviceId, 'anonymous-id'); - assert.strictEqual(serverSettings.enableTelemetry, 'true'); assert.strictEqual(serverSettings.sendErrorReports, 'false'); assert.strictEqual(serverSettings.cliPath, '/path/to/cli'); diff --git a/src/test/unit/common/services/notificationService.test.ts b/src/test/unit/common/services/notificationService.test.ts deleted file mode 100644 index e06cb4f3a..000000000 --- a/src/test/unit/common/services/notificationService.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { strictEqual } from 'assert'; -import sinon from 'sinon'; -import { snykMessages } from '../../../../snyk/base/messages/snykMessages'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; -import { IConfiguration } from '../../../../snyk/common/configuration/configuration'; -import { NotificationService } from '../../../../snyk/common/services/notificationService'; -import { IVSCodeCommands } from '../../../../snyk/common/vscode/commands'; -import { IVSCodeWindow } from '../../../../snyk/common/vscode/window'; -import { LoggerMock } from '../../mocks/logger.mock'; - -suite('NotificationService', () => { - let commands: IVSCodeCommands; - let configuration: IConfiguration; - - setup(() => { - commands = { - executeCommand: sinon.fake(), - } as IVSCodeCommands; - }); - - teardown(() => { - sinon.restore(); - }); - - test('"Welcome Button Is Clicked" analytical event is logged', async () => { - const logWelcomeButtonIsClickedFake = sinon.fake(); - const window = { - showInformationMessage: () => Promise.resolve(snykMessages.welcome.button), - } as unknown as IVSCodeWindow; - const analytics = { - logWelcomeButtonIsClicked: logWelcomeButtonIsClickedFake, - } as unknown as IAnalytics; - configuration = { - shouldShowWelcomeNotification: true, - hideOssBackgroundScanNotification: sinon.fake(), - } as unknown as IConfiguration; - - const notificationService = new NotificationService(window, commands, configuration, analytics, new LoggerMock()); - await notificationService.init(); - - strictEqual(logWelcomeButtonIsClickedFake.calledOnce, true); - }); -}); diff --git a/src/test/unit/common/user.test.ts b/src/test/unit/common/user.test.ts index 6d573531f..8d80b9024 100644 --- a/src/test/unit/common/user.test.ts +++ b/src/test/unit/common/user.test.ts @@ -1,28 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../snyk/common/analytics/itly'; import { User, UserDto } from '../../../snyk/common/user'; import { IVSCodeCommands } from '../../../snyk/common/vscode/commands'; suite('User', () => { - test('Identification calls analytics identify', async () => { - const identifyFake = sinon.fake(); - const analytics = { - identify: identifyFake, - } as unknown as IAnalytics; - const commandExecutor = { - executeCommand(_command, ..._rest) { - return Promise.resolve({ id: 'test', username: 't' } as UserDto); - }, - } as IVSCodeCommands; - - const user = new User(); - await user.identify(commandExecutor, analytics); - - strictEqual(identifyFake.called, true); - }); - test('Returns authenticated id in SHA-256', () => { const user = new User(undefined, '185958e2-6317-4543-b9bc-960d94890353'); diff --git a/src/test/unit/snykCode/codeActions/codeIssuesActionsProvider.test.ts b/src/test/unit/snykCode/codeActions/codeIssuesActionsProvider.test.ts index d36ae1504..76a4ba361 100644 --- a/src/test/unit/snykCode/codeActions/codeIssuesActionsProvider.test.ts +++ b/src/test/unit/snykCode/codeActions/codeIssuesActionsProvider.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; import { SNYK_IGNORE_ISSUE_COMMAND, SNYK_OPEN_ISSUE_COMMAND } from '../../../../snyk/common/constants/commands'; import { CodeIssueData, Issue } from '../../../../snyk/common/languageServer/types'; import { WorkspaceFolderResult } from '../../../../snyk/common/services/productService'; @@ -12,7 +11,6 @@ import { IssueUtils } from '../../../../snyk/snykCode/utils/issueUtils'; suite('Snyk Code actions provider', () => { let issuesActionsProvider: SnykCodeActionsProvider; - let logQuickFixIsDisplayed: sinon.SinonSpy; setup(() => { const codeResults = new Map>(); @@ -25,11 +23,6 @@ suite('Snyk Code actions provider', () => { } as unknown as Issue, ]); - logQuickFixIsDisplayed = sinon.fake(); - const analytics = { - logQuickFixIsDisplayed, - } as unknown as IAnalytics; - const codeActionAdapter = { create: (_: string, _kind?: CodeActionKind) => ({ command: {}, @@ -51,7 +44,6 @@ suite('Snyk Code actions provider', () => { codeActionAdapter, codeActionKindAdapter, {} as IVSCodeLanguages, - analytics, ); }); @@ -76,19 +68,4 @@ suite('Snyk Code actions provider', () => { strictEqual(codeActions[1].command?.command, SNYK_IGNORE_ISSUE_COMMAND); strictEqual(codeActions[2].command?.command, SNYK_IGNORE_ISSUE_COMMAND); }); - - test("Logs 'Quick Fix is Displayed' analytical event", () => { - // arrange - const document = { - uri: { - fsPath: '//folderName//test.js', - }, - } as unknown as TextDocument; - - // act - issuesActionsProvider.provideCodeActions(document, {} as Range, {} as CodeActionContext); - - // verify - strictEqual(logQuickFixIsDisplayed.calledOnce, true); - }); }); diff --git a/src/test/unit/snykCode/codeService.test.ts b/src/test/unit/snykCode/codeService.test.ts index 7aae49382..261930d26 100644 --- a/src/test/unit/snykCode/codeService.test.ts +++ b/src/test/unit/snykCode/codeService.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../snyk/common/analytics/itly'; import { IConfiguration } from '../../../snyk/common/configuration/configuration'; import { WorkspaceTrust } from '../../../snyk/common/configuration/trustedFolders'; import { ILanguageServer } from '../../../snyk/common/languageServer/languageServer'; @@ -45,7 +44,6 @@ suite('Code Service', () => { ls, languagesMock, new LoggerMock(), - {} as IAnalytics, ); }); diff --git a/src/test/unit/snykCode/hoverProvider/hoverProvider.test.ts b/src/test/unit/snykCode/hoverProvider/hoverProvider.test.ts deleted file mode 100644 index bd212563c..000000000 --- a/src/test/unit/snykCode/hoverProvider/hoverProvider.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { strictEqual } from 'assert'; -import sinon from 'sinon'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; -import { IHoverAdapter } from '../../../../snyk/common/vscode/hover'; -import { IVSCodeLanguages } from '../../../../snyk/common/vscode/languages'; -import { IMarkdownStringAdapter } from '../../../../snyk/common/vscode/markdownString'; -import { Diagnostic, DiagnosticCollection, Position, TextDocument, Uri } from '../../../../snyk/common/vscode/types'; -import { DisposableHoverProvider } from '../../../../snyk/snykCode/hoverProvider/hoverProvider'; -import { ISnykCodeAnalyzer } from '../../../../snyk/snykCode/interfaces'; -import { IssueUtils } from '../../../../snyk/snykCode/utils/issueUtils'; -import { LoggerMock } from '../../mocks/logger.mock'; - -suite('Snyk Code hover provider', () => { - let provider: DisposableHoverProvider; - const logIssueHoverIsDisplayed = sinon.fake(); - - setup(() => { - const analyzer = { - findSuggestion: (_: string) => true, - } as unknown as ISnykCodeAnalyzer; - const vscodeLanguagesMock = sinon.fake() as unknown as IVSCodeLanguages; - - const analytics = { - logIssueHoverIsDisplayed, - } as unknown as IAnalytics; - - provider = new DisposableHoverProvider(analyzer, new LoggerMock(), vscodeLanguagesMock, analytics, { - get: sinon.fake(), - } as IMarkdownStringAdapter); - }); - - teardown(() => { - sinon.restore(); - }); - - test("Logs 'Issue Hover is Displayed' analytical event", () => { - // prepare objects - const snykReview = { - has: (_: Uri): boolean => true, - get: sinon.fake(), - } as unknown as DiagnosticCollection; - - sinon.stub(IssueUtils, 'findIssueWithRange').returns({} as Diagnostic); - - const hoverProvider = provider.getHover(snykReview, { - create: sinon.fake() as unknown, - } as IHoverAdapter); - - const document = { - uri: 'test.js', - } as unknown as TextDocument; - - // act - hoverProvider(document, {} as Position); - - // verify - strictEqual(logIssueHoverIsDisplayed.calledOnce, true); - }); -}); diff --git a/src/test/unit/snykIac/codeActions/iacCodeActionsProvider.test.ts b/src/test/unit/snykIac/codeActions/iacCodeActionsProvider.test.ts index 201207332..ba736dda8 100644 --- a/src/test/unit/snykIac/codeActions/iacCodeActionsProvider.test.ts +++ b/src/test/unit/snykIac/codeActions/iacCodeActionsProvider.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; import { SNYK_OPEN_ISSUE_COMMAND } from '../../../../snyk/common/constants/commands'; import { IacIssueData, Issue } from '../../../../snyk/common/languageServer/types'; import { WorkspaceFolderResult } from '../../../../snyk/common/services/productService'; @@ -23,11 +22,6 @@ suite('IaC code actions provider', () => { } as unknown as Issue, ]); - logQuickFixIsDisplayed = sinon.fake(); - const analytics = { - logQuickFixIsDisplayed, - } as unknown as IAnalytics; - const codeActionAdapter = { create: (_: string, _kind?: CodeActionKind) => ({ command: {}, @@ -49,7 +43,6 @@ suite('IaC code actions provider', () => { codeActionAdapter, codeActionKindAdapter, {} as IVSCodeLanguages, - analytics, ); }); @@ -72,19 +65,4 @@ suite('IaC code actions provider', () => { strictEqual(codeActions?.length, 1); strictEqual(codeActions[0].command?.command, SNYK_OPEN_ISSUE_COMMAND); }); - - test("Logs 'Quick Fix is Displayed' analytical event", () => { - // arrange - const document = { - uri: { - fsPath: '//folderName//test.js', - }, - } as unknown as TextDocument; - - // act - issuesActionsProvider.provideCodeActions(document, {} as Range, {} as CodeActionContext); - - // verify - strictEqual(logQuickFixIsDisplayed.calledOnce, true); - }); }); diff --git a/src/test/unit/snykIac/iacService.test.ts b/src/test/unit/snykIac/iacService.test.ts index 58dca273f..ad838274a 100644 --- a/src/test/unit/snykIac/iacService.test.ts +++ b/src/test/unit/snykIac/iacService.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../snyk/common/analytics/itly'; import { IConfiguration } from '../../../snyk/common/configuration/configuration'; import { WorkspaceTrust } from '../../../snyk/common/configuration/trustedFolders'; import { ILanguageServer } from '../../../snyk/common/languageServer/languageServer'; @@ -47,7 +46,6 @@ suite('IaC Service', () => { registerCodeActionsProvider: sinon.fake(), } as unknown as IVSCodeLanguages, new LoggerMock(), - {} as IAnalytics, ); }); diff --git a/src/test/unit/snykOss/ossService.test.ts b/src/test/unit/snykOss/ossService.test.ts index 46f3e13db..fcb93c820 100644 --- a/src/test/unit/snykOss/ossService.test.ts +++ b/src/test/unit/snykOss/ossService.test.ts @@ -1,6 +1,5 @@ import { strictEqual } from 'assert'; import sinon from 'sinon'; -import { IAnalytics } from '../../../snyk/common/analytics/itly'; import { IConfiguration } from '../../../snyk/common/configuration/configuration'; import { WorkspaceTrust } from '../../../snyk/common/configuration/trustedFolders'; import { ILanguageServer } from '../../../snyk/common/languageServer/languageServer'; @@ -45,7 +44,6 @@ suite('OSS Service', () => { registerCodeActionsProvider: sinon.fake(), } as unknown as IVSCodeLanguages, new LoggerMock(), - {} as IAnalytics, ); }); diff --git a/src/test/unit/snykOss/providers/ossCodeActionsProvider.test.ts b/src/test/unit/snykOss/providers/ossCodeActionsProvider.test.ts index 5a6ad2c26..c311a7b8c 100644 --- a/src/test/unit/snykOss/providers/ossCodeActionsProvider.test.ts +++ b/src/test/unit/snykOss/providers/ossCodeActionsProvider.test.ts @@ -1,7 +1,6 @@ import assert from 'assert'; import sinon from 'sinon'; import { CodeAction, CodeActionContext, CodeActionKind, Range, TextDocument } from 'vscode'; -import { IAnalytics } from '../../../../snyk/common/analytics/itly'; import { OpenCommandIssueType, OpenIssueCommandArg } from '../../../../snyk/common/commands/types'; import { SNYK_OPEN_ISSUE_COMMAND } from '../../../../snyk/common/constants/commands'; import { Issue, IssueSeverity, OssIssueData } from '../../../../snyk/common/languageServer/types'; @@ -12,7 +11,6 @@ import { OssCodeActionsProvider } from '../../../../snyk/snykOss/providers/ossCo suite('OSS code actions provider', () => { let ossActionsProvider: OssCodeActionsProvider; - let logQuickFixIsDisplayed: sinon.SinonSpy; let rangeMock: Range; setup(() => { @@ -24,11 +22,6 @@ suite('OSS code actions provider', () => { } as unknown as Issue, ]); - logQuickFixIsDisplayed = sinon.fake(); - const analytics = { - logQuickFixIsDisplayed, - } as unknown as IAnalytics; - const codeActionAdapter = { create: (_: string, _kind?: CodeActionKind) => ({ command: {}, @@ -48,7 +41,6 @@ suite('OSS code actions provider', () => { codeActionAdapter, codeActionKindAdapter, ossResults, - analytics, ); }); @@ -112,7 +104,6 @@ suite('OSS code actions provider', () => { const result = ossActionsProvider.provideCodeActions(document, clickedRange, context); // assert - sinon.assert.calledOnce(logQuickFixIsDisplayed); assert.deepStrictEqual(result, codeActions); }); }); diff --git a/src/test/unit/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.test.ts b/src/test/unit/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.test.ts index f1ce0a5de..c03d8cf38 100644 --- a/src/test/unit/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.test.ts +++ b/src/test/unit/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.test.ts @@ -1,7 +1,6 @@ import { strictEqual } from 'assert'; import { EMPTY, Subject } from 'rxjs'; import sinon from 'sinon'; -import { IAnalytics } from '../../../../../snyk/common/analytics/itly'; import { IConfiguration } from '../../../../../snyk/common/configuration/configuration'; import { ILanguageClientAdapter } from '../../../../../snyk/common/vscode/languageClient'; import { IVSCodeLanguages } from '../../../../../snyk/common/vscode/languages'; @@ -49,7 +48,6 @@ suite('OSS VulnerabilityCountService', () => { ); const editorDecorator = new EditorDecorator(window, languages, {} as IThemeColorAdapter); - const analytics = {} as IAnalytics; const configuration = {} as IConfiguration; ossVulnerabilityCountService = new OssVulnerabilityCountService( @@ -60,7 +58,6 @@ suite('OSS VulnerabilityCountService', () => { ossService, logger, editorDecorator, - analytics, configuration, ); });