@neelegirl/baileys 1.5.6 → 1.5.8
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 +24 -27
- package/WAProto/WAProto.proto +665 -291
- package/WAProto/index.d.ts +48037 -2294
- package/WAProto/index.js +139804 -45203
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +64 -58
- package/lib/Defaults/index.js +96 -74
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/WASignalGroup/GroupProtocol.js +1909 -0
- package/lib/Signal/WASignalGroup/ciphertext_message.js +16 -0
- package/lib/Signal/WASignalGroup/generate-proto.sh +1 -0
- package/lib/Signal/WASignalGroup/group.proto +42 -0
- package/lib/Signal/WASignalGroup/group_cipher.js +120 -0
- package/lib/Signal/WASignalGroup/group_session_builder.js +46 -0
- package/lib/Signal/WASignalGroup/index.js +6 -0
- package/lib/Signal/WASignalGroup/keyhelper.js +21 -0
- package/lib/Signal/WASignalGroup/protobufs.js +3 -0
- package/lib/Signal/WASignalGroup/queue_job.js +69 -0
- package/lib/Signal/WASignalGroup/readme.md +6 -0
- package/lib/Signal/WASignalGroup/sender_chain_key.js +50 -0
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/lib/Signal/WASignalGroup/sender_key_message.js +92 -0
- package/lib/Signal/WASignalGroup/sender_key_name.js +70 -0
- package/lib/Signal/WASignalGroup/sender_key_record.js +56 -0
- package/lib/Signal/WASignalGroup/sender_key_state.js +129 -0
- package/lib/Signal/{Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -3
- package/lib/Signal/libsignal.d.ts +4 -5
- package/lib/Signal/libsignal.js +112 -292
- package/lib/Socket/Client/abstract-socket-client.d.ts +15 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +22 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/types.d.ts +15 -15
- package/lib/Socket/Client/types.js +15 -8
- package/lib/Socket/Client/websocket.d.ts +12 -12
- package/lib/Socket/Client/websocket.js +36 -24
- package/lib/Socket/business.d.ts +177 -178
- package/lib/Socket/business.js +71 -179
- package/lib/Socket/chats.d.ts +93 -93
- package/lib/Socket/chats.js +625 -474
- package/lib/Socket/communities.d.ts +62 -83
- package/lib/Socket/communities.js +414 -412
- package/lib/Socket/groups.d.ts +112 -118
- package/lib/Socket/groups.js +171 -146
- package/lib/Socket/index.d.ts +182 -222
- package/lib/Socket/index.js +17 -12
- package/lib/Socket/messages-recv.d.ts +169 -165
- package/lib/Socket/messages-recv.js +1721 -1185
- package/lib/Socket/messages-send.d.ts +160 -161
- package/lib/Socket/messages-send.js +992 -642
- package/lib/Socket/mex.d.ts +0 -1
- package/lib/Socket/mex.js +9 -4
- package/lib/Socket/newsletter.d.ts +139 -139
- package/lib/Socket/newsletter.js +258 -153
- package/lib/Socket/registration.d.ts +266 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +36 -42
- package/lib/Socket/socket.js +615 -533
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +83 -0
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.js +24 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/lib/Store/make-cache-manager-store.js +90 -0
- package/lib/Store/make-in-memory-store.d.ts +123 -0
- package/lib/Store/make-in-memory-store.js +429 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +86 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +31 -0
- package/lib/Types/Auth.d.ts +96 -87
- package/lib/Types/Auth.js +3 -2
- package/lib/Types/Call.d.ts +13 -13
- package/lib/Types/Call.js +3 -2
- package/lib/Types/Chat.d.ts +94 -79
- package/lib/Types/Chat.js +9 -8
- package/lib/Types/Contact.d.ts +9 -13
- package/lib/Types/Contact.js +3 -2
- package/lib/Types/Events.d.ts +179 -152
- package/lib/Types/Events.js +3 -2
- package/lib/Types/GroupMetadata.d.ts +48 -49
- package/lib/Types/GroupMetadata.js +3 -2
- package/lib/Types/Label.d.ts +14 -13
- package/lib/Types/Label.js +30 -24
- package/lib/Types/LabelAssociation.d.ts +20 -15
- package/lib/Types/LabelAssociation.js +12 -6
- package/lib/Types/Message.d.ts +404 -234
- package/lib/Types/Message.js +13 -11
- package/lib/Types/MexUpdates.d.ts +9 -0
- package/lib/Types/MexUpdates.js +18 -0
- package/lib/Types/Newsletter.d.ts +104 -130
- package/lib/Types/Newsletter.js +40 -31
- package/lib/Types/Product.d.ts +71 -58
- package/lib/Types/Product.js +3 -2
- package/lib/Types/Signal.d.ts +55 -63
- package/lib/Types/Signal.js +3 -2
- package/lib/Types/Socket.d.ts +66 -77
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/State.d.ts +19 -17
- package/lib/Types/State.js +14 -13
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.js +3 -2
- package/lib/Types/index.d.ts +61 -47
- package/lib/Types/index.js +48 -26
- package/lib/Utils/auth-utils.d.ts +10 -8
- package/lib/Utils/auth-utils.js +154 -206
- package/lib/Utils/baileys-event-stream.d.ts +7 -6
- package/lib/Utils/baileys-event-stream.js +43 -29
- package/lib/Utils/business.d.ts +20 -14
- package/lib/Utils/business.js +134 -110
- package/lib/Utils/chat-utils.d.ts +69 -57
- package/lib/Utils/chat-utils.js +380 -362
- package/lib/Utils/check-npm-version.d.ts +15 -0
- package/lib/Utils/check-npm-version.js +52 -0
- package/lib/Utils/crypto.d.ts +45 -30
- package/lib/Utils/crypto.js +178 -141
- package/lib/Utils/decode-wa-message.d.ts +35 -42
- package/lib/Utils/decode-wa-message.js +150 -176
- package/lib/Utils/event-buffer.d.ts +17 -12
- package/lib/Utils/event-buffer.js +286 -269
- package/lib/Utils/generics.d.ts +99 -60
- package/lib/Utils/generics.js +481 -244
- package/lib/Utils/history.d.ts +22 -18
- package/lib/Utils/history.js +80 -54
- package/lib/Utils/index.d.ts +19 -20
- package/lib/Utils/index.js +41 -19
- package/lib/Utils/link-preview.d.ts +14 -12
- package/lib/Utils/link-preview.js +75 -40
- package/lib/Utils/logger.d.ts +11 -10
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +13 -12
- package/lib/Utils/lt-hash.js +37 -27
- package/lib/Utils/make-mutex.d.ts +7 -6
- package/lib/Utils/make-mutex.js +29 -20
- package/lib/Utils/message-retry-manager.d.ts +6 -6
- package/lib/Utils/message-retry-manager.js +36 -8
- package/lib/Utils/messages-media.d.ts +102 -87
- package/lib/Utils/messages-media.js +570 -427
- package/lib/Utils/messages.d.ts +64 -37
- package/lib/Utils/messages.js +1270 -511
- package/lib/Utils/noise-handler.d.ts +18 -18
- package/lib/Utils/noise-handler.js +109 -101
- package/lib/Utils/process-message.d.ts +32 -25
- package/lib/Utils/process-message.js +281 -266
- package/lib/Utils/signal.d.ts +32 -24
- package/lib/Utils/signal.js +105 -98
- package/lib/Utils/use-mongo-file-auth-state.d.ts +6 -0
- package/lib/Utils/use-mongo-file-auth-state.js +84 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -5
- package/lib/Utils/use-multi-file-auth-state.js +186 -69
- package/lib/Utils/use-single-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-single-file-auth-state.js +80 -0
- package/lib/Utils/validate-connection.d.ts +13 -11
- package/lib/Utils/validate-connection.js +116 -124
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +1292 -1277
- package/lib/WABinary/decode.d.ts +9 -7
- package/lib/WABinary/decode.js +189 -139
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +154 -105
- package/lib/WABinary/generic-utils.d.ts +27 -14
- package/lib/WABinary/generic-utils.js +102 -62
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +25 -6
- package/lib/WABinary/jid-utils.d.ts +46 -41
- package/lib/WABinary/jid-utils.js +80 -84
- package/lib/WABinary/types.d.ts +13 -10
- package/lib/WABinary/types.js +3 -2
- package/lib/WAM/BinaryInfo.d.ts +15 -8
- package/lib/WAM/BinaryInfo.js +14 -7
- package/lib/WAM/constants.d.ts +37 -30
- package/lib/WAM/constants.js +11983 -19465
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +110 -95
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +23 -4
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +28 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +69 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +19 -12
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -19
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +26 -18
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +20 -12
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -11
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +24 -16
- package/lib/WAUSync/Protocols/index.d.ts +6 -5
- package/lib/WAUSync/Protocols/index.js +26 -5
- package/lib/WAUSync/USyncQuery.d.ts +28 -26
- package/lib/WAUSync/USyncQuery.js +62 -64
- package/lib/WAUSync/USyncUser.d.ts +10 -11
- package/lib/WAUSync/USyncUser.js +19 -12
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +23 -4
- package/lib/index.d.ts +11 -10
- package/lib/index.js +33 -11
- package/package.json +43 -48
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/fix-imports.js +0 -29
- package/engine-requirements.js +0 -10
- 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 +0 -12
- 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 +0 -30
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js +0 -82
- 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 +0 -12
- 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 +0 -18
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- 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 +0 -26
- 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 +0 -63
- 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 +0 -66
- 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 +0 -48
- 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 +0 -41
- 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 +0 -84
- 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.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js +0 -171
- package/lib/Signal/lid-mapping.js.map +0 -1
- 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.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- 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.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- 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.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- 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 +0 -2
- package/lib/Types/Bussines.js.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/baileys-event-stream.js.map +0 -1
- package/lib/Utils/browser-utils.d.ts +0 -4
- package/lib/Utils/browser-utils.d.ts.map +0 -1
- package/lib/Utils/browser-utils.js +0 -28
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts +0 -28
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- package/lib/Utils/pre-key-manager.js +0 -106
- package/lib/Utils/pre-key-manager.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- 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.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- 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.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- 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.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- 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 +0 -51
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -29
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/Utils/history.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { AxiosRequestConfig } from 'axios'
|
|
2
|
+
import { proto } from '../../WAProto'
|
|
3
|
+
import { Chat, Contact } from '../Types'
|
|
4
|
+
|
|
5
|
+
export declare const downloadHistory: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<proto.HistorySync>
|
|
6
|
+
|
|
4
7
|
export declare const processHistoryMessage: (item: proto.IHistorySync) => {
|
|
5
|
-
chats: Chat[]
|
|
6
|
-
contacts: Contact[]
|
|
7
|
-
messages:
|
|
8
|
-
syncType: proto.HistorySync.HistorySyncType
|
|
9
|
-
progress: number | null | undefined
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
chats: Chat[]
|
|
9
|
+
contacts: Contact[]
|
|
10
|
+
messages: proto.IWebMessageInfo[]
|
|
11
|
+
syncType: proto.HistorySync.HistorySyncType
|
|
12
|
+
progress: number | null | undefined
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<{
|
|
16
|
+
chats: Chat[]
|
|
17
|
+
contacts: Contact[]
|
|
18
|
+
messages: proto.IWebMessageInfo[]
|
|
19
|
+
syncType: proto.HistorySync.HistorySyncType
|
|
20
|
+
progress: number | null | undefined
|
|
21
|
+
}>
|
|
22
|
+
|
|
23
|
+
export declare const getHistoryMsg: (message: proto.IMessage) => proto.Message.IHistorySyncNotification | null | undefined
|
package/lib/Utils/history.js
CHANGED
|
@@ -1,68 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const util_1 = require("util")
|
|
6
|
+
const zlib_1 = require("zlib")
|
|
7
|
+
const WAProto_1 = require("../../WAProto")
|
|
8
|
+
const Types_1 = require("../Types")
|
|
9
|
+
const WABinary_1 = require("../WABinary")
|
|
10
|
+
const generics_1 = require("./generics")
|
|
11
|
+
const messages_1 = require("./messages")
|
|
12
|
+
const messages_media_1 = require("./messages-media")
|
|
13
|
+
const inflatePromise = util_1.promisify(zlib_1.inflate)
|
|
14
|
+
|
|
15
|
+
const downloadHistory = async (msg, options) => {
|
|
16
|
+
const stream = await messages_media_1.downloadContentFromMessage(msg, 'md-msg-hist', { options })
|
|
17
|
+
const bufferArray = []
|
|
12
18
|
for await (const chunk of stream) {
|
|
13
|
-
bufferArray.push(chunk)
|
|
19
|
+
bufferArray.push(chunk)
|
|
14
20
|
}
|
|
15
|
-
let buffer = Buffer.concat(bufferArray)
|
|
21
|
+
let buffer = Buffer.concat(bufferArray)
|
|
16
22
|
// decompress buffer
|
|
17
|
-
buffer = await inflatePromise(buffer)
|
|
18
|
-
const syncData = proto.HistorySync.decode(buffer)
|
|
19
|
-
return syncData
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
buffer = await inflatePromise(buffer)
|
|
24
|
+
const syncData = WAProto_1.proto.HistorySync.decode(buffer)
|
|
25
|
+
return syncData
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const processHistoryMessage = (item) => {
|
|
29
|
+
const messages = []
|
|
30
|
+
const contacts = []
|
|
31
|
+
const chats = []
|
|
25
32
|
switch (item.syncType) {
|
|
26
|
-
case proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
|
|
27
|
-
case proto.HistorySync.HistorySyncType.RECENT:
|
|
28
|
-
case proto.HistorySync.HistorySyncType.FULL:
|
|
29
|
-
case proto.HistorySync.HistorySyncType.ON_DEMAND:
|
|
33
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
|
|
34
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.RECENT:
|
|
35
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.FULL:
|
|
36
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND:
|
|
30
37
|
for (const chat of item.conversations) {
|
|
31
|
-
|
|
38
|
+
contacts.push({
|
|
32
39
|
id: chat.id,
|
|
33
40
|
name: chat.name || undefined,
|
|
34
41
|
lid: chat.lidJid || undefined,
|
|
35
|
-
|
|
42
|
+
jid: (0, WABinary_1.isJidUser)(chat.id) ? chat.id : undefined
|
|
36
43
|
});
|
|
37
|
-
const msgs = chat.messages || []
|
|
38
|
-
delete chat.messages
|
|
44
|
+
const msgs = chat.messages || []
|
|
45
|
+
delete chat.messages
|
|
46
|
+
delete chat.archived
|
|
47
|
+
delete chat.muteEndTime
|
|
48
|
+
delete chat.pinned
|
|
39
49
|
for (const item of msgs) {
|
|
40
|
-
const message = item.message
|
|
41
|
-
messages.push(message)
|
|
50
|
+
const message = item.message
|
|
51
|
+
messages.push(message)
|
|
42
52
|
if (!chat.messages?.length) {
|
|
43
53
|
// keep only the most recent message in the chat array
|
|
44
|
-
chat.messages = [{ message }]
|
|
54
|
+
chat.messages = [{ message }]
|
|
45
55
|
}
|
|
46
56
|
if (!message.key.fromMe && !chat.lastMessageRecvTimestamp) {
|
|
47
|
-
chat.lastMessageRecvTimestamp = toNumber(message.messageTimestamp)
|
|
57
|
+
chat.lastMessageRecvTimestamp = generics_1.toNumber(message.messageTimestamp)
|
|
48
58
|
}
|
|
49
|
-
if (
|
|
50
|
-
message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB
|
|
51
|
-
message.messageStubParameters?.[0]) {
|
|
59
|
+
if (message.messageStubType === Types_1.WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP
|
|
60
|
+
|| message.messageStubType === Types_1.WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB
|
|
61
|
+
&& message.messageStubParameters?.[0]) {
|
|
52
62
|
contacts.push({
|
|
53
63
|
id: message.key.participant || message.key.remoteJid,
|
|
54
64
|
verifiedName: message.messageStubParameters?.[0]
|
|
55
|
-
})
|
|
65
|
+
})
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
|
-
|
|
68
|
+
if (WABinary_1.isJidUser(chat.id) && chat.readOnly && chat.archived) {
|
|
69
|
+
delete chat.readOnly
|
|
70
|
+
}
|
|
71
|
+
chats.push({ ...chat })
|
|
59
72
|
}
|
|
60
|
-
break
|
|
61
|
-
case proto.HistorySync.HistorySyncType.PUSH_NAME:
|
|
73
|
+
break
|
|
74
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.PUSH_NAME:
|
|
62
75
|
for (const c of item.pushnames) {
|
|
63
|
-
contacts.push({
|
|
76
|
+
contacts.push({
|
|
77
|
+
id: c.id,
|
|
78
|
+
name: c.name || undefined,
|
|
79
|
+
lid: c.lidJid || undefined,
|
|
80
|
+
jid: WABinary_1.isJidUser(c.id) ? c.id : undefined
|
|
81
|
+
})
|
|
64
82
|
}
|
|
65
|
-
break
|
|
83
|
+
break
|
|
66
84
|
}
|
|
67
85
|
return {
|
|
68
86
|
chats,
|
|
@@ -70,15 +88,23 @@ export const processHistoryMessage = (item) => {
|
|
|
70
88
|
messages,
|
|
71
89
|
syncType: item.syncType,
|
|
72
90
|
progress: item.progress
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const downloadAndProcessHistorySyncNotification = async (msg, options) => {
|
|
95
|
+
const historyMsg = await downloadHistory(msg, options)
|
|
96
|
+
return processHistoryMessage(historyMsg)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const getHistoryMsg = (message) => {
|
|
100
|
+
const normalizedContent = !!message ? messages_1.normalizeMessageContent(message) : undefined
|
|
101
|
+
const anyHistoryMsg = normalizedContent?.protocolMessage?.historySyncNotification
|
|
102
|
+
return anyHistoryMsg
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = {
|
|
106
|
+
downloadHistory,
|
|
107
|
+
processHistoryMessage,
|
|
108
|
+
downloadAndProcessHistorySyncNotification,
|
|
109
|
+
getHistoryMsg
|
|
110
|
+
}
|
package/lib/Utils/index.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export * from './generics
|
|
2
|
-
export * from './decode-wa-message
|
|
3
|
-
export * from './messages
|
|
4
|
-
export * from './messages-media
|
|
5
|
-
export * from './validate-connection
|
|
6
|
-
export * from './crypto
|
|
7
|
-
export * from './signal
|
|
8
|
-
export * from './noise-handler
|
|
9
|
-
export * from './history
|
|
10
|
-
export * from './chat-utils
|
|
11
|
-
export * from './lt-hash
|
|
12
|
-
export * from './auth-utils
|
|
13
|
-
export * from './baileys-event-stream
|
|
14
|
-
export * from './use-
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './generics'
|
|
2
|
+
export * from './decode-wa-message'
|
|
3
|
+
export * from './messages'
|
|
4
|
+
export * from './messages-media'
|
|
5
|
+
export * from './validate-connection'
|
|
6
|
+
export * from './crypto'
|
|
7
|
+
export * from './signal'
|
|
8
|
+
export * from './noise-handler'
|
|
9
|
+
export * from './history'
|
|
10
|
+
export * from './chat-utils'
|
|
11
|
+
export * from './lt-hash'
|
|
12
|
+
export * from './auth-utils'
|
|
13
|
+
export * from './baileys-event-stream'
|
|
14
|
+
export * from './use-mongo-file-auth-state'
|
|
15
|
+
export * from './use-single-file-auth-state'
|
|
16
|
+
export * from './use-multi-file-auth-state'
|
|
17
|
+
export * from './link-preview'
|
|
18
|
+
export * from './event-buffer'
|
|
19
|
+
export * from './process-message'
|
package/lib/Utils/index.js
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k] } }
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc)
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k
|
|
12
|
+
o[k2] = m[k]
|
|
13
|
+
}))
|
|
14
|
+
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
20
|
+
|
|
21
|
+
__exportStar(require("./generics"), exports)
|
|
22
|
+
__exportStar(require("./decode-wa-message"), exports)
|
|
23
|
+
__exportStar(require("./messages"), exports)
|
|
24
|
+
__exportStar(require("./messages-media"), exports)
|
|
25
|
+
__exportStar(require("./validate-connection"), exports)
|
|
26
|
+
__exportStar(require("./crypto"), exports)
|
|
27
|
+
__exportStar(require("./signal"), exports)
|
|
28
|
+
__exportStar(require("./noise-handler"), exports)
|
|
29
|
+
__exportStar(require("./history"), exports)
|
|
30
|
+
__exportStar(require("./chat-utils"), exports)
|
|
31
|
+
__exportStar(require("./lt-hash"), exports)
|
|
32
|
+
__exportStar(require("./auth-utils"), exports)
|
|
33
|
+
__exportStar(require("./baileys-event-stream"), exports)
|
|
34
|
+
__exportStar(require("./use-mongo-file-auth-state"), exports)
|
|
35
|
+
__exportStar(require("./use-single-file-auth-state"), exports)
|
|
36
|
+
__exportStar(require("./use-multi-file-auth-state"), exports)
|
|
37
|
+
__exportStar(require("./link-preview"), exports)
|
|
38
|
+
__exportStar(require("./event-buffer"), exports)
|
|
39
|
+
__exportStar(require("./process-message"), exports)
|
|
40
|
+
__exportStar(require("./message-retry-manager"), exports)
|
|
41
|
+
__exportStar(require("./check-npm-version"), exports)
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { AxiosRequestConfig } from 'axios'
|
|
2
|
+
import { WAMediaUploadFunction, WAUrlInfo } from '../Types'
|
|
3
|
+
import { ILogger } from './logger'
|
|
4
|
+
|
|
3
5
|
export type URLGenerationOptions = {
|
|
4
|
-
thumbnailWidth: number
|
|
6
|
+
thumbnailWidth: number
|
|
5
7
|
fetchOpts: {
|
|
6
8
|
/** Timeout in ms */
|
|
7
|
-
timeout: number
|
|
8
|
-
proxyUrl?: string
|
|
9
|
-
headers?:
|
|
10
|
-
}
|
|
11
|
-
uploadImage?: WAMediaUploadFunction
|
|
12
|
-
logger?: ILogger
|
|
13
|
-
}
|
|
9
|
+
timeout: number
|
|
10
|
+
proxyUrl?: string
|
|
11
|
+
headers?: AxiosRequestConfig<{}>['headers']
|
|
12
|
+
}
|
|
13
|
+
uploadImage?: WAMediaUploadFunction
|
|
14
|
+
logger?: ILogger
|
|
15
|
+
}
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* Given a piece of text, checks for any URL present, generates link preview for the same and returns it
|
|
16
19
|
* Return undefined if the fetch failed or no URL was found
|
|
17
20
|
* @param text first matched URL in text
|
|
18
21
|
* @returns the URL info required to generate link preview
|
|
19
22
|
*/
|
|
20
|
-
export declare const getUrlInfo: (text: string, opts?: URLGenerationOptions) => Promise<WAUrlInfo | undefined
|
|
21
|
-
//# sourceMappingURL=link-preview.d.ts.map
|
|
23
|
+
export declare const getUrlInfo: (text: string, opts?: URLGenerationOptions) => Promise<WAUrlInfo | undefined>
|
|
@@ -1,85 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k] } }
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc)
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k
|
|
12
|
+
o[k2] = m[k]
|
|
13
|
+
}))
|
|
14
|
+
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v })
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod
|
|
23
|
+
var result = {}
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k)
|
|
25
|
+
__setModuleDefault(result, mod)
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
30
|
+
|
|
31
|
+
const messages_1 = require("./messages")
|
|
32
|
+
const messages_media_1 = require("./messages-media")
|
|
33
|
+
const THUMBNAIL_WIDTH_PX = 192
|
|
34
|
+
|
|
4
35
|
/** Fetches an image and generates a thumbnail for it */
|
|
5
36
|
const getCompressedJpegThumbnail = async (url, { thumbnailWidth, fetchOpts }) => {
|
|
6
|
-
const stream = await getHttpStream(url, fetchOpts)
|
|
7
|
-
const result = await extractImageThumb(stream, thumbnailWidth)
|
|
8
|
-
return result
|
|
9
|
-
}
|
|
37
|
+
const stream = await messages_media_1.getHttpStream(url, fetchOpts)
|
|
38
|
+
const result = await messages_media_1.extractImageThumb(stream, thumbnailWidth)
|
|
39
|
+
return result
|
|
40
|
+
}
|
|
41
|
+
|
|
10
42
|
/**
|
|
11
43
|
* Given a piece of text, checks for any URL present, generates link preview for the same and returns it
|
|
12
44
|
* Return undefined if the fetch failed or no URL was found
|
|
13
45
|
* @param text first matched URL in text
|
|
14
46
|
* @returns the URL info required to generate link preview
|
|
15
47
|
*/
|
|
16
|
-
|
|
17
|
-
thumbnailWidth: THUMBNAIL_WIDTH_PX,
|
|
18
|
-
fetchOpts: { timeout: 3000 }
|
|
19
|
-
}) => {
|
|
48
|
+
const getUrlInfo = async (text, opts = { thumbnailWidth: THUMBNAIL_WIDTH_PX, fetchOpts: { timeout: 3000 }}) => {
|
|
20
49
|
try {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
let previewLink = text;
|
|
50
|
+
const retries = 0
|
|
51
|
+
const maxRetry = 5
|
|
52
|
+
const { getLinkPreview } = await Promise.resolve().then(() => __importStar(require('link-preview-js')))
|
|
53
|
+
let previewLink = text
|
|
26
54
|
if (!text.startsWith('https://') && !text.startsWith('http://')) {
|
|
27
|
-
previewLink = 'https://' + previewLink
|
|
55
|
+
previewLink = 'https://' + previewLink
|
|
28
56
|
}
|
|
29
57
|
const info = await getLinkPreview(previewLink, {
|
|
30
58
|
...opts.fetchOpts,
|
|
31
59
|
followRedirects: 'follow',
|
|
32
60
|
handleRedirects: (baseURL, forwardedURL) => {
|
|
33
|
-
const urlObj = new URL(baseURL)
|
|
34
|
-
const forwardedURLObj = new URL(forwardedURL)
|
|
61
|
+
const urlObj = new URL(baseURL)
|
|
62
|
+
const forwardedURLObj = new URL(forwardedURL)
|
|
35
63
|
if (retries >= maxRetry) {
|
|
36
|
-
return false
|
|
64
|
+
return false
|
|
37
65
|
}
|
|
38
|
-
if (forwardedURLObj.hostname === urlObj.hostname
|
|
39
|
-
forwardedURLObj.hostname === 'www.' + urlObj.hostname
|
|
40
|
-
'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
41
|
-
retries + 1
|
|
42
|
-
return true
|
|
66
|
+
if (forwardedURLObj.hostname === urlObj.hostname
|
|
67
|
+
|| forwardedURLObj.hostname === 'www.' + urlObj.hostname
|
|
68
|
+
|| 'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
69
|
+
retries + 1
|
|
70
|
+
return true
|
|
43
71
|
}
|
|
44
72
|
else {
|
|
45
|
-
return false
|
|
73
|
+
return false
|
|
46
74
|
}
|
|
47
75
|
},
|
|
48
|
-
headers: opts.fetchOpts
|
|
49
|
-
})
|
|
76
|
+
headers: opts.fetchOpts
|
|
77
|
+
})
|
|
50
78
|
if (info && 'title' in info && info.title) {
|
|
51
|
-
const [image] = info.images
|
|
79
|
+
const [image] = info.images
|
|
52
80
|
const urlInfo = {
|
|
53
81
|
'canonical-url': info.url,
|
|
54
82
|
'matched-text': text,
|
|
55
83
|
title: info.title,
|
|
56
84
|
description: info.description,
|
|
57
85
|
originalThumbnailUrl: image
|
|
58
|
-
}
|
|
86
|
+
}
|
|
59
87
|
if (opts.uploadImage) {
|
|
60
|
-
const { imageMessage } = await prepareWAMessageMedia({ image: { url: image } }, {
|
|
88
|
+
const { imageMessage } = await messages_1.prepareWAMessageMedia({ image: { url: image } }, {
|
|
61
89
|
upload: opts.uploadImage,
|
|
62
90
|
mediaTypeOverride: 'thumbnail-link',
|
|
63
91
|
options: opts.fetchOpts
|
|
64
|
-
})
|
|
65
|
-
urlInfo.jpegThumbnail = imageMessage?.jpegThumbnail
|
|
66
|
-
|
|
92
|
+
})
|
|
93
|
+
urlInfo.jpegThumbnail = imageMessage?.jpegThumbnail
|
|
94
|
+
? Buffer.from(imageMessage.jpegThumbnail)
|
|
95
|
+
: undefined
|
|
96
|
+
urlInfo.highQualityThumbnail = imageMessage || undefined
|
|
67
97
|
}
|
|
68
98
|
else {
|
|
69
99
|
try {
|
|
70
|
-
urlInfo.jpegThumbnail = image
|
|
100
|
+
urlInfo.jpegThumbnail = image
|
|
101
|
+
? (await getCompressedJpegThumbnail(image, opts)).buffer
|
|
102
|
+
: undefined
|
|
71
103
|
}
|
|
72
104
|
catch (error) {
|
|
73
|
-
opts.logger?.debug({ err: error.stack, url: previewLink }, 'error in generating thumbnail')
|
|
105
|
+
opts.logger?.debug({ err: error.stack, url: previewLink }, 'error in generating thumbnail')
|
|
74
106
|
}
|
|
75
107
|
}
|
|
76
|
-
return urlInfo
|
|
108
|
+
return urlInfo
|
|
77
109
|
}
|
|
78
110
|
}
|
|
79
111
|
catch (error) {
|
|
80
112
|
if (!error.message.includes('receive a valid')) {
|
|
81
|
-
throw error
|
|
113
|
+
throw error
|
|
82
114
|
}
|
|
83
115
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = {
|
|
119
|
+
getUrlInfo
|
|
120
|
+
}
|
package/lib/Utils/logger.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export interface ILogger {
|
|
2
|
-
level: string
|
|
3
|
-
child(obj: Record<string, unknown>): ILogger
|
|
4
|
-
trace(obj: unknown, msg?: string):
|
|
5
|
-
debug(obj: unknown, msg?: string):
|
|
6
|
-
info(obj: unknown, msg?: string):
|
|
7
|
-
warn(obj: unknown, msg?: string):
|
|
8
|
-
error(obj: unknown, msg?: string):
|
|
2
|
+
level: string
|
|
3
|
+
child(obj: Record<string, unknown>): ILogger
|
|
4
|
+
trace(obj: unknown, msg?: string): any
|
|
5
|
+
debug(obj: unknown, msg?: string): any
|
|
6
|
+
info(obj: unknown, msg?: string): any
|
|
7
|
+
warn(obj: unknown, msg?: string): any
|
|
8
|
+
error(obj: unknown, msg?: string): any
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
declare const _default: import("pino").Logger<never, boolean>
|
|
12
|
+
|
|
13
|
+
export default _default
|
package/lib/Utils/logger.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod }
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
6
|
+
const pino_1 = __importDefault(require("pino"))
|
|
7
|
+
exports.default = pino_1.default({ timestamp: () => `,"time":"${new Date().toJSON()}"` })
|
package/lib/Utils/lt-hash.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
declare class
|
|
2
|
-
salt: string
|
|
3
|
-
constructor(e: string)
|
|
4
|
-
add(e:
|
|
5
|
-
subtract(e:
|
|
6
|
-
subtractThenAdd(e:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
declare class d {
|
|
2
|
+
salt: string
|
|
3
|
+
constructor(e: string)
|
|
4
|
+
add(e: any, t: any): any
|
|
5
|
+
subtract(e: any, t: any): any
|
|
6
|
+
subtractThenAdd(e: any, t: any, r: any): any
|
|
7
|
+
_addSingle(e: any, t: any): Promise<ArrayBuffer>
|
|
8
|
+
_subtractSingle(e: any, t: any): Promise<ArrayBuffer>
|
|
9
|
+
performPointwiseWithOverflow(e: any, t: any, r: any): ArrayBuffer
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
11
|
+
|
|
12
|
+
export declare const LT_HASH_ANTI_TAMPERING: d
|
|
13
|
+
|
|
14
|
+
export {}
|