From d4b166060697994830ce36f0e926bf37557db1bd Mon Sep 17 00:00:00 2001 From: Rong <58057861+Rong5180@users.noreply.github.com> Date: Tue, 11 Jan 2022 15:21:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91,=E5=AE=8C=E6=88=90=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=85=BC=E5=AE=B9=20(#270)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修改更新逻辑,完成旧版本兼容 * fix: 完善更新逻辑,兼容老项目 * fix: 修改output输出服务名 Co-authored-by: rongxwang --- src/modules/apigw/index.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/modules/apigw/index.ts b/src/modules/apigw/index.ts index fe79ab2..e213ef6 100644 --- a/src/modules/apigw/index.ts +++ b/src/modules/apigw/index.ts @@ -240,6 +240,8 @@ export default class Apigw { oldState = {}, serviceId, isAutoRelease = true, + serviceName, + serviceDesc, } = inputs; inputs.protocols = getProtocolString(inputs.protocols as ('http' | 'https')[]); @@ -248,6 +250,27 @@ export default class Apigw { const detail = await this.service.getById(serviceId); if (detail) { + // 如果 serviceName,serviceDesc,protocols任意字段更新了,则更新服务 + if ( + !(serviceName === detail.ServiceName && serviceDesc === detail.ServiceDesc) && + !(serviceName === undefined && serviceDesc === undefined) + ) { + const apiInputs = { + Action: 'ModifyService' as const, + serviceId, + serviceDesc: serviceDesc || detail.ServiceDesc || undefined, + serviceName: serviceName || detail.ServiceName || undefined, + }; + if (!serviceName) { + delete apiInputs.serviceName; + } + if (!serviceDesc) { + delete apiInputs.serviceDesc; + } + + await this.request(apiInputs); + } + const apiList: ApiEndpoint[] = await this.api.bulkDeploy({ apiList: endpoints, stateList: stateApiList, @@ -269,7 +292,7 @@ export default class Apigw { const outputs: ApigwDeployOutputs = { created: false, serviceId, - serviceName: detail.ServiceName, + serviceName: serviceName || detail.ServiceName, subDomain: subDomain, protocols: inputs.protocols, environment: environment, @@ -291,7 +314,8 @@ export default class Apigw { })); } - return this.formatApigwOutputs(outputs); + // return this.formatApigwOutputs(outputs); + return outputs; } throw new ApiError({ type: 'API_APIGW_DescribeService', From 1a9470fcd69505a80774f318459273095ac29cff Mon Sep 17 00:00:00 2001 From: slsplus Date: Tue, 11 Jan 2022 07:21:49 +0000 Subject: [PATCH 2/2] chore(release): version 2.23.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [2.23.1](https://github.com/serverless-tencent/tencent-component-toolkit/compare/v2.23.0...v2.23.1) (2022-01-11) ### Bug Fixes * 修改更新逻辑,完成旧版本兼容 ([#270](https://github.com/serverless-tencent/tencent-component-toolkit/issues/270)) ([d4b1660](https://github.com/serverless-tencent/tencent-component-toolkit/commit/d4b166060697994830ce36f0e926bf37557db1bd)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7ab755..417792b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.23.1](https://github.com/serverless-tencent/tencent-component-toolkit/compare/v2.23.0...v2.23.1) (2022-01-11) + + +### Bug Fixes + +* 修改更新逻辑,完成旧版本兼容 ([#270](https://github.com/serverless-tencent/tencent-component-toolkit/issues/270)) ([d4b1660](https://github.com/serverless-tencent/tencent-component-toolkit/commit/d4b166060697994830ce36f0e926bf37557db1bd)) + # [2.23.0](https://github.com/serverless-tencent/tencent-component-toolkit/compare/v2.22.2...v2.23.0) (2022-01-10) diff --git a/package.json b/package.json index 8341cfe..4b4db07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tencent-component-toolkit", - "version": "2.23.0", + "version": "2.23.1", "description": "Tencent component toolkit", "main": "lib/index.js", "types": "lib/index.d.ts",