@oxidezap/baileyrs 0.0.26 → 0.0.28
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/README.md +31 -460
- 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 +61 -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 +282 -57
- 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 +33 -15
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Bridge/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Bridge/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC/F,cAAc,YAAY,CAAA;AAC1B,OAAO,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,MAAM,iBAAiB,CAAA"}
|
package/lib/Bridge/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* exclusively — see `Socket/events.ts` for the bridge-canonical-Baileys
|
|
7
7
|
* three-stage pipeline.
|
|
8
8
|
*/
|
|
9
|
-
export { adaptBridgeEvent, KNOWN_BRIDGE_EVENT_TYPES } from
|
|
10
|
-
export * from
|
|
11
|
-
export { asBool, asBoolOr, asJidString, asNumber, asString, bridgeJidToString, isBridgeJid, isObject, normalizeDiscriminator, toUnixSeconds } from
|
|
9
|
+
export { adaptBridgeEvent, adaptBridgeMessageWire, KNOWN_BRIDGE_EVENT_TYPES } from './adapt.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
export { asBool, asBoolOr, asJidString, asNumber, asString, bridgeJidToString, isBridgeJid, isObject, normalizeDiscriminator, toUnixSeconds } from './primitives.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/lib/Bridge/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Bridge/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Bridge/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC/F,cAAc,YAAY,CAAA;AAC1B,OAAO,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,MAAM,iBAAiB,CAAA"}
|
|
@@ -41,6 +41,10 @@ export declare const asBridgeJid: (x: unknown) => BridgeJid | undefined;
|
|
|
41
41
|
export declare const bridgeJidToString: (j: BridgeJid) => string;
|
|
42
42
|
/** Combined: validate & stringify in one step. Returns `undefined` on invalid input. */
|
|
43
43
|
export declare const asJidString: (x: unknown) => string | undefined;
|
|
44
|
+
/** Preserve the addressable-device portion when a JID is used for signaling. */
|
|
45
|
+
export declare const bridgeJidToAddressString: (j: BridgeJid) => string;
|
|
46
|
+
/** Validate and stringify a signaling JID without discarding its device. */
|
|
47
|
+
export declare const asJidAddressString: (x: unknown) => string | undefined;
|
|
44
48
|
/**
|
|
45
49
|
* Coerce a timestamp value into unix seconds. Accepts both numbers and ISO
|
|
46
50
|
* strings — the bridge serializes `DateTime<Utc>` as ISO unless explicitly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/Bridge/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/Bridge/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,MAAO,OAAO,KAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACR,CAAA;AAEzD,6EAA6E;AAC7E,eAAO,MAAM,QAAQ,MAAO,OAAO,KAAG,MAAM,GAAG,SAAoD,CAAA;AAEnG,iEAAiE;AACjE,eAAO,MAAM,QAAQ,MAAO,OAAO,KAAG,MAAM,GAAG,SACa,CAAA;AAE5D,wEAAwE;AACxE,eAAO,MAAM,MAAM,MAAO,OAAO,KAAG,OAAO,GAAG,SAAqD,CAAA;AAEnG,0EAA0E;AAC1E,eAAO,MAAM,QAAQ,MAAO,OAAO,YAAY,OAAO,KAAG,OAAgC,CAAA;AAEzF;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qEAAqE;AACrE,eAAO,MAAM,WAAW,MAAO,OAAO,KAAG,CAAC,IAAI,SAC4B,CAAA;AAE1E,sFAAsF;AACtF,eAAO,MAAM,WAAW,MAAO,OAAO,KAAG,SAAS,GAAG,SAA6C,CAAA;AAElG,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,MAAO,SAAS,KAAG,MAAiC,CAAA;AAElF,wFAAwF;AACxF,eAAO,MAAM,WAAW,MAAO,OAAO,KAAG,MAAM,GAAG,SAGjD,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,MAAO,SAAS,KAAG,MAOvD,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,MAAO,OAAO,KAAG,MAAM,GAAG,SAGxD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,MAO5C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,MAAO,OAAO,KAAG,MAAM,GAAG,SAG5D,CAAA"}
|
package/lib/Bridge/primitives.js
CHANGED
|
@@ -31,6 +31,20 @@ export const asJidString = (x) => {
|
|
|
31
31
|
const j = asBridgeJid(x);
|
|
32
32
|
return j ? bridgeJidToString(j) : undefined;
|
|
33
33
|
};
|
|
34
|
+
/** Preserve the addressable-device portion when a JID is used for signaling. */
|
|
35
|
+
export const bridgeJidToAddressString = (j) => {
|
|
36
|
+
if (!j.user)
|
|
37
|
+
return j.server;
|
|
38
|
+
const rendersAgent = j.server !== 's.whatsapp.net' && j.server !== 'lid' && j.server !== 'hosted' && j.server !== 'hosted.lid';
|
|
39
|
+
const agent = rendersAgent && Number.isInteger(j.agent) && (j.agent ?? 0) > 0 ? `.${j.agent}` : '';
|
|
40
|
+
const device = Number.isInteger(j.device) && (j.device ?? 0) > 0 ? `:${j.device}` : '';
|
|
41
|
+
return `${j.user}${agent}${device}@${j.server}`;
|
|
42
|
+
};
|
|
43
|
+
/** Validate and stringify a signaling JID without discarding its device. */
|
|
44
|
+
export const asJidAddressString = (x) => {
|
|
45
|
+
const j = asBridgeJid(x);
|
|
46
|
+
return j ? bridgeJidToAddressString(j) : undefined;
|
|
47
|
+
};
|
|
34
48
|
/**
|
|
35
49
|
* Coerce a timestamp value into unix seconds. Accepts both numbers and ISO
|
|
36
50
|
* strings — the bridge serializes `DateTime<Utc>` as ISO unless explicitly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/Bridge/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CACpE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAEzD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AAEnG,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAsB,EAAE,CAC1D,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAE5D,wEAAwE;AACxE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAuB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AAEnG,0EAA0E;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,QAAiB,EAAW,EAAE,CAAC,MA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,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACrB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACvC,CAAC,CAAA"}
|
package/lib/Bridge/schema.d.ts
CHANGED
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
* `asNumber`, `asString`) at those leak points only — not boilerplate
|
|
23
23
|
* everywhere.
|
|
24
24
|
*/
|
|
25
|
-
import type { WhatsAppEvent } from 'whatsapp-rust-bridge';
|
|
25
|
+
import type { MessageWireInfo, WhatsAppEvent } from 'whatsapp-rust-bridge';
|
|
26
26
|
import type { ILogger } from '../Utils/logger.js';
|
|
27
|
-
import type { CanonicalEvent } from './types.js';
|
|
27
|
+
import type { CanonicalEvent, CanonicalMessage } from './types.js';
|
|
28
28
|
export type BridgeEventType = WhatsAppEvent['type'];
|
|
29
29
|
/** Set of bridge event types we explicitly handle — derived from the table. */
|
|
30
30
|
export declare const KNOWN_BRIDGE_EVENT_TYPES: ReadonlySet<string>;
|
|
@@ -33,4 +33,11 @@ export declare const KNOWN_BRIDGE_EVENT_TYPES: ReadonlySet<string>;
|
|
|
33
33
|
* Mirrors the previous `adaptBridgeEvent` API exactly.
|
|
34
34
|
*/
|
|
35
35
|
export declare const adaptBridgeEventViaSchema: (event: WhatsAppEvent, logger?: ILogger) => CanonicalEvent | null;
|
|
36
|
+
/**
|
|
37
|
+
* Adapt the protobuf-wire capability without manufacturing a synthetic bridge
|
|
38
|
+
* event object. Both message transports converge on the same validated mapping
|
|
39
|
+
* below, so metadata semantics cannot drift between the compatibility and hot
|
|
40
|
+
* paths.
|
|
41
|
+
*/
|
|
42
|
+
export declare const adaptBridgeMessageWire: (messageProto: unknown, info: MessageWireInfo, logger?: ILogger) => CanonicalMessage | null;
|
|
36
43
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/Bridge/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/Bridge/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAGjD,OAAO,KAAK,EAGX,cAAc,EAGd,gBAAgB,EAEhB,MAAM,YAAY,CAAA;AAgBnB,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AA+enD,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAAkC,CAAA;AAE3F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,UAAW,aAAa,WAAW,OAAO,KAAG,cAAc,GAAG,IAUnG,CAAA;AAeD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,iBACpB,OAAO,QACf,eAAe,WACZ,OAAO,KACd,gBAAgB,GAAG,IA8BrB,CAAA"}
|
package/lib/Bridge/schema.js
CHANGED
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
* `asNumber`, `asString`) at those leak points only — not boilerplate
|
|
23
23
|
* everywhere.
|
|
24
24
|
*/
|
|
25
|
-
import { processHistoryMessage } from
|
|
26
|
-
import {
|
|
25
|
+
import { processHistoryMessage } from '../Utils/process-history-message.js';
|
|
26
|
+
import { isJidGroup } from '../WABinary/jid-utils.js';
|
|
27
|
+
import { asBoolOr, asJidAddressString, asJidString, asNumber, asString, isObject, normalizeDiscriminator, toUnixSeconds } from './primitives.js';
|
|
27
28
|
/**
|
|
28
29
|
* Bridge sync-action events (`pin_update`, `mute_update`, etc.) carry the
|
|
29
30
|
* proto action under `data.action`, but the bridge `.d.ts` types it as
|
|
@@ -31,6 +32,22 @@ import { asBoolOr, asJidString, asNumber, asString, bridgeJidToString, isBridgeJ
|
|
|
31
32
|
* once at the call site.
|
|
32
33
|
*/
|
|
33
34
|
const extractAction = (data) => isObject(data.action) ? data.action : undefined;
|
|
35
|
+
/** A group JID is authoritative when an older producer leaves `is_group` false. */
|
|
36
|
+
const resolveIsGroup = (wireValue, chatJid) => asBoolOr(wireValue, false) || isJidGroup(chatJid) === true;
|
|
37
|
+
const resolveParticipantAlt = (senderAlt, isGroup) => isGroup ? senderAlt : undefined;
|
|
38
|
+
const resolveRemoteJidAlt = (senderAlt, recipientAlt, isGroup, isFromMe) => (isGroup ? undefined : isFromMe ? recipientAlt : senderAlt);
|
|
39
|
+
const parseEditAttribute = (value) => {
|
|
40
|
+
switch (value) {
|
|
41
|
+
case '1':
|
|
42
|
+
case '2':
|
|
43
|
+
case '3':
|
|
44
|
+
case '7':
|
|
45
|
+
case '8':
|
|
46
|
+
return value;
|
|
47
|
+
default:
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
34
51
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
35
52
|
// Per-event adapters — the bulk of the file. One entry per WhatsAppEvent variant.
|
|
36
53
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -53,6 +70,22 @@ const ADAPTERS = {
|
|
|
53
70
|
}),
|
|
54
71
|
qr: data => (data.code ? { type: 'qr', code: data.code } : null),
|
|
55
72
|
pairing_code: data => (data.code ? { type: 'qr', code: data.code } : null),
|
|
73
|
+
pairing_code_refresh: data => ({
|
|
74
|
+
type: 'noop',
|
|
75
|
+
bridgeType: 'pairing_code_refresh',
|
|
76
|
+
detail: data.force_manual ? 'force_manual' : 'automatic'
|
|
77
|
+
}),
|
|
78
|
+
pair_passkey_request: () => ({ type: 'noop', bridgeType: 'pair_passkey_request' }),
|
|
79
|
+
pair_passkey_confirmation: data => ({
|
|
80
|
+
type: 'noop',
|
|
81
|
+
bridgeType: 'pair_passkey_confirmation',
|
|
82
|
+
detail: data.skip_handoff_ux ? 'handoff_verified' : 'confirmation_required'
|
|
83
|
+
}),
|
|
84
|
+
pair_passkey_error: data => ({
|
|
85
|
+
type: 'noop',
|
|
86
|
+
bridgeType: 'pair_passkey_error',
|
|
87
|
+
detail: asString(data.error)
|
|
88
|
+
}),
|
|
56
89
|
pair_success: data => {
|
|
57
90
|
// `id` and `lid` come typed as `Jid` in the bridge .d.ts, but the
|
|
58
91
|
// bridge actually serializes pair_success.{id,lid} as strings (see
|
|
@@ -83,6 +116,23 @@ const ADAPTERS = {
|
|
|
83
116
|
// ── Messages ──
|
|
84
117
|
message: (data, logger) => adaptMessage(data, logger),
|
|
85
118
|
receipt: (data, logger) => adaptReceipt(data, logger),
|
|
119
|
+
// Upstream consumes message ACKs internally through
|
|
120
|
+
// `CB:ack,class:message`: successful ACKs stay off the public event bus,
|
|
121
|
+
// while NACKs become `messages.update` with status ERROR. Preserve every
|
|
122
|
+
// typed field here so the dispatcher can reproduce both surfaces.
|
|
123
|
+
server_ack: data => {
|
|
124
|
+
const id = asString(data.id);
|
|
125
|
+
if (!id)
|
|
126
|
+
return null;
|
|
127
|
+
return {
|
|
128
|
+
type: 'serverAck',
|
|
129
|
+
id,
|
|
130
|
+
class: asString(data.class),
|
|
131
|
+
from: asJidString(data.from),
|
|
132
|
+
timestamp: asNumber(data.timestamp),
|
|
133
|
+
error: asString(data.error)
|
|
134
|
+
};
|
|
135
|
+
},
|
|
86
136
|
undecryptable_message: data => {
|
|
87
137
|
// Bridge ships `{ info: MessageInfo, is_unavailable, unavailable_type,
|
|
88
138
|
// decrypt_fail_mode }` — same MessageInfo shape as the regular
|
|
@@ -99,20 +149,21 @@ const ADAPTERS = {
|
|
|
99
149
|
const id = asString(info.id);
|
|
100
150
|
if (!src || !chat || !id)
|
|
101
151
|
return null;
|
|
102
|
-
const isGroup =
|
|
103
|
-
const
|
|
104
|
-
const
|
|
152
|
+
const isGroup = resolveIsGroup(src.is_group, chat);
|
|
153
|
+
const isFromMe = asBoolOr(src.is_from_me, false);
|
|
154
|
+
const senderAlt = asJidString(src.sender_alt);
|
|
155
|
+
const recipientAlt = asJidString(src.recipient_alt);
|
|
105
156
|
return {
|
|
106
157
|
type: 'undecryptableMessage',
|
|
107
158
|
chatJid: chat,
|
|
108
159
|
senderJid: isGroup ? asJidString(src.sender) : undefined,
|
|
109
160
|
id,
|
|
110
161
|
timestamp: toUnixSeconds(info.timestamp),
|
|
111
|
-
isFromMe
|
|
162
|
+
isFromMe,
|
|
112
163
|
isGroup,
|
|
113
164
|
pushName: asString(info.push_name),
|
|
114
|
-
participantAlt,
|
|
115
|
-
remoteJidAlt,
|
|
165
|
+
participantAlt: resolveParticipantAlt(senderAlt, isGroup),
|
|
166
|
+
remoteJidAlt: resolveRemoteJidAlt(senderAlt, recipientAlt, isGroup, isFromMe),
|
|
116
167
|
isUnavailable: asBoolOr(data.is_unavailable, false),
|
|
117
168
|
unavailableType: asString(data.unavailable_type),
|
|
118
169
|
decryptFailMode: asString(data.decrypt_fail_mode),
|
|
@@ -215,8 +266,59 @@ const ADAPTERS = {
|
|
|
215
266
|
return null;
|
|
216
267
|
return { type: 'markChatAsReadUpdate', jid, read: asBoolOr(extractAction(data)?.read, true) };
|
|
217
268
|
},
|
|
269
|
+
label_edit_update: data => {
|
|
270
|
+
const labelId = asString(data.label_id);
|
|
271
|
+
if (!labelId)
|
|
272
|
+
return { type: 'noop', bridgeType: 'label_edit_update' };
|
|
273
|
+
const action = extractAction(data);
|
|
274
|
+
// `predefinedId` is proto `predefined_id` (a number); upstream `Label`
|
|
275
|
+
// wants it as a string. Dual-read the spelling, then stringify.
|
|
276
|
+
const predefined = asNumber(action?.predefinedId) ?? asNumber(action?.predefined_id);
|
|
277
|
+
return {
|
|
278
|
+
type: 'labelEdit',
|
|
279
|
+
labelId,
|
|
280
|
+
name: asString(action?.name) ?? '',
|
|
281
|
+
color: asNumber(action?.color) ?? 0,
|
|
282
|
+
deleted: asBoolOr(action?.deleted, false),
|
|
283
|
+
predefinedId: predefined != null ? String(predefined) : undefined
|
|
284
|
+
};
|
|
285
|
+
},
|
|
286
|
+
label_association_update: data => {
|
|
287
|
+
const labelId = asString(data.label_id);
|
|
288
|
+
const chatJid = asJidString(data.chat_jid);
|
|
289
|
+
if (!labelId || !chatJid)
|
|
290
|
+
return { type: 'noop', bridgeType: 'label_association_update' };
|
|
291
|
+
// `action.labeled === true` → label added to the chat, else removed.
|
|
292
|
+
return { type: 'labelAssociation', labelId, chatJid, labeled: asBoolOr(extractAction(data)?.labeled, true) };
|
|
293
|
+
},
|
|
218
294
|
// ── Calls ──
|
|
219
295
|
incoming_call: (data, logger) => adaptIncomingCall(data, logger),
|
|
296
|
+
missed_call: data => {
|
|
297
|
+
const from = asJidString(data.from);
|
|
298
|
+
const callId = asString(data.call_id);
|
|
299
|
+
if (!from || !callId)
|
|
300
|
+
return null;
|
|
301
|
+
return {
|
|
302
|
+
type: 'incomingCall',
|
|
303
|
+
from,
|
|
304
|
+
timestamp: toUnixSeconds(data.timestamp),
|
|
305
|
+
offline: data.reason === 'offline',
|
|
306
|
+
action: { type: 'timeout', callId }
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
call_ended_elsewhere: data => {
|
|
310
|
+
const from = asJidString(data.from);
|
|
311
|
+
const callId = asString(data.call_id);
|
|
312
|
+
if (!from || !callId)
|
|
313
|
+
return null;
|
|
314
|
+
return {
|
|
315
|
+
type: 'incomingCall',
|
|
316
|
+
from,
|
|
317
|
+
timestamp: toUnixSeconds(data.timestamp),
|
|
318
|
+
offline: false,
|
|
319
|
+
action: { type: data.outcome === 'accepted' ? 'accept' : 'reject', callId }
|
|
320
|
+
};
|
|
321
|
+
},
|
|
220
322
|
// ── History sync — fully decoded by the bridge, normalized 1:1 with upstream ──
|
|
221
323
|
history_sync: data => {
|
|
222
324
|
// `data` is `proto.IHistorySync & { syncType, chunkOrder?, progress? }` —
|
|
@@ -236,22 +338,38 @@ const ADAPTERS = {
|
|
|
236
338
|
const metaChunkOrder = asNumber(overlay.chunkOrder);
|
|
237
339
|
const metaProgress = asNumber(overlay.progress);
|
|
238
340
|
const peerDataRequestSessionId = asString(overlay.peerDataRequestSessionId);
|
|
341
|
+
// Batch markers (the bridge splits a chunk into bounded sub-batches).
|
|
342
|
+
// Absent on a non-batched bridge → treat as a single final batch.
|
|
343
|
+
const batchIndex = asNumber(overlay.batchIndex);
|
|
344
|
+
const isFinalBatch = overlay.isFinalBatch !== false;
|
|
239
345
|
return {
|
|
240
346
|
type: 'historySync',
|
|
241
347
|
chats: processed.chats,
|
|
242
348
|
contacts: processed.contacts,
|
|
243
349
|
messages: processed.messages,
|
|
244
350
|
lidPnMappings: processed.lidPnMappings,
|
|
245
|
-
syncType: metaSyncType ?? processed.syncType,
|
|
246
|
-
progress: metaProgress ?? processed.progress,
|
|
351
|
+
syncType: metaSyncType ?? processed.syncType ?? undefined,
|
|
352
|
+
progress: metaProgress ?? processed.progress ?? undefined,
|
|
353
|
+
pastParticipants: processed.pastParticipants,
|
|
247
354
|
chunkOrder: metaChunkOrder,
|
|
248
|
-
peerDataRequestSessionId
|
|
355
|
+
peerDataRequestSessionId,
|
|
356
|
+
batchIndex,
|
|
357
|
+
isFinalBatch
|
|
249
358
|
};
|
|
250
359
|
},
|
|
251
360
|
// ── Acknowledged but no Baileys equivalent (noop) ──
|
|
252
361
|
self_push_name_updated: () => ({ type: 'noop', bridgeType: 'self_push_name_updated' }),
|
|
253
|
-
offline_sync_completed:
|
|
362
|
+
offline_sync_completed: data => ({
|
|
363
|
+
type: 'offlineSyncCompleted',
|
|
364
|
+
count: asNumber(data.count) ?? 0
|
|
365
|
+
}),
|
|
254
366
|
offline_sync_preview: () => ({ type: 'noop', bridgeType: 'offline_sync_preview' }),
|
|
367
|
+
dirty_state: data => {
|
|
368
|
+
const dirtyType = asString(data.dirty_type);
|
|
369
|
+
if (!dirtyType)
|
|
370
|
+
return null;
|
|
371
|
+
return { type: 'dirtyState', dirtyType, timestamp: asNumber(data.timestamp) };
|
|
372
|
+
},
|
|
255
373
|
device_list_update: () => ({ type: 'noop', bridgeType: 'device_list_update' }),
|
|
256
374
|
identity_change: () => ({ type: 'noop', bridgeType: 'identity_change' }),
|
|
257
375
|
disappearing_mode_changed: data => {
|
|
@@ -323,6 +441,16 @@ const ADAPTERS = {
|
|
|
323
441
|
const jid = asJidString(data.jid);
|
|
324
442
|
return jid ? { type: 'chatDelete', jid } : { type: 'noop', bridgeType: 'delete_chat_update' };
|
|
325
443
|
},
|
|
444
|
+
clear_chat_update: data => {
|
|
445
|
+
// Clear = drop all messages but keep the chat. Maps to upstream
|
|
446
|
+
// `messages.delete` `{ jid, all: true }` (the chat-clear surface noted in
|
|
447
|
+
// the messageDelete dispatcher), distinct from chatDelete (whole chat gone).
|
|
448
|
+
const jid = asJidString(data.jid);
|
|
449
|
+
return jid ? { type: 'chatClear', jid } : { type: 'noop', bridgeType: 'clear_chat_update' };
|
|
450
|
+
},
|
|
451
|
+
// Muting a contact's status (stories) updates. Forwarded for surface completeness,
|
|
452
|
+
// but noop'd: upstream Baileys has no status-mute event/chatModify to map it onto.
|
|
453
|
+
user_status_mute_update: () => ({ type: 'noop', bridgeType: 'user_status_mute_update' }),
|
|
326
454
|
delete_message_for_me_update: data => {
|
|
327
455
|
const chatJid = asJidString(data.chat_jid);
|
|
328
456
|
const messageId = asString(data.message_id);
|
|
@@ -408,6 +536,46 @@ const adaptMessage = (data, logger) => {
|
|
|
408
536
|
const messageProto = isObject(data.message) ? data.message : undefined;
|
|
409
537
|
if (!info || !messageProto)
|
|
410
538
|
return null;
|
|
539
|
+
return adaptMessageParts(info, messageProto, logger);
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Adapt the protobuf-wire capability without manufacturing a synthetic bridge
|
|
543
|
+
* event object. Both message transports converge on the same validated mapping
|
|
544
|
+
* below, so metadata semantics cannot drift between the compatibility and hot
|
|
545
|
+
* paths.
|
|
546
|
+
*/
|
|
547
|
+
export const adaptBridgeMessageWire = (messageProto, info, logger) => {
|
|
548
|
+
if (!isObject(messageProto))
|
|
549
|
+
return null;
|
|
550
|
+
const chat = asString(info.chat);
|
|
551
|
+
const id = asString(info.id);
|
|
552
|
+
if (!chat || !id) {
|
|
553
|
+
logger?.debug({ info }, 'message wire adapter: missing chat/id');
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
const isGroup = resolveIsGroup(info.isGroup, chat);
|
|
557
|
+
const isFromMe = asBoolOr(info.isFromMe, false);
|
|
558
|
+
const senderAlt = asString(info.senderAlt);
|
|
559
|
+
const recipientAlt = asString(info.recipientAlt);
|
|
560
|
+
return {
|
|
561
|
+
type: 'message',
|
|
562
|
+
chatJid: chat,
|
|
563
|
+
senderJid: isGroup ? asString(info.sender) : undefined,
|
|
564
|
+
isGroup,
|
|
565
|
+
isFromMe,
|
|
566
|
+
id,
|
|
567
|
+
timestamp: asNumber(info.timestamp) ?? 0,
|
|
568
|
+
pushName: asString(info.pushName),
|
|
569
|
+
participantAlt: resolveParticipantAlt(senderAlt, isGroup),
|
|
570
|
+
remoteJidAlt: resolveRemoteJidAlt(senderAlt, recipientAlt, isGroup, isFromMe),
|
|
571
|
+
isViewOnce: info.isViewOnce === true ? true : undefined,
|
|
572
|
+
isOffline: info.isOffline === true ? true : undefined,
|
|
573
|
+
unavailableRequestId: asString(info.unavailableRequestId),
|
|
574
|
+
editAttribute: parseEditAttribute(info.edit),
|
|
575
|
+
messageProto: messageProto
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
const adaptMessageParts = (info, messageProto, logger) => {
|
|
411
579
|
const src = isObject(info.source) ? info.source : undefined;
|
|
412
580
|
const chat = src && asJidString(src.chat);
|
|
413
581
|
const id = asString(info.id);
|
|
@@ -415,37 +583,27 @@ const adaptMessage = (data, logger) => {
|
|
|
415
583
|
logger?.debug({ info }, 'message adapter: missing chat/id');
|
|
416
584
|
return null;
|
|
417
585
|
}
|
|
418
|
-
const isGroup =
|
|
586
|
+
const isGroup = resolveIsGroup(src.is_group, chat);
|
|
587
|
+
const isFromMe = asBoolOr(src.is_from_me, false);
|
|
419
588
|
const senderRaw = src.sender;
|
|
420
589
|
const senderJid = isGroup ? asJidString(senderRaw) : undefined;
|
|
421
|
-
const
|
|
422
|
-
const
|
|
423
|
-
// Bridge `EditAttribute` is one of "1"|"2"|"3"|"7"|"8" or "" (none) — narrow
|
|
424
|
-
// to the literal set so consumers can switch exhaustively without
|
|
425
|
-
// re-parsing.
|
|
426
|
-
const editAttributeRaw = asString(info.edit);
|
|
427
|
-
const editAttribute = editAttributeRaw === '1' ||
|
|
428
|
-
editAttributeRaw === '2' ||
|
|
429
|
-
editAttributeRaw === '3' ||
|
|
430
|
-
editAttributeRaw === '7' ||
|
|
431
|
-
editAttributeRaw === '8'
|
|
432
|
-
? editAttributeRaw
|
|
433
|
-
: undefined;
|
|
590
|
+
const senderAlt = asJidString(src.sender_alt);
|
|
591
|
+
const recipientAlt = asJidString(src.recipient_alt);
|
|
434
592
|
return {
|
|
435
593
|
type: 'message',
|
|
436
594
|
chatJid: chat,
|
|
437
595
|
senderJid,
|
|
438
596
|
isGroup,
|
|
439
|
-
isFromMe
|
|
597
|
+
isFromMe,
|
|
440
598
|
id,
|
|
441
599
|
timestamp: toUnixSeconds(info.timestamp),
|
|
442
600
|
pushName: asString(info.push_name),
|
|
443
|
-
participantAlt,
|
|
444
|
-
remoteJidAlt,
|
|
601
|
+
participantAlt: resolveParticipantAlt(senderAlt, isGroup),
|
|
602
|
+
remoteJidAlt: resolveRemoteJidAlt(senderAlt, recipientAlt, isGroup, isFromMe),
|
|
445
603
|
isViewOnce: info.is_view_once === true ? true : undefined,
|
|
446
604
|
isOffline: asBoolOr(info.is_offline, false) ? true : undefined,
|
|
447
605
|
unavailableRequestId: asString(info.unavailable_request_id),
|
|
448
|
-
editAttribute,
|
|
606
|
+
editAttribute: parseEditAttribute(info.edit),
|
|
449
607
|
messageProto: messageProto
|
|
450
608
|
};
|
|
451
609
|
};
|
|
@@ -461,7 +619,7 @@ const adaptReceipt = (data, logger) => {
|
|
|
461
619
|
logger?.debug({ data }, 'receipt adapter: missing chat or message_ids');
|
|
462
620
|
return null;
|
|
463
621
|
}
|
|
464
|
-
const isGroup =
|
|
622
|
+
const isGroup = resolveIsGroup(src.is_group, chat);
|
|
465
623
|
return {
|
|
466
624
|
type: 'receipt',
|
|
467
625
|
chatJid: chat,
|
|
@@ -502,6 +660,7 @@ const adaptContactUpdate = (data) => {
|
|
|
502
660
|
*/
|
|
503
661
|
const RECEIPT_TYPE_MAP = {
|
|
504
662
|
Delivered: 'delivered',
|
|
663
|
+
Sent: 'sent',
|
|
505
664
|
Sender: 'sender',
|
|
506
665
|
Retry: 'retry',
|
|
507
666
|
EncRekeyRetry: 'enc-rekey-retry',
|
|
@@ -514,6 +673,7 @@ const RECEIPT_TYPE_MAP = {
|
|
|
514
673
|
HistorySync: 'history-sync',
|
|
515
674
|
ServerError: 'server-error',
|
|
516
675
|
delivered: 'delivered',
|
|
676
|
+
sent: 'sent',
|
|
517
677
|
sender: 'sender',
|
|
518
678
|
retry: 'retry',
|
|
519
679
|
enc_rekey_retry: 'enc-rekey-retry',
|
|
@@ -564,7 +724,11 @@ const adaptIncomingCall = (data, logger) => {
|
|
|
564
724
|
logger?.debug({ data }, 'incoming_call adapter: missing action.type/call_id');
|
|
565
725
|
return null;
|
|
566
726
|
}
|
|
567
|
-
const canonicalAction = {
|
|
727
|
+
const canonicalAction = {
|
|
728
|
+
type: actionType,
|
|
729
|
+
callId,
|
|
730
|
+
callCreator: asJidAddressString(action.call_creator)
|
|
731
|
+
};
|
|
568
732
|
// The bridge `CallAction` union narrows variant-specific fields only
|
|
569
733
|
// on the matching variant. We've already validated `action.type` via
|
|
570
734
|
// `parseCallActionType`, so a runtime cast through the action's own
|
|
@@ -588,7 +752,7 @@ const adaptIncomingCall = (data, logger) => {
|
|
|
588
752
|
}
|
|
589
753
|
return {
|
|
590
754
|
type: 'incomingCall',
|
|
591
|
-
from,
|
|
755
|
+
from: asJidAddressString(data.from) ?? from,
|
|
592
756
|
timestamp: toUnixSeconds(data.timestamp),
|
|
593
757
|
offline: asBoolOr(data.offline, false),
|
|
594
758
|
stanzaId: asString(data.stanza_id),
|
|
@@ -605,7 +769,12 @@ const parseCallActionType = (raw) => {
|
|
|
605
769
|
return 'offer';
|
|
606
770
|
case 'pre_accept':
|
|
607
771
|
case 'preaccept':
|
|
608
|
-
return '
|
|
772
|
+
return 'preaccept';
|
|
773
|
+
case 'transport':
|
|
774
|
+
return 'transport';
|
|
775
|
+
case 'relay_latency':
|
|
776
|
+
case 'relaylatency':
|
|
777
|
+
return 'relaylatency';
|
|
609
778
|
case 'accept':
|
|
610
779
|
return 'accept';
|
|
611
780
|
case 'reject':
|
|
@@ -623,7 +792,24 @@ const adaptGroupParticipant = (raw) => {
|
|
|
623
792
|
const jid = asJidString(raw.jid);
|
|
624
793
|
if (!jid)
|
|
625
794
|
return null;
|
|
626
|
-
|
|
795
|
+
const rawRole = asString(raw.type);
|
|
796
|
+
const role = rawRole === 'participant' || rawRole === 'admin' || rawRole === 'superadmin' ? rawRole : undefined;
|
|
797
|
+
const participant = { jid, phoneNumber: asJidString(raw.phone_number) };
|
|
798
|
+
const lid = asJidString(raw.lid);
|
|
799
|
+
const username = asString(raw.username);
|
|
800
|
+
const displayName = asString(raw.display_name);
|
|
801
|
+
const joinTime = asNumber(raw.join_time);
|
|
802
|
+
if (lid)
|
|
803
|
+
participant.lid = lid;
|
|
804
|
+
if (username)
|
|
805
|
+
participant.username = username;
|
|
806
|
+
if (displayName)
|
|
807
|
+
participant.displayName = displayName;
|
|
808
|
+
if (joinTime !== undefined)
|
|
809
|
+
participant.joinTime = joinTime;
|
|
810
|
+
if (role)
|
|
811
|
+
participant.role = role;
|
|
812
|
+
return participant;
|
|
627
813
|
};
|
|
628
814
|
const adaptGroupParticipants = (raw) => {
|
|
629
815
|
if (!Array.isArray(raw))
|
|
@@ -708,6 +894,44 @@ const adaptGroupAction = (raw) => {
|
|
|
708
894
|
unlinkType: asString(raw.unlink_type) ?? '',
|
|
709
895
|
unlinkReason: asString(raw.unlink_reason)
|
|
710
896
|
};
|
|
897
|
+
case 'linked_group_promote':
|
|
898
|
+
return { type: 'linkedGroupPromote', participants: adaptGroupParticipants(raw.participants) };
|
|
899
|
+
case 'linked_group_demote':
|
|
900
|
+
return { type: 'linkedGroupDemote', participants: adaptGroupParticipants(raw.participants) };
|
|
901
|
+
case 'suspended':
|
|
902
|
+
return { type: 'suspended' };
|
|
903
|
+
case 'unsuspended':
|
|
904
|
+
return { type: 'unsuspended' };
|
|
905
|
+
case 'auto_add_disabled':
|
|
906
|
+
return { type: 'autoAddDisabled' };
|
|
907
|
+
case 'is_capi_hosted_group':
|
|
908
|
+
return { type: 'capiHostedGroup' };
|
|
909
|
+
case 'group_safety_check':
|
|
910
|
+
return { type: 'groupSafetyCheck' };
|
|
911
|
+
case 'limit_sharing_enabled':
|
|
912
|
+
return { type: 'limitSharingEnabled', trigger: asNumber(raw.trigger) };
|
|
913
|
+
case 'allow_admin_reports':
|
|
914
|
+
return { type: 'allowAdminReports' };
|
|
915
|
+
case 'not_allow_admin_reports':
|
|
916
|
+
return { type: 'notAllowAdminReports' };
|
|
917
|
+
case 'reports':
|
|
918
|
+
return { type: 'reports' };
|
|
919
|
+
case 'allow_non_admin_sub_group_creation':
|
|
920
|
+
return { type: 'allowNonAdminSubGroupCreation' };
|
|
921
|
+
case 'not_allow_non_admin_sub_group_creation':
|
|
922
|
+
return { type: 'notAllowNonAdminSubGroupCreation' };
|
|
923
|
+
case 'created_sub_group_suggestion':
|
|
924
|
+
return { type: 'createdSubGroupSuggestion' };
|
|
925
|
+
case 'revoked_sub_group_suggestions':
|
|
926
|
+
return { type: 'revokedSubGroupSuggestions' };
|
|
927
|
+
case 'change_number':
|
|
928
|
+
return {
|
|
929
|
+
type: 'changeNumber',
|
|
930
|
+
newOwner: asJidString(raw.new_owner),
|
|
931
|
+
subGroupSuggestions: Array.isArray(raw.sub_group_suggestions)
|
|
932
|
+
? raw.sub_group_suggestions.map(asJidString).filter((jid) => jid !== undefined)
|
|
933
|
+
: []
|
|
934
|
+
};
|
|
711
935
|
case 'growth_locked':
|
|
712
936
|
case 'growthlocked': {
|
|
713
937
|
const expiration = asNumber(raw.expiration);
|
|
@@ -764,8 +988,12 @@ const adaptGroupUpdate = (data, logger) => {
|
|
|
764
988
|
return {
|
|
765
989
|
type: 'groupUpdate',
|
|
766
990
|
groupJid,
|
|
991
|
+
notificationId: asString(data.notification_id),
|
|
992
|
+
actionIndex: asNumber(data.action_index) ?? 0,
|
|
767
993
|
author: asJidString(data.participant),
|
|
768
994
|
authorPn: asJidString(data.participant_pn),
|
|
995
|
+
authorUsername: asString(data.participant_username),
|
|
996
|
+
authorCountryCode: asString(data.participant_country_code),
|
|
769
997
|
timestamp: toUnixSeconds(data.timestamp),
|
|
770
998
|
isLidAddressingMode: asBoolOr(data.is_lid_addressing_mode, false),
|
|
771
999
|
action
|