@hbmodsofc/baileys 1.7.8 → 2.2.0
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/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +8 -12
- package/lib/Defaults/index.js +124 -90
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/group_cipher.d.ts +1 -0
- package/lib/Signal/Group/group_cipher.js +39 -28
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
- package/lib/Signal/Group/sender-chain-key.js +2 -9
- package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
- package/lib/Signal/Group/sender-key-message.js +3 -3
- package/lib/Signal/Group/sender-key-state.d.ts +4 -4
- package/lib/Signal/Group/sender-key-state.js +16 -47
- package/lib/Signal/libsignal.d.ts +3 -7
- package/lib/Signal/libsignal.js +39 -224
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +3 -1
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +16 -10
- package/lib/Socket/business.d.ts +78 -94
- package/lib/Socket/business.js +11 -130
- package/lib/Socket/chats.d.ts +233 -63
- package/lib/Socket/chats.js +184 -234
- package/lib/Socket/groups.d.ts +41 -62
- package/lib/Socket/groups.js +64 -76
- package/lib/Socket/hbmods.d.ts +253 -0
- package/lib/Socket/hbmods.js +1 -0
- package/lib/Socket/index.d.ts +83 -129
- package/lib/Socket/index.js +6 -13
- package/lib/Socket/messages-recv.d.ts +48 -59
- package/lib/Socket/messages-recv.js +371 -516
- package/lib/Socket/messages-send.d.ts +67 -86
- package/lib/Socket/messages-send.js +1 -1091
- package/lib/Socket/newsletter.d.ts +64 -76
- package/lib/Socket/newsletter.js +1 -184
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +13 -19
- package/lib/Socket/socket.js +1 -805
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Types/Auth.d.ts +10 -4
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +9 -29
- package/lib/Types/Chat.js +1 -7
- package/lib/Types/Contact.d.ts +1 -5
- package/lib/Types/Events.d.ts +14 -55
- package/lib/Types/GroupMetadata.d.ts +5 -15
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +49 -75
- package/lib/Types/Message.js +7 -10
- package/lib/Types/Newsletter.d.ts +98 -129
- package/lib/Types/Newsletter.js +38 -33
- package/lib/Types/Product.d.ts +1 -1
- package/lib/Types/Signal.d.ts +1 -29
- package/lib/Types/Socket.d.ts +22 -48
- package/lib/Types/State.d.ts +2 -13
- package/lib/Types/State.js +0 -12
- package/lib/Types/USync.d.ts +1 -1
- package/lib/Types/index.d.ts +3 -10
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +102 -378
- package/lib/Utils/baileys-event-stream.js +1 -1
- package/lib/Utils/business.d.ts +2 -2
- package/lib/Utils/business.js +13 -19
- package/lib/Utils/chat-utils.d.ts +22 -21
- package/lib/Utils/chat-utils.js +154 -201
- package/lib/Utils/crypto.d.ts +19 -18
- package/lib/Utils/crypto.js +37 -78
- package/lib/Utils/decode-wa-message.d.ts +7 -34
- package/lib/Utils/decode-wa-message.js +66 -138
- package/lib/Utils/event-buffer.d.ts +8 -6
- package/lib/Utils/event-buffer.js +43 -81
- package/lib/Utils/generics.d.ts +27 -27
- package/lib/Utils/generics.js +133 -128
- package/lib/Utils/history.d.ts +5 -9
- package/lib/Utils/history.js +23 -17
- package/lib/Utils/index.d.ts +0 -2
- package/lib/Utils/index.js +0 -2
- package/lib/Utils/link-preview.d.ts +4 -4
- package/lib/Utils/link-preview.js +12 -40
- package/lib/Utils/logger.d.ts +3 -11
- package/lib/Utils/lt-hash.d.ts +8 -8
- package/lib/Utils/lt-hash.js +24 -23
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/make-mutex.js +2 -3
- package/lib/Utils/messages-media.d.ts +41 -37
- package/lib/Utils/messages-media.js +368 -252
- package/lib/Utils/messages.d.ts +15 -13
- package/lib/Utils/messages.js +261 -274
- package/lib/Utils/noise-handler.d.ts +15 -13
- package/lib/Utils/noise-handler.js +26 -20
- package/lib/Utils/process-message.d.ts +8 -9
- package/lib/Utils/process-message.js +93 -157
- package/lib/Utils/signal.d.ts +5 -6
- package/lib/Utils/signal.js +29 -37
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
- package/lib/Utils/use-multi-file-auth-state.js +7 -12
- package/lib/Utils/validate-connection.d.ts +6 -5
- package/lib/Utils/validate-connection.js +97 -39
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/constants.js +13 -1276
- package/lib/WABinary/decode.d.ts +4 -3
- package/lib/WABinary/decode.js +14 -28
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +147 -134
- package/lib/WABinary/generic-utils.d.ts +7 -4
- package/lib/WABinary/generic-utils.js +125 -40
- package/lib/WABinary/jid-utils.d.ts +8 -13
- package/lib/WABinary/jid-utils.js +16 -27
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/constants.d.ts +2 -3
- package/lib/WAM/constants.js +2359 -2252
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAM/encode.js +11 -8
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +4 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -5
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +5 -5
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +6 -5
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +3 -11
- package/lib/WAUSync/USyncQuery.d.ts +2 -2
- package/lib/WAUSync/USyncQuery.js +15 -19
- package/lib/WAUSync/USyncUser.d.ts +5 -5
- package/lib/WAUSync/index.d.ts +1 -1
- package/lib/WAUSync/index.js +1 -1
- package/package.json +102 -104
- package/WAProto/index.js +0 -37306
- package/lib/Signal/lid-mapping.d.ts +0 -26
- package/lib/Signal/lid-mapping.js +0 -146
- package/lib/Socket/communities.d.ts +0 -232
- package/lib/Socket/communities.js +0 -402
- package/lib/Socket/mex.d.ts +0 -2
- package/lib/Socket/mex.js +0 -45
- package/lib/Types/Bussines.d.ts +0 -24
- package/lib/Types/Bussines.js +0 -2
- package/lib/Utils/lidToJid-test.d.ts +0 -11
- package/lib/Utils/lidToJid-test.js +0 -27
- package/lib/Utils/message-retry-manager.d.ts +0 -81
- package/lib/Utils/message-retry-manager.js +0 -152
- /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
|
@@ -21,22 +21,19 @@ const BUFFERABLE_EVENT = [
|
|
|
21
21
|
'messages.delete',
|
|
22
22
|
'messages.reaction',
|
|
23
23
|
'message-receipt.update',
|
|
24
|
-
'groups.update'
|
|
24
|
+
'groups.update',
|
|
25
25
|
];
|
|
26
26
|
const BUFFERABLE_EVENT_SET = new Set(BUFFERABLE_EVENT);
|
|
27
27
|
/**
|
|
28
28
|
* The event buffer logically consolidates different events into a single event
|
|
29
29
|
* making the data processing more efficient.
|
|
30
|
+
* @param ev the baileys event emitter
|
|
30
31
|
*/
|
|
31
32
|
const makeEventBuffer = (logger) => {
|
|
32
33
|
const ev = new events_1.default();
|
|
33
34
|
const historyCache = new Set();
|
|
34
35
|
let data = makeBufferData();
|
|
35
|
-
let
|
|
36
|
-
let bufferTimeout = null;
|
|
37
|
-
let bufferCount = 0;
|
|
38
|
-
const MAX_HISTORY_CACHE_SIZE = 10000; // Limit the history cache size to prevent memory bloat
|
|
39
|
-
const BUFFER_TIMEOUT_MS = 30000; // 30 seconds
|
|
36
|
+
let buffersInProgress = 0;
|
|
40
37
|
// take the generic event and fire it as a baileys event
|
|
41
38
|
ev.on('event', (map) => {
|
|
42
39
|
for (const event in map) {
|
|
@@ -44,44 +41,25 @@ const makeEventBuffer = (logger) => {
|
|
|
44
41
|
}
|
|
45
42
|
});
|
|
46
43
|
function buffer() {
|
|
47
|
-
|
|
48
|
-
logger.debug('Event buffer activated');
|
|
49
|
-
isBuffering = true;
|
|
50
|
-
bufferCount++;
|
|
51
|
-
// Auto-flush after a timeout to prevent infinite buffering
|
|
52
|
-
if (bufferTimeout) {
|
|
53
|
-
clearTimeout(bufferTimeout);
|
|
54
|
-
}
|
|
55
|
-
bufferTimeout = setTimeout(() => {
|
|
56
|
-
if (isBuffering) {
|
|
57
|
-
logger.warn('Buffer timeout reached, auto-flushing');
|
|
58
|
-
flush();
|
|
59
|
-
}
|
|
60
|
-
}, BUFFER_TIMEOUT_MS);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
bufferCount++;
|
|
64
|
-
}
|
|
44
|
+
buffersInProgress += 1;
|
|
65
45
|
}
|
|
66
|
-
function flush() {
|
|
67
|
-
|
|
46
|
+
function flush(force = false) {
|
|
47
|
+
// no buffer going on
|
|
48
|
+
if (!buffersInProgress) {
|
|
68
49
|
return false;
|
|
69
50
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// Clear history cache if it exceeds the max size
|
|
79
|
-
if (historyCache.size > MAX_HISTORY_CACHE_SIZE) {
|
|
80
|
-
logger.debug({ cacheSize: historyCache.size }, 'Clearing history cache');
|
|
81
|
-
historyCache.clear();
|
|
51
|
+
if (!force) {
|
|
52
|
+
// reduce the number of buffers in progress
|
|
53
|
+
buffersInProgress -= 1;
|
|
54
|
+
// if there are still some buffers going on
|
|
55
|
+
// then we don't flush now
|
|
56
|
+
if (buffersInProgress) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
82
59
|
}
|
|
83
60
|
const newData = makeBufferData();
|
|
84
61
|
const chatUpdates = Object.values(data.chatUpdates);
|
|
62
|
+
// gather the remaining conditional events so we re-queue them
|
|
85
63
|
let conditionalChatUpdatesLeft = 0;
|
|
86
64
|
for (const update of chatUpdates) {
|
|
87
65
|
if (update.conditional) {
|
|
@@ -109,14 +87,14 @@ const makeEventBuffer = (logger) => {
|
|
|
109
87
|
};
|
|
110
88
|
},
|
|
111
89
|
emit(event, evData) {
|
|
112
|
-
if (
|
|
90
|
+
if (buffersInProgress && BUFFERABLE_EVENT_SET.has(event)) {
|
|
113
91
|
append(data, historyCache, event, evData, logger);
|
|
114
92
|
return true;
|
|
115
93
|
}
|
|
116
94
|
return ev.emit('event', { [event]: evData });
|
|
117
95
|
},
|
|
118
96
|
isBuffering() {
|
|
119
|
-
return
|
|
97
|
+
return buffersInProgress > 0;
|
|
120
98
|
},
|
|
121
99
|
buffer,
|
|
122
100
|
flush,
|
|
@@ -125,31 +103,16 @@ const makeEventBuffer = (logger) => {
|
|
|
125
103
|
buffer();
|
|
126
104
|
try {
|
|
127
105
|
const result = await work(...args);
|
|
128
|
-
// If this is the only buffer, flush after a small delay
|
|
129
|
-
if (bufferCount === 1) {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
if (isBuffering && bufferCount === 1) {
|
|
132
|
-
flush();
|
|
133
|
-
}
|
|
134
|
-
}, 100); // Small delay to allow nested buffers
|
|
135
|
-
}
|
|
136
106
|
return result;
|
|
137
107
|
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
141
108
|
finally {
|
|
142
|
-
|
|
143
|
-
if (bufferCount === 0) {
|
|
144
|
-
// Auto-flush when no other buffers are active
|
|
145
|
-
setTimeout(flush, 100);
|
|
146
|
-
}
|
|
109
|
+
flush();
|
|
147
110
|
}
|
|
148
111
|
};
|
|
149
112
|
},
|
|
150
113
|
on: (...args) => ev.on(...args),
|
|
151
114
|
off: (...args) => ev.off(...args),
|
|
152
|
-
removeAllListeners: (...args) => ev.removeAllListeners(...args)
|
|
115
|
+
removeAllListeners: (...args) => ev.removeAllListeners(...args),
|
|
153
116
|
};
|
|
154
117
|
};
|
|
155
118
|
exports.makeEventBuffer = makeEventBuffer;
|
|
@@ -175,9 +138,8 @@ const makeBufferData = () => {
|
|
|
175
138
|
groupUpdates: {}
|
|
176
139
|
};
|
|
177
140
|
};
|
|
178
|
-
function append(data, historyCache, event,
|
|
179
|
-
|
|
180
|
-
eventData, logger) {
|
|
141
|
+
function append(data, historyCache, event, eventData, logger) {
|
|
142
|
+
var _a, _b, _c;
|
|
181
143
|
switch (event) {
|
|
182
144
|
case 'messaging-history.set':
|
|
183
145
|
for (const chat of eventData.chats) {
|
|
@@ -214,16 +176,13 @@ eventData, logger) {
|
|
|
214
176
|
}
|
|
215
177
|
}
|
|
216
178
|
data.historySets.empty = false;
|
|
217
|
-
data.historySets.syncType = eventData.syncType;
|
|
218
|
-
data.historySets.progress = eventData.progress;
|
|
219
|
-
data.historySets.peerDataRequestSessionId = eventData.peerDataRequestSessionId;
|
|
220
179
|
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest;
|
|
221
180
|
break;
|
|
222
181
|
case 'chats.upsert':
|
|
223
182
|
for (const chat of eventData) {
|
|
224
183
|
let upsert = data.chatUpserts[chat.id];
|
|
225
184
|
if (!upsert) {
|
|
226
|
-
upsert = data.historySets
|
|
185
|
+
upsert = data.historySets[chat.id];
|
|
227
186
|
if (upsert) {
|
|
228
187
|
logger.debug({ chatId: chat.id }, 'absorbed chat upsert in chat set');
|
|
229
188
|
}
|
|
@@ -329,7 +288,7 @@ eventData, logger) {
|
|
|
329
288
|
const { messages, type } = eventData;
|
|
330
289
|
for (const message of messages) {
|
|
331
290
|
const key = stringifyMessageKey(message.key);
|
|
332
|
-
let existing = data.messageUpserts[key]
|
|
291
|
+
let existing = (_a = data.messageUpserts[key]) === null || _a === void 0 ? void 0 : _a.message;
|
|
333
292
|
if (!existing) {
|
|
334
293
|
existing = data.historySets.messages[key];
|
|
335
294
|
if (existing) {
|
|
@@ -350,7 +309,9 @@ eventData, logger) {
|
|
|
350
309
|
else {
|
|
351
310
|
data.messageUpserts[key] = {
|
|
352
311
|
message,
|
|
353
|
-
type: type === 'notify' || data.messageUpserts[key]
|
|
312
|
+
type: type === 'notify' || ((_b = data.messageUpserts[key]) === null || _b === void 0 ? void 0 : _b.type) === 'notify'
|
|
313
|
+
? 'notify'
|
|
314
|
+
: type
|
|
354
315
|
};
|
|
355
316
|
}
|
|
356
317
|
}
|
|
@@ -359,7 +320,7 @@ eventData, logger) {
|
|
|
359
320
|
const msgUpdates = eventData;
|
|
360
321
|
for (const { key, update } of msgUpdates) {
|
|
361
322
|
const keyStr = stringifyMessageKey(key);
|
|
362
|
-
const existing = data.historySets.messages[keyStr] || data.messageUpserts[keyStr]
|
|
323
|
+
const existing = data.historySets.messages[keyStr] || ((_c = data.messageUpserts[keyStr]) === null || _c === void 0 ? void 0 : _c.message);
|
|
363
324
|
if (existing) {
|
|
364
325
|
Object.assign(existing, update);
|
|
365
326
|
// if the message was received & read by us
|
|
@@ -406,7 +367,8 @@ eventData, logger) {
|
|
|
406
367
|
(0, messages_1.updateMessageWithReaction)(existing.message, reaction);
|
|
407
368
|
}
|
|
408
369
|
else {
|
|
409
|
-
data.messageReactions[keyStr] = data.messageReactions[keyStr]
|
|
370
|
+
data.messageReactions[keyStr] = data.messageReactions[keyStr]
|
|
371
|
+
|| { key, reactions: [] };
|
|
410
372
|
(0, messages_1.updateMessageWithReaction)(data.messageReactions[keyStr], reaction);
|
|
411
373
|
}
|
|
412
374
|
}
|
|
@@ -420,7 +382,8 @@ eventData, logger) {
|
|
|
420
382
|
(0, messages_1.updateMessageWithReceipt)(existing.message, receipt);
|
|
421
383
|
}
|
|
422
384
|
else {
|
|
423
|
-
data.messageReceipts[keyStr] = data.messageReceipts[keyStr]
|
|
385
|
+
data.messageReceipts[keyStr] = data.messageReceipts[keyStr]
|
|
386
|
+
|| { key, userReceipt: [] };
|
|
424
387
|
(0, messages_1.updateMessageWithReceipt)(data.messageReceipts[keyStr], receipt);
|
|
425
388
|
}
|
|
426
389
|
}
|
|
@@ -460,10 +423,10 @@ eventData, logger) {
|
|
|
460
423
|
// if the message has already been marked read by us
|
|
461
424
|
const chatId = message.key.remoteJid;
|
|
462
425
|
const chat = data.chatUpdates[chatId] || data.chatUpserts[chatId];
|
|
463
|
-
if ((0, process_message_1.isRealMessage)(message, '')
|
|
464
|
-
(0, process_message_1.shouldIncrementChatUnread)(message)
|
|
465
|
-
typeof chat
|
|
466
|
-
chat.unreadCount > 0) {
|
|
426
|
+
if ((0, process_message_1.isRealMessage)(message, '')
|
|
427
|
+
&& (0, process_message_1.shouldIncrementChatUnread)(message)
|
|
428
|
+
&& typeof (chat === null || chat === void 0 ? void 0 : chat.unreadCount) === 'number'
|
|
429
|
+
&& chat.unreadCount > 0) {
|
|
467
430
|
logger.debug({ chatId: chat.id }, 'decrementing chat counter');
|
|
468
431
|
chat.unreadCount -= 1;
|
|
469
432
|
if (chat.unreadCount === 0) {
|
|
@@ -479,10 +442,7 @@ function consolidateEvents(data) {
|
|
|
479
442
|
chats: Object.values(data.historySets.chats),
|
|
480
443
|
messages: Object.values(data.historySets.messages),
|
|
481
444
|
contacts: Object.values(data.historySets.contacts),
|
|
482
|
-
|
|
483
|
-
progress: data.historySets.progress,
|
|
484
|
-
isLatest: data.historySets.isLatest,
|
|
485
|
-
peerDataRequestSessionId: data.historySets.peerDataRequestSessionId
|
|
445
|
+
isLatest: data.historySets.isLatest
|
|
486
446
|
};
|
|
487
447
|
}
|
|
488
448
|
const chatUpsertList = Object.values(data.chatUpserts);
|
|
@@ -536,10 +496,12 @@ function consolidateEvents(data) {
|
|
|
536
496
|
return map;
|
|
537
497
|
}
|
|
538
498
|
function concatChats(a, b) {
|
|
539
|
-
if (b.unreadCount === null
|
|
540
|
-
|
|
541
|
-
a.unreadCount
|
|
542
|
-
|
|
499
|
+
if (b.unreadCount === null) {
|
|
500
|
+
// neutralize unread counter
|
|
501
|
+
if (a.unreadCount < 0) {
|
|
502
|
+
a.unreadCount = undefined;
|
|
503
|
+
b.unreadCount = undefined;
|
|
504
|
+
}
|
|
543
505
|
}
|
|
544
506
|
if (typeof a.unreadCount === 'number' && typeof b.unreadCount === 'number') {
|
|
545
507
|
b = { ...b };
|
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { Logger } from 'pino';
|
|
4
|
+
import { proto } from '../../WAProto';
|
|
5
|
+
import { BaileysEventEmitter, BaileysEventMap, WACallUpdateType, WAVersion } from '../Types';
|
|
6
|
+
import { BinaryNode } from '../WABinary';
|
|
7
|
+
export declare const Browsers: {
|
|
8
|
+
ubuntu: (browser: any) => [string, string, string];
|
|
9
|
+
macOS: (browser: any) => [string, string, string];
|
|
10
|
+
baileys: (browser: any) => [string, string, string];
|
|
11
|
+
windows: (browser: any) => [string, string, string];
|
|
12
|
+
/** The appropriate browser based on your OS & release */
|
|
13
|
+
appropriate: (browser: any) => [string, string, string];
|
|
10
14
|
};
|
|
15
|
+
export declare const getPlatformId: (browser: string) => any;
|
|
11
16
|
export declare const getKeyAuthor: (key: proto.IMessageKey | undefined | null, meId?: string) => string;
|
|
12
|
-
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer
|
|
13
|
-
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer<ArrayBuffer>;
|
|
17
|
+
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer;
|
|
18
|
+
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array;
|
|
19
|
+
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer;
|
|
16
20
|
export declare const generateRegistrationId: () => number;
|
|
17
|
-
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array
|
|
21
|
+
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array;
|
|
18
22
|
export declare const toNumber: (t: Long | number | null | undefined) => number;
|
|
19
23
|
/** unix timestamp of a date in seconds */
|
|
20
24
|
export declare const unixTimestampSeconds: (date?: Date) => number;
|
|
@@ -33,33 +37,34 @@ export declare const delayCancellable: (ms: number) => {
|
|
|
33
37
|
export declare function promiseTimeout<T>(ms: number | undefined, promise: (resolve: (v: T) => void, reject: (error: any) => void) => void): Promise<T>;
|
|
34
38
|
export declare const generateMessageIDV2: (userId?: string) => string;
|
|
35
39
|
export declare const generateMessageID: () => string;
|
|
36
|
-
export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) =>
|
|
37
|
-
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<ConnectionState>) =>
|
|
40
|
+
export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
41
|
+
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
42
|
+
export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void;
|
|
38
43
|
/**
|
|
39
44
|
* utility that fetches latest baileys version from the master branch.
|
|
40
45
|
* Use to ensure your WA connection is always on the latest version
|
|
41
46
|
*/
|
|
42
|
-
export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<
|
|
47
|
+
export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
|
|
43
48
|
version: WAVersion;
|
|
44
49
|
isLatest: boolean;
|
|
45
50
|
error?: undefined;
|
|
46
51
|
} | {
|
|
47
52
|
version: WAVersion;
|
|
48
53
|
isLatest: boolean;
|
|
49
|
-
error:
|
|
54
|
+
error: any;
|
|
50
55
|
}>;
|
|
51
56
|
/**
|
|
52
57
|
* A utility that fetches the latest web version of whatsapp.
|
|
53
58
|
* Use to ensure your WA connection is always on the latest version
|
|
54
59
|
*/
|
|
55
|
-
export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig<
|
|
60
|
+
export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig<any>) => Promise<{
|
|
56
61
|
version: WAVersion;
|
|
57
62
|
isLatest: boolean;
|
|
58
63
|
error?: undefined;
|
|
59
64
|
} | {
|
|
60
65
|
version: WAVersion;
|
|
61
66
|
isLatest: boolean;
|
|
62
|
-
error:
|
|
67
|
+
error: any;
|
|
63
68
|
}>;
|
|
64
69
|
/** unique message tag prefix for MD clients */
|
|
65
70
|
export declare const generateMdTagPrefix: () => string;
|
|
@@ -82,11 +87,6 @@ export declare const getCodeFromWSError: (error: Error) => number;
|
|
|
82
87
|
* Is the given platform WA business
|
|
83
88
|
* @param platform AuthenticationCreds.platform
|
|
84
89
|
*/
|
|
85
|
-
export declare const isWABusinessPlatform: (platform: string) =>
|
|
86
|
-
export declare function trimUndefined(obj:
|
|
87
|
-
[_: string]: any;
|
|
88
|
-
}): {
|
|
89
|
-
[_: string]: any;
|
|
90
|
-
};
|
|
90
|
+
export declare const isWABusinessPlatform: (platform: string) => boolean;
|
|
91
|
+
export declare function trimUndefined(obj: any): any;
|
|
91
92
|
export declare function bytesToCrockford(buffer: Buffer): string;
|
|
92
|
-
export declare function encodeNewsletterMessage(message: proto.IMessage): Uint8Array;
|