@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.
- package/dist/cjs/src/io.js +40 -40
- package/dist/cjs/src/io.js.map +1 -1
- package/dist/cjs/src/package-json.js +4 -4
- package/dist/cjs/src/schemas/logger.d.ts +2 -0
- package/dist/cjs/src/schemas/logger.d.ts.map +1 -0
- package/dist/cjs/src/schemas/logger.js +3 -0
- package/dist/cjs/src/schemas/logger.js.map +1 -0
- package/dist/cjs/src/schemas/mod.d.ts +2 -1
- package/dist/cjs/src/schemas/mod.d.ts.map +1 -1
- package/dist/cjs/src/schemas/mod.js.map +1 -1
- package/dist/cjs/src/schemas/wechaty-options.d.ts +19 -0
- package/dist/cjs/src/schemas/wechaty-options.d.ts.map +1 -1
- package/dist/cjs/src/user-mixins/wechatify.d.ts +23 -0
- package/dist/cjs/src/user-mixins/wechatify.d.ts.map +1 -1
- package/dist/cjs/src/user-mixins/wechatify.js +25 -0
- package/dist/cjs/src/user-mixins/wechatify.js.map +1 -1
- package/dist/cjs/src/user-modules/call.d.ts +4 -0
- package/dist/cjs/src/user-modules/call.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/call.js +6 -7
- package/dist/cjs/src/user-modules/call.js.map +1 -1
- package/dist/cjs/src/user-modules/channel-card.d.ts +2 -0
- package/dist/cjs/src/user-modules/channel-card.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/channel-card.js +2 -3
- package/dist/cjs/src/user-modules/channel-card.js.map +1 -1
- package/dist/cjs/src/user-modules/channel.d.ts +2 -0
- package/dist/cjs/src/user-modules/channel.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/channel.js +2 -3
- package/dist/cjs/src/user-modules/channel.js.map +1 -1
- package/dist/cjs/src/user-modules/chat-history.d.ts +2 -0
- package/dist/cjs/src/user-modules/chat-history.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/chat-history.js +2 -3
- package/dist/cjs/src/user-modules/chat-history.js.map +1 -1
- package/dist/cjs/src/user-modules/consult-card.d.ts +2 -0
- package/dist/cjs/src/user-modules/consult-card.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/consult-card.js +3 -4
- package/dist/cjs/src/user-modules/consult-card.js.map +1 -1
- package/dist/cjs/src/user-modules/contact-self.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/contact-self.js +8 -9
- package/dist/cjs/src/user-modules/contact-self.js.map +1 -1
- package/dist/cjs/src/user-modules/contact.d.ts +2 -0
- package/dist/cjs/src/user-modules/contact.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/contact.js +36 -37
- package/dist/cjs/src/user-modules/contact.js.map +1 -1
- package/dist/cjs/src/user-modules/delay.d.ts +2 -0
- package/dist/cjs/src/user-modules/delay.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
- package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js +2 -3
- package/dist/cjs/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
- package/dist/cjs/src/user-modules/favorite.d.ts +21 -0
- package/dist/cjs/src/user-modules/favorite.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/favorite.js +1 -21
- package/dist/cjs/src/user-modules/favorite.js.map +1 -1
- package/dist/cjs/src/user-modules/friendship.d.ts +2 -0
- package/dist/cjs/src/user-modules/friendship.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/friendship.js +11 -12
- package/dist/cjs/src/user-modules/friendship.js.map +1 -1
- package/dist/cjs/src/user-modules/im-specific.d.ts +2 -0
- package/dist/cjs/src/user-modules/im-specific.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/im-specific.js +1 -2
- package/dist/cjs/src/user-modules/im-specific.js.map +1 -1
- package/dist/cjs/src/user-modules/image.d.ts +22 -0
- package/dist/cjs/src/user-modules/image.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/image.js +5 -6
- package/dist/cjs/src/user-modules/image.js.map +1 -1
- package/dist/cjs/src/user-modules/location.d.ts +2 -0
- package/dist/cjs/src/user-modules/location.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/location.js +2 -3
- package/dist/cjs/src/user-modules/location.js.map +1 -1
- package/dist/cjs/src/user-modules/message.d.ts +2 -0
- package/dist/cjs/src/user-modules/message.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/message.js +55 -55
- package/dist/cjs/src/user-modules/message.js.map +1 -1
- package/dist/cjs/src/user-modules/mini-program.d.ts +2 -0
- package/dist/cjs/src/user-modules/mini-program.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/mini-program.js +2 -3
- package/dist/cjs/src/user-modules/mini-program.js.map +1 -1
- package/dist/cjs/src/user-modules/moment.d.ts +21 -0
- package/dist/cjs/src/user-modules/moment.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/moment.js +5 -25
- package/dist/cjs/src/user-modules/moment.js.map +1 -1
- package/dist/cjs/src/user-modules/money.d.ts +2 -0
- package/dist/cjs/src/user-modules/money.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/post.d.ts +2 -0
- package/dist/cjs/src/user-modules/post.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/post.js +25 -25
- package/dist/cjs/src/user-modules/post.js.map +1 -1
- package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts +2 -0
- package/dist/cjs/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/premium-online-appointment-card.js +2 -3
- package/dist/cjs/src/user-modules/premium-online-appointment-card.js.map +1 -1
- package/dist/cjs/src/user-modules/room-invitation.d.ts +2 -0
- package/dist/cjs/src/user-modules/room-invitation.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/room-invitation.js +10 -11
- package/dist/cjs/src/user-modules/room-invitation.js.map +1 -1
- package/dist/cjs/src/user-modules/room.d.ts +2 -0
- package/dist/cjs/src/user-modules/room.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/room.js +43 -43
- package/dist/cjs/src/user-modules/room.js.map +1 -1
- package/dist/cjs/src/user-modules/tag-group.d.ts +2 -0
- package/dist/cjs/src/user-modules/tag-group.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/tag-group.js +13 -14
- package/dist/cjs/src/user-modules/tag-group.js.map +1 -1
- package/dist/cjs/src/user-modules/tag.d.ts +2 -0
- package/dist/cjs/src/user-modules/tag.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/tag.js +21 -22
- package/dist/cjs/src/user-modules/tag.js.map +1 -1
- package/dist/cjs/src/user-modules/url-link.d.ts +2 -0
- package/dist/cjs/src/user-modules/url-link.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/url-link.js +2 -3
- package/dist/cjs/src/user-modules/url-link.js.map +1 -1
- package/dist/cjs/src/user-modules/voice.d.ts +2 -0
- package/dist/cjs/src/user-modules/voice.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/voice.js +8 -9
- package/dist/cjs/src/user-modules/voice.js.map +1 -1
- package/dist/cjs/src/user-modules/wecom.d.ts +3 -1
- package/dist/cjs/src/user-modules/wecom.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/wecom.js +2 -3
- package/dist/cjs/src/user-modules/wecom.js.map +1 -1
- package/dist/cjs/src/user-modules/wxxd-order.d.ts +2 -0
- package/dist/cjs/src/user-modules/wxxd-order.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/wxxd-order.js +9 -10
- package/dist/cjs/src/user-modules/wxxd-order.js.map +1 -1
- package/dist/cjs/src/user-modules/wxxd-product.d.ts +2 -0
- package/dist/cjs/src/user-modules/wxxd-product.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/wxxd-product.js +6 -7
- package/dist/cjs/src/user-modules/wxxd-product.js.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-base.d.ts +21 -37
- package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-base.js +17 -17
- package/dist/cjs/src/wechaty/wechaty-base.js.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts +15 -4
- package/dist/cjs/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-skeleton.js +17 -6
- package/dist/cjs/src/wechaty/wechaty-skeleton.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
- package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts +12 -6
- package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/io-mixin.js +8 -8
- package/dist/cjs/src/wechaty-mixins/io-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +53 -19
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/login-mixin.js +5 -5
- package/dist/cjs/src/wechaty-mixins/login-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +21 -10
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/misc-mixin.js +1 -1
- package/dist/cjs/src/wechaty-mixins/misc-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.js +5 -5
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +3 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +1 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +121 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +1 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +16 -12
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js +116 -64
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/dist/esm/src/io.js +40 -40
- package/dist/esm/src/io.js.map +1 -1
- package/dist/esm/src/package-json.js +4 -4
- package/dist/esm/src/schemas/logger.d.ts +2 -0
- package/dist/esm/src/schemas/logger.d.ts.map +1 -0
- package/dist/esm/src/schemas/logger.js +2 -0
- package/dist/esm/src/schemas/logger.js.map +1 -0
- package/dist/esm/src/schemas/mod.d.ts +2 -1
- package/dist/esm/src/schemas/mod.d.ts.map +1 -1
- package/dist/esm/src/schemas/mod.js.map +1 -1
- package/dist/esm/src/schemas/wechaty-options.d.ts +19 -0
- package/dist/esm/src/schemas/wechaty-options.d.ts.map +1 -1
- package/dist/esm/src/user-mixins/wechatify.d.ts +23 -0
- package/dist/esm/src/user-mixins/wechatify.d.ts.map +1 -1
- package/dist/esm/src/user-mixins/wechatify.js +25 -0
- package/dist/esm/src/user-mixins/wechatify.js.map +1 -1
- package/dist/esm/src/user-modules/call.d.ts +4 -0
- package/dist/esm/src/user-modules/call.d.ts.map +1 -1
- package/dist/esm/src/user-modules/call.js +6 -7
- package/dist/esm/src/user-modules/call.js.map +1 -1
- package/dist/esm/src/user-modules/channel-card.d.ts +2 -0
- package/dist/esm/src/user-modules/channel-card.d.ts.map +1 -1
- package/dist/esm/src/user-modules/channel-card.js +2 -3
- package/dist/esm/src/user-modules/channel-card.js.map +1 -1
- package/dist/esm/src/user-modules/channel.d.ts +2 -0
- package/dist/esm/src/user-modules/channel.d.ts.map +1 -1
- package/dist/esm/src/user-modules/channel.js +2 -3
- package/dist/esm/src/user-modules/channel.js.map +1 -1
- package/dist/esm/src/user-modules/chat-history.d.ts +2 -0
- package/dist/esm/src/user-modules/chat-history.d.ts.map +1 -1
- package/dist/esm/src/user-modules/chat-history.js +2 -3
- package/dist/esm/src/user-modules/chat-history.js.map +1 -1
- package/dist/esm/src/user-modules/consult-card.d.ts +2 -0
- package/dist/esm/src/user-modules/consult-card.d.ts.map +1 -1
- package/dist/esm/src/user-modules/consult-card.js +3 -4
- package/dist/esm/src/user-modules/consult-card.js.map +1 -1
- package/dist/esm/src/user-modules/contact-self.d.ts.map +1 -1
- package/dist/esm/src/user-modules/contact-self.js +8 -9
- package/dist/esm/src/user-modules/contact-self.js.map +1 -1
- package/dist/esm/src/user-modules/contact.d.ts +2 -0
- package/dist/esm/src/user-modules/contact.d.ts.map +1 -1
- package/dist/esm/src/user-modules/contact.js +36 -37
- package/dist/esm/src/user-modules/contact.js.map +1 -1
- package/dist/esm/src/user-modules/delay.d.ts +2 -0
- package/dist/esm/src/user-modules/delay.d.ts.map +1 -1
- package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts +2 -0
- package/dist/esm/src/user-modules/douyin-one-click-phone-collection.d.ts.map +1 -1
- package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js +2 -3
- package/dist/esm/src/user-modules/douyin-one-click-phone-collection.js.map +1 -1
- package/dist/esm/src/user-modules/favorite.d.ts +21 -0
- package/dist/esm/src/user-modules/favorite.d.ts.map +1 -1
- package/dist/esm/src/user-modules/favorite.js +1 -21
- package/dist/esm/src/user-modules/favorite.js.map +1 -1
- package/dist/esm/src/user-modules/friendship.d.ts +2 -0
- package/dist/esm/src/user-modules/friendship.d.ts.map +1 -1
- package/dist/esm/src/user-modules/friendship.js +11 -12
- package/dist/esm/src/user-modules/friendship.js.map +1 -1
- package/dist/esm/src/user-modules/im-specific.d.ts +2 -0
- package/dist/esm/src/user-modules/im-specific.d.ts.map +1 -1
- package/dist/esm/src/user-modules/im-specific.js +1 -2
- package/dist/esm/src/user-modules/im-specific.js.map +1 -1
- package/dist/esm/src/user-modules/image.d.ts +22 -0
- package/dist/esm/src/user-modules/image.d.ts.map +1 -1
- package/dist/esm/src/user-modules/image.js +5 -6
- package/dist/esm/src/user-modules/image.js.map +1 -1
- package/dist/esm/src/user-modules/location.d.ts +2 -0
- package/dist/esm/src/user-modules/location.d.ts.map +1 -1
- package/dist/esm/src/user-modules/location.js +2 -3
- package/dist/esm/src/user-modules/location.js.map +1 -1
- package/dist/esm/src/user-modules/message.d.ts +2 -0
- package/dist/esm/src/user-modules/message.d.ts.map +1 -1
- package/dist/esm/src/user-modules/message.js +56 -56
- package/dist/esm/src/user-modules/message.js.map +1 -1
- package/dist/esm/src/user-modules/mini-program.d.ts +2 -0
- package/dist/esm/src/user-modules/mini-program.d.ts.map +1 -1
- package/dist/esm/src/user-modules/mini-program.js +2 -3
- package/dist/esm/src/user-modules/mini-program.js.map +1 -1
- package/dist/esm/src/user-modules/moment.d.ts +21 -0
- package/dist/esm/src/user-modules/moment.d.ts.map +1 -1
- package/dist/esm/src/user-modules/moment.js +5 -25
- package/dist/esm/src/user-modules/moment.js.map +1 -1
- package/dist/esm/src/user-modules/money.d.ts +2 -0
- package/dist/esm/src/user-modules/money.d.ts.map +1 -1
- package/dist/esm/src/user-modules/post.d.ts +2 -0
- package/dist/esm/src/user-modules/post.d.ts.map +1 -1
- package/dist/esm/src/user-modules/post.js +25 -25
- package/dist/esm/src/user-modules/post.js.map +1 -1
- package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts +2 -0
- package/dist/esm/src/user-modules/premium-online-appointment-card.d.ts.map +1 -1
- package/dist/esm/src/user-modules/premium-online-appointment-card.js +2 -3
- package/dist/esm/src/user-modules/premium-online-appointment-card.js.map +1 -1
- package/dist/esm/src/user-modules/room-invitation.d.ts +2 -0
- package/dist/esm/src/user-modules/room-invitation.d.ts.map +1 -1
- package/dist/esm/src/user-modules/room-invitation.js +10 -11
- package/dist/esm/src/user-modules/room-invitation.js.map +1 -1
- package/dist/esm/src/user-modules/room.d.ts +2 -0
- package/dist/esm/src/user-modules/room.d.ts.map +1 -1
- package/dist/esm/src/user-modules/room.js +44 -44
- package/dist/esm/src/user-modules/room.js.map +1 -1
- package/dist/esm/src/user-modules/tag-group.d.ts +2 -0
- package/dist/esm/src/user-modules/tag-group.d.ts.map +1 -1
- package/dist/esm/src/user-modules/tag-group.js +13 -14
- package/dist/esm/src/user-modules/tag-group.js.map +1 -1
- package/dist/esm/src/user-modules/tag.d.ts +2 -0
- package/dist/esm/src/user-modules/tag.d.ts.map +1 -1
- package/dist/esm/src/user-modules/tag.js +21 -22
- package/dist/esm/src/user-modules/tag.js.map +1 -1
- package/dist/esm/src/user-modules/url-link.d.ts +2 -0
- package/dist/esm/src/user-modules/url-link.d.ts.map +1 -1
- package/dist/esm/src/user-modules/url-link.js +2 -3
- package/dist/esm/src/user-modules/url-link.js.map +1 -1
- package/dist/esm/src/user-modules/voice.d.ts +2 -0
- package/dist/esm/src/user-modules/voice.d.ts.map +1 -1
- package/dist/esm/src/user-modules/voice.js +8 -9
- package/dist/esm/src/user-modules/voice.js.map +1 -1
- package/dist/esm/src/user-modules/wecom.d.ts +3 -1
- package/dist/esm/src/user-modules/wecom.d.ts.map +1 -1
- package/dist/esm/src/user-modules/wecom.js +2 -3
- package/dist/esm/src/user-modules/wecom.js.map +1 -1
- package/dist/esm/src/user-modules/wxxd-order.d.ts +2 -0
- package/dist/esm/src/user-modules/wxxd-order.d.ts.map +1 -1
- package/dist/esm/src/user-modules/wxxd-order.js +9 -10
- package/dist/esm/src/user-modules/wxxd-order.js.map +1 -1
- package/dist/esm/src/user-modules/wxxd-product.d.ts +2 -0
- package/dist/esm/src/user-modules/wxxd-product.d.ts.map +1 -1
- package/dist/esm/src/user-modules/wxxd-product.js +6 -7
- package/dist/esm/src/user-modules/wxxd-product.js.map +1 -1
- package/dist/esm/src/wechaty/wechaty-base.d.ts +21 -37
- package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/esm/src/wechaty/wechaty-base.js +17 -17
- package/dist/esm/src/wechaty/wechaty-base.js.map +1 -1
- package/dist/esm/src/wechaty/wechaty-skeleton.d.ts +15 -4
- package/dist/esm/src/wechaty/wechaty-skeleton.d.ts.map +1 -1
- package/dist/esm/src/wechaty/wechaty-skeleton.js +17 -6
- package/dist/esm/src/wechaty/wechaty-skeleton.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts +3 -2
- package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/io-mixin.d.ts +12 -6
- package/dist/esm/src/wechaty-mixins/io-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/io-mixin.js +8 -8
- package/dist/esm/src/wechaty-mixins/io-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +53 -19
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/login-mixin.js +5 -5
- package/dist/esm/src/wechaty-mixins/login-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +21 -10
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/misc-mixin.js +1 -1
- package/dist/esm/src/wechaty-mixins/misc-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +18 -12
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/plugin-mixin.js +5 -5
- package/dist/esm/src/wechaty-mixins/plugin-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts +3 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.d.ts.map +1 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js +96 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.js.map +1 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +16 -12
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js +116 -64
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +3 -2
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +4 -4
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/package.json +3 -3
- package/src/io.ts +40 -40
- package/src/package-json.ts +4 -4
- package/src/schemas/logger.ts +1 -0
- package/src/schemas/mod.ts +4 -0
- package/src/schemas/wechaty-options.ts +21 -0
- package/src/user-mixins/wechatify.ts +26 -0
- package/src/user-modules/call.ts +6 -7
- package/src/user-modules/channel-card.ts +2 -3
- package/src/user-modules/channel.ts +2 -3
- package/src/user-modules/chat-history.ts +2 -3
- package/src/user-modules/consult-card.ts +3 -5
- package/src/user-modules/contact-self.ts +8 -11
- package/src/user-modules/contact.ts +36 -40
- package/src/user-modules/douyin-one-click-phone-collection.ts +2 -3
- package/src/user-modules/favorite.ts +1 -2
- package/src/user-modules/friendship.ts +11 -12
- package/src/user-modules/im-specific.ts +1 -2
- package/src/user-modules/image.ts +5 -6
- package/src/user-modules/location.ts +2 -3
- package/src/user-modules/message.ts +55 -56
- package/src/user-modules/mini-program.ts +2 -3
- package/src/user-modules/moment.ts +5 -6
- package/src/user-modules/post.ts +25 -25
- package/src/user-modules/premium-online-appointment-card.ts +2 -3
- package/src/user-modules/room-invitation.ts +10 -11
- package/src/user-modules/room.ts +43 -44
- package/src/user-modules/tag-group.ts +13 -14
- package/src/user-modules/tag.ts +21 -22
- package/src/user-modules/url-link.ts +2 -3
- package/src/user-modules/voice.ts +8 -9
- package/src/user-modules/wecom.ts +3 -3
- package/src/user-modules/wxxd-order.ts +9 -10
- package/src/user-modules/wxxd-product.ts +6 -7
- package/src/wechaty/wechaty-base.ts +17 -17
- package/src/wechaty/wechaty-skeleton.ts +21 -8
- package/src/wechaty-mixins/io-mixin.ts +8 -8
- package/src/wechaty-mixins/login-mixin.ts +5 -5
- package/src/wechaty-mixins/misc-mixin.ts +1 -1
- package/src/wechaty-mixins/plugin-mixin.ts +5 -5
- package/src/wechaty-mixins/puppet-mixin-dirty-pool.spec.ts +144 -0
- package/src/wechaty-mixins/puppet-mixin.ts +114 -69
- package/src/wechaty-mixins/wechatify-user-module-mixin.ts +4 -4
|
@@ -20,19 +20,31 @@
|
|
|
20
20
|
import { MemoryCard } from 'memory-card'
|
|
21
21
|
import { log } from '@juzi/wechaty-puppet'
|
|
22
22
|
import * as UUID from 'uuid'
|
|
23
|
-
import type { Loggable } from 'brolog'
|
|
24
23
|
|
|
25
24
|
import {
|
|
26
25
|
WechatyEventEmitter,
|
|
27
26
|
WechatyEventName,
|
|
28
27
|
} from '../schemas/mod.js'
|
|
29
28
|
|
|
29
|
+
import type { LoggerLike } from '../schemas/logger.js'
|
|
30
30
|
import type { WechatyOptions } from '../schemas/wechaty-options.js'
|
|
31
31
|
|
|
32
32
|
abstract class WechatySkeleton extends WechatyEventEmitter {
|
|
33
33
|
|
|
34
|
-
static readonly log:
|
|
35
|
-
|
|
34
|
+
static readonly log: LoggerLike = log
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Effective logger for this Wechaty instance.
|
|
38
|
+
*
|
|
39
|
+
* Populated in the following order (see puppet-mixin):
|
|
40
|
+
* 1. `puppet.log` — the logger the puppet ended up using
|
|
41
|
+
* (which, when {@link WechatyOptions.logger} is supplied, is
|
|
42
|
+
* the caller's logger).
|
|
43
|
+
* 2. the built-in brolog `log` — hard fallback for the pre-init
|
|
44
|
+
* window and for puppets that have not adopted `puppet.log`.
|
|
45
|
+
*/
|
|
46
|
+
__log: LoggerLike = log
|
|
47
|
+
get log (): LoggerLike { return this.__log }
|
|
36
48
|
|
|
37
49
|
/**
|
|
38
50
|
* the UUID of the Wechaty
|
|
@@ -77,20 +89,20 @@ abstract class WechatySkeleton extends WechatyEventEmitter {
|
|
|
77
89
|
* by skipping the second time initialization.
|
|
78
90
|
*/
|
|
79
91
|
async init (): Promise<void> {
|
|
80
|
-
log.verbose('WechatySkeleton', 'init()')
|
|
92
|
+
this.log.verbose('WechatySkeleton', 'init()')
|
|
81
93
|
|
|
82
94
|
if (!this.__memory) {
|
|
83
95
|
this.__memory = new MemoryCard(this.__options.name)
|
|
84
96
|
try {
|
|
85
97
|
await this.__memory.load()
|
|
86
98
|
} catch (_) {
|
|
87
|
-
log.silly('WechatySkeleton', 'onStart() memory.load() had already loaded')
|
|
99
|
+
this.log.silly('WechatySkeleton', 'onStart() memory.load() had already loaded')
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
async start (): Promise<void> {
|
|
93
|
-
log.verbose('WechatySkeleton', 'start()')
|
|
105
|
+
this.log.verbose('WechatySkeleton', 'start()')
|
|
94
106
|
// no super.start()
|
|
95
107
|
|
|
96
108
|
/**
|
|
@@ -100,12 +112,12 @@ abstract class WechatySkeleton extends WechatyEventEmitter {
|
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
async stop (): Promise<void> {
|
|
103
|
-
log.verbose('WechatySkeleton', 'stop()')
|
|
115
|
+
this.log.verbose('WechatySkeleton', 'stop()')
|
|
104
116
|
// no super.stop()
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
override on (event: WechatyEventName, listener: (...args: any[]) => any): this {
|
|
108
|
-
log.verbose('WechatySkeleton', 'on(%s, listener) registering... listenerCount: %s',
|
|
120
|
+
this.log.verbose('WechatySkeleton', 'on(%s, listener) registering... listenerCount: %s',
|
|
109
121
|
event,
|
|
110
122
|
this.listenerCount(event),
|
|
111
123
|
)
|
|
@@ -117,6 +129,7 @@ abstract class WechatySkeleton extends WechatyEventEmitter {
|
|
|
117
129
|
|
|
118
130
|
type WechatySkeletonProtectedProperty =
|
|
119
131
|
| '__events'
|
|
132
|
+
| '__log'
|
|
120
133
|
| '__memory'
|
|
121
134
|
| '__options'
|
|
122
135
|
| 'memory'
|
|
@@ -36,7 +36,7 @@ const ioMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin> (mixinB
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
override async start (): Promise<void> {
|
|
39
|
-
log.verbose('WechatyIoMixin', 'start()')
|
|
39
|
+
this.log.verbose('WechatyIoMixin', 'start()')
|
|
40
40
|
|
|
41
41
|
await super.start()
|
|
42
42
|
|
|
@@ -48,13 +48,13 @@ const ioMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin> (mixinB
|
|
|
48
48
|
* Clean the memory leak-ed io (?)
|
|
49
49
|
*/
|
|
50
50
|
if (this.__io) {
|
|
51
|
-
log.error('WechatyIoMixin', 'start() found existing io instance: stopping...')
|
|
51
|
+
this.log.error('WechatyIoMixin', 'start() found existing io instance: stopping...')
|
|
52
52
|
try {
|
|
53
53
|
await this.__io.stop()
|
|
54
54
|
} catch (e) {
|
|
55
55
|
this.emitError(e)
|
|
56
56
|
}
|
|
57
|
-
log.error('WechatyIoMixin', 'start() found existing io instance: stopping... done')
|
|
57
|
+
this.log.error('WechatyIoMixin', 'start() found existing io instance: stopping... done')
|
|
58
58
|
this.__io = undefined
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -66,13 +66,13 @@ const ioMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin> (mixinB
|
|
|
66
66
|
wechaty : this as any, // <- FIXME: remove any, Huan(202111)
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
log.verbose('WechatyIoMixin', 'start() starting io ...')
|
|
69
|
+
this.log.verbose('WechatyIoMixin', 'start() starting io ...')
|
|
70
70
|
await this.__io.start()
|
|
71
|
-
log.verbose('WechatyIoMixin', 'start() starting io ... done')
|
|
71
|
+
this.log.verbose('WechatyIoMixin', 'start() starting io ... done')
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
override async stop (): Promise<void> {
|
|
75
|
-
log.verbose('WechatyIoMixin', 'stop()')
|
|
75
|
+
this.log.verbose('WechatyIoMixin', 'stop()')
|
|
76
76
|
|
|
77
77
|
try {
|
|
78
78
|
if (!this.__io) {
|
|
@@ -83,9 +83,9 @@ const ioMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin> (mixinB
|
|
|
83
83
|
this.__io = undefined
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
|
-
log.verbose('WechatyIoMixin', 'stop() starting io ...')
|
|
86
|
+
this.log.verbose('WechatyIoMixin', 'stop() starting io ...')
|
|
87
87
|
await io.stop()
|
|
88
|
-
log.verbose('WechatyIoMixin', 'stop() starting io ... done')
|
|
88
|
+
this.log.verbose('WechatyIoMixin', 'stop() starting io ... done')
|
|
89
89
|
} catch (e) {
|
|
90
90
|
this.emitError(e)
|
|
91
91
|
}
|
|
@@ -49,7 +49,7 @@ const loginMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GEr
|
|
|
49
49
|
} catch (e) {
|
|
50
50
|
this.emit('error', e)
|
|
51
51
|
|
|
52
|
-
log.warn('WechatyLoginMixin', 'get isLoggedIn puppet instance is not ready yet')
|
|
52
|
+
this.log.warn('WechatyLoginMixin', 'get isLoggedIn puppet instance is not ready yet')
|
|
53
53
|
// https://github.com/wechaty/wechaty/issues/1878
|
|
54
54
|
return false
|
|
55
55
|
}
|
|
@@ -63,7 +63,7 @@ const loginMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GEr
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
override async init (): Promise<void> {
|
|
66
|
-
log.verbose('WechatyLoginMixin', 'init()')
|
|
66
|
+
this.log.verbose('WechatyLoginMixin', 'init()')
|
|
67
67
|
await super.init()
|
|
68
68
|
|
|
69
69
|
if (this.__loginMixinInited) {
|
|
@@ -80,7 +80,7 @@ const loginMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GEr
|
|
|
80
80
|
* await bot.logout()
|
|
81
81
|
*/
|
|
82
82
|
async logout (reason?: string): Promise<void> {
|
|
83
|
-
log.verbose('WechatyLoginMixin', 'logout()')
|
|
83
|
+
this.log.verbose('WechatyLoginMixin', 'logout()')
|
|
84
84
|
await this.puppet.logout(reason)
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -88,7 +88,7 @@ const loginMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GEr
|
|
|
88
88
|
* @deprecated: use `isLoggedIn` property instead. will be removed after Dec 31, 2022
|
|
89
89
|
*/
|
|
90
90
|
logonoff (): boolean {
|
|
91
|
-
log.warn('WechatyLoginMixin', 'logonoff() is deprecated: use `isLoggedIn` property instead.\n%s', new Error().stack)
|
|
91
|
+
this.log.warn('WechatyLoginMixin', 'logonoff() is deprecated: use `isLoggedIn` property instead.\n%s', new Error().stack)
|
|
92
92
|
return this.isLoggedIn
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -97,7 +97,7 @@ const loginMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GEr
|
|
|
97
97
|
* @deprecated use {@link Wechaty#currentUser} instead
|
|
98
98
|
*/
|
|
99
99
|
userSelf () {
|
|
100
|
-
log.warn('WechatyLoginMixin', 'userSelf() deprecated: use currentUser instead.\n%s',
|
|
100
|
+
this.log.warn('WechatyLoginMixin', 'userSelf() deprecated: use currentUser instead.\n%s',
|
|
101
101
|
new Error().stack,
|
|
102
102
|
)
|
|
103
103
|
return this.currentUser
|
|
@@ -66,7 +66,7 @@ const miscMixin = <MixinBase extends typeof WechatySkeleton & PuppetMixin & GErr
|
|
|
66
66
|
* @private
|
|
67
67
|
*/
|
|
68
68
|
ding (data?: string): void {
|
|
69
|
-
log.silly('WechatyMiscMixin', 'ding(%s)', data || '')
|
|
69
|
+
this.log.silly('WechatyMiscMixin', 'ding(%s)', data || '')
|
|
70
70
|
|
|
71
71
|
try {
|
|
72
72
|
this.puppet.ding(data)
|
|
@@ -58,16 +58,16 @@ const pluginMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin & Mi
|
|
|
58
58
|
)[]
|
|
59
59
|
): WechatyPluginUninstaller {
|
|
60
60
|
const pluginList = plugins.flat()
|
|
61
|
-
log.verbose('WechatyPluginMixin', 'use() total %d plugins', pluginList.length)
|
|
61
|
+
this.log.verbose('WechatyPluginMixin', 'use() total %d plugins', pluginList.length)
|
|
62
62
|
|
|
63
63
|
const uninstallerList: WechatyPluginUninstaller[] = []
|
|
64
64
|
|
|
65
65
|
for (const plugin of pluginList) {
|
|
66
|
-
log.verbose('WechatyPluginMixin', 'use() installing Plugin %s on Wechaty %s ...', plugin.name, this.name())
|
|
66
|
+
this.log.verbose('WechatyPluginMixin', 'use() installing Plugin %s on Wechaty %s ...', plugin.name, this.name())
|
|
67
67
|
|
|
68
68
|
const uninstaller = plugin(this as any) // <- Huan(202110): TODO: remove any
|
|
69
69
|
if (isWechatyPluginUninstaller(uninstaller)) {
|
|
70
|
-
log.verbose('WechatyPluginMixin', 'use() saving uninstaller for Plugin %s on Wechaty %s ...', plugin.name, this.name())
|
|
70
|
+
this.log.verbose('WechatyPluginMixin', 'use() saving uninstaller for Plugin %s on Wechaty %s ...', plugin.name, this.name())
|
|
71
71
|
uninstallerList.push(uninstaller)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -76,9 +76,9 @@ const pluginMixin = <MixinBase extends typeof WechatySkeleton & GErrorMixin & Mi
|
|
|
76
76
|
* Return the function to uninstall all plugins
|
|
77
77
|
*/
|
|
78
78
|
return () => uninstallerList.forEach(uninstaller => {
|
|
79
|
-
log.verbose('WechatyPluginMixin', 'use() uninstalling Plugin %s on Wechaty %s ...', uninstaller.name, this.name())
|
|
79
|
+
this.log.verbose('WechatyPluginMixin', 'use() uninstalling Plugin %s on Wechaty %s ...', uninstaller.name, this.name())
|
|
80
80
|
uninstaller()
|
|
81
|
-
log.verbose('WechatyPluginMixin', 'use() uninstalling Plugin %s on Wechaty %s ... done', uninstaller.name, this.name())
|
|
81
|
+
this.log.verbose('WechatyPluginMixin', 'use() uninstalling Plugin %s on Wechaty %s ... done', uninstaller.name, this.name())
|
|
82
82
|
})
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm
|
|
2
|
+
|
|
3
|
+
import { test } from 'tstest'
|
|
4
|
+
import * as PUPPET from '@juzi/wechaty-puppet'
|
|
5
|
+
import { PuppetMock } from '@juzi/wechaty-puppet-mock'
|
|
6
|
+
|
|
7
|
+
import { WechatyBuilder } from '../wechaty-builder.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Regression: the `dirty` event handler for pooled user-modules
|
|
11
|
+
* (Contact / Room / WxxdProduct / WxxdOrder) used to call
|
|
12
|
+
* `this.Xxx.find({ id }).ready(true)`. `find({ id })` on a pool miss
|
|
13
|
+
* constructs a fresh instance and calls `ready()` — a puppet-side gRPC
|
|
14
|
+
* round-trip — turning a passive "invalidate if cached" signal into an
|
|
15
|
+
* active fetch for ids no business code has touched.
|
|
16
|
+
*
|
|
17
|
+
* The fix looks the id up in the pool directly and only calls
|
|
18
|
+
* `.ready(true)` when the instance is already pooled.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
async function delay (ms: number): Promise<void> {
|
|
22
|
+
await new Promise<void>(resolve => setTimeout(resolve, ms))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test('dirty handler does not fetch payload for un-pooled ids, but still refreshes pooled ones', async t => {
|
|
26
|
+
const puppet = new PuppetMock() as any
|
|
27
|
+
const wechaty = WechatyBuilder.build({ puppet })
|
|
28
|
+
|
|
29
|
+
const botContact = puppet.mocker.createContact({ name: 'test-bot' })
|
|
30
|
+
|
|
31
|
+
await wechaty.start()
|
|
32
|
+
await puppet.mocker.login(botContact)
|
|
33
|
+
|
|
34
|
+
// --- Case 1: un-pooled Contact id must not trigger contactRawPayload ---
|
|
35
|
+
|
|
36
|
+
let contactRawPayloadCalls = 0
|
|
37
|
+
const originalContactRawPayload = puppet.contactRawPayload.bind(puppet)
|
|
38
|
+
puppet.contactRawPayload = async (id: string) => {
|
|
39
|
+
contactRawPayloadCalls++
|
|
40
|
+
return originalContactRawPayload(id)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
puppet.emit('dirty', {
|
|
44
|
+
payloadType: PUPPET.types.Payload.Contact,
|
|
45
|
+
payloadId: 'never-loaded-contact-id',
|
|
46
|
+
})
|
|
47
|
+
await delay(50)
|
|
48
|
+
|
|
49
|
+
t.equal(
|
|
50
|
+
contactRawPayloadCalls,
|
|
51
|
+
0,
|
|
52
|
+
`dirty(Contact) for un-pooled id must not trigger contactRawPayload; got ${contactRawPayloadCalls} call(s)`,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
// --- Case 2: un-pooled Room id must not trigger roomRawPayload ---
|
|
56
|
+
|
|
57
|
+
let roomRawPayloadCalls = 0
|
|
58
|
+
const originalRoomRawPayload = puppet.roomRawPayload.bind(puppet)
|
|
59
|
+
puppet.roomRawPayload = async (id: string) => {
|
|
60
|
+
roomRawPayloadCalls++
|
|
61
|
+
return originalRoomRawPayload(id)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
puppet.emit('dirty', {
|
|
65
|
+
payloadType: PUPPET.types.Payload.Room,
|
|
66
|
+
payloadId: 'never-loaded-room-id',
|
|
67
|
+
})
|
|
68
|
+
await delay(50)
|
|
69
|
+
|
|
70
|
+
t.equal(
|
|
71
|
+
roomRawPayloadCalls,
|
|
72
|
+
0,
|
|
73
|
+
`dirty(Room) for un-pooled id must not trigger roomRawPayload; got ${roomRawPayloadCalls} call(s)`,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
// --- Case 3: Message dirty must not trigger messageRawPayload (Message has no user-layer pool) ---
|
|
77
|
+
|
|
78
|
+
let messageRawPayloadCalls = 0
|
|
79
|
+
const originalMessageRawPayload = puppet.messageRawPayload.bind(puppet)
|
|
80
|
+
puppet.messageRawPayload = async (id: string) => {
|
|
81
|
+
messageRawPayloadCalls++
|
|
82
|
+
return originalMessageRawPayload(id)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
puppet.emit('dirty', {
|
|
86
|
+
payloadType: PUPPET.types.Payload.Message,
|
|
87
|
+
payloadId: 'some-message-id',
|
|
88
|
+
})
|
|
89
|
+
await delay(50)
|
|
90
|
+
|
|
91
|
+
t.equal(
|
|
92
|
+
messageRawPayloadCalls,
|
|
93
|
+
0,
|
|
94
|
+
`dirty(Message) must not trigger messageRawPayload at the user layer; got ${messageRawPayloadCalls} call(s)`,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
// --- Case 4: un-pooled Contact still emits the user-facing dirty event ---
|
|
98
|
+
|
|
99
|
+
let wechatyDirtyEmits = 0
|
|
100
|
+
wechaty.on('dirty', () => {
|
|
101
|
+
wechatyDirtyEmits++
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
puppet.emit('dirty', {
|
|
105
|
+
payloadType: PUPPET.types.Payload.Contact,
|
|
106
|
+
payloadId: 'yet-another-un-pooled-id',
|
|
107
|
+
})
|
|
108
|
+
await delay(50)
|
|
109
|
+
|
|
110
|
+
t.equal(
|
|
111
|
+
wechatyDirtyEmits,
|
|
112
|
+
1,
|
|
113
|
+
`wechaty.emit('dirty', ...) must fire once even when the id is not pooled; got ${wechatyDirtyEmits}`,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
// --- Case 5: pooled Contact MUST re-fetch on dirty ---
|
|
117
|
+
|
|
118
|
+
const pooledContact = puppet.mocker.createContact({ name: 'pooled-contact' })
|
|
119
|
+
|
|
120
|
+
// Force the contact into the wechatified pool via find(). Payload gets
|
|
121
|
+
// loaded once as part of find()'s ready() call — subsequent counts we
|
|
122
|
+
// measure from AFTER this seed.
|
|
123
|
+
await wechaty.Contact.find({ id: pooledContact.id })
|
|
124
|
+
|
|
125
|
+
let contactPayloadCalls = 0
|
|
126
|
+
const originalContactPayload = puppet.contactPayload.bind(puppet)
|
|
127
|
+
puppet.contactPayload = async (id: string) => {
|
|
128
|
+
contactPayloadCalls++
|
|
129
|
+
return originalContactPayload(id)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
puppet.emit('dirty', {
|
|
133
|
+
payloadType: PUPPET.types.Payload.Contact,
|
|
134
|
+
payloadId: pooledContact.id,
|
|
135
|
+
})
|
|
136
|
+
await delay(50)
|
|
137
|
+
|
|
138
|
+
t.ok(
|
|
139
|
+
contactPayloadCalls >= 1,
|
|
140
|
+
`dirty(Contact) for pooled id must trigger contactPayload via ready(true); got ${contactPayloadCalls} call(s)`,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
await wechaty.stop()
|
|
144
|
+
})
|