violetics 7.0.0-alpha → 7.0.2-alpha

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.
Files changed (114) hide show
  1. package/LICENSE +3 -2
  2. package/README.md +1001 -232
  3. package/WAProto/index.js +75379 -142631
  4. package/engine-requirements.js +11 -8
  5. package/lib/Defaults/index.js +132 -144
  6. package/lib/Signal/Group/ciphertext-message.js +2 -6
  7. package/lib/Signal/Group/group-session-builder.js +7 -42
  8. package/lib/Signal/Group/group_cipher.js +37 -52
  9. package/lib/Signal/Group/index.js +11 -57
  10. package/lib/Signal/Group/keyhelper.js +7 -45
  11. package/lib/Signal/Group/sender-chain-key.js +7 -16
  12. package/lib/Signal/Group/sender-key-distribution-message.js +8 -12
  13. package/lib/Signal/Group/sender-key-message.js +9 -13
  14. package/lib/Signal/Group/sender-key-name.js +2 -6
  15. package/lib/Signal/Group/sender-key-record.js +9 -22
  16. package/lib/Signal/Group/sender-key-state.js +27 -43
  17. package/lib/Signal/Group/sender-message-key.js +4 -8
  18. package/lib/Signal/libsignal.js +319 -94
  19. package/lib/Signal/lid-mapping.js +224 -139
  20. package/lib/Socket/Client/index.js +2 -19
  21. package/lib/Socket/Client/types.js +10 -0
  22. package/lib/Socket/Client/websocket.js +53 -0
  23. package/lib/Socket/business.js +162 -44
  24. package/lib/Socket/chats.js +477 -442
  25. package/lib/Socket/communities.js +430 -0
  26. package/lib/Socket/groups.js +110 -99
  27. package/lib/Socket/index.js +10 -10
  28. package/lib/Socket/messages-recv.js +878 -552
  29. package/lib/Socket/messages-send.js +859 -428
  30. package/lib/Socket/mex.js +41 -0
  31. package/lib/Socket/newsletter.js +195 -390
  32. package/lib/Socket/socket.js +463 -289
  33. package/lib/Store/index.js +3 -10
  34. package/lib/Store/make-in-memory-store.js +73 -79
  35. package/lib/Store/make-ordered-dictionary.js +4 -7
  36. package/lib/Store/object-repository.js +2 -6
  37. package/lib/Types/Auth.js +1 -2
  38. package/lib/Types/Bussines.js +1 -0
  39. package/lib/Types/Call.js +1 -2
  40. package/lib/Types/Chat.js +7 -4
  41. package/lib/Types/Contact.js +1 -2
  42. package/lib/Types/Events.js +1 -2
  43. package/lib/Types/GroupMetadata.js +1 -2
  44. package/lib/Types/Label.js +2 -5
  45. package/lib/Types/LabelAssociation.js +2 -5
  46. package/lib/Types/Message.js +17 -9
  47. package/lib/Types/Newsletter.js +33 -38
  48. package/lib/Types/Product.js +1 -2
  49. package/lib/Types/Signal.js +1 -2
  50. package/lib/Types/Socket.js +2 -2
  51. package/lib/Types/State.js +12 -2
  52. package/lib/Types/USync.js +1 -2
  53. package/lib/Types/index.js +14 -31
  54. package/lib/Utils/auth-utils.js +228 -145
  55. package/lib/Utils/browser-utils.js +28 -0
  56. package/lib/Utils/business.js +66 -70
  57. package/lib/Utils/chat-utils.js +331 -249
  58. package/lib/Utils/crypto.js +57 -91
  59. package/lib/Utils/decode-wa-message.js +168 -84
  60. package/lib/Utils/event-buffer.js +138 -80
  61. package/lib/Utils/generics.js +180 -297
  62. package/lib/Utils/history.js +83 -49
  63. package/lib/Utils/identity-change-handler.js +48 -0
  64. package/lib/Utils/index.js +19 -33
  65. package/lib/Utils/link-preview.js +14 -23
  66. package/lib/Utils/logger.js +2 -7
  67. package/lib/Utils/lt-hash.js +2 -46
  68. package/lib/Utils/make-mutex.js +24 -35
  69. package/lib/Utils/message-retry-manager.js +224 -0
  70. package/lib/Utils/messages-media.js +501 -496
  71. package/lib/Utils/messages.js +1428 -362
  72. package/lib/Utils/noise-handler.js +145 -100
  73. package/lib/Utils/pre-key-manager.js +105 -0
  74. package/lib/Utils/process-message.js +356 -150
  75. package/lib/Utils/reporting-utils.js +257 -0
  76. package/lib/Utils/signal.js +78 -73
  77. package/lib/Utils/sync-action-utils.js +47 -0
  78. package/lib/Utils/tc-token-utils.js +17 -0
  79. package/lib/Utils/use-multi-file-auth-state.js +32 -34
  80. package/lib/Utils/validate-connection.js +91 -107
  81. package/lib/WABinary/constants.js +1300 -1304
  82. package/lib/WABinary/decode.js +26 -48
  83. package/lib/WABinary/encode.js +109 -155
  84. package/lib/WABinary/generic-utils.js +161 -149
  85. package/lib/WABinary/index.js +5 -21
  86. package/lib/WABinary/jid-utils.js +73 -40
  87. package/lib/WABinary/types.js +1 -2
  88. package/lib/WAM/BinaryInfo.js +2 -6
  89. package/lib/WAM/constants.js +19070 -11568
  90. package/lib/WAM/encode.js +17 -23
  91. package/lib/WAM/index.js +3 -19
  92. package/lib/WAUSync/Protocols/USyncContactProtocol.js +8 -12
  93. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -15
  94. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -13
  95. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -14
  96. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -23
  97. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -9
  98. package/lib/WAUSync/Protocols/index.js +4 -20
  99. package/lib/WAUSync/USyncQuery.js +40 -36
  100. package/lib/WAUSync/USyncUser.js +2 -6
  101. package/lib/WAUSync/index.js +3 -19
  102. package/lib/index.js +11 -44
  103. package/package.json +75 -108
  104. package/lib/Defaults/baileys-version.json +0 -3
  105. package/lib/Defaults/phonenumber-mcc.json +0 -223
  106. package/lib/Signal/Group/queue-job.js +0 -57
  107. package/lib/Socket/Client/abstract-socket-client.js +0 -13
  108. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  109. package/lib/Socket/Client/web-socket-client.js +0 -111
  110. package/lib/Socket/groupStatus.js +0 -637
  111. package/lib/Socket/registration.js +0 -166
  112. package/lib/Socket/usync.js +0 -70
  113. package/lib/Store/make-cache-manager-store.js +0 -83
  114. package/lib/Utils/baileys-event-stream.js +0 -63
@@ -1,10 +1,3 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.makeCacheManagerAuthState = exports.makeInMemoryStore = void 0;
7
- const make_cache_manager_store_1 = __importDefault(require("./make-cache-manager-store"));
8
- exports.makeCacheManagerAuthState = make_cache_manager_store_1.default;
9
- const make_in_memory_store_1 = __importDefault(require("./make-in-memory-store"));
10
- exports.makeInMemoryStore = make_in_memory_store_1.default;
1
+ export * from './make-in-memory-store.js';
2
+ export * from './make-ordered-dictionary.js';
3
+ export * from './object-repository.js';
@@ -1,41 +1,42 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.waLabelAssociationKey = exports.waMessageID = exports.waChatKey = void 0;
7
- const WAProto_1 = require("../../WAProto");
8
- const Defaults_1 = require("../Defaults");
9
- const LabelAssociation_1 = require("../Types/LabelAssociation");
10
- const Utils_1 = require("../Utils");
11
- const WABinary_1 = require("../WABinary");
12
- const make_ordered_dictionary_1 = __importDefault(require("./make-ordered-dictionary"));
13
- const object_repository_1 = require("./object-repository");
14
- const waChatKey = (pin) => ({
1
+ /**
2
+ * Lia@Note 03-02-26
3
+ * --- [WIP]
4
+ * Manually converted to ESM and modified by me
5
+ * Originally based on @whiskeysockets/baileys v6.7.16
6
+ * Minor adjustments for compatibility with baileys v7 (⁠つ⁠≧⁠▽⁠≦⁠)⁠つ
7
+ */
8
+ import keyedDB from '@adiwajshing/keyed-db';
9
+ import { writeFileSync, readFileSync, existsSync } from 'fs';
10
+ import { WAProto } from '../Types/index.js';
11
+ import { LabelAssociationType } from '../Types/LabelAssociation.js';
12
+ import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
13
+ import { md5, toNumber, updateMessageWithReceipt, updateMessageWithReaction } from '../Utils/index.js';
14
+ import { jidDecode, jidNormalizedUser } from '../WABinary/index.js';
15
+ import { makeOrderedDictionary } from './make-ordered-dictionary.js';
16
+ import { ObjectRepository } from './object-repository.js';
17
+ export const waChatKey = (pin) => ({
15
18
  key: (c) => (pin ? (c.pinned ? '1' : '0') : '') + (c.archived ? '0' : '1') + (c.conversationTimestamp ? c.conversationTimestamp.toString(16).padStart(8, '0') : '') + c.id,
16
19
  compare: (k1, k2) => k2.localeCompare(k1)
17
20
  });
18
- exports.waChatKey = waChatKey;
19
- const waMessageID = (m) => m.key.id || '';
20
- exports.waMessageID = waMessageID;
21
- exports.waLabelAssociationKey = {
22
- key: (la) => (la.type === LabelAssociation_1.LabelAssociationType.Chat ? la.chatId + la.labelId : la.chatId + la.messageId + la.labelId),
21
+ export const waMessageID = (m) => m.key.id || '';
22
+ export const waLabelAssociationKey = {
23
+ key: (la) => (la.type === LabelAssociationType.Chat ? la.chatId + la.labelId : la.chatId + la.messageId + la.labelId),
23
24
  compare: (k1, k2) => k2.localeCompare(k1)
24
25
  };
25
- const makeMessagesDictionary = () => (0, make_ordered_dictionary_1.default)(exports.waMessageID);
26
- exports.default = (config) => {
26
+ const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID);
27
+ export const makeInMemoryStore = (config = {}) => {
27
28
  const socket = config.socket;
28
- const chatKey = config.chatKey || (0, exports.waChatKey)(true);
29
- const labelAssociationKey = config.labelAssociationKey || exports.waLabelAssociationKey;
30
- const logger = config.logger || Defaults_1.DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
31
- const KeyedDB = require('@adiwajshing/keyed-db').default;
29
+ const chatKey = config.chatKey || waChatKey(true);
30
+ const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey;
31
+ const logger = config.logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
32
+ const KeyedDB = keyedDB?.default ?? keyedDB; // Lia@Note 03-02-26 --- Handle CJS ↔ ESM default export differences ⊂⁠(⁠・⁠ω⁠・⁠*⁠⊂⁠)
32
33
  const chats = new KeyedDB(chatKey, c => c.id);
33
34
  const messages = {};
34
35
  const contacts = {};
35
36
  const groupMetadata = {};
36
37
  const presences = {};
37
38
  const state = { connection: 'close' };
38
- const labels = new object_repository_1.ObjectRepository();
39
+ const labels = new ObjectRepository();
39
40
  const labelAssociations = new KeyedDB(labelAssociationKey, labelAssociationKey.key);
40
41
  const assertMessageList = (jid) => {
41
42
  if (!messages[jid]) {
@@ -56,14 +57,6 @@ exports.default = (config) => {
56
57
  labels.upsertById(label.id, label);
57
58
  }
58
59
  };
59
- const getValidContacts = () => {
60
- for (const contact of Object.keys(contacts)) {
61
- if (contact.indexOf('@') < 0) {
62
- delete contacts[contact];
63
- }
64
- }
65
- return Object.keys(contacts);
66
- };
67
60
  /**
68
61
  * binds to a BaileysEventEmitter.
69
62
  * It listens to all events and constructs a state that you can query accurate data from.
@@ -74,7 +67,11 @@ exports.default = (config) => {
74
67
  ev.on('connection.update', update => {
75
68
  Object.assign(state, update);
76
69
  });
77
- ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest }) => {
70
+ ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest, syncType }) => {
71
+ if (syncType === WAProto.HistorySync.HistorySyncType.ON_DEMAND) {
72
+ return; // FOR NOW,
73
+ //TODO: HANDLE
74
+ }
78
75
  if (isLatest) {
79
76
  chats.clear();
80
77
  for (const id in messages) {
@@ -91,7 +88,7 @@ exports.default = (config) => {
91
88
  }
92
89
  logger.debug({ deletedContacts: isLatest ? oldContacts.size : 0, newContacts }, 'synced contacts');
93
90
  for (const msg of newMessages) {
94
- const jid = msg.key.remoteJid;
91
+ const jid = msg.key.remoteJidAlt || msg.key.remoteJid;
95
92
  const list = assertMessageList(jid);
96
93
  list.upsert(msg, 'prepend');
97
94
  }
@@ -108,11 +105,10 @@ exports.default = (config) => {
108
105
  contact = contacts[update.id];
109
106
  }
110
107
  else {
111
- const validContacts = getValidContacts();
112
- const contactHashes = validContacts.map((contactId) => {
113
- const { user } = (0, WABinary_1.jidDecode)(contactId);
114
- return [contactId, ((0, Utils_1.md5)(Buffer.from(user + 'WA_ADD_NOTIF', 'utf8'))).toString('base64').slice(0, 3)];
115
- });
108
+ const contactHashes = await Promise.all(Object.keys(contacts).map(async (contactId) => {
109
+ const { user } = jidDecode(contactId);
110
+ return [contactId, (await md5(Buffer.from(user + 'WA_ADD_NOTIF', 'utf8'))).toString('base64').slice(0, 3)];
111
+ }));
116
112
  contact = contacts[((_a = contactHashes.find(([, b]) => b === update.id)) === null || _a === void 0 ? void 0 : _a[0]) || '']; // find contact by attrs.hash, when user is not saved as a contact
117
113
  }
118
114
  if (contact) {
@@ -122,11 +118,11 @@ exports.default = (config) => {
122
118
  else if (update.imgUrl === 'removed') {
123
119
  delete contact.imgUrl;
124
120
  }
125
- Object.assign(contacts[contact.id], contact);
126
121
  }
127
122
  else {
128
- logger.debug({ update }, 'got update for non-existant contact');
123
+ return logger.debug({ update }, 'got update for non-existant contact');
129
124
  }
125
+ Object.assign(contacts[contact.id], contact);
130
126
  }
131
127
  });
132
128
  ev.on('chats.upsert', newChats => {
@@ -184,19 +180,17 @@ exports.default = (config) => {
184
180
  case 'append':
185
181
  case 'notify':
186
182
  for (const msg of newMessages) {
187
- const jid = (0, WABinary_1.jidNormalizedUser)(msg.key.remoteJid);
183
+ const jid = jidNormalizedUser(msg.key.remoteJidAlt || msg.key.remoteJid);
188
184
  const list = assertMessageList(jid);
189
185
  list.upsert(msg, 'append');
190
- if (type === 'notify') {
191
- if (!chats.get(jid)) {
192
- ev.emit('chats.upsert', [
193
- {
194
- id: jid,
195
- conversationTimestamp: (0, Utils_1.toNumber)(msg.messageTimestamp),
196
- unreadCount: 1
197
- }
198
- ]);
199
- }
186
+ if (type === 'notify' && !chats.get(jid)) {
187
+ ev.emit('chats.upsert', [
188
+ {
189
+ id: jid,
190
+ conversationTimestamp: toNumber(msg.messageTimestamp),
191
+ unreadCount: 1
192
+ }
193
+ ]);
200
194
  }
201
195
  }
202
196
  break;
@@ -205,7 +199,7 @@ exports.default = (config) => {
205
199
  ev.on('messages.update', updates => {
206
200
  var _a;
207
201
  for (const { update, key } of updates) {
208
- const list = assertMessageList((0, WABinary_1.jidNormalizedUser)(key.remoteJid));
202
+ const list = assertMessageList(jidNormalizedUser(key.remoteJid));
209
203
  if (update === null || update === void 0 ? void 0 : update.status) {
210
204
  const listStatus = (_a = list.get(key.id)) === null || _a === void 0 ? void 0 : _a.status;
211
205
  if (listStatus && (update === null || update === void 0 ? void 0 : update.status) <= listStatus) {
@@ -226,7 +220,7 @@ exports.default = (config) => {
226
220
  list === null || list === void 0 ? void 0 : list.clear();
227
221
  }
228
222
  else {
229
- const jid = item.keys[0].remoteJid;
223
+ const jid = item.keys[0].remoteJidAlt || item.keys[0].remoteJid;
230
224
  const list = messages[jid];
231
225
  if (list) {
232
226
  const idSet = new Set(item.keys.map(k => k.id));
@@ -250,37 +244,50 @@ exports.default = (config) => {
250
244
  if (metadata) {
251
245
  switch (action) {
252
246
  case 'add':
253
- metadata.participants.push(...participants.map(id => ({ id, isAdmin: false, isSuperAdmin: false })));
247
+ metadata.participants.push(...participants.map(participant => ({ id: participant.id, phoneNumber: participant.phoneNumber, admin: participant.admin })));
254
248
  break;
255
249
  case 'demote':
256
250
  case 'promote':
257
251
  for (const participant of metadata.participants) {
258
- if (participants.includes(participant.id)) {
259
- participant.isAdmin = action === 'promote';
252
+ for (const participantData of participants) {
253
+ if (participantData.id === participant.id || participantData.phoneNumber === participant.phoneNumber) {
254
+ participant.admin = action === 'promote' && 'admin';
255
+ }
260
256
  }
261
257
  }
262
258
  break;
263
259
  case 'remove':
264
- metadata.participants = metadata.participants.filter(p => !participants.includes(p.id));
260
+ const removeSet = new Set();
261
+ for (const p of participants) {
262
+ if (p.id)
263
+ removeSet.add(p.id);
264
+ if (p.phoneNumber)
265
+ removeSet.add(p.phoneNumber);
266
+ }
267
+ metadata.participants = metadata.participants.reduce((acc, p) => {
268
+ if (!removeSet.has(p.id) && !removeSet.has(p.phoneNumber))
269
+ acc.push(p);
270
+ return acc;
271
+ }, []);
265
272
  break;
266
273
  }
267
274
  }
268
275
  });
269
276
  ev.on('message-receipt.update', updates => {
270
277
  for (const { key, receipt } of updates) {
271
- const obj = messages[key.remoteJid];
278
+ const obj = messages[key.remoteJidAlt || key.remoteJid];
272
279
  const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
273
280
  if (msg) {
274
- (0, Utils_1.updateMessageWithReceipt)(msg, receipt);
281
+ updateMessageWithReceipt(msg, receipt);
275
282
  }
276
283
  }
277
284
  });
278
285
  ev.on('messages.reaction', (reactions) => {
279
286
  for (const { key, reaction } of reactions) {
280
- const obj = messages[key.remoteJid];
287
+ const obj = messages[key.remoteJidAlt || key.remoteJid];
281
288
  const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
282
289
  if (msg) {
283
- (0, Utils_1.updateMessageWithReaction)(msg, reaction);
290
+ updateMessageWithReaction(msg, reaction);
284
291
  }
285
292
  }
286
293
  });
@@ -300,7 +307,7 @@ exports.default = (config) => {
300
307
  for (const jid in json.messages) {
301
308
  const list = assertMessageList(jid);
302
309
  for (const msg of json.messages[jid]) {
303
- list.upsert(WAProto_1.proto.WebMessageInfo.fromObject(msg), 'append');
310
+ list.upsert(WAProto.WebMessageInfo.fromObject(msg), 'append');
304
311
  }
305
312
  }
306
313
  };
@@ -392,15 +399,6 @@ exports.default = (config) => {
392
399
  }
393
400
  return groupMetadata[jid];
394
401
  },
395
- // fetchBroadcastListInfo: async(jid: string, sock: WASocket | undefined) => {
396
- // if(!groupMetadata[jid]) {
397
- // const metadata = await sock?.getBroadcastListInfo(jid)
398
- // if(metadata) {
399
- // groupMetadata[jid] = metadata
400
- // }
401
- // }
402
- // return groupMetadata[jid]
403
- // },
404
402
  fetchMessageReceipts: async ({ remoteJid, id }) => {
405
403
  const list = messages[remoteJid];
406
404
  const msg = list === null || list === void 0 ? void 0 : list.get(id);
@@ -409,13 +407,9 @@ exports.default = (config) => {
409
407
  toJSON,
410
408
  fromJSON,
411
409
  writeToFile: (path) => {
412
- // require fs here so that in case "fs" is not available -- the app does not crash
413
- const { writeFileSync } = require('fs');
414
410
  writeFileSync(path, JSON.stringify(toJSON()));
415
411
  },
416
412
  readFromFile: (path) => {
417
- // require fs here so that in case "fs" is not available -- the app does not crash
418
- const { readFileSync, existsSync } = require('fs');
419
413
  if (existsSync(path)) {
420
414
  logger.debug({ path }, 'reading from file');
421
415
  const jsonStr = readFileSync(path, { encoding: 'utf-8' });
@@ -424,4 +418,4 @@ exports.default = (config) => {
424
418
  }
425
419
  }
426
420
  };
427
- };
421
+ };
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function makeOrderedDictionary(idGetter) {
1
+ export function makeOrderedDictionary(idGetter) {
4
2
  const array = [];
5
3
  const dict = {};
6
4
  const get = (id) => dict[id];
@@ -56,9 +54,9 @@ function makeOrderedDictionary(idGetter) {
56
54
  },
57
55
  clear: () => {
58
56
  array.splice(0, array.length);
59
- Object.keys(dict).forEach(key => {
57
+ for (const key of Object.keys(dict)) {
60
58
  delete dict[key];
61
- });
59
+ }
62
60
  },
63
61
  filter: (contain) => {
64
62
  let i = 0;
@@ -77,5 +75,4 @@ function makeOrderedDictionary(idGetter) {
77
75
  array.splice(0, array.length, ...newItems);
78
76
  }
79
77
  };
80
- }
81
- exports.default = makeOrderedDictionary;
78
+ }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectRepository = void 0;
4
- class ObjectRepository {
1
+ export class ObjectRepository {
5
2
  constructor(entities = {}) {
6
3
  this.entityMap = new Map(Object.entries(entities));
7
4
  }
@@ -23,5 +20,4 @@ class ObjectRepository {
23
20
  toJSON() {
24
21
  return this.findAll();
25
22
  }
26
- }
27
- exports.ObjectRepository = ObjectRepository;
23
+ }
package/lib/Types/Auth.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/lib/Types/Call.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/lib/Types/Chat.js CHANGED
@@ -1,4 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_WA_PATCH_NAMES = void 0;
4
- exports.ALL_WA_PATCH_NAMES = ['critical_block', 'critical_unblock_low', 'regular_high', 'regular_low', 'regular'];
1
+ export const ALL_WA_PATCH_NAMES = [
2
+ 'critical_block',
3
+ 'critical_unblock_low',
4
+ 'regular_high',
5
+ 'regular_low',
6
+ 'regular'
7
+ ];
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ import { proto } from '../../WAProto/index.js';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LabelColor = void 0;
4
1
  /** WhatsApp has 20 predefined colors */
5
- var LabelColor;
2
+ export var LabelColor;
6
3
  (function (LabelColor) {
7
4
  LabelColor[LabelColor["Color1"] = 0] = "Color1";
8
5
  LabelColor[LabelColor["Color2"] = 1] = "Color2";
@@ -24,4 +21,4 @@ var LabelColor;
24
21
  LabelColor[LabelColor["Color18"] = 17] = "Color18";
25
22
  LabelColor[LabelColor["Color19"] = 18] = "Color19";
26
23
  LabelColor[LabelColor["Color20"] = 19] = "Color20";
27
- })(LabelColor = exports.LabelColor || (exports.LabelColor = {}));
24
+ })(LabelColor || (LabelColor = {}));
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LabelAssociationType = void 0;
4
1
  /** Association type */
5
- var LabelAssociationType;
2
+ export var LabelAssociationType;
6
3
  (function (LabelAssociationType) {
7
4
  LabelAssociationType["Chat"] = "label_jid";
8
5
  LabelAssociationType["Message"] = "label_message";
9
- })(LabelAssociationType = exports.LabelAssociationType || (exports.LabelAssociationType = {}));
6
+ })(LabelAssociationType || (LabelAssociationType = {}));
@@ -1,9 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
4
- const WAProto_1 = require("../../WAProto");
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
- exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
8
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
9
- exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
1
+ import { proto } from '../../WAProto/index.js';
2
+ // export the WAMessage Prototypes
3
+ export { proto as WAProto };
4
+ // vltcs@changes 03-02-26 --- Add exported message-related enum types from proto.Message
5
+ export const AssociationType = proto.MessageAssociation.AssociationType;
6
+ export const ButtonHeaderType = proto.Message.ButtonsMessage.HeaderType;
7
+ export const ButtonType = proto.Message.ButtonsMessage.Button.Type;
8
+ export const CarouselCardType = proto.Message.InteractiveMessage.CarouselMessage.CarouselCardType;
9
+ export const ListType = proto.Message.ListMessage.ListType;
10
+ export const ProtocolType = proto.Message.ProtocolMessage.Type;
11
+ export const WAMessageStubType = proto.WebMessageInfo.StubType;
12
+ export const WAMessageStatus = proto.WebMessageInfo.Status;
13
+ export var WAMessageAddressingMode;
14
+ (function (WAMessageAddressingMode) {
15
+ WAMessageAddressingMode["PN"] = "pn";
16
+ WAMessageAddressingMode["LID"] = "lid";
17
+ })(WAMessageAddressingMode || (WAMessageAddressingMode = {}));
@@ -1,38 +1,33 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const MexOperations = {
6
- PROMOTE: "NotificationNewsletterAdminPromote",
7
- DEMOTE: "NotificationNewsletterAdminDemote",
8
- UPDATE: "NotificationNewsletterUpdate"
9
- }
10
-
11
- const XWAPaths = {
12
- PROMOTE: "xwa2_notify_newsletter_admin_promote",
13
- DEMOTE: "xwa2_notify_newsletter_admin_demote",
14
- ADMIN_COUNT: "xwa2_newsletter_admin",
15
- CREATE: "xwa2_newsletter_create",
16
- NEWSLETTER: "xwa2_newsletter",
17
- SUBSCRIBED: "xwa2_newsletter_subscribed",
18
- METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
19
- }
20
-
21
- const QueryIds = {
22
- JOB_MUTATION: "7150902998257522",
23
- METADATA: "6620195908089573",
24
- UNFOLLOW: "7238632346214362",
25
- FOLLOW: "7871414976211147",
26
- UNMUTE: "7337137176362961",
27
- MUTE: "25151904754424642",
28
- CREATE: "6996806640408138",
29
- ADMIN_COUNT: "7130823597031706",
30
- CHANGE_OWNER: "7341777602580933",
31
- DELETE: "8316537688363079",
32
- DEMOTE: "6551828931592903",
33
- SUBSCRIBED: "6388546374527196"
34
- }
35
-
36
- exports.MexOperations = MexOperations
37
- exports.XWAPaths = XWAPaths
38
- exports.QueryIds = QueryIds
1
+ export var XWAPaths;
2
+ (function (XWAPaths) {
3
+ XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
4
+ XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
5
+ XWAPaths["xwa2_newsletter_subscribed"] = "xwa2_newsletter_subscribed";
6
+ XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
7
+ XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
8
+ XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
9
+ XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
10
+ XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
11
+ XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
12
+ XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
13
+ XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
14
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
15
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
16
+ })(XWAPaths || (XWAPaths = {}));
17
+ export var QueryIds;
18
+ (function (QueryIds) {
19
+ QueryIds["CREATE"] = "8823471724422422";
20
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
21
+ QueryIds["METADATA"] = "6563316087068696";
22
+ QueryIds["JOB_MUTATION"] = "7150902998257522";
23
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
24
+ QueryIds["SUBSCRIBED"] = "6388546374527196";
25
+ QueryIds["FOLLOW"] = "7871414976211147";
26
+ QueryIds["UNFOLLOW"] = "7238632346214362";
27
+ QueryIds["MUTE"] = "29766401636284406";
28
+ QueryIds["UNMUTE"] = "9864994326891137";
29
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
30
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
31
+ QueryIds["DEMOTE"] = "6551828931592903";
32
+ QueryIds["DELETE"] = "30062808666639665";
33
+ })(QueryIds || (QueryIds = {}));
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ import { proto } from '../../WAProto/index.js';
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ import { proto } from '../../WAProto/index.js';
2
+ import {} from './Message.js';
@@ -1,2 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ import { Boom } from '@hapi/boom';
2
+ export var SyncState;
3
+ (function (SyncState) {
4
+ /** The socket is connecting, but we haven't received pending notifications yet. */
5
+ SyncState[SyncState["Connecting"] = 0] = "Connecting";
6
+ /** Pending notifications received. Buffering events until we decide whether to sync or not. */
7
+ SyncState[SyncState["AwaitingInitialSync"] = 1] = "AwaitingInitialSync";
8
+ /** The initial app state sync (history, etc.) is in progress. Buffering continues. */
9
+ SyncState[SyncState["Syncing"] = 2] = "Syncing";
10
+ /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
11
+ SyncState[SyncState["Online"] = 3] = "Online";
12
+ })(SyncState || (SyncState = {}));
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ import { USyncUser } from '../WAUSync/index.js';
@@ -1,33 +1,16 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DisconnectReason = void 0;
18
- __exportStar(require("./Auth"), exports);
19
- __exportStar(require("./GroupMetadata"), exports);
20
- __exportStar(require("./Chat"), exports);
21
- __exportStar(require("./Contact"), exports);
22
- __exportStar(require("./State"), exports);
23
- __exportStar(require("./Message"), exports);
24
- __exportStar(require("./Newsletter"), exports);
25
- __exportStar(require("./Socket"), exports);
26
- __exportStar(require("./Events"), exports);
27
- __exportStar(require("./Product"), exports);
28
- __exportStar(require("./Call"), exports);
29
- __exportStar(require("./Signal"), exports);
30
- var DisconnectReason;
1
+ export * from './Auth.js';
2
+ export * from './GroupMetadata.js';
3
+ export * from './Chat.js';
4
+ export * from './Contact.js';
5
+ export * from './State.js';
6
+ export * from './Message.js';
7
+ export * from './Socket.js';
8
+ export * from './Events.js';
9
+ export * from './Product.js';
10
+ export * from './Call.js';
11
+ export * from './Signal.js';
12
+ export * from './Newsletter.js';
13
+ export var DisconnectReason;
31
14
  (function (DisconnectReason) {
32
15
  DisconnectReason[DisconnectReason["connectionClosed"] = 428] = "connectionClosed";
33
16
  DisconnectReason[DisconnectReason["connectionLost"] = 408] = "connectionLost";
@@ -39,4 +22,4 @@ var DisconnectReason;
39
22
  DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
40
23
  DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
41
24
  DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
42
- })(DisconnectReason = exports.DisconnectReason || (exports.DisconnectReason = {}));
25
+ })(DisconnectReason || (DisconnectReason = {}));