@vinzsocket/baileys 2.8.20 → 2.8.35
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/Defaults/index.js +38 -31
- package/lib/Signal/Group/ciphertext-message.js +9 -2
- package/lib/Signal/Group/group-session-builder.js +15 -7
- package/lib/Signal/Group/group_cipher.js +21 -13
- package/lib/Signal/Group/index.js +79 -12
- package/lib/Signal/Group/keyhelper.js +16 -6
- package/lib/Signal/Group/queue-job.js +9 -2
- package/lib/Signal/Group/sender-chain-key.js +14 -6
- package/lib/Signal/Group/sender-key-distribution-message.js +13 -6
- package/lib/Signal/Group/sender-key-message.js +17 -9
- package/lib/Signal/Group/sender-key-name.js +9 -2
- package/lib/Signal/Group/sender-key-record.js +16 -9
- package/lib/Signal/Group/sender-key-state.js +13 -6
- package/lib/Signal/Group/sender-message-key.js +12 -4
- package/lib/Signal/libsignal.js +35 -26
- package/lib/Signal/lid-mapping.js +27 -19
- package/lib/Socket/Client/index.js +27 -3
- package/lib/Socket/Client/types.js +11 -4
- package/lib/Socket/Client/websocket.js +19 -11
- package/lib/Socket/business.js +41 -34
- package/lib/Socket/chats.js +103 -95
- package/lib/Socket/communities.js +58 -49
- package/lib/Socket/groups.js +59 -51
- package/lib/Socket/index.js +11 -6
- package/lib/Socket/messages-recv.js +153 -145
- package/lib/Socket/messages-send.js +112 -104
- package/lib/Socket/mex.js +15 -8
- package/lib/Socket/newsletter.js +30 -23
- package/lib/Socket/socket.js +112 -105
- package/lib/Store/index.js +49 -4
- package/lib/Store/make-cache-manager-store.js +19 -11
- package/lib/Store/make-in-memory-store.js +38 -29
- package/lib/Store/make-ordered-dictionary.js +9 -2
- package/lib/Store/object-repository.js +9 -2
- package/lib/Types/Auth.js +5 -2
- package/lib/Types/Bussines.js +5 -2
- package/lib/Types/Call.js +5 -2
- package/lib/Types/Chat.js +7 -1
- package/lib/Types/Contact.js +5 -2
- package/lib/Types/Events.js +3 -2
- package/lib/Types/GroupMetadata.js +5 -2
- package/lib/Types/Label.js +8 -2
- package/lib/Types/LabelAssociation.js +8 -2
- package/lib/Types/Message.js +18 -6
- package/lib/Types/Newsletter.js +10 -4
- package/lib/Types/Product.js +5 -2
- package/lib/Types/Signal.js +3 -2
- package/lib/Types/Socket.js +4 -3
- package/lib/Types/State.js +9 -3
- package/lib/Types/USync.js +3 -2
- package/lib/Types/index.js +155 -14
- package/lib/Utils/auth-utils.js +35 -25
- package/lib/Utils/baileys-event-stream.js +24 -15
- package/lib/Utils/business.js +72 -59
- package/lib/Utils/chat-utils.js +94 -77
- package/lib/Utils/crypto.js +55 -30
- package/lib/Utils/decode-wa-message.js +47 -37
- package/lib/Utils/event-buffer.js +25 -17
- package/lib/Utils/extended-messages.js +16 -9
- package/lib/Utils/generics.js +101 -62
- package/lib/Utils/history.js +33 -23
- package/lib/Utils/index.js +236 -22
- package/lib/Utils/lid-resolver.js +14 -5
- package/lib/Utils/link-preview.js +14 -7
- package/lib/Utils/logger.js +10 -4
- package/lib/Utils/lt-hash.js +10 -4
- package/lib/Utils/make-mutex.js +11 -3
- package/lib/Utils/mention.js +14 -4
- package/lib/Utils/message-retry-manager.js +13 -6
- package/lib/Utils/messages-media.js +128 -93
- package/lib/Utils/messages.js +125 -98
- package/lib/Utils/noise-handler.js +28 -21
- package/lib/Utils/process-message.js +74 -63
- package/lib/Utils/signal.js +48 -33
- package/lib/Utils/use-multi-file-auth-state.js +27 -20
- package/lib/Utils/validate-connection.js +57 -47
- package/lib/WABinary/constants.js +10 -4
- package/lib/WABinary/decode.js +20 -10
- package/lib/WABinary/encode.js +12 -4
- package/lib/WABinary/generic-utils.js +32 -15
- package/lib/WABinary/index.js +60 -6
- package/lib/WABinary/jid-utils.js +39 -20
- package/lib/WABinary/types.js +4 -2
- package/lib/WAM/BinaryInfo.js +9 -2
- package/lib/WAM/constants.js +13001 -1
- package/lib/WAM/encode.js +17 -10
- package/lib/WAM/index.js +38 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +12 -5
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +13 -6
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +11 -4
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +11 -4
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +11 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +26 -19
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +9 -2
- package/lib/WAUSync/Protocols/index.js +60 -6
- package/lib/WAUSync/USyncQuery.js +24 -17
- package/lib/WAUSync/USyncUser.js +9 -2
- package/lib/WAUSync/index.js +38 -4
- package/lib/index.js +114 -12
- package/package.json +2 -1
- package/lib/Defaults/index.d.ts +0 -58
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts +0 -15
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts +0 -18
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts +0 -12
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/queue-job.d.ts +0 -2
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts +0 -19
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts +0 -31
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts +0 -39
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts +0 -12
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts +0 -8
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts +0 -30
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js.map +0 -1
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts +0 -16
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts +0 -188
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts +0 -98
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts +0 -233
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts +0 -137
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts +0 -220
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts +0 -173
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts +0 -169
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts +0 -3
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts +0 -147
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts +0 -50
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/make-cache-manager-store.d.ts +0 -17
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -14
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -105
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Bussines.d.ts +0 -25
- package/lib/Types/Bussines.d.ts.map +0 -1
- package/lib/Types/Bussines.js.map +0 -1
- package/lib/Types/Call.d.ts +0 -14
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts +0 -123
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts +0 -24
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts +0 -199
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts +0 -66
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts +0 -47
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts +0 -30
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts +0 -300
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Newsletter.d.ts +0 -135
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Types/Product.d.ts +0 -79
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts +0 -82
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts +0 -130
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts +0 -39
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts +0 -65
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/auth-utils.d.ts +0 -19
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/baileys-event-stream.d.ts +0 -17
- package/lib/Utils/baileys-event-stream.d.ts.map +0 -1
- package/lib/Utils/baileys-event-stream.js.map +0 -1
- package/lib/Utils/business.d.ts +0 -23
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts +0 -46
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts +0 -34
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/extended-messages.d.ts +0 -73
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts +0 -20
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/index.d.ts +0 -22
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/lid-resolver.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -22
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts +0 -12
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts +0 -13
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts +0 -8
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/mention.d.ts +0 -27
- package/lib/Utils/message-retry-manager.d.ts +0 -82
- package/lib/Utils/message-retry-manager.d.ts.map +0 -1
- package/lib/Utils/message-retry-manager.js.map +0 -1
- package/lib/Utils/messages-media.d.ts +0 -113
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts +0 -76
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts +0 -20
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/process-message.d.ts +0 -43
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/signal.d.ts +0 -34
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts +0 -28
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts +0 -15
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts +0 -6
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts +0 -37
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts +0 -19
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts +0 -9
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts +0 -40
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts +0 -4
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -30
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -13
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts +0 -4
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts +0 -13
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/Utils/generics.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bindWaitForConnectionUpdate = exports.BufferJSON = exports.Browsers = void 0;
|
|
7
|
+
exports.bindWaitForEvent = bindWaitForEvent;
|
|
8
|
+
exports.bytesToCrockford = bytesToCrockford;
|
|
9
|
+
exports.encodeBigEndian = exports.delayCancellable = exports.delay = exports.debouncedTimeout = void 0;
|
|
10
|
+
exports.encodeNewsletterMessage = encodeNewsletterMessage;
|
|
11
|
+
exports.isWABusinessPlatform = exports.getStatusFromReceiptType = exports.getPlatformId = exports.getKeyAuthor = exports.getErrorCodeFromStreamError = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.generateRegistrationId = exports.generateMessageIDV2 = exports.generateMessageID = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion = exports.encodeWAMessage = void 0;
|
|
12
|
+
exports.promiseTimeout = promiseTimeout;
|
|
13
|
+
exports.toNumber = void 0;
|
|
14
|
+
exports.trimUndefined = trimUndefined;
|
|
15
|
+
exports.writeRandomPadMax16 = exports.unpadRandomMax16 = exports.unixTimestampSeconds = void 0;
|
|
16
|
+
var _boom = require("@hapi/boom");
|
|
17
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
18
|
+
var _crypto = require("crypto");
|
|
19
|
+
var _os = require("os");
|
|
20
|
+
var _index = require("../../WAProto/index.js");
|
|
21
|
+
var _index2 = require("../Types/index.js");
|
|
22
|
+
var _index3 = require("../WABinary/index.js");
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
24
|
const baileysVersion = [2, 3000, 1023223821];
|
|
7
|
-
import { DisconnectReason } from '../Types/index.js';
|
|
8
|
-
import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
|
|
9
25
|
const PLATFORM_MAP = {
|
|
10
26
|
aix: 'AIX',
|
|
11
27
|
darwin: 'Mac OS',
|
|
@@ -19,19 +35,20 @@ const PLATFORM_MAP = {
|
|
|
19
35
|
cygwin: undefined,
|
|
20
36
|
netbsd: undefined
|
|
21
37
|
};
|
|
22
|
-
|
|
38
|
+
const Browsers = exports.Browsers = {
|
|
23
39
|
ubuntu: browser => ['Ubuntu', browser, '22.04.4'],
|
|
24
40
|
macOS: browser => ['Mac OS', browser, '14.4.1'],
|
|
25
41
|
baileys: browser => ['Baileys', browser, '6.5.0'],
|
|
26
42
|
windows: browser => ['Windows', browser, '10.0.22631'],
|
|
27
43
|
/** The appropriate browser based on your OS & release */
|
|
28
|
-
appropriate: browser => [PLATFORM_MAP[platform()] || 'Ubuntu', browser, release()]
|
|
44
|
+
appropriate: browser => [PLATFORM_MAP[(0, _os.platform)()] || 'Ubuntu', browser, (0, _os.release)()]
|
|
29
45
|
};
|
|
30
|
-
|
|
31
|
-
const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
46
|
+
const getPlatformId = browser => {
|
|
47
|
+
const platformType = _index.proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
32
48
|
return platformType ? platformType.toString() : '1'; //chrome
|
|
33
49
|
};
|
|
34
|
-
|
|
50
|
+
exports.getPlatformId = getPlatformId;
|
|
51
|
+
const BufferJSON = exports.BufferJSON = {
|
|
35
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
53
|
replacer: (k, value) => {
|
|
37
54
|
if (Buffer.isBuffer(value) || value instanceof Uint8Array || value?.type === 'Buffer') {
|
|
@@ -51,13 +68,15 @@ export const BufferJSON = {
|
|
|
51
68
|
return value;
|
|
52
69
|
}
|
|
53
70
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
const getKeyAuthor = (key, meId = 'me') => (key?.fromMe ? meId : key?.participant || key?.remoteJid) || '';
|
|
72
|
+
exports.getKeyAuthor = getKeyAuthor;
|
|
73
|
+
const writeRandomPadMax16 = msg => {
|
|
74
|
+
const pad = (0, _crypto.randomBytes)(1);
|
|
57
75
|
const padLength = (pad[0] & 0x0f) + 1;
|
|
58
76
|
return Buffer.concat([msg, Buffer.alloc(padLength, padLength)]);
|
|
59
77
|
};
|
|
60
|
-
|
|
78
|
+
exports.writeRandomPadMax16 = writeRandomPadMax16;
|
|
79
|
+
const unpadRandomMax16 = e => {
|
|
61
80
|
const t = new Uint8Array(e);
|
|
62
81
|
if (0 === t.length) {
|
|
63
82
|
throw new Error('unpadPkcs7 given empty bytes');
|
|
@@ -68,11 +87,14 @@ export const unpadRandomMax16 = e => {
|
|
|
68
87
|
}
|
|
69
88
|
return new Uint8Array(t.buffer, t.byteOffset, t.length - r);
|
|
70
89
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
90
|
+
exports.unpadRandomMax16 = unpadRandomMax16;
|
|
91
|
+
const encodeWAMessage = message => writeRandomPadMax16(_index.proto.Message.encode(message).finish());
|
|
92
|
+
exports.encodeWAMessage = encodeWAMessage;
|
|
93
|
+
const generateRegistrationId = () => {
|
|
94
|
+
return Uint16Array.from((0, _crypto.randomBytes)(2))[0] & 16383;
|
|
74
95
|
};
|
|
75
|
-
|
|
96
|
+
exports.generateRegistrationId = generateRegistrationId;
|
|
97
|
+
const encodeBigEndian = (e, t = 4) => {
|
|
76
98
|
let r = e;
|
|
77
99
|
const a = new Uint8Array(t);
|
|
78
100
|
for (let i = t - 1; i >= 0; i--) {
|
|
@@ -81,10 +103,13 @@ export const encodeBigEndian = (e, t = 4) => {
|
|
|
81
103
|
}
|
|
82
104
|
return a;
|
|
83
105
|
};
|
|
84
|
-
|
|
106
|
+
exports.encodeBigEndian = encodeBigEndian;
|
|
107
|
+
const toNumber = t => typeof t === 'object' && t ? 'toNumber' in t ? t.toNumber() : t.low : t || 0;
|
|
85
108
|
/** unix timestamp of a date in seconds */
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
exports.toNumber = toNumber;
|
|
110
|
+
const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000);
|
|
111
|
+
exports.unixTimestampSeconds = unixTimestampSeconds;
|
|
112
|
+
const debouncedTimeout = (intervalMs = 1000, task) => {
|
|
88
113
|
let timeout;
|
|
89
114
|
return {
|
|
90
115
|
start: (newIntervalMs, newTask) => {
|
|
@@ -101,8 +126,10 @@ export const debouncedTimeout = (intervalMs = 1000, task) => {
|
|
|
101
126
|
setInterval: newInterval => intervalMs = newInterval
|
|
102
127
|
};
|
|
103
128
|
};
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
exports.debouncedTimeout = debouncedTimeout;
|
|
130
|
+
const delay = ms => delayCancellable(ms).delay;
|
|
131
|
+
exports.delay = delay;
|
|
132
|
+
const delayCancellable = ms => {
|
|
106
133
|
const stack = new Error().stack;
|
|
107
134
|
let timeout;
|
|
108
135
|
let reject;
|
|
@@ -112,7 +139,7 @@ export const delayCancellable = ms => {
|
|
|
112
139
|
});
|
|
113
140
|
const cancel = () => {
|
|
114
141
|
clearTimeout(timeout);
|
|
115
|
-
reject(new Boom('Cancelled', {
|
|
142
|
+
reject(new _boom.Boom('Cancelled', {
|
|
116
143
|
statusCode: 500,
|
|
117
144
|
data: {
|
|
118
145
|
stack
|
|
@@ -124,7 +151,8 @@ export const delayCancellable = ms => {
|
|
|
124
151
|
cancel
|
|
125
152
|
};
|
|
126
153
|
};
|
|
127
|
-
|
|
154
|
+
exports.delayCancellable = delayCancellable;
|
|
155
|
+
async function promiseTimeout(ms, promise) {
|
|
128
156
|
if (!ms) {
|
|
129
157
|
return new Promise(promise);
|
|
130
158
|
}
|
|
@@ -135,8 +163,8 @@ export async function promiseTimeout(ms, promise) {
|
|
|
135
163
|
cancel
|
|
136
164
|
} = delayCancellable(ms);
|
|
137
165
|
const p = new Promise((resolve, reject) => {
|
|
138
|
-
delay.then(() => reject(new Boom('Timed Out', {
|
|
139
|
-
statusCode: DisconnectReason.timedOut,
|
|
166
|
+
delay.then(() => reject(new _boom.Boom('Timed Out', {
|
|
167
|
+
statusCode: _index2.DisconnectReason.timedOut,
|
|
140
168
|
data: {
|
|
141
169
|
stack
|
|
142
170
|
}
|
|
@@ -147,24 +175,26 @@ export async function promiseTimeout(ms, promise) {
|
|
|
147
175
|
}
|
|
148
176
|
// inspired from whatsmeow code
|
|
149
177
|
// https://github.com/tulir/whatsmeow/blob/64bc969fbe78d31ae0dd443b8d4c80a5d026d07a/send.go#L42
|
|
150
|
-
|
|
178
|
+
const generateMessageIDV2 = userId => {
|
|
151
179
|
const data = Buffer.alloc(8 + 20 + 16);
|
|
152
180
|
data.writeBigUInt64BE(BigInt(Math.floor(Date.now() / 1000)));
|
|
153
181
|
if (userId) {
|
|
154
|
-
const id = jidDecode(userId);
|
|
182
|
+
const id = (0, _index3.jidDecode)(userId);
|
|
155
183
|
if (id?.user) {
|
|
156
184
|
data.write(id.user, 8);
|
|
157
185
|
data.write('@c.us', 8 + id.user.length);
|
|
158
186
|
}
|
|
159
187
|
}
|
|
160
|
-
const random = randomBytes(16);
|
|
188
|
+
const random = (0, _crypto.randomBytes)(16);
|
|
161
189
|
random.copy(data, 28);
|
|
162
|
-
const hash = createHash('sha256').update(data).digest();
|
|
190
|
+
const hash = (0, _crypto.createHash)('sha256').update(data).digest();
|
|
163
191
|
return '3EB0' + hash.toString('hex').toUpperCase().substring(0, 18);
|
|
164
192
|
};
|
|
165
193
|
// generate a random ID to attach to a message
|
|
166
|
-
|
|
167
|
-
|
|
194
|
+
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
195
|
+
const generateMessageID = () => '3EB0' + (0, _crypto.randomBytes)(18).toString('hex').toUpperCase();
|
|
196
|
+
exports.generateMessageID = generateMessageID;
|
|
197
|
+
function bindWaitForEvent(ev, event) {
|
|
168
198
|
return async (check, timeoutMs) => {
|
|
169
199
|
let listener;
|
|
170
200
|
let closeListener;
|
|
@@ -174,8 +204,8 @@ export function bindWaitForEvent(ev, event) {
|
|
|
174
204
|
lastDisconnect
|
|
175
205
|
}) => {
|
|
176
206
|
if (connection === 'close') {
|
|
177
|
-
reject(lastDisconnect?.error || new Boom('Connection Closed', {
|
|
178
|
-
statusCode: DisconnectReason.connectionClosed
|
|
207
|
+
reject(lastDisconnect?.error || new _boom.Boom('Connection Closed', {
|
|
208
|
+
statusCode: _index2.DisconnectReason.connectionClosed
|
|
179
209
|
}));
|
|
180
210
|
}
|
|
181
211
|
};
|
|
@@ -192,15 +222,16 @@ export function bindWaitForEvent(ev, event) {
|
|
|
192
222
|
});
|
|
193
223
|
};
|
|
194
224
|
}
|
|
195
|
-
|
|
225
|
+
const bindWaitForConnectionUpdate = ev => bindWaitForEvent(ev, 'connection.update');
|
|
196
226
|
/**
|
|
197
227
|
* utility that fetches latest baileys version from the master branch.
|
|
198
228
|
* Use to ensure your WA connection is always on the latest version
|
|
199
229
|
*/
|
|
200
|
-
|
|
230
|
+
exports.bindWaitForConnectionUpdate = bindWaitForConnectionUpdate;
|
|
231
|
+
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
201
232
|
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts';
|
|
202
233
|
try {
|
|
203
|
-
const result = await
|
|
234
|
+
const result = await _axios.default.get(URL, {
|
|
204
235
|
...options,
|
|
205
236
|
responseType: 'text'
|
|
206
237
|
});
|
|
@@ -229,11 +260,12 @@ export const fetchLatestBaileysVersion = async (options = {}) => {
|
|
|
229
260
|
* A utility that fetches the latest web version of whatsapp.
|
|
230
261
|
* Use to ensure your WA connection is always on the latest version
|
|
231
262
|
*/
|
|
232
|
-
|
|
263
|
+
exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
|
|
264
|
+
const fetchLatestWaWebVersion = async options => {
|
|
233
265
|
try {
|
|
234
266
|
const {
|
|
235
267
|
data
|
|
236
|
-
} = await
|
|
268
|
+
} = await _axios.default.get('https://web.whatsapp.com/sw.js', {
|
|
237
269
|
...options,
|
|
238
270
|
responseType: 'json'
|
|
239
271
|
});
|
|
@@ -262,39 +294,42 @@ export const fetchLatestWaWebVersion = async options => {
|
|
|
262
294
|
}
|
|
263
295
|
};
|
|
264
296
|
/** unique message tag prefix for MD clients */
|
|
265
|
-
|
|
266
|
-
|
|
297
|
+
exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
|
|
298
|
+
const generateMdTagPrefix = () => {
|
|
299
|
+
const bytes = (0, _crypto.randomBytes)(4);
|
|
267
300
|
return `${bytes.readUInt16BE()}.${bytes.readUInt16BE(2)}-`;
|
|
268
301
|
};
|
|
302
|
+
exports.generateMdTagPrefix = generateMdTagPrefix;
|
|
269
303
|
const STATUS_MAP = {
|
|
270
|
-
sender: proto.WebMessageInfo.Status.SERVER_ACK,
|
|
271
|
-
played: proto.WebMessageInfo.Status.PLAYED,
|
|
272
|
-
read: proto.WebMessageInfo.Status.READ,
|
|
273
|
-
'read-self': proto.WebMessageInfo.Status.READ
|
|
304
|
+
sender: _index.proto.WebMessageInfo.Status.SERVER_ACK,
|
|
305
|
+
played: _index.proto.WebMessageInfo.Status.PLAYED,
|
|
306
|
+
read: _index.proto.WebMessageInfo.Status.READ,
|
|
307
|
+
'read-self': _index.proto.WebMessageInfo.Status.READ
|
|
274
308
|
};
|
|
275
309
|
/**
|
|
276
310
|
* Given a type of receipt, returns what the new status of the message should be
|
|
277
311
|
* @param type type from receipt
|
|
278
312
|
*/
|
|
279
|
-
|
|
313
|
+
const getStatusFromReceiptType = type => {
|
|
280
314
|
const status = STATUS_MAP[type];
|
|
281
315
|
if (typeof type === 'undefined') {
|
|
282
|
-
return proto.WebMessageInfo.Status.DELIVERY_ACK;
|
|
316
|
+
return _index.proto.WebMessageInfo.Status.DELIVERY_ACK;
|
|
283
317
|
}
|
|
284
318
|
return status;
|
|
285
319
|
};
|
|
320
|
+
exports.getStatusFromReceiptType = getStatusFromReceiptType;
|
|
286
321
|
const CODE_MAP = {
|
|
287
|
-
conflict: DisconnectReason.connectionReplaced
|
|
322
|
+
conflict: _index2.DisconnectReason.connectionReplaced
|
|
288
323
|
};
|
|
289
324
|
/**
|
|
290
325
|
* Stream errors generally provide a reason, map that to a baileys DisconnectReason
|
|
291
326
|
* @param reason the string reason given, eg. "conflict"
|
|
292
327
|
*/
|
|
293
|
-
|
|
294
|
-
const [reasonNode] = getAllBinaryNodeChildren(node);
|
|
328
|
+
const getErrorCodeFromStreamError = node => {
|
|
329
|
+
const [reasonNode] = (0, _index3.getAllBinaryNodeChildren)(node);
|
|
295
330
|
let reason = reasonNode?.tag || 'unknown';
|
|
296
|
-
const statusCode = +(node.attrs.code || CODE_MAP[reason] || DisconnectReason.badSession);
|
|
297
|
-
if (statusCode === DisconnectReason.restartRequired) {
|
|
331
|
+
const statusCode = +(node.attrs.code || CODE_MAP[reason] || _index2.DisconnectReason.badSession);
|
|
332
|
+
if (statusCode === _index2.DisconnectReason.restartRequired) {
|
|
298
333
|
reason = 'restart required';
|
|
299
334
|
}
|
|
300
335
|
return {
|
|
@@ -302,7 +337,8 @@ export const getErrorCodeFromStreamError = node => {
|
|
|
302
337
|
statusCode
|
|
303
338
|
};
|
|
304
339
|
};
|
|
305
|
-
|
|
340
|
+
exports.getErrorCodeFromStreamError = getErrorCodeFromStreamError;
|
|
341
|
+
const getCallStatusFromNode = ({
|
|
306
342
|
tag,
|
|
307
343
|
attrs
|
|
308
344
|
}) => {
|
|
@@ -332,8 +368,9 @@ export const getCallStatusFromNode = ({
|
|
|
332
368
|
}
|
|
333
369
|
return status;
|
|
334
370
|
};
|
|
371
|
+
exports.getCallStatusFromNode = getCallStatusFromNode;
|
|
335
372
|
const UNEXPECTED_SERVER_CODE_TEXT = 'Unexpected server response: ';
|
|
336
|
-
|
|
373
|
+
const getCodeFromWSError = error => {
|
|
337
374
|
let statusCode = 500;
|
|
338
375
|
if (error?.message?.includes(UNEXPECTED_SERVER_CODE_TEXT)) {
|
|
339
376
|
const code = +error?.message.slice(UNEXPECTED_SERVER_CODE_TEXT.length);
|
|
@@ -352,11 +389,13 @@ export const getCodeFromWSError = error => {
|
|
|
352
389
|
* Is the given platform WA business
|
|
353
390
|
* @param platform AuthenticationCreds.platform
|
|
354
391
|
*/
|
|
355
|
-
|
|
392
|
+
exports.getCodeFromWSError = getCodeFromWSError;
|
|
393
|
+
const isWABusinessPlatform = platform => {
|
|
356
394
|
return platform === 'smbi' || platform === 'smba';
|
|
357
395
|
};
|
|
358
396
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
359
|
-
|
|
397
|
+
exports.isWABusinessPlatform = isWABusinessPlatform;
|
|
398
|
+
function trimUndefined(obj) {
|
|
360
399
|
for (const key in obj) {
|
|
361
400
|
if (typeof obj[key] === 'undefined') {
|
|
362
401
|
delete obj[key];
|
|
@@ -365,7 +404,7 @@ export function trimUndefined(obj) {
|
|
|
365
404
|
return obj;
|
|
366
405
|
}
|
|
367
406
|
const CROCKFORD_CHARACTERS = '123456789ABCDEFGHJKLMNPQRSTVWXYZ';
|
|
368
|
-
|
|
407
|
+
function bytesToCrockford(buffer) {
|
|
369
408
|
let value = 0;
|
|
370
409
|
let bitCount = 0;
|
|
371
410
|
const crockford = [];
|
|
@@ -382,7 +421,7 @@ export function bytesToCrockford(buffer) {
|
|
|
382
421
|
}
|
|
383
422
|
return crockford.join('');
|
|
384
423
|
}
|
|
385
|
-
|
|
386
|
-
return proto.Message.encode(message).finish();
|
|
424
|
+
function encodeNewsletterMessage(message) {
|
|
425
|
+
return _index.proto.Message.encode(message).finish();
|
|
387
426
|
}
|
|
388
427
|
//# sourceMappingURL=generics.js.map
|
package/lib/Utils/history.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processHistoryMessage = exports.getHistoryMsg = exports.downloadHistory = exports.downloadAndProcessHistorySyncNotification = void 0;
|
|
7
|
+
var _util = require("util");
|
|
8
|
+
var _zlib = require("zlib");
|
|
9
|
+
var _index = require("../../WAProto/index.js");
|
|
10
|
+
var _index2 = require("../Types/index.js");
|
|
11
|
+
var _generics = require("./generics.js");
|
|
12
|
+
var _messages = require("./messages.js");
|
|
13
|
+
var _messagesMedia = require("./messages-media.js");
|
|
14
|
+
const inflatePromise = (0, _util.promisify)(_zlib.inflate);
|
|
15
|
+
const downloadHistory = async (msg, options) => {
|
|
16
|
+
const stream = await (0, _messagesMedia.downloadContentFromMessage)(msg, 'md-msg-hist', {
|
|
11
17
|
options
|
|
12
18
|
});
|
|
13
19
|
const bufferArray = [];
|
|
@@ -17,18 +23,19 @@ export const downloadHistory = async (msg, options) => {
|
|
|
17
23
|
let buffer = Buffer.concat(bufferArray);
|
|
18
24
|
// decompress buffer
|
|
19
25
|
buffer = await inflatePromise(buffer);
|
|
20
|
-
const syncData = proto.HistorySync.decode(buffer);
|
|
26
|
+
const syncData = _index.proto.HistorySync.decode(buffer);
|
|
21
27
|
return syncData;
|
|
22
28
|
};
|
|
23
|
-
|
|
29
|
+
exports.downloadHistory = downloadHistory;
|
|
30
|
+
const processHistoryMessage = item => {
|
|
24
31
|
const messages = [];
|
|
25
32
|
const contacts = [];
|
|
26
33
|
const chats = [];
|
|
27
34
|
switch (item.syncType) {
|
|
28
|
-
case proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
|
|
29
|
-
case proto.HistorySync.HistorySyncType.RECENT:
|
|
30
|
-
case proto.HistorySync.HistorySyncType.FULL:
|
|
31
|
-
case proto.HistorySync.HistorySyncType.ON_DEMAND:
|
|
35
|
+
case _index.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
|
|
36
|
+
case _index.proto.HistorySync.HistorySyncType.RECENT:
|
|
37
|
+
case _index.proto.HistorySync.HistorySyncType.FULL:
|
|
38
|
+
case _index.proto.HistorySync.HistorySyncType.ON_DEMAND:
|
|
32
39
|
for (const chat of item.conversations) {
|
|
33
40
|
contacts.push({
|
|
34
41
|
id: chat.id,
|
|
@@ -48,9 +55,9 @@ export const processHistoryMessage = item => {
|
|
|
48
55
|
}];
|
|
49
56
|
}
|
|
50
57
|
if (!message.key.fromMe && !chat.lastMessageRecvTimestamp) {
|
|
51
|
-
chat.lastMessageRecvTimestamp = toNumber(message.messageTimestamp);
|
|
58
|
+
chat.lastMessageRecvTimestamp = (0, _generics.toNumber)(message.messageTimestamp);
|
|
52
59
|
}
|
|
53
|
-
if ((message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP || message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB) && message.messageStubParameters?.[0]) {
|
|
60
|
+
if ((message.messageStubType === _index2.WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP || message.messageStubType === _index2.WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB) && message.messageStubParameters?.[0]) {
|
|
54
61
|
contacts.push({
|
|
55
62
|
id: message.key.participant || message.key.remoteJid,
|
|
56
63
|
verifiedName: message.messageStubParameters?.[0]
|
|
@@ -62,7 +69,7 @@ export const processHistoryMessage = item => {
|
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
71
|
break;
|
|
65
|
-
case proto.HistorySync.HistorySyncType.PUSH_NAME:
|
|
72
|
+
case _index.proto.HistorySync.HistorySyncType.PUSH_NAME:
|
|
66
73
|
for (const c of item.pushnames) {
|
|
67
74
|
contacts.push({
|
|
68
75
|
id: c.id,
|
|
@@ -79,13 +86,16 @@ export const processHistoryMessage = item => {
|
|
|
79
86
|
progress: item.progress
|
|
80
87
|
};
|
|
81
88
|
};
|
|
82
|
-
|
|
89
|
+
exports.processHistoryMessage = processHistoryMessage;
|
|
90
|
+
const downloadAndProcessHistorySyncNotification = async (msg, options) => {
|
|
83
91
|
const historyMsg = await downloadHistory(msg, options);
|
|
84
92
|
return processHistoryMessage(historyMsg);
|
|
85
93
|
};
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
exports.downloadAndProcessHistorySyncNotification = downloadAndProcessHistorySyncNotification;
|
|
95
|
+
const getHistoryMsg = message => {
|
|
96
|
+
const normalizedContent = !!message ? (0, _messages.normalizeMessageContent)(message) : undefined;
|
|
88
97
|
const anyHistoryMsg = normalizedContent?.protocolMessage?.historySyncNotification;
|
|
89
98
|
return anyHistoryMsg;
|
|
90
99
|
};
|
|
91
|
-
//# sourceMappingURL=history.js.map
|
|
100
|
+
//# sourceMappingURL=history.js.map
|
|
101
|
+
exports.getHistoryMsg = getHistoryMsg;
|