@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/WAM/encode.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.encodeWAM = void 0;
|
|
7
|
+
var _BinaryInfo = require("./BinaryInfo.js");
|
|
8
|
+
var _constants = require("./constants.js");
|
|
3
9
|
const getHeaderBitLength = key => key < 256 ? 2 : 3;
|
|
4
|
-
|
|
10
|
+
const encodeWAM = binaryInfo => {
|
|
5
11
|
binaryInfo.buffer = [];
|
|
6
12
|
encodeWAMHeader(binaryInfo);
|
|
7
13
|
encodeEvents(binaryInfo);
|
|
@@ -14,6 +20,7 @@ export const encodeWAM = binaryInfo => {
|
|
|
14
20
|
}
|
|
15
21
|
return buffer;
|
|
16
22
|
};
|
|
23
|
+
exports.encodeWAM = encodeWAM;
|
|
17
24
|
function encodeWAMHeader(binaryInfo) {
|
|
18
25
|
const headerBuffer = Buffer.alloc(8); // starting buffer
|
|
19
26
|
headerBuffer.write('WAM', 0, 'utf8');
|
|
@@ -25,12 +32,12 @@ function encodeWAMHeader(binaryInfo) {
|
|
|
25
32
|
}
|
|
26
33
|
function encodeGlobalAttributes(binaryInfo, globals) {
|
|
27
34
|
for (const [key, _value] of Object.entries(globals)) {
|
|
28
|
-
const id = WEB_GLOBALS.find(a => a?.name === key).id;
|
|
35
|
+
const id = _constants.WEB_GLOBALS.find(a => a?.name === key).id;
|
|
29
36
|
let value = _value;
|
|
30
37
|
if (typeof value === 'boolean') {
|
|
31
38
|
value = value ? 1 : 0;
|
|
32
39
|
}
|
|
33
|
-
binaryInfo.buffer.push(serializeData(id, value, FLAG_GLOBAL));
|
|
40
|
+
binaryInfo.buffer.push(serializeData(id, value, _constants.FLAG_GLOBAL));
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
function encodeEvents(binaryInfo) {
|
|
@@ -39,13 +46,13 @@ function encodeEvents(binaryInfo) {
|
|
|
39
46
|
globals
|
|
40
47
|
}] of binaryInfo.events.map(a => Object.entries(a)[0])) {
|
|
41
48
|
encodeGlobalAttributes(binaryInfo, globals);
|
|
42
|
-
const event = WEB_EVENTS.find(a => a.name === name);
|
|
49
|
+
const event = _constants.WEB_EVENTS.find(a => a.name === name);
|
|
43
50
|
const props_ = Object.entries(props);
|
|
44
51
|
let extended = false;
|
|
45
52
|
for (const [, value] of props_) {
|
|
46
53
|
extended || (extended = value !== null);
|
|
47
54
|
}
|
|
48
|
-
const eventFlag = extended ? FLAG_EVENT : FLAG_EVENT | FLAG_EXTENDED;
|
|
55
|
+
const eventFlag = extended ? _constants.FLAG_EVENT : _constants.FLAG_EVENT | _constants.FLAG_EXTENDED;
|
|
49
56
|
binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag));
|
|
50
57
|
for (let i = 0; i < props_.length; i++) {
|
|
51
58
|
const [key, _value] = props_[i];
|
|
@@ -55,7 +62,7 @@ function encodeEvents(binaryInfo) {
|
|
|
55
62
|
if (typeof value === 'boolean') {
|
|
56
63
|
value = value ? 1 : 0;
|
|
57
64
|
}
|
|
58
|
-
const fieldFlag = extended ? FLAG_EVENT : FLAG_FIELD | FLAG_EXTENDED;
|
|
65
|
+
const fieldFlag = extended ? _constants.FLAG_EVENT : _constants.FLAG_FIELD | _constants.FLAG_EXTENDED;
|
|
59
66
|
binaryInfo.buffer.push(serializeData(id, value, fieldFlag));
|
|
60
67
|
}
|
|
61
68
|
}
|
|
@@ -65,7 +72,7 @@ function serializeData(key, value, flag) {
|
|
|
65
72
|
let buffer;
|
|
66
73
|
let offset = 0;
|
|
67
74
|
if (value === null) {
|
|
68
|
-
if (flag === FLAG_GLOBAL) {
|
|
75
|
+
if (flag === _constants.FLAG_GLOBAL) {
|
|
69
76
|
buffer = Buffer.alloc(bufferLength);
|
|
70
77
|
offset = serializeHeader(buffer, offset, key, flag);
|
|
71
78
|
return buffer;
|
|
@@ -133,7 +140,7 @@ function serializeHeader(buffer, offset, key, flag) {
|
|
|
133
140
|
buffer.writeUInt8(key, offset);
|
|
134
141
|
offset += 1;
|
|
135
142
|
} else {
|
|
136
|
-
buffer.writeUInt8(flag | FLAG_BYTE, offset);
|
|
143
|
+
buffer.writeUInt8(flag | _constants.FLAG_BYTE, offset);
|
|
137
144
|
offset += 1;
|
|
138
145
|
buffer.writeUInt16LE(key, offset);
|
|
139
146
|
offset += 2;
|
package/lib/WAM/index.js
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _constants = require("./constants.js");
|
|
7
|
+
Object.keys(_constants).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _constants[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _encode = require("./encode.js");
|
|
18
|
+
Object.keys(_encode).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _encode[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _encode[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _BinaryInfo = require("./BinaryInfo.js");
|
|
29
|
+
Object.keys(_BinaryInfo).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _BinaryInfo[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _BinaryInfo[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncContactProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
8
|
+
var _USyncUser = require("../USyncUser.js");
|
|
9
|
+
class USyncContactProtocol {
|
|
4
10
|
constructor() {
|
|
5
11
|
this.name = 'contact';
|
|
6
12
|
}
|
|
@@ -20,10 +26,11 @@ export class USyncContactProtocol {
|
|
|
20
26
|
}
|
|
21
27
|
parser(node) {
|
|
22
28
|
if (node.tag === 'contact') {
|
|
23
|
-
assertNodeErrorFree(node);
|
|
29
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
24
30
|
return node?.attrs?.type === 'in';
|
|
25
31
|
}
|
|
26
32
|
return false;
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
|
-
//# sourceMappingURL=USyncContactProtocol.js.map
|
|
35
|
+
//# sourceMappingURL=USyncContactProtocol.js.map
|
|
36
|
+
exports.USyncContactProtocol = USyncContactProtocol;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncDeviceProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
8
|
+
class USyncDeviceProtocol {
|
|
3
9
|
constructor() {
|
|
4
10
|
this.name = 'devices';
|
|
5
11
|
}
|
|
@@ -22,9 +28,9 @@ export class USyncDeviceProtocol {
|
|
|
22
28
|
const deviceList = [];
|
|
23
29
|
let keyIndex = undefined;
|
|
24
30
|
if (node.tag === 'devices') {
|
|
25
|
-
assertNodeErrorFree(node);
|
|
26
|
-
const deviceListNode = getBinaryNodeChild(node, 'device-list');
|
|
27
|
-
const keyIndexNode = getBinaryNodeChild(node, 'key-index-list');
|
|
31
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
32
|
+
const deviceListNode = (0, _index.getBinaryNodeChild)(node, 'device-list');
|
|
33
|
+
const keyIndexNode = (0, _index.getBinaryNodeChild)(node, 'key-index-list');
|
|
28
34
|
if (Array.isArray(deviceListNode?.content)) {
|
|
29
35
|
for (const {
|
|
30
36
|
tag,
|
|
@@ -55,4 +61,5 @@ export class USyncDeviceProtocol {
|
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
|
-
//# sourceMappingURL=USyncDeviceProtocol.js.map
|
|
64
|
+
//# sourceMappingURL=USyncDeviceProtocol.js.map
|
|
65
|
+
exports.USyncDeviceProtocol = USyncDeviceProtocol;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncDisappearingModeProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
8
|
+
class USyncDisappearingModeProtocol {
|
|
3
9
|
constructor() {
|
|
4
10
|
this.name = 'disappearing_mode';
|
|
5
11
|
}
|
|
@@ -14,7 +20,7 @@ export class USyncDisappearingModeProtocol {
|
|
|
14
20
|
}
|
|
15
21
|
parser(node) {
|
|
16
22
|
if (node.tag === 'disappearing_mode') {
|
|
17
|
-
assertNodeErrorFree(node);
|
|
23
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
18
24
|
const duration = +node?.attrs.duration;
|
|
19
25
|
const setAt = new Date(+(node?.attrs.t || 0) * 1000);
|
|
20
26
|
return {
|
|
@@ -24,4 +30,5 @@ export class USyncDisappearingModeProtocol {
|
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
|
-
//# sourceMappingURL=USyncDisappearingModeProtocol.js.map
|
|
33
|
+
//# sourceMappingURL=USyncDisappearingModeProtocol.js.map
|
|
34
|
+
exports.USyncDisappearingModeProtocol = USyncDisappearingModeProtocol;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncStatusProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
8
|
+
class USyncStatusProtocol {
|
|
3
9
|
constructor() {
|
|
4
10
|
this.name = 'status';
|
|
5
11
|
}
|
|
@@ -14,7 +20,7 @@ export class USyncStatusProtocol {
|
|
|
14
20
|
}
|
|
15
21
|
parser(node) {
|
|
16
22
|
if (node.tag === 'status') {
|
|
17
|
-
assertNodeErrorFree(node);
|
|
23
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
18
24
|
let status = node?.content?.toString() ?? null;
|
|
19
25
|
const setAt = new Date(+(node?.attrs.t || 0) * 1000);
|
|
20
26
|
if (!status) {
|
|
@@ -33,4 +39,5 @@ export class USyncStatusProtocol {
|
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
//# sourceMappingURL=USyncStatusProtocol.js.map
|
|
42
|
+
//# sourceMappingURL=USyncStatusProtocol.js.map
|
|
43
|
+
exports.USyncStatusProtocol = USyncStatusProtocol;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncUsernameProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
2
8
|
// Look up a user's WhatsApp username via a USync query.
|
|
3
9
|
// Mirrors the existing protocol files (UsyncLIDProtocol.js etc) in this folder.
|
|
4
|
-
|
|
10
|
+
class USyncUsernameProtocol {
|
|
5
11
|
constructor() {
|
|
6
12
|
this.name = 'username';
|
|
7
13
|
}
|
|
@@ -16,9 +22,10 @@ export class USyncUsernameProtocol {
|
|
|
16
22
|
}
|
|
17
23
|
parser(node) {
|
|
18
24
|
if (node.tag === 'username') {
|
|
19
|
-
assertNodeErrorFree(node);
|
|
25
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
20
26
|
return typeof node.content === 'string' ? node.content : null;
|
|
21
27
|
}
|
|
22
28
|
return null;
|
|
23
29
|
}
|
|
24
|
-
}
|
|
30
|
+
}
|
|
31
|
+
exports.USyncUsernameProtocol = USyncUsernameProtocol;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncBotProfileProtocol = void 0;
|
|
7
|
+
var _index = require("../../WABinary/index.js");
|
|
8
|
+
var _USyncUser = require("../USyncUser.js");
|
|
9
|
+
class USyncBotProfileProtocol {
|
|
4
10
|
constructor() {
|
|
5
11
|
this.name = 'bot';
|
|
6
12
|
}
|
|
@@ -29,33 +35,34 @@ export class USyncBotProfileProtocol {
|
|
|
29
35
|
};
|
|
30
36
|
}
|
|
31
37
|
parser(node) {
|
|
32
|
-
const botNode = getBinaryNodeChild(node, 'bot');
|
|
33
|
-
const profile = getBinaryNodeChild(botNode, 'profile');
|
|
34
|
-
const commandsNode = getBinaryNodeChild(profile, 'commands');
|
|
35
|
-
const promptsNode = getBinaryNodeChild(profile, 'prompts');
|
|
38
|
+
const botNode = (0, _index.getBinaryNodeChild)(node, 'bot');
|
|
39
|
+
const profile = (0, _index.getBinaryNodeChild)(botNode, 'profile');
|
|
40
|
+
const commandsNode = (0, _index.getBinaryNodeChild)(profile, 'commands');
|
|
41
|
+
const promptsNode = (0, _index.getBinaryNodeChild)(profile, 'prompts');
|
|
36
42
|
const commands = [];
|
|
37
43
|
const prompts = [];
|
|
38
|
-
for (const command of getBinaryNodeChildren(commandsNode, 'command')) {
|
|
44
|
+
for (const command of (0, _index.getBinaryNodeChildren)(commandsNode, 'command')) {
|
|
39
45
|
commands.push({
|
|
40
|
-
name: getBinaryNodeChildString(command, 'name'),
|
|
41
|
-
description: getBinaryNodeChildString(command, 'description')
|
|
46
|
+
name: (0, _index.getBinaryNodeChildString)(command, 'name'),
|
|
47
|
+
description: (0, _index.getBinaryNodeChildString)(command, 'description')
|
|
42
48
|
});
|
|
43
49
|
}
|
|
44
|
-
for (const prompt of getBinaryNodeChildren(promptsNode, 'prompt')) {
|
|
45
|
-
prompts.push(`${getBinaryNodeChildString(prompt, 'emoji')} ${getBinaryNodeChildString(prompt, 'text')}`);
|
|
50
|
+
for (const prompt of (0, _index.getBinaryNodeChildren)(promptsNode, 'prompt')) {
|
|
51
|
+
prompts.push(`${(0, _index.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, _index.getBinaryNodeChildString)(prompt, 'text')}`);
|
|
46
52
|
}
|
|
47
53
|
return {
|
|
48
|
-
isDefault: !!getBinaryNodeChild(profile, 'default'),
|
|
54
|
+
isDefault: !!(0, _index.getBinaryNodeChild)(profile, 'default'),
|
|
49
55
|
jid: node.attrs.jid,
|
|
50
|
-
name: getBinaryNodeChildString(profile, 'name'),
|
|
51
|
-
attributes: getBinaryNodeChildString(profile, 'attributes'),
|
|
52
|
-
description: getBinaryNodeChildString(profile, 'description'),
|
|
53
|
-
category: getBinaryNodeChildString(profile, 'category'),
|
|
56
|
+
name: (0, _index.getBinaryNodeChildString)(profile, 'name'),
|
|
57
|
+
attributes: (0, _index.getBinaryNodeChildString)(profile, 'attributes'),
|
|
58
|
+
description: (0, _index.getBinaryNodeChildString)(profile, 'description'),
|
|
59
|
+
category: (0, _index.getBinaryNodeChildString)(profile, 'category'),
|
|
54
60
|
personaId: profile.attrs['persona_id'],
|
|
55
|
-
commandsDescription: getBinaryNodeChildString(commandsNode, 'description'),
|
|
61
|
+
commandsDescription: (0, _index.getBinaryNodeChildString)(commandsNode, 'description'),
|
|
56
62
|
commands,
|
|
57
63
|
prompts
|
|
58
64
|
};
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
|
-
//# sourceMappingURL=UsyncBotProfileProtocol.js.map
|
|
67
|
+
//# sourceMappingURL=UsyncBotProfileProtocol.js.map
|
|
68
|
+
exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncLIDProtocol = void 0;
|
|
7
|
+
class USyncLIDProtocol {
|
|
2
8
|
constructor() {
|
|
3
9
|
this.name = 'lid';
|
|
4
10
|
}
|
|
@@ -18,4 +24,5 @@ export class USyncLIDProtocol {
|
|
|
18
24
|
return null;
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
|
-
//# sourceMappingURL=UsyncLIDProtocol.js.map
|
|
27
|
+
//# sourceMappingURL=UsyncLIDProtocol.js.map
|
|
28
|
+
exports.USyncLIDProtocol = USyncLIDProtocol;
|
|
@@ -1,6 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _USyncDeviceProtocol = require("./USyncDeviceProtocol.js");
|
|
7
|
+
Object.keys(_USyncDeviceProtocol).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _USyncDeviceProtocol[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _USyncDeviceProtocol[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _USyncContactProtocol = require("./USyncContactProtocol.js");
|
|
18
|
+
Object.keys(_USyncContactProtocol).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _USyncContactProtocol[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _USyncContactProtocol[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _USyncStatusProtocol = require("./USyncStatusProtocol.js");
|
|
29
|
+
Object.keys(_USyncStatusProtocol).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _USyncStatusProtocol[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _USyncStatusProtocol[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _USyncDisappearingModeProtocol = require("./USyncDisappearingModeProtocol.js");
|
|
40
|
+
Object.keys(_USyncDisappearingModeProtocol).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _USyncDisappearingModeProtocol[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _USyncDisappearingModeProtocol[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _USyncUsernameProtocol = require("./USyncUsernameProtocol.js");
|
|
51
|
+
Object.keys(_USyncUsernameProtocol).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _USyncUsernameProtocol[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _USyncUsernameProtocol[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncQuery = void 0;
|
|
7
|
+
var _index = require("../WABinary/index.js");
|
|
8
|
+
var _UsyncBotProfileProtocol = require("./Protocols/UsyncBotProfileProtocol.js");
|
|
9
|
+
var _UsyncLIDProtocol = require("./Protocols/UsyncLIDProtocol.js");
|
|
10
|
+
var _USyncUsernameProtocol = require("./Protocols/USyncUsernameProtocol.js");
|
|
11
|
+
var _index2 = require("./Protocols/index.js");
|
|
12
|
+
var _USyncUser = require("./USyncUser.js");
|
|
13
|
+
class USyncQuery {
|
|
8
14
|
constructor() {
|
|
9
15
|
this.protocols = [];
|
|
10
16
|
this.users = [];
|
|
@@ -35,11 +41,11 @@ export class USyncQuery {
|
|
|
35
41
|
list: [],
|
|
36
42
|
sideList: []
|
|
37
43
|
};
|
|
38
|
-
const usyncNode = getBinaryNodeChild(result, 'usync');
|
|
44
|
+
const usyncNode = (0, _index.getBinaryNodeChild)(result, 'usync');
|
|
39
45
|
//TODO: implement error backoff, refresh etc.
|
|
40
46
|
//TODO: see if there are any errors in the result node
|
|
41
47
|
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
|
42
|
-
const listNode = getBinaryNodeChild(usyncNode, 'list');
|
|
48
|
+
const listNode = (0, _index.getBinaryNodeChild)(usyncNode, 'list');
|
|
43
49
|
if (Array.isArray(listNode?.content) && typeof listNode !== 'undefined') {
|
|
44
50
|
queryResult.list = listNode.content.map(node => {
|
|
45
51
|
const id = node?.attrs.jid;
|
|
@@ -63,32 +69,33 @@ export class USyncQuery {
|
|
|
63
69
|
return queryResult;
|
|
64
70
|
}
|
|
65
71
|
withDeviceProtocol() {
|
|
66
|
-
this.protocols.push(new USyncDeviceProtocol());
|
|
72
|
+
this.protocols.push(new _index2.USyncDeviceProtocol());
|
|
67
73
|
return this;
|
|
68
74
|
}
|
|
69
75
|
withContactProtocol() {
|
|
70
|
-
this.protocols.push(new USyncContactProtocol());
|
|
76
|
+
this.protocols.push(new _index2.USyncContactProtocol());
|
|
71
77
|
return this;
|
|
72
78
|
}
|
|
73
79
|
withStatusProtocol() {
|
|
74
|
-
this.protocols.push(new USyncStatusProtocol());
|
|
80
|
+
this.protocols.push(new _index2.USyncStatusProtocol());
|
|
75
81
|
return this;
|
|
76
82
|
}
|
|
77
83
|
withDisappearingModeProtocol() {
|
|
78
|
-
this.protocols.push(new USyncDisappearingModeProtocol());
|
|
84
|
+
this.protocols.push(new _index2.USyncDisappearingModeProtocol());
|
|
79
85
|
return this;
|
|
80
86
|
}
|
|
81
87
|
withBotProfileProtocol() {
|
|
82
|
-
this.protocols.push(new USyncBotProfileProtocol());
|
|
88
|
+
this.protocols.push(new _UsyncBotProfileProtocol.USyncBotProfileProtocol());
|
|
83
89
|
return this;
|
|
84
90
|
}
|
|
85
91
|
withLIDProtocol() {
|
|
86
|
-
this.protocols.push(new USyncLIDProtocol());
|
|
92
|
+
this.protocols.push(new _UsyncLIDProtocol.USyncLIDProtocol());
|
|
87
93
|
return this;
|
|
88
94
|
}
|
|
89
95
|
withUsernameProtocol() {
|
|
90
|
-
this.protocols.push(new USyncUsernameProtocol());
|
|
96
|
+
this.protocols.push(new _USyncUsernameProtocol.USyncUsernameProtocol());
|
|
91
97
|
return this;
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
//# sourceMappingURL=USyncQuery.js.map
|
|
100
|
+
//# sourceMappingURL=USyncQuery.js.map
|
|
101
|
+
exports.USyncQuery = USyncQuery;
|
package/lib/WAUSync/USyncUser.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.USyncUser = void 0;
|
|
7
|
+
class USyncUser {
|
|
2
8
|
withId(id) {
|
|
3
9
|
this.id = id;
|
|
4
10
|
return this;
|
|
@@ -20,4 +26,5 @@ export class USyncUser {
|
|
|
20
26
|
return this;
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
|
-
//# sourceMappingURL=USyncUser.js.map
|
|
29
|
+
//# sourceMappingURL=USyncUser.js.map
|
|
30
|
+
exports.USyncUser = USyncUser;
|
package/lib/WAUSync/index.js
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _index = require("./Protocols/index.js");
|
|
7
|
+
Object.keys(_index).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _index[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _USyncQuery = require("./USyncQuery.js");
|
|
18
|
+
Object.keys(_USyncQuery).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _USyncQuery[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _USyncQuery[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _USyncUser = require("./USyncUser.js");
|
|
29
|
+
Object.keys(_USyncUser).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _USyncUser[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _USyncUser[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|