From 18350434e67d25376210b2694bccba02c02039ef Mon Sep 17 00:00:00 2001 From: JasonYeMSFT Date: Thu, 18 Apr 2024 15:16:59 -0700 Subject: [PATCH] Enable CosmosDB OAuth support (#2277) * Enable CosmosDB OAuth support * Fix connectionString construction Deduplicate key credential extraction * Fix lint --- package-lock.json | 521 ++++++++++-------- package.json | 10 +- .../api/DatabaseAccountTreeItemInternal.ts | 14 +- src/docdb/NoSqlCodeLensProvider.ts | 2 +- src/docdb/commands/connectNoSqlContainer.ts | 9 +- src/docdb/commands/executeNoSqlQuery.ts | 9 +- src/docdb/commands/getNoSqlQueryPlan.ts | 9 +- src/docdb/getCosmosClient.ts | 60 +- src/docdb/tree/DocDBAccountTreeItemBase.ts | 28 +- src/docdb/tree/DocDBDocumentTreeItem.ts | 2 +- src/docdb/tree/IDocDBTreeRoot.ts | 3 +- src/graph/tree/GraphAccountTreeItem.ts | 16 +- src/tree/AttachedAccountsTreeItem.ts | 9 +- src/tree/SubscriptionTreeItem.ts | 30 +- 14 files changed, 459 insertions(+), 263 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2fd87d1..ea9207ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,9 @@ "@azure/arm-postgresql": "^6.0.0", "@azure/arm-postgresql-flexible": "^7.1.0", "@azure/cosmos": "^3.6.3", - "@microsoft/vscode-azext-azureutils": "^2.0.2", - "@microsoft/vscode-azext-utils": "^2.1.0", + "@microsoft/vscode-azext-azureauth": "^2.3.0", + "@microsoft/vscode-azext-azureutils": "^3.0.1", + "@microsoft/vscode-azext-utils": "^2.4.0", "antlr4ts": "^0.4.1-alpha.0", "bson": "^6.0.0", "fs-extra": "^8.0.0", @@ -1043,18 +1044,18 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@azure/arm-resources-subscriptions": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@azure/arm-resources-subscriptions/-/arm-resources-subscriptions-2.0.1.tgz", - "integrity": "sha512-K/WTPFQz12eTdpR/VgB56R0qQ/MFJmsYuBAw5k/hLmMAZNIqBTy96YMRPzFLjpDZRs/HpLV61vpUGldBQL9iUw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@azure/arm-resources-subscriptions/-/arm-resources-subscriptions-2.1.0.tgz", + "integrity": "sha512-vKiu/3Yh84IV3IuJJ+0Fgs/ZQpvuGzoZ3dAoBksIV++Uu/Qz9RcQVz7pj+APWYIuODuR9I0eGKswZvzynzekug==", "dependencies": { "@azure/core-auth": "^1.3.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.7.0", "@azure/core-paging": "^1.2.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "engines": { - "node": ">=12.0.0" + "node": ">=14.0.0" } }, "node_modules/@azure/arm-resources-subscriptions/node_modules/tslib": { @@ -1326,8 +1327,7 @@ "node_modules/@azure/ms-rest-azure-env": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@azure/ms-rest-azure-env/-/ms-rest-azure-env-2.0.0.tgz", - "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==", - "peer": true + "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==" }, "node_modules/@azure/ms-rest-azure-js": { "version": "2.1.0", @@ -1509,46 +1509,105 @@ } }, "node_modules/@microsoft/1ds-core-js": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-3.2.3.tgz", - "integrity": "sha512-796A8fd90oUKDRO7UXUT9BwZ3G+a9XzJj5v012FcCN/2qRhEsIV3x/0wkx2S08T4FiQEUPkB2uoYHpEjEneM7g==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.1.2.tgz", + "integrity": "sha512-m1MeUdPtDqq4D7qmirMBgiHQNQs8wkUoTxA44RTtki6kup8cF1c4WYXsxvHJ8R4C/wbm+HRM9PxBqI5JH3d58Q==", "dependencies": { - "@microsoft/applicationinsights-core-js": "2.8.4", - "@microsoft/applicationinsights-shims": "^2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" } }, "node_modules/@microsoft/1ds-post-js": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-3.2.3.tgz", - "integrity": "sha512-tcGJQXXr2LYoBbIXPoUVe1KCF3OtBsuKDFL7BXfmNtuSGtWF0yejm6H83DrR8/cUIGMRMUP9lqNlqFGwDYiwAQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.1.2.tgz", + "integrity": "sha512-rfuILnEZqXtZaPQf+WRF/zYZ6V0Dxh0W9lWiVM9aY2Enuh8fEvbjeeXGk0n/jGXeko/bLXevmOaMrZw9x1pIVw==", "dependencies": { - "@microsoft/1ds-core-js": "3.2.3", - "@microsoft/applicationinsights-shims": "^2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/1ds-core-js": "4.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + } + }, + "node_modules/@microsoft/applicationinsights-channel-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.1.2.tgz", + "integrity": "sha512-QyPxpOOhtohFzcl4tzfWp4seN6JaToF66DZ1qjsYkUmEyHAackWSsv9m7qvuaAcCB9WrUzW9y0mRXgGKsEJcAg==", + "dependencies": { + "@microsoft/applicationinsights-common": "3.1.2", + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + }, + "peerDependencies": { + "tslib": "*" + } + }, + "node_modules/@microsoft/applicationinsights-common": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.1.2.tgz", + "integrity": "sha512-ivu3s73xt6Owakepnx2mbrMCry1mVHrA/2TL4nKCRLad6O3IBK3MkruMoeb3hoWpECBhErFRVj+/b0Kh7dl/Lw==", + "dependencies": { + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + }, + "peerDependencies": { + "tslib": "*" } }, "node_modules/@microsoft/applicationinsights-core-js": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.8.4.tgz", - "integrity": "sha512-FoA0FNOsFbJnLyTyQlYs6+HR7HMEa6nAOE6WOm9WVejBHMHQ/Bdb+hfVFi6slxwCimr/ner90jchi4/sIYdnyQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.1.2.tgz", + "integrity": "sha512-xsJAm52tV355S/MogTunV/m1wg6P6tFg9Yhi4AC2OE9p2aa0k/FYHzWmrCrsEAVimCd8n/iTXmMRSrQk5QpxiA==", "dependencies": { - "@microsoft/applicationinsights-shims": "2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" }, "peerDependencies": { "tslib": "*" } }, "node_modules/@microsoft/applicationinsights-shims": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz", - "integrity": "sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", + "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + } + }, + "node_modules/@microsoft/applicationinsights-web-basic": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.1.2.tgz", + "integrity": "sha512-NUnAk/ML9ClnmiQQRo3Fq2obzJVZAfGTgkQOwobZMvNhBVK5IPuv/ROEEAVbl02Go9AjV5uCZ+QoRhTfWrIumQ==", + "dependencies": { + "@microsoft/applicationinsights-channel-js": "3.1.2", + "@microsoft/applicationinsights-common": "3.1.2", + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + }, + "peerDependencies": { + "tslib": "*" + } }, "node_modules/@microsoft/dynamicproto-js": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz", - "integrity": "sha512-D1Oivw1A4bIXhzBIy3/BBPn3p2On+kpO2NiYt9shICDK7L/w+cR6FFBUsBZ05l6iqzTeL+Jm8lAYn0g6G7DmDg==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.3.tgz", + "integrity": "sha512-JTWTU80rMy3mdxOjjpaiDQsTLZ6YSGGqsjURsY6AUQtIj0udlF/jYmhdLZu8693ZIC0T1IwYnFa0+QeiMnziBA==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.10.4 < 2.x" + } }, "node_modules/@microsoft/eslint-config-azuretools": { "version": "0.1.0", @@ -1564,20 +1623,29 @@ "eslint-plugin-import": ">=2" } }, + "node_modules/@microsoft/vscode-azext-azureauth": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureauth/-/vscode-azext-azureauth-2.3.0.tgz", + "integrity": "sha512-mnVIyke5rc9ua+g81zF133UCZerKJwILJ51OvMv24VVfdo9qYaqgy2kOa/O6JwICXylcpL2/ODNw+RkFg58b1g==", + "dependencies": { + "@azure/arm-resources-subscriptions": "^2.1.0", + "@azure/ms-rest-azure-env": "^2.0.0" + } + }, "node_modules/@microsoft/vscode-azext-azureutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-2.0.2.tgz", - "integrity": "sha512-r+7NqedkvfFazztO7kxT1AU/B/UfiGhTDlRtFHx+W5bhp+yJw0eOtX8VPJXXSXoOaq2dzuGBwxAQ0bDD1lNPcQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-3.0.1.tgz", + "integrity": "sha512-zNNhCoh6vKoImPxsxUTIP+311TBeIW1GL/EVq5LBWYhnN1v8jmhtltIJuWkmOOq52DQGWRe99Lkj3Qzh1mGZcw==", "dependencies": { "@azure/arm-resources": "^5.0.0", "@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0", "@azure/arm-resources-subscriptions": "^2.0.0", - "@azure/arm-storage": "^18.0.0", + "@azure/arm-storage": "^18.2.0", "@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0", "@azure/core-client": "^1.6.0", "@azure/core-rest-pipeline": "^1.9.0", "@azure/logger": "^1.0.4", - "@microsoft/vscode-azext-utils": "^2.0.0", + "@microsoft/vscode-azext-utils": "^2.2.0", "semver": "^7.3.7", "uuid": "^9.0.0" }, @@ -1719,12 +1787,12 @@ } }, "node_modules/@microsoft/vscode-azext-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.1.0.tgz", - "integrity": "sha512-nkV5RODko5/XOBeh6kTkiMqkls+mB7kcLKKqwZPSdZijouCSawzPpurNf5erc9hqt0q9oCl5cRx1UwDXFw9tVQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.4.0.tgz", + "integrity": "sha512-xWZiB1md9zdKsljyaTftj2EK+xJGynzRoMGT0MoMARewJ+xRDlS/xKUlguUoAzWoMFtS4COuEPoY6KYBgICOog==", "dependencies": { "@microsoft/vscode-azureresources-api": "^2.0.4", - "@vscode/extension-telemetry": "^0.6.2", + "@vscode/extension-telemetry": "^0.9.0", "dayjs": "^1.11.2", "escape-string-regexp": "^2.0.0", "html-to-text": "^8.2.0", @@ -1750,14 +1818,14 @@ } }, "node_modules/@microsoft/vscode-azext-utils/node_modules/vscode-uri": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", - "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" }, "node_modules/@microsoft/vscode-azureresources-api": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.1.0.tgz", - "integrity": "sha512-dqjLyHl0OJgnjEtMtZEDvA9YovszWnE2k3ktEcHiTHWZ62luYrhOQhMzJjGArSFH3ANRCWgS6A1q4OTjZoBrKQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.2.0.tgz", + "integrity": "sha512-2Hc43wYwNe3zjXxwfMMW2L6NnjdOJlTkp7N7mP1AuDSe+cNE3L2yG8pEQTbz9xSNhfXl7PQi6EF05l7MOvqcvw==", "peerDependencies": { "@azure/ms-rest-azure-env": "^2.0.0" } @@ -1770,6 +1838,19 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@nevware21/ts-async": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.5.1.tgz", + "integrity": "sha512-O2kN8n2HpDWJ7Oji+oTMnhITrCndmrNvrHbGDwAIBydx+FWvLE/vrw4QwnRRMvSCa2AJrcP59Ryklxv30KfkWQ==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.11.2 < 2.x" + } + }, + "node_modules/@nevware21/ts-utils": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.11.2.tgz", + "integrity": "sha512-80W8BkS09kkGuUHJX50Fqq+QqAslxUaOQytH+3JhRacXs1EpEt2JOOkYKytqFZAYir3SeH9fahniEaDzIBxlUw==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -3441,15 +3522,16 @@ } }, "node_modules/@vscode/extension-telemetry": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.6.2.tgz", - "integrity": "sha512-yb/wxLuaaCRcBAZtDCjNYSisAXz3FWsSqAha5nhHcYxx2ZPdQdWuZqVXGKq0ZpHVndBWWtK6XqtpCN2/HB4S1w==", + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.6.tgz", + "integrity": "sha512-qWK2GNw+b69QRYpjuNM9g3JKToMICoNIdc0rQMtvb4gIG9vKKCZCVCz+ZOx6XM/YlfWAyuPiyxcjIY0xyF+Djg==", "dependencies": { - "@microsoft/1ds-core-js": "^3.2.3", - "@microsoft/1ds-post-js": "^3.2.3" + "@microsoft/1ds-core-js": "^4.1.2", + "@microsoft/1ds-post-js": "^4.1.2", + "@microsoft/applicationinsights-web-basic": "^3.1.2" }, "engines": { - "vscode": "^1.60.0" + "vscode": "^1.75.0" } }, "node_modules/@vscode/test-electron": { @@ -4169,29 +4251,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^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", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/azure-devops-node-api": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.0.1.tgz", @@ -5130,9 +5189,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz", - "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==" + "version": "1.11.10", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", + "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" }, "node_modules/debug": { "version": "4.3.4", @@ -5175,9 +5234,9 @@ "dev": true }, "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "engines": { "node": ">=0.10.0" } @@ -6909,25 +6968,6 @@ "readable-stream": "^2.3.6" } }, - "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -7515,9 +7555,9 @@ "dev": true }, "node_modules/html-to-text": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.2.0.tgz", - "integrity": "sha512-CLXExYn1b++Lgri+ZyVvbUEFwzkLZppjjZOwB7X1qv2jIi8MrMEvxWX5KQ7zATAzTvcqgmtO00M2kCRMtEdOKQ==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.2.1.tgz", + "integrity": "sha512-aN/3JvAk8qFsWVeE9InWAWueLXrbkoVZy0TkzaGhoRBC2gCFEeRLDDJN3/ijIGHohy6H+SZzUQWN/hcYtaPK8w==", "dependencies": { "@selderee/plugin-htmlparser2": "^0.6.0", "deepmerge": "^4.2.2", @@ -9632,9 +9672,9 @@ } }, "node_modules/moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" }, "node_modules/ms": { "version": "2.1.2", @@ -10715,11 +10755,6 @@ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "dev": true }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, "node_modules/pumpify": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", @@ -12110,12 +12145,9 @@ } }, "node_modules/tas-client": { - "version": "0.1.73", - "resolved": "https://registry.npmjs.org/tas-client/-/tas-client-0.1.73.tgz", - "integrity": "sha512-UDdUF9kV2hYdlv+7AgqP2kXarVSUhjK7tg1BUflIRGEgND0/QoNpN64rcEuhEcM8AIbW65yrCopJWqRhLZ3m8w==", - "dependencies": { - "axios": "^1.6.1" - } + "version": "0.2.33", + "resolved": "https://registry.npmjs.org/tas-client/-/tas-client-0.2.33.tgz", + "integrity": "sha512-V+uqV66BOQnWxvI6HjDnE4VkInmYZUQ4dgB7gzaDyFyFSK1i1nF/j7DpS9UbQAgV9NaF1XpcyuavnM1qOeiEIg==" }, "node_modules/terser": { "version": "5.16.6", @@ -13126,14 +13158,14 @@ "integrity": "sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==" }, "node_modules/vscode-tas-client": { - "version": "0.1.75", - "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.75.tgz", - "integrity": "sha512-/+ALFWPI4U3obeRvLFSt39guT7P9bZQrkmcLoiS+2HtzJ/7iPKNt5Sj+XTiitGlPYVFGFc0plxX8AAp6Uxs0xQ==", + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.84.tgz", + "integrity": "sha512-rUTrUopV+70hvx1hW5ebdw1nd6djxubkLvVxjGdyD/r5v/wcVF41LIfiAtbm5qLZDtQdsMH1IaCuDoluoIa88w==", "dependencies": { - "tas-client": "0.1.73" + "tas-client": "0.2.33" }, "engines": { - "vscode": "^1.19.1" + "vscode": "^1.85.0" } }, "node_modules/vscode-uri": { @@ -14585,12 +14617,12 @@ } }, "@azure/arm-resources-subscriptions": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@azure/arm-resources-subscriptions/-/arm-resources-subscriptions-2.0.1.tgz", - "integrity": "sha512-K/WTPFQz12eTdpR/VgB56R0qQ/MFJmsYuBAw5k/hLmMAZNIqBTy96YMRPzFLjpDZRs/HpLV61vpUGldBQL9iUw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@azure/arm-resources-subscriptions/-/arm-resources-subscriptions-2.1.0.tgz", + "integrity": "sha512-vKiu/3Yh84IV3IuJJ+0Fgs/ZQpvuGzoZ3dAoBksIV++Uu/Qz9RcQVz7pj+APWYIuODuR9I0eGKswZvzynzekug==", "requires": { "@azure/core-auth": "^1.3.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.7.0", "@azure/core-paging": "^1.2.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -14844,8 +14876,7 @@ "@azure/ms-rest-azure-env": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@azure/ms-rest-azure-env/-/ms-rest-azure-env-2.0.0.tgz", - "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==", - "peer": true + "integrity": "sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==" }, "@azure/ms-rest-azure-js": { "version": "2.1.0", @@ -15002,43 +15033,93 @@ } }, "@microsoft/1ds-core-js": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-3.2.3.tgz", - "integrity": "sha512-796A8fd90oUKDRO7UXUT9BwZ3G+a9XzJj5v012FcCN/2qRhEsIV3x/0wkx2S08T4FiQEUPkB2uoYHpEjEneM7g==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.1.2.tgz", + "integrity": "sha512-m1MeUdPtDqq4D7qmirMBgiHQNQs8wkUoTxA44RTtki6kup8cF1c4WYXsxvHJ8R4C/wbm+HRM9PxBqI5JH3d58Q==", "requires": { - "@microsoft/applicationinsights-core-js": "2.8.4", - "@microsoft/applicationinsights-shims": "^2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" } }, "@microsoft/1ds-post-js": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-3.2.3.tgz", - "integrity": "sha512-tcGJQXXr2LYoBbIXPoUVe1KCF3OtBsuKDFL7BXfmNtuSGtWF0yejm6H83DrR8/cUIGMRMUP9lqNlqFGwDYiwAQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.1.2.tgz", + "integrity": "sha512-rfuILnEZqXtZaPQf+WRF/zYZ6V0Dxh0W9lWiVM9aY2Enuh8fEvbjeeXGk0n/jGXeko/bLXevmOaMrZw9x1pIVw==", "requires": { - "@microsoft/1ds-core-js": "3.2.3", - "@microsoft/applicationinsights-shims": "^2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/1ds-core-js": "4.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + } + }, + "@microsoft/applicationinsights-channel-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.1.2.tgz", + "integrity": "sha512-QyPxpOOhtohFzcl4tzfWp4seN6JaToF66DZ1qjsYkUmEyHAackWSsv9m7qvuaAcCB9WrUzW9y0mRXgGKsEJcAg==", + "requires": { + "@microsoft/applicationinsights-common": "3.1.2", + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + } + }, + "@microsoft/applicationinsights-common": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.1.2.tgz", + "integrity": "sha512-ivu3s73xt6Owakepnx2mbrMCry1mVHrA/2TL4nKCRLad6O3IBK3MkruMoeb3hoWpECBhErFRVj+/b0Kh7dl/Lw==", + "requires": { + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" } }, "@microsoft/applicationinsights-core-js": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.8.4.tgz", - "integrity": "sha512-FoA0FNOsFbJnLyTyQlYs6+HR7HMEa6nAOE6WOm9WVejBHMHQ/Bdb+hfVFi6slxwCimr/ner90jchi4/sIYdnyQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.1.2.tgz", + "integrity": "sha512-xsJAm52tV355S/MogTunV/m1wg6P6tFg9Yhi4AC2OE9p2aa0k/FYHzWmrCrsEAVimCd8n/iTXmMRSrQk5QpxiA==", "requires": { - "@microsoft/applicationinsights-shims": "2.0.1", - "@microsoft/dynamicproto-js": "^1.1.6" + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" } }, "@microsoft/applicationinsights-shims": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-2.0.1.tgz", - "integrity": "sha512-G0MXf6R6HndRbDy9BbEj0zrLeuhwt2nsXk2zKtF0TnYo39KgYqhYC2ayIzKPTm2KAE+xzD7rgyLdZnrcRvt9WQ==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", + "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", + "requires": { + "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + } + }, + "@microsoft/applicationinsights-web-basic": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.1.2.tgz", + "integrity": "sha512-NUnAk/ML9ClnmiQQRo3Fq2obzJVZAfGTgkQOwobZMvNhBVK5IPuv/ROEEAVbl02Go9AjV5uCZ+QoRhTfWrIumQ==", + "requires": { + "@microsoft/applicationinsights-channel-js": "3.1.2", + "@microsoft/applicationinsights-common": "3.1.2", + "@microsoft/applicationinsights-core-js": "3.1.2", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.3.0 < 2.x", + "@nevware21/ts-utils": ">= 0.11.0 < 2.x" + } }, "@microsoft/dynamicproto-js": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz", - "integrity": "sha512-D1Oivw1A4bIXhzBIy3/BBPn3p2On+kpO2NiYt9shICDK7L/w+cR6FFBUsBZ05l6iqzTeL+Jm8lAYn0g6G7DmDg==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.3.tgz", + "integrity": "sha512-JTWTU80rMy3mdxOjjpaiDQsTLZ6YSGGqsjURsY6AUQtIj0udlF/jYmhdLZu8693ZIC0T1IwYnFa0+QeiMnziBA==", + "requires": { + "@nevware21/ts-utils": ">= 0.10.4 < 2.x" + } }, "@microsoft/eslint-config-azuretools": { "version": "0.1.0", @@ -15049,20 +15130,29 @@ "@typescript-eslint/parser": "^4.28.5" } }, + "@microsoft/vscode-azext-azureauth": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureauth/-/vscode-azext-azureauth-2.3.0.tgz", + "integrity": "sha512-mnVIyke5rc9ua+g81zF133UCZerKJwILJ51OvMv24VVfdo9qYaqgy2kOa/O6JwICXylcpL2/ODNw+RkFg58b1g==", + "requires": { + "@azure/arm-resources-subscriptions": "^2.1.0", + "@azure/ms-rest-azure-env": "^2.0.0" + } + }, "@microsoft/vscode-azext-azureutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-2.0.2.tgz", - "integrity": "sha512-r+7NqedkvfFazztO7kxT1AU/B/UfiGhTDlRtFHx+W5bhp+yJw0eOtX8VPJXXSXoOaq2dzuGBwxAQ0bDD1lNPcQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureutils/-/vscode-azext-azureutils-3.0.1.tgz", + "integrity": "sha512-zNNhCoh6vKoImPxsxUTIP+311TBeIW1GL/EVq5LBWYhnN1v8jmhtltIJuWkmOOq52DQGWRe99Lkj3Qzh1mGZcw==", "requires": { "@azure/arm-resources": "^5.0.0", "@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0", "@azure/arm-resources-subscriptions": "^2.0.0", - "@azure/arm-storage": "^18.0.0", + "@azure/arm-storage": "^18.2.0", "@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0", "@azure/core-client": "^1.6.0", "@azure/core-rest-pipeline": "^1.9.0", "@azure/logger": "^1.0.4", - "@microsoft/vscode-azext-utils": "^2.0.0", + "@microsoft/vscode-azext-utils": "^2.2.0", "semver": "^7.3.7", "uuid": "^9.0.0" }, @@ -15172,12 +15262,12 @@ } }, "@microsoft/vscode-azext-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.1.0.tgz", - "integrity": "sha512-nkV5RODko5/XOBeh6kTkiMqkls+mB7kcLKKqwZPSdZijouCSawzPpurNf5erc9hqt0q9oCl5cRx1UwDXFw9tVQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-2.4.0.tgz", + "integrity": "sha512-xWZiB1md9zdKsljyaTftj2EK+xJGynzRoMGT0MoMARewJ+xRDlS/xKUlguUoAzWoMFtS4COuEPoY6KYBgICOog==", "requires": { "@microsoft/vscode-azureresources-api": "^2.0.4", - "@vscode/extension-telemetry": "^0.6.2", + "@vscode/extension-telemetry": "^0.9.0", "dayjs": "^1.11.2", "escape-string-regexp": "^2.0.0", "html-to-text": "^8.2.0", @@ -15193,16 +15283,16 @@ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, "vscode-uri": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", - "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" } } }, "@microsoft/vscode-azureresources-api": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.1.0.tgz", - "integrity": "sha512-dqjLyHl0OJgnjEtMtZEDvA9YovszWnE2k3ktEcHiTHWZ62luYrhOQhMzJjGArSFH3ANRCWgS6A1q4OTjZoBrKQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azureresources-api/-/vscode-azureresources-api-2.2.0.tgz", + "integrity": "sha512-2Hc43wYwNe3zjXxwfMMW2L6NnjdOJlTkp7N7mP1AuDSe+cNE3L2yG8pEQTbz9xSNhfXl7PQi6EF05l7MOvqcvw==", "requires": {} }, "@mongodb-js/saslprep": { @@ -15213,6 +15303,19 @@ "sparse-bitfield": "^3.0.3" } }, + "@nevware21/ts-async": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.5.1.tgz", + "integrity": "sha512-O2kN8n2HpDWJ7Oji+oTMnhITrCndmrNvrHbGDwAIBydx+FWvLE/vrw4QwnRRMvSCa2AJrcP59Ryklxv30KfkWQ==", + "requires": { + "@nevware21/ts-utils": ">= 0.11.2 < 2.x" + } + }, + "@nevware21/ts-utils": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.11.2.tgz", + "integrity": "sha512-80W8BkS09kkGuUHJX50Fqq+QqAslxUaOQytH+3JhRacXs1EpEt2JOOkYKytqFZAYir3SeH9fahniEaDzIBxlUw==" + }, "@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -16665,12 +16768,13 @@ } }, "@vscode/extension-telemetry": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.6.2.tgz", - "integrity": "sha512-yb/wxLuaaCRcBAZtDCjNYSisAXz3FWsSqAha5nhHcYxx2ZPdQdWuZqVXGKq0ZpHVndBWWtK6XqtpCN2/HB4S1w==", + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.6.tgz", + "integrity": "sha512-qWK2GNw+b69QRYpjuNM9g3JKToMICoNIdc0rQMtvb4gIG9vKKCZCVCz+ZOx6XM/YlfWAyuPiyxcjIY0xyF+Djg==", "requires": { - "@microsoft/1ds-core-js": "^3.2.3", - "@microsoft/1ds-post-js": "^3.2.3" + "@microsoft/1ds-core-js": "^4.1.2", + "@microsoft/1ds-post-js": "^4.1.2", + "@microsoft/applicationinsights-web-basic": "^3.1.2" } }, "@vscode/test-electron": { @@ -17246,28 +17350,6 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true }, - "axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "requires": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - }, - "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } - } - }, "azure-devops-node-api": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.0.1.tgz", @@ -18020,9 +18102,9 @@ } }, "dayjs": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz", - "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==" + "version": "1.11.10", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", + "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" }, "debug": { "version": "4.3.4", @@ -18051,9 +18133,9 @@ "dev": true }, "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" }, "default-compare": { "version": "1.0.0", @@ -19420,11 +19502,6 @@ "readable-stream": "^2.3.6" } }, - "follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" - }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -19869,9 +19946,9 @@ "dev": true }, "html-to-text": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.2.0.tgz", - "integrity": "sha512-CLXExYn1b++Lgri+ZyVvbUEFwzkLZppjjZOwB7X1qv2jIi8MrMEvxWX5KQ7zATAzTvcqgmtO00M2kCRMtEdOKQ==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.2.1.tgz", + "integrity": "sha512-aN/3JvAk8qFsWVeE9InWAWueLXrbkoVZy0TkzaGhoRBC2gCFEeRLDDJN3/ijIGHohy6H+SZzUQWN/hcYtaPK8w==", "requires": { "@selderee/plugin-htmlparser2": "^0.6.0", "deepmerge": "^4.2.2", @@ -21445,9 +21522,9 @@ } }, "moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==" }, "ms": { "version": "2.1.2", @@ -22268,11 +22345,6 @@ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "dev": true }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, "pumpify": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", @@ -23381,12 +23453,9 @@ } }, "tas-client": { - "version": "0.1.73", - "resolved": "https://registry.npmjs.org/tas-client/-/tas-client-0.1.73.tgz", - "integrity": "sha512-UDdUF9kV2hYdlv+7AgqP2kXarVSUhjK7tg1BUflIRGEgND0/QoNpN64rcEuhEcM8AIbW65yrCopJWqRhLZ3m8w==", - "requires": { - "axios": "^1.6.1" - } + "version": "0.2.33", + "resolved": "https://registry.npmjs.org/tas-client/-/tas-client-0.2.33.tgz", + "integrity": "sha512-V+uqV66BOQnWxvI6HjDnE4VkInmYZUQ4dgB7gzaDyFyFSK1i1nF/j7DpS9UbQAgV9NaF1XpcyuavnM1qOeiEIg==" }, "terser": { "version": "5.16.6", @@ -24198,11 +24267,11 @@ "integrity": "sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==" }, "vscode-tas-client": { - "version": "0.1.75", - "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.75.tgz", - "integrity": "sha512-/+ALFWPI4U3obeRvLFSt39guT7P9bZQrkmcLoiS+2HtzJ/7iPKNt5Sj+XTiitGlPYVFGFc0plxX8AAp6Uxs0xQ==", + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/vscode-tas-client/-/vscode-tas-client-0.1.84.tgz", + "integrity": "sha512-rUTrUopV+70hvx1hW5ebdw1nd6djxubkLvVxjGdyD/r5v/wcVF41LIfiAtbm5qLZDtQdsMH1IaCuDoluoIa88w==", "requires": { - "tas-client": "0.1.73" + "tas-client": "0.2.33" } }, "vscode-uri": { diff --git a/package.json b/package.json index 95859cd3..bec4d227 100644 --- a/package.json +++ b/package.json @@ -1069,6 +1069,11 @@ "type": "integer", "default": 8081, "description": "Port to use when connecting to a CosmosDB Emulator instance" + }, + "azureDatabases.testCosmosAuth": { + "type": "boolean", + "description": "Whether to only use Auth credential for Cosmos DB resources", + "default": true } } } @@ -1129,8 +1134,9 @@ "@azure/arm-postgresql": "^6.0.0", "@azure/arm-postgresql-flexible": "^7.1.0", "@azure/cosmos": "^3.6.3", - "@microsoft/vscode-azext-azureutils": "^2.0.2", - "@microsoft/vscode-azext-utils": "^2.1.0", + "@microsoft/vscode-azext-azureauth": "^2.3.0", + "@microsoft/vscode-azext-azureutils": "^3.0.1", + "@microsoft/vscode-azext-utils": "^2.4.0", "antlr4ts": "^0.4.1-alpha.0", "bson": "^6.0.0", "fs-extra": "^8.0.0", diff --git a/src/commands/api/DatabaseAccountTreeItemInternal.ts b/src/commands/api/DatabaseAccountTreeItemInternal.ts index 89a8c116..0082dff9 100644 --- a/src/commands/api/DatabaseAccountTreeItemInternal.ts +++ b/src/commands/api/DatabaseAccountTreeItemInternal.ts @@ -5,6 +5,7 @@ import { callWithTelemetryAndErrorHandling, IActionContext } from '@microsoft/vscode-azext-utils'; import { API } from '../../AzureDBExperiences'; +import { getCosmosKeyCredential } from '../../docdb/getCosmosClient'; import { DocDBAccountTreeItemBase } from '../../docdb/tree/DocDBAccountTreeItemBase'; import { ext } from '../../extensionVariables'; import { ParsedMongoConnectionString } from '../../mongo/mongoConnectionStrings'; @@ -57,10 +58,15 @@ export class DatabaseAccountTreeItemInternal implements DatabaseAccountTreeItem public get docDBData(): { masterKey: string; documentEndpoint: string; } | undefined { if (this._accountNode instanceof DocDBAccountTreeItemBase) { - return { - documentEndpoint: this._accountNode.root.endpoint, - masterKey: this._accountNode.root.masterKey - }; + const keyCred = getCosmosKeyCredential(this._accountNode.root.credentials); + if (keyCred) { + return { + documentEndpoint: this._accountNode.root.endpoint, + masterKey: keyCred.key + }; + } else { + return undefined; + } } else { return undefined; } diff --git a/src/docdb/NoSqlCodeLensProvider.ts b/src/docdb/NoSqlCodeLensProvider.ts index 346cfcb5..35550220 100644 --- a/src/docdb/NoSqlCodeLensProvider.ts +++ b/src/docdb/NoSqlCodeLensProvider.ts @@ -21,7 +21,7 @@ export type NoSqlQueryConnection = { databaseId: string; containerId: string; endpoint: string; - masterKey: string; + masterKey?: string; isEmulator: boolean; }; diff --git a/src/docdb/commands/connectNoSqlContainer.ts b/src/docdb/commands/connectNoSqlContainer.ts index caaa41ea..74b5cc8e 100644 --- a/src/docdb/commands/connectNoSqlContainer.ts +++ b/src/docdb/commands/connectNoSqlContainer.ts @@ -7,16 +7,19 @@ import { IActionContext } from "@microsoft/vscode-azext-utils"; import { KeyValueStore } from "../../KeyValueStore"; import { ext } from "../../extensionVariables"; import { NoSqlQueryConnection, noSqlQueryConnectionKey } from "../NoSqlCodeLensProvider"; +import { getCosmosKeyCredential } from "../getCosmosClient"; import { DocDBCollectionTreeItem } from "../tree/DocDBCollectionTreeItem"; import { pickDocDBAccount } from "./pickDocDBAccount"; export function setConnectedNoSqlContainer(node: DocDBCollectionTreeItem): void { + const root = node.root; + const keyCred = getCosmosKeyCredential(root.credentials); const noSqlQueryConnection: NoSqlQueryConnection = { databaseId: node.parent.id, containerId: node.id, - endpoint: node.root.endpoint, - masterKey: node.root.masterKey, - isEmulator: !!node.root.isEmulator + endpoint: root.endpoint, + masterKey: keyCred?.key, + isEmulator: !!root.isEmulator }; KeyValueStore.instance.set(noSqlQueryConnectionKey, noSqlQueryConnection); ext.noSqlCodeLensProvider.updateCodeLens(); diff --git a/src/docdb/commands/executeNoSqlQuery.ts b/src/docdb/commands/executeNoSqlQuery.ts index cdfd76c9..77352633 100644 --- a/src/docdb/commands/executeNoSqlQuery.ts +++ b/src/docdb/commands/executeNoSqlQuery.ts @@ -10,7 +10,7 @@ import { KeyValueStore } from "../../KeyValueStore"; import { localize } from "../../utils/localize"; import * as vscodeUtil from "../../utils/vscodeUtils"; import { NoSqlQueryConnection, noSqlQueryConnectionKey } from "../NoSqlCodeLensProvider"; -import { getCosmosClient } from "../getCosmosClient"; +import { CosmosDBCredential, getCosmosClient } from "../getCosmosClient"; export async function executeNoSqlQuery(_context: IActionContext, args: { queryText: string, populateQueryMetrics?: boolean }): Promise { let queryText: string; @@ -33,7 +33,12 @@ export async function executeNoSqlQuery(_context: IActionContext, args: { queryT } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { databaseId, containerId, endpoint, masterKey, isEmulator } = connectedCollection as NoSqlQueryConnection; - const client = getCosmosClient(endpoint, masterKey, isEmulator); + const credentials: CosmosDBCredential[] = []; + if (masterKey !== undefined) { + credentials.push({ type: "key", key: masterKey }); + } + credentials.push({ type: "auth" }); + const client = getCosmosClient(endpoint, credentials, isEmulator); const options = { populateQueryMetrics }; const response = await client.database(databaseId).container(containerId).items.query(queryText, options).fetchAll(); const resultDocumentTitle = `query results for ${containerId}`; diff --git a/src/docdb/commands/getNoSqlQueryPlan.ts b/src/docdb/commands/getNoSqlQueryPlan.ts index 524bb8d3..c16f04df 100644 --- a/src/docdb/commands/getNoSqlQueryPlan.ts +++ b/src/docdb/commands/getNoSqlQueryPlan.ts @@ -10,7 +10,7 @@ import { KeyValueStore } from "../../KeyValueStore"; import { localize } from "../../utils/localize"; import * as vscodeUtil from "../../utils/vscodeUtils"; import { NoSqlQueryConnection, noSqlQueryConnectionKey } from "../NoSqlCodeLensProvider"; -import { getCosmosClient } from "../getCosmosClient"; +import { CosmosDBCredential, getCosmosClient } from "../getCosmosClient"; export async function getNoSqlQueryPlan(_context: IActionContext, args: { queryText: string } | undefined): Promise { let queryText: string; @@ -30,7 +30,12 @@ export async function getNoSqlQueryPlan(_context: IActionContext, args: { queryT } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { databaseId, containerId, endpoint, masterKey, isEmulator } = connectedCollection as NoSqlQueryConnection; - const client = getCosmosClient(endpoint, masterKey, isEmulator); + const credentials: CosmosDBCredential[] = []; + if (masterKey !== undefined) { + credentials.push({ type: "key", key: masterKey }); + } + credentials.push({ type: "auth" }); + const client = getCosmosClient(endpoint, credentials, isEmulator); const response = await client.database(databaseId).container(containerId).getQueryPlan(queryText); await vscodeUtil.showNewFile(JSON.stringify(response.result, undefined, 2), `query results for ${containerId}`, ".json", ViewColumn.Beside); } diff --git a/src/docdb/getCosmosClient.ts b/src/docdb/getCosmosClient.ts index d81f2907..de4c658b 100644 --- a/src/docdb/getCosmosClient.ts +++ b/src/docdb/getCosmosClient.ts @@ -9,10 +9,66 @@ import * as https from "https"; import * as vscode from 'vscode'; import { ext } from "../extensionVariables"; -export function getCosmosClient(endpoint: string, key: string, isEmulator: boolean | undefined): CosmosClient { +// eslint-disable-next-line import/no-internal-modules +import { getSessionFromVSCode } from "@microsoft/vscode-azext-azureauth/out/src/getSessionFromVSCode"; + +export type CosmosDBKeyCredential = { + type: "key"; + key: string; +}; + +export type CosmosDBAuthCredential = { + type: "auth"; +}; + +export type CosmosDBCredential = CosmosDBKeyCredential | CosmosDBAuthCredential; + +export function getCosmosKeyCredential(credentials: CosmosDBCredential[]): CosmosDBKeyCredential | undefined { + return credentials.filter((cred): cred is CosmosDBKeyCredential => cred.type === "key")[0]; +} + +export function getCosmosAuthCredential(credentials: CosmosDBCredential[]): CosmosDBAuthCredential | undefined { + return credentials.filter((cred): cred is CosmosDBAuthCredential => cred.type === "auth")[0]; +} + +export function getCosmosClient( + endpoint: string, + credentials: CosmosDBCredential[], + isEmulator: boolean | undefined +): CosmosClient { const vscodeStrictSSL: boolean | undefined = vscode.workspace.getConfiguration().get(ext.settingsKeys.vsCode.proxyStrictSSL); const enableEndpointDiscovery: boolean | undefined = vscode.workspace.getConfiguration().get(ext.settingsKeys.enableEndpointDiscovery); const connectionPolicy = { enableEndpointDiscovery: (enableEndpointDiscovery === undefined) ? true : enableEndpointDiscovery }; - return new CosmosClient({ endpoint, key, userAgentSuffix: appendExtensionUserAgent(), agent: new https.Agent({ rejectUnauthorized: isEmulator ? !isEmulator : vscodeStrictSSL }), connectionPolicy: connectionPolicy }); + const keyCred = getCosmosKeyCredential(credentials); + const authCred = getCosmosAuthCredential(credentials); + + const commonProperties = { + endpoint, + userAgentSuffix: appendExtensionUserAgent(), + agent: new https.Agent({ rejectUnauthorized: isEmulator ? !isEmulator : vscodeStrictSSL }), + connectionPolicy + }; + // @todo: Add telemetry to monitor usage of each credential type + if (keyCred) { + return new CosmosClient({ + ...commonProperties, + key: keyCred.key + }); + } else if (authCred) { + return new CosmosClient({ + ...commonProperties, + aadCredentials: { + getToken: async (scopes, _options) => { + const session = await getSessionFromVSCode(scopes, undefined, { createIfNone: true }); + return { + token: session?.accessToken ?? "", + expiresOnTimestamp: 0 + }; + } + } + }); + } else { + throw Error("No credential available to create CosmosClient."); + } } diff --git a/src/docdb/tree/DocDBAccountTreeItemBase.ts b/src/docdb/tree/DocDBAccountTreeItemBase.ts index da9eec6b..770af909 100644 --- a/src/docdb/tree/DocDBAccountTreeItemBase.ts +++ b/src/docdb/tree/DocDBAccountTreeItemBase.ts @@ -12,7 +12,7 @@ import { deleteCosmosDBAccount } from '../../commands/deleteDatabaseAccount/dele import { SERVERLESS_CAPABILITY_NAME, getThemeAgnosticIconPath } from '../../constants'; import { nonNullProp } from '../../utils/nonNull'; import { rejectOnTimeout } from '../../utils/timeout'; -import { getCosmosClient } from '../getCosmosClient'; +import { CosmosDBCredential, getCosmosClient, getCosmosKeyCredential } from '../getCosmosClient'; import { DocDBTreeItemBase } from './DocDBTreeItemBase'; /** @@ -24,22 +24,38 @@ export abstract class DocDBAccountTreeItemBase extends DocDBTreeItemBase getCosmosClient(endpoint, masterKey, isEmulator) + getCosmosClient: () => getCosmosClient(endpoint, credentials, isEmulator) }; - this.valuesToMask.push(id, endpoint, masterKey); + const keys = credentials + .map((cred) => cred.type === "key" ? cred.key : undefined) + .filter((value): value is string => value !== undefined); + this.valuesToMask.push(id, endpoint, ...keys); } public get connectionString(): string { - return `AccountEndpoint=${this.root.endpoint};AccountKey=${this.root.masterKey}`; + const firstKey = getCosmosKeyCredential(this.root.credentials); + if (firstKey) { + return `AccountEndpoint=${this.root.endpoint};AccountKey=${firstKey.key}`; + } else { + return `AccountEndpoint=${this.root.endpoint}`; + } } public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } { diff --git a/src/docdb/tree/DocDBDocumentTreeItem.ts b/src/docdb/tree/DocDBDocumentTreeItem.ts index 434a6639..f722f4cd 100644 --- a/src/docdb/tree/DocDBDocumentTreeItem.ts +++ b/src/docdb/tree/DocDBDocumentTreeItem.ts @@ -106,7 +106,7 @@ export class DocDBDocumentTreeItem extends AzExtTreeItem implements IEditableTre } } - private getPartitionKeyValue(): string | undefined { + private getPartitionKeyValue(): string | number | undefined { const partitionKey = this.parent.parent.partitionKey; if (!partitionKey) { //Fixed collections -> no partitionKeyValue return undefined; diff --git a/src/docdb/tree/IDocDBTreeRoot.ts b/src/docdb/tree/IDocDBTreeRoot.ts index 9179eb45..854fb7a2 100644 --- a/src/docdb/tree/IDocDBTreeRoot.ts +++ b/src/docdb/tree/IDocDBTreeRoot.ts @@ -5,10 +5,11 @@ *--------------------------------------------------------------------------------------------*/ import { CosmosClient } from "@azure/cosmos"; +import { CosmosDBCredential } from "../getCosmosClient"; export interface IDocDBTreeRoot { endpoint: string; - masterKey: string; + credentials: CosmosDBCredential[]; isEmulator: boolean | undefined; getCosmosClient(): CosmosClient; } diff --git a/src/graph/tree/GraphAccountTreeItem.ts b/src/graph/tree/GraphAccountTreeItem.ts index 7e1f561f..f4398113 100644 --- a/src/graph/tree/GraphAccountTreeItem.ts +++ b/src/graph/tree/GraphAccountTreeItem.ts @@ -6,9 +6,10 @@ import { DatabaseAccountGetResults } from '@azure/arm-cosmosdb/src/models'; import { DatabaseDefinition, Resource } from '@azure/cosmos'; import { AzExtParentTreeItem } from '@microsoft/vscode-azext-utils'; +import { CosmosDBCredential } from '../../docdb/getCosmosClient'; import { DocDBAccountTreeItemBase } from '../../docdb/tree/DocDBAccountTreeItemBase'; -import { DocDBStoredProceduresTreeItem } from '../../docdb/tree/DocDBStoredProceduresTreeItem'; import { DocDBStoredProcedureTreeItem } from '../../docdb/tree/DocDBStoredProcedureTreeItem'; +import { DocDBStoredProceduresTreeItem } from '../../docdb/tree/DocDBStoredProceduresTreeItem'; import { IGremlinEndpoint } from '../../vscode-cosmosdbgraph.api'; import { GraphCollectionTreeItem } from './GraphCollectionTreeItem'; import { GraphDatabaseTreeItem } from './GraphDatabaseTreeItem'; @@ -18,8 +19,17 @@ export class GraphAccountTreeItem extends DocDBAccountTreeItemBase { public static contextValue: string = "cosmosDBGraphAccount"; public contextValue: string = GraphAccountTreeItem.contextValue; - constructor(parent: AzExtParentTreeItem, id: string, label: string, documentEndpoint: string, private _gremlinEndpoint: IGremlinEndpoint | undefined, masterKey: string, isEmulator: boolean | undefined, readonly databaseAccount?: DatabaseAccountGetResults) { - super(parent, id, label, documentEndpoint, masterKey, isEmulator, databaseAccount); + constructor( + parent: AzExtParentTreeItem, + id: string, + label: string, + documentEndpoint: string, + private _gremlinEndpoint: IGremlinEndpoint | undefined, + credentials: CosmosDBCredential[], + isEmulator: boolean | undefined, + readonly databaseAccount?: DatabaseAccountGetResults + ) { + super(parent, id, label, documentEndpoint, credentials, isEmulator, databaseAccount); this.valuesToMask.push(documentEndpoint); if (_gremlinEndpoint) { this.valuesToMask.push(_gremlinEndpoint.host); diff --git a/src/tree/AttachedAccountsTreeItem.ts b/src/tree/AttachedAccountsTreeItem.ts index d854e506..25d2ead6 100644 --- a/src/tree/AttachedAccountsTreeItem.ts +++ b/src/tree/AttachedAccountsTreeItem.ts @@ -10,6 +10,7 @@ import { API, getExperienceFromApi, getExperienceQuickPick, getExperienceQuickPi import { removeTreeItemFromCache } from '../commands/api/apiCache'; import { emulatorPassword, isWindows } from '../constants'; import { parseDocDBConnectionString } from '../docdb/docDBConnectionStrings'; +import { CosmosDBCredential } from '../docdb/getCosmosClient'; import { DocDBAccountTreeItem } from '../docdb/tree/DocDBAccountTreeItem'; import { DocDBAccountTreeItemBase } from '../docdb/tree/DocDBAccountTreeItemBase'; import { ext } from '../extensionVariables'; @@ -332,15 +333,17 @@ export class AttachedAccountsTreeItem extends AzExtParentTreeItem { const parsedCS = parseDocDBConnectionString(connectionString); label = label || `${parsedCS.accountId} (${getExperienceFromApi(api).shortName})`; + + const credentials: CosmosDBCredential[] = [{ type: "key", key: parsedCS.masterKey }]; switch (api) { case API.Table: - treeItem = new TableAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, parsedCS.masterKey, isEmulator); + treeItem = new TableAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, credentials, isEmulator); break; case API.Graph: - treeItem = new GraphAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, undefined, parsedCS.masterKey, isEmulator); + treeItem = new GraphAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, undefined, credentials, isEmulator); break; case API.Core: - treeItem = new DocDBAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, parsedCS.masterKey, isEmulator); + treeItem = new DocDBAccountTreeItem(this, parsedCS.accountId, label, parsedCS.documentEndpoint, credentials, isEmulator); break; default: throw new Error(`Unexpected defaultExperience "${api}".`); diff --git a/src/tree/SubscriptionTreeItem.ts b/src/tree/SubscriptionTreeItem.ts index 910d8d97..8c248dc5 100644 --- a/src/tree/SubscriptionTreeItem.ts +++ b/src/tree/SubscriptionTreeItem.ts @@ -5,10 +5,11 @@ import { CosmosDBManagementClient } from '@azure/arm-cosmosdb'; import { DatabaseAccountGetResults, DatabaseAccountListKeysResult } from '@azure/arm-cosmosdb/src/models'; -import { getResourceGroupFromId, ILocationWizardContext, LocationListStep, ResourceGroupListStep, SubscriptionTreeItemBase, uiUtils } from '@microsoft/vscode-azext-azureutils'; +import { ILocationWizardContext, LocationListStep, ResourceGroupListStep, SubscriptionTreeItemBase, getResourceGroupFromId, uiUtils } from '@microsoft/vscode-azext-azureutils'; import { AzExtParentTreeItem, AzExtTreeItem, AzureWizard, AzureWizardPromptStep, IActionContext } from '@microsoft/vscode-azext-utils'; import * as vscode from 'vscode'; import { API, Experience, getExperienceLabel, tryGetExperience } from '../AzureDBExperiences'; +import { CosmosDBCredential } from '../docdb/getCosmosClient'; import { DocDBAccountTreeItem } from "../docdb/tree/DocDBAccountTreeItem"; import { ext } from '../extensionVariables'; import { tryGetGremlinEndpointFromAzure } from '../graph/gremlinEndpoints'; @@ -16,7 +17,7 @@ import { GraphAccountTreeItem } from "../graph/tree/GraphAccountTreeItem"; import { MongoAccountTreeItem } from '../mongo/tree/MongoAccountTreeItem'; import { PostgresAbstractServer, PostgresServerType } from '../postgres/abstract/models'; import { IPostgresServerWizardContext } from '../postgres/commands/createPostgresServer/IPostgresServerWizardContext'; -import { createPostgresConnectionString, ParsedPostgresConnectionString, parsePostgresConnectionString } from '../postgres/postgresConnectionStrings'; +import { ParsedPostgresConnectionString, createPostgresConnectionString, parsePostgresConnectionString } from '../postgres/postgresConnectionStrings'; import { PostgresServerTreeItem } from '../postgres/tree/PostgresServerTreeItem'; import { TableAccountTreeItem } from "../table/tree/TableAccountTreeItem"; import { createActivityContext } from '../utils/activityUtils'; @@ -133,19 +134,34 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase { // Use the default connection string return new MongoAccountTreeItem(parent, id, label, connectionString.toString(), isEmulator, databaseAccount); } else { - const keyResult: DatabaseAccountListKeysResult = await client.databaseAccounts.listKeys(resourceGroup, name); - const primaryMasterKey: string = nonNullProp(keyResult, 'primaryMasterKey'); + let keyResult: DatabaseAccountListKeysResult | undefined; + try { + keyResult = await client.databaseAccounts.listKeys(resourceGroup, name); + } catch (error) { + // If the client failed to list keys, proceed without using keys + } + + let keyCred = keyResult?.primaryMasterKey ? { + type: "key", + key: keyResult.primaryMasterKey + } : undefined; + const testCosmosAuth = vscode.workspace.getConfiguration().get("azureDatabases.testCosmosAuth"); + if (testCosmosAuth) { + keyCred = undefined; + } + const authCred = { type: "auth" }; + const credentials = [keyCred, authCred].filter((cred): cred is CosmosDBCredential => cred !== undefined); switch (experience && experience.api) { case "Table": - return new TableAccountTreeItem(parent, id, label, documentEndpoint, primaryMasterKey, isEmulator, databaseAccount); + return new TableAccountTreeItem(parent, id, label, documentEndpoint, credentials, isEmulator, databaseAccount); case "Graph": { const gremlinEndpoint = await tryGetGremlinEndpointFromAzure(client, resourceGroup, name); - return new GraphAccountTreeItem(parent, id, label, documentEndpoint, gremlinEndpoint, primaryMasterKey, isEmulator, databaseAccount); + return new GraphAccountTreeItem(parent, id, label, documentEndpoint, gremlinEndpoint, credentials, isEmulator, databaseAccount); } case "Core": default: // Default to DocumentDB, the base type for all Cosmos DB Accounts - return new DocDBAccountTreeItem(parent, id, label, documentEndpoint, primaryMasterKey, isEmulator, databaseAccount); + return new DocDBAccountTreeItem(parent, id, label, documentEndpoint, credentials, isEmulator, databaseAccount); } }