@juzi/wechaty 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/cjs/src/mods/impls.d.ts +3 -3
  2. package/dist/cjs/src/mods/impls.d.ts.map +1 -1
  3. package/dist/cjs/src/mods/impls.js +2 -1
  4. package/dist/cjs/src/mods/impls.js.map +1 -1
  5. package/dist/cjs/src/mods/users.d.ts +1 -1
  6. package/dist/cjs/src/mods/users.d.ts.map +1 -1
  7. package/dist/cjs/src/package-json.js +3 -3
  8. package/dist/cjs/src/user-modules/contact.d.ts +8 -0
  9. package/dist/cjs/src/user-modules/contact.d.ts.map +1 -1
  10. package/dist/cjs/src/user-modules/contact.js +34 -22
  11. package/dist/cjs/src/user-modules/contact.js.map +1 -1
  12. package/dist/cjs/src/user-modules/mod.d.ts +4 -3
  13. package/dist/cjs/src/user-modules/mod.d.ts.map +1 -1
  14. package/dist/cjs/src/user-modules/mod.js +3 -1
  15. package/dist/cjs/src/user-modules/mod.js.map +1 -1
  16. package/dist/cjs/src/user-modules/tag-group.d.ts +60 -0
  17. package/dist/cjs/src/user-modules/tag-group.d.ts.map +1 -0
  18. package/dist/cjs/src/user-modules/tag-group.js +71 -0
  19. package/dist/cjs/src/user-modules/tag-group.js.map +1 -0
  20. package/dist/cjs/src/user-modules/tag.d.ts +40 -11
  21. package/dist/cjs/src/user-modules/tag.d.ts.map +1 -1
  22. package/dist/cjs/src/user-modules/tag.js +73 -27
  23. package/dist/cjs/src/user-modules/tag.js.map +1 -1
  24. package/dist/cjs/src/wechaty/wechaty-base.d.ts +15 -5
  25. package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
  26. package/dist/cjs/src/wechaty/wechaty-impl.spec.js +5 -3
  27. package/dist/cjs/src/wechaty/wechaty-impl.spec.js.map +1 -1
  28. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +6 -0
  29. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  30. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +9 -9
  31. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  32. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +8 -0
  33. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  34. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +14 -20
  35. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  36. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +4 -2
  37. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  38. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +3 -0
  39. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  40. package/dist/esm/src/mods/impls.d.ts +3 -3
  41. package/dist/esm/src/mods/impls.d.ts.map +1 -1
  42. package/dist/esm/src/mods/impls.js +1 -1
  43. package/dist/esm/src/mods/impls.js.map +1 -1
  44. package/dist/esm/src/mods/users.d.ts +1 -1
  45. package/dist/esm/src/mods/users.d.ts.map +1 -1
  46. package/dist/esm/src/package-json.js +3 -3
  47. package/dist/esm/src/user-modules/contact.d.ts +8 -0
  48. package/dist/esm/src/user-modules/contact.d.ts.map +1 -1
  49. package/dist/esm/src/user-modules/contact.js +34 -22
  50. package/dist/esm/src/user-modules/contact.js.map +1 -1
  51. package/dist/esm/src/user-modules/mod.d.ts +4 -3
  52. package/dist/esm/src/user-modules/mod.d.ts.map +1 -1
  53. package/dist/esm/src/user-modules/mod.js +2 -1
  54. package/dist/esm/src/user-modules/mod.js.map +1 -1
  55. package/dist/esm/src/user-modules/tag-group.d.ts +60 -0
  56. package/dist/esm/src/user-modules/tag-group.d.ts.map +1 -0
  57. package/dist/esm/src/user-modules/tag-group.js +68 -0
  58. package/dist/esm/src/user-modules/tag-group.js.map +1 -0
  59. package/dist/esm/src/user-modules/tag.d.ts +40 -11
  60. package/dist/esm/src/user-modules/tag.d.ts.map +1 -1
  61. package/dist/esm/src/user-modules/tag.js +73 -27
  62. package/dist/esm/src/user-modules/tag.js.map +1 -1
  63. package/dist/esm/src/wechaty/wechaty-base.d.ts +15 -5
  64. package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
  65. package/dist/esm/src/wechaty/wechaty-impl.spec.js +5 -3
  66. package/dist/esm/src/wechaty/wechaty-impl.spec.js.map +1 -1
  67. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +6 -0
  68. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  69. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +9 -9
  70. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  71. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +8 -0
  72. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  73. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +14 -20
  74. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  75. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +4 -2
  76. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  77. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -1
  78. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  79. package/package.json +2 -2
  80. package/src/mods/impls.ts +3 -0
  81. package/src/mods/users.ts +1 -0
  82. package/src/package-json.ts +3 -3
  83. package/src/user-modules/contact.ts +40 -22
  84. package/src/user-modules/mod.ts +8 -0
  85. package/src/user-modules/tag-group.ts +115 -0
  86. package/src/user-modules/tag.ts +85 -14
  87. package/src/wechaty/wechaty-impl.spec.ts +3 -0
  88. package/src/wechaty-mixins/wechatify-user-module-mixin.ts +6 -0
@@ -1,4 +1,4 @@
1
- import { ContactConstructor, ContactSelfConstructor, DelayConstructor, FriendshipConstructor, ImageConstructor, LocationConstructor, MessageConstructor, MiniProgramConstructor, PostConstructor, RoomConstructor, RoomInvitationConstructor, TagConstructor, UrlLinkConstructor, ChannelConstructor } from '../user-modules/mod.js';
1
+ import { ContactConstructor, ContactSelfConstructor, DelayConstructor, FriendshipConstructor, ImageConstructor, LocationConstructor, MessageConstructor, MiniProgramConstructor, PostConstructor, RoomConstructor, RoomInvitationConstructor, TagConstructor, TagGroupConstructor, UrlLinkConstructor, ChannelConstructor } from '../user-modules/mod.js';
2
2
  import type { WechatySkeleton } from '../wechaty/mod.js';
3
3
  declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleton>(mixinBase: MixinBase) => ((abstract new (...args: any[]) => {
4
4
  __wechatifiedContact?: ContactConstructor | undefined;
@@ -13,6 +13,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
13
13
  __wechatifiedRoom?: RoomConstructor | undefined;
14
14
  __wechatifiedRoomInvitation?: RoomInvitationConstructor | undefined;
15
15
  __wechatifiedTag?: TagConstructor | undefined;
16
+ __wechatifiedTagGroup?: TagGroupConstructor | undefined;
16
17
  __wechatifiedUrlLink?: UrlLinkConstructor | undefined;
17
18
  __wechatifiedChannel?: ChannelConstructor | undefined;
18
19
  readonly Contact: ContactConstructor;
@@ -27,6 +28,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
27
28
  readonly Room: RoomConstructor;
28
29
  readonly RoomInvitation: RoomInvitationConstructor;
29
30
  readonly Tag: TagConstructor;
31
+ readonly TagGroup: TagGroupConstructor;
30
32
  readonly UrlLink: UrlLinkConstructor;
31
33
  readonly Channel: ChannelConstructor;
32
34
  init(): Promise<void>;
@@ -57,7 +59,7 @@ declare const wechatifyUserModuleMixin: <MixinBase extends typeof WechatySkeleto
57
59
  readonly log: import("brolog/dist/esm/src/logger.js").Loggable;
58
60
  }) & MixinBase;
59
61
  declare type WechatifyUserModuleMixin = ReturnType<typeof wechatifyUserModuleMixin>;
60
- declare type ProtectedPropertyWechatifyUserModuleMixin = '__wechatifiedContact' | '__wechatifiedContactSelf' | '__wechatifiedDelay' | '__wechatifiedFriendship' | '__wechatifiedImage' | '__wechatifiedLocation' | '__wechatifiedMessage' | '__wechatifiedMiniProgram' | '__wechatifiedRoom' | '__wechatifiedRoomInvitation' | '__wechatifiedTag' | '__wechatifiedUrlLink' | '__wechatifiedChannel';
62
+ declare type ProtectedPropertyWechatifyUserModuleMixin = '__wechatifiedContact' | '__wechatifiedContactSelf' | '__wechatifiedDelay' | '__wechatifiedFriendship' | '__wechatifiedImage' | '__wechatifiedLocation' | '__wechatifiedMessage' | '__wechatifiedMiniProgram' | '__wechatifiedRoom' | '__wechatifiedRoomInvitation' | '__wechatifiedTag' | '__wechatifiedTagGroup' | '__wechatifiedUrlLink' | '__wechatifiedChannel';
61
63
  export type { WechatifyUserModuleMixin, ProtectedPropertyWechatifyUserModuleMixin, };
62
64
  export { wechatifyUserModuleMixin, };
63
65
  //# sourceMappingURL=wechatify-user-module-mixin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wechatify-user-module-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,EAgBL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAGnB,MAA4B,wBAAwB,CAAA;AAErD,OAAO,KAAK,EACV,eAAe,EAChB,MAAkC,mBAAmB,CAAA;AAEtD,QAAA,MAAM,wBAAwB,+FAKJ,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmCH,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;cAyCxC,CAAA;AAYD,aAAK,wBAAwB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE3E,aAAK,yCAAyC,GAC1C,sBAAsB,GACtB,0BAA0B,GAC1B,oBAAoB,GACpB,yBAAyB,GACzB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,0BAA0B,GAC1B,mBAAmB,GACnB,6BAA6B,GAC7B,kBAAkB,GAClB,sBAAsB,GACtB,sBAAsB,CAAA;AAE1B,YAAY,EACV,wBAAwB,EACxB,yCAAyC,GAC1C,CAAA;AACD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
1
+ {"version":3,"file":"wechatify-user-module-mixin.d.ts","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,EAiBL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAGnB,MAA4B,wBAAwB,CAAA;AAErD,OAAO,KAAK,EACV,eAAe,EAChB,MAAkC,mBAAmB,CAAA;AAEtD,QAAA,MAAM,wBAAwB,+FAKJ,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqCH,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CxC,CAAA;AAYD,aAAK,wBAAwB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE3E,aAAK,yCAAyC,GAC1C,sBAAsB,GACtB,0BAA0B,GAC1B,oBAAoB,GACpB,yBAAyB,GACzB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,0BAA0B,GAC1B,mBAAmB,GACnB,6BAA6B,GAC7B,kBAAkB,GAClB,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,CAAA;AAE1B,YAAY,EACV,wBAAwB,EACxB,yCAAyC,GAC1C,CAAA;AACD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { log } from '@juzi/wechaty-puppet';
2
- import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, UrlLinkImpl, ChannelImpl, wechatifyUserModule, } from '../user-modules/mod.js';
2
+ import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, TagGroupImpl, UrlLinkImpl, ChannelImpl, wechatifyUserModule, } from '../user-modules/mod.js';
3
3
  const wechatifyUserModuleMixin = (mixinBase) => {
4
4
  log.verbose('WechatifyUserModuleMixin', 'wechatifyUserModuleMixin(%s)', mixinBase.name);
5
5
  class WechatifyUserModuleMixin extends mixinBase {
@@ -19,6 +19,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
19
19
  __wechatifiedRoom;
20
20
  __wechatifiedRoomInvitation;
21
21
  __wechatifiedTag;
22
+ __wechatifiedTagGroup;
22
23
  __wechatifiedUrlLink;
23
24
  __wechatifiedChannel;
24
25
  get Contact() { return guardWechatify(this.__wechatifiedContact); }
@@ -33,6 +34,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
33
34
  get Room() { return guardWechatify(this.__wechatifiedRoom); }
34
35
  get RoomInvitation() { return guardWechatify(this.__wechatifiedRoomInvitation); }
35
36
  get Tag() { return guardWechatify(this.__wechatifiedTag); }
37
+ get TagGroup() { return guardWechatify(this.__wechatifiedTagGroup); }
36
38
  get UrlLink() { return guardWechatify(this.__wechatifiedUrlLink); }
37
39
  get Channel() { return guardWechatify(this.__wechatifiedChannel); }
38
40
  async init() {
@@ -64,6 +66,7 @@ const wechatifyUserModuleMixin = (mixinBase) => {
64
66
  this.__wechatifiedRoom = wechatifyUserModule(RoomImpl)(this);
65
67
  this.__wechatifiedRoomInvitation = wechatifyUserModule(RoomInvitationImpl)(this);
66
68
  this.__wechatifiedTag = wechatifyUserModule(TagImpl)(this);
69
+ this.__wechatifiedTagGroup = wechatifyUserModule(TagGroupImpl)(this);
67
70
  this.__wechatifiedUrlLink = wechatifyUserModule(UrlLinkImpl)(this);
68
71
  this.__wechatifiedChannel = wechatifyUserModule(ChannelImpl)(this);
69
72
  log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done');
@@ -1 +1 @@
1
- {"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAe,sBAAsB,CAAA;AAEnD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,WAAW,EAiBX,mBAAmB,GACpB,MAA4B,wBAAwB,CAAA;AAMrD,MAAM,wBAAwB,GAAG,CAA4C,SAAoB,EAAE,EAAE;IACnG,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,8BAA8B,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAEvF,MAAe,wBAAyB,SAAQ,SAAS;QAEvD,YAAa,GAAG,IAAW;YACzB,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,eAAe,CAAC,CAAA;YACxD,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA;QAChB,CAAC;QAED,oBAAoB,CAA6B;QACjD,wBAAwB,CAA6B;QACrD,kBAAkB,CAA6B;QAC/C,uBAAuB,CAA6B;QACpD,kBAAkB,CAA6B;QAC/C,qBAAqB,CAA6B;QAClD,oBAAoB,CAA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mB,CAAC,QAAQ,CAAC,CAAC,IAAW,CAAC,CAAA;YAC7E,IAAI,CAAC,iBAAiB,GAAa,mBAAmB,CAAC,QAAQ,CAAC,CAAC,IAAW,CAAC,CAAA;YAC7E,IAAI,CAAC,2BAA2B,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,IAAW,CAAC,CAAA;YACvF,IAAI,CAAC,gBAAgB,GAAc,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAW,CAAC,CAAA;YAC5E,IAAI,CAAC,oBAAoB,GAAU,mBAAmB,CAAC,WAAW,CAAC,CAAC,IAAW,CAAC,CAAA;YAChF,IAAI,CAAC,oBAAoB,GAAU,mBAAmB,CAAC,WAAW,CAAC,CAAC,IAAW,CAAC,CAAA;YAEhF,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,wDAAwD,CAAC,CAAA;QACnG,CAAC;KAEF;IAED,OAAO,wBAAwB,CAAA;AACjC,CAAC,CAAA;AAED;;GAEG;AACH,SAAS,cAAc,CAAsB,UAAc;IACzD,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAA;KAClB;IACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAA;AACjH,CAAC;AAuBD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
1
+ {"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAe,sBAAsB,CAAA;AAEnD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EAkBX,mBAAmB,GACpB,MAA4B,wBAAwB,CAAA;AAMrD,MAAM,wBAAwB,GAAG,CAA4C,SAAoB,EAAE,EAAE;IACn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CAAsB,UAAc;IACzD,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAA;KAClB;IACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAA;AACjH,CAAC;AAwBD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juzi/wechaty",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Wechaty is a RPA SDK for Chatbot Makers.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -110,7 +110,7 @@
110
110
  "homepage": "https://github.com/wechaty/",
111
111
  "dependencies": {
112
112
  "@juzi/wechaty-puppet": "^1.0.12",
113
- "@juzi/wechaty-puppet-service": "^1.0.16",
113
+ "@juzi/wechaty-puppet-service": "^1.0.17",
114
114
  "clone-class": "^1.1.1",
115
115
  "cmd-ts": "^0.10.0",
116
116
  "cockatiel": "^2.0.2",
package/src/mods/impls.ts CHANGED
@@ -46,6 +46,7 @@ export {
46
46
  RoomInvitationImpl,
47
47
  DelayImpl,
48
48
  TagImpl,
49
+ TagGroupImpl,
49
50
  UrlLinkImpl,
50
51
  ChannelImpl,
51
52
  } from '../user-modules/mod.js'
@@ -85,6 +86,7 @@ export type {
85
86
  RoomInterface,
86
87
  RoomInvitationInterface,
87
88
  TagInterface,
89
+ TagGroupInterface,
88
90
  UrlLinkInterface,
89
91
  ChannelInterface,
90
92
  } from '../user-modules/mod.js'
@@ -105,6 +107,7 @@ export type {
105
107
  RoomConstructor,
106
108
  RoomInvitationConstructor,
107
109
  TagConstructor,
110
+ TagGroupConstructor,
108
111
  UrlLinkConstructor,
109
112
  ChannelConstructor,
110
113
  } from '../user-modules/mod.js'
package/src/mods/users.ts CHANGED
@@ -40,6 +40,7 @@ export type {
40
40
  RoomInterface as Room,
41
41
  RoomInvitationInterface as RoomInvitation,
42
42
  TagInterface as Tag,
43
+ TagGroupInterface as TagGroup,
43
44
  UrlLinkInterface as UrlLink,
44
45
  ChannelInterface as Channel,
45
46
  } from '../user-modules/mod.js'
@@ -4,10 +4,10 @@
4
4
  */
5
5
  import type { PackageJsonWechaty } from './config'
6
6
 
7
- export const GIT_COMMIT_HASH: string = '0bd685a3ccb3fcb75954bdc8405a0cc90cab8db3'
7
+ export const GIT_COMMIT_HASH: string = '895c078a64de163acae5b4697c4229d918448492'
8
8
  export const packageJson: PackageJsonWechaty = {
9
9
  "name": "@juzi/wechaty",
10
- "version": "1.0.17",
10
+ "version": "1.0.18",
11
11
  "description": "Wechaty is a RPA SDK for Chatbot Makers.",
12
12
  "type": "module",
13
13
  "exports": {
@@ -117,7 +117,7 @@ export const packageJson: PackageJsonWechaty = {
117
117
  "homepage": "https://github.com/wechaty/",
118
118
  "dependencies": {
119
119
  "@juzi/wechaty-puppet": "^1.0.12",
120
- "@juzi/wechaty-puppet-service": "^1.0.16",
120
+ "@juzi/wechaty-puppet-service": "^1.0.17",
121
121
  "clone-class": "^1.1.1",
122
122
  "cmd-ts": "^0.10.0",
123
123
  "cockatiel": "^2.0.2",
@@ -218,17 +218,15 @@ class ContactMixin extends MixinBase implements SayableSayer {
218
218
  static async tags (): Promise<TagInterface[]> {
219
219
  log.verbose('Contact', 'static tags() for %s', this)
220
220
 
221
- // TODO implement new tag methods
222
- // try {
223
- // const tagIdList = await this.wechaty.puppet.tagContactList()
224
- // const tagList = tagIdList.map(id => this.wechaty.Tag.load(id))
225
- // return tagList
226
- // } catch (e) {
227
- // this.wechaty.emitError(e)
228
- // log.error('Contact', 'static tags() exception: %s', (e as Error).message)
229
- // return []
230
- // }
231
- return []
221
+ try {
222
+ const tagIdList = await this.wechaty.puppet.tagTagList()
223
+ const tagList = tagIdList.map(id => this.wechaty.Tag.create(id))
224
+ return tagList
225
+ } catch (e) {
226
+ this.wechaty.emitError(e)
227
+ log.error('Contact', 'static tags() exception: %s', (e as Error).message)
228
+ return []
229
+ }
232
230
  }
233
231
 
234
232
  /**
@@ -674,17 +672,37 @@ class ContactMixin extends MixinBase implements SayableSayer {
674
672
  async tags (): Promise<TagInterface[]> {
675
673
  log.verbose('Contact', 'tags() for %s', this)
676
674
 
677
- // TODO: implement new tag methods
678
- // try {
679
- // const tagIdList = await this.wechaty.puppet.tagContactList(this.id)
680
- // const tagList = tagIdList.map(id => this.wechaty.Tag.load(id))
681
- // return tagList
682
- // } catch (e) {
683
- // this.wechaty.emitError(e)
684
- // log.error('Contact', 'tags() exception: %s', (e as Error).message)
685
- // return []
686
- // }
687
- return []
675
+ try {
676
+ const tagPayloadList = await this.wechaty.puppet.tagContactTagList(this.id)
677
+ const tagList = tagPayloadList.map(tag => this.wechaty.Tag.create(tag))
678
+ return tagList
679
+ } catch (e) {
680
+ this.wechaty.emitError(e)
681
+ log.error('Contact', 'tags() exception: %s', (e as Error).message)
682
+ return []
683
+ }
684
+ }
685
+
686
+ /**
687
+ * Add a Tag
688
+ */
689
+
690
+ async tag (tag: TagInterface): Promise<void> {
691
+ log.verbose('Contact', 'tag(%s) for %s', tag, this)
692
+
693
+ await this.wechaty.puppet.tagContactTagAdd(tag.groupId(), tag.id(), this.id)
694
+
695
+ }
696
+
697
+ /**
698
+ * Remove a Tag
699
+ */
700
+
701
+ async tagRemove (tag: TagInterface): Promise<void> {
702
+ log.verbose('Contact', 'tagRemove(%s) for %s', tag, this)
703
+
704
+ await this.wechaty.puppet.tagContactTagRemove(tag.groupId(), tag.id(), this.id)
705
+
688
706
  }
689
707
 
690
708
  /**
@@ -87,6 +87,11 @@ import {
87
87
  TagInterface,
88
88
  TagConstructor,
89
89
  } from './tag.js'
90
+ import {
91
+ TagGroupImpl,
92
+ TagGroupInterface,
93
+ TagGroupConstructor,
94
+ } from './tag-group.js'
90
95
  import {
91
96
  UrlLinkImpl,
92
97
  UrlLinkInterface,
@@ -120,6 +125,7 @@ export type {
120
125
  RoomInterface,
121
126
  RoomInvitationInterface,
122
127
  TagInterface,
128
+ TagGroupInterface,
123
129
  DelayInterface,
124
130
  UrlLinkInterface,
125
131
  ChannelInterface,
@@ -141,6 +147,7 @@ export type {
141
147
  RoomInvitationConstructor,
142
148
  DelayConstructor,
143
149
  TagConstructor,
150
+ TagGroupConstructor,
144
151
  UrlLinkConstructor,
145
152
  ChannelConstructor,
146
153
  }
@@ -163,6 +170,7 @@ export {
163
170
  RoomInvitationImpl,
164
171
  DelayImpl,
165
172
  TagImpl,
173
+ TagGroupImpl,
166
174
  UrlLinkImpl,
167
175
  ChannelImpl,
168
176
  }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Wechaty Chatbot SDK - https://github.com/wechaty/wechaty
3
+ *
4
+ * @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
5
+ * Wechaty Contributors <https://github.com/wechaty>.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agGroupreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific languagGroupe governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ */
20
+ import type * as PUPPET from '@juzi/wechaty-puppet'
21
+
22
+ import type { Constructor } from 'clone-class'
23
+ import { log } from '../config.js'
24
+
25
+ import { validationMixin } from '../user-mixins/validation.js'
26
+ import {
27
+ wechatifyMixinBase,
28
+ } from '../user-mixins/wechatify.js'
29
+
30
+ class TagGroupMixin extends wechatifyMixinBase() {
31
+
32
+ /**
33
+ *
34
+ * Create
35
+ *
36
+ */
37
+ static create (payload: PUPPET.payloads.TagGroup): TagGroupInterface {
38
+ log.verbose('TagGroup', 'create()')
39
+
40
+ return new this(payload)
41
+ }
42
+
43
+ /**
44
+ * @hideconstructor
45
+ */
46
+ constructor (
47
+ public readonly payload: PUPPET.payloads.TagGroup,
48
+ ) {
49
+ super()
50
+ log.silly('TagGroup', 'constructor()')
51
+ }
52
+
53
+ id (): string {
54
+ return this.payload.id
55
+ }
56
+
57
+ name (): string {
58
+ return this.payload.name
59
+ }
60
+
61
+ static async createTagGroup (name: string): Promise<TagGroupInterface | void> {
62
+ log.verbose('TagGroup', 'createTagGroup(%s, %s)', name)
63
+
64
+ try {
65
+ const payload = await this.wechaty.puppet.tagGroupAdd(name)
66
+ if (payload) {
67
+ return new this(payload)
68
+ }
69
+ } catch (e) {
70
+ this.wechaty.emitError(e)
71
+ log.error('Contact', 'createTag() exception: %s', (e as Error).message)
72
+ }
73
+ }
74
+
75
+ static async deleteTagGroup (tagGroup: TagGroupInterface): Promise<TagGroupInterface | void> {
76
+ log.verbose('TagGroup', 'deleteTagGroup(%s)', tagGroup)
77
+
78
+ try {
79
+ await this.wechaty.puppet.tagGroupDelete(tagGroup.id())
80
+ } catch (e) {
81
+ this.wechaty.emitError(e)
82
+ log.error('Contact', 'createTag() exception: %s', (e as Error).message)
83
+ }
84
+ }
85
+
86
+ static async list (): Promise<TagGroupInterface[]> {
87
+ log.verbose('TagGroup', 'list()')
88
+
89
+ try {
90
+ const payloads = await this.wechaty.puppet.tagGroupList()
91
+ return payloads.map(payload => new this(payload))
92
+ } catch (e) {
93
+ this.wechaty.emitError(e)
94
+ log.error('TagGroup', 'list() exception: %s', (e as Error).message)
95
+ return []
96
+ }
97
+ }
98
+
99
+ }
100
+
101
+ class TagGroupImpl extends validationMixin(TagGroupMixin)<TagGroupInterface>() { }
102
+ interface TagGroupInterface extends TagGroupImpl { }
103
+
104
+ type TagGroupConstructor = Constructor<
105
+ TagGroupInterface,
106
+ typeof TagGroupImpl
107
+ >
108
+
109
+ export type {
110
+ TagGroupConstructor,
111
+ TagGroupInterface,
112
+ }
113
+ export {
114
+ TagGroupImpl,
115
+ }
@@ -17,37 +17,108 @@
17
17
  * limitations under the License.
18
18
  *
19
19
  */
20
- import {
21
- log,
22
- } from '@juzi/wechaty-puppet'
20
+ import type * as PUPPET from '@juzi/wechaty-puppet'
23
21
 
24
- import type { Constructor } from 'clone-class'
22
+ import type { Constructor } from 'clone-class'
23
+ import { log } from '../config.js'
25
24
 
26
- import {
27
- poolifyMixin,
28
- } from '../user-mixins/poolify.js'
29
25
  import { validationMixin } from '../user-mixins/validation.js'
30
26
  import {
31
27
  wechatifyMixinBase,
32
28
  } from '../user-mixins/wechatify.js'
29
+ import type { ContactInterface } from './contact.js'
33
30
 
34
- const MixinBase = poolifyMixin(
35
- wechatifyMixinBase(),
36
- )<TagInterface>()
31
+ class TagMixin extends wechatifyMixinBase() {
37
32
 
38
- class TagMixin extends MixinBase {
33
+ /**
34
+ *
35
+ * Create
36
+ *
37
+ */
38
+ static create (payload: PUPPET.payloads.Tag): TagInterface {
39
+ log.verbose('Tag', 'create()')
40
+
41
+ return new this(payload)
42
+ }
39
43
 
40
44
  /**
41
45
  * @hideconstructor
42
46
  */
43
47
  constructor (
44
- public readonly id: string,
48
+ public readonly payload: PUPPET.payloads.Tag,
45
49
  ) {
46
50
  super()
47
- log.silly('Tag', `constructor(${id})`)
51
+ log.silly('Tag', 'constructor()')
52
+ }
53
+
54
+ id (): string {
55
+ return this.payload.id
56
+ }
57
+
58
+ type (): PUPPET.types.Tag {
59
+ return this.payload.type
60
+ }
61
+
62
+ groupId (): string {
63
+ return this.payload.groupId || ''
64
+ }
65
+
66
+ name (): string {
67
+ return this.payload.name
48
68
  }
49
69
 
50
- // TODO: implement new tag methods
70
+ static async list (): Promise<TagInterface[]> {
71
+ log.verbose('Tag', 'list()')
72
+
73
+ try {
74
+ const payloads = await this.wechaty.puppet.tagTagList()
75
+ return payloads.map(payload => new this(payload))
76
+ } catch (e) {
77
+ this.wechaty.emitError(e)
78
+ log.error('Tag', 'list() exception: %s', (e as Error).message)
79
+ return []
80
+ }
81
+ }
82
+
83
+ async contactList (): Promise<ContactInterface[]> {
84
+ log.verbose('Tag', 'contactList() for tag id: %s', this.id())
85
+
86
+ const contactIds = await this.wechaty.puppet.tagTagContactList(this.groupId(), this.id())
87
+ const contactPromises = contactIds.map(id => this.wechaty.Contact.find({ id })) as Promise<ContactInterface>[]
88
+ return Promise.all(contactPromises)
89
+ }
90
+
91
+ async tag (contact: ContactInterface): Promise<void> {
92
+ log.verbose('Tag', 'tag(%s) for tag id: %s', contact, this.id())
93
+
94
+ const contactId = contact.id
95
+ await this.wechaty.puppet.tagContactTagAdd(this.groupId(), this.id(), contactId)
96
+ }
97
+
98
+ static async createTag (tagGroupId: string | undefined, name: string): Promise<TagInterface | void> {
99
+ log.verbose('Tag', 'createTag(%s, %s)', tagGroupId, name)
100
+
101
+ try {
102
+ const payload = await this.wechaty.puppet.tagTagAdd(tagGroupId, name)
103
+ if (payload) {
104
+ return new this(payload)
105
+ }
106
+ } catch (e) {
107
+ this.wechaty.emitError(e)
108
+ log.error('Contact', 'createTag() exception: %s', (e as Error).message)
109
+ }
110
+ }
111
+
112
+ static async deleteTag (tag: TagInterface): Promise<void> {
113
+ log.verbose('Tag', 'deleteTag(%s, %s)', tag)
114
+
115
+ try {
116
+ await this.wechaty.puppet.tagTagDelete(tag.groupId(), tag.id())
117
+ } catch (e) {
118
+ this.wechaty.emitError(e)
119
+ log.error('Contact', 'deleteTag() exception: %s', (e as Error).message)
120
+ }
121
+ }
51
122
 
52
123
  }
53
124
 
@@ -17,6 +17,7 @@ import type {
17
17
  RoomConstructor,
18
18
  DelayConstructor,
19
19
  TagConstructor,
20
+ TagGroupConstructor,
20
21
  UrlLinkConstructor,
21
22
  MessageInterface,
22
23
  ChannelConstructor,
@@ -45,6 +46,7 @@ test('Wechaty interface', async t => {
45
46
  Room : RoomConstructor
46
47
  RoomInvitation : RoomInvitationConstructor
47
48
  Tag : TagConstructor
49
+ TagGroup : TagGroupConstructor
48
50
  UrlLink : UrlLinkConstructor
49
51
  Channel : ChannelConstructor
50
52
 
@@ -63,6 +65,7 @@ test('Wechaty interface', async t => {
63
65
  = this.Room
64
66
  = this.RoomInvitation
65
67
  = this.Tag
68
+ = this.TagGroup
66
69
  = this.UrlLink
67
70
  = this.Channel
68
71
  = {} as any
@@ -13,6 +13,7 @@ import {
13
13
  RoomImpl,
14
14
  RoomInvitationImpl,
15
15
  TagImpl,
16
+ TagGroupImpl,
16
17
  UrlLinkImpl,
17
18
  ChannelImpl,
18
19
 
@@ -28,6 +29,7 @@ import {
28
29
  RoomConstructor,
29
30
  RoomInvitationConstructor,
30
31
  TagConstructor,
32
+ TagGroupConstructor,
31
33
  UrlLinkConstructor,
32
34
  ChannelConstructor,
33
35
 
@@ -60,6 +62,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
60
62
  __wechatifiedRoom? : RoomConstructor
61
63
  __wechatifiedRoomInvitation? : RoomInvitationConstructor
62
64
  __wechatifiedTag? : TagConstructor
65
+ __wechatifiedTagGroup? : TagGroupConstructor
63
66
  __wechatifiedUrlLink? : UrlLinkConstructor
64
67
  __wechatifiedChannel? : ChannelConstructor
65
68
 
@@ -75,6 +78,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
75
78
  get Room () : RoomConstructor { return guardWechatify(this.__wechatifiedRoom) }
76
79
  get RoomInvitation () : RoomInvitationConstructor { return guardWechatify(this.__wechatifiedRoomInvitation) }
77
80
  get Tag () : TagConstructor { return guardWechatify(this.__wechatifiedTag) }
81
+ get TagGroup () : TagGroupConstructor { return guardWechatify(this.__wechatifiedTagGroup) }
78
82
  get UrlLink () : UrlLinkConstructor { return guardWechatify(this.__wechatifiedUrlLink) }
79
83
  get Channel () : ChannelConstructor { return guardWechatify(this.__wechatifiedChannel) }
80
84
 
@@ -110,6 +114,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
110
114
  this.__wechatifiedRoom = wechatifyUserModule(RoomImpl)(this as any)
111
115
  this.__wechatifiedRoomInvitation = wechatifyUserModule(RoomInvitationImpl)(this as any)
112
116
  this.__wechatifiedTag = wechatifyUserModule(TagImpl)(this as any)
117
+ this.__wechatifiedTagGroup = wechatifyUserModule(TagGroupImpl)(this as any)
113
118
  this.__wechatifiedUrlLink = wechatifyUserModule(UrlLinkImpl)(this as any)
114
119
  this.__wechatifiedChannel = wechatifyUserModule(ChannelImpl)(this as any)
115
120
 
@@ -145,6 +150,7 @@ type ProtectedPropertyWechatifyUserModuleMixin =
145
150
  | '__wechatifiedRoom'
146
151
  | '__wechatifiedRoomInvitation'
147
152
  | '__wechatifiedTag'
153
+ | '__wechatifiedTagGroup'
148
154
  | '__wechatifiedUrlLink'
149
155
  | '__wechatifiedChannel'
150
156