sanka-baileyss 2.5.2 → 2.5.3

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.
@@ -620,12 +620,10 @@ const makeMessagesRecvSocket = (config) => {
620
620
  const sendToAll = !((_a = (0, WABinary_1.jidDecode)(participant)) === null || _a === void 0 ? void 0 : _a.device);
621
621
  await assertSessions([participant], true);
622
622
  if ((0, WABinary_1.isJidGroup)(remoteJid)) {
623
- // Instead of clearing entire group sender-key-memory, only clear specific participant's key
624
623
  const senderKeyName = `${remoteJid}::${participant}`;
625
624
  logger.debug({ remoteJid, participant, senderKeyName }, 'clearing sender key for specific participant on retry');
626
625
  await authState.keys.set({ 'sender-key': { [senderKeyName]: null } });
627
626
 
628
- // Also update sender-key-memory to remove this specific participant
629
627
  const result = await authState.keys.get('sender-key-memory', [remoteJid]);
630
628
  const senderKeyMap = result[remoteJid] || {};
631
629
  if (senderKeyMap[participant]) {
@@ -805,7 +803,6 @@ const makeMessagesRecvSocket = (config) => {
805
803
  processingMutex.mutex(async () => {
806
804
  var _a, _b, _c, _d, _e, _f;
807
805
  await decrypt();
808
- // message failed to decrypt
809
806
  if (msg.messageStubType === WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT) {
810
807
  if (((_a = msg === null || msg === void 0 ? void 0 : msg.messageStubParameters) === null || _a === void 0 ? void 0 : _a[0]) === Utils_1.MISSING_KEYS_ERROR_TEXT) {
811
808
  return sendMessageAck(node, Utils_1.NACK_REASONS.ParsingError);
@@ -827,7 +824,6 @@ const makeMessagesRecvSocket = (config) => {
827
824
  });
828
825
  }
829
826
  else {
830
- // no type in the receipt => message delivered
831
827
  let type = undefined;
832
828
  if ((_b = msg.key.participant) === null || _b === void 0 ? void 0 : _b.endsWith('@lid')) {
833
829
  msg.key.participant = node.attrs.participant_pn || authState.creds.me.id;
@@ -942,12 +938,10 @@ const makeMessagesRecvSocket = (config) => {
942
938
  callOfferCache.set(call.id, call);
943
939
  }
944
940
  const existingCall = callOfferCache.get(call.id);
945
- // use existing call info to populate this event
946
941
  if (existingCall) {
947
942
  call.isVideo = existingCall.isVideo;
948
943
  call.isGroup = existingCall.isGroup;
949
944
  }
950
- // delete data once call has ended
951
945
  if (status === 'reject' || status === 'accept' || status === 'timeout' || status === 'terminate') {
952
946
  callOfferCache.del(call.id);
953
947
  }
@@ -956,9 +950,6 @@ const makeMessagesRecvSocket = (config) => {
956
950
  };
957
951
  const handleBadAck = async ({ attrs }) => {
958
952
  const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id, 'server_id': attrs === null || attrs === void 0 ? void 0 : attrs.server_id };
959
- // current hypothesis is that if pash is sent in the ack
960
- // it means -- the message hasn't reached all devices yet
961
- // we'll retry sending the message here
962
953
  if (attrs.phash) {
963
954
  logger.info({ attrs }, 'received phash in ack, resending message...');
964
955
  const cacheKey = `${key.remoteJid}:${key.id}`;
@@ -977,8 +968,6 @@ const makeMessagesRecvSocket = (config) => {
977
968
  logger.warn({ attrs }, 'could not send message again, as it was not found');
978
969
  }
979
970
  }
980
- // error in acknowledgement,
981
- // device could not display the message
982
971
  if (attrs.error) {
983
972
  logger.warn({ attrs }, 'received error in ack');
984
973
  ev.emit('messages.update', [
@@ -994,8 +983,6 @@ const makeMessagesRecvSocket = (config) => {
994
983
  ]);
995
984
  }
996
985
  };
997
- /// processes a node with the given function
998
- /// and adds the task to the existing buffer if we're buffering events
999
986
  const processNodeWithBuffer = async (node, identifier, exec) => {
1000
987
  ev.buffer();
1001
988
  await execTask();
@@ -1046,7 +1033,6 @@ const makeMessagesRecvSocket = (config) => {
1046
1033
  processNodeWithBuffer(node, identifier, exec);
1047
1034
  }
1048
1035
  };
1049
- // recv a message
1050
1036
  ws.on('CB:message', (node) => {
1051
1037
  processNode('message', node, 'processing message', handleMessage);
1052
1038
  });
@@ -1064,7 +1050,6 @@ const makeMessagesRecvSocket = (config) => {
1064
1050
  .catch(error => onUnexpectedError(error, 'handling bad ack'));
1065
1051
  });
1066
1052
  ev.on('call', ([call]) => {
1067
- // missed call + group call notification message generation
1068
1053
  if (call.status === 'timeout' || (call.status === 'offer' && call.isGroup)) {
1069
1054
  const msg = {
1070
1055
  key: {
@@ -288,7 +288,7 @@ const makeMessagesSocket = (config) => {
288
288
  return node;
289
289
  }));
290
290
  return { nodes, shouldIncludeDeviceIdentity };
291
- }; //apela
291
+ };
292
292
  const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, useCachedGroupMetadata, statusJidList, AI = false }) => {
293
293
  const meId = authState.creds.me.id;
294
294
  let shouldIncludeDeviceIdentity = false;
@@ -330,7 +330,7 @@ exports.default = (config) => {
330
330
  }
331
331
  const diff = count - messages.length;
332
332
  if (diff < 0) {
333
- messages = messages.slice(-count); // get the last X messages
333
+ messages = messages.slice(-count);
334
334
  }
335
335
  }
336
336
  else {
@@ -408,12 +408,10 @@ exports.default = (config) => {
408
408
  toJSON,
409
409
  fromJSON,
410
410
  writeToFile: (path) => {
411
- // require fs here so that in case "fs" is not available -- the app does not crash
412
411
  const { writeFileSync } = require('fs');
413
412
  writeFileSync(path, JSON.stringify(toJSON()));
414
413
  },
415
414
  readFromFile: (path) => {
416
- // require fs here so that in case "fs" is not available -- the app does not crash
417
415
  const { readFileSync, existsSync } = require('fs');
418
416
  if (existsSync(path)) {
419
417
  logger.debug({ path }, 'reading from file');
@@ -3,7 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
4
4
  const WAProto_1 = require("../../WAProto");
5
5
  Object.defineProperty(exports, "WAProto", { enumerable: true, get: function () { return WAProto_1.proto; } });
6
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
7
6
  exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
8
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
9
7
  exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
@@ -577,8 +577,6 @@ const processSyncAction = (syncAction, ev, me, initialSyncOpts, logger) => {
577
577
  const isArchived = archiveAction
578
578
  ? archiveAction.archived
579
579
  : type === 'archive';
580
- // // basically we don't need to fire an "archive" update if the chat is being marked unarchvied
581
- // // this only applies for the initial sync
582
580
  // if(isInitialSync && !isArchived) {
583
581
  // isArchived = false
584
582
  // }
@@ -187,7 +187,6 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
187
187
  }
188
188
  }
189
189
  }
190
- // if nothing was found to decrypt
191
190
  if (!decryptables) {
192
191
  fullMessage.messageStubType = WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT;
193
192
  fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT, JSON.stringify(stanza, generics_1.BufferJSON.replacer)];
@@ -34,7 +34,6 @@ const makeEventBuffer = (logger) => {
34
34
  const historyCache = new Set();
35
35
  let data = makeBufferData();
36
36
  let buffersInProgress = 0;
37
- // take the generic event and fire it as a baileys event
38
37
  ev.on('event', (map) => {
39
38
  for (const event in map) {
40
39
  ev.emit(event, map[event]);
@@ -44,22 +43,17 @@ const makeEventBuffer = (logger) => {
44
43
  buffersInProgress += 1;
45
44
  }
46
45
  function flush(force = false) {
47
- // no buffer going on
48
46
  if (!buffersInProgress) {
49
47
  return false;
50
48
  }
51
49
  if (!force) {
52
- // reduce the number of buffers in progress
53
50
  buffersInProgress -= 1;
54
- // if there are still some buffers going on
55
- // then we don't flush now
56
51
  if (buffersInProgress) {
57
52
  return false;
58
53
  }
59
54
  }
60
55
  const newData = makeBufferData();
61
56
  const chatUpdates = Object.values(data.chatUpdates);
62
- // gather the remaining conditional events so we re-queue them
63
57
  let conditionalChatUpdatesLeft = 0;
64
58
  for (const update of chatUpdates) {
65
59
  if (update.conditional) {
@@ -206,24 +200,18 @@ function append(data, historyCache, event, eventData, logger) {
206
200
  const conditionMatches = update.conditional ? update.conditional(data) : true;
207
201
  if (conditionMatches) {
208
202
  delete update.conditional;
209
- // if there is an existing upsert, merge the update into it
210
203
  const upsert = data.historySets.chats[chatId] || data.chatUpserts[chatId];
211
204
  if (upsert) {
212
205
  concatChats(upsert, update);
213
206
  }
214
207
  else {
215
- // merge the update into the existing update
216
208
  const chatUpdate = data.chatUpdates[chatId] || {};
217
209
  data.chatUpdates[chatId] = concatChats(chatUpdate, update);
218
210
  }
219
211
  }
220
212
  else if (conditionMatches === undefined) {
221
- // condition yet to be fulfilled
222
213
  data.chatUpdates[chatId] = update;
223
214
  }
224
- // otherwise -- condition not met, update is invalid
225
- // if the chat has been updated
226
- // ignore any existing chat delete
227
215
  if (data.chatDeletes.has(chatId)) {
228
216
  data.chatDeletes.delete(chatId);
229
217
  }
@@ -234,7 +222,6 @@ function append(data, historyCache, event, eventData, logger) {
234
222
  if (!data.chatDeletes.has(chatId)) {
235
223
  data.chatDeletes.add(chatId);
236
224
  }
237
- // remove any prior updates & upserts
238
225
  if (data.chatUpdates[chatId]) {
239
226
  delete data.chatUpdates[chatId];
240
227
  }
@@ -272,13 +259,11 @@ function append(data, historyCache, event, eventData, logger) {
272
259
  const contactUpdates = eventData;
273
260
  for (const update of contactUpdates) {
274
261
  const id = update.id;
275
- // merge into prior upsert
276
262
  const upsert = data.historySets.contacts[id] || data.contactUpserts[id];
277
263
  if (upsert) {
278
264
  Object.assign(upsert, update);
279
265
  }
280
266
  else {
281
- // merge into prior update
282
267
  const contactUpdate = data.contactUpdates[id] || {};
283
268
  data.contactUpdates[id] = Object.assign(contactUpdate, update);
284
269
  }
@@ -323,9 +308,6 @@ function append(data, historyCache, event, eventData, logger) {
323
308
  const existing = data.historySets.messages[keyStr] || ((_c = data.messageUpserts[keyStr]) === null || _c === void 0 ? void 0 : _c.message);
324
309
  if (existing) {
325
310
  Object.assign(existing, update);
326
- // if the message was received & read by us
327
- // the chat counter must have been incremented
328
- // so we need to decrement it
329
311
  if (update.status === Types_1.WAMessageStatus.READ && !key.fromMe) {
330
312
  decrementChatReadCounterIfMsgDidUnread(existing);
331
313
  }
@@ -419,8 +401,6 @@ function append(data, historyCache, event, eventData, logger) {
419
401
  }
420
402
  }
421
403
  function decrementChatReadCounterIfMsgDidUnread(message) {
422
- // decrement chat unread counter
423
- // if the message has already been marked read by us
424
404
  const chatId = message.key.remoteJid;
425
405
  const chat = data.chatUpdates[chatId] || data.chatUpserts[chatId];
426
406
  if ((0, process_message_1.isRealMessage)(message, '')
@@ -497,7 +477,6 @@ function consolidateEvents(data) {
497
477
  }
498
478
  function concatChats(a, b) {
499
479
  if (b.unreadCount === null) {
500
- // neutralize unread counter
501
480
  if (a.unreadCount < 0) {
502
481
  a.unreadCount = undefined;
503
482
  b.unreadCount = undefined;
@@ -17,7 +17,6 @@ const downloadHistory = async (msg, options) => {
17
17
  bufferArray.push(chunk);
18
18
  }
19
19
  let buffer = Buffer.concat(bufferArray);
20
- // decompress buffer
21
20
  buffer = await inflatePromise(buffer);
22
21
  const syncData = WAProto_1.proto.HistorySync.decode(buffer);
23
22
  return syncData;
@@ -48,7 +47,6 @@ const processHistoryMessage = (item) => {
48
47
  const message = item.message;
49
48
  messages.push(message);
50
49
  if (!((_a = chat.messages) === null || _a === void 0 ? void 0 : _a.length)) {
51
- // keep only the most recent message in the chat array
52
50
  chat.messages = [{ message }];
53
51
  }
54
52
  if (!message.key.fromMe && !chat.lastMessageRecvTimestamp) {
@@ -22,7 +22,6 @@ const getUrlInfo = async (text, opts = {
22
22
  }) => {
23
23
  var _a;
24
24
  try {
25
- // retries
26
25
  const retries = 0;
27
26
  const maxRetry = 5;
28
27
  const { getLinkPreview } = await import('link-preview-js');
@@ -7,14 +7,11 @@ const makeMutex = () => {
7
7
  return {
8
8
  mutex(code) {
9
9
  task = (async () => {
10
- // wait for the previous task to complete
11
- // if there is an error, we swallow so as to not block the queue
12
10
  try {
13
11
  await task;
14
12
  }
15
13
  catch (_a) { }
16
14
  try {
17
- // execute the current task
18
15
  const result = await code();
19
16
  return result;
20
17
  }
@@ -22,8 +19,6 @@ const makeMutex = () => {
22
19
  clearTimeout(taskTimeout);
23
20
  }
24
21
  })();
25
- // we replace the existing task, appending the new piece of execution to it
26
- // so the next task will have to wait for this one to finish
27
22
  return task;
28
23
  },
29
24
  };
@@ -578,7 +578,6 @@ const downloadEncryptedContent = async (downloadUrl, { cipherKey, iv }, { startB
578
578
  headers.Range += endChunk;
579
579
  }
580
580
  }
581
- // download the message
582
581
  const fetched = await (0, exports.getHttpStream)(downloadUrl, {
583
582
  ...options || {},
584
583
  headers,
@@ -611,8 +610,6 @@ const downloadEncryptedContent = async (downloadUrl, { cipherKey, iv }, { startB
611
610
  data = data.slice(AES_CHUNK_SIZE);
612
611
  }
613
612
  aes = Crypto.createDecipheriv('aes-256-cbc', cipherKey, ivValue);
614
- // if an end byte that is not EOF is specified
615
- // stop auto padding (PKCS7) -- otherwise throws an error for decryption
616
613
  if (endByte) {
617
614
  aes.setAutoPadding(false);
618
615
  }
@@ -745,9 +742,6 @@ const encryptMediaRetryRequest = (key, mediaKey, meId) => {
745
742
  type: 'server-error'
746
743
  },
747
744
  content: [
748
- // this encrypt node is actually pretty useless
749
- // the media is returned even without this node
750
- // keeping it here to maintain parity with WA Web
751
745
  {
752
746
  tag: 'encrypt',
753
747
  attrs: {},
@@ -407,7 +407,6 @@ const generateWAMessageContent = async (message, options) => {
407
407
  throw new boom_1.Boom(`poll.selectableCount in poll should be >= 0 and <= ${message.poll.values.length}`, { statusCode: 400 });
408
408
  }
409
409
  m.messageContextInfo = {
410
- // encKey
411
410
  messageSecret: message.poll.messageSecret || (0, crypto_1.randomBytes)(32),
412
411
  };
413
412
  m.pollCreationMessage = {
@@ -509,8 +508,6 @@ const generateWAMessageContent = async (message, options) => {
509
508
  };
510
509
  exports.generateWAMessageContent = generateWAMessageContent;
511
510
  const generateWAMessageFromContent = (jid, message, options) => {
512
- // set timestamp to now
513
- // if not specified
514
511
  if (!options.timestamp) {
515
512
  options.timestamp = new Date();
516
513
  }
@@ -522,7 +519,6 @@ const generateWAMessageFromContent = (jid, message, options) => {
522
519
  const participant = quoted.key.fromMe ? userJid : (quoted.participant || quoted.key.participant || quoted.key.remoteJid);
523
520
  let quotedMsg = (0, exports.normalizeMessageContent)(quoted.message);
524
521
  const msgType = (0, exports.getContentType)(quotedMsg);
525
- // strip any redundant properties
526
522
  quotedMsg = WAProto_1.proto.Message.fromObject({ [msgType]: quotedMsg[msgType] });
527
523
  const quotedContent = quotedMsg[msgType];
528
524
  if (typeof quotedContent === 'object' && quotedContent && 'contextInfo' in quotedContent) {
@@ -532,21 +528,15 @@ const generateWAMessageFromContent = (jid, message, options) => {
532
528
  contextInfo.participant = (0, WABinary_1.jidNormalizedUser)(participant);
533
529
  contextInfo.stanzaId = quoted.key.id;
534
530
  contextInfo.quotedMessage = quotedMsg;
535
- // if a participant is quoted, then it must be a group
536
- // hence, remoteJid of group must also be entered
537
531
  if (jid !== quoted.key.remoteJid) {
538
532
  contextInfo.remoteJid = quoted.key.remoteJid;
539
533
  }
540
534
  innerMessage[key].contextInfo = contextInfo;
541
535
  }
542
536
  if (
543
- // if we want to send a disappearing message
544
537
  !!(options === null || options === void 0 ? void 0 : options.ephemeralExpiration) &&
545
- // and it's not a protocol message -- delete, toggle disappear message
546
538
  key !== 'protocolMessage' &&
547
- // already not converted to disappearing message
548
539
  key !== 'ephemeralMessage' &&
549
- // newsletter not accept disappearing messages
550
540
  !(0, WABinary_1.isJidNewsLetter)(jid)) {
551
541
  innerMessage[key].contextInfo = {
552
542
  ...(innerMessage[key].contextInfo || {}),
@@ -25,8 +25,6 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
25
25
  return result;
26
26
  };
27
27
  const decrypt = (ciphertext) => {
28
- // before the handshake is finished, we use the same counter
29
- // after handshake, the counters are different
30
28
  const iv = generateIV(isFinished ? readCounter : writeCounter);
31
29
  const result = (0, crypto_1.aesDecryptGCM)(ciphertext, decKey, iv, hash);
32
30
  if (isFinished) {
@@ -127,9 +125,6 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
127
125
  },
128
126
  decodeFrame: (newData, onFrame) => {
129
127
  var _a;
130
- // the binary protocol uses its own framing mechanism
131
- // on top of the WS frames
132
- // so we get this data and separate out the frames
133
128
  const getBytesSize = () => {
134
129
  if (inBytes.length >= 3) {
135
130
  return (inBytes.readUInt8() << 16) | inBytes.readUInt16BE(1);
@@ -19,11 +19,9 @@ const REAL_MSG_REQ_ME_STUB_TYPES = new Set([
19
19
  ]);
20
20
  /** Cleans a received message to further processing */
21
21
  const cleanMessage = (message, meId) => {
22
- // ensure remoteJid and participant doesn't have device or agent in it
23
22
  message.key.remoteJid = (0, WABinary_1.jidNormalizedUser)(message.key.remoteJid);
24
23
  message.key.participant = message.key.participant ? (0, WABinary_1.jidNormalizedUser)(message.key.participant) : undefined;
25
24
  const content = (0, messages_1.normalizeMessageContent)(message.message);
26
- // if the message has a reaction, ensure fromMe & remoteJid are from our perspective
27
25
  if (content === null || content === void 0 ? void 0 : content.reactionMessage) {
28
26
  normaliseKey(content.reactionMessage.key);
29
27
  }
@@ -31,19 +29,11 @@ const cleanMessage = (message, meId) => {
31
29
  normaliseKey(content.pollUpdateMessage.pollCreationMessageKey);
32
30
  }
33
31
  function normaliseKey(msgKey) {
34
- // if the reaction is from another user
35
- // we've to correctly map the key to this user's perspective
36
32
  if (!message.key.fromMe) {
37
- // if the sender believed the message being reacted to is not from them
38
- // we've to correct the key to be from them, or some other participant
39
33
  msgKey.fromMe = !msgKey.fromMe
40
34
  ? (0, WABinary_1.areJidsSameUser)(msgKey.participant || msgKey.remoteJid, meId)
41
- // if the message being reacted to, was from them
42
- // fromMe automatically becomes false
43
35
  : false;
44
- // set the remoteJid to being the same as the chat the message came from
45
36
  msgKey.remoteJid = message.key.remoteJid;
46
- // set participant of the message
47
37
  msgKey.participant = msgKey.participant || message.key.participant;
48
38
  }
49
39
  }
@@ -110,14 +100,11 @@ const processMessage = async (message, { shouldProcessHistoryMsg, ev, creds, key
110
100
  const isRealMsg = (0, exports.isRealMessage)(message, meId);
111
101
  if (isRealMsg) {
112
102
  chat.conversationTimestamp = (0, generics_1.toNumber)(message.messageTimestamp);
113
- // only increment unread count if not CIPHERTEXT and from another person
114
103
  if ((0, exports.shouldIncrementChatUnread)(message)) {
115
104
  chat.unreadCount = (chat.unreadCount || 0) + 1;
116
105
  }
117
106
  }
118
107
  const content = (0, messages_1.normalizeMessageContent)(message.message);
119
- // unarchive chat if it's a real message, or someone reacted to our message
120
- // and we've the unarchive chats setting on
121
108
  if ((isRealMsg || ((_b = (_a = content === null || content === void 0 ? void 0 : content.reactionMessage) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.fromMe))
122
109
  && (accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.unarchiveChats)) {
123
110
  chat.archived = false;
@@ -226,7 +213,6 @@ const processMessage = async (message, { shouldProcessHistoryMsg, ev, creds, key
226
213
  case Types_1.WAMessageStubType.GROUP_PARTICIPANT_REMOVE:
227
214
  participants = message.messageStubParameters || [];
228
215
  emitParticipantsUpdate('remove');
229
- // mark the chat read only if you left the group
230
216
  if (participantsIncludesMe()) {
231
217
  chat.readOnly = true;
232
218
  }
@@ -277,7 +263,6 @@ const processMessage = async (message, { shouldProcessHistoryMsg, ev, creds, key
277
263
  }
278
264
  else if (content === null || content === void 0 ? void 0 : content.pollUpdateMessage) {
279
265
  const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey;
280
- // we need to fetch the poll creation message to get the poll enc key
281
266
  const pollMsg = await getMessage(creationMsgKey);
282
267
  if (pollMsg) {
283
268
  const meIdNormalised = (0, WABinary_1.jidNormalizedUser)(meId);
@@ -67,11 +67,6 @@ const parseAndInjectE2ESessions = async (node, repository) => {
67
67
  for (const node of nodes) {
68
68
  WABinary_1.assertNodeErrorFree(node)
69
69
  }
70
- // Most of the work in repository.injectE2ESession is CPU intensive, not IO
71
- // So Promise.all doesn't really help here,
72
- // but blocks even loop if we're using it inside keys.transaction, and it makes it "sync" actually
73
- // This way we chunk it in smaller parts and between those parts we can yield to the event loop
74
- // It's rare case when you need to E2E sessions for so many users, but it's possible
75
70
  const chunkSize = 100
76
71
  const chunks = lodash_1.chunk(nodes, chunkSize)
77
72
  for (const nodesChunk of chunks) {
@@ -31,7 +31,7 @@ const decompressingIfRequired = (buffer) => {
31
31
  if (2 & buffer.readUInt8()) {
32
32
  buffer = (0, zlib_1.inflateSync)(buffer.slice(1));
33
33
  }
34
- else { // nodes with no compression have a 0x00 prefix, we remove that
34
+ else {
35
35
  buffer = buffer.slice(1);
36
36
  }
37
37
  return buffer;
@@ -207,7 +207,6 @@ const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) =>
207
207
  if (listSize === 0 || !header) {
208
208
  throw new Error('invalid node');
209
209
  }
210
- // read the attributes in
211
210
  const attributesLength = (listSize - 1) >> 1;
212
211
  for (let i = 0; i < attributesLength; i++) {
213
212
  const key = readString(readByte());
@@ -252,7 +252,6 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
252
252
  }
253
253
  }
254
254
  else if (typeof content === 'undefined') {
255
- // do nothing
256
255
  }
257
256
  else {
258
257
  throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`)
@@ -4,7 +4,7 @@ exports.getAdditionalNode = exports.getBinaryNodeFilter = exports.binaryNodeToSt
4
4
  const boom_1 = require("@hapi/boom");
5
5
  const WAProto_1 = require("../../WAProto");
6
6
  const Utils_1 = require("../Utils")
7
- // some extra useful utilities
7
+
8
8
  const getBinaryNodeChildren = (node, childTag) => {
9
9
  if (Array.isArray(node?.content)) {
10
10
  return node.content.filter(item => item.tag === childTag)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanka-baileyss",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "WhatsApp API Modification By Sanka_Vollerei",
5
5
  "keywords": [
6
6
  "Baileys",