@oxidezap/baileyrs 0.0.26 → 0.0.27
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/lib/Bridge/adapt.d.ts +2 -0
- package/lib/Bridge/adapt.d.ts.map +1 -1
- package/lib/Bridge/adapt.js +2 -1
- package/lib/Bridge/adapt.js.map +1 -1
- package/lib/Bridge/history-sync-wire.d.ts +17 -0
- package/lib/Bridge/history-sync-wire.d.ts.map +1 -0
- package/lib/Bridge/history-sync-wire.js +45 -0
- package/lib/Bridge/history-sync-wire.js.map +1 -0
- package/lib/Bridge/index.d.ts +1 -1
- package/lib/Bridge/index.d.ts.map +1 -1
- package/lib/Bridge/index.js +3 -3
- package/lib/Bridge/index.js.map +1 -1
- package/lib/Bridge/primitives.d.ts +4 -0
- package/lib/Bridge/primitives.d.ts.map +1 -1
- package/lib/Bridge/primitives.js +14 -0
- package/lib/Bridge/primitives.js.map +1 -1
- package/lib/Bridge/schema.d.ts +9 -2
- package/lib/Bridge/schema.d.ts.map +1 -1
- package/lib/Bridge/schema.js +263 -35
- package/lib/Bridge/schema.js.map +1 -1
- package/lib/Bridge/types.d.ts +117 -3
- package/lib/Bridge/types.d.ts.map +1 -1
- package/lib/Compatibility/group-metadata.d.ts +9 -0
- package/lib/Compatibility/group-metadata.d.ts.map +1 -0
- package/lib/Compatibility/group-metadata.js +70 -0
- package/lib/Compatibility/group-metadata.js.map +1 -0
- package/lib/Compatibility/group-notifications.d.ts +22 -0
- package/lib/Compatibility/group-notifications.d.ts.map +1 -0
- package/lib/Compatibility/group-notifications.js +307 -0
- package/lib/Compatibility/group-notifications.js.map +1 -0
- package/lib/Compatibility/group-stub-params.d.ts +32 -0
- package/lib/Compatibility/group-stub-params.d.ts.map +1 -0
- package/lib/Compatibility/group-stub-params.js +57 -0
- package/lib/Compatibility/group-stub-params.js.map +1 -0
- package/lib/Compatibility/internal/async-primitives.d.ts +16 -0
- package/lib/Compatibility/internal/async-primitives.d.ts.map +1 -0
- package/lib/Compatibility/internal/async-primitives.js +42 -0
- package/lib/Compatibility/internal/async-primitives.js.map +1 -0
- package/lib/Compatibility/internal/auth-state.d.ts +15 -0
- package/lib/Compatibility/internal/auth-state.d.ts.map +1 -0
- package/lib/Compatibility/internal/auth-state.js +21 -0
- package/lib/Compatibility/internal/auth-state.js.map +1 -0
- package/lib/Compatibility/internal/cache-store.d.ts +7 -0
- package/lib/Compatibility/internal/cache-store.d.ts.map +1 -0
- package/lib/Compatibility/internal/cache-store.js +19 -0
- package/lib/Compatibility/internal/cache-store.js.map +1 -0
- package/lib/Compatibility/internal/expiring-lru-map.d.ts +21 -0
- package/lib/Compatibility/internal/expiring-lru-map.d.ts.map +1 -0
- package/lib/Compatibility/internal/expiring-lru-map.js +68 -0
- package/lib/Compatibility/internal/expiring-lru-map.js.map +1 -0
- package/lib/Compatibility/internal/make-mutex.d.ts +7 -0
- package/lib/Compatibility/internal/make-mutex.d.ts.map +1 -0
- package/lib/Compatibility/internal/make-mutex.js +31 -0
- package/lib/Compatibility/internal/make-mutex.js.map +1 -0
- package/lib/Compatibility/internal/native-memory-store.d.ts +6 -0
- package/lib/Compatibility/internal/native-memory-store.d.ts.map +1 -0
- package/lib/Compatibility/internal/native-memory-store.js +8 -0
- package/lib/Compatibility/internal/native-memory-store.js.map +1 -0
- package/lib/Compatibility/internal/numeric-enum.d.ts +8 -0
- package/lib/Compatibility/internal/numeric-enum.d.ts.map +1 -0
- package/lib/Compatibility/internal/numeric-enum.js +11 -0
- package/lib/Compatibility/internal/numeric-enum.js.map +1 -0
- package/lib/Compatibility/internal/signal-key-store.d.ts +9 -0
- package/lib/Compatibility/internal/signal-key-store.d.ts.map +1 -0
- package/lib/Compatibility/internal/signal-key-store.js +17 -0
- package/lib/Compatibility/internal/signal-key-store.js.map +1 -0
- package/lib/Compatibility/legacy-store/adapter.d.ts +4 -0
- package/lib/Compatibility/legacy-store/adapter.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/adapter.js +301 -0
- package/lib/Compatibility/legacy-store/adapter.js.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/basic.d.ts +6 -0
- package/lib/Compatibility/legacy-store/codecs/basic.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/basic.js +184 -0
- package/lib/Compatibility/legacy-store/codecs/basic.js.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/index.d.ts +6 -0
- package/lib/Compatibility/legacy-store/codecs/index.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/index.js +7 -0
- package/lib/Compatibility/legacy-store/codecs/index.js.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/signal.d.ts +8 -0
- package/lib/Compatibility/legacy-store/codecs/signal.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/codecs/signal.js +219 -0
- package/lib/Compatibility/legacy-store/codecs/signal.js.map +1 -0
- package/lib/Compatibility/legacy-store/common.d.ts +25 -0
- package/lib/Compatibility/legacy-store/common.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/common.js +112 -0
- package/lib/Compatibility/legacy-store/common.js.map +1 -0
- package/lib/Compatibility/legacy-store/constants.d.ts +226 -0
- package/lib/Compatibility/legacy-store/constants.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/constants.js +199 -0
- package/lib/Compatibility/legacy-store/constants.js.map +1 -0
- package/lib/Compatibility/legacy-store/device.d.ts +9 -0
- package/lib/Compatibility/legacy-store/device.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/device.js +192 -0
- package/lib/Compatibility/legacy-store/device.js.map +1 -0
- package/lib/Compatibility/legacy-store/multi-file.d.ts +6 -0
- package/lib/Compatibility/legacy-store/multi-file.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/multi-file.js +84 -0
- package/lib/Compatibility/legacy-store/multi-file.js.map +1 -0
- package/lib/Compatibility/legacy-store/native-projection.d.ts +8 -0
- package/lib/Compatibility/legacy-store/native-projection.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/native-projection.js +109 -0
- package/lib/Compatibility/legacy-store/native-projection.js.map +1 -0
- package/lib/Compatibility/legacy-store/routing.d.ts +18 -0
- package/lib/Compatibility/legacy-store/routing.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/routing.js +162 -0
- package/lib/Compatibility/legacy-store/routing.js.map +1 -0
- package/lib/Compatibility/legacy-store/types.d.ts +41 -0
- package/lib/Compatibility/legacy-store/types.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/types.js +3 -0
- package/lib/Compatibility/legacy-store/types.js.map +1 -0
- package/lib/Compatibility/legacy-store/validation.d.ts +9 -0
- package/lib/Compatibility/legacy-store/validation.d.ts.map +1 -0
- package/lib/Compatibility/legacy-store/validation.js +49 -0
- package/lib/Compatibility/legacy-store/validation.js.map +1 -0
- package/lib/Compatibility/media-type.d.ts +10 -0
- package/lib/Compatibility/media-type.d.ts.map +1 -0
- package/lib/Compatibility/media-type.js +31 -0
- package/lib/Compatibility/media-type.js.map +1 -0
- package/lib/Compatibility/message-keys.d.ts +9 -0
- package/lib/Compatibility/message-keys.d.ts.map +1 -0
- package/lib/Compatibility/message-keys.js +15 -0
- package/lib/Compatibility/message-keys.js.map +1 -0
- package/lib/Compatibility/message-relay.d.ts +26 -0
- package/lib/Compatibility/message-relay.d.ts.map +1 -0
- package/lib/Compatibility/message-relay.js +61 -0
- package/lib/Compatibility/message-relay.js.map +1 -0
- package/lib/Compatibility/message-upsert.d.ts +11 -0
- package/lib/Compatibility/message-upsert.d.ts.map +1 -0
- package/lib/Compatibility/message-upsert.js +8 -0
- package/lib/Compatibility/message-upsert.js.map +1 -0
- package/lib/Compatibility/participating-refresh.d.ts +9 -0
- package/lib/Compatibility/participating-refresh.d.ts.map +1 -0
- package/lib/Compatibility/participating-refresh.js +14 -0
- package/lib/Compatibility/participating-refresh.js.map +1 -0
- package/lib/Compatibility/proto-runtime.d.ts +9 -0
- package/lib/Compatibility/proto-runtime.d.ts.map +1 -0
- package/lib/Compatibility/proto-runtime.js +567 -0
- package/lib/Compatibility/proto-runtime.js.map +1 -0
- package/lib/Compatibility/public-api/auth-utils.d.ts +6 -0
- package/lib/Compatibility/public-api/auth-utils.d.ts.map +1 -0
- package/lib/Compatibility/public-api/auth-utils.js +202 -0
- package/lib/Compatibility/public-api/auth-utils.js.map +1 -0
- package/lib/Compatibility/public-api/enum-types.d.ts +163 -0
- package/lib/Compatibility/public-api/enum-types.d.ts.map +1 -0
- package/lib/Compatibility/public-api/enum-types.js +10 -0
- package/lib/Compatibility/public-api/enum-types.js.map +1 -0
- package/lib/Compatibility/public-api/identity-change-handler.d.ts +42 -0
- package/lib/Compatibility/public-api/identity-change-handler.d.ts.map +1 -0
- package/lib/Compatibility/public-api/identity-change-handler.js +38 -0
- package/lib/Compatibility/public-api/identity-change-handler.js.map +1 -0
- package/lib/Compatibility/public-api/message-retry-manager.d.ts +62 -0
- package/lib/Compatibility/public-api/message-retry-manager.d.ts.map +1 -0
- package/lib/Compatibility/public-api/message-retry-manager.js +180 -0
- package/lib/Compatibility/public-api/message-retry-manager.js.map +1 -0
- package/lib/Compatibility/public-api/pre-key-manager.d.ts +14 -0
- package/lib/Compatibility/public-api/pre-key-manager.d.ts.map +1 -0
- package/lib/Compatibility/public-api/pre-key-manager.js +83 -0
- package/lib/Compatibility/public-api/pre-key-manager.js.map +1 -0
- package/lib/Compatibility/public-api/stanza-ack.d.ts +4 -0
- package/lib/Compatibility/public-api/stanza-ack.d.ts.map +1 -0
- package/lib/Compatibility/public-api/stanza-ack.js +20 -0
- package/lib/Compatibility/public-api/stanza-ack.js.map +1 -0
- package/lib/Compatibility/signal-repository.d.ts +12 -0
- package/lib/Compatibility/signal-repository.d.ts.map +1 -0
- package/lib/Compatibility/signal-repository.js +131 -0
- package/lib/Compatibility/signal-repository.js.map +1 -0
- package/lib/Compatibility/socket-results.d.ts +28 -0
- package/lib/Compatibility/socket-results.d.ts.map +1 -0
- package/lib/Compatibility/socket-results.js +72 -0
- package/lib/Compatibility/socket-results.js.map +1 -0
- package/lib/Compatibility/stanza-responses.d.ts +13 -0
- package/lib/Compatibility/stanza-responses.d.ts.map +1 -0
- package/lib/Compatibility/stanza-responses.js +16 -0
- package/lib/Compatibility/stanza-responses.js.map +1 -0
- package/lib/Compatibility/tagged-message-waiter.d.ts +5 -0
- package/lib/Compatibility/tagged-message-waiter.d.ts.map +1 -0
- package/lib/Compatibility/tagged-message-waiter.js +42 -0
- package/lib/Compatibility/tagged-message-waiter.js.map +1 -0
- package/lib/Compatibility/usync/adapter.d.ts +13 -0
- package/lib/Compatibility/usync/adapter.d.ts.map +1 -0
- package/lib/Compatibility/usync/adapter.js +291 -0
- package/lib/Compatibility/usync/adapter.js.map +1 -0
- package/lib/Compatibility/websocket-client.d.ts +40 -0
- package/lib/Compatibility/websocket-client.d.ts.map +1 -0
- package/lib/Compatibility/websocket-client.js +120 -0
- package/lib/Compatibility/websocket-client.js.map +1 -0
- package/lib/Defaults/index.d.ts +70 -3
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +107 -15
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Platform/crypto.d.ts +6 -0
- package/lib/Platform/crypto.d.ts.map +1 -0
- package/lib/Platform/crypto.js +36 -0
- package/lib/Platform/crypto.js.map +1 -0
- package/lib/Socket/blocking.d.ts +2 -2
- package/lib/Socket/blocking.d.ts.map +1 -1
- package/lib/Socket/blocking.js +2 -1
- package/lib/Socket/blocking.js.map +1 -1
- package/lib/Socket/chat-actions.d.ts +2 -9
- package/lib/Socket/chat-actions.d.ts.map +1 -1
- package/lib/Socket/chat-actions.js +24 -13
- package/lib/Socket/chat-actions.js.map +1 -1
- package/lib/Socket/communities.d.ts +61 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +72 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/contacts.d.ts +4 -2
- package/lib/Socket/contacts.d.ts.map +1 -1
- package/lib/Socket/contacts.js +6 -4
- package/lib/Socket/contacts.js.map +1 -1
- package/lib/Socket/events.d.ts +13 -5
- package/lib/Socket/events.d.ts.map +1 -1
- package/lib/Socket/events.js +273 -55
- package/lib/Socket/events.js.map +1 -1
- package/lib/Socket/group-notifications.d.ts +1 -30
- package/lib/Socket/group-notifications.d.ts.map +1 -1
- package/lib/Socket/group-notifications.js +3 -268
- package/lib/Socket/group-notifications.js.map +1 -1
- package/lib/Socket/groups.d.ts +17 -36
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +111 -116
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +140 -201
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +215 -345
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/message-capping.d.ts +4 -0
- package/lib/Socket/message-capping.d.ts.map +1 -0
- package/lib/Socket/message-capping.js +22 -0
- package/lib/Socket/message-capping.js.map +1 -0
- package/lib/Socket/messages.d.ts +8 -14
- package/lib/Socket/messages.d.ts.map +1 -1
- package/lib/Socket/messages.js +74 -40
- package/lib/Socket/messages.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +5 -0
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +7 -0
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/prekeys.d.ts +10 -0
- package/lib/Socket/prekeys.d.ts.map +1 -0
- package/lib/Socket/prekeys.js +21 -0
- package/lib/Socket/prekeys.js.map +1 -0
- package/lib/Socket/presence.d.ts +3 -3
- package/lib/Socket/presence.d.ts.map +1 -1
- package/lib/Socket/presence.js +2 -2
- package/lib/Socket/presence.js.map +1 -1
- package/lib/Socket/profile.d.ts +6 -8
- package/lib/Socket/profile.d.ts.map +1 -1
- package/lib/Socket/profile.js +18 -17
- package/lib/Socket/profile.js.map +1 -1
- package/lib/Socket/reachout.js +1 -1
- package/lib/Socket/transport.d.ts.map +1 -1
- package/lib/Socket/transport.js +13 -1
- package/lib/Socket/transport.js.map +1 -1
- package/lib/Socket/types.d.ts +4 -2
- package/lib/Socket/types.d.ts.map +1 -1
- package/lib/Socket/types.js.map +1 -1
- package/lib/Socket/usync.d.ts +12 -0
- package/lib/Socket/usync.d.ts.map +1 -0
- package/lib/Socket/usync.js +27 -0
- package/lib/Socket/usync.js.map +1 -0
- package/lib/Types/Auth.d.ts +28 -30
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Auth.js +1 -1
- package/lib/Types/Auth.js.map +1 -1
- package/lib/Types/BinaryNode.d.ts +0 -4
- package/lib/Types/BinaryNode.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +1 -1
- package/lib/Types/Bussines.d.ts.map +1 -1
- package/lib/Types/Call.d.ts +3 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +2 -2
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +16 -5
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/Events.js +1 -1
- package/lib/Types/Events.js.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +4 -0
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Label.d.ts +3 -23
- package/lib/Types/Label.d.ts.map +1 -1
- package/lib/Types/Label.js +24 -23
- package/lib/Types/Label.js.map +1 -1
- package/lib/Types/LabelAssociation.d.ts +5 -6
- package/lib/Types/LabelAssociation.d.ts.map +1 -1
- package/lib/Types/LabelAssociation.js +4 -5
- package/lib/Types/LabelAssociation.js.map +1 -1
- package/lib/Types/Message.d.ts +45 -10
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js +5 -7
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/Newsletter.d.ts +5 -28
- package/lib/Types/Newsletter.d.ts.map +1 -1
- package/lib/Types/Newsletter.js +34 -30
- package/lib/Types/Newsletter.js.map +1 -1
- package/lib/Types/Product.d.ts +75 -0
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Reachout.d.ts +3 -18
- package/lib/Types/Reachout.d.ts.map +1 -1
- package/lib/Types/Reachout.js +20 -19
- package/lib/Types/Reachout.js.map +1 -1
- package/lib/Types/Signal.d.ts +91 -0
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +76 -30
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/State.d.ts +19 -0
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +26 -1
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/USync.d.ts +9 -0
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +9 -12
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +30 -30
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +2 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +3 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/boom.d.ts +8 -32
- package/lib/Utils/boom.d.ts.map +1 -1
- package/lib/Utils/boom.js +7 -62
- package/lib/Utils/boom.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts +1 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js +6 -0
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +8 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +32 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +31 -0
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +81 -0
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +15 -4
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +471 -34
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +52 -15
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +269 -25
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/group-stub-params.d.ts +1 -28
- package/lib/Utils/group-stub-params.d.ts.map +1 -1
- package/lib/Utils/group-stub-params.js +2 -44
- package/lib/Utils/group-stub-params.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +2 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -0
- package/lib/Utils/identity-change-handler.js +4 -0
- package/lib/Utils/identity-change-handler.js.map +1 -0
- package/lib/Utils/index.d.ts +9 -0
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +19 -10
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +2 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +4 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +28 -6
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +119 -1
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +33 -9
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +106 -33
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/native-crypto-provider.d.ts +10 -8
- package/lib/Utils/native-crypto-provider.d.ts.map +1 -1
- package/lib/Utils/native-crypto-provider.js +13 -56
- package/lib/Utils/native-crypto-provider.js.map +1 -1
- package/lib/Utils/pre-key-manager.d.ts +2 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +3 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-history-message.d.ts +15 -4
- package/lib/Utils/process-history-message.d.ts.map +1 -1
- package/lib/Utils/process-history-message.js +162 -95
- package/lib/Utils/process-history-message.js.map +1 -1
- package/lib/Utils/process-message.d.ts +25 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +79 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/signal.d.ts +29 -0
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +133 -0
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/sparse-array.d.ts +9 -0
- package/lib/Utils/sparse-array.d.ts.map +1 -0
- package/lib/Utils/sparse-array.js +12 -0
- package/lib/Utils/sparse-array.js.map +1 -0
- package/lib/Utils/stanza-ack.d.ts +2 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +3 -0
- package/lib/Utils/stanza-ack.js.map +1 -0
- package/lib/Utils/use-bridge-store.d.ts.map +1 -1
- package/lib/Utils/use-bridge-store.js +191 -7
- package/lib/Utils/use-bridge-store.js.map +1 -1
- package/lib/Utils/use-memory-store.d.ts +8 -4
- package/lib/Utils/use-memory-store.d.ts.map +1 -1
- package/lib/Utils/use-memory-store.js +87 -10
- package/lib/Utils/use-memory-store.js.map +1 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts +4 -2
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -1
- package/lib/Utils/use-multi-file-auth-state.js +13 -5
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -1
- package/lib/Utils/wrap-legacy-store.d.ts +8 -32
- package/lib/Utils/wrap-legacy-store.d.ts.map +1 -1
- package/lib/Utils/wrap-legacy-store.js +7 -1214
- package/lib/Utils/wrap-legacy-store.js.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +8 -0
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +63 -1
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/index.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +22 -10
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +40 -9
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/lib/WAProto/compatibility-schema.d.ts +25 -0
- package/lib/WAProto/compatibility-schema.d.ts.map +1 -0
- package/lib/WAProto/compatibility-schema.js +6 -0
- package/lib/WAProto/compatibility-schema.js.map +1 -0
- package/lib/WAProto/runtime.d.ts +14019 -0
- package/lib/WAProto/runtime.js +17 -0
- package/lib/WAProto/runtime.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +27 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +39 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +33 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +41 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +19 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +15 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +21 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +30 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +78 -0
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/package.json +32 -14
- package/lib/Bridge/__tests__/adapt.test.d.ts +0 -2
- package/lib/Bridge/__tests__/adapt.test.d.ts.map +0 -1
- package/lib/Bridge/__tests__/adapt.test.js +0 -387
- package/lib/Bridge/__tests__/adapt.test.js.map +0 -1
- package/lib/Bridge/__tests__/dts-drift.test.d.ts +0 -13
- package/lib/Bridge/__tests__/dts-drift.test.d.ts.map +0 -1
- package/lib/Bridge/__tests__/dts-drift.test.js +0 -90
- package/lib/Bridge/__tests__/dts-drift.test.js.map +0 -1
- package/lib/Bridge/__tests__/fixtures.d.ts +0 -192
- package/lib/Bridge/__tests__/fixtures.d.ts.map +0 -1
- package/lib/Bridge/__tests__/fixtures.js +0 -99
- package/lib/Bridge/__tests__/fixtures.js.map +0 -1
- package/lib/Utils/__tests__/_legacy-store-fixtures.d.ts +0 -73
- package/lib/Utils/__tests__/_legacy-store-fixtures.d.ts.map +0 -1
- package/lib/Utils/__tests__/_legacy-store-fixtures.js +0 -113
- package/lib/Utils/__tests__/_legacy-store-fixtures.js.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-coverage.test.d.ts +0 -10
- package/lib/Utils/__tests__/wrap-legacy-store-coverage.test.d.ts.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-coverage.test.js +0 -291
- package/lib/Utils/__tests__/wrap-legacy-store-coverage.test.js.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-lid-mapping.test.d.ts +0 -8
- package/lib/Utils/__tests__/wrap-legacy-store-lid-mapping.test.d.ts.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-lid-mapping.test.js +0 -91
- package/lib/Utils/__tests__/wrap-legacy-store-lid-mapping.test.js.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-sender-key.test.d.ts +0 -10
- package/lib/Utils/__tests__/wrap-legacy-store-sender-key.test.d.ts.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-sender-key.test.js +0 -125
- package/lib/Utils/__tests__/wrap-legacy-store-sender-key.test.js.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-session-ratchet.test.d.ts +0 -2
- package/lib/Utils/__tests__/wrap-legacy-store-session-ratchet.test.d.ts.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-session-ratchet.test.js +0 -214
- package/lib/Utils/__tests__/wrap-legacy-store-session-ratchet.test.js.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-session.test.d.ts +0 -14
- package/lib/Utils/__tests__/wrap-legacy-store-session.test.d.ts.map +0 -1
- package/lib/Utils/__tests__/wrap-legacy-store-session.test.js +0 -305
- package/lib/Utils/__tests__/wrap-legacy-store-session.test.js.map +0 -1
- package/lib/Utils/bridge-call.d.ts +0 -22
- package/lib/Utils/bridge-call.d.ts.map +0 -1
- package/lib/Utils/bridge-call.js +0 -105
- package/lib/Utils/bridge-call.js.map +0 -1
- package/lib/Utils/lid-mapping-store.d.ts +0 -81
- package/lib/Utils/lid-mapping-store.d.ts.map +0 -1
- package/lib/Utils/lid-mapping-store.js +0 -126
- package/lib/Utils/lid-mapping-store.js.map +0 -1
- package/lib/__tests__/expect.d.ts +0 -44
- package/lib/__tests__/expect.d.ts.map +0 -1
- package/lib/__tests__/expect.js +0 -100
- package/lib/__tests__/expect.js.map +0 -1
package/lib/Socket/contacts.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
export const makeContactMethods = (ctx) => ({
|
|
2
|
-
onWhatsApp: async (...
|
|
2
|
+
onWhatsApp: async (...phoneNumber) => {
|
|
3
3
|
const client = await ctx.getClient();
|
|
4
4
|
// Single batched usync — the bridge splits PN/LID inputs internally and
|
|
5
5
|
// returns lid/pnJid/isBusiness in the same payload, so no secondary IQ.
|
|
6
|
-
const results = await client.isOnWhatsApp(
|
|
6
|
+
const results = await client.isOnWhatsApp(phoneNumber);
|
|
7
7
|
return results.map(r => {
|
|
8
8
|
const out = { exists: r.isRegistered, jid: r.jid, isBusiness: r.isBusiness };
|
|
9
9
|
if (r.lid)
|
|
10
10
|
out.lid = r.lid;
|
|
11
11
|
if (r.pnJid)
|
|
12
12
|
out.pnJid = r.pnJid;
|
|
13
|
+
if (r.verifiedName)
|
|
14
|
+
out.verifiedName = r.verifiedName;
|
|
13
15
|
return out;
|
|
14
16
|
});
|
|
15
17
|
},
|
|
16
|
-
profilePictureUrl: async (jid, type = 'preview') => {
|
|
17
|
-
const result = await (await ctx.getClient()).profilePictureUrl(jid, type);
|
|
18
|
+
profilePictureUrl: async (jid, type = 'preview', timeoutMs) => {
|
|
19
|
+
const result = await (await ctx.getClient()).profilePictureUrl(jid, type, timeoutMs);
|
|
18
20
|
return result?.url;
|
|
19
21
|
},
|
|
20
22
|
fetchUserInfo: async (...jids) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/Socket/contacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/Socket/contacts.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAkB,EAAE,EAAE,CAAC,CAAC;IAC1D,UAAU,EAAE,KAAK,EAAE,GAAG,WAAqB,EAA2C,EAAE;QACvF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAA;QACpC,wEAAwE;QACxE,wEAAwE;QACxE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QACtD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACtB,MAAM,GAAG,GAAqB,EAAE,MAAM,EAAE,CAAC,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;YAC9F,IAAI,CAAC,CAAC,GAAG;gBAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAA;YAC1B,IAAI,CAAC,CAAC,KAAK;gBAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAA;YAChC,IAAI,CAAC,CAAC,YAAY;gBAAE,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAA;YACrD,OAAO,GAAG,CAAA;QACX,CAAC,CAAC,CAAA;IACH,CAAC;IAED,iBAAiB,EAAE,KAAK,EAAE,GAAW,EAAE,IAAI,GAAwB,SAAS,EAAE,SAAkB,EAAE,EAAE;QACnG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;QACpF,OAAO,MAAM,EAAE,GAAG,CAAA;IACnB,CAAC;IAED,aAAa,EAAE,KAAK,EAAE,GAAG,IAAc,EAAE,EAAE;QAC1C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IACzD,CAAC;CACD,CAAC,CAAA"}
|
package/lib/Socket/events.d.ts
CHANGED
|
@@ -6,20 +6,28 @@
|
|
|
6
6
|
* mapped type so TS forces a handler per variant — a missing handler
|
|
7
7
|
* is a compile error.
|
|
8
8
|
*/
|
|
9
|
-
import type { WhatsAppEvent } from 'whatsapp-rust-bridge';
|
|
9
|
+
import type { WhatsAppEvent, WhatsAppEventCallbacks } from 'whatsapp-rust-bridge';
|
|
10
|
+
import type { CanonicalEvent } from '../Bridge/index.js';
|
|
10
11
|
import type { SocketContext } from './types.js';
|
|
11
12
|
interface EventCallbacks {
|
|
12
13
|
onPairSuccess?: (data: {
|
|
13
14
|
platform?: string;
|
|
14
15
|
businessName?: string;
|
|
15
16
|
}) => void | Promise<void>;
|
|
17
|
+
onIncomingCall?: (event: Extract<CanonicalEvent, {
|
|
18
|
+
type: 'incomingCall';
|
|
19
|
+
}>) => void;
|
|
20
|
+
onDirtyState?: (event: Extract<CanonicalEvent, {
|
|
21
|
+
type: 'dirtyState';
|
|
22
|
+
}>) => void;
|
|
16
23
|
}
|
|
17
24
|
/**
|
|
18
|
-
* Create
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* exclusively, so a downstream rename surfaces as a `tsc` failure.
|
|
25
|
+
* Create typed single and batch handlers for the bridge. The bridge only uses
|
|
26
|
+
* the batch capability when adjacent messages are already queued, while this
|
|
27
|
+
* layer owns all Baileys-specific translation and EventEmitter aggregation.
|
|
22
28
|
*/
|
|
29
|
+
export declare const makeEventHandlers: (ctx: SocketContext, callbacks?: EventCallbacks) => WhatsAppEventCallbacks;
|
|
30
|
+
/** Legacy single-event helper retained for direct consumers and tests. */
|
|
23
31
|
export declare const makeEventHandler: (ctx: SocketContext, callbacks?: EventCallbacks) => (event: WhatsAppEvent) => void;
|
|
24
32
|
export {};
|
|
25
33
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/Socket/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/Socket/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAGX,aAAa,EACb,sBAAsB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAA;AA8B1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAiF/C,UAAU,cAAc;IACvB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5F,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,KAAK,IAAI,CAAA;IACnF,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,CAAC,KAAK,IAAI,CAAA;CAC/E;AAuuBD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,aAAa,cAAc,cAAc,KAAG,sBAuDlF,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,QAAS,aAAa,cAAc,cAAc,mCACrC,CAAA"}
|
package/lib/Socket/events.js
CHANGED
|
@@ -6,14 +6,26 @@
|
|
|
6
6
|
* mapped type so TS forces a handler per variant — a missing handler
|
|
7
7
|
* is a compile error.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import { decodeProtoBatch } from 'whatsapp-rust-bridge';
|
|
10
|
+
import { adaptBridgeEvent, adaptBridgeMessageWire } from '../Bridge/index.js';
|
|
11
|
+
import { decodeHistorySyncWireBatch } from '../Bridge/history-sync-wire.js';
|
|
12
|
+
import { bridgeGroupMetadataToBaileys } from '../Compatibility/group-metadata.js';
|
|
13
|
+
import { DEF_CALLBACK_PREFIX, DEF_TAG_PREFIX, HISTORY_SYNC_PAUSED_TIMEOUT_MS } from '../Defaults/index.js';
|
|
14
|
+
import { DisconnectReason, WAMessageStatus, WAProto } from '../Types/index.js';
|
|
15
|
+
import { LabelAssociationType } from '../Types/LabelAssociation.js';
|
|
16
|
+
import { Boom } from '../Utils/boom.js';
|
|
17
|
+
import { toNumber } from '../Utils/generics.js';
|
|
18
|
+
import { CONVERSATION_HISTORY_SYNC_TYPES } from '../Utils/process-history-message.js';
|
|
19
|
+
import { isJidGroup } from '../WABinary/jid-utils.js';
|
|
20
|
+
import { buildGroupCreateStubMessage, buildGroupJoinRequestEvents, buildGroupNotificationChatUpdates, buildGroupNotificationDomainEvent, buildGroupNotificationStubMessages } from '../Compatibility/group-notifications.js';
|
|
21
|
+
import { emitMessageUpsert } from '../Compatibility/message-upsert.js';
|
|
22
|
+
import { extractMessageCappingPayload } from './message-capping.js';
|
|
23
|
+
import { mapReachoutTimelock } from './reachout.js';
|
|
24
|
+
const CANONICAL_MESSAGE_EVENT = 'message';
|
|
25
|
+
const MESSAGE_UPSERT_APPEND = 'append';
|
|
26
|
+
const MESSAGE_UPSERT_NOTIFY = 'notify';
|
|
27
|
+
const MESSAGE_PROTO_TYPE = 'Message';
|
|
28
|
+
const MESSAGE_WIRE_OFFSET_SENTINEL_COUNT = 1;
|
|
17
29
|
/** Emit CB: pattern events on the ws EventEmitter for retrocompat. */
|
|
18
30
|
const emitCBEvents = (ctx, node) => {
|
|
19
31
|
const { ws } = ctx;
|
|
@@ -71,6 +83,17 @@ const canonicalMessageToWAMessage = (m) => {
|
|
|
71
83
|
wm.key.editAttribute = m.editAttribute;
|
|
72
84
|
return wm;
|
|
73
85
|
};
|
|
86
|
+
const messageUpsertMetadata = (message) => ({
|
|
87
|
+
type: message.isOffline ? MESSAGE_UPSERT_APPEND : MESSAGE_UPSERT_NOTIFY,
|
|
88
|
+
requestId: message.unavailableRequestId
|
|
89
|
+
});
|
|
90
|
+
const hasMessageSideEffects = (message) => message.messageProto.reactionMessage != null || message.messageProto.protocolMessage != null;
|
|
91
|
+
const hasSameUpsertMetadata = (left, right) => left.type === right.type && left.requestId === right.requestId;
|
|
92
|
+
const clearHistorySyncPausedTimeout = (state) => {
|
|
93
|
+
if (state.pausedTimeout)
|
|
94
|
+
clearTimeout(state.pausedTimeout);
|
|
95
|
+
state.pausedTimeout = undefined;
|
|
96
|
+
};
|
|
74
97
|
const emitClose = (ctx, reason, statusCode, data) => ctx.ev.emit('connection.update', {
|
|
75
98
|
connection: 'close',
|
|
76
99
|
lastDisconnect: { error: new Boom(reason, { statusCode, data }), date: new Date() }
|
|
@@ -132,7 +155,13 @@ const emitConnectionUpdate = (ctx, update) => ctx.ev.emit('connection.update', u
|
|
|
132
155
|
const DISPATCHERS = {
|
|
133
156
|
// ── Connection lifecycle ──
|
|
134
157
|
connected: (_, { ctx }) => emitConnectionUpdate(ctx, { connection: 'open' }),
|
|
135
|
-
|
|
158
|
+
offlineSyncCompleted: (_, { ctx }) => emitConnectionUpdate(ctx, {
|
|
159
|
+
receivedPendingNotifications: true
|
|
160
|
+
}),
|
|
161
|
+
disconnected: (_, { ctx, historySync }) => {
|
|
162
|
+
clearHistorySyncPausedTimeout(historySync);
|
|
163
|
+
emitClose(ctx, 'Connection closed', DisconnectReason.connectionClosed);
|
|
164
|
+
},
|
|
136
165
|
qr: (evt, { ctx }) => emitConnectionUpdate(ctx, { qr: evt.code }),
|
|
137
166
|
pairSuccess: (evt, { ctx, callbacks }) => {
|
|
138
167
|
const { id, lid, businessName, platform } = evt;
|
|
@@ -196,13 +225,7 @@ const DISPATCHERS = {
|
|
|
196
225
|
// succeeds, not to drop inbound `fromMe` messages from other linked
|
|
197
226
|
// devices.
|
|
198
227
|
const waMsg = canonicalMessageToWAMessage(evt);
|
|
199
|
-
|
|
200
|
-
messages: [waMsg],
|
|
201
|
-
type: evt.isOffline ? 'append' : 'notify'
|
|
202
|
-
};
|
|
203
|
-
if (evt.unavailableRequestId)
|
|
204
|
-
upsertPayload.requestId = evt.unavailableRequestId;
|
|
205
|
-
ctx.ev.emit('messages.upsert', upsertPayload);
|
|
228
|
+
emitMessageUpsert(ctx, [waMsg], messageUpsertMetadata(evt));
|
|
206
229
|
// Mirror upstream `process-message.ts:523-533`: when the inbound
|
|
207
230
|
// proto carries a `reactionMessage`, surface it on the dedicated
|
|
208
231
|
// `messages.reaction` channel as well. The `key` in the event
|
|
@@ -260,8 +283,11 @@ const DISPATCHERS = {
|
|
|
260
283
|
]);
|
|
261
284
|
}
|
|
262
285
|
else if (protocolMsg.type === WAProto.Message.ProtocolMessage.Type.MESSAGE_EDIT && protocolMsg.editedMessage) {
|
|
286
|
+
// `timestampMs` is an int64 proto field → a protobufjs `Long`
|
|
287
|
+
// object from the bridge; `toNumber` is Long-safe (plain
|
|
288
|
+
// `Number()` would yield NaN and corrupt the edit timestamp).
|
|
263
289
|
const tsMs = protocolMsg.timestampMs;
|
|
264
|
-
const editedTs = tsMs != null ? Math.floor(
|
|
290
|
+
const editedTs = tsMs != null ? Math.floor(toNumber(tsMs) / 1000) : (evt.timestamp ?? waMsg.messageTimestamp);
|
|
265
291
|
ctx.ev.emit('messages.update', [
|
|
266
292
|
{
|
|
267
293
|
key: { ...waMsg.key, id: protocolKeyId },
|
|
@@ -383,6 +409,42 @@ const DISPATCHERS = {
|
|
|
383
409
|
groupUpdate: (evt, { ctx }) => {
|
|
384
410
|
const user = ctx.getUser();
|
|
385
411
|
const fromMe = !!(evt.author && (evt.author === user?.id || evt.author === user?.lid));
|
|
412
|
+
if (evt.action.type === 'create') {
|
|
413
|
+
// The neutral bridge marker intentionally carries no Baileys-shaped
|
|
414
|
+
// metadata. Resolve it here, at the compatibility boundary, then emit
|
|
415
|
+
// the same complete lifecycle and ordering as upstream.
|
|
416
|
+
void (async () => {
|
|
417
|
+
try {
|
|
418
|
+
const bridgeMetadata = await (await ctx.getClient()).getGroupMetadata(evt.groupJid);
|
|
419
|
+
const metadata = bridgeGroupMetadataToBaileys(bridgeMetadata);
|
|
420
|
+
ctx.ev.emit('chats.upsert', [
|
|
421
|
+
{ id: metadata.id, name: metadata.subject, conversationTimestamp: metadata.creation }
|
|
422
|
+
]);
|
|
423
|
+
ctx.ev.emit('groups.upsert', [
|
|
424
|
+
{
|
|
425
|
+
...metadata,
|
|
426
|
+
author: evt.author,
|
|
427
|
+
authorPn: evt.authorPn,
|
|
428
|
+
authorUsername: evt.authorUsername
|
|
429
|
+
}
|
|
430
|
+
]);
|
|
431
|
+
ctx.ev.emit('messages.upsert', {
|
|
432
|
+
messages: [buildGroupCreateStubMessage(evt, metadata, fromMe)],
|
|
433
|
+
type: 'append'
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
ctx.logger.warn({ err, groupJid: evt.groupJid }, 'group create notification: metadata resolution failed');
|
|
438
|
+
}
|
|
439
|
+
})();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
// Upstream upserts the synthesized notification message before
|
|
443
|
+
// process-message derives high-level group/chat events from it.
|
|
444
|
+
const stubMessages = buildGroupNotificationStubMessages(evt, fromMe);
|
|
445
|
+
if (stubMessages.length > 0) {
|
|
446
|
+
ctx.ev.emit('messages.upsert', { messages: stubMessages, type: 'append' });
|
|
447
|
+
}
|
|
386
448
|
// Dispatch via discriminator instead of `as never` so TS validates
|
|
387
449
|
// payload ↔ event-name pairing.
|
|
388
450
|
const domainEvent = buildGroupNotificationDomainEvent(evt);
|
|
@@ -392,25 +454,15 @@ const DISPATCHERS = {
|
|
|
392
454
|
else
|
|
393
455
|
ctx.ev.emit('group-participants.update', domainEvent.payload);
|
|
394
456
|
}
|
|
395
|
-
// `groups.upsert` is intentionally NOT emitted from `<create>`. The
|
|
396
|
-
// bridge gives us only the creation marker — `participants` /
|
|
397
|
-
// `subject` / `creation` are unknown without an extra IQ. Upstream
|
|
398
|
-
// emits this only AFTER `groupMetadata` resolves (`messages-recv.ts:661`),
|
|
399
|
-
// so emitting `[{ id }]` here would feed consumers a broken
|
|
400
|
-
// `GroupMetadata` (participants undefined → `metadata.participants.map`
|
|
401
|
-
// throws). Bots that want the metadata should call
|
|
402
|
-
// `sock.groupMetadata(evt.groupJid)` from a `groups.update` listener
|
|
403
|
-
// or after the matching `messages.upsert` stub.
|
|
404
457
|
// Fan out `group.join-request` for membership_approval_request /
|
|
405
458
|
// created_membership_requests / revoked_membership_requests.
|
|
406
459
|
// Upstream emits one event per affected participant.
|
|
407
460
|
for (const joinReq of buildGroupJoinRequestEvents(evt)) {
|
|
408
461
|
ctx.ev.emit('group.join-request', joinReq);
|
|
409
462
|
}
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
ctx.ev.emit('
|
|
413
|
-
}
|
|
463
|
+
const chatUpdates = buildGroupNotificationChatUpdates(evt);
|
|
464
|
+
if (chatUpdates.length > 0)
|
|
465
|
+
ctx.ev.emit('chats.update', chatUpdates);
|
|
414
466
|
},
|
|
415
467
|
// ── Chat state ──
|
|
416
468
|
archiveUpdate: (evt, { ctx }) => ctx.ev.emit('chats.update', [{ id: evt.jid, archived: evt.archived }]),
|
|
@@ -435,16 +487,34 @@ const DISPATCHERS = {
|
|
|
435
487
|
// Mirrors upstream `chat-utils.ts:852`: read=true → unreadCount=0,
|
|
436
488
|
// read=false (mark as unread) → -1 sentinel.
|
|
437
489
|
ctx.ev.emit('chats.update', [{ id: evt.jid, unreadCount: evt.read ? 0 : -1 }]),
|
|
490
|
+
labelEdit: (evt, { ctx }) =>
|
|
491
|
+
// Upstream `labels.edit` carries a `Label`. A delete arrives with
|
|
492
|
+
// `deleted: true` (consumers remove it from their store).
|
|
493
|
+
ctx.ev.emit('labels.edit', {
|
|
494
|
+
id: evt.labelId,
|
|
495
|
+
name: evt.name,
|
|
496
|
+
color: evt.color,
|
|
497
|
+
deleted: evt.deleted,
|
|
498
|
+
predefinedId: evt.predefinedId
|
|
499
|
+
}),
|
|
500
|
+
labelAssociation: (evt, { ctx }) =>
|
|
501
|
+
// Inbound sync only ever carries chat associations (the bridge event
|
|
502
|
+
// has a `chat_jid`); message-label associations are a separate path.
|
|
503
|
+
ctx.ev.emit('labels.association', {
|
|
504
|
+
association: { type: LabelAssociationType.Chat, chatId: evt.chatJid, labelId: evt.labelId },
|
|
505
|
+
type: evt.labeled ? 'add' : 'remove'
|
|
506
|
+
}),
|
|
438
507
|
// ── Calls ──
|
|
439
|
-
incomingCall: (evt, { ctx }) => {
|
|
508
|
+
incomingCall: (evt, { ctx, callbacks }) => {
|
|
509
|
+
callbacks?.onIncomingCall?.(evt);
|
|
440
510
|
const isGroup = isJidGroup(evt.from);
|
|
441
|
-
//
|
|
442
|
-
//
|
|
443
|
-
|
|
444
|
-
const status = evt.action.type === 'preAccept' ? 'ringing' : evt.action.type;
|
|
511
|
+
// Canonical call actions use the exact public Baileys status spelling;
|
|
512
|
+
// missed-call notifications are normalized to `timeout` by the adapter.
|
|
513
|
+
const status = evt.action.type;
|
|
445
514
|
const callEvt = {
|
|
446
515
|
chatId: evt.from,
|
|
447
|
-
from: evt.from,
|
|
516
|
+
from: evt.action.callCreator ?? evt.from,
|
|
517
|
+
...(evt.action.callCreator ? { callCreator: evt.action.callCreator } : {}),
|
|
448
518
|
id: evt.action.callId,
|
|
449
519
|
date: new Date(evt.timestamp * 1000),
|
|
450
520
|
status,
|
|
@@ -472,6 +542,7 @@ const DISPATCHERS = {
|
|
|
472
542
|
ctx.ev.emit('call', [callEvt]);
|
|
473
543
|
},
|
|
474
544
|
// ── Raw passthrough ──
|
|
545
|
+
dirtyState: (evt, { callbacks }) => callbacks?.onDirtyState?.(evt),
|
|
475
546
|
rawNode: (evt, { ctx }) => emitCBEvents(ctx, evt.node),
|
|
476
547
|
notification: (evt, { ctx }) => ctx.logger.trace({ tag: evt.tag, attrs: evt.attrs }, 'bridge generic notification (no Baileys mapping)'),
|
|
477
548
|
mexNotification: (evt, { ctx }) => {
|
|
@@ -485,8 +556,35 @@ const DISPATCHERS = {
|
|
|
485
556
|
ctx.logger.warn({ payload: evt.payload }, 'reachout-timelock push: payload missing expected fields');
|
|
486
557
|
return;
|
|
487
558
|
}
|
|
559
|
+
if (evt.opName === 'MessageCappingInfoNotification') {
|
|
560
|
+
const payload = extractMessageCappingPayload(evt.payload);
|
|
561
|
+
if (payload)
|
|
562
|
+
ctx.ev.emit('message-capping.update', payload);
|
|
563
|
+
else
|
|
564
|
+
ctx.logger.warn({ payload: evt.payload }, 'message-capping push: payload missing expected fields');
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
488
567
|
ctx.logger.trace({ opName: evt.opName, offline: evt.offline }, 'bridge mex notification with no Baileys mapping (drop)');
|
|
489
568
|
},
|
|
569
|
+
serverAck: (evt, { ctx }) => {
|
|
570
|
+
// The public CB surface comes exclusively from Event::RawNode. Rebuilding
|
|
571
|
+
// an ACK from this semantic event would drop optional wire attributes and
|
|
572
|
+
// emit the same stanza twice whenever raw forwarding is enabled.
|
|
573
|
+
if (evt.class === 'message' && evt.error) {
|
|
574
|
+
ctx.logger.warn({ msgId: evt.id, from: evt.from, error: evt.error }, 'outgoing message was rejected by the server');
|
|
575
|
+
ctx.ev.emit('messages.update', [
|
|
576
|
+
{
|
|
577
|
+
key: { remoteJid: evt.from, fromMe: true, id: evt.id },
|
|
578
|
+
update: {
|
|
579
|
+
status: WAMessageStatus.ERROR,
|
|
580
|
+
messageStubParameters: [evt.error]
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
]);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
ctx.logger.debug({ msgId: evt.id, class: evt.class, from: evt.from, timestamp: evt.timestamp }, 'server acknowledged outgoing stanza');
|
|
587
|
+
},
|
|
490
588
|
noop: (evt, { ctx }) => ctx.logger.trace({ bridgeType: evt.bridgeType, detail: evt.detail }, 'bridge event acknowledged (no Baileys equivalent)'),
|
|
491
589
|
lidMappingUpdate: (evt, { ctx }) => {
|
|
492
590
|
// Mirror upstream `messages-recv.ts:287`: one `lid-mapping.update`
|
|
@@ -496,6 +594,7 @@ const DISPATCHERS = {
|
|
|
496
594
|
}
|
|
497
595
|
},
|
|
498
596
|
chatDelete: (evt, { ctx }) => ctx.ev.emit('chats.delete', [evt.jid]),
|
|
597
|
+
chatClear: (evt, { ctx }) => ctx.ev.emit('messages.delete', { jid: evt.jid, all: true }),
|
|
499
598
|
messageDelete: (evt, { ctx }) =>
|
|
500
599
|
// Upstream `chat-utils.ts:857` shape: `{ keys: WAMessageKey[] }` for
|
|
501
600
|
// per-message delete (not the `{ jid, all: true }` chat-clear case
|
|
@@ -541,7 +640,7 @@ const DISPATCHERS = {
|
|
|
541
640
|
ephemeralSettingTimestamp: evt.settingTimestamp
|
|
542
641
|
}
|
|
543
642
|
]),
|
|
544
|
-
historySync: (evt, { ctx }) => {
|
|
643
|
+
historySync: (evt, { ctx, historySync }) => {
|
|
545
644
|
// 1:1 with upstream `process-message.ts:371-376`. `isLatest` is true
|
|
546
645
|
// when this is the first history sync the bot has seen since
|
|
547
646
|
// pairing — upstream tracks it in `creds.processedHistoryMessages`,
|
|
@@ -550,13 +649,49 @@ const DISPATCHERS = {
|
|
|
550
649
|
// gating "first hydrate" logic on `isLatest` see the same boolean.
|
|
551
650
|
const HSType = WAProto.HistorySync.HistorySyncType;
|
|
552
651
|
const isInitial = evt.syncType === HSType.INITIAL_BOOTSTRAP;
|
|
652
|
+
// The bridge may split one chunk into bounded batches (isFinalBatch=false
|
|
653
|
+
// on all but the last). `isLatest`/`progress` are chunk-level signals, so
|
|
654
|
+
// they only fire on the final batch — intermediate batches just append
|
|
655
|
+
// data. A non-batched bridge omits the flag → `!== false` keeps the old
|
|
656
|
+
// single-event behavior.
|
|
657
|
+
const isFinalBatch = evt.isFinalBatch !== false;
|
|
658
|
+
if (isFinalBatch && isInitial && !historySync.initialBootstrapComplete) {
|
|
659
|
+
historySync.initialBootstrapComplete = true;
|
|
660
|
+
ctx.ev.emit('messaging-history.status', {
|
|
661
|
+
syncType: HSType.INITIAL_BOOTSTRAP,
|
|
662
|
+
status: 'complete',
|
|
663
|
+
explicit: true
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
if (isFinalBatch && evt.syncType === HSType.RECENT && !historySync.recentSyncComplete) {
|
|
667
|
+
clearHistorySyncPausedTimeout(historySync);
|
|
668
|
+
if (evt.progress === 100) {
|
|
669
|
+
historySync.recentSyncComplete = true;
|
|
670
|
+
ctx.ev.emit('messaging-history.status', { syncType: HSType.RECENT, status: 'complete', explicit: true });
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
historySync.pausedTimeout = setTimeout(() => {
|
|
674
|
+
if (!historySync.recentSyncComplete) {
|
|
675
|
+
historySync.recentSyncComplete = true;
|
|
676
|
+
ctx.ev.emit('messaging-history.status', {
|
|
677
|
+
syncType: HSType.RECENT,
|
|
678
|
+
status: 'paused',
|
|
679
|
+
explicit: false
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
historySync.pausedTimeout = undefined;
|
|
683
|
+
}, HISTORY_SYNC_PAUSED_TIMEOUT_MS);
|
|
684
|
+
historySync.pausedTimeout.unref?.();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
553
687
|
const payload = {
|
|
554
688
|
chats: evt.chats,
|
|
555
689
|
contacts: evt.contacts,
|
|
556
690
|
messages: evt.messages,
|
|
557
|
-
isLatest: evt.syncType === HSType.ON_DEMAND ? undefined : isInitial,
|
|
558
|
-
progress: evt.progress,
|
|
691
|
+
isLatest: evt.syncType === HSType.ON_DEMAND ? undefined : isInitial && isFinalBatch,
|
|
692
|
+
progress: isFinalBatch ? evt.progress : undefined,
|
|
559
693
|
syncType: evt.syncType,
|
|
694
|
+
pastParticipants: evt.pastParticipants,
|
|
560
695
|
chunkOrder: evt.chunkOrder,
|
|
561
696
|
peerDataRequestSessionId: evt.peerDataRequestSessionId,
|
|
562
697
|
lidPnMappings: evt.lidPnMappings.length > 0 ? evt.lidPnMappings : undefined
|
|
@@ -573,30 +708,113 @@ const DISPATCHERS = {
|
|
|
573
708
|
ctx.ev.emit('contacts.upsert', evt.contacts);
|
|
574
709
|
}
|
|
575
710
|
};
|
|
711
|
+
const dispatchCanonicalEvent = (canonical, dispatchCtx) => {
|
|
712
|
+
// Type-safe table lookup. The runtime cast through `DispatcherFn` is a
|
|
713
|
+
// no-op TS-wise (the table is exhaustively typed) — needed only because TS
|
|
714
|
+
// cannot follow the discriminator across an indexed mapped type.
|
|
715
|
+
const dispatcher = DISPATCHERS[canonical.type];
|
|
716
|
+
try {
|
|
717
|
+
dispatcher(canonical, dispatchCtx);
|
|
718
|
+
}
|
|
719
|
+
catch (err) {
|
|
720
|
+
// One bad event must not poison the rest of the pipeline.
|
|
721
|
+
dispatchCtx.ctx.logger.error({ err, type: canonical.type }, 'dispatcher threw — dropping event');
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
/** Aggregate adjacent ordinary messages while preserving every side-effecting
|
|
725
|
+
* event boundary. Both bridge object events and protobuf-wire batches enter
|
|
726
|
+
* through this single state machine. */
|
|
727
|
+
const dispatchCanonicalBatch = (ctx, dispatchCtx, count, canonicalAt) => {
|
|
728
|
+
let pending;
|
|
729
|
+
for (let index = 0; index < count; index++) {
|
|
730
|
+
const canonical = canonicalAt(index);
|
|
731
|
+
if (!canonical)
|
|
732
|
+
continue;
|
|
733
|
+
// Only ordinary messages can share one messages.upsert emission.
|
|
734
|
+
// Flush before every other event or a message with secondary
|
|
735
|
+
// channels (reaction, revoke, edit, member-label) to preserve the
|
|
736
|
+
// exact observable order of those side effects.
|
|
737
|
+
if (canonical.type !== CANONICAL_MESSAGE_EVENT || hasMessageSideEffects(canonical)) {
|
|
738
|
+
if (pending) {
|
|
739
|
+
emitMessageUpsert(ctx, pending.messages, pending);
|
|
740
|
+
pending = undefined;
|
|
741
|
+
}
|
|
742
|
+
dispatchCanonicalEvent(canonical, dispatchCtx);
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
if (ctx.fullConfig.shouldIgnoreJid?.(canonical.chatJid))
|
|
746
|
+
continue;
|
|
747
|
+
try {
|
|
748
|
+
const metadata = messageUpsertMetadata(canonical);
|
|
749
|
+
const message = canonicalMessageToWAMessage(canonical);
|
|
750
|
+
if (pending && hasSameUpsertMetadata(pending, metadata)) {
|
|
751
|
+
pending.messages.push(message);
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
if (pending)
|
|
755
|
+
emitMessageUpsert(ctx, pending.messages, pending);
|
|
756
|
+
pending = { ...metadata, messages: [message] };
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
catch (err) {
|
|
760
|
+
ctx.logger.error({ err, type: CANONICAL_MESSAGE_EVENT }, 'dispatcher threw — dropping event');
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
if (pending)
|
|
764
|
+
emitMessageUpsert(ctx, pending.messages, pending);
|
|
765
|
+
};
|
|
576
766
|
/**
|
|
577
|
-
* Create
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* exclusively, so a downstream rename surfaces as a `tsc` failure.
|
|
767
|
+
* Create typed single and batch handlers for the bridge. The bridge only uses
|
|
768
|
+
* the batch capability when adjacent messages are already queued, while this
|
|
769
|
+
* layer owns all Baileys-specific translation and EventEmitter aggregation.
|
|
581
770
|
*/
|
|
582
|
-
export const
|
|
583
|
-
const dispatchCtx = {
|
|
584
|
-
|
|
771
|
+
export const makeEventHandlers = (ctx, callbacks) => {
|
|
772
|
+
const dispatchCtx = {
|
|
773
|
+
ctx,
|
|
774
|
+
callbacks,
|
|
775
|
+
historySync: { initialBootstrapComplete: false, recentSyncComplete: false }
|
|
776
|
+
};
|
|
777
|
+
const onEvent = (event) => {
|
|
585
778
|
const canonical = adaptBridgeEvent(event, ctx.logger);
|
|
586
|
-
if (
|
|
779
|
+
if (canonical)
|
|
780
|
+
dispatchCanonicalEvent(canonical, dispatchCtx);
|
|
781
|
+
};
|
|
782
|
+
const onEventBatch = (events) => {
|
|
783
|
+
dispatchCanonicalBatch(ctx, dispatchCtx, events.length, index => adaptBridgeEvent(events[index], ctx.logger));
|
|
784
|
+
};
|
|
785
|
+
const onMessageBatch = (batch) => {
|
|
786
|
+
if (batch.messageOffsets.length < MESSAGE_WIRE_OFFSET_SENTINEL_COUNT) {
|
|
787
|
+
ctx.logger.error('message wire batch is missing its leading offset');
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const messageCount = batch.messageOffsets.length - MESSAGE_WIRE_OFFSET_SENTINEL_COUNT;
|
|
791
|
+
if (batch.infos.length !== messageCount) {
|
|
792
|
+
ctx.logger.error({ infoCount: batch.infos.length, messageCount }, 'message wire batch metadata count does not match its payload count');
|
|
587
793
|
return;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
// only because TS can't follow the discriminator across the
|
|
591
|
-
// indexed-access into the mapped type.
|
|
592
|
-
const dispatcher = DISPATCHERS[canonical.type];
|
|
794
|
+
}
|
|
795
|
+
let messages;
|
|
593
796
|
try {
|
|
594
|
-
|
|
797
|
+
messages = decodeProtoBatch(MESSAGE_PROTO_TYPE, batch.messageData, batch.messageOffsets);
|
|
595
798
|
}
|
|
596
799
|
catch (err) {
|
|
597
|
-
|
|
598
|
-
|
|
800
|
+
ctx.logger.error({ err }, 'failed to decode message wire batch');
|
|
801
|
+
return;
|
|
599
802
|
}
|
|
803
|
+
dispatchCanonicalBatch(ctx, dispatchCtx, messageCount, index => adaptBridgeMessageWire(messages[index], batch.infos[index], ctx.logger));
|
|
804
|
+
};
|
|
805
|
+
const onHistorySyncBatch = (batch) => {
|
|
806
|
+
const decoded = decodeHistorySyncWireBatch(batch, ctx.logger);
|
|
807
|
+
onEvent(decoded.event);
|
|
808
|
+
return decoded.skippedConversations;
|
|
809
|
+
};
|
|
810
|
+
return {
|
|
811
|
+
onEvent,
|
|
812
|
+
onEventBatch,
|
|
813
|
+
onMessageBatch,
|
|
814
|
+
onHistorySyncBatch,
|
|
815
|
+
historySyncConversationTypes: CONVERSATION_HISTORY_SYNC_TYPES
|
|
600
816
|
};
|
|
601
817
|
};
|
|
818
|
+
/** Legacy single-event helper retained for direct consumers and tests. */
|
|
819
|
+
export const makeEventHandler = (ctx, callbacks) => makeEventHandlers(ctx, callbacks).onEvent;
|
|
602
820
|
//# sourceMappingURL=events.js.map
|