xhyphersockets 1.4.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.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -0
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +4775 -0
  5. package/WAProto/index.d.ts +55057 -0
  6. package/WAProto/index.js +169661 -0
  7. package/WAProto/index.ts.ts +53473 -0
  8. package/engine-requirements.js +10 -0
  9. package/lib/Defaults/baileys-version.json +3 -0
  10. package/lib/Defaults/index.d.ts +51 -0
  11. package/lib/Defaults/index.js +106 -0
  12. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  13. package/lib/Signal/Group/ciphertext-message.js +15 -0
  14. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  15. package/lib/Signal/Group/group-session-builder.js +64 -0
  16. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  17. package/lib/Signal/Group/group_cipher.js +96 -0
  18. package/lib/Signal/Group/index.d.ts +11 -0
  19. package/lib/Signal/Group/index.js +57 -0
  20. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  21. package/lib/Signal/Group/keyhelper.js +55 -0
  22. package/lib/Signal/Group/queue-job.d.ts +1 -0
  23. package/lib/Signal/Group/queue-job.js +57 -0
  24. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  25. package/lib/Signal/Group/sender-chain-key.js +34 -0
  26. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  27. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  28. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  29. package/lib/Signal/Group/sender-key-message.js +69 -0
  30. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  31. package/lib/Signal/Group/sender-key-name.js +51 -0
  32. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  33. package/lib/Signal/Group/sender-key-record.js +53 -0
  34. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  35. package/lib/Signal/Group/sender-key-state.js +99 -0
  36. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  37. package/lib/Signal/Group/sender-message-key.js +29 -0
  38. package/lib/Signal/libsignal.d.ts +3 -0
  39. package/lib/Signal/libsignal.js +174 -0
  40. package/lib/Socket/Client/index.d.ts +2 -0
  41. package/lib/Socket/Client/index.js +18 -0
  42. package/lib/Socket/Client/types.d.ts +16 -0
  43. package/lib/Socket/Client/types.js +13 -0
  44. package/lib/Socket/Client/websocket.d.ts +13 -0
  45. package/lib/Socket/Client/websocket.js +111 -0
  46. package/lib/Socket/RHandler.d.ts +416 -0
  47. package/lib/Socket/RHandler.js +530 -0
  48. package/lib/Socket/business.d.ts +172 -0
  49. package/lib/Socket/business.js +260 -0
  50. package/lib/Socket/chats.d.ts +94 -0
  51. package/lib/Socket/chats.js +908 -0
  52. package/lib/Socket/groups.d.ts +124 -0
  53. package/lib/Socket/groups.js +332 -0
  54. package/lib/Socket/index.d.ts +172 -0
  55. package/lib/Socket/index.js +10 -0
  56. package/lib/Socket/messages-recv.d.ts +161 -0
  57. package/lib/Socket/messages-recv.js +1054 -0
  58. package/lib/Socket/messages-send.d.ts +152 -0
  59. package/lib/Socket/messages-send.js +903 -0
  60. package/lib/Socket/newsletter.d.ts +136 -0
  61. package/lib/Socket/newsletter.js +303 -0
  62. package/lib/Socket/socket.d.ts +43 -0
  63. package/lib/Socket/socket.js +654 -0
  64. package/lib/Socket/usync.d.ts +36 -0
  65. package/lib/Socket/usync.js +70 -0
  66. package/lib/Store/index.d.ts +2 -0
  67. package/lib/Store/index.js +8 -0
  68. package/lib/Store/make-in-memory-store.d.ts +118 -0
  69. package/lib/Store/make-in-memory-store.js +439 -0
  70. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  71. package/lib/Store/make-ordered-dictionary.js +81 -0
  72. package/lib/Store/object-repository.d.ts +10 -0
  73. package/lib/Store/object-repository.js +27 -0
  74. package/lib/Types/Auth.d.ts +103 -0
  75. package/lib/Types/Auth.js +2 -0
  76. package/lib/Types/Call.d.ts +13 -0
  77. package/lib/Types/Call.js +2 -0
  78. package/lib/Types/Chat.d.ts +109 -0
  79. package/lib/Types/Chat.js +4 -0
  80. package/lib/Types/Contact.d.ts +23 -0
  81. package/lib/Types/Contact.js +2 -0
  82. package/lib/Types/Events.d.ts +199 -0
  83. package/lib/Types/Events.js +2 -0
  84. package/lib/Types/GroupMetadata.d.ts +64 -0
  85. package/lib/Types/GroupMetadata.js +2 -0
  86. package/lib/Types/Label.d.ts +35 -0
  87. package/lib/Types/Label.js +27 -0
  88. package/lib/Types/LabelAssociation.d.ts +29 -0
  89. package/lib/Types/LabelAssociation.js +9 -0
  90. package/lib/Types/Message.d.ts +402 -0
  91. package/lib/Types/Message.js +7 -0
  92. package/lib/Types/Newsletter.d.ts +103 -0
  93. package/lib/Types/Newsletter.js +38 -0
  94. package/lib/Types/Product.d.ts +78 -0
  95. package/lib/Types/Product.js +2 -0
  96. package/lib/Types/Signal.d.ts +57 -0
  97. package/lib/Types/Signal.js +2 -0
  98. package/lib/Types/Socket.d.ts +119 -0
  99. package/lib/Types/Socket.js +2 -0
  100. package/lib/Types/State.d.ts +27 -0
  101. package/lib/Types/State.js +2 -0
  102. package/lib/Types/USync.d.ts +25 -0
  103. package/lib/Types/USync.js +2 -0
  104. package/lib/Types/index.d.ts +64 -0
  105. package/lib/Types/index.js +42 -0
  106. package/lib/Utils/audioToBuffer.js +29 -0
  107. package/lib/Utils/auth-utils.d.ts +18 -0
  108. package/lib/Utils/auth-utils.js +199 -0
  109. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  110. package/lib/Utils/baileys-event-stream.js +63 -0
  111. package/lib/Utils/business.d.ts +22 -0
  112. package/lib/Utils/business.js +234 -0
  113. package/lib/Utils/chat-utils.d.ts +70 -0
  114. package/lib/Utils/chat-utils.js +730 -0
  115. package/lib/Utils/crypto.d.ts +40 -0
  116. package/lib/Utils/crypto.js +193 -0
  117. package/lib/Utils/decode-wa-message.d.ts +35 -0
  118. package/lib/Utils/decode-wa-message.js +207 -0
  119. package/lib/Utils/event-buffer.d.ts +35 -0
  120. package/lib/Utils/event-buffer.js +518 -0
  121. package/lib/Utils/generics.d.ts +89 -0
  122. package/lib/Utils/generics.js +428 -0
  123. package/lib/Utils/history.d.ts +19 -0
  124. package/lib/Utils/history.js +94 -0
  125. package/lib/Utils/index.d.ts +19 -0
  126. package/lib/Utils/index.js +36 -0
  127. package/lib/Utils/link-preview.d.ts +21 -0
  128. package/lib/Utils/link-preview.js +126 -0
  129. package/lib/Utils/logger.d.ts +11 -0
  130. package/lib/Utils/logger.js +7 -0
  131. package/lib/Utils/lt-hash.d.ts +12 -0
  132. package/lib/Utils/lt-hash.js +51 -0
  133. package/lib/Utils/make-mutex.d.ts +7 -0
  134. package/lib/Utils/make-mutex.js +43 -0
  135. package/lib/Utils/messages-media.d.ts +124 -0
  136. package/lib/Utils/messages-media.js +887 -0
  137. package/lib/Utils/messages.d.ts +75 -0
  138. package/lib/Utils/messages.js +1030 -0
  139. package/lib/Utils/noise-handler.d.ts +19 -0
  140. package/lib/Utils/noise-handler.js +150 -0
  141. package/lib/Utils/process-message.d.ts +42 -0
  142. package/lib/Utils/process-message.js +385 -0
  143. package/lib/Utils/signal.d.ts +33 -0
  144. package/lib/Utils/signal.js +153 -0
  145. package/lib/Utils/streamToBuffer.js +15 -0
  146. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  147. package/lib/Utils/use-multi-file-auth-state.js +125 -0
  148. package/lib/Utils/validate-connection.d.ts +10 -0
  149. package/lib/Utils/validate-connection.js +173 -0
  150. package/lib/WABinary/constants.d.ts +27 -0
  151. package/lib/WABinary/constants.js +1303 -0
  152. package/lib/WABinary/decode.d.ts +6 -0
  153. package/lib/WABinary/decode.js +265 -0
  154. package/lib/WABinary/encode.d.ts +2 -0
  155. package/lib/WABinary/encode.js +250 -0
  156. package/lib/WABinary/generic-utils.d.ts +14 -0
  157. package/lib/WABinary/generic-utils.js +110 -0
  158. package/lib/WABinary/index.d.ts +5 -0
  159. package/lib/WABinary/index.js +21 -0
  160. package/lib/WABinary/jid-utils.d.ts +36 -0
  161. package/lib/WABinary/jid-utils.js +83 -0
  162. package/lib/WABinary/jid-utils.js.bak +83 -0
  163. package/lib/WABinary/types.d.ts +18 -0
  164. package/lib/WABinary/types.js +2 -0
  165. package/lib/WAM/BinaryInfo.d.ts +8 -0
  166. package/lib/WAM/BinaryInfo.js +13 -0
  167. package/lib/WAM/constants.d.ts +38 -0
  168. package/lib/WAM/constants.js +15350 -0
  169. package/lib/WAM/encode.d.ts +2 -0
  170. package/lib/WAM/encode.js +155 -0
  171. package/lib/WAM/index.d.ts +3 -0
  172. package/lib/WAM/index.js +19 -0
  173. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  174. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  175. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  176. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  177. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  178. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  179. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  180. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  181. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  182. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  183. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  184. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  185. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  186. package/lib/WAUSync/Protocols/index.js +20 -0
  187. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  188. package/lib/WAUSync/USyncQuery.js +89 -0
  189. package/lib/WAUSync/USyncUser.d.ts +12 -0
  190. package/lib/WAUSync/USyncUser.js +26 -0
  191. package/lib/WAUSync/index.d.ts +3 -0
  192. package/lib/WAUSync/index.js +19 -0
  193. package/lib/index.d.ts +16 -0
  194. package/lib/index.js +75 -0
  195. package/package.json +110 -0
@@ -0,0 +1,908 @@
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.makeChatsSocket = void 0;
7
+ const boom_1 = require("@hapi/boom");
8
+ const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
9
+ const WAProto_1 = require("../../WAProto");
10
+ const Defaults_1 = require("../Defaults");
11
+ const Types_1 = require("../Types");
12
+ const Utils_1 = require("../Utils");
13
+ const make_mutex_1 = require("../Utils/make-mutex");
14
+ const process_message_1 = __importDefault(require("../Utils/process-message"));
15
+ const WABinary_1 = require("../WABinary");
16
+ const WAUSync_1 = require("../WAUSync");
17
+ const usync_1 = require("./usync");
18
+ const MAX_SYNC_ATTEMPTS = 2;
19
+ const makeChatsSocket = (config) => {
20
+ const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config;
21
+ const sock = (0, usync_1.makeUSyncSocket)(config);
22
+ const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError, } = sock;
23
+ let privacySettings;
24
+ let needToFlushWithAppStateSync = false;
25
+ let pendingAppStateSync = false;
26
+ /** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */
27
+ const processingMutex = (0, make_mutex_1.makeMutex)();
28
+ const placeholderResendCache = config.placeholderResendCache || new node_cache_1.default({
29
+ stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
30
+ useClones: false
31
+ });
32
+ if (!config.placeholderResendCache) {
33
+ config.placeholderResendCache = placeholderResendCache;
34
+ }
35
+ /** helper function to fetch the given app state sync key */
36
+ const getAppStateSyncKey = async (keyId) => {
37
+ const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId]);
38
+ return key;
39
+ };
40
+ const fetchPrivacySettings = async (force = false) => {
41
+ if (!privacySettings || force) {
42
+ const { content } = await query({
43
+ tag: 'iq',
44
+ attrs: {
45
+ xmlns: 'privacy',
46
+ to: WABinary_1.S_WHATSAPP_NET,
47
+ type: 'get'
48
+ },
49
+ content: [
50
+ { tag: 'privacy', attrs: {} }
51
+ ]
52
+ });
53
+ privacySettings = (0, WABinary_1.reduceBinaryNodeToDictionary)(content === null || content === void 0 ? void 0 : content[0], 'category');
54
+ }
55
+ return privacySettings;
56
+ };
57
+ /** helper function to run a privacy IQ query */
58
+ const privacyQuery = async (name, value) => {
59
+ await query({
60
+ tag: 'iq',
61
+ attrs: {
62
+ xmlns: 'privacy',
63
+ to: WABinary_1.S_WHATSAPP_NET,
64
+ type: 'set'
65
+ },
66
+ content: [{
67
+ tag: 'privacy',
68
+ attrs: {},
69
+ content: [
70
+ {
71
+ tag: 'category',
72
+ attrs: { name, value }
73
+ }
74
+ ]
75
+ }]
76
+ });
77
+ };
78
+ const updateMessagesPrivacy = async (value) => {
79
+ await privacyQuery('messages', value);
80
+ };
81
+ const updateCallPrivacy = async (value) => {
82
+ await privacyQuery('calladd', value);
83
+ };
84
+ const updateLastSeenPrivacy = async (value) => {
85
+ await privacyQuery('last', value);
86
+ };
87
+ const updateOnlinePrivacy = async (value) => {
88
+ await privacyQuery('online', value);
89
+ };
90
+ const updateProfilePicturePrivacy = async (value) => {
91
+ await privacyQuery('profile', value);
92
+ };
93
+ const updateStatusPrivacy = async (value) => {
94
+ await privacyQuery('status', value);
95
+ };
96
+ const updateReadReceiptsPrivacy = async (value) => {
97
+ await privacyQuery('readreceipts', value);
98
+ };
99
+ const updateGroupsAddPrivacy = async (value) => {
100
+ await privacyQuery('groupadd', value);
101
+ };
102
+ const updateDefaultDisappearingMode = async (duration) => {
103
+ await query({
104
+ tag: 'iq',
105
+ attrs: {
106
+ xmlns: 'disappearing_mode',
107
+ to: WABinary_1.S_WHATSAPP_NET,
108
+ type: 'set'
109
+ },
110
+ content: [{
111
+ tag: 'disappearing_mode',
112
+ attrs: {
113
+ duration: duration.toString()
114
+ }
115
+ }]
116
+ });
117
+ };
118
+ const getBotListV2 = async () => {
119
+ const resp = await query({
120
+ tag: 'iq',
121
+ attrs: {
122
+ xmlns: 'bot',
123
+ to: WABinary_1.S_WHATSAPP_NET,
124
+ type: 'get'
125
+ },
126
+ content: [{
127
+ tag: 'bot',
128
+ attrs: {
129
+ v: '2'
130
+ }
131
+ }]
132
+ });
133
+ const botNode = (0, WABinary_1.getBinaryNodeChild)(resp, 'bot');
134
+ const botList = [];
135
+ for (const section of (0, WABinary_1.getBinaryNodeChildren)(botNode, 'section')) {
136
+ if (section.attrs.type === 'all') {
137
+ for (const bot of (0, WABinary_1.getBinaryNodeChildren)(section, 'bot')) {
138
+ botList.push({
139
+ jid: bot.attrs.jid,
140
+ personaId: bot.attrs['persona_id']
141
+ });
142
+ }
143
+ }
144
+ }
145
+ return botList;
146
+ };
147
+ const onWhatsApp = async (...jids) => {
148
+ const usyncQuery = new WAUSync_1.USyncQuery()
149
+ .withContactProtocol()
150
+ .withLIDProtocol();
151
+ for (const jid of jids) {
152
+ const phone = `+${jid.replace('+', '').split('@')[0].split(':')[0]}`;
153
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withPhone(phone));
154
+ }
155
+ const results = await sock.executeUSyncQuery(usyncQuery);
156
+ if (results) {
157
+ return results.list.filter((a) => !!a.contact).map(({ contact, id, lid }) => ({ jid: id, exists: contact, lid }));
158
+ }
159
+ };
160
+ const fetchStatus = async (...jids) => {
161
+ const usyncQuery = new WAUSync_1.USyncQuery()
162
+ .withStatusProtocol();
163
+ for (const jid of jids) {
164
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
165
+ }
166
+ const result = await sock.executeUSyncQuery(usyncQuery);
167
+ if (result) {
168
+ return result.list;
169
+ }
170
+ };
171
+ const checkStatusWA = async (numberOrJid) => {
172
+ try {
173
+ const jid = numberOrJid.includes('@s.whatsapp.net')
174
+ ? numberOrJid
175
+ : numberOrJid.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
176
+
177
+ const exists = await onWhatsApp(jid)
178
+ if (!exists || !exists[0]?.exists) {
179
+ return {
180
+ jid,
181
+ IsBanned: true,
182
+ Statusbio: null,
183
+ setAt: null
184
+ }
185
+ }
186
+
187
+ const fetched = await fetchStatus(jid).catch(() => [])
188
+ const status = fetched?.[0]?.status?.status || null
189
+ const setAt = fetched?.[0]?.status?.setAt || null
190
+
191
+ return {
192
+ jid,
193
+ IsBanned: false,
194
+ Statusbio: status,
195
+ setAt
196
+ }
197
+ } catch (e) {
198
+ return {
199
+ jid: numberOrJid,
200
+ IsBanned: true,
201
+ Statusbio: null,
202
+ setAt: null,
203
+ error: e.message
204
+ }
205
+ }
206
+ }
207
+ const fetchDisappearingDuration = async (...jids) => {
208
+ const usyncQuery = new WAUSync_1.USyncQuery()
209
+ .withDisappearingModeProtocol();
210
+ for (const jid of jids) {
211
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
212
+ }
213
+ const result = await sock.executeUSyncQuery(usyncQuery);
214
+ if (result) {
215
+ return result.list;
216
+ }
217
+ };
218
+ /** update the profile picture for yourself or a group */
219
+ const updateProfilePicture = async (jid, content) => {
220
+ let targetJid;
221
+ if (!jid) {
222
+ throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
223
+ }
224
+ if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
225
+ targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
226
+ }
227
+ const { img } = await (0, Utils_1.generateProfilePicture)(content);
228
+ await query({
229
+ tag: 'iq',
230
+ attrs: {
231
+ target: targetJid,
232
+ to: WABinary_1.S_WHATSAPP_NET,
233
+ type: 'set',
234
+ xmlns: 'w:profile:picture'
235
+ },
236
+ content: [
237
+ {
238
+ tag: 'picture',
239
+ attrs: { type: 'image' },
240
+ content: img
241
+ }
242
+ ]
243
+ });
244
+ };
245
+ /** remove the profile picture for yourself or a group */
246
+ const removeProfilePicture = async (jid) => {
247
+ let targetJid;
248
+ if (!jid) {
249
+ throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
250
+ }
251
+ if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
252
+ targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
253
+ }
254
+ await query({
255
+ tag: 'iq',
256
+ attrs: {
257
+ target: targetJid,
258
+ to: WABinary_1.S_WHATSAPP_NET,
259
+ type: 'set',
260
+ xmlns: 'w:profile:picture'
261
+ }
262
+ });
263
+ };
264
+ /** update the profile status for yourself */
265
+ const updateProfileStatus = async (status) => {
266
+ await query({
267
+ tag: 'iq',
268
+ attrs: {
269
+ to: WABinary_1.S_WHATSAPP_NET,
270
+ type: 'set',
271
+ xmlns: 'status'
272
+ },
273
+ content: [
274
+ {
275
+ tag: 'status',
276
+ attrs: {},
277
+ content: Buffer.from(status, 'utf-8')
278
+ }
279
+ ]
280
+ });
281
+ };
282
+ const updateProfileName = async (name) => {
283
+ await chatModify({ pushNameSetting: name }, '');
284
+ };
285
+ const fetchBlocklist = async () => {
286
+ const result = await query({
287
+ tag: 'iq',
288
+ attrs: {
289
+ xmlns: 'blocklist',
290
+ to: WABinary_1.S_WHATSAPP_NET,
291
+ type: 'get'
292
+ }
293
+ });
294
+ const listNode = (0, WABinary_1.getBinaryNodeChild)(result, 'list');
295
+ return (0, WABinary_1.getBinaryNodeChildren)(listNode, 'item')
296
+ .map(n => n.attrs.jid);
297
+ };
298
+ const updateBlockStatus = async (jid, action) => {
299
+ await query({
300
+ tag: 'iq',
301
+ attrs: {
302
+ xmlns: 'blocklist',
303
+ to: WABinary_1.S_WHATSAPP_NET,
304
+ type: 'set'
305
+ },
306
+ content: [
307
+ {
308
+ tag: 'item',
309
+ attrs: {
310
+ action,
311
+ jid
312
+ }
313
+ }
314
+ ]
315
+ });
316
+ };
317
+ const getBusinessProfile = async (jid) => {
318
+ var _a, _b, _c, _d, _e, _f, _g;
319
+ const results = await query({
320
+ tag: 'iq',
321
+ attrs: {
322
+ to: 's.whatsapp.net',
323
+ xmlns: 'w:biz',
324
+ type: 'get'
325
+ },
326
+ content: [{
327
+ tag: 'business_profile',
328
+ attrs: { v: '244' },
329
+ content: [{
330
+ tag: 'profile',
331
+ attrs: { jid }
332
+ }]
333
+ }]
334
+ });
335
+ const profileNode = (0, WABinary_1.getBinaryNodeChild)(results, 'business_profile');
336
+ const profiles = (0, WABinary_1.getBinaryNodeChild)(profileNode, 'profile');
337
+ if (profiles) {
338
+ const address = (0, WABinary_1.getBinaryNodeChild)(profiles, 'address');
339
+ const description = (0, WABinary_1.getBinaryNodeChild)(profiles, 'description');
340
+ const website = (0, WABinary_1.getBinaryNodeChild)(profiles, 'website');
341
+ const email = (0, WABinary_1.getBinaryNodeChild)(profiles, 'email');
342
+ const category = (0, WABinary_1.getBinaryNodeChild)((0, WABinary_1.getBinaryNodeChild)(profiles, 'categories'), 'category');
343
+ const businessHours = (0, WABinary_1.getBinaryNodeChild)(profiles, 'business_hours');
344
+ const businessHoursConfig = businessHours
345
+ ? (0, WABinary_1.getBinaryNodeChildren)(businessHours, 'business_hours_config')
346
+ : undefined;
347
+ const websiteStr = (_a = website === null || website === void 0 ? void 0 : website.content) === null || _a === void 0 ? void 0 : _a.toString();
348
+ return {
349
+ wid: (_b = profiles.attrs) === null || _b === void 0 ? void 0 : _b.jid,
350
+ address: (_c = address === null || address === void 0 ? void 0 : address.content) === null || _c === void 0 ? void 0 : _c.toString(),
351
+ description: ((_d = description === null || description === void 0 ? void 0 : description.content) === null || _d === void 0 ? void 0 : _d.toString()) || '',
352
+ website: websiteStr ? [websiteStr] : [],
353
+ email: (_e = email === null || email === void 0 ? void 0 : email.content) === null || _e === void 0 ? void 0 : _e.toString(),
354
+ category: (_f = category === null || category === void 0 ? void 0 : category.content) === null || _f === void 0 ? void 0 : _f.toString(),
355
+ 'business_hours': {
356
+ timezone: (_g = businessHours === null || businessHours === void 0 ? void 0 : businessHours.attrs) === null || _g === void 0 ? void 0 : _g.timezone,
357
+ 'business_config': businessHoursConfig === null || businessHoursConfig === void 0 ? void 0 : businessHoursConfig.map(({ attrs }) => attrs)
358
+ }
359
+ };
360
+ }
361
+ };
362
+ const cleanDirtyBits = async (type, fromTimestamp) => {
363
+ logger.info({ fromTimestamp }, 'clean dirty bits ' + type);
364
+ await sendNode({
365
+ tag: 'iq',
366
+ attrs: {
367
+ to: WABinary_1.S_WHATSAPP_NET,
368
+ type: 'set',
369
+ xmlns: 'urn:xmpp:whatsapp:dirty',
370
+ id: generateMessageTag(),
371
+ },
372
+ content: [
373
+ {
374
+ tag: 'clean',
375
+ attrs: {
376
+ type,
377
+ ...(fromTimestamp ? { timestamp: fromTimestamp.toString() } : null),
378
+ }
379
+ }
380
+ ]
381
+ });
382
+ };
383
+ const newAppStateChunkHandler = (isInitialSync) => {
384
+ return {
385
+ onMutation(mutation) {
386
+ (0, Utils_1.processSyncAction)(mutation, ev, authState.creds.me, isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, logger);
387
+ }
388
+ };
389
+ };
390
+ const resyncAppState = ev.createBufferedFunction(async (collections, isInitialSync) => {
391
+ // we use this to determine which events to fire
392
+ // otherwise when we resync from scratch -- all notifications will fire
393
+ const initialVersionMap = {};
394
+ const globalMutationMap = {};
395
+ await authState.keys.transaction(async () => {
396
+ var _a;
397
+ const collectionsToHandle = new Set(collections);
398
+ // in case something goes wrong -- ensure we don't enter a loop that cannot be exited from
399
+ const attemptsMap = {};
400
+ // keep executing till all collections are done
401
+ // sometimes a single patch request will not return all the patches (God knows why)
402
+ // so we fetch till they're all done (this is determined by the "has_more_patches" flag)
403
+ while (collectionsToHandle.size) {
404
+ const states = {};
405
+ const nodes = [];
406
+ for (const name of collectionsToHandle) {
407
+ const result = await authState.keys.get('app-state-sync-version', [name]);
408
+ let state = result[name];
409
+ if (state) {
410
+ if (typeof initialVersionMap[name] === 'undefined') {
411
+ initialVersionMap[name] = state.version;
412
+ }
413
+ }
414
+ else {
415
+ state = (0, Utils_1.newLTHashState)();
416
+ }
417
+ states[name] = state;
418
+ logger.info(`resyncing ${name} from v${state.version}`);
419
+ nodes.push({
420
+ tag: 'collection',
421
+ attrs: {
422
+ name,
423
+ version: state.version.toString(),
424
+ // return snapshot if being synced from scratch
425
+ 'return_snapshot': (!state.version).toString()
426
+ }
427
+ });
428
+ }
429
+ const result = await query({
430
+ tag: 'iq',
431
+ attrs: {
432
+ to: WABinary_1.S_WHATSAPP_NET,
433
+ xmlns: 'w:sync:app:state',
434
+ type: 'set'
435
+ },
436
+ content: [
437
+ {
438
+ tag: 'sync',
439
+ attrs: {},
440
+ content: nodes
441
+ }
442
+ ]
443
+ });
444
+ // extract from binary node
445
+ const decoded = await (0, Utils_1.extractSyncdPatches)(result, config === null || config === void 0 ? void 0 : config.options);
446
+ for (const key in decoded) {
447
+ const name = key;
448
+ const { patches, hasMorePatches, snapshot } = decoded[name];
449
+ try {
450
+ if (snapshot) {
451
+ const { state: newState, mutationMap } = await (0, Utils_1.decodeSyncdSnapshot)(name, snapshot, getAppStateSyncKey, initialVersionMap[name], appStateMacVerification.snapshot);
452
+ states[name] = newState;
453
+ Object.assign(globalMutationMap, mutationMap);
454
+ logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`);
455
+ await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
456
+ }
457
+ // only process if there are syncd patches
458
+ if (patches.length) {
459
+ const { state: newState, mutationMap } = await (0, Utils_1.decodePatches)(name, patches, states[name], getAppStateSyncKey, config.options, initialVersionMap[name], logger, appStateMacVerification.patch);
460
+ await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
461
+ logger.info(`synced ${name} to v${newState.version}`);
462
+ initialVersionMap[name] = newState.version;
463
+ Object.assign(globalMutationMap, mutationMap);
464
+ }
465
+ if (hasMorePatches) {
466
+ logger.info(`${name} has more patches...`);
467
+ }
468
+ else { // collection is done with sync
469
+ collectionsToHandle.delete(name);
470
+ }
471
+ }
472
+ catch (error) {
473
+ // if retry attempts overshoot
474
+ // or key not found
475
+ const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS
476
+ || ((_a = error.output) === null || _a === void 0 ? void 0 : _a.statusCode) === 404
477
+ || error.name === 'TypeError';
478
+ logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`);
479
+ await authState.keys.set({ 'app-state-sync-version': { [name]: null } });
480
+ // increment number of retries
481
+ attemptsMap[name] = (attemptsMap[name] || 0) + 1;
482
+ if (isIrrecoverableError) {
483
+ // stop retrying
484
+ collectionsToHandle.delete(name);
485
+ }
486
+ }
487
+ }
488
+ }
489
+ });
490
+ const { onMutation } = newAppStateChunkHandler(isInitialSync);
491
+ for (const key in globalMutationMap) {
492
+ onMutation(globalMutationMap[key]);
493
+ }
494
+ });
495
+ /**
496
+ * fetch the profile picture of a user/group
497
+ * type = "preview" for a low res picture
498
+ * type = "image for the high res picture"
499
+ */
500
+ const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
501
+ var _a;
502
+ jid = (0, WABinary_1.jidNormalizedUser)(jid);
503
+ const result = await query({
504
+ tag: 'iq',
505
+ attrs: {
506
+ target: jid,
507
+ to: WABinary_1.S_WHATSAPP_NET,
508
+ type: 'get',
509
+ xmlns: 'w:profile:picture'
510
+ },
511
+ content: [
512
+ { tag: 'picture', attrs: { type, query: 'url' } }
513
+ ]
514
+ }, timeoutMs);
515
+ const child = (0, WABinary_1.getBinaryNodeChild)(result, 'picture');
516
+ return (_a = child === null || child === void 0 ? void 0 : child.attrs) === null || _a === void 0 ? void 0 : _a.url;
517
+ };
518
+ const sendPresenceUpdate = async (type, toJid) => {
519
+ const me = authState.creds.me;
520
+ if (type === 'available' || type === 'unavailable') {
521
+ if (!me.name) {
522
+ logger.warn('no name present, ignoring presence update request...');
523
+ return;
524
+ }
525
+ ev.emit('connection.update', { isOnline: type === 'available' });
526
+ await sendNode({
527
+ tag: 'presence',
528
+ attrs: {
529
+ name: me.name.replace(/@/g, ''),
530
+ type
531
+ }
532
+ });
533
+ }
534
+ else {
535
+ const { server } = (0, WABinary_1.jidDecode)(toJid);
536
+ const isLid = server === 'lid';
537
+ await sendNode({
538
+ tag: 'chatstate',
539
+ attrs: {
540
+ from: isLid ? me.lid : me.id,
541
+ to: toJid,
542
+ },
543
+ content: [
544
+ {
545
+ tag: type === 'recording' ? 'composing' : type,
546
+ attrs: type === 'recording' ? { media: 'audio' } : {}
547
+ }
548
+ ]
549
+ });
550
+ }
551
+ };
552
+ /**
553
+ * @param toJid the jid to subscribe to
554
+ * @param tcToken token for subscription, use if present
555
+ */
556
+ const presenceSubscribe = (toJid, tcToken) => (sendNode({
557
+ tag: 'presence',
558
+ attrs: {
559
+ to: toJid,
560
+ id: generateMessageTag(),
561
+ type: 'subscribe'
562
+ },
563
+ content: tcToken
564
+ ? [
565
+ {
566
+ tag: 'tctoken',
567
+ attrs: {},
568
+ content: tcToken
569
+ }
570
+ ]
571
+ : undefined
572
+ }));
573
+ const handlePresenceUpdate = ({ tag, attrs, content }) => {
574
+ var _a;
575
+ let presence;
576
+ const jid = attrs.from;
577
+ const participant = attrs.participant || attrs.from;
578
+ if (shouldIgnoreJid(jid) && jid != '@s.whatsapp.net') {
579
+ return;
580
+ }
581
+ if (tag === 'presence') {
582
+ presence = {
583
+ lastKnownPresence: attrs.type === 'unavailable' ? 'unavailable' : 'available',
584
+ lastSeen: attrs.last && attrs.last !== 'deny' ? +attrs.last : undefined
585
+ };
586
+ }
587
+ else if (Array.isArray(content)) {
588
+ const [firstChild] = content;
589
+ let type = firstChild.tag;
590
+ if (type === 'paused') {
591
+ type = 'available';
592
+ }
593
+ if (((_a = firstChild.attrs) === null || _a === void 0 ? void 0 : _a.media) === 'audio') {
594
+ type = 'recording';
595
+ }
596
+ presence = { lastKnownPresence: type };
597
+ }
598
+ else {
599
+ logger.error({ tag, attrs, content }, 'recv invalid presence node');
600
+ }
601
+ if (presence) {
602
+ ev.emit('presence.update', { id: jid, presences: { [participant]: presence } });
603
+ }
604
+ };
605
+ const appPatch = async (patchCreate) => {
606
+ const name = patchCreate.type;
607
+ const myAppStateKeyId = authState.creds.myAppStateKeyId;
608
+ if (!myAppStateKeyId) {
609
+ throw new boom_1.Boom('App state key not present!', { statusCode: 400 });
610
+ }
611
+ let initial;
612
+ let encodeResult;
613
+ await processingMutex.mutex(async () => {
614
+ await authState.keys.transaction(async () => {
615
+ logger.debug({ patch: patchCreate }, 'applying app patch');
616
+ await resyncAppState([name], false);
617
+ const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name]);
618
+ initial = currentSyncVersion || (0, Utils_1.newLTHashState)();
619
+ encodeResult = await (0, Utils_1.encodeSyncdPatch)(patchCreate, myAppStateKeyId, initial, getAppStateSyncKey);
620
+ const { patch, state } = encodeResult;
621
+ const node = {
622
+ tag: 'iq',
623
+ attrs: {
624
+ to: WABinary_1.S_WHATSAPP_NET,
625
+ type: 'set',
626
+ xmlns: 'w:sync:app:state'
627
+ },
628
+ content: [
629
+ {
630
+ tag: 'sync',
631
+ attrs: {},
632
+ content: [
633
+ {
634
+ tag: 'collection',
635
+ attrs: {
636
+ name,
637
+ version: (state.version - 1).toString(),
638
+ 'return_snapshot': 'false'
639
+ },
640
+ content: [
641
+ {
642
+ tag: 'patch',
643
+ attrs: {},
644
+ content: WAProto_1.proto.SyncdPatch.encode(patch).finish()
645
+ }
646
+ ]
647
+ }
648
+ ]
649
+ }
650
+ ]
651
+ };
652
+ await query(node);
653
+ await authState.keys.set({ 'app-state-sync-version': { [name]: state } });
654
+ });
655
+ });
656
+ if (config.emitOwnEvents) {
657
+ const { onMutation } = newAppStateChunkHandler(false);
658
+ const { mutationMap } = await (0, Utils_1.decodePatches)(name, [{ ...encodeResult.patch, version: { version: encodeResult.state.version }, }], initial, getAppStateSyncKey, config.options, undefined, logger);
659
+ for (const key in mutationMap) {
660
+ onMutation(mutationMap[key]);
661
+ }
662
+ }
663
+ };
664
+ /** sending non-abt props may fix QR scan fail if server expects */
665
+ const fetchProps = async () => {
666
+ var _a, _b, _c;
667
+ const resultNode = await query({
668
+ tag: 'iq',
669
+ attrs: {
670
+ to: WABinary_1.S_WHATSAPP_NET,
671
+ xmlns: 'w',
672
+ type: 'get',
673
+ },
674
+ content: [
675
+ { tag: 'props', attrs: {
676
+ protocol: '2',
677
+ hash: ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.lastPropHash) || ''
678
+ } }
679
+ ]
680
+ });
681
+ const propsNode = (0, WABinary_1.getBinaryNodeChild)(resultNode, 'props');
682
+ let props = {};
683
+ if (propsNode) {
684
+ if ((_b = propsNode.attrs) === null || _b === void 0 ? void 0 : _b.hash) { // on some clients, the hash is returning as undefined
685
+ authState.creds.lastPropHash = (_c = propsNode === null || propsNode === void 0 ? void 0 : propsNode.attrs) === null || _c === void 0 ? void 0 : _c.hash;
686
+ ev.emit('creds.update', authState.creds);
687
+ }
688
+ props = (0, WABinary_1.reduceBinaryNodeToDictionary)(propsNode, 'prop');
689
+ }
690
+ logger.debug('fetched props');
691
+ return props;
692
+ };
693
+ /**
694
+ * modify a chat -- mark unread, read etc.
695
+ * lastMessages must be sorted in reverse chronologically
696
+ * requires the last messages till the last message received; required for archive & unread
697
+ */
698
+ const chatModify = (mod, jid) => {
699
+ const patch = (0, Utils_1.chatModificationToAppPatch)(mod, jid);
700
+ return appPatch(patch);
701
+ };
702
+ /**
703
+ * Star or Unstar a message
704
+ */
705
+ const star = (jid, messages, star) => {
706
+ return chatModify({
707
+ star: {
708
+ messages,
709
+ star
710
+ }
711
+ }, jid);
712
+ };
713
+ /**
714
+ * Adds label for the chats
715
+ */
716
+ const addChatLabel = (jid, labelId) => {
717
+ return chatModify({
718
+ addChatLabel: {
719
+ labelId
720
+ }
721
+ }, jid);
722
+ };
723
+ /**
724
+ * Removes label for the chat
725
+ */
726
+ const removeChatLabel = (jid, labelId) => {
727
+ return chatModify({
728
+ removeChatLabel: {
729
+ labelId
730
+ }
731
+ }, jid);
732
+ };
733
+ /**
734
+ * Adds label for the message
735
+ */
736
+ const addMessageLabel = (jid, messageId, labelId) => {
737
+ return chatModify({
738
+ addMessageLabel: {
739
+ messageId,
740
+ labelId
741
+ }
742
+ }, jid);
743
+ };
744
+ /**
745
+ * Removes label for the message
746
+ */
747
+ const removeMessageLabel = (jid, messageId, labelId) => {
748
+ return chatModify({
749
+ removeMessageLabel: {
750
+ messageId,
751
+ labelId
752
+ }
753
+ }, jid);
754
+ };
755
+ /**
756
+ * queries need to be fired on connection open
757
+ * help ensure parity with WA Web
758
+ * */
759
+ const executeInitQueries = async () => {
760
+ await Promise.all([
761
+ fetchProps(),
762
+ fetchBlocklist(),
763
+ fetchPrivacySettings(),
764
+ ]);
765
+ };
766
+ const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
767
+ var _a, _b, _c;
768
+ ev.emit('messages.upsert', { messages: [msg], type });
769
+ if (!!msg.pushName) {
770
+ let jid = msg.key.fromMe ? authState.creds.me.id : (msg.key.participant || msg.key.remoteJid);
771
+ jid = (0, WABinary_1.jidNormalizedUser)(jid);
772
+ if (!msg.key.fromMe) {
773
+ ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }]);
774
+ }
775
+ // update our pushname too
776
+ if (msg.key.fromMe && msg.pushName && ((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.name) !== msg.pushName) {
777
+ ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } });
778
+ }
779
+ }
780
+ const historyMsg = (0, Utils_1.getHistoryMsg)(msg.message);
781
+ const shouldProcessHistoryMsg = historyMsg
782
+ ? (shouldSyncHistoryMessage(historyMsg)
783
+ && Defaults_1.PROCESSABLE_HISTORY_TYPES.includes(historyMsg.syncType))
784
+ : false;
785
+ if (historyMsg && !authState.creds.myAppStateKeyId) {
786
+ logger.warn('skipping app state sync, as myAppStateKeyId is not set');
787
+ pendingAppStateSync = true;
788
+ }
789
+ await Promise.all([
790
+ (async () => {
791
+ if (historyMsg
792
+ && authState.creds.myAppStateKeyId) {
793
+ pendingAppStateSync = false;
794
+ await doAppStateSync();
795
+ }
796
+ })(),
797
+ (0, process_message_1.default)(msg, {
798
+ shouldProcessHistoryMsg,
799
+ placeholderResendCache,
800
+ ev,
801
+ creds: authState.creds,
802
+ keyStore: authState.keys,
803
+ logger,
804
+ options: config.options,
805
+ getMessage: config.getMessage,
806
+ })
807
+ ]);
808
+ if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.appStateSyncKeyShare)
809
+ && pendingAppStateSync) {
810
+ await doAppStateSync();
811
+ pendingAppStateSync = false;
812
+ }
813
+ async function doAppStateSync() {
814
+ if (!authState.creds.accountSyncCounter) {
815
+ logger.info('doing initial app state sync');
816
+ await resyncAppState(Types_1.ALL_WA_PATCH_NAMES, true);
817
+ const accountSyncCounter = (authState.creds.accountSyncCounter || 0) + 1;
818
+ ev.emit('creds.update', { accountSyncCounter });
819
+ if (needToFlushWithAppStateSync) {
820
+ logger.debug('flushing with app state sync');
821
+ ev.flush();
822
+ }
823
+ }
824
+ }
825
+ });
826
+ ws.on('CB:presence', handlePresenceUpdate);
827
+ ws.on('CB:chatstate', handlePresenceUpdate);
828
+ ws.on('CB:ib,,dirty', async (node) => {
829
+ const { attrs } = (0, WABinary_1.getBinaryNodeChild)(node, 'dirty');
830
+ const type = attrs.type;
831
+ switch (type) {
832
+ case 'account_sync':
833
+ if (attrs.timestamp) {
834
+ let { lastAccountSyncTimestamp } = authState.creds;
835
+ if (lastAccountSyncTimestamp) {
836
+ await cleanDirtyBits('account_sync', lastAccountSyncTimestamp);
837
+ }
838
+ lastAccountSyncTimestamp = +attrs.timestamp;
839
+ ev.emit('creds.update', { lastAccountSyncTimestamp });
840
+ }
841
+ break;
842
+ case 'groups':
843
+ // handled in groups.ts
844
+ break;
845
+ default:
846
+ logger.info({ node }, 'received unknown sync');
847
+ break;
848
+ }
849
+ });
850
+ ev.on('connection.update', ({ connection, receivedPendingNotifications }) => {
851
+ var _a;
852
+ if (connection === 'open') {
853
+ if (fireInitQueries) {
854
+ executeInitQueries()
855
+ .catch(error => onUnexpectedError(error, 'init queries'));
856
+ }
857
+ sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable')
858
+ .catch(error => onUnexpectedError(error, 'presence update requests'));
859
+ }
860
+ if (receivedPendingNotifications && // if we don't have the app state key
861
+ // we keep buffering events until we finally have
862
+ // the key and can sync the messages
863
+ !((_a = authState.creds) === null || _a === void 0 ? void 0 : _a.myAppStateKeyId)) {
864
+ ev.buffer();
865
+ needToFlushWithAppStateSync = true;
866
+ }
867
+ });
868
+ return {
869
+ ...sock,
870
+ getBotListV2,
871
+ processingMutex,
872
+ fetchPrivacySettings,
873
+ upsertMessage,
874
+ appPatch,
875
+ sendPresenceUpdate,
876
+ presenceSubscribe,
877
+ profilePictureUrl,
878
+ onWhatsApp,
879
+ fetchBlocklist,
880
+ fetchDisappearingDuration,
881
+ fetchStatus,
882
+ updateProfilePicture,
883
+ removeProfilePicture,
884
+ updateProfileStatus,
885
+ updateProfileName,
886
+ updateBlockStatus,
887
+ updateCallPrivacy,
888
+ updateMessagesPrivacy,
889
+ updateLastSeenPrivacy,
890
+ updateOnlinePrivacy,
891
+ updateProfilePicturePrivacy,
892
+ updateStatusPrivacy,
893
+ updateReadReceiptsPrivacy,
894
+ updateGroupsAddPrivacy,
895
+ updateDefaultDisappearingMode,
896
+ getBusinessProfile,
897
+ resyncAppState,
898
+ chatModify,
899
+ cleanDirtyBits,
900
+ addChatLabel,
901
+ removeChatLabel,
902
+ addMessageLabel,
903
+ removeMessageLabel,
904
+ star,
905
+ checkStatusWA
906
+ };
907
+ };
908
+ exports.makeChatsSocket = makeChatsSocket;