From 3df4a979b0f3f37cc58bd78ef67ef5ffb20b76ef Mon Sep 17 00:00:00 2001 From: binsee <5285894+binsee@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:03:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E2=AC=86=EF=B8=8F=20upgrade=20dep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c75a6d18..fcb21ac1 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@chatie/eslint-config": "^1.0.4", "@chatie/semver": "^0.4.7", "@chatie/tsconfig": "^4.6.3", - "@juzi/wechaty-puppet": "^1.0.83", + "@juzi/wechaty-puppet": "^1.0.84", "@juzi/wechaty-puppet-mock": "^1.0.1", "@swc/core": "1.3.39", "@types/google-protobuf": "^3.15.5", @@ -70,10 +70,10 @@ "why-is-node-running": "^2.2.1" }, "peerDependencies": { - "@juzi/wechaty-puppet": "^1.0.77" + "@juzi/wechaty-puppet": "^1.0.84" }, "dependencies": { - "@juzi/wechaty-grpc": "^1.0.77", + "@juzi/wechaty-grpc": "^1.0.79", "clone-class": "^1.1.1", "ducks": "^1.0.2", "file-box": "^1.5.5", From 207c6f7ad522b0881bb5e31fcdb8d6529abaa963 Mon Sep 17 00:00:00 2001 From: binsee <5285894+binsee@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:15:08 +0800 Subject: [PATCH 2/3] 1.0.92 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fcb21ac1..6d228c36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@juzi/wechaty-puppet-service", - "version": "1.0.91", + "version": "1.0.92", "description": "Puppet Service for Wechaty", "type": "module", "exports": { From db922a3fa779060b387775caa9c76ec924a904dc Mon Sep 17 00:00:00 2001 From: binsee <5285894+binsee@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:17:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=F0=9F=92=A5=20change=20tag=20api?= =?UTF-8?q?=20to=20batch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/puppet-service.ts | 45 +++++++++++++++++++---------- src/server/puppet-implementation.ts | 40 +++++++++++++++++++------ 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/src/client/puppet-service.ts b/src/client/puppet-service.ts index ecac929d..190daa15 100644 --- a/src/client/puppet-service.ts +++ b/src/client/puppet-service.ts @@ -2333,35 +2333,38 @@ class PuppetService extends PUPPET.Puppet { } override async tagTagAdd ( - tagName: string, + tagNameList: string[], tagGroupId?: string, - ): Promise { - log.verbose('PuppetService', 'tagTagAdd(%s, %s)', tagName, tagGroupId) + ): Promise { + log.verbose('PuppetService', 'tagTagAdd(%s, %s)', tagNameList, tagGroupId) const request = new grpcPuppet.TagTagAddRequest() if (typeof tagGroupId !== 'undefined') { request.setTagGroupId(tagGroupId) } - request.setTagName(tagName) + request.setTagNameList(tagNameList) const result = await util.promisify( this.grpcManager.client.tagTagAdd .bind(this.grpcManager.client), )(request) - const id = result.getTagId() + const tagInfoList:PUPPET.types.TagInfo[] = result.getTagInfoList().map(i => ({ + id : i.getTagId(), + name: i.getTagName(), + })) - return id + return tagInfoList } override async tagTagDelete ( - tagId: string, + tagIdList: string[], ): Promise { - log.verbose('PuppetService', 'tagTagDelete(%s)', tagId) + log.verbose('PuppetService', 'tagTagDelete(%s)', tagIdList) const request = new grpcPuppet.TagTagDeleteRequest() - request.setTagId(tagId) + request.setTagIdList(tagIdList) await util.promisify( this.grpcManager.client.tagTagDelete @@ -2371,20 +2374,30 @@ class PuppetService extends PUPPET.Puppet { } override async tagTagModify ( - tagId: string, - tagNewName: string, - ): Promise { - log.verbose('PuppetService', 'tagTagModify(%s, %s)', tagId, tagNewName) + tagNewInfoList: PUPPET.types.TagInfo[], + ): Promise { + log.verbose('PuppetService', 'tagTagModify(%o)', tagNewInfoList) const request = new grpcPuppet.TagTagModifyRequest() - request.setTagId(tagId) - request.setTagNewName(tagNewName) + const newInfoList = tagNewInfoList.map(i => { + const tagInfo = new grpcPuppet.TagTagInfo() + tagInfo.setTagId(i.id) + tagInfo.setTagName(i.name) + return tagInfo + }) + request.setTagNewInfoList(newInfoList) - await util.promisify( + const result = await util.promisify( this.grpcManager.client.tagTagModify .bind(this.grpcManager.client), )(request) + const tagInfoList:PUPPET.types.TagInfo[] = result.getTagInfoList().map(i => ({ + id : i.getTagId(), + name: i.getTagName(), + })) + + return tagInfoList } override async tagGroupList (): Promise { diff --git a/src/server/puppet-implementation.ts b/src/server/puppet-implementation.ts index ece5e612..d73e52fb 100644 --- a/src/server/puppet-implementation.ts +++ b/src/server/puppet-implementation.ts @@ -1916,13 +1916,19 @@ function puppetImplementation ( try { const tagGroupId = call.request.getTagGroupId() - const tagName = call.request.getTagName() + const tagNameList = call.request.getTagNameList() - const result = await puppet.tagTagAdd(tagName, tagGroupId) + const result = await puppet.tagTagAdd(tagNameList, tagGroupId) const response = new grpcPuppet.TagTagAddResponse() if (result) { - response.setTagId(result) + const tagInfoList : grpcPuppet.TagTagInfo[] = result.map(i => { + const tagInfo = new grpcPuppet.TagTagInfo() + tagInfo.setTagId(i.id) + tagInfo.setTagName(i.name) + return tagInfo + }) + response.setTagInfoList(tagInfoList) } return callback(null, response) @@ -1935,9 +1941,9 @@ function puppetImplementation ( log.verbose('PuppetServiceImpl', 'tagTagDelete()') try { - const tagId = call.request.getTagId() + const tagIdList = call.request.getTagIdList() - await puppet.tagTagDelete(tagId) + await puppet.tagTagDelete(tagIdList) return callback(null, new grpcPuppet.TagTagDeleteResponse()) } catch (e) { @@ -1949,12 +1955,28 @@ function puppetImplementation ( log.verbose('PuppetServiceImpl', 'tagTagModify()') try { - const tagId = call.request.getTagId() - const tagNewName = call.request.getTagNewName() + const tagInfoList = call.request.getTagNewInfoList() + const newInfoList : PUPPET.types.TagInfo[] = tagInfoList.map(i => { + const info :PUPPET.types.TagInfo = { + id : i.getTagId(), + name: i.getTagName(), + } + return info + }) - await puppet.tagTagModify(tagId, tagNewName) + const result = await puppet.tagTagModify(newInfoList) + const response = new grpcPuppet.TagTagModifyResponse() + if (result) { + const tagInfoList : grpcPuppet.TagTagInfo[] = result.map(i => { + const tagInfo = new grpcPuppet.TagTagInfo() + tagInfo.setTagId(i.id) + tagInfo.setTagName(i.name) + return tagInfo + }) + response.setTagInfoList(tagInfoList) + } - return callback(null, new grpcPuppet.TagTagModifyResponse()) + return callback(null, response) } catch (e) { return grpcError('tagTagModify', e, callback) }