From 63312b481f1886121eadc0b1d951aa6034f58c61 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Mon, 11 Nov 2024 20:47:31 +0000 Subject: [PATCH 1/7] 'npm audit fix' --- package-lock.json | 141 +++++++++++++++++++++++++++------------------- 1 file changed, 84 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index e82a62a..84b768e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "ts-loader": "^9.5.1", "tslint": "^5.20.1", "typescript": "^5.3.3", - "webpack": "^5.94.0", + "webpack": "^5.95.0", "webpack-cli": "^5.1.4" }, "engines": { @@ -196,11 +196,34 @@ "node": ">= 6" } }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" }, "node_modules/@types/glob": { "version": "7.1.2", @@ -537,10 +560,11 @@ "dev": true }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -548,15 +572,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", - "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "dev": true, - "peerDependencies": { - "acorn": "^8" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -696,9 +711,9 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.23.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", - "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "dev": true, "funding": [ { @@ -714,11 +729,12 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001646", - "electron-to-chromium": "^1.5.4", + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", "node-releases": "^2.0.18", - "update-browserslist-db": "^1.1.0" + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -743,9 +759,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001655", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz", - "integrity": "sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==", + "version": "1.0.30001680", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", + "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", "dev": true, "funding": [ { @@ -760,7 +776,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/chalk": { "version": "2.4.2", @@ -972,10 +989,11 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz", - "integrity": "sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==", - "dev": true + "version": "1.5.56", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz", + "integrity": "sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw==", + "dev": true, + "license": "ISC" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -1710,16 +1728,17 @@ "dev": true }, "node_modules/micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" + "braces": "^3.0.3", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=8" + "node": ">=8.6" } }, "node_modules/mime-db": { @@ -1960,7 +1979,8 @@ "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -2078,18 +2098,23 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pkg-dir": { @@ -2834,9 +2859,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", - "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", "dev": true, "funding": [ { @@ -2852,9 +2877,10 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" + "escalade": "^3.2.0", + "picocolors": "^1.1.0" }, "bin": { "update-browserslist-db": "cli.js" @@ -2892,18 +2918,19 @@ } }, "node_modules/webpack": { - "version": "5.94.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", - "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "version": "5.96.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.96.1.tgz", + "integrity": "sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA==", "dev": true, + "license": "MIT", "dependencies": { - "@types/estree": "^1.0.5", + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", From 527f96f11faec9faab90c27dc49d186fb8e4c7a2 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 08:09:16 +0000 Subject: [PATCH 2/7] Bump version to 3.8 and require VS Code 1.93 --- package-lock.json | 28 +++++++++++++++------------- package.json | 8 ++++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84b768e..b1bfd7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,23 +1,23 @@ { "name": "servermanager", - "version": "3.6.3-SNAPSHOT", + "version": "3.8.0-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "servermanager", - "version": "3.6.3-SNAPSHOT", + "version": "3.8.0-SNAPSHOT", "license": "MIT", "dependencies": { "axios": "^1.7.4", "node-cmd": "^5.0.0" }, "devDependencies": { - "@intersystems-community/intersystems-servermanager": "^3.4.1", + "@intersystems-community/intersystems-servermanager": "^3.8.0-beta.2", "@types/glob": "^7.1.1", "@types/mocha": "^9.0.0", "@types/node": "^14.18.0", - "@types/vscode": "^1.75.0", + "@types/vscode": "^1.93.0", "@vscode/test-electron": "^2.3.8", "glob": "^7.1.6", "mocha": "^9.2.2", @@ -29,7 +29,7 @@ "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.75.0" + "vscode": "^1.93.0" } }, "node_modules/@babel/code-frame": { @@ -68,10 +68,11 @@ } }, "node_modules/@intersystems-community/intersystems-servermanager": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@intersystems-community/intersystems-servermanager/-/intersystems-servermanager-3.4.1.tgz", - "integrity": "sha512-H3Kro3f/OcM+wXRhZpo9MPEEk4A4He+mVnGXEh2MYdwBEaOH83bfI6b9orJqFq7q4Vww9+1mZfs6IGEQydV/QQ==", - "dev": true + "version": "3.8.0-beta.2", + "resolved": "https://registry.npmjs.org/@intersystems-community/intersystems-servermanager/-/intersystems-servermanager-3.8.0-beta.2.tgz", + "integrity": "sha512-jBU4b04CKHupopACB+Tkdxj6WQPOW9lzYuDhcuBQxCK9O+m1Da4x9fGzAjGeRg6T2uKJkegjOD3/4uammgaGgg==", + "dev": true, + "license": "MIT" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -260,10 +261,11 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.80.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.80.0.tgz", - "integrity": "sha512-qK/CmOdS2o7ry3k6YqU4zD3R2AYlJfbwBoSbKpBoP+GpXNE+0NEgJOli4n0bm0diK5kfBnchgCEj4igQz/44Hg==", - "dev": true + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.95.0.tgz", + "integrity": "sha512-0LBD8TEiNbet3NvWsmn59zLzOFu/txSlGxnv5yAFHCrhG9WvAnR3IvfHzMOs2aeWqgvNjq9pO99IUw8d3n+unw==", + "dev": true, + "license": "MIT" }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", diff --git a/package.json b/package.json index 44f0574..8b620bb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "servermanager", "displayName": "InterSystems Server Manager", - "version": "3.6.3-SNAPSHOT", + "version": "3.8.0-SNAPSHOT", "publisher": "intersystems-community", "description": "Define connections to InterSystems servers. Browse and manage those servers.", "repository": { @@ -15,7 +15,7 @@ "multi-root ready" ], "engines": { - "vscode": "^1.75.0" + "vscode": "^1.93.0" }, "icon": "images/logo.png", "categories": [ @@ -52,8 +52,8 @@ "node-cmd": "^5.0.0" }, "devDependencies": { - "@intersystems-community/intersystems-servermanager": "^3.4.1", - "@types/vscode": "^1.75.0", + "@intersystems-community/intersystems-servermanager": "^3.8.0-beta.2", + "@types/vscode": "^1.93.0", "@types/glob": "^7.1.1", "@types/mocha": "^9.0.0", "@types/node": "^14.18.0", From d3dc80f80848ed3c036757283bc3b8d96326a2e0 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 08:12:47 +0000 Subject: [PATCH 3/7] Bump types package to beta 3.8 version --- types/package-lock.json | 4 ++-- types/package.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/package-lock.json b/types/package-lock.json index 37f3ad7..e16589d 100644 --- a/types/package-lock.json +++ b/types/package-lock.json @@ -1,12 +1,12 @@ { "name": "@intersystems-community/intersystems-servermanager", - "version": "3.0.0-beta.1", + "version": "3.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@intersystems-community/intersystems-servermanager", - "version": "3.0.0-beta.1", + "version": "3.8.0", "license": "MIT", "devDependencies": { "rimraf": "^3.0.0" diff --git a/types/package.json b/types/package.json index b601f75..98f9861 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@intersystems-community/intersystems-servermanager", - "version": "3.4.1", + "version": "3.8.0-beta.2", "description": "InterSystems Server Manager VS Code extension API interfaces and constants", "types": "index.d.ts", "main": "index.js", @@ -32,6 +32,7 @@ "url": "https://github.com/intersystems-community/intersystems-servermanager/issues" }, "devDependencies": { + "@types/vscode": "^1.93.0", "rimraf": "^3.0.0" } } From b62ed047916b5107b0391dffbfa691863434d966 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 08:14:44 +0000 Subject: [PATCH 4/7] Add API signature info to @intersystems-community/intersystems-servermanager --- types/README.md | 4 ++++ types/index.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/types/README.md b/types/README.md index 81d609c..1b99cf1 100644 --- a/types/README.md +++ b/types/README.md @@ -6,6 +6,10 @@ Package defining the interfaces used in the API that is published by the `inters # Changelog +### v3.8.0 + +- Add function signatures, including `getAccount` which was introduced in Server Manager 3.8.0. + ### v3.4.1 - Add optional `superServer` object. diff --git a/types/index.d.ts b/types/index.d.ts index 650f472..443c23f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,3 +1,5 @@ +import * as vscode from 'vscode'; + export const EXTENSION_ID: string; export const AUTHENTICATION_PROVIDER: string; @@ -30,3 +32,34 @@ export interface IJSONServerSpec { export interface IServerSpec extends IJSONServerSpec { name: string; } + +export interface ServerManagerAPI { + pickServer( + scope?: vscode.ConfigurationScope, + options?: vscode.QuickPickOptions, + ): Promise; + + getServerNames( + scope?: vscode.ConfigurationScope, + sorted?: boolean, + ): IServerName[]; + + getServerSummary( + name: string, + scope?: vscode.ConfigurationScope, + ): IServerName | undefined; + + getServerSpec( + name: string, + scope?: vscode.ConfigurationScope, + flushCredentialCache?: boolean, + options?: { hideFromRecents?: boolean, /* Obsolete */ noCredentials?: boolean }, + ): Promise; + + getAccount( + serverSpec: IServerSpec + ): vscode.AuthenticationSessionAccountInformation | undefined; + + onDidChangePassword( + ): vscode.Event; +} From c225dc6296dba2196994deeb83b88e9124ba9cf3 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 08:18:08 +0000 Subject: [PATCH 5/7] Add `getAccount` to API, and use it internally to fix overprompting --- src/authenticationProvider.ts | 12 +++++++++++- src/extension.ts | 12 +++++++++++- src/makeRESTRequest.ts | 6 ++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/authenticationProvider.ts b/src/authenticationProvider.ts index f203791..43634e1 100644 --- a/src/authenticationProvider.ts +++ b/src/authenticationProvider.ts @@ -2,6 +2,7 @@ import { authentication, AuthenticationProvider, AuthenticationProviderAuthenticationSessionsChangeEvent, + AuthenticationProviderSessionOptions, AuthenticationSession, Disposable, Event, @@ -56,7 +57,7 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid } // This function is called first when `vscode.authentication.getSession` is called. - public async getSessions(scopes: string[] = []): Promise { + public async getSessions(scopes: readonly string[] = [], options: AuthenticationProviderSessionOptions): Promise { await this._ensureInitialized(); let sessions = this._sessions; @@ -65,6 +66,15 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid sessions = sessions.filter((session) => session.scopes[index] === scopes[index].toLowerCase()); } + if (options.account) { + const accountParts = options.account.id.split("/"); + const serverName = accountParts.shift(); + const userName = accountParts.join('/').toLowerCase(); + if (serverName && userName) { + sessions = sessions.filter((session) => session.scopes[0] === serverName && session.scopes[1] === userName); + } + } + if (sessions.length === 1) { if (!(await this._isStillValid(sessions[0]))) { sessions = []; diff --git a/src/extension.ts b/src/extension.ts index 45aa478..26c2a17 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -16,6 +16,11 @@ import { NamespaceTreeItem, ProjectTreeItem, ServerManagerView, ServerTreeItem, export const extensionId = "intersystems-community.servermanager"; export let globalState: vscode.Memento; +export function getAccountFromParts(serverName: string, userName?: string): vscode.AuthenticationSessionAccountInformation | undefined { + const accountId = userName ? `${serverName}/${userName.toLowerCase()}` : undefined; + return accountId ? { id: accountId, label: `${userName} on ${serverName}` } : undefined; +} + export function activate(context: vscode.ExtensionContext) { const _onDidChangePassword = new vscode.EventEmitter(); @@ -43,10 +48,11 @@ export function activate(context: vscode.ExtensionContext) { // Still logged in with the authentication provider? const scopes = [serverSession.serverName, serverSession.username.toLowerCase()]; + const account = getAccountFromParts(serverSession.serverName, serverSession.username); const session = await vscode.authentication.getSession( AUTHENTICATION_PROVIDER, scopes, - { silent: true }, + { silent: true, account }, ); // If not, try to log out on the server, then remove our record of its cookies @@ -407,6 +413,10 @@ export function activate(context: vscode.ExtensionContext) { return spec; }, + getAccount(serverSpec: IServerSpec): vscode.AuthenticationSessionAccountInformation | undefined { + return getAccountFromParts(serverSpec.name, serverSpec.username); + }, + onDidChangePassword( ): vscode.Event { return _onDidChangePassword.event; diff --git a/src/makeRESTRequest.ts b/src/makeRESTRequest.ts index 1658212..ac1adf0 100644 --- a/src/makeRESTRequest.ts +++ b/src/makeRESTRequest.ts @@ -7,6 +7,7 @@ import * as vscode from "vscode"; import { AUTHENTICATION_PROVIDER } from "./authenticationProvider"; import { IServerSpec } from "@intersystems-community/intersystems-servermanager"; import { getServerSpec } from "./api/getServerSpec"; +import { getAccountFromParts } from "./extension"; export interface IServerSession { serverName: string; @@ -221,16 +222,17 @@ async function resolveCredentials(serverSpec: IServerSpec) { // This arises if setting says to use authentication provider if (typeof serverSpec.password === "undefined") { const scopes = [serverSpec.name, (serverSpec.username || "").toLowerCase()]; + const account = getAccountFromParts(serverSpec.name, serverSpec.username); let session = await vscode.authentication.getSession( AUTHENTICATION_PROVIDER, scopes, - { silent: true }, + { silent: true, account }, ); if (!session) { session = await vscode.authentication.getSession( AUTHENTICATION_PROVIDER, scopes, - { createIfNone: true }, + { createIfNone: true, account }, ); } if (session) { From cacb7468cbf30e7937eb95d7dbf6299465759eb3 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 08:30:18 +0000 Subject: [PATCH 6/7] Update README --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 162e79f..d6eccf8 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,12 @@ InterSystems Server Manager is a Visual Studio Code extension for defining conne See the [CHANGELOG](https://marketplace.visualstudio.com/items/intersystems-community.servermanager/changelog) for changes in each release. -# New in Version 3.6 - Date TBC -TODO +# New in Version 3.8 - November 2024 +- Updated the authentication provider to resolve overprompting caused by a VS Code 1.93 change. +- Added a new function (`getAccount`) to the API surface as a helper for extensions leveraging the authentication provider. + +# New in Version 3.6 - January 2024 +The view container was renamed and given a new icon as part of work integrating the ObjectScript extension's views with it. # New in Version 3.4 - July 2023 @@ -207,7 +211,7 @@ If a server has been named in `/default` it is promoted to the top of the list, The NPM package [`@intersystems-community/intersystems-servermanager`](https://www.npmjs.com/package/@intersystems-community/intersystems-servermanager) defines the types used by the API which this extension exports. It also declares some constants. -An extension XYZ needing to connect to InterSystems servers should include `"@intersystems-community/intersystems-servermanager": "latest"` in the `"devDependencies"` object in its `package.json`. +An extension XYZ needing to connect to InterSystems servers should include `"@intersystems-community/intersystems-servermanager": "^3.8.0"` in the `"devDependencies"` object in its `package.json`. It might also define Server Manager as a dependency in its `package.json` like this: @@ -240,7 +244,7 @@ Alternatively the `activate` method of XYZ can detect whether the extension is a XYZ can then use the extension's API to obtain the properties of a named server definition: ```ts - const serverManagerApi = extension.exports; + const serverManagerApi: serverManager.ServerManagerAPI = extension.exports; if (serverManagerApi && serverManagerApi.getServerSpec) { // defensive coding const serverSpec: serverManager.IServerSpec | undefined = await serverManagerApi.getServerSpec(serverName); } @@ -253,9 +257,10 @@ To obtain the password with which to connect, use code like this which will also ```ts if (typeof serverSpec.password === 'undefined') { const scopes = [serverSpec.name, serverSpec.username || '']; - let session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, { silent: true }); + const account = serverManagerApi.getAccount(serverSpec); + let session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, { silent: true, account }); if (!session) { - session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, { createIfNone: true }); + session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, { createIfNone: true, account }); } if (session) { serverSpec.username = session.scopes[1]; From 795fe9a07ad35bc4e414977fd2deeea929241ed3 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Tue, 12 Nov 2024 21:01:46 +0000 Subject: [PATCH 7/7] Finalize and publish types package 3.8.0 --- package-lock.json | 8 ++++---- package.json | 2 +- types/package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b1bfd7f..c6f5d1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "node-cmd": "^5.0.0" }, "devDependencies": { - "@intersystems-community/intersystems-servermanager": "^3.8.0-beta.2", + "@intersystems-community/intersystems-servermanager": "^3.8.0", "@types/glob": "^7.1.1", "@types/mocha": "^9.0.0", "@types/node": "^14.18.0", @@ -68,9 +68,9 @@ } }, "node_modules/@intersystems-community/intersystems-servermanager": { - "version": "3.8.0-beta.2", - "resolved": "https://registry.npmjs.org/@intersystems-community/intersystems-servermanager/-/intersystems-servermanager-3.8.0-beta.2.tgz", - "integrity": "sha512-jBU4b04CKHupopACB+Tkdxj6WQPOW9lzYuDhcuBQxCK9O+m1Da4x9fGzAjGeRg6T2uKJkegjOD3/4uammgaGgg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@intersystems-community/intersystems-servermanager/-/intersystems-servermanager-3.8.0.tgz", + "integrity": "sha512-D3/LoQXOsApLo07BLHipuibUYIQLz5MK57GWLtmtYIiNa2gJ0Igaz0Fv5SuZ+gdPL3tlN1g88iQ4vJ7E+arRiQ==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 8b620bb..6810497 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "node-cmd": "^5.0.0" }, "devDependencies": { - "@intersystems-community/intersystems-servermanager": "^3.8.0-beta.2", + "@intersystems-community/intersystems-servermanager": "^3.8.0", "@types/vscode": "^1.93.0", "@types/glob": "^7.1.1", "@types/mocha": "^9.0.0", diff --git a/types/package.json b/types/package.json index 98f9861..75b4144 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@intersystems-community/intersystems-servermanager", - "version": "3.8.0-beta.2", + "version": "3.8.0", "description": "InterSystems Server Manager VS Code extension API interfaces and constants", "types": "index.d.ts", "main": "index.js",