@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as PUPPET from '@juzi/wechaty-puppet'
|
|
2
|
-
import { log }
|
|
2
|
+
import { log, type LoggerLike } from '@juzi/wechaty-puppet'
|
|
3
3
|
import {
|
|
4
4
|
GError,
|
|
5
5
|
timeoutPromise,
|
|
@@ -18,12 +18,8 @@ import type {
|
|
|
18
18
|
CallImpl,
|
|
19
19
|
ContactImpl,
|
|
20
20
|
ContactInterface,
|
|
21
|
-
MessageImpl,
|
|
22
|
-
RoomImpl,
|
|
23
21
|
TagGroupInterface,
|
|
24
22
|
TagInterface,
|
|
25
|
-
WxxdOrderImpl,
|
|
26
|
-
WxxdProductImpl,
|
|
27
23
|
} from '../user-modules/mod.js'
|
|
28
24
|
|
|
29
25
|
import type {
|
|
@@ -85,11 +81,11 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
override async start (): Promise<void> {
|
|
88
|
-
log.verbose('WechatyPuppetMixin', 'start()')
|
|
84
|
+
this.log.verbose('WechatyPuppetMixin', 'start()')
|
|
89
85
|
|
|
90
|
-
log.verbose('WechatyPuppetMixin', 'start() super.start() ...')
|
|
86
|
+
this.log.verbose('WechatyPuppetMixin', 'start() super.start() ...')
|
|
91
87
|
await super.start()
|
|
92
|
-
log.verbose('WechatyPuppetMixin', 'start() super.start() ... done')
|
|
88
|
+
this.log.verbose('WechatyPuppetMixin', 'start() super.start() ... done')
|
|
93
89
|
|
|
94
90
|
try {
|
|
95
91
|
/**
|
|
@@ -101,12 +97,12 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
try {
|
|
104
|
-
log.verbose('WechatyPuppetMixin', 'start() starting puppet ...')
|
|
100
|
+
this.log.verbose('WechatyPuppetMixin', 'start() starting puppet ...')
|
|
105
101
|
await timeoutPromise(
|
|
106
102
|
this.puppet.start(),
|
|
107
103
|
15 * 1000, // 15 seconds timeout
|
|
108
104
|
)
|
|
109
|
-
log.verbose('WechatyPuppetMixin', 'start() starting puppet ... done')
|
|
105
|
+
this.log.verbose('WechatyPuppetMixin', 'start() starting puppet ... done')
|
|
110
106
|
} catch (e) {
|
|
111
107
|
if (e instanceof TimeoutPromiseGError) {
|
|
112
108
|
/**
|
|
@@ -119,8 +115,8 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
119
115
|
*
|
|
120
116
|
* e.g. after resolve @issue https://github.com/padlocal/wechaty-puppet-padlocal/issues/116
|
|
121
117
|
*/
|
|
122
|
-
log.warn('WechatyPuppetMixin', 'start() starting puppet ... timeout')
|
|
123
|
-
log.warn('WechatyPuppetMixin', 'start() puppet info: %s', this.puppet)
|
|
118
|
+
this.log.warn('WechatyPuppetMixin', 'start() starting puppet ... timeout')
|
|
119
|
+
this.log.warn('WechatyPuppetMixin', 'start() puppet info: %s', this.puppet)
|
|
124
120
|
} else {
|
|
125
121
|
throw e
|
|
126
122
|
}
|
|
@@ -132,88 +128,116 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
override async stop (): Promise<void> {
|
|
135
|
-
log.verbose('WechatyPuppetMixin', 'stop()')
|
|
131
|
+
this.log.verbose('WechatyPuppetMixin', 'stop()')
|
|
136
132
|
|
|
137
133
|
try {
|
|
138
|
-
log.verbose('WechatyPuppetMixin', 'stop() stopping puppet ...')
|
|
134
|
+
this.log.verbose('WechatyPuppetMixin', 'stop() stopping puppet ...')
|
|
139
135
|
await timeoutPromise(
|
|
140
136
|
this.puppet.stop(),
|
|
141
137
|
15 * 1000, // 15 seconds timeout
|
|
142
138
|
)
|
|
143
|
-
log.verbose('WechatyPuppetMixin', 'stop() stopping puppet ... done')
|
|
139
|
+
this.log.verbose('WechatyPuppetMixin', 'stop() stopping puppet ... done')
|
|
144
140
|
} catch (e) {
|
|
145
141
|
if (e instanceof TimeoutPromiseGError) {
|
|
146
|
-
log.warn('WechatyPuppetMixin', 'stop() stopping puppet ... timeout')
|
|
147
|
-
log.warn('WechatyPuppetMixin', 'stop() puppet info: %s', this.puppet)
|
|
142
|
+
this.log.warn('WechatyPuppetMixin', 'stop() stopping puppet ... timeout')
|
|
143
|
+
this.log.warn('WechatyPuppetMixin', 'stop() puppet info: %s', this.puppet)
|
|
148
144
|
}
|
|
149
145
|
this.emitError(e)
|
|
150
146
|
}
|
|
151
147
|
|
|
152
|
-
log.verbose('WechatyPuppetMixin', 'stop() super.stop() ...')
|
|
148
|
+
this.log.verbose('WechatyPuppetMixin', 'stop() super.stop() ...')
|
|
153
149
|
await super.stop()
|
|
154
|
-
log.verbose('WechatyPuppetMixin', 'stop() super.stop() ... done')
|
|
150
|
+
this.log.verbose('WechatyPuppetMixin', 'stop() super.stop() ... done')
|
|
155
151
|
|
|
156
152
|
this.__callPool.clear()
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
async ready (): Promise<void> {
|
|
160
|
-
log.verbose('WechatyPuppetMixin', 'ready()')
|
|
156
|
+
this.log.verbose('WechatyPuppetMixin', 'ready()')
|
|
161
157
|
await this.__readyState.stable('active')
|
|
162
|
-
log.silly('WechatyPuppetMixin', 'ready() this.readyState.stable(on) resolved')
|
|
158
|
+
this.log.silly('WechatyPuppetMixin', 'ready() this.readyState.stable(on) resolved')
|
|
163
159
|
}
|
|
164
160
|
|
|
165
161
|
override async init (): Promise<void> {
|
|
166
|
-
log.verbose('WechatyPuppetMixin', 'init()')
|
|
162
|
+
this.log.verbose('WechatyPuppetMixin', 'init()')
|
|
167
163
|
await super.init()
|
|
168
164
|
|
|
169
165
|
if (this.__puppetMixinInited) {
|
|
170
|
-
log.verbose('WechatyPuppetMixin', 'init() skipped because this puppet has already been inited before.')
|
|
166
|
+
this.log.verbose('WechatyPuppetMixin', 'init() skipped because this puppet has already been inited before.')
|
|
171
167
|
return
|
|
172
168
|
}
|
|
173
169
|
this.__puppetMixinInited = true
|
|
174
170
|
|
|
175
|
-
log.verbose('WechatyPuppetMixin', 'init() instanciating puppet instance ...')
|
|
171
|
+
this.log.verbose('WechatyPuppetMixin', 'init() instanciating puppet instance ...')
|
|
172
|
+
/**
|
|
173
|
+
* Forward `WechatyOptions.logger` down into `PuppetOptions.logger` so
|
|
174
|
+
* that the puppet layer emits logs through the same logger the caller
|
|
175
|
+
* supplied to Wechaty.
|
|
176
|
+
*/
|
|
177
|
+
const basePuppetOptions = 'puppetOptions' in this.__options
|
|
178
|
+
? this.__options.puppetOptions
|
|
179
|
+
: undefined
|
|
180
|
+
const mergedPuppetOptions = this.__options.logger
|
|
181
|
+
? { ...(basePuppetOptions ?? {}), logger: this.__options.logger }
|
|
182
|
+
: basePuppetOptions
|
|
176
183
|
const puppetInstance = await PUPPET.helpers.resolvePuppet({
|
|
177
184
|
puppet: this.__options.puppet || config.systemPuppetName(),
|
|
178
|
-
puppetOptions:
|
|
179
|
-
? this.__options.puppetOptions
|
|
180
|
-
: undefined,
|
|
185
|
+
puppetOptions: mergedPuppetOptions,
|
|
181
186
|
})
|
|
182
|
-
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Adopt the puppet's effective logger onto the Wechaty side, so that
|
|
190
|
+
* `wechaty.log` and, via the accessory chain, every user module
|
|
191
|
+
* (`Contact.log`, `Message.log`, ...) route through it. `PuppetInterface`
|
|
192
|
+
* hides `log` (via `PuppetSkeletonProtectedProperty`), so a structural
|
|
193
|
+
* cast is required. The `??` guards third-party puppets that never
|
|
194
|
+
* adopted the pluggable logger — those fall back to the brolog `log`
|
|
195
|
+
* already assigned in WechatySkeleton.
|
|
196
|
+
*
|
|
197
|
+
* Adopted immediately after `resolvePuppet` so the rest of init() —
|
|
198
|
+
* setMemory / setupPuppetEvents / the sync `emit('puppet')` listeners —
|
|
199
|
+
* all route through the caller-supplied logger, not brolog.
|
|
200
|
+
*/
|
|
201
|
+
const puppetLog = (puppetInstance as unknown as { log?: LoggerLike }).log
|
|
202
|
+
if (puppetLog) {
|
|
203
|
+
this.__log = puppetLog
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this.log.verbose('WechatyPuppetMixin', 'init() instanciating puppet instance ... done')
|
|
183
207
|
|
|
184
208
|
/**
|
|
185
209
|
* Plug the Memory Card to Puppet
|
|
186
210
|
*/
|
|
187
|
-
log.verbose('WechatyPuppetMixin', 'init() setting memory ...')
|
|
211
|
+
this.log.verbose('WechatyPuppetMixin', 'init() setting memory ...')
|
|
188
212
|
const puppetMemory = this.memory.multiplex(PUPPET_MEMORY_NAME)
|
|
189
213
|
puppetInstance.setMemory(puppetMemory)
|
|
190
|
-
log.verbose('WechatyPuppetMixin', 'init() setting memory ... done')
|
|
214
|
+
this.log.verbose('WechatyPuppetMixin', 'init() setting memory ... done')
|
|
191
215
|
|
|
192
216
|
/**
|
|
193
217
|
* Propagate Puppet Events to Wechaty
|
|
194
218
|
*/
|
|
195
|
-
log.verbose('WechatyPuppetMixin', 'init() setting up events ...')
|
|
219
|
+
this.log.verbose('WechatyPuppetMixin', 'init() setting up events ...')
|
|
196
220
|
this.__setupPuppetEvents(puppetInstance)
|
|
197
|
-
log.verbose('WechatyPuppetMixin', 'init() setting up events ... done')
|
|
221
|
+
this.log.verbose('WechatyPuppetMixin', 'init() setting up events ... done')
|
|
198
222
|
|
|
199
223
|
/**
|
|
200
224
|
* Private Event
|
|
201
225
|
* - Huan(202005): emit puppet when set
|
|
202
226
|
* - Huan(202110): @see https://github.com/wechaty/redux/blob/16af0ae01f72e37f0ee286b49fa5ccf69850323d/src/wechaty-redux.ts#L82-L98
|
|
203
227
|
*/
|
|
204
|
-
log.verbose('WechatyPuppetMixin', 'init() emitting "puppet" event ...')
|
|
228
|
+
this.log.verbose('WechatyPuppetMixin', 'init() emitting "puppet" event ...')
|
|
205
229
|
;(this.emit as any)('puppet', puppetInstance)
|
|
206
|
-
log.verbose('WechatyPuppetMixin', 'init() emitting "puppet" event ... done')
|
|
230
|
+
this.log.verbose('WechatyPuppetMixin', 'init() emitting "puppet" event ... done')
|
|
207
231
|
|
|
208
232
|
this.__puppet = puppetInstance
|
|
209
233
|
}
|
|
210
234
|
|
|
211
235
|
__setupPuppetEvents (puppet: PUPPET.impls.PuppetInterface): void {
|
|
212
|
-
log.verbose('WechatyPuppetMixin', '__setupPuppetEvents(%s)', puppet)
|
|
236
|
+
this.log.verbose('WechatyPuppetMixin', '__setupPuppetEvents(%s)', puppet)
|
|
213
237
|
|
|
214
238
|
const eventNameList: PUPPET.types.PuppetEventName[] = Object.keys(PUPPET.types.PUPPET_EVENT_DICT) as PUPPET.types.PuppetEventName[]
|
|
215
239
|
for (const eventName of eventNameList) {
|
|
216
|
-
log.verbose('PuppetMixin',
|
|
240
|
+
this.log.verbose('PuppetMixin',
|
|
217
241
|
'__setupPuppetEvents() puppet.on(%s) (listenerCount:%s) registering...',
|
|
218
242
|
eventName,
|
|
219
243
|
puppet.listenerCount(eventName),
|
|
@@ -293,7 +317,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
293
317
|
if (contact) {
|
|
294
318
|
this.emit('logout', contact, payload.data)
|
|
295
319
|
} else {
|
|
296
|
-
log.verbose('PuppetMixin',
|
|
320
|
+
this.log.verbose('PuppetMixin',
|
|
297
321
|
'__setupPuppetEvents() logout event contact self not found for id: %s',
|
|
298
322
|
payload.contactId,
|
|
299
323
|
)
|
|
@@ -390,7 +414,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
390
414
|
|
|
391
415
|
case 'ready':
|
|
392
416
|
puppet.on('ready', async () => {
|
|
393
|
-
log.silly('WechatyPuppetMixin', '__setupPuppetEvents() puppet.on(ready)')
|
|
417
|
+
this.log.silly('WechatyPuppetMixin', '__setupPuppetEvents() puppet.on(ready)')
|
|
394
418
|
|
|
395
419
|
// ready event should be emitted 15s after login
|
|
396
420
|
let onceLogout: () => void
|
|
@@ -419,7 +443,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
419
443
|
this.__readyState.active(true)
|
|
420
444
|
}
|
|
421
445
|
} catch (e) {
|
|
422
|
-
log.error(`ready error: ${(e as Error).message}, will emit event anyway if it's logged in now`)
|
|
446
|
+
this.log.error(`ready error: ${(e as Error).message}, will emit event anyway if it's logged in now`)
|
|
423
447
|
if (this.puppet.isLoggedIn) {
|
|
424
448
|
this.emit('ready')
|
|
425
449
|
this.__loginIndicator.value(true)
|
|
@@ -541,7 +565,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
541
565
|
changer = await this.Contact.find({ id: payload.changerId })
|
|
542
566
|
}
|
|
543
567
|
} catch (e) {
|
|
544
|
-
log.warn('room-announce', 'room-announce event error: %s', (e as Error).message)
|
|
568
|
+
this.log.warn('room-announce', 'room-announce event error: %s', (e as Error).message)
|
|
545
569
|
}
|
|
546
570
|
const date = timestampToDate(payload.timestamp)
|
|
547
571
|
this.emit('room-announce', room, payload.newAnnounce, changer, payload.oldAnnounce, date)
|
|
@@ -588,7 +612,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
588
612
|
return tag.name() === oldName
|
|
589
613
|
})
|
|
590
614
|
if (!result) {
|
|
591
|
-
log.warn('WechatyPuppetMixin', 'tagRenameEvent still get old name after %s retries for tag %s', PUPPET_PAYLOAD_SYNC_MAX_RETRY, tag.id)
|
|
615
|
+
this.log.warn('WechatyPuppetMixin', 'tagRenameEvent still get old name after %s retries for tag %s', PUPPET_PAYLOAD_SYNC_MAX_RETRY, tag.id)
|
|
592
616
|
}
|
|
593
617
|
}))
|
|
594
618
|
this.emit('tag', payload.type, renamedTags, date)
|
|
@@ -634,7 +658,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
634
658
|
return tagGroup.name() === oldName
|
|
635
659
|
})
|
|
636
660
|
if (!result) {
|
|
637
|
-
log.warn('WechatyPuppetMixin', 'tagGroupRenameEvent still get old name after %s retries for tagGroup %s', PUPPET_PAYLOAD_SYNC_MAX_RETRY, tagGroup.id)
|
|
661
|
+
this.log.warn('WechatyPuppetMixin', 'tagGroupRenameEvent still get old name after %s retries for tagGroup %s', PUPPET_PAYLOAD_SYNC_MAX_RETRY, tagGroup.id)
|
|
638
662
|
}
|
|
639
663
|
}))
|
|
640
664
|
this.emit('tag-group', payload.type, renamedTagGroups, date)
|
|
@@ -668,7 +692,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
668
692
|
this.emit('contact-enter-conversation', contact, date, payload.scene)
|
|
669
693
|
contact.emit('enter-conversation', date, payload.scene)
|
|
670
694
|
} else {
|
|
671
|
-
log.verbose('PuppetMixin',
|
|
695
|
+
this.log.verbose('PuppetMixin',
|
|
672
696
|
'__setupPuppetEvents() contact-enter-conversation event contact not found for id: %s',
|
|
673
697
|
payload.contactId,
|
|
674
698
|
)
|
|
@@ -685,7 +709,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
685
709
|
this.emit('contact-lead-filled', contact, leads, date)
|
|
686
710
|
contact.emit('lead-filled', leads, date)
|
|
687
711
|
} else {
|
|
688
|
-
log.verbose('PuppetMixin',
|
|
712
|
+
this.log.verbose('PuppetMixin',
|
|
689
713
|
'__setupPuppetEvents() contact-lead-filled event contact not found for id: %s',
|
|
690
714
|
payload.contactId,
|
|
691
715
|
)
|
|
@@ -700,26 +724,46 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
700
724
|
case 'dirty':
|
|
701
725
|
/**
|
|
702
726
|
* https://github.com/wechaty/wechaty-puppet-service/issues/43
|
|
727
|
+
*
|
|
728
|
+
* `dirty` semantics: the puppet-service told us the cached payload
|
|
729
|
+
* for this id is stale. It is NOT a request to load the payload.
|
|
730
|
+
*
|
|
731
|
+
* The old handler used `this.Xxx.find({ id })` which, on pool miss,
|
|
732
|
+
* constructs a fresh user-layer instance AND calls `.ready()` — a
|
|
733
|
+
* puppet-side gRPC round-trip. For a `dirty` event about an id
|
|
734
|
+
* that no business code has ever touched, this turned a passive
|
|
735
|
+
* "invalidate if cached" signal into an active fetch, amplifying
|
|
736
|
+
* dirty-event bursts (e.g. during message storms) into extra
|
|
737
|
+
* puppet-service QPS.
|
|
738
|
+
*
|
|
739
|
+
* Fix: for pooled user-modules, look the instance up in the pool
|
|
740
|
+
* directly and only call `.ready(true)` when it is already there.
|
|
741
|
+
* The Call branch (below) already follows this shape via
|
|
742
|
+
* `__callPool.get(...)`. Message has no pool, so its branch is a
|
|
743
|
+
* no-op break (any caller wanting a Message must load it itself).
|
|
703
744
|
*/
|
|
704
745
|
puppet.on('dirty', async ({ payloadType, payloadId }) => {
|
|
705
746
|
try {
|
|
706
747
|
switch (payloadType) {
|
|
707
748
|
case PUPPET.types.Payload.Contact: {
|
|
708
|
-
const
|
|
709
|
-
await
|
|
749
|
+
const cached = this.Contact.pool.get(payloadId)
|
|
750
|
+
if (cached) await cached.ready(true)
|
|
710
751
|
break
|
|
711
752
|
}
|
|
712
753
|
case PUPPET.types.Payload.Room: {
|
|
713
|
-
const
|
|
714
|
-
await
|
|
754
|
+
const cached = this.Room.pool.get(payloadId)
|
|
755
|
+
if (cached) await cached.ready(true)
|
|
715
756
|
break
|
|
716
757
|
}
|
|
717
758
|
case PUPPET.types.Payload.RoomMember: {
|
|
718
759
|
if (payloadId.includes(PUPPET.STRING_SPLITTER)) {
|
|
719
760
|
break
|
|
720
761
|
}
|
|
721
|
-
|
|
722
|
-
|
|
762
|
+
// A bare (non-composite) RoomMember dirty id addresses the
|
|
763
|
+
// whole room, mirroring the Room branch — but never load
|
|
764
|
+
// a new Room here.
|
|
765
|
+
const cached = this.Room.pool.get(payloadId)
|
|
766
|
+
if (cached) await cached.ready()
|
|
723
767
|
break
|
|
724
768
|
}
|
|
725
769
|
|
|
@@ -729,12 +773,13 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
729
773
|
case PUPPET.types.Payload.Friendship:
|
|
730
774
|
// Friendship has no payload
|
|
731
775
|
break
|
|
732
|
-
case PUPPET.types.Payload.Message:
|
|
733
|
-
// Message
|
|
734
|
-
|
|
735
|
-
|
|
776
|
+
case PUPPET.types.Payload.Message:
|
|
777
|
+
// Message has no user-layer pool (see message.ts: `load`
|
|
778
|
+
// constructs a fresh instance every call). Dirty for a
|
|
779
|
+
// Message id is therefore a no-op at this layer — the
|
|
780
|
+
// cache-mixin listener still invalidates the puppet-side
|
|
781
|
+
// payload cache alongside this handler.
|
|
736
782
|
break
|
|
737
|
-
}
|
|
738
783
|
case PUPPET.types.Payload.Tag:
|
|
739
784
|
break
|
|
740
785
|
case PUPPET.types.Payload.TagGroup:
|
|
@@ -742,13 +787,13 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
742
787
|
case PUPPET.types.Payload.Post:
|
|
743
788
|
break
|
|
744
789
|
case PUPPET.types.Payload.WxxdProduct: {
|
|
745
|
-
const
|
|
746
|
-
await
|
|
790
|
+
const cached = this.WxxdProduct.pool.get(payloadId)
|
|
791
|
+
if (cached) await cached.ready(true)
|
|
747
792
|
break
|
|
748
793
|
}
|
|
749
794
|
case PUPPET.types.Payload.WxxdOrder: {
|
|
750
|
-
const
|
|
751
|
-
await
|
|
795
|
+
const cached = this.WxxdOrder.pool.get(payloadId)
|
|
796
|
+
if (cached) await cached.ready(true)
|
|
752
797
|
break
|
|
753
798
|
}
|
|
754
799
|
case PUPPET.types.Payload.Call: {
|
|
@@ -773,7 +818,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
773
818
|
try {
|
|
774
819
|
await call.ready(true)
|
|
775
820
|
} catch (e) {
|
|
776
|
-
log.warn(
|
|
821
|
+
this.log.warn(
|
|
777
822
|
'WechatyPuppetMixin',
|
|
778
823
|
'dirty(Call) ready failed for callId=%s: %s',
|
|
779
824
|
payloadId,
|
|
@@ -786,7 +831,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
786
831
|
|
|
787
832
|
case PUPPET.types.Payload.Unspecified:
|
|
788
833
|
default:
|
|
789
|
-
log.warn('unknown payload type: ' + payloadType)
|
|
834
|
+
this.log.warn('unknown payload type: ' + payloadType)
|
|
790
835
|
}
|
|
791
836
|
this.emit('dirty', payloadId, payloadType)
|
|
792
837
|
} catch (e) {
|
|
@@ -834,7 +879,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
834
879
|
try {
|
|
835
880
|
if (payload.signal === PUPPET.types.CallSignal.Invite) {
|
|
836
881
|
if (this.__callPool.has(payload.callId)) {
|
|
837
|
-
log.warn('WechatyPuppetMixin', '__setupPuppetEvents() duplicate Invite for callId=%s, ignoring', payload.callId)
|
|
882
|
+
this.log.warn('WechatyPuppetMixin', '__setupPuppetEvents() duplicate Invite for callId=%s, ignoring', payload.callId)
|
|
838
883
|
return
|
|
839
884
|
}
|
|
840
885
|
const call = new (this.Call as any)({
|
|
@@ -853,13 +898,13 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
853
898
|
// are expected within race windows (e.g. a Ringing ack arriving
|
|
854
899
|
// before callInvite returns) or after the Call has been finalized
|
|
855
900
|
// and removed from the pool. Drop silently — log.warn, not error.
|
|
856
|
-
log.warn('WechatyPuppetMixin', '__setupPuppetEvents() call event for unknown callId=%s, dropping', payload.callId)
|
|
901
|
+
this.log.warn('WechatyPuppetMixin', '__setupPuppetEvents() call event for unknown callId=%s, dropping', payload.callId)
|
|
857
902
|
return
|
|
858
903
|
}
|
|
859
904
|
|
|
860
905
|
const actor = await (this.Contact as typeof ContactImpl).find({ id: payload.contactId })
|
|
861
906
|
if (!actor) {
|
|
862
|
-
log.warn('WechatyPuppetMixin', '__setupPuppetEvents() actor contact not found for callId=%s contactId=%s, dropping', payload.callId, payload.contactId)
|
|
907
|
+
this.log.warn('WechatyPuppetMixin', '__setupPuppetEvents() actor contact not found for callId=%s contactId=%s, dropping', payload.callId, payload.contactId)
|
|
863
908
|
return
|
|
864
909
|
}
|
|
865
910
|
|
|
@@ -904,7 +949,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
904
949
|
}
|
|
905
950
|
}
|
|
906
951
|
|
|
907
|
-
log.verbose('WechatyPuppetMixin', '__setupPuppetEvents() ... done')
|
|
952
|
+
this.log.verbose('WechatyPuppetMixin', '__setupPuppetEvents() ... done')
|
|
908
953
|
}
|
|
909
954
|
|
|
910
955
|
/**
|
|
@@ -942,7 +987,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
942
987
|
await call.sync()
|
|
943
988
|
ended = !!call.endTime()
|
|
944
989
|
} catch (e) {
|
|
945
|
-
log.warn(
|
|
990
|
+
this.log.warn(
|
|
946
991
|
'WechatyPuppetMixin',
|
|
947
992
|
'__finalizeIfEnded() sync attempt %d failed for callId=%s: %s',
|
|
948
993
|
attempt + 1,
|
|
@@ -960,7 +1005,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
960
1005
|
try {
|
|
961
1006
|
const participants = await call.participants()
|
|
962
1007
|
if (participants.length === 2) {
|
|
963
|
-
log.warn(
|
|
1008
|
+
this.log.warn(
|
|
964
1009
|
'WechatyPuppetMixin',
|
|
965
1010
|
'__finalizeIfEnded() 1v1 fallback after sync failure for callId=%s (rosterLength=%d)',
|
|
966
1011
|
call.id,
|
|
@@ -968,7 +1013,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
968
1013
|
)
|
|
969
1014
|
ended = true
|
|
970
1015
|
} else {
|
|
971
|
-
log.error(
|
|
1016
|
+
this.log.error(
|
|
972
1017
|
'WechatyPuppetMixin',
|
|
973
1018
|
'__finalizeIfEnded() sync failed, leaving callId=%s in pool for next dirty signal (rosterLength=%d)',
|
|
974
1019
|
call.id,
|
|
@@ -976,7 +1021,7 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
976
1021
|
)
|
|
977
1022
|
}
|
|
978
1023
|
} catch (e) {
|
|
979
|
-
log.error(
|
|
1024
|
+
this.log.error(
|
|
980
1025
|
'WechatyPuppetMixin',
|
|
981
1026
|
'__finalizeIfEnded() participants lookup failed for callId=%s: %s',
|
|
982
1027
|
call.id,
|
|
@@ -134,18 +134,18 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
134
134
|
get WxxdOrder () : WxxdOrderConstructor { return guardWechatify(this.__wechatifiedWxxdOrder) }
|
|
135
135
|
|
|
136
136
|
override async init (): Promise<void> {
|
|
137
|
-
log.verbose('WechatifyUserModuleMixin', 'init()')
|
|
137
|
+
this.log.verbose('WechatifyUserModuleMixin', 'init()')
|
|
138
138
|
await super.init()
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* Skip if already wechatified
|
|
142
142
|
*/
|
|
143
143
|
if (this.__wechatifiedMessage) {
|
|
144
|
-
log.verbose('WechatifyUserModuleMixin', 'init() Wechaty User Module (WUM)s have already wechatified: skip')
|
|
144
|
+
this.log.verbose('WechatifyUserModuleMixin', 'init() Wechaty User Module (WUM)s have already wechatified: skip')
|
|
145
145
|
return
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ...')
|
|
148
|
+
this.log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ...')
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* Wechatify User Classes
|
|
@@ -182,7 +182,7 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
182
182
|
this.__wechatifiedWxxdProduct = wechatifyUserModule(WxxdProductImpl)(this as any)
|
|
183
183
|
this.__wechatifiedWxxdOrder = wechatifyUserModule(WxxdOrderImpl)(this as any)
|
|
184
184
|
|
|
185
|
-
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done')
|
|
185
|
+
this.log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done')
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
}
|