@juzi/wechaty 1.0.158 → 1.0.160

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 (373) hide show
  1. package/dist/cjs/src/io.js +40 -40
  2. package/dist/cjs/src/io.js.map +1 -1
  3. package/dist/cjs/src/package-json.js +4 -4
  4. package/dist/cjs/src/schemas/logger.d.ts +2 -0
  5. package/dist/cjs/src/schemas/logger.d.ts.map +1 -0
  6. package/dist/cjs/src/schemas/logger.js +3 -0
  7. package/dist/cjs/src/schemas/logger.js.map +1 -0
  8. package/dist/cjs/src/schemas/mod.d.ts +2 -1
  9. package/dist/cjs/src/schemas/mod.d.ts.map +1 -1
  10. package/dist/cjs/src/schemas/mod.js.map +1 -1
  11. package/dist/cjs/src/schemas/wechaty-options.d.ts +19 -0
  12. package/dist/cjs/src/schemas/wechaty-options.d.ts.map +1 -1
  13. package/dist/cjs/src/user-mixins/wechatify.d.ts +23 -0
  14. package/dist/cjs/src/user-mixins/wechatify.d.ts.map +1 -1
  15. package/dist/cjs/src/user-mixins/wechatify.js +25 -0
  16. package/dist/cjs/src/user-mixins/wechatify.js.map +1 -1
  17. package/dist/cjs/src/user-modules/call.d.ts +4 -0
  18. package/dist/cjs/src/user-modules/call.d.ts.map +1 -1
  19. package/dist/cjs/src/user-modules/call.js +6 -7
  20. package/dist/cjs/src/user-modules/call.js.map +1 -1
  21. package/dist/cjs/src/user-modules/channel-card.d.ts +2 -0
  22. package/dist/cjs/src/user-modules/channel-card.d.ts.map +1 -1
  23. package/dist/cjs/src/user-modules/channel-card.js +2 -3
  24. package/dist/cjs/src/user-modules/channel-card.js.map +1 -1
  25. package/dist/cjs/src/user-modules/channel.d.ts +2 -0
  26. package/dist/cjs/src/user-modules/channel.d.ts.map +1 -1
  27. package/dist/cjs/src/user-modules/channel.js +2 -3
  28. package/dist/cjs/src/user-modules/channel.js.map +1 -1
  29. package/dist/cjs/src/user-modules/chat-history.d.ts +2 -0
  30. package/dist/cjs/src/user-modules/chat-history.d.ts.map +1 -1
  31. package/dist/cjs/src/user-modules/chat-history.js +2 -3
  32. package/dist/cjs/src/user-modules/chat-history.js.map +1 -1
  33. package/dist/cjs/src/user-modules/consult-card.d.ts +2 -0
  34. package/dist/cjs/src/user-modules/consult-card.d.ts.map +1 -1
  35. package/dist/cjs/src/user-modules/consult-card.js +3 -4
  36. package/dist/cjs/src/user-modules/consult-card.js.map +1 -1
  37. package/dist/cjs/src/user-modules/contact-self.d.ts.map +1 -1
  38. package/dist/cjs/src/user-modules/contact-self.js +8 -9
  39. package/dist/cjs/src/user-modules/contact-self.js.map +1 -1
  40. package/dist/cjs/src/user-modules/contact.d.ts +2 -0
  41. package/dist/cjs/src/user-modules/contact.d.ts.map +1 -1
  42. package/dist/cjs/src/user-modules/contact.js +36 -37
  43. package/dist/cjs/src/user-modules/contact.js.map +1 -1
  44. package/dist/cjs/src/user-modules/delay.d.ts +2 -0
  45. package/dist/cjs/src/user-modules/delay.d.ts.map +1 -1
  46. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
  47. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
  48. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js +2 -3
  49. package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
  50. package/dist/cjs/src/user-modules/favorite.d.ts +21 -0
  51. package/dist/cjs/src/user-modules/favorite.d.ts.map +1 -1
  52. package/dist/cjs/src/user-modules/favorite.js +1 -21
  53. package/dist/cjs/src/user-modules/favorite.js.map +1 -1
  54. package/dist/cjs/src/user-modules/friendship.d.ts +2 -0
  55. package/dist/cjs/src/user-modules/friendship.d.ts.map +1 -1
  56. package/dist/cjs/src/user-modules/friendship.js +11 -12
  57. package/dist/cjs/src/user-modules/friendship.js.map +1 -1
  58. package/dist/cjs/src/user-modules/im-specific.d.ts +2 -0
  59. package/dist/cjs/src/user-modules/im-specific.d.ts.map +1 -1
  60. package/dist/cjs/src/user-modules/im-specific.js +1 -2
  61. package/dist/cjs/src/user-modules/im-specific.js.map +1 -1
  62. package/dist/cjs/src/user-modules/image.d.ts +22 -0
  63. package/dist/cjs/src/user-modules/image.d.ts.map +1 -1
  64. package/dist/cjs/src/user-modules/image.js +5 -6
  65. package/dist/cjs/src/user-modules/image.js.map +1 -1
  66. package/dist/cjs/src/user-modules/location.d.ts +2 -0
  67. package/dist/cjs/src/user-modules/location.d.ts.map +1 -1
  68. package/dist/cjs/src/user-modules/location.js +2 -3
  69. package/dist/cjs/src/user-modules/location.js.map +1 -1
  70. package/dist/cjs/src/user-modules/message.d.ts +2 -0
  71. package/dist/cjs/src/user-modules/message.d.ts.map +1 -1
  72. package/dist/cjs/src/user-modules/message.js +55 -55
  73. package/dist/cjs/src/user-modules/message.js.map +1 -1
  74. package/dist/cjs/src/user-modules/mini-program.d.ts +2 -0
  75. package/dist/cjs/src/user-modules/mini-program.d.ts.map +1 -1
  76. package/dist/cjs/src/user-modules/mini-program.js +2 -3
  77. package/dist/cjs/src/user-modules/mini-program.js.map +1 -1
  78. package/dist/cjs/src/user-modules/moment.d.ts +21 -0
  79. package/dist/cjs/src/user-modules/moment.d.ts.map +1 -1
  80. package/dist/cjs/src/user-modules/moment.js +5 -25
  81. package/dist/cjs/src/user-modules/moment.js.map +1 -1
  82. package/dist/cjs/src/user-modules/money.d.ts +2 -0
  83. package/dist/cjs/src/user-modules/money.d.ts.map +1 -1
  84. package/dist/cjs/src/user-modules/post.d.ts +2 -0
  85. package/dist/cjs/src/user-modules/post.d.ts.map +1 -1
  86. package/dist/cjs/src/user-modules/post.js +25 -25
  87. package/dist/cjs/src/user-modules/post.js.map +1 -1
  88. package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts +2 -0
  89. package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
  90. package/dist/cjs/src/user-modules/premium-online-appointment-card.js +2 -3
  91. package/dist/cjs/src/user-modules/premium-online-appointment-card.js.map +1 -1
  92. package/dist/cjs/src/user-modules/room-invitation.d.ts +2 -0
  93. package/dist/cjs/src/user-modules/room-invitation.d.ts.map +1 -1
  94. package/dist/cjs/src/user-modules/room-invitation.js +10 -11
  95. package/dist/cjs/src/user-modules/room-invitation.js.map +1 -1
  96. package/dist/cjs/src/user-modules/room.d.ts +2 -0
  97. package/dist/cjs/src/user-modules/room.d.ts.map +1 -1
  98. package/dist/cjs/src/user-modules/room.js +43 -43
  99. package/dist/cjs/src/user-modules/room.js.map +1 -1
  100. package/dist/cjs/src/user-modules/tag-group.d.ts +2 -0
  101. package/dist/cjs/src/user-modules/tag-group.d.ts.map +1 -1
  102. package/dist/cjs/src/user-modules/tag-group.js +13 -14
  103. package/dist/cjs/src/user-modules/tag-group.js.map +1 -1
  104. package/dist/cjs/src/user-modules/tag.d.ts +2 -0
  105. package/dist/cjs/src/user-modules/tag.d.ts.map +1 -1
  106. package/dist/cjs/src/user-modules/tag.js +21 -22
  107. package/dist/cjs/src/user-modules/tag.js.map +1 -1
  108. package/dist/cjs/src/user-modules/url-link.d.ts +2 -0
  109. package/dist/cjs/src/user-modules/url-link.d.ts.map +1 -1
  110. package/dist/cjs/src/user-modules/url-link.js +2 -3
  111. package/dist/cjs/src/user-modules/url-link.js.map +1 -1
  112. package/dist/cjs/src/user-modules/voice.d.ts +2 -0
  113. package/dist/cjs/src/user-modules/voice.d.ts.map +1 -1
  114. package/dist/cjs/src/user-modules/voice.js +8 -9
  115. package/dist/cjs/src/user-modules/voice.js.map +1 -1
  116. package/dist/cjs/src/user-modules/wecom.d.ts +3 -1
  117. package/dist/cjs/src/user-modules/wecom.d.ts.map +1 -1
  118. package/dist/cjs/src/user-modules/wecom.js +2 -3
  119. package/dist/cjs/src/user-modules/wecom.js.map +1 -1
  120. package/dist/cjs/src/user-modules/wxxd-order.d.ts +2 -0
  121. package/dist/cjs/src/user-modules/wxxd-order.d.ts.map +1 -1
  122. package/dist/cjs/src/user-modules/wxxd-order.js +9 -10
  123. package/dist/cjs/src/user-modules/wxxd-order.js.map +1 -1
  124. package/dist/cjs/src/user-modules/wxxd-product.d.ts +2 -0
  125. package/dist/cjs/src/user-modules/wxxd-product.d.ts.map +1 -1
  126. package/dist/cjs/src/user-modules/wxxd-product.js +6 -7
  127. package/dist/cjs/src/user-modules/wxxd-product.js.map +1 -1
  128. package/dist/cjs/src/wechaty/wechaty-base.d.ts +21 -37
  129. package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
  130. package/dist/cjs/src/wechaty/wechaty-base.js +17 -17
  131. package/dist/cjs/src/wechaty/wechaty-base.js.map +1 -1
  132. package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts +15 -4
  133. package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
  134. package/dist/cjs/src/wechaty/wechaty-skeleton.js +17 -6
  135. package/dist/cjs/src/wechaty/wechaty-skeleton.js.map +1 -1
  136. package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
  137. package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
  138. package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts +12 -6
  139. package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
  140. package/dist/cjs/src/wechaty-mixins/io-mixin.js +8 -8
  141. package/dist/cjs/src/wechaty-mixins/io-mixin.js.map +1 -1
  142. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +53 -19
  143. package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  144. package/dist/cjs/src/wechaty-mixins/login-mixin.js +5 -5
  145. package/dist/cjs/src/wechaty-mixins/login-mixin.js.map +1 -1
  146. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +21 -10
  147. package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  148. package/dist/cjs/src/wechaty-mixins/misc-mixin.js +1 -1
  149. package/dist/cjs/src/wechaty-mixins/misc-mixin.js.map +1 -1
  150. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
  151. package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  152. package/dist/cjs/src/wechaty-mixins/plugin-mixin.js +5 -5
  153. package/dist/cjs/src/wechaty-mixins/plugin-mixin.js.map +1 -1
  154. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +3 -0
  155. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +1 -0
  156. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +121 -0
  157. package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +1 -0
  158. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +16 -12
  159. package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  160. package/dist/cjs/src/wechaty-mixins/puppet-mixin.js +116 -64
  161. package/dist/cjs/src/wechaty-mixins/puppet-mixin.js.map +1 -1
  162. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
  163. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  164. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
  165. package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  166. package/dist/esm/src/io.js +40 -40
  167. package/dist/esm/src/io.js.map +1 -1
  168. package/dist/esm/src/package-json.js +4 -4
  169. package/dist/esm/src/schemas/logger.d.ts +2 -0
  170. package/dist/esm/src/schemas/logger.d.ts.map +1 -0
  171. package/dist/esm/src/schemas/logger.js +2 -0
  172. package/dist/esm/src/schemas/logger.js.map +1 -0
  173. package/dist/esm/src/schemas/mod.d.ts +2 -1
  174. package/dist/esm/src/schemas/mod.d.ts.map +1 -1
  175. package/dist/esm/src/schemas/mod.js.map +1 -1
  176. package/dist/esm/src/schemas/wechaty-options.d.ts +19 -0
  177. package/dist/esm/src/schemas/wechaty-options.d.ts.map +1 -1
  178. package/dist/esm/src/user-mixins/wechatify.d.ts +23 -0
  179. package/dist/esm/src/user-mixins/wechatify.d.ts.map +1 -1
  180. package/dist/esm/src/user-mixins/wechatify.js +25 -0
  181. package/dist/esm/src/user-mixins/wechatify.js.map +1 -1
  182. package/dist/esm/src/user-modules/call.d.ts +4 -0
  183. package/dist/esm/src/user-modules/call.d.ts.map +1 -1
  184. package/dist/esm/src/user-modules/call.js +6 -7
  185. package/dist/esm/src/user-modules/call.js.map +1 -1
  186. package/dist/esm/src/user-modules/channel-card.d.ts +2 -0
  187. package/dist/esm/src/user-modules/channel-card.d.ts.map +1 -1
  188. package/dist/esm/src/user-modules/channel-card.js +2 -3
  189. package/dist/esm/src/user-modules/channel-card.js.map +1 -1
  190. package/dist/esm/src/user-modules/channel.d.ts +2 -0
  191. package/dist/esm/src/user-modules/channel.d.ts.map +1 -1
  192. package/dist/esm/src/user-modules/channel.js +2 -3
  193. package/dist/esm/src/user-modules/channel.js.map +1 -1
  194. package/dist/esm/src/user-modules/chat-history.d.ts +2 -0
  195. package/dist/esm/src/user-modules/chat-history.d.ts.map +1 -1
  196. package/dist/esm/src/user-modules/chat-history.js +2 -3
  197. package/dist/esm/src/user-modules/chat-history.js.map +1 -1
  198. package/dist/esm/src/user-modules/consult-card.d.ts +2 -0
  199. package/dist/esm/src/user-modules/consult-card.d.ts.map +1 -1
  200. package/dist/esm/src/user-modules/consult-card.js +3 -4
  201. package/dist/esm/src/user-modules/consult-card.js.map +1 -1
  202. package/dist/esm/src/user-modules/contact-self.d.ts.map +1 -1
  203. package/dist/esm/src/user-modules/contact-self.js +8 -9
  204. package/dist/esm/src/user-modules/contact-self.js.map +1 -1
  205. package/dist/esm/src/user-modules/contact.d.ts +2 -0
  206. package/dist/esm/src/user-modules/contact.d.ts.map +1 -1
  207. package/dist/esm/src/user-modules/contact.js +36 -37
  208. package/dist/esm/src/user-modules/contact.js.map +1 -1
  209. package/dist/esm/src/user-modules/delay.d.ts +2 -0
  210. package/dist/esm/src/user-modules/delay.d.ts.map +1 -1
  211. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
  212. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
  213. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js +2 -3
  214. package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
  215. package/dist/esm/src/user-modules/favorite.d.ts +21 -0
  216. package/dist/esm/src/user-modules/favorite.d.ts.map +1 -1
  217. package/dist/esm/src/user-modules/favorite.js +1 -21
  218. package/dist/esm/src/user-modules/favorite.js.map +1 -1
  219. package/dist/esm/src/user-modules/friendship.d.ts +2 -0
  220. package/dist/esm/src/user-modules/friendship.d.ts.map +1 -1
  221. package/dist/esm/src/user-modules/friendship.js +11 -12
  222. package/dist/esm/src/user-modules/friendship.js.map +1 -1
  223. package/dist/esm/src/user-modules/im-specific.d.ts +2 -0
  224. package/dist/esm/src/user-modules/im-specific.d.ts.map +1 -1
  225. package/dist/esm/src/user-modules/im-specific.js +1 -2
  226. package/dist/esm/src/user-modules/im-specific.js.map +1 -1
  227. package/dist/esm/src/user-modules/image.d.ts +22 -0
  228. package/dist/esm/src/user-modules/image.d.ts.map +1 -1
  229. package/dist/esm/src/user-modules/image.js +5 -6
  230. package/dist/esm/src/user-modules/image.js.map +1 -1
  231. package/dist/esm/src/user-modules/location.d.ts +2 -0
  232. package/dist/esm/src/user-modules/location.d.ts.map +1 -1
  233. package/dist/esm/src/user-modules/location.js +2 -3
  234. package/dist/esm/src/user-modules/location.js.map +1 -1
  235. package/dist/esm/src/user-modules/message.d.ts +2 -0
  236. package/dist/esm/src/user-modules/message.d.ts.map +1 -1
  237. package/dist/esm/src/user-modules/message.js +56 -56
  238. package/dist/esm/src/user-modules/message.js.map +1 -1
  239. package/dist/esm/src/user-modules/mini-program.d.ts +2 -0
  240. package/dist/esm/src/user-modules/mini-program.d.ts.map +1 -1
  241. package/dist/esm/src/user-modules/mini-program.js +2 -3
  242. package/dist/esm/src/user-modules/mini-program.js.map +1 -1
  243. package/dist/esm/src/user-modules/moment.d.ts +21 -0
  244. package/dist/esm/src/user-modules/moment.d.ts.map +1 -1
  245. package/dist/esm/src/user-modules/moment.js +5 -25
  246. package/dist/esm/src/user-modules/moment.js.map +1 -1
  247. package/dist/esm/src/user-modules/money.d.ts +2 -0
  248. package/dist/esm/src/user-modules/money.d.ts.map +1 -1
  249. package/dist/esm/src/user-modules/post.d.ts +2 -0
  250. package/dist/esm/src/user-modules/post.d.ts.map +1 -1
  251. package/dist/esm/src/user-modules/post.js +25 -25
  252. package/dist/esm/src/user-modules/post.js.map +1 -1
  253. package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts +2 -0
  254. package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
  255. package/dist/esm/src/user-modules/premium-online-appointment-card.js +2 -3
  256. package/dist/esm/src/user-modules/premium-online-appointment-card.js.map +1 -1
  257. package/dist/esm/src/user-modules/room-invitation.d.ts +2 -0
  258. package/dist/esm/src/user-modules/room-invitation.d.ts.map +1 -1
  259. package/dist/esm/src/user-modules/room-invitation.js +10 -11
  260. package/dist/esm/src/user-modules/room-invitation.js.map +1 -1
  261. package/dist/esm/src/user-modules/room.d.ts +2 -0
  262. package/dist/esm/src/user-modules/room.d.ts.map +1 -1
  263. package/dist/esm/src/user-modules/room.js +44 -44
  264. package/dist/esm/src/user-modules/room.js.map +1 -1
  265. package/dist/esm/src/user-modules/tag-group.d.ts +2 -0
  266. package/dist/esm/src/user-modules/tag-group.d.ts.map +1 -1
  267. package/dist/esm/src/user-modules/tag-group.js +13 -14
  268. package/dist/esm/src/user-modules/tag-group.js.map +1 -1
  269. package/dist/esm/src/user-modules/tag.d.ts +2 -0
  270. package/dist/esm/src/user-modules/tag.d.ts.map +1 -1
  271. package/dist/esm/src/user-modules/tag.js +21 -22
  272. package/dist/esm/src/user-modules/tag.js.map +1 -1
  273. package/dist/esm/src/user-modules/url-link.d.ts +2 -0
  274. package/dist/esm/src/user-modules/url-link.d.ts.map +1 -1
  275. package/dist/esm/src/user-modules/url-link.js +2 -3
  276. package/dist/esm/src/user-modules/url-link.js.map +1 -1
  277. package/dist/esm/src/user-modules/voice.d.ts +2 -0
  278. package/dist/esm/src/user-modules/voice.d.ts.map +1 -1
  279. package/dist/esm/src/user-modules/voice.js +8 -9
  280. package/dist/esm/src/user-modules/voice.js.map +1 -1
  281. package/dist/esm/src/user-modules/wecom.d.ts +3 -1
  282. package/dist/esm/src/user-modules/wecom.d.ts.map +1 -1
  283. package/dist/esm/src/user-modules/wecom.js +2 -3
  284. package/dist/esm/src/user-modules/wecom.js.map +1 -1
  285. package/dist/esm/src/user-modules/wxxd-order.d.ts +2 -0
  286. package/dist/esm/src/user-modules/wxxd-order.d.ts.map +1 -1
  287. package/dist/esm/src/user-modules/wxxd-order.js +9 -10
  288. package/dist/esm/src/user-modules/wxxd-order.js.map +1 -1
  289. package/dist/esm/src/user-modules/wxxd-product.d.ts +2 -0
  290. package/dist/esm/src/user-modules/wxxd-product.d.ts.map +1 -1
  291. package/dist/esm/src/user-modules/wxxd-product.js +6 -7
  292. package/dist/esm/src/user-modules/wxxd-product.js.map +1 -1
  293. package/dist/esm/src/wechaty/wechaty-base.d.ts +21 -37
  294. package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
  295. package/dist/esm/src/wechaty/wechaty-base.js +17 -17
  296. package/dist/esm/src/wechaty/wechaty-base.js.map +1 -1
  297. package/dist/esm/src/wechaty/wechaty-skeleton.d.ts +15 -4
  298. package/dist/esm/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
  299. package/dist/esm/src/wechaty/wechaty-skeleton.js +17 -6
  300. package/dist/esm/src/wechaty/wechaty-skeleton.js.map +1 -1
  301. package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
  302. package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
  303. package/dist/esm/src/wechaty-mixins/io-mixin.d.ts +12 -6
  304. package/dist/esm/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
  305. package/dist/esm/src/wechaty-mixins/io-mixin.js +8 -8
  306. package/dist/esm/src/wechaty-mixins/io-mixin.js.map +1 -1
  307. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +53 -19
  308. package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
  309. package/dist/esm/src/wechaty-mixins/login-mixin.js +5 -5
  310. package/dist/esm/src/wechaty-mixins/login-mixin.js.map +1 -1
  311. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +21 -10
  312. package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
  313. package/dist/esm/src/wechaty-mixins/misc-mixin.js +1 -1
  314. package/dist/esm/src/wechaty-mixins/misc-mixin.js.map +1 -1
  315. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
  316. package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
  317. package/dist/esm/src/wechaty-mixins/plugin-mixin.js +5 -5
  318. package/dist/esm/src/wechaty-mixins/plugin-mixin.js.map +1 -1
  319. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +3 -0
  320. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +1 -0
  321. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +96 -0
  322. package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +1 -0
  323. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +16 -12
  324. package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
  325. package/dist/esm/src/wechaty-mixins/puppet-mixin.js +116 -64
  326. package/dist/esm/src/wechaty-mixins/puppet-mixin.js.map +1 -1
  327. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
  328. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
  329. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
  330. package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
  331. package/package.json +3 -3
  332. package/src/io.ts +40 -40
  333. package/src/package-json.ts +4 -4
  334. package/src/schemas/logger.ts +1 -0
  335. package/src/schemas/mod.ts +4 -0
  336. package/src/schemas/wechaty-options.ts +21 -0
  337. package/src/user-mixins/wechatify.ts +26 -0
  338. package/src/user-modules/call.ts +6 -7
  339. package/src/user-modules/channel-card.ts +2 -3
  340. package/src/user-modules/channel.ts +2 -3
  341. package/src/user-modules/chat-history.ts +2 -3
  342. package/src/user-modules/consult-card.ts +3 -5
  343. package/src/user-modules/contact-self.ts +8 -11
  344. package/src/user-modules/contact.ts +36 -40
  345. package/src/user-modules/douyin-one-click-phone-collection.ts +2 -3
  346. package/src/user-modules/favorite.ts +1 -2
  347. package/src/user-modules/friendship.ts +11 -12
  348. package/src/user-modules/im-specific.ts +1 -2
  349. package/src/user-modules/image.ts +5 -6
  350. package/src/user-modules/location.ts +2 -3
  351. package/src/user-modules/message.ts +55 -56
  352. package/src/user-modules/mini-program.ts +2 -3
  353. package/src/user-modules/moment.ts +5 -6
  354. package/src/user-modules/post.ts +25 -25
  355. package/src/user-modules/premium-online-appointment-card.ts +2 -3
  356. package/src/user-modules/room-invitation.ts +10 -11
  357. package/src/user-modules/room.ts +43 -44
  358. package/src/user-modules/tag-group.ts +13 -14
  359. package/src/user-modules/tag.ts +21 -22
  360. package/src/user-modules/url-link.ts +2 -3
  361. package/src/user-modules/voice.ts +8 -9
  362. package/src/user-modules/wecom.ts +3 -3
  363. package/src/user-modules/wxxd-order.ts +9 -10
  364. package/src/user-modules/wxxd-product.ts +6 -7
  365. package/src/wechaty/wechaty-base.ts +17 -17
  366. package/src/wechaty/wechaty-skeleton.ts +21 -8
  367. package/src/wechaty-mixins/io-mixin.ts +8 -8
  368. package/src/wechaty-mixins/login-mixin.ts +5 -5
  369. package/src/wechaty-mixins/misc-mixin.ts +1 -1
  370. package/src/wechaty-mixins/plugin-mixin.ts +5 -5
  371. package/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.ts +144 -0
  372. package/src/wechaty-mixins/puppet-mixin.ts +114 -69
  373. package/src/wechaty-mixins/wechatify-user-module-mixin.ts +4 -4
@@ -18,9 +18,6 @@
18
18
  *
19
19
  */
20
20
  import type * as PUPPET from '@juzi/wechaty-puppet'
21
- import {
22
- log,
23
- } from '@juzi/wechaty-puppet'
24
21
  import type {
25
22
  FileBoxInterface,
26
23
  } from 'file-box'
@@ -68,7 +65,7 @@ class ContactSelfMixin extends MixinBase {
68
65
  return contact as ContactSelfInterface
69
66
  }
70
67
  } catch (e) {
71
- log.silly('ContactSelf', 'find() exception: %s', (e as Error).message)
68
+ this.log.silly('ContactSelf', 'find() exception: %s', (e as Error).message)
72
69
  }
73
70
  return undefined
74
71
  }
@@ -104,7 +101,7 @@ class ContactSelfMixin extends MixinBase {
104
101
  *
105
102
  */
106
103
  public override async avatar (file?: FileBoxInterface): Promise<void | FileBoxInterface> {
107
- log.verbose('Contact', 'avatar(%s)', file ? file.name : '')
104
+ this.log.verbose('Contact', 'avatar(%s)', file ? file.name : '')
108
105
 
109
106
  if (!file) {
110
107
  const filebox = await super.avatar()
@@ -133,7 +130,7 @@ class ContactSelfMixin extends MixinBase {
133
130
  * })
134
131
  */
135
132
  public async qrcode (): Promise<string> {
136
- log.verbose('Contact', 'qrcode()')
133
+ this.log.verbose('Contact', 'qrcode()')
137
134
  if (this.id !== this.wechaty.puppet.currentUserId) {
138
135
  throw new Error('only can get qrcode for the currentUser')
139
136
  }
@@ -162,7 +159,7 @@ class ContactSelfMixin extends MixinBase {
162
159
  public override name (name: string): Promise<void>
163
160
 
164
161
  public override name (name?: string): string | Promise<void> {
165
- log.verbose('ContactSelf', 'name(%s)', name || '')
162
+ this.log.verbose('ContactSelf', 'name(%s)', name || '')
166
163
 
167
164
  if (typeof name === 'undefined') {
168
165
  return super.name()
@@ -179,7 +176,7 @@ class ContactSelfMixin extends MixinBase {
179
176
  public override realName (realName: string): Promise<void>
180
177
 
181
178
  public override realName (realName?: string): string | Promise<void> {
182
- log.verbose('ContactSelf', 'realName(%s)', realName || '')
179
+ this.log.verbose('ContactSelf', 'realName(%s)', realName || '')
183
180
 
184
181
  if (typeof realName === 'undefined') {
185
182
  return super.realName()
@@ -196,7 +193,7 @@ class ContactSelfMixin extends MixinBase {
196
193
  public override aka (aka: string): Promise<void>
197
194
 
198
195
  public override aka (aka?: string): string | Promise<void> {
199
- log.verbose('ContactSelf', 'aka(%s)', aka || '')
196
+ this.log.verbose('ContactSelf', 'aka(%s)', aka || '')
200
197
 
201
198
  if (typeof aka === 'undefined') {
202
199
  return super.aka()
@@ -225,7 +222,7 @@ class ContactSelfMixin extends MixinBase {
225
222
  * })
226
223
  */
227
224
  public async signature (signature: string): Promise<void> {
228
- log.verbose('ContactSelf', 'signature()')
225
+ this.log.verbose('ContactSelf', 'signature()')
229
226
 
230
227
  if (this.id !== this.wechaty.puppet.currentUserId) {
231
228
  throw new Error('only can change signature for user self')
@@ -235,7 +232,7 @@ class ContactSelfMixin extends MixinBase {
235
232
  }
236
233
 
237
234
  public async roomAlias (room: RoomInterface, alias?: string): Promise<void | string> {
238
- log.verbose('ContactSelf', 'roomAlias()')
235
+ this.log.verbose('ContactSelf', 'roomAlias()')
239
236
 
240
237
  if (typeof alias === 'undefined') {
241
238
  return room.alias(this)
@@ -28,10 +28,6 @@ import type {
28
28
  Constructor,
29
29
  } from 'clone-class'
30
30
 
31
- import {
32
- log,
33
- } from '../config.js'
34
-
35
31
  import { ContactEventEmitter } from '../schemas/mod.js'
36
32
 
37
33
  import {
@@ -98,7 +94,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
98
94
  static async find (
99
95
  query : string | PUPPET.filters.Contact,
100
96
  ): Promise<undefined | ContactInterface> {
101
- log.silly('Contact', 'find(%s)', JSON.stringify(query, stringifyFilter))
97
+ this.log.silly('Contact', 'find(%s)', JSON.stringify(query, stringifyFilter))
102
98
 
103
99
  if (typeof query === 'object' && query.id) {
104
100
  let contact: ContactImpl
@@ -129,7 +125,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
129
125
  }
130
126
 
131
127
  if (contactList.length > 1) {
132
- log.warn('Contact', 'find() got more than 1 result: %d total', contactList.length)
128
+ this.log.warn('Contact', 'find() got more than 1 result: %d total', contactList.length)
133
129
  }
134
130
 
135
131
  for (const [ idx, contact ] of contactList.entries()) {
@@ -138,15 +134,15 @@ class ContactMixin extends MixinBase implements SayableSayer {
138
134
  // https://github.com/wechaty/wechaty/issues/1345
139
135
  const valid = await this.wechaty.puppet.contactValidate(contact.id)
140
136
  if (valid) {
141
- log.silly('Contact', 'find() contact<id=%s> is valid, return it', idx, contact.id)
137
+ this.log.silly('Contact', 'find() contact<id=%s> is valid, return it', idx, contact.id)
142
138
  return contact
143
139
  } else {
144
- log.silly('Contact', 'find() contact<id=%s> is invalid, skip it', idx, contact.id)
140
+ this.log.silly('Contact', 'find() contact<id=%s> is invalid, skip it', idx, contact.id)
145
141
  }
146
142
 
147
143
  }
148
144
 
149
- log.warn('Contact', 'find() all of %d contacts are invalid', contactList.length)
145
+ this.log.warn('Contact', 'find() all of %d contacts are invalid', contactList.length)
150
146
  return undefined
151
147
  }
152
148
 
@@ -172,7 +168,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
172
168
  static async findAll (
173
169
  query? : string | PUPPET.filters.Contact,
174
170
  ): Promise<ContactInterface[]> {
175
- log.verbose('Contact', 'findAll(%s)', JSON.stringify(query, stringifyFilter) || '')
171
+ this.log.verbose('Contact', 'findAll(%s)', JSON.stringify(query, stringifyFilter) || '')
176
172
 
177
173
  const contactIdList: string[] = await this.wechaty.puppet.contactSearch(query)
178
174
 
@@ -242,7 +238,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
242
238
  opts? : { batch?: number },
243
239
  ): AsyncIterable<ContactInterface[]> {
244
240
  const batch = opts?.batch ?? 100
245
- log.verbose('Contact', 'findAllIter(%s, batch=%d)', JSON.stringify(query, stringifyFilter) || '', batch)
241
+ this.log.verbose('Contact', 'findAllIter(%s, batch=%d)', JSON.stringify(query, stringifyFilter) || '', batch)
246
242
 
247
243
  if (batch <= 0) {
248
244
  throw new Error(`Contact.findAllIter() batch must be positive, got ${batch}`)
@@ -263,7 +259,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
263
259
  for (const id of idChunk) {
264
260
  const payload = payloadMap.get(id)
265
261
  if (!payload) {
266
- log.silly('Contact', 'findAllIter() payload missing for id=%s, skip', id)
262
+ this.log.silly('Contact', 'findAllIter() payload missing for id=%s, skip', id)
267
263
  continue
268
264
  }
269
265
 
@@ -278,7 +274,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
278
274
  if (contactChunk.length > 0) {
279
275
  yield contactChunk
280
276
  } else {
281
- log.warn('Contact', 'findAllIter() batch all missing from payloadMap, idChunk=%j', idChunk)
277
+ this.log.warn('Contact', 'findAllIter() batch all missing from payloadMap, idChunk=%j', idChunk)
282
278
  }
283
279
  }
284
280
  }
@@ -348,7 +344,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
348
344
  // TODO
349
345
  // eslint-disable-next-line no-use-before-define
350
346
  static async delete (contact: ContactInterface): Promise<void> {
351
- log.verbose('Contact', 'static delete(%s)', contact.id)
347
+ this.log.verbose('Contact', 'static delete(%s)', contact.id)
352
348
  await this.wechaty.puppet.contactDelete(contact.id)
353
349
  }
354
350
 
@@ -367,7 +363,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
367
363
  public readonly id: string,
368
364
  ) {
369
365
  super()
370
- log.silly('Contact', `constructor(${id})`)
366
+ this.log.silly('Contact', `constructor(${id})`)
371
367
  }
372
368
 
373
369
  /**
@@ -458,10 +454,10 @@ class ContactMixin extends MixinBase implements SayableSayer {
458
454
  sayable: Sayable,
459
455
  options?: SayOptionsObject,
460
456
  ): Promise<void | MessageInterface> {
461
- log.verbose('Contact', 'say(%s)', sayable)
457
+ this.log.verbose('Contact', 'say(%s)', sayable)
462
458
 
463
459
  if (options?.mentionList) {
464
- log.warn('Contact', 'you cannot mention someone in private conversation!')
460
+ this.log.warn('Contact', 'you cannot mention someone in private conversation!')
465
461
  delete options.mentionList
466
462
  }
467
463
 
@@ -488,7 +484,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
488
484
  * call.on('ended', () => console.log('call ended'))
489
485
  */
490
486
  async call (options?: { media?: PUPPET.types.CallMediaType }): Promise<CallInterface> {
491
- log.verbose('Contact', 'call(%s)', JSON.stringify(options ?? {}))
487
+ this.log.verbose('Contact', 'call(%s)', JSON.stringify(options ?? {}))
492
488
  return (this.wechaty as any).call([ this as unknown as ContactInterface ], options)
493
489
  }
494
490
 
@@ -547,7 +543,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
547
543
  * }
548
544
  */
549
545
  async alias (newAlias?: null | string): Promise<void | undefined | string> {
550
- log.silly('Contact', 'alias(%s)',
546
+ this.log.silly('Contact', 'alias(%s)',
551
547
  newAlias === undefined
552
548
  ? ''
553
549
  : newAlias,
@@ -594,7 +590,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
594
590
  }
595
591
  } catch (e) {
596
592
  this.wechaty.emitError(e)
597
- log.error('Contact', 'alias(%s) rejected: %s', newAlias, (e as Error).message)
593
+ this.log.error('Contact', 'alias(%s) rejected: %s', newAlias, (e as Error).message)
598
594
  }
599
595
  }
600
596
 
@@ -623,7 +619,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
623
619
  async phone (): Promise<string[]>
624
620
  async phone (phoneList: string[]): Promise<void>
625
621
  async phone (phoneList?: string[]): Promise<string[] | void> {
626
- log.silly('Contact', 'phone(%s)', phoneList === undefined ? '' : JSON.stringify(phoneList))
622
+ this.log.silly('Contact', 'phone(%s)', phoneList === undefined ? '' : JSON.stringify(phoneList))
627
623
 
628
624
  if (!this.payload) {
629
625
  throw new Error('no payload')
@@ -639,14 +635,14 @@ class ContactMixin extends MixinBase implements SayableSayer {
639
635
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
640
636
  } catch (e) {
641
637
  this.wechaty.emitError(e)
642
- log.error('Contact', 'phone(%s) rejected: %s', JSON.stringify(phoneList), (e as Error).message)
638
+ this.log.error('Contact', 'phone(%s) rejected: %s', JSON.stringify(phoneList), (e as Error).message)
643
639
  }
644
640
  }
645
641
 
646
642
  async corporation (): Promise<undefined | string>
647
643
  async corporation (remark: string | null): Promise<void>
648
644
  async corporation (remark?: string | null): Promise<void | undefined | string> {
649
- log.silly('Contact', 'corporation(%s)', remark)
645
+ this.log.silly('Contact', 'corporation(%s)', remark)
650
646
 
651
647
  if (!this.payload) {
652
648
  throw new Error('no payload')
@@ -666,14 +662,14 @@ class ContactMixin extends MixinBase implements SayableSayer {
666
662
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
667
663
  } catch (e) {
668
664
  this.wechaty.emitError(e)
669
- log.error('Contact', 'corporation(%s) rejected: %s', remark, (e as Error).message)
665
+ this.log.error('Contact', 'corporation(%s) rejected: %s', remark, (e as Error).message)
670
666
  }
671
667
  }
672
668
 
673
669
  async description (): Promise<undefined | string>
674
670
  async description (newDescription: string | null): Promise<void>
675
671
  async description (newDescription?: string | null): Promise<void | undefined | string> {
676
- log.silly('Contact', 'description(%s)', newDescription)
672
+ this.log.silly('Contact', 'description(%s)', newDescription)
677
673
 
678
674
  if (!this.payload) {
679
675
  throw new Error('no payload')
@@ -689,7 +685,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
689
685
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
690
686
  } catch (e) {
691
687
  this.wechaty.emitError(e)
692
- log.error('Contact', 'description(%s) rejected: %s', newDescription, (e as Error).message)
688
+ this.log.error('Contact', 'description(%s) rejected: %s', newDescription, (e as Error).message)
693
689
  }
694
690
  }
695
691
 
@@ -723,7 +719,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
723
719
  * const isFriend = contact.friend()
724
720
  */
725
721
  friend (): undefined | boolean {
726
- log.verbose('Contact', 'friend()')
722
+ this.log.verbose('Contact', 'friend()')
727
723
  return this.payload?.friend
728
724
  }
729
725
 
@@ -813,7 +809,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
813
809
  * console.log(`Contact: ${contact.name()} with avatar file: ${name}`)
814
810
  */
815
811
  async avatar (): Promise<FileBoxInterface> {
816
- log.verbose('Contact', 'avatar()')
812
+ this.log.verbose('Contact', 'avatar()')
817
813
 
818
814
  const fileBox = await this.wechaty.puppet.contactAvatar(this.id)
819
815
  return fileBox
@@ -827,7 +823,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
827
823
  * const tags = await contact.tags()
828
824
  */
829
825
  async tags (): Promise<TagInterface[]> {
830
- log.verbose('Contact', 'tags() for %s', this)
826
+ this.log.verbose('Contact', 'tags() for %s', this)
831
827
 
832
828
  try {
833
829
  const tagPayloadList = this.payload?.tags || []
@@ -837,7 +833,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
837
833
  return tagList.filter(tag => !!tag) as TagInterface[]
838
834
  } catch (e) {
839
835
  this.wechaty.emitError(e)
840
- log.error('Contact', 'tags() exception: %s', (e as Error).message)
836
+ this.log.error('Contact', 'tags() exception: %s', (e as Error).message)
841
837
  return []
842
838
  }
843
839
  }
@@ -847,7 +843,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
847
843
  */
848
844
 
849
845
  async tag (tags: TagInterface | TagInterface[]): Promise<void> {
850
- log.verbose('Contact', 'tag(%s) for %s', JSON.stringify(tags), this)
846
+ this.log.verbose('Contact', 'tag(%s) for %s', JSON.stringify(tags), this)
851
847
 
852
848
  if (!Array.isArray(tags)) {
853
849
  tags = [ tags ]
@@ -863,7 +859,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
863
859
  */
864
860
 
865
861
  async tagRemove (tags: TagInterface | TagInterface[]): Promise<void> {
866
- log.verbose('Contact', 'tagRemove(%s) for %s', JSON.stringify(tags), this)
862
+ this.log.verbose('Contact', 'tagRemove(%s) for %s', JSON.stringify(tags), this)
867
863
 
868
864
  if (!Array.isArray(tags)) {
869
865
  tags = [ tags ]
@@ -898,20 +894,20 @@ class ContactMixin extends MixinBase implements SayableSayer {
898
894
  async ready (
899
895
  forceSync = false,
900
896
  ): Promise<void> {
901
- log.silly('Contact', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
897
+ this.log.silly('Contact', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
902
898
 
903
899
  if (!forceSync && this.isReady()) { // already ready
904
- log.silly('Contact', 'ready() isReady() true')
900
+ this.log.silly('Contact', 'ready() isReady() true')
905
901
  return
906
902
  }
907
903
 
908
904
  try {
909
905
  this.payload = await this.wechaty.puppet.contactPayload(this.id)
910
- // log.silly('Contact', `ready() this.wechaty.puppet.contactPayload(%s) resolved`, this)
906
+ // this.log.silly('Contact', `ready() this.wechaty.puppet.contactPayload(%s) resolved`, this)
911
907
 
912
908
  } catch (e) {
913
909
  this.wechaty.emitError(e)
914
- log.verbose('Contact', 'ready() this.wechaty.puppet.contactPayload(%s) exception: %s',
910
+ this.log.verbose('Contact', 'ready() this.wechaty.puppet.contactPayload(%s) exception: %s',
915
911
  this.id,
916
912
  (e as Error).message,
917
913
  )
@@ -941,7 +937,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
941
937
  }
942
938
  } catch (e) {
943
939
  this.wechaty.emitError(e)
944
- log.error('Contact', 'readMark() exception: %s', (e as Error).message)
940
+ this.log.error('Contact', 'readMark() exception: %s', (e as Error).message)
945
941
  }
946
942
  }
947
943
 
@@ -950,7 +946,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
950
946
  await this.wechaty.puppet.endConversation(this.id)
951
947
  } catch (e) {
952
948
  this.wechaty.emitError(e)
953
- log.error('Contact', 'endConversation() exception: %s', (e as Error).message)
949
+ this.log.error('Contact', 'endConversation() exception: %s', (e as Error).message)
954
950
  }
955
951
  }
956
952
 
@@ -994,7 +990,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
994
990
  * @deprecated use `handle()` instead
995
991
  */
996
992
  weixin (): undefined | string {
997
- // log.warn('Contact', 'weixin() is deprecated, use `handle()` instead.')
993
+ // this.log.warn('Contact', 'weixin() is deprecated, use `handle()` instead.')
998
994
  // console.error(new Error().stack)
999
995
  return this.payload?.weixin
1000
996
  }
@@ -1005,7 +1001,7 @@ class ContactMixin extends MixinBase implements SayableSayer {
1005
1001
  try {
1006
1002
  additionalInfoObj = JSON.parse(this.payload.additionalInfo)
1007
1003
  } catch (e) {
1008
- log.warn('Contact', 'additionalInfo() parse failed, additionalInfo: %s', this.payload.additionalInfo)
1004
+ this.log.warn('Contact', 'additionalInfo() parse failed, additionalInfo: %s', this.payload.additionalInfo)
1009
1005
  }
1010
1006
  }
1011
1007
  return additionalInfoObj
@@ -1,5 +1,4 @@
1
1
  import type { Constructor } from 'clone-class'
2
- import { log } from '../config.js'
3
2
 
4
3
  import { validationMixin } from '../user-mixins/validation.js'
5
4
 
@@ -15,7 +14,7 @@ class DouyinOneClickPhoneCollectionMixin extends wechatifyMixinBase() {
15
14
  *
16
15
  */
17
16
  static async create (): Promise<DouyinOneClickPhoneCollectionInterface> {
18
- log.verbose('DouyinOneClickPhoneCollection', 'create()')
17
+ this.log.verbose('DouyinOneClickPhoneCollection', 'create()')
19
18
 
20
19
  return new this({})
21
20
  }
@@ -27,7 +26,7 @@ class DouyinOneClickPhoneCollectionMixin extends wechatifyMixinBase() {
27
26
  public readonly payload: {},
28
27
  ) {
29
28
  super()
30
- log.verbose('DouyinOneClickPhoneCollection', 'constructor()')
29
+ this.log.verbose('DouyinOneClickPhoneCollection', 'constructor()')
31
30
  // Huan(202110): it is ok to create a raw one without wechaty instance
32
31
  // guardWechatifyClass.call(this, DouyinOneClickPhoneCollection)
33
32
  }
@@ -17,7 +17,6 @@
17
17
  * limitations under the License.
18
18
  *
19
19
  */
20
- import { log } from '@juzi/wechaty-puppet'
21
20
  import type { Constructor } from 'clone-class'
22
21
  import { validationMixin } from '../user-mixins/validation.js'
23
22
 
@@ -41,7 +40,7 @@ class FavoriteMixin extends wechatifyMixinBase() {
41
40
  * const tags = await wechaty.Favorite.tags()
42
41
  */
43
42
  static async tags (): Promise<TagInterface[]> {
44
- log.verbose('Favorite', 'static tags() for %s', this)
43
+ this.log.verbose('Favorite', 'static tags() for %s', this)
45
44
 
46
45
  // TODO:
47
46
  // try {
@@ -19,7 +19,6 @@
19
19
  */
20
20
  import { EventEmitter } from 'events'
21
21
  import * as PUPPET from '@juzi/wechaty-puppet'
22
- import { log } from '@juzi/wechaty-puppet'
23
22
  import type { Constructor } from 'clone-class'
24
23
 
25
24
  import {
@@ -98,7 +97,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
98
97
  queryFilter : PUPPET.filters.Friendship,
99
98
  type?: PUPPET.types.Contact,
100
99
  ): Promise<undefined | ContactInterface> {
101
- log.verbose('Friendship', 'static search("%s")',
100
+ this.log.verbose('Friendship', 'static search("%s")',
102
101
  JSON.stringify(queryFilter),
103
102
  )
104
103
  if (typeof (type) === 'undefined') {
@@ -141,13 +140,13 @@ class FriendshipMixin extends MixinBase implements Accepter {
141
140
  contact : ContactInterface,
142
141
  options : FriendshipAddOptions,
143
142
  ): Promise<void> {
144
- log.verbose('Friendship', 'static add(%s, %s)',
143
+ this.log.verbose('Friendship', 'static add(%s, %s)',
145
144
  contact.id,
146
145
  typeof options === 'string' ? options : options.hello,
147
146
  )
148
147
 
149
148
  if (typeof options === 'string') {
150
- log.warn('Friendship', 'the params hello is deprecated in the next version, please put the attr hello into options object, e.g. { hello: "xxxx" }')
149
+ this.log.warn('Friendship', 'the params hello is deprecated in the next version, please put the attr hello into options object, e.g. { hello: "xxxx" }')
151
150
  await this.wechaty.puppet.friendshipAdd(contact.id, { hello: options })
152
151
  } else {
153
152
  const friendOption: PUPPET.types.FriendshipAddOptions = {
@@ -162,7 +161,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
162
161
  static async del (
163
162
  contact: ContactInterface,
164
163
  ): Promise<void> {
165
- log.verbose('Friendship', 'static del(%s)', contact.id)
164
+ this.log.verbose('Friendship', 'static del(%s)', contact.id)
166
165
  throw new Error('to be implemented')
167
166
  }
168
167
 
@@ -184,7 +183,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
184
183
  public readonly id: string,
185
184
  ) {
186
185
  super()
187
- log.verbose('Friendship', 'constructor(id=%s)', id)
186
+ this.log.verbose('Friendship', 'constructor(id=%s)', id)
188
187
  }
189
188
 
190
189
  override toString () {
@@ -254,7 +253,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
254
253
  * .start()
255
254
  */
256
255
  async accept (): Promise<void> {
257
- log.verbose('Friendship', 'accept()')
256
+ this.log.verbose('Friendship', 'accept()')
258
257
 
259
258
  if (!this.payload) {
260
259
  throw new Error('no payload')
@@ -264,7 +263,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
264
263
  throw new Error('accept() need type to be FriendshipType.Receive, but it got a ' + FriendshipImpl.Type[this.payload.type])
265
264
  }
266
265
 
267
- log.silly('Friendship', 'accept() to %s', this.payload.contactId)
266
+ this.log.silly('Friendship', 'accept() to %s', this.payload.contactId)
268
267
 
269
268
  await this.wechaty.puppet.friendshipAccept(this.id)
270
269
 
@@ -276,14 +275,14 @@ class FriendshipMixin extends MixinBase implements Accepter {
276
275
  if (!contact.isReady()) {
277
276
  throw new Error('Friendship.accept() contact.ready() not ready')
278
277
  }
279
- log.verbose('Friendship', 'accept() with contact %s ready()', contact.name())
278
+ this.log.verbose('Friendship', 'accept() with contact %s ready()', contact.name())
280
279
  }
281
280
 
282
281
  await retryPolicy.execute(doSync)
283
282
 
284
283
  } catch (e) {
285
284
  this.wechaty.emitError(e)
286
- log.warn('Friendship', 'accept() contact %s not ready because of %s', contact, (e && (e as Error).message) || e)
285
+ this.log.warn('Friendship', 'accept() contact %s not ready because of %s', contact, (e && (e as Error).message) || e)
287
286
  // console.error(e)
288
287
  }
289
288
 
@@ -384,7 +383,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
384
383
  * .start()
385
384
  */
386
385
  toJSON (): string {
387
- log.verbose('Friendship', 'toJSON()')
386
+ this.log.verbose('Friendship', 'toJSON()')
388
387
 
389
388
  if (!this.isReady()) {
390
389
  throw new Error(`Friendship<${this.id}> needs to be ready. Please call ready() before toJSON()`)
@@ -405,7 +404,7 @@ class FriendshipMixin extends MixinBase implements Accepter {
405
404
  static async fromJSON (
406
405
  payload: string | PUPPET.payloads.Friendship,
407
406
  ): Promise<FriendshipInterface> {
408
- log.verbose('Friendship', 'static fromJSON(%s)',
407
+ this.log.verbose('Friendship', 'static fromJSON(%s)',
409
408
  typeof payload === 'string'
410
409
  ? payload
411
410
  : JSON.stringify(payload),
@@ -1,4 +1,3 @@
1
- import { log } from '@juzi/wechaty-puppet'
2
1
  import type { Constructor } from 'clone-class'
3
2
 
4
3
  import { validationMixin } from '../user-mixins/validation.js'
@@ -36,7 +35,7 @@ class ImSpecificMixin extends wechatifyMixinBase() {
36
35
  */
37
36
  constructor () {
38
37
  super()
39
- log.verbose('ImSpecific', 'constructor()')
38
+ this.log.verbose('ImSpecific', 'constructor()')
40
39
  }
41
40
 
42
41
  }
@@ -23,7 +23,6 @@ import type {
23
23
  } from 'file-box'
24
24
  import type { Constructor } from 'clone-class'
25
25
  import { validationMixin } from '../user-mixins/validation.js'
26
- import { log } from '../config.js'
27
26
 
28
27
  import {
29
28
  wechatifyMixinBase,
@@ -32,7 +31,7 @@ import {
32
31
  class ImageMixin extends wechatifyMixinBase() {
33
32
 
34
33
  static create (id: string): ImageInterface {
35
- log.verbose('Image', 'static create(%s)', id)
34
+ this.log.verbose('Image', 'static create(%s)', id)
36
35
 
37
36
  const image = new this(id)
38
37
  return image
@@ -42,11 +41,11 @@ class ImageMixin extends wechatifyMixinBase() {
42
41
  public id: string,
43
42
  ) {
44
43
  super()
45
- log.verbose('Image', 'constructor(%s)', id)
44
+ this.log.verbose('Image', 'constructor(%s)', id)
46
45
  }
47
46
 
48
47
  async thumbnail (): Promise<FileBoxInterface> {
49
- log.verbose('Image', 'thumbnail() for id: "%s"', this.id)
48
+ this.log.verbose('Image', 'thumbnail() for id: "%s"', this.id)
50
49
  const fileBox = await this.wechaty.puppet.messageImage(
51
50
  this.id,
52
51
  PUPPET.types.Image.Thumbnail,
@@ -55,7 +54,7 @@ class ImageMixin extends wechatifyMixinBase() {
55
54
  }
56
55
 
57
56
  async hd (): Promise<FileBoxInterface> {
58
- log.verbose('Image', 'hd() for id: "%s"', this.id)
57
+ this.log.verbose('Image', 'hd() for id: "%s"', this.id)
59
58
  const fileBox = await this.wechaty.puppet.messageImage(
60
59
  this.id,
61
60
  PUPPET.types.Image.HD,
@@ -64,7 +63,7 @@ class ImageMixin extends wechatifyMixinBase() {
64
63
  }
65
64
 
66
65
  async artwork (): Promise<FileBoxInterface> {
67
- log.verbose('Image', 'artwork() for id: "%s"', this.id)
66
+ this.log.verbose('Image', 'artwork() for id: "%s"', this.id)
68
67
  const fileBox = await this.wechaty.puppet.messageImage(
69
68
  this.id,
70
69
  PUPPET.types.Image.Artwork,
@@ -19,7 +19,6 @@
19
19
  */
20
20
  import type * as PUPPET from '@juzi/wechaty-puppet'
21
21
  import type { Constructor } from 'clone-class'
22
- import { log } from '../config.js'
23
22
 
24
23
  import { validationMixin } from '../user-mixins/validation.js'
25
24
  import {
@@ -35,7 +34,7 @@ class LocationMixin extends wechatifyMixinBase() {
35
34
  * See: https://en.wikipedia.org/wiki/Point_of_interest
36
35
  */
37
36
  static async create (poi: string): Promise<LocationInterface> {
38
- log.verbose('Location', 'create(%s)', poi)
37
+ this.log.verbose('Location', 'create(%s)', poi)
39
38
 
40
39
  const payload: PUPPET.payloads.Location = {
41
40
  accuracy : 15, // in meters
@@ -55,7 +54,7 @@ class LocationMixin extends wechatifyMixinBase() {
55
54
  public readonly payload: PUPPET.payloads.Location,
56
55
  ) {
57
56
  super()
58
- log.verbose('Location', 'constructor()')
57
+ this.log.verbose('Location', 'constructor()')
59
58
  // Huan(202110): it is ok to create a raw one without wechaty instance
60
59
  // guardWechatifyClass.call(this, Location)
61
60
  }