From 3afdc1c86f6d0429e5e0289993e64b5c677aa2de Mon Sep 17 00:00:00 2001 From: Ismayil Ismayilov Date: Wed, 4 Sep 2024 02:12:07 +0400 Subject: [PATCH] Remove workaround method and align on gallery resource arrea --- app/exec/extension/default.ts | 10 ++-------- app/exec/extension/isvalid.ts | 2 +- app/exec/extension/publish.ts | 2 +- app/exec/extension/share.ts | 2 +- app/exec/extension/show.ts | 2 +- app/exec/extension/unpublish.ts | 2 +- app/exec/extension/unshare.ts | 2 +- package-lock.json | 2 +- package.json | 2 +- 9 files changed, 10 insertions(+), 16 deletions(-) diff --git a/app/exec/extension/default.ts b/app/exec/extension/default.ts index bfc01fc..764e07c 100644 --- a/app/exec/extension/default.ts +++ b/app/exec/extension/default.ts @@ -318,16 +318,10 @@ export class ExtensionBase extends TfCommand { return this.getHelp(cmd); } - /**** TEMPORARY until Marketplace fixes getResourceArea ****/ - protected async getGalleryApi() { - const handler = await this.getCredentials(this.webApi.serverUrl, false); - return new GalleryApi(this.webApi.serverUrl, [handler]); // await this.webApi.getGalleryApi(this.webApi.serverUrl); - } - /**** TEMPORARY until Marketplace fixes getResourceArea ****/ - public static async getMarketplaceUrl(): Promise { + const RESOURCE_AREA_ID = "69D21C00-F135-441B-B5CE-3626378E0819" trace.debug("getMarketplaceUrl"); - const url = "https://app.vssps.visualstudio.com/_apis/resourceareas/69D21C00-F135-441B-B5CE-3626378E0819"; + const url = `https://app.vssps.visualstudio.com/_apis/resourceareas/${RESOURCE_AREA_ID}`; const response = await new Promise((resolve, reject) => { https .get(url, resp => { diff --git a/app/exec/extension/isvalid.ts b/app/exec/extension/isvalid.ts index 0bcc5c1..6d050f1 100644 --- a/app/exec/extension/isvalid.ts +++ b/app/exec/extension/isvalid.ts @@ -38,7 +38,7 @@ export class ExtensionIsValid extends extBase.ExtensionBase { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl); const extInfo = await this.identifyExtension(); const version = await this.commandArgs.version.val(); diff --git a/app/exec/extension/publish.ts b/app/exec/extension/publish.ts index 9af49d4..dcc96f5 100644 --- a/app/exec/extension/publish.ts +++ b/app/exec/extension/publish.ts @@ -69,7 +69,7 @@ export class ExtensionPublish extends extBase.ExtensionBase { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl) let result = {}; const publishSettings = await this.getPublishSettings(); diff --git a/app/exec/extension/share.ts b/app/exec/extension/share.ts index 7ba485d..f459ee8 100644 --- a/app/exec/extension/share.ts +++ b/app/exec/extension/share.ts @@ -37,7 +37,7 @@ export class ExtensionShare extends extBase.ExtensionBase { } public async exec(): Promise { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl); return this.commandArgs.vsix.val(true).then(vsixPath => { let extInfoPromise: Promise; diff --git a/app/exec/extension/show.ts b/app/exec/extension/show.ts index b909841..f7187d4 100644 --- a/app/exec/extension/show.ts +++ b/app/exec/extension/show.ts @@ -27,7 +27,7 @@ export class ExtensionShow extends extBase.ExtensionBase { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl); return this.identifyExtension().then(extInfo => { let sharingMgr = new publishUtils.SharingManager({}, galleryApi, extInfo); diff --git a/app/exec/extension/unpublish.ts b/app/exec/extension/unpublish.ts index 7774b2c..87d6740 100644 --- a/app/exec/extension/unpublish.ts +++ b/app/exec/extension/unpublish.ts @@ -27,7 +27,7 @@ export class ExtensionUnpublish extends extBase.ExtensionBase { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl); const extInfo = await this.identifyExtension(); await galleryApi.deleteExtension(extInfo.publisher, extInfo.id); diff --git a/app/exec/extension/unshare.ts b/app/exec/extension/unshare.ts index fb9e05f..ae1942f 100644 --- a/app/exec/extension/unshare.ts +++ b/app/exec/extension/unshare.ts @@ -38,7 +38,7 @@ export class ExtensionShare extends extBase.ExtensionBase { } public async exec(): Promise { - const galleryApi = await this.getGalleryApi(); + const galleryApi = await this.webApi.getGalleryApi(this.webApi.serverUrl); return this.commandArgs.vsix.val(true).then(vsixPath => { let extInfoPromise: Promise; diff --git a/package-lock.json b/package-lock.json index 4dfe774..012763b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "tfx-cli", - "version": "0.17.0", + "version": "0.18.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ec7de20..ffab844 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tfx-cli", - "version": "0.17.0", + "version": "0.18.0", "description": "CLI for Azure DevOps Services and Team Foundation Server", "repository": { "type": "git",