@microsoft/vscode-azext-azureutils
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -11,4 +11,5 @@ /*--------------------------------------------------------------------------------------------- | ||
import type { HttpOperationResponse, RequestPrepareOptions, ServiceClient } from '@azure/ms-rest-js'; | ||
import type { PagedAsyncIterableIterator } from '@azure/core-paging'; | ||
import { Disposable, Progress } from 'vscode'; | ||
import type { AzExtParentTreeItem, AzExtTreeItem, AzureNameStep, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNamingRules, IAzureQuickPickItem, IAzureQuickPickOptions, ISubscriptionActionContext, ISubscriptionContext, IWizardOptions, UIExtensionVariables } from '@microsoft/vscode-azext-utils'; | ||
import type { AzExtParentTreeItem, AzExtServiceClientCredentials, AzExtServiceClientCredentialsT1, AzExtServiceClientCredentialsT2, AzExtTreeItem, AzureNameStep, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNamingRules, IAzureQuickPickItem, IAzureQuickPickOptions, ISubscriptionActionContext, ISubscriptionContext, IWizardOptions, UIExtensionVariables } from '@microsoft/vscode-azext-utils'; | ||
import { ExtendedLocation, ResourceGroup } from '@azure/arm-resources'; | ||
@@ -377,42 +378,2 @@ import { StorageAccount } from '@azure/arm-storage'; | ||
/** | ||
* Loose type to use for T1 and T2 versions of "@azure/ms-rest-js". The Azure Account extension returns | ||
* credentials that will satisfy both T1 and T2 requirements | ||
*/ | ||
export type AzExtServiceClientCredentials = AzExtServiceClientCredentialsT1 & AzExtServiceClientCredentialsT2; | ||
/** | ||
* Loose interface to allow for the use of different versions of "@azure/ms-rest-js" | ||
* There's several cases where we don't control which "credentials" interface gets used, causing build errors even though the functionality itself seems to be compatible | ||
* For example: https://github.com/Azure/azure-sdk-for-js/issues/10045 | ||
* Used specifically for T1 Azure SDKs | ||
*/ | ||
export interface AzExtServiceClientCredentialsT1 { | ||
/** | ||
* Signs a request with the Authentication header. | ||
* | ||
* @param {WebResourceLike} webResource The WebResourceLike/request to be signed. | ||
* @returns {Promise<WebResourceLike>} The signed request object; | ||
*/ | ||
signRequest(webResource: any): Promise<any>; | ||
} | ||
/** | ||
* Loose interface to allow for the use of different versions of "@azure/ms-rest-js" | ||
* Used specifically for T2 Azure SDKs | ||
*/ | ||
export interface AzExtServiceClientCredentialsT2 { | ||
/** | ||
* Gets the token provided by this credential. | ||
* | ||
* This method is called automatically by Azure SDK client libraries. You may call this method | ||
* directly, but you must also handle token caching and token refreshing. | ||
* | ||
* @param scopes - The list of scopes for which the token will have access. | ||
* @param options - The options used to configure any requests this | ||
* TokenCredential implementation might make. | ||
*/ | ||
getToken(scopes?: string | string[], options?: any): Promise<any | null>; | ||
} | ||
/** | ||
* Credential type to be used for creating generic http rest clients | ||
@@ -467,1 +428,5 @@ */ | ||
export function createAzureSubscriptionClient<T>(context: AzExtClientContext, clientType: AzExtSubscriptionClientType<T>): T; | ||
export declare namespace uiUtils { | ||
export function listAllIterator<T>(iterator: PagedAsyncIterableIterator<T>): Promise<T[]> | ||
} |
@@ -22,2 +22,3 @@ "use strict"; | ||
__exportStar(require("./tree/SubscriptionTreeItemBase"), exports); | ||
__exportStar(require("./utils/uiUtils"), exports); | ||
__exportStar(require("./wizard/LocationListStep"), exports); | ||
@@ -24,0 +25,0 @@ __exportStar(require("./wizard/ResourceGroupCreateStep"), exports); |
@@ -17,4 +17,4 @@ "use strict"; | ||
path.join(__dirname, '..', '..', '..', 'resources') : | ||
path.join(__dirname, 'node_modules', '@microsoft/vscode-azext-utils', 'resources'); | ||
path.join(__dirname, 'node_modules', '@microsoft', 'vscode-azext-azureutils', 'resources'); | ||
} | ||
//# sourceMappingURL=IconPath.js.map |
@@ -39,3 +39,4 @@ "use strict"; | ||
uiUtils.listAll = listAll; | ||
function listAllIterator(list, options) { | ||
function listAllIterator(iterator) { | ||
var iterator_1, iterator_1_1; | ||
var e_1, _a; | ||
@@ -45,4 +46,4 @@ return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
for (var _b = __asyncValues(list(options)), _c; _c = yield _b.next(), !_c.done;) { | ||
const r = _c.value; | ||
for (iterator_1 = __asyncValues(iterator); iterator_1_1 = yield iterator_1.next(), !iterator_1_1.done;) { | ||
const r = iterator_1_1.value; | ||
resources.push(r); | ||
@@ -54,3 +55,3 @@ } | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b); | ||
if (iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return)) yield _a.call(iterator_1); | ||
} | ||
@@ -57,0 +58,0 @@ finally { if (e_1) throw e_1.error; } |
@@ -59,3 +59,3 @@ "use strict"; | ||
if (/concierge/i.test(wizardContext.subscriptionDisplayName)) { | ||
const rgs = yield uiUtils_1.uiUtils.listAllIterator(resourceClient.resourceGroups.list); | ||
const rgs = yield uiUtils_1.uiUtils.listAllIterator(resourceClient.resourceGroups.list()); | ||
if (rgs.length === 1 && rgs[0].name && /^learn/i.test(rgs[0].name)) { | ||
@@ -62,0 +62,0 @@ wizardContext.resourceGroup = rgs[0]; |
@@ -39,3 +39,3 @@ "use strict"; | ||
const client = yield (0, clients_1.createResourcesClient)(wizardContext); | ||
wizardContext.resourceGroupsTask = uiUtils_1.uiUtils.listAllIterator(client.resourceGroups.list); | ||
wizardContext.resourceGroupsTask = uiUtils_1.uiUtils.listAllIterator(client.resourceGroups.list()); | ||
} | ||
@@ -42,0 +42,0 @@ return yield wizardContext.resourceGroupsTask; |
@@ -79,3 +79,3 @@ "use strict"; | ||
const quickPickOptions = { placeHolder: 'Select a storage account.', id: `StorageAccountListStep/${wizardContext.subscriptionId}` }; | ||
const picksTask = this.getQuickPicks(wizardContext, uiUtils_1.uiUtils.listAllIterator(client.storageAccounts.list)); | ||
const picksTask = this.getQuickPicks(wizardContext, uiUtils_1.uiUtils.listAllIterator(client.storageAccounts.list())); | ||
const result = (yield wizardContext.ui.showQuickPick(picksTask, quickPickOptions)).data; | ||
@@ -82,0 +82,0 @@ wizardContext.storageAccount = result; |
{ | ||
"name": "@microsoft/vscode-azext-azureutils", | ||
"author": "Microsoft Corporation", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Common Azure utils for developing Azure extensions for VS Code", | ||
@@ -41,3 +41,3 @@ "tags": [ | ||
"@azure/ms-rest-js": "^2.2.1", | ||
"@microsoft/vscode-azext-utils": "file:../ui/microsoft-vscode-azext-utils-0.0.1.tgz", | ||
"@microsoft/vscode-azext-utils": "^0.0.2", | ||
"semver": "^5.7.1", | ||
@@ -48,2 +48,3 @@ "uuid": "^8.3.2", | ||
"devDependencies": { | ||
"@azure/core-paging": "^1.2.1", | ||
"@azure/ms-rest-azure-env": "^2.0.0", | ||
@@ -68,2 +69,2 @@ "@microsoft/eslint-config-azuretools": "^0.1.0", | ||
} | ||
} | ||
} |
144276
19
2393
+ Added@microsoft/vscode-azext-utils@0.0.2(transitive)
+ Added@vscode/extension-telemetry@0.4.10(transitive)
+ Addeddayjs@1.11.11(transitive)
+ Addeddefine-lazy-prop@2.0.0(transitive)
+ Addeddom-serializer@0.2.2(transitive)
+ Addeddomelementtype@1.3.12.3.0(transitive)
+ Addeddomhandler@2.4.2(transitive)
+ Addeddomutils@1.7.0(transitive)
+ Addedentities@1.1.22.2.0(transitive)
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedhe@1.2.0(transitive)
+ Addedhtml-to-text@5.1.1(transitive)
+ Addedhtmlparser2@3.10.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-docker@2.2.1(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedopen@8.4.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtas-client@0.2.33(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedvscode-tas-client@0.1.84(transitive)