@pontalabs/baileys 1.0.6 → 1.0.7
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/LICENSE +1 -1
- package/README.md +839 -267
- package/WAProto/GenerateStatics.sh +4 -3
- package/WAProto/WAProto.proto +511 -1215
- package/WAProto/index.d.ts +55 -14017
- package/WAProto/index.js +29 -97689
- package/lib/Defaults/index.d.ts +74 -72
- package/lib/Defaults/index.js +108 -94
- package/lib/Signal/Group/ciphertext-message.d.ts +7 -8
- package/lib/Signal/Group/ciphertext-message.js +16 -9
- package/lib/Signal/Group/group-session-builder.d.ts +13 -11
- package/lib/Signal/Group/group-session-builder.js +61 -19
- package/lib/Signal/Group/group_cipher.d.ts +16 -14
- package/lib/Signal/Group/group_cipher.js +70 -41
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +61 -12
- package/lib/Signal/Group/keyhelper.d.ts +14 -9
- package/lib/Signal/Group/keyhelper.js +58 -10
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -13
- package/lib/Signal/Group/sender-chain-key.js +34 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -16
- package/lib/Signal/Group/sender-key-distribution-message.js +36 -28
- package/lib/Signal/Group/sender-key-message.d.ts +18 -18
- package/lib/Signal/Group/sender-key-message.js +45 -38
- package/lib/Signal/Group/sender-key-name.d.ts +15 -14
- package/lib/Signal/Group/sender-key-name.js +31 -20
- package/lib/Signal/Group/sender-key-record.d.ts +25 -24
- package/lib/Signal/Group/sender-key-record.js +35 -18
- package/lib/Signal/Group/sender-key-state.d.ts +34 -29
- package/lib/Signal/Group/sender-key-state.js +100 -37
- package/lib/Signal/Group/sender-message-key.d.ts +10 -11
- package/lib/Signal/Group/sender-message-key.js +22 -15
- package/lib/Signal/libsignal.d.ts +8 -5
- package/lib/Signal/libsignal.js +142 -288
- package/lib/Signal/lid-mapping.d.ts +28 -23
- package/lib/Signal/lid-mapping.js +184 -277
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +22 -3
- 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 +37 -29
- package/lib/Socket/business.d.ts +178 -208
- package/lib/Socket/business.js +127 -91
- package/lib/Socket/chats.d.ts +93 -120
- package/lib/Socket/chats.js +652 -727
- package/lib/Socket/community.js +10 -2
- package/lib/Socket/groups.d.ts +111 -143
- package/lib/Socket/groups.js +186 -165
- package/lib/Socket/index.d.ts +183 -252
- package/lib/Socket/index.js +18 -38
- package/lib/Socket/messages-recv.d.ts +167 -196
- package/lib/Socket/messages-recv.js +1567 -1443
- package/lib/Socket/messages-send.d.ts +158 -192
- package/lib/Socket/messages-send.js +1208 -1102
- package/lib/Socket/newsletter.d.ts +138 -163
- package/lib/Socket/newsletter.js +249 -153
- package/lib/Socket/socket.d.ts +36 -50
- package/lib/Socket/socket.js +820 -749
- package/lib/Store/index.d.ts +4 -4
- package/lib/Store/index.js +24 -4
- package/lib/Store/make-in-memory-store.d.ts +104 -44
- package/lib/Store/make-in-memory-store.js +213 -199
- package/lib/Store/make-ordered-dictionary.d.ts +12 -13
- package/lib/Store/make-ordered-dictionary.js +45 -38
- package/lib/Store/object-repository.d.ts +10 -11
- package/lib/Store/object-repository.js +16 -9
- package/lib/Types/Auth.d.ts +97 -93
- package/lib/Types/Auth.js +3 -2
- package/lib/Types/Bussines.js +3 -2
- package/lib/Types/Call.d.ts +13 -14
- package/lib/Types/Call.js +3 -2
- package/lib/Types/Chat.d.ts +97 -78
- package/lib/Types/Chat.js +9 -8
- package/lib/Types/Contact.d.ts +9 -12
- package/lib/Types/Contact.js +3 -2
- package/lib/Types/Events.d.ts +176 -206
- package/lib/Types/Events.js +3 -2
- package/lib/Types/GroupMetadata.d.ts +48 -53
- 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 +412 -248
- package/lib/Types/Message.js +19 -17
- package/lib/Types/Product.d.ts +71 -58
- package/lib/Types/Product.js +3 -2
- package/lib/Types/Signal.d.ts +82 -71
- package/lib/Types/Signal.js +3 -2
- package/lib/Types/Socket.d.ts +81 -76
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/State.d.ts +19 -75
- package/lib/Types/State.js +14 -56
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.js +3 -2
- package/lib/Types/index.d.ts +62 -47
- package/lib/Types/index.js +50 -26
- package/lib/Utils/auth-utils.d.ts +10 -13
- package/lib/Utils/auth-utils.js +472 -213
- package/lib/Utils/business.d.ts +20 -14
- package/lib/Utils/business.js +134 -110
- package/lib/Utils/chat-utils.d.ts +70 -88
- package/lib/Utils/chat-utils.js +403 -466
- package/lib/Utils/crypto.d.ts +46 -27
- package/lib/Utils/crypto.js +188 -117
- package/lib/Utils/decode-wa-message.d.ts +45 -58
- package/lib/Utils/decode-wa-message.js +311 -212
- package/lib/Utils/event-buffer.d.ts +17 -14
- package/lib/Utils/event-buffer.js +296 -321
- package/lib/Utils/generics.d.ts +92 -66
- package/lib/Utils/generics.js +436 -270
- package/lib/Utils/history.d.ts +23 -24
- package/lib/Utils/history.js +76 -106
- package/lib/Utils/index.d.ts +21 -24
- package/lib/Utils/index.js +41 -24
- 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 +14 -8
- package/lib/Utils/lt-hash.js +53 -3
- package/lib/Utils/make-mutex.d.ts +7 -7
- package/lib/Utils/make-mutex.js +44 -28
- package/lib/Utils/message-retry-manager.d.ts +88 -115
- package/lib/Utils/message-retry-manager.js +160 -265
- package/lib/Utils/messages-media.d.ts +107 -105
- package/lib/Utils/messages-media.js +619 -548
- package/lib/Utils/messages.d.ts +66 -52
- package/lib/Utils/messages.js +1558 -1730
- package/lib/Utils/noise-handler.d.ts +18 -18
- package/lib/Utils/noise-handler.js +130 -176
- package/lib/Utils/process-message.d.ts +32 -43
- package/lib/Utils/process-message.js +282 -484
- package/lib/Utils/rich-message-utils.js +724 -1220
- package/lib/Utils/signal.d.ts +32 -37
- package/lib/Utils/signal.js +105 -140
- package/lib/Utils/use-multi-file-auth-state.d.ts +5 -5
- package/lib/Utils/use-multi-file-auth-state.js +120 -70
- package/lib/Utils/use-single-file-auth-state.d.ts +13 -11
- package/lib/Utils/use-single-file-auth-state.js +66 -92
- package/lib/Utils/validate-connection.d.ts +13 -11
- package/lib/Utils/validate-connection.js +113 -128
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +1292 -1451
- package/lib/WABinary/decode.d.ts +9 -7
- package/lib/WABinary/decode.js +189 -163
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +155 -110
- package/lib/WABinary/generic-utils.d.ts +27 -14
- package/lib/WABinary/generic-utils.js +105 -177
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +25 -6
- package/lib/WABinary/jid-utils.d.ts +54 -41
- package/lib/WABinary/jid-utils.js +152 -83
- 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 +109 -95
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +23 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +21 -37
- 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/USyncStatusProtocol.d.ts +12 -11
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +24 -16
- package/lib/WAUSync/Protocols/index.d.ts +6 -6
- package/lib/WAUSync/Protocols/index.js +26 -6
- package/lib/WAUSync/USyncQuery.d.ts +28 -27
- package/lib/WAUSync/USyncQuery.js +62 -68
- package/lib/WAUSync/USyncUser.d.ts +10 -15
- package/lib/WAUSync/USyncUser.js +19 -20
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +23 -4
- package/lib/index.d.ts +12 -11
- package/lib/index.js +39 -12
- package/package.json +42 -86
- package/engine-requirements.js +0 -10
|
@@ -1,214 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const boom_1 = require("@hapi/boom")
|
|
6
|
+
const WAProto_1 = require("../../WAProto")
|
|
7
|
+
|
|
5
8
|
// some extra useful utilities
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return [];
|
|
10
|
-
let index = indexCache.get(node);
|
|
11
|
-
// Build the index once per node
|
|
12
|
-
if (!index) {
|
|
13
|
-
index = new Map();
|
|
14
|
-
for (const child of node.content) {
|
|
15
|
-
let arr = index.get(child.tag);
|
|
16
|
-
if (!arr)
|
|
17
|
-
index.set(child.tag, (arr = []));
|
|
18
|
-
arr.push(child);
|
|
19
|
-
}
|
|
20
|
-
indexCache.set(node, index);
|
|
9
|
+
const getBinaryNodeChildren = (node, childTag) => {
|
|
10
|
+
if (Array.isArray(node?.content)) {
|
|
11
|
+
return node.content.filter(item => item.tag === childTag)
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return getBinaryNodeChildren(node, childTag)[0];
|
|
27
|
-
};
|
|
28
|
-
export const getAllBinaryNodeChildren = ({ content }) => {
|
|
13
|
+
return []
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getAllBinaryNodeChildren = ({ content }) => {
|
|
29
17
|
if (Array.isArray(content)) {
|
|
30
|
-
return content
|
|
18
|
+
return content
|
|
19
|
+
}
|
|
20
|
+
return []
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const getBinaryNodeChild = (node, childTag) => {
|
|
24
|
+
if (Array.isArray(node?.content)) {
|
|
25
|
+
return node?.content.find(item => item.tag === childTag)
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const child = getBinaryNodeChild(node, childTag)?.content
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const getBinaryNodeChildBuffer = (node, childTag) => {
|
|
30
|
+
const child = getBinaryNodeChild(node, childTag)?.content
|
|
36
31
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
37
|
-
return child
|
|
32
|
+
return child
|
|
38
33
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const getBinaryNodeChildString = (node, childTag) => {
|
|
37
|
+
const child = getBinaryNodeChild(node, childTag)?.content
|
|
42
38
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
43
|
-
return Buffer.from(child).toString('utf-8')
|
|
39
|
+
return Buffer.from(child).toString('utf-8')
|
|
44
40
|
}
|
|
45
41
|
else if (typeof child === 'string') {
|
|
46
|
-
return child
|
|
42
|
+
return child
|
|
47
43
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const getBinaryNodeChildUInt = (node, childTag, length) => {
|
|
47
|
+
const buff = getBinaryNodeChildBuffer(node, childTag)
|
|
51
48
|
if (buff) {
|
|
52
|
-
return bufferToUInt(buff, length)
|
|
49
|
+
return bufferToUInt(buff, length)
|
|
53
50
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const assertNodeErrorFree = (node) => {
|
|
54
|
+
const errNode = getBinaryNodeChild(node, 'error')
|
|
57
55
|
if (errNode) {
|
|
58
|
-
throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code })
|
|
56
|
+
throw new boom_1.Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code })
|
|
59
57
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const reduceBinaryNodeToDictionary = (node, tag) => {
|
|
61
|
+
const nodes = getBinaryNodeChildren(node, tag)
|
|
63
62
|
const dict = nodes.reduce((dict, { attrs }) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return dict;
|
|
73
|
-
};
|
|
74
|
-
export const getBinaryNodeMessages = ({ content }) => {
|
|
75
|
-
const msgs = [];
|
|
63
|
+
dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value
|
|
64
|
+
return dict
|
|
65
|
+
}, {})
|
|
66
|
+
return dict
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const getBinaryNodeMessages = ({ content }) => {
|
|
70
|
+
const msgs = []
|
|
76
71
|
if (Array.isArray(content)) {
|
|
77
72
|
for (const item of content) {
|
|
78
73
|
if (item.tag === 'message') {
|
|
79
|
-
msgs.push(proto.WebMessageInfo.decode(item.content)
|
|
74
|
+
msgs.push(WAProto_1.proto.WebMessageInfo.decode(item.content))
|
|
80
75
|
}
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
|
-
return msgs
|
|
84
|
-
}
|
|
78
|
+
return msgs
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const getBinaryFilteredButtons = (nodeContent) => {
|
|
82
|
+
if (!Array.isArray(nodeContent)) return false
|
|
83
|
+
|
|
84
|
+
return nodeContent.some(a =>
|
|
85
|
+
['native_flow'].includes(a?.content?.[0]?.content?.[0]?.tag) ||
|
|
86
|
+
['interactive', 'buttons', 'list'].includes(a?.content?.[0]?.tag) ||
|
|
87
|
+
['hsm', 'biz'].includes(a?.tag)
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const getBinaryFilteredBizBot = (nodeContent) => {
|
|
92
|
+
if (!Array.isArray(nodeContent)) return false
|
|
93
|
+
|
|
94
|
+
return nodeContent.some(b =>
|
|
95
|
+
['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1'
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
85
99
|
function bufferToUInt(e, t) {
|
|
86
|
-
let a = 0
|
|
100
|
+
let a = 0
|
|
87
101
|
for (let i = 0; i < t; i++) {
|
|
88
|
-
a = 256 * a + e[i]
|
|
102
|
+
a = 256 * a + e[i]
|
|
89
103
|
}
|
|
90
|
-
return a
|
|
104
|
+
return a
|
|
91
105
|
}
|
|
92
|
-
const tabs = (n) => '\t'.repeat(n)
|
|
93
|
-
|
|
106
|
+
const tabs = (n) => '\t'.repeat(n)
|
|
107
|
+
function binaryNodeToString(node, i = 0) {
|
|
94
108
|
if (!node) {
|
|
95
|
-
return node
|
|
109
|
+
return node
|
|
96
110
|
}
|
|
97
111
|
if (typeof node === 'string') {
|
|
98
|
-
return tabs(i) + node
|
|
112
|
+
return tabs(i) + node
|
|
99
113
|
}
|
|
100
114
|
if (node instanceof Uint8Array) {
|
|
101
|
-
return tabs(i) + Buffer.from(node).toString('hex')
|
|
115
|
+
return tabs(i) + Buffer.from(node).toString('hex')
|
|
102
116
|
}
|
|
103
117
|
if (Array.isArray(node)) {
|
|
104
|
-
return node.map(x => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n')
|
|
118
|
+
return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n')
|
|
105
119
|
}
|
|
106
|
-
const children = binaryNodeToString(node.content, i + 1)
|
|
120
|
+
const children = binaryNodeToString(node.content, i + 1)
|
|
107
121
|
const tag = `<${node.tag} ${Object.entries(node.attrs || {})
|
|
108
122
|
.filter(([, v]) => v !== undefined)
|
|
109
123
|
.map(([k, v]) => `${k}='${v}'`)
|
|
110
|
-
.join(' ')}
|
|
111
|
-
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>'
|
|
112
|
-
return tag + content
|
|
124
|
+
.join(' ')}`
|
|
125
|
+
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>'
|
|
126
|
+
return tag + content
|
|
113
127
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
tag: 'list',
|
|
130
|
-
attrs: { v: '2', type: 'product_list' }
|
|
131
|
-
};
|
|
132
|
-
const NATIVE_FLOW_ATTRIBUTE = { type: 'native_flow', v: '1' };
|
|
133
|
-
const MIXED_NATIVE_FLOW = {
|
|
134
|
-
tag: 'interactive',
|
|
135
|
-
attrs: NATIVE_FLOW_ATTRIBUTE,
|
|
136
|
-
content: [
|
|
137
|
-
{
|
|
138
|
-
tag: 'native_flow',
|
|
139
|
-
attrs: { v: '9', name: 'mixed' }
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
};
|
|
143
|
-
export const getBizBinaryNode = (message) => {
|
|
144
|
-
const flowMsg = message.interactiveMessage?.nativeFlowMessage;
|
|
145
|
-
const firstButtonName = flowMsg?.buttons?.[0]?.name;
|
|
146
|
-
const qualityContent = {
|
|
147
|
-
tag: 'quality_control',
|
|
148
|
-
attrs: {
|
|
149
|
-
decision_id: randomBytes(20).toString('hex'),
|
|
150
|
-
source_type: 'third_party'
|
|
151
|
-
},
|
|
152
|
-
content: DECISION_SOURCE_CONTENT
|
|
153
|
-
};
|
|
154
|
-
const bizAttributes = {
|
|
155
|
-
actual_actors: '2',
|
|
156
|
-
host_storage: '2',
|
|
157
|
-
privacy_mode_ts: `${Date.now() / 1_000 | 0}`
|
|
158
|
-
};
|
|
159
|
-
if (firstButtonName === 'review_and_pay' || firstButtonName === 'payment_info') {
|
|
160
|
-
bizAttributes.native_flow_name = firstButtonName === 'review_and_pay' ?
|
|
161
|
-
'order_details' :
|
|
162
|
-
firstButtonName;
|
|
163
|
-
return {
|
|
164
|
-
tag: 'biz',
|
|
165
|
-
attrs: bizAttributes,
|
|
166
|
-
content: [qualityContent]
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
if (firstButtonName && FLOWS_MAP[firstButtonName]) {
|
|
170
|
-
return {
|
|
171
|
-
tag: 'biz',
|
|
172
|
-
attrs: bizAttributes,
|
|
173
|
-
content: [
|
|
174
|
-
{
|
|
175
|
-
tag: 'interactive',
|
|
176
|
-
attrs: NATIVE_FLOW_ATTRIBUTE,
|
|
177
|
-
content: [
|
|
178
|
-
{
|
|
179
|
-
tag: 'native_flow',
|
|
180
|
-
attrs: { v: '2', name: firstButtonName }
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
},
|
|
184
|
-
qualityContent
|
|
185
|
-
]
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
if (flowMsg || message.buttonsMessage || message.templateMessage) {
|
|
189
|
-
return {
|
|
190
|
-
tag: 'biz',
|
|
191
|
-
attrs: bizAttributes,
|
|
192
|
-
content: [
|
|
193
|
-
MIXED_NATIVE_FLOW,
|
|
194
|
-
qualityContent
|
|
195
|
-
]
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (message.listMessage) {
|
|
199
|
-
return {
|
|
200
|
-
tag: 'biz',
|
|
201
|
-
attrs: bizAttributes,
|
|
202
|
-
content: [
|
|
203
|
-
LIST_TYPE_CONTENT,
|
|
204
|
-
qualityContent
|
|
205
|
-
]
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
tag: 'biz',
|
|
210
|
-
attrs: bizAttributes,
|
|
211
|
-
content: [qualityContent]
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
//# sourceMappingURL=generic-utils.js.map
|
|
128
|
+
|
|
129
|
+
module.exports = {
|
|
130
|
+
getBinaryNodeChildren,
|
|
131
|
+
getAllBinaryNodeChildren,
|
|
132
|
+
getBinaryNodeChild,
|
|
133
|
+
getBinaryNodeChildBuffer,
|
|
134
|
+
getBinaryNodeChildString,
|
|
135
|
+
getBinaryNodeChildUInt,
|
|
136
|
+
assertNodeErrorFree,
|
|
137
|
+
reduceBinaryNodeToDictionary,
|
|
138
|
+
getBinaryNodeMessages,
|
|
139
|
+
getBinaryFilteredButtons,
|
|
140
|
+
getBinaryFilteredBizBot,
|
|
141
|
+
binaryNodeToString
|
|
142
|
+
}
|
package/lib/WABinary/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './encode
|
|
2
|
-
export * from './decode
|
|
3
|
-
export * from './generic-utils
|
|
4
|
-
export * from './jid-utils
|
|
5
|
-
export * from './types
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './encode'
|
|
2
|
+
export * from './decode'
|
|
3
|
+
export * from './generic-utils'
|
|
4
|
+
export * from './jid-utils'
|
|
5
|
+
export * from './types'
|
package/lib/WABinary/index.js
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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("./encode"), exports)
|
|
22
|
+
__exportStar(require("./decode"), exports)
|
|
23
|
+
__exportStar(require("./generic-utils"), exports)
|
|
24
|
+
__exportStar(require("./jid-utils"), exports)
|
|
25
|
+
__exportStar(require("./types"), exports)
|
|
@@ -1,48 +1,61 @@
|
|
|
1
|
-
export declare const S_WHATSAPP_NET = "@s.whatsapp.net"
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export declare const S_WHATSAPP_NET = "@s.whatsapp.net"
|
|
2
|
+
|
|
3
|
+
export declare const OFFICIAL_BIZ_JID = "16505361212@c.us"
|
|
4
|
+
|
|
5
|
+
export declare const SERVER_JID = "server@c.us"
|
|
6
|
+
|
|
7
|
+
export declare const PSA_WID = "0@c.us"
|
|
8
|
+
|
|
9
|
+
export declare const STORIES_JID = "status@broadcast"
|
|
10
|
+
|
|
11
|
+
export declare const META_AI_JID = '13135550002@c.us'
|
|
12
|
+
|
|
13
|
+
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid' | 'newsletter' | 'bot'
|
|
14
|
+
|
|
14
15
|
export type JidWithDevice = {
|
|
15
|
-
user: string
|
|
16
|
-
device?: number
|
|
17
|
-
}
|
|
16
|
+
user: string
|
|
17
|
+
device?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
export type FullJid = JidWithDevice & {
|
|
19
|
-
server: JidServer
|
|
20
|
-
domainType?: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
server: JidServer
|
|
22
|
+
domainType?: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string
|
|
26
|
+
|
|
27
|
+
export declare const jidDecode: (jid: string | undefined) => FullJid | undefined
|
|
28
|
+
|
|
27
29
|
/** is the jid Meta AI */
|
|
28
|
-
export declare const isJidMetaAI: (jid: string | undefined) => boolean | undefined
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export declare const isJidMetaAI: (jid: string | undefined) => boolean | undefined
|
|
31
|
+
|
|
32
|
+
/** is the jid a user */
|
|
33
|
+
export declare const areJidsSameUser: (jid1: string | undefined, jid2: string | undefined) => boolean
|
|
34
|
+
|
|
35
|
+
/** is the lid a user */
|
|
36
|
+
export declare const isJidUser: (jid: string | undefined) => boolean | undefined
|
|
37
|
+
|
|
38
|
+
/** is the jid a group */
|
|
39
|
+
export declare const isLidUser: (jid: string | undefined) => boolean | undefined
|
|
40
|
+
|
|
33
41
|
/** is the jid a broadcast */
|
|
34
|
-
export declare const isJidBroadcast: (jid: string | undefined) => boolean | undefined
|
|
42
|
+
export declare const isJidBroadcast: (jid: string | undefined) => boolean | undefined
|
|
43
|
+
|
|
35
44
|
/** is the jid a group */
|
|
36
|
-
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined
|
|
45
|
+
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined
|
|
46
|
+
|
|
37
47
|
/** is the jid the status broadcast */
|
|
38
|
-
export declare const isJidStatusBroadcast: (jid: string) =>
|
|
48
|
+
export declare const isJidStatusBroadcast: (jid: string) => boolean
|
|
49
|
+
|
|
39
50
|
/** is the jid a newsletter */
|
|
40
|
-
export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export declare const
|
|
46
|
-
|
|
47
|
-
export declare const transferDevice: (fromJid: string, toJid: string) => string
|
|
48
|
-
|
|
51
|
+
export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined
|
|
52
|
+
|
|
53
|
+
/** is the jid a bot */
|
|
54
|
+
export declare const isJidBot: (jid: string | undefined) => boolean | undefined
|
|
55
|
+
|
|
56
|
+
export declare const jidNormalizedUser: (jid: string | undefined) => string
|
|
57
|
+
|
|
58
|
+
export declare const transferDevice: (fromJid: string, toJid: string) => string
|
|
59
|
+
|
|
60
|
+
/** pisahkan dua kandidat identitas jadi { jid, lid } berdasarkan suffix domain-nya */
|
|
61
|
+
export declare const splitJidLid: (a: string | undefined, b: string | undefined) => { jid: string | undefined, lid: string | undefined }
|