@alannxd/baileys 6.0.3 → 6.0.5

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 (234) hide show
  1. package/WAProto/GenerateStatics.sh +3 -0
  2. package/WAProto/WAProto.proto +5479 -0
  3. package/WAProto/fix-imports.js +85 -0
  4. package/WAProto/index.d.ts +14017 -0
  5. package/WAProto/index.js +201 -160
  6. package/engine-requirements.js +1 -1
  7. package/lib/Defaults/index.d.ts +37 -15
  8. package/lib/Defaults/index.js +119 -136
  9. package/lib/Signal/Group/ciphertext-message.d.ts +1 -0
  10. package/lib/Signal/Group/ciphertext-message.js +2 -5
  11. package/lib/Signal/Group/group-session-builder.d.ts +4 -3
  12. package/lib/Signal/Group/group-session-builder.js +7 -41
  13. package/lib/Signal/Group/group_cipher.d.ts +4 -4
  14. package/lib/Signal/Group/group_cipher.js +37 -51
  15. package/lib/Signal/Group/index.d.ts +12 -11
  16. package/lib/Signal/Group/index.js +12 -57
  17. package/lib/Signal/Group/keyhelper.d.ts +2 -1
  18. package/lib/Signal/Group/keyhelper.js +7 -44
  19. package/lib/Signal/Group/sender-chain-key.d.ts +3 -2
  20. package/lib/Signal/Group/sender-chain-key.js +7 -15
  21. package/lib/Signal/Group/sender-key-distribution-message.d.ts +2 -1
  22. package/lib/Signal/Group/sender-key-distribution-message.js +8 -11
  23. package/lib/Signal/Group/sender-key-message.d.ts +2 -1
  24. package/lib/Signal/Group/sender-key-message.js +9 -12
  25. package/lib/Signal/Group/sender-key-name.d.ts +1 -0
  26. package/lib/Signal/Group/sender-key-name.js +2 -5
  27. package/lib/Signal/Group/sender-key-record.d.ts +3 -2
  28. package/lib/Signal/Group/sender-key-record.js +9 -21
  29. package/lib/Signal/Group/sender-key-state.d.ts +7 -6
  30. package/lib/Signal/Group/sender-key-state.js +27 -42
  31. package/lib/Signal/Group/sender-message-key.d.ts +1 -0
  32. package/lib/Signal/Group/sender-message-key.js +4 -7
  33. package/lib/Signal/libsignal.d.ts +5 -3
  34. package/lib/Signal/libsignal.js +347 -90
  35. package/lib/Signal/lid-mapping.d.ts +23 -0
  36. package/lib/Signal/lid-mapping.js +277 -0
  37. package/lib/Socket/Client/index.d.ts +3 -3
  38. package/lib/Socket/Client/index.js +3 -19
  39. package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +4 -5
  40. package/lib/Socket/Client/types.js +11 -0
  41. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +3 -2
  42. package/lib/Socket/Client/websocket.js +54 -0
  43. package/lib/Socket/business.d.ts +154 -108
  44. package/lib/Socket/business.js +162 -43
  45. package/lib/Socket/chats.d.ts +96 -239
  46. package/lib/Socket/chats.js +627 -427
  47. package/lib/Socket/communities.d.ts +239 -146
  48. package/lib/Socket/communities.js +90 -80
  49. package/lib/Socket/groups.d.ts +104 -57
  50. package/lib/Socket/groups.js +154 -161
  51. package/lib/Socket/index.d.ts +202 -115
  52. package/lib/Socket/index.js +11 -10
  53. package/lib/Socket/luxu.d.ts +22 -266
  54. package/lib/Socket/luxu.js +422 -465
  55. package/lib/Socket/messages-recv.d.ts +136 -84
  56. package/lib/Socket/messages-recv.js +1421 -615
  57. package/lib/Socket/messages-send.d.ts +142 -126
  58. package/lib/Socket/messages-send.js +878 -671
  59. package/lib/Socket/mex.d.ts +3 -0
  60. package/lib/Socket/mex.js +42 -0
  61. package/lib/Socket/newsletter.d.ts +121 -85
  62. package/lib/Socket/newsletter.js +147 -272
  63. package/lib/Socket/socket.d.ts +34 -19
  64. package/lib/Socket/socket.js +544 -313
  65. package/lib/Store/index.d.ts +10 -3
  66. package/lib/Store/index.js +10 -10
  67. package/lib/Store/keyed-db.d.ts +22 -0
  68. package/lib/Store/keyed-db.js +108 -0
  69. package/lib/Store/make-cache-manager-store.d.ts +17 -11
  70. package/lib/Store/make-cache-manager-store.js +43 -41
  71. package/lib/Store/make-in-memory-store.d.ts +39 -118
  72. package/lib/Store/make-in-memory-store.js +112 -341
  73. package/lib/Store/make-ordered-dictionary.d.ts +11 -10
  74. package/lib/Store/make-ordered-dictionary.js +14 -20
  75. package/lib/Store/object-repository.d.ts +10 -9
  76. package/lib/Store/object-repository.js +11 -6
  77. package/lib/Types/Auth.d.ts +19 -12
  78. package/lib/Types/Auth.js +2 -2
  79. package/lib/Types/Bussines.d.ts +25 -0
  80. package/lib/Types/Bussines.js +2 -0
  81. package/lib/Types/Call.d.ts +3 -1
  82. package/lib/Types/Call.js +2 -2
  83. package/lib/Types/Chat.d.ts +35 -13
  84. package/lib/Types/Chat.js +8 -4
  85. package/lib/Types/Contact.d.ts +8 -1
  86. package/lib/Types/Contact.js +2 -2
  87. package/lib/Types/Events.d.ts +116 -17
  88. package/lib/Types/Events.js +2 -2
  89. package/lib/Types/GroupMetadata.d.ts +21 -5
  90. package/lib/Types/GroupMetadata.js +2 -2
  91. package/lib/Types/Label.d.ts +12 -0
  92. package/lib/Types/Label.js +3 -5
  93. package/lib/Types/LabelAssociation.d.ts +1 -0
  94. package/lib/Types/LabelAssociation.js +3 -5
  95. package/lib/Types/Message.d.ts +105 -58
  96. package/lib/Types/Message.js +11 -9
  97. package/lib/Types/Mex.d.ts +141 -0
  98. package/lib/Types/Mex.js +37 -0
  99. package/lib/Types/Product.d.ts +2 -1
  100. package/lib/Types/Product.js +2 -2
  101. package/lib/Types/Signal.d.ts +32 -2
  102. package/lib/Types/Signal.js +2 -2
  103. package/lib/Types/Socket.d.ts +50 -25
  104. package/lib/Types/Socket.js +3 -2
  105. package/lib/Types/State.d.ts +72 -2
  106. package/lib/Types/State.js +56 -2
  107. package/lib/Types/USync.d.ts +3 -2
  108. package/lib/Types/USync.js +2 -2
  109. package/lib/Types/index.d.ts +22 -14
  110. package/lib/Types/index.js +15 -31
  111. package/lib/Utils/auth-utils.d.ts +12 -6
  112. package/lib/Utils/auth-utils.js +239 -143
  113. package/lib/Utils/browser-utils.d.ts +4 -0
  114. package/lib/Utils/browser-utils.js +28 -0
  115. package/lib/Utils/business.d.ts +3 -2
  116. package/lib/Utils/business.js +66 -69
  117. package/lib/Utils/chat-utils.d.ts +52 -23
  118. package/lib/Utils/chat-utils.js +396 -253
  119. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  120. package/lib/Utils/companion-reg-client-utils.js +35 -0
  121. package/lib/Utils/crypto.d.ts +18 -22
  122. package/lib/Utils/crypto.js +57 -90
  123. package/lib/Utils/decode-wa-message.d.ts +55 -8
  124. package/lib/Utils/decode-wa-message.js +203 -84
  125. package/lib/Utils/event-buffer.d.ts +9 -8
  126. package/lib/Utils/event-buffer.js +185 -77
  127. package/lib/Utils/generics.d.ts +28 -29
  128. package/lib/Utils/generics.js +180 -210
  129. package/lib/Utils/history.d.ts +18 -9
  130. package/lib/Utils/history.js +93 -55
  131. package/lib/Utils/identity-change-handler.d.ts +44 -0
  132. package/lib/Utils/identity-change-handler.js +50 -0
  133. package/lib/Utils/index.d.ts +22 -17
  134. package/lib/Utils/index.js +22 -33
  135. package/lib/Utils/link-preview.d.ts +5 -5
  136. package/lib/Utils/link-preview.js +16 -24
  137. package/lib/Utils/logger.d.ts +11 -3
  138. package/lib/Utils/logger.js +3 -7
  139. package/lib/Utils/lt-hash.d.ts +8 -12
  140. package/lib/Utils/lt-hash.js +3 -46
  141. package/lib/Utils/make-mutex.d.ts +4 -2
  142. package/lib/Utils/make-mutex.js +24 -34
  143. package/lib/Utils/message-retry-manager.d.ts +115 -0
  144. package/lib/Utils/message-retry-manager.js +265 -0
  145. package/lib/Utils/messages-media.d.ts +61 -44
  146. package/lib/Utils/messages-media.js +451 -482
  147. package/lib/Utils/messages.d.ts +32 -18
  148. package/lib/Utils/messages.js +458 -369
  149. package/lib/Utils/noise-handler.d.ts +13 -14
  150. package/lib/Utils/noise-handler.js +145 -99
  151. package/lib/Utils/offline-node-processor.d.ts +17 -0
  152. package/lib/Utils/offline-node-processor.js +40 -0
  153. package/lib/Utils/pre-key-manager.d.ts +28 -0
  154. package/lib/Utils/pre-key-manager.js +106 -0
  155. package/lib/Utils/process-message.d.ts +31 -12
  156. package/lib/Utils/process-message.js +459 -150
  157. package/lib/Utils/reporting-utils.d.ts +11 -0
  158. package/lib/Utils/reporting-utils.js +258 -0
  159. package/lib/Utils/signal.d.ts +20 -5
  160. package/lib/Utils/signal.js +120 -72
  161. package/lib/Utils/stanza-ack.d.ts +11 -0
  162. package/lib/Utils/stanza-ack.js +38 -0
  163. package/lib/Utils/sync-action-utils.d.ts +19 -0
  164. package/lib/Utils/sync-action-utils.js +49 -0
  165. package/lib/Utils/tc-token-utils.d.ts +37 -0
  166. package/lib/Utils/tc-token-utils.js +163 -0
  167. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
  168. package/lib/Utils/use-multi-file-auth-state.js +29 -27
  169. package/lib/Utils/validate-connection.d.ts +7 -7
  170. package/lib/Utils/validate-connection.js +73 -99
  171. package/lib/WABinary/constants.d.ts +25 -27
  172. package/lib/WABinary/constants.js +1281 -20
  173. package/lib/WABinary/decode.d.ts +5 -5
  174. package/lib/WABinary/decode.js +52 -42
  175. package/lib/WABinary/encode.d.ts +3 -3
  176. package/lib/WABinary/encode.js +110 -155
  177. package/lib/WABinary/generic-utils.d.ts +8 -7
  178. package/lib/WABinary/generic-utils.js +48 -49
  179. package/lib/WABinary/index.d.ts +6 -5
  180. package/lib/WABinary/index.js +6 -21
  181. package/lib/WABinary/jid-utils.d.ts +25 -8
  182. package/lib/WABinary/jid-utils.js +74 -40
  183. package/lib/WABinary/types.d.ts +2 -1
  184. package/lib/WABinary/types.js +2 -2
  185. package/lib/WAM/BinaryInfo.d.ts +3 -11
  186. package/lib/WAM/BinaryInfo.js +2 -5
  187. package/lib/WAM/constants.d.ts +5 -3
  188. package/lib/WAM/constants.js +19071 -11568
  189. package/lib/WAM/encode.d.ts +3 -3
  190. package/lib/WAM/encode.js +17 -22
  191. package/lib/WAM/index.d.ts +4 -3
  192. package/lib/WAM/index.js +4 -19
  193. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +4 -3
  194. package/lib/WAUSync/Protocols/USyncContactProtocol.js +33 -13
  195. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +3 -2
  196. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -14
  197. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +3 -2
  198. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -12
  199. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +3 -2
  200. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -13
  201. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  202. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  203. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +4 -3
  204. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -22
  205. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +5 -3
  206. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -8
  207. package/lib/WAUSync/Protocols/index.d.ts +6 -4
  208. package/lib/WAUSync/Protocols/index.js +6 -20
  209. package/lib/WAUSync/USyncQuery.d.ts +6 -4
  210. package/lib/WAUSync/USyncQuery.js +44 -35
  211. package/lib/WAUSync/USyncUser.d.ts +10 -5
  212. package/lib/WAUSync/USyncUser.js +10 -5
  213. package/lib/WAUSync/index.d.ts +4 -0
  214. package/lib/WAUSync/index.js +4 -19
  215. package/lib/index.d.ts +10 -9
  216. package/lib/index.js +12 -34
  217. package/package.json +84 -53
  218. package/WAProto/fix-import.js +0 -29
  219. package/lib/Defaults/baileys-version.json +0 -3
  220. package/lib/Defaults/phonenumber-mcc.json +0 -223
  221. package/lib/Signal/Group/queue-job.d.ts +0 -1
  222. package/lib/Signal/Group/queue-job.js +0 -57
  223. package/lib/Socket/Client/abstract-socket-client.js +0 -13
  224. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  225. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  226. package/lib/Socket/Client/web-socket-client.js +0 -62
  227. package/lib/Socket/registration.d.ts +0 -267
  228. package/lib/Socket/registration.js +0 -166
  229. package/lib/Socket/usync.d.ts +0 -36
  230. package/lib/Socket/usync.js +0 -70
  231. package/lib/Types/Newsletter.d.ts +0 -103
  232. package/lib/Types/Newsletter.js +0 -38
  233. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  234. package/lib/Utils/baileys-event-stream.js +0 -63
@@ -1,13 +1,12 @@
1
- const WAProto_1 = require('../../WAProto');
2
- const Types_1 = require('../Types');
3
- const Utils_1 = require('../Utils');
4
- const WABinary_1 = require('../WABinary');
5
- const newsletter_1 = require('./newsletter');
6
-
7
- const makeCommunitiesSocket = (config) => {
8
- const sock = (0, newsletter_1.makeNewsletterSocket)(config);
1
+ import { proto } from '../../WAProto/index.js';
2
+ import { WAMessageStubType } from '../Types/index.js';
3
+ import { generateMessageID, generateMessageIDV2, unixTimestampSeconds } from '../Utils/index.js';
4
+ import logger from '../Utils/logger.js';
5
+ import { getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString, jidEncode, jidNormalizedUser } from '../WABinary/index.js';
6
+ import { makeBusinessSocket } from './business.js';
7
+ export const makeCommunitiesSocket = (config) => {
8
+ const sock = makeBusinessSocket(config);
9
9
  const { authState, ev, query, upsertMessage } = sock;
10
-
11
10
  const communityQuery = async (jid, type, content) => query({
12
11
  tag: 'iq',
13
12
  attrs: {
@@ -17,12 +16,10 @@ const makeCommunitiesSocket = (config) => {
17
16
  },
18
17
  content
19
18
  });
20
-
21
19
  const communityMetadata = async (jid) => {
22
20
  const result = await communityQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
23
21
  return extractCommunityMetadata(result);
24
22
  };
25
-
26
23
  const communityFetchAllParticipating = async () => {
27
24
  const result = await query({
28
25
  tag: 'iq',
@@ -43,9 +40,9 @@ const makeCommunitiesSocket = (config) => {
43
40
  ]
44
41
  });
45
42
  const data = {};
46
- const communitiesChild = WABinary_1.getBinaryNodeChild(result, 'communities');
43
+ const communitiesChild = getBinaryNodeChild(result, 'communities');
47
44
  if (communitiesChild) {
48
- const communities = WABinary_1.getBinaryNodeChildren(communitiesChild, 'community');
45
+ const communities = getBinaryNodeChildren(communitiesChild, 'community');
49
46
  for (const communityNode of communities) {
50
47
  const meta = extractCommunityMetadata({
51
48
  tag: 'result',
@@ -58,15 +55,14 @@ const makeCommunitiesSocket = (config) => {
58
55
  sock.ev.emit('groups.update', Object.values(data));
59
56
  return data;
60
57
  };
61
-
62
58
  async function parseGroupResult(node) {
63
- Utils_1.logger.info({ node }, 'parseGroupResult');
64
- const groupNode = WABinary_1.getBinaryNodeChild(node, 'group');
59
+ logger.info({ node }, 'parseGroupResult');
60
+ const groupNode = getBinaryNodeChild(node, 'group');
65
61
  if (groupNode) {
66
62
  try {
67
- Utils_1.logger.info({ groupNode }, 'groupNode');
63
+ logger.info({ groupNode }, 'groupNode');
68
64
  const metadata = await sock.groupMetadata(`${groupNode.attrs.id}@g.us`);
69
- return metadata? metadata : Optional.empty();
65
+ return metadata ? metadata : Optional.empty();
70
66
  }
71
67
  catch (error) {
72
68
  console.error('Error parsing group metadata:', error);
@@ -75,26 +71,23 @@ const makeCommunitiesSocket = (config) => {
75
71
  }
76
72
  return Optional.empty();
77
73
  }
78
-
79
74
  const Optional = {
80
75
  empty: () => null,
81
- of: (value) => (value!== null? { value } : null)
76
+ of: (value) => (value !== null ? { value } : null)
82
77
  };
83
-
84
78
  sock.ws.on('CB:ib,,dirty', async (node) => {
85
- const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty');
86
- if (attrs.type!== 'communities') {
79
+ const { attrs } = getBinaryNodeChild(node, 'dirty');
80
+ if (attrs.type !== 'communities') {
87
81
  return;
88
82
  }
89
83
  await communityFetchAllParticipating();
90
84
  await sock.cleanDirtyBits('groups');
91
85
  });
92
-
93
86
  return {
94
- ...sock,
87
+ ...sock,
95
88
  communityMetadata,
96
89
  communityCreate: async (subject, body) => {
97
- const descriptionId = Utils_1.generateMessageID().substring(0, 12);
90
+ const descriptionId = generateMessageID().substring(0, 12);
98
91
  const result = await communityQuery('@g.us', 'set', [
99
92
  {
100
93
  tag: 'create',
@@ -129,7 +122,7 @@ const makeCommunitiesSocket = (config) => {
129
122
  return await parseGroupResult(result);
130
123
  },
131
124
  communityCreateGroup: async (subject, participants, parentCommunityJid) => {
132
- const key = Utils_1.generateMessageIDV2();
125
+ const key = generateMessageIDV2();
133
126
  const result = await communityQuery('@g.us', 'set', [
134
127
  {
135
128
  tag: 'create',
@@ -138,7 +131,7 @@ const makeCommunitiesSocket = (config) => {
138
131
  key
139
132
  },
140
133
  content: [
141
- ...participants.map(jid => ({
134
+ ...participants.map(jid => ({
142
135
  tag: 'participant',
143
136
  attrs: { jid }
144
137
  })),
@@ -193,25 +186,29 @@ const makeCommunitiesSocket = (config) => {
193
186
  communityFetchLinkedGroups: async (jid) => {
194
187
  let communityJid = jid;
195
188
  let isCommunity = false;
189
+ // Try to determine if it is a subgroup or a community
196
190
  const metadata = await sock.groupMetadata(jid);
197
191
  if (metadata.linkedParent) {
192
+ // It is a subgroup, get the community jid
198
193
  communityJid = metadata.linkedParent;
199
194
  }
200
195
  else {
196
+ // It is a community
201
197
  isCommunity = true;
202
198
  }
199
+ // Fetch all subgroups of the community
203
200
  const result = await communityQuery(communityJid, 'get', [{ tag: 'sub_groups', attrs: {} }]);
204
201
  const linkedGroupsData = [];
205
- const subGroupsNode = WABinary_1.getBinaryNodeChild(result, 'sub_groups');
202
+ const subGroupsNode = getBinaryNodeChild(result, 'sub_groups');
206
203
  if (subGroupsNode) {
207
- const groupNodes = WABinary_1.getBinaryNodeChildren(subGroupsNode, 'group');
204
+ const groupNodes = getBinaryNodeChildren(subGroupsNode, 'group');
208
205
  for (const groupNode of groupNodes) {
209
206
  linkedGroupsData.push({
210
- id: groupNode.attrs.id? WABinary_1.jidEncode(groupNode.attrs.id, 'g.us') : undefined,
207
+ id: groupNode.attrs.id ? jidEncode(groupNode.attrs.id, 'g.us') : undefined,
211
208
  subject: groupNode.attrs.subject || '',
212
- creation: groupNode.attrs.creation? Number(groupNode.attrs.creation) : undefined,
213
- owner: groupNode.attrs.creator? WABinary_1.jidNormalizedUser(groupNode.attrs.creator) : undefined,
214
- size: groupNode.attrs.size? Number(groupNode.attrs.size) : undefined
209
+ creation: groupNode.attrs.creation ? Number(groupNode.attrs.creation) : undefined,
210
+ owner: groupNode.attrs.creator ? jidNormalizedUser(groupNode.attrs.creator) : undefined,
211
+ size: groupNode.attrs.size ? Number(groupNode.attrs.size) : undefined
215
212
  });
216
213
  }
217
214
  }
@@ -228,8 +225,8 @@ const makeCommunitiesSocket = (config) => {
228
225
  attrs: {}
229
226
  }
230
227
  ]);
231
- const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests');
232
- const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request');
228
+ const node = getBinaryNodeChild(result, 'membership_approval_requests');
229
+ const participants = getBinaryNodeChildren(node, 'membership_approval_request');
233
230
  return participants.map(v => v.attrs);
234
231
  },
235
232
  communityRequestParticipantsUpdate: async (jid, participants, action) => {
@@ -249,9 +246,9 @@ const makeCommunitiesSocket = (config) => {
249
246
  ]
250
247
  }
251
248
  ]);
252
- const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action');
253
- const nodeAction = WABinary_1.getBinaryNodeChild(node, action);
254
- const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant');
249
+ const node = getBinaryNodeChild(result, 'membership_requests_action');
250
+ const nodeAction = getBinaryNodeChild(node, action);
251
+ const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant');
255
252
  return participantsAffected.map(p => {
256
253
  return { status: p.attrs.error || '200', jid: p.attrs.jid };
257
254
  });
@@ -260,56 +257,67 @@ const makeCommunitiesSocket = (config) => {
260
257
  const result = await communityQuery(jid, 'set', [
261
258
  {
262
259
  tag: action,
263
- attrs: action === 'remove'? { linked_groups: 'true' } : {},
260
+ attrs: action === 'remove' ? { linked_groups: 'true' } : {},
264
261
  content: participants.map(jid => ({
265
262
  tag: 'participant',
266
263
  attrs: { jid }
267
264
  }))
268
265
  }
269
266
  ]);
270
- const node = WABinary_1.getBinaryNodeChild(result, action);
271
- const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant');
267
+ const node = getBinaryNodeChild(result, action);
268
+ const participantsAffected = getBinaryNodeChildren(node, 'participant');
272
269
  return participantsAffected.map(p => {
273
270
  return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
274
271
  });
275
272
  },
276
273
  communityUpdateDescription: async (jid, description) => {
277
274
  const metadata = await communityMetadata(jid);
278
- const prev = metadata.descId?? null;
275
+ const prev = metadata.descId ?? null;
279
276
  await communityQuery(jid, 'set', [
280
277
  {
281
278
  tag: 'description',
282
279
  attrs: {
283
- ...(description? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
284
- ...(prev? { prev } : {})
280
+ ...(description ? { id: generateMessageID() } : { delete: 'true' }),
281
+ ...(prev ? { prev } : {})
285
282
  },
286
- content: description? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
283
+ content: description ? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
287
284
  }
288
285
  ]);
289
286
  },
290
287
  communityInviteCode: async (jid) => {
291
288
  const result = await communityQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
292
- const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
289
+ const inviteNode = getBinaryNodeChild(result, 'invite');
293
290
  return inviteNode?.attrs.code;
294
291
  },
295
292
  communityRevokeInvite: async (jid) => {
296
293
  const result = await communityQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
297
- const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
294
+ const inviteNode = getBinaryNodeChild(result, 'invite');
298
295
  return inviteNode?.attrs.code;
299
296
  },
300
297
  communityAcceptInvite: async (code) => {
301
298
  const results = await communityQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
302
- const result = WABinary_1.getBinaryNodeChild(results, 'community');
299
+ const result = getBinaryNodeChild(results, 'community');
303
300
  return result?.attrs.jid;
304
301
  },
302
+ /**
303
+ * revoke a v4 invite for someone
304
+ * @param communityJid community jid
305
+ * @param invitedJid jid of person you invited
306
+ * @returns true if successful
307
+ */
305
308
  communityRevokeInviteV4: async (communityJid, invitedJid) => {
306
309
  const result = await communityQuery(communityJid, 'set', [
307
310
  { tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
308
311
  ]);
309
- return!!result;
312
+ return !!result;
310
313
  },
314
+ /**
315
+ * accept a CommunityInviteMessage
316
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
317
+ * @param inviteMessage the message to accept
318
+ */
311
319
  communityAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
312
- key = typeof key === 'string'? { remoteJid: key } : key;
320
+ key = typeof key === 'string' ? { remoteJid: key } : key;
313
321
  const results = await communityQuery(inviteMessage.groupJid, 'set', [
314
322
  {
315
323
  tag: 'accept',
@@ -320,8 +328,11 @@ const makeCommunitiesSocket = (config) => {
320
328
  }
321
329
  }
322
330
  ]);
331
+ // if we have the full message key
332
+ // update the invite message to be expired
323
333
  if (key.id) {
324
- inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
334
+ // create new invite message that is expired
335
+ inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage);
325
336
  inviteMessage.inviteExpiration = 0;
326
337
  inviteMessage.inviteCode = '';
327
338
  ev.emit('messages.update', [
@@ -335,17 +346,18 @@ const makeCommunitiesSocket = (config) => {
335
346
  }
336
347
  ]);
337
348
  }
349
+ // generate the community add message
338
350
  await upsertMessage({
339
351
  key: {
340
352
  remoteJid: inviteMessage.groupJid,
341
- id: Utils_1.generateMessageIDV2(sock.user?.id),
353
+ id: generateMessageIDV2(sock.user?.id),
342
354
  fromMe: false,
343
- participant: key.remoteJid
355
+ participant: key.remoteJid // TODO: investigate if this makes any sense at all
344
356
  },
345
- messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
357
+ messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
346
358
  messageStubParameters: [JSON.stringify(authState.creds.me)],
347
359
  participant: key.remoteJid,
348
- messageTimestamp: Utils_1.unixTimestampSeconds()
360
+ messageTimestamp: unixTimestampSeconds()
349
361
  }, 'notify');
350
362
  return results.attrs.from;
351
363
  }),
@@ -355,7 +367,7 @@ const makeCommunitiesSocket = (config) => {
355
367
  },
356
368
  communityToggleEphemeral: async (jid, ephemeralExpiration) => {
357
369
  const content = ephemeralExpiration
358
- ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
370
+ ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
359
371
  : { tag: 'not_ephemeral', attrs: {} };
360
372
  await communityQuery(jid, 'set', [content]);
361
373
  },
@@ -373,49 +385,47 @@ const makeCommunitiesSocket = (config) => {
373
385
  communityFetchAllParticipating
374
386
  };
375
387
  };
376
-
377
- const extractCommunityMetadata = (result) => {
378
- const community = WABinary_1.getBinaryNodeChild(result, 'community');
379
- const descChild = WABinary_1.getBinaryNodeChild(community, 'description');
388
+ export const extractCommunityMetadata = (result) => {
389
+ const community = getBinaryNodeChild(result, 'community');
390
+ const descChild = getBinaryNodeChild(community, 'description');
380
391
  let desc;
381
392
  let descId;
382
393
  if (descChild) {
383
- desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
394
+ desc = getBinaryNodeChildString(descChild, 'body');
384
395
  descId = descChild.attrs.id;
385
396
  }
386
397
  const communityId = community.attrs.id?.includes('@')
387
- ? community.attrs.id
388
- : WABinary_1.jidEncode(community.attrs.id || '', 'g.us');
389
- const eph = WABinary_1.getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
390
- const memberAddMode = WABinary_1.getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
398
+ ? community.attrs.id
399
+ : jidEncode(community.attrs.id || '', 'g.us');
400
+ const eph = getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
401
+ const memberAddMode = getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
391
402
  const metadata = {
392
403
  id: communityId,
393
404
  subject: community.attrs.subject || '',
394
405
  subjectOwner: community.attrs.s_o,
395
406
  subjectTime: Number(community.attrs.s_t || 0),
396
- size: WABinary_1.getBinaryNodeChildren(community, 'participant').length,
407
+ size: getBinaryNodeChildren(community, 'participant').length,
397
408
  creation: Number(community.attrs.creation || 0),
398
- owner: community.attrs.creator? WABinary_1.jidNormalizedUser(community.attrs.creator) : undefined,
409
+ owner: community.attrs.creator ? jidNormalizedUser(community.attrs.creator) : undefined,
399
410
  desc,
400
411
  descId,
401
- linkedParent: WABinary_1.getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
402
- restrict:!!WABinary_1.getBinaryNodeChild(community, 'locked'),
403
- announce:!!WABinary_1.getBinaryNodeChild(community, 'announcement'),
404
- isCommunity:!!WABinary_1.getBinaryNodeChild(community, 'parent'),
405
- isCommunityAnnounce:!!WABinary_1.getBinaryNodeChild(community, 'default_sub_community'),
406
- joinApprovalMode:!!WABinary_1.getBinaryNodeChild(community, 'membership_approval_mode'),
412
+ linkedParent: getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
413
+ restrict: !!getBinaryNodeChild(community, 'locked'),
414
+ announce: !!getBinaryNodeChild(community, 'announcement'),
415
+ isCommunity: !!getBinaryNodeChild(community, 'parent'),
416
+ isCommunityAnnounce: !!getBinaryNodeChild(community, 'default_sub_community'),
417
+ joinApprovalMode: !!getBinaryNodeChild(community, 'membership_approval_mode'),
407
418
  memberAddMode,
408
- participants: WABinary_1.getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
419
+ participants: getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
409
420
  return {
421
+ // TODO: IMPLEMENT THE PN/LID FIELDS HERE!!
410
422
  id: attrs.jid,
411
423
  admin: (attrs.type || null)
412
424
  };
413
425
  }),
414
- ephemeralDuration: eph? +eph : undefined,
415
- addressingMode: WABinary_1.getBinaryNodeChildString(community, 'addressing_mode')
426
+ ephemeralDuration: eph ? +eph : undefined,
427
+ addressingMode: getBinaryNodeChildString(community, 'addressing_mode')
416
428
  };
417
429
  return metadata;
418
430
  };
419
-
420
- exports.makeCommunitiesSocket = makeCommunitiesSocket;
421
- exports.extractCommunityMetadata = extractCommunityMetadata;
431
+ //# sourceMappingURL=communities.js.map
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
- import { proto } from '../../WAProto';
3
- import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
4
- import { BinaryNode } from '../WABinary';
1
+ import { Boom } from '@hapi/boom';
2
+ import { proto } from '../../WAProto/index.js';
3
+ import type { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types/index.js';
4
+ import { type BinaryNode } from '../WABinary/index.js';
5
5
  export declare const makeGroupsSocket: (config: SocketConfig) => {
6
6
  groupMetadata: (jid: string) => Promise<GroupMetadata>;
7
7
  groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
@@ -10,106 +10,153 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
10
10
  groupRequestParticipantsList: (jid: string) => Promise<{
11
11
  [key: string]: string;
12
12
  }[]>;
13
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
13
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
14
14
  status: string;
15
- jid: string;
15
+ jid: string | undefined;
16
16
  }[]>;
17
17
  groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
18
18
  status: string;
19
- jid: string;
19
+ jid: string | undefined;
20
20
  content: BinaryNode;
21
21
  }[]>;
22
22
  groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
23
23
  groupInviteCode: (jid: string) => Promise<string | undefined>;
24
24
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
25
25
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
26
+ /**
27
+ * revoke a v4 invite for someone
28
+ * @param groupJid group jid
29
+ * @param invitedJid jid of person you invited
30
+ * @returns true if successful
31
+ */
32
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
26
33
  /**
27
34
  * accept a GroupInviteMessage
28
35
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
29
36
  * @param inviteMessage the message to accept
30
37
  */
31
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
38
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
32
39
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
33
40
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
34
- groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
35
- groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
36
- groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
41
+ groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
42
+ groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
43
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
44
+ groupToggleHistory: (jid: string, enable: boolean) => Promise<void>
37
45
  groupFetchAllParticipating: () => Promise<{
38
46
  [_: string]: GroupMetadata;
39
47
  }>;
40
- processingMutex: {
41
- mutex<T>(code: () => T | Promise<T>): Promise<T>;
48
+ serverProps: {
49
+ privacyTokenOn1to1: boolean;
50
+ profilePicPrivacyToken: boolean;
51
+ lidTrustedTokenIssueToLid: boolean;
52
+ };
53
+ createCallLink: (type: "audio" | "video", event?: {
54
+ startTime: number;
55
+ }, timeoutMs?: number) => Promise<string | undefined>;
56
+ getBotListV2: () => Promise<import("../Types/index.js").BotListInfo[]>;
57
+ messageMutex: {
58
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
59
+ };
60
+ receiptMutex: {
61
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
62
+ };
63
+ appStatePatchMutex: {
64
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
65
+ };
66
+ notificationMutex: {
67
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
42
68
  };
43
69
  fetchPrivacySettings: (force?: boolean) => Promise<{
44
70
  [_: string]: string;
45
71
  }>;
46
- upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
47
- appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
48
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
49
- presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
50
- profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
51
- onWhatsApp: (...jids: string[]) => Promise<{
52
- jid: string;
53
- exists: unknown;
54
- lid: unknown;
55
- }[] | undefined>;
56
- fetchBlocklist: () => Promise<string[]>;
57
- fetchStatus: (jid: string) => Promise<{
58
- status: string | undefined;
59
- setAt: Date;
60
- } | undefined>;
61
- updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
72
+ upsertMessage: (msg: import("../Types/index.js").WAMessage, type: import("../Types/index.js").MessageUpsertType) => Promise<void>;
73
+ appPatch: (patchCreate: import("../Types/index.js").WAPatchCreate) => Promise<void>;
74
+ sendPresenceUpdate: (type: import("../Types/index.js").WAPresence, toJid?: string) => Promise<void>;
75
+ presenceSubscribe: (toJid: string) => Promise<void>;
76
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
77
+ fetchBlocklist: () => Promise<(string | undefined)[]>;
78
+ fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
79
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
80
+ updateProfilePicture: (jid: string, content: import("../Types/index.js").WAMediaUpload, dimensions?: {
81
+ width: number;
82
+ height: number;
83
+ }) => Promise<void>;
62
84
  removeProfilePicture: (jid: string) => Promise<void>;
63
85
  updateProfileStatus: (status: string) => Promise<void>;
64
86
  updateProfileName: (name: string) => Promise<void>;
65
87
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
66
- updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
67
- updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
68
- updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
69
- updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
70
- updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
71
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
88
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
89
+ updateCallPrivacy: (value: import("../Types/index.js").WAPrivacyCallValue) => Promise<void>;
90
+ updateMessagesPrivacy: (value: import("../Types/index.js").WAPrivacyMessagesValue) => Promise<void>;
91
+ updateLastSeenPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
92
+ updateOnlinePrivacy: (value: import("../Types/index.js").WAPrivacyOnlineValue) => Promise<void>;
93
+ updateProfilePicturePrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
94
+ updateStatusPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
95
+ updateReadReceiptsPrivacy: (value: import("../Types/index.js").WAReadReceiptsValue) => Promise<void>;
96
+ updateGroupsAddPrivacy: (value: import("../Types/index.js").WAPrivacyGroupAddValue) => Promise<void>;
72
97
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
73
- getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
74
- resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
75
- chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
76
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
98
+ getBusinessProfile: (jid: string) => Promise<import("../Types/index.js").WABusinessProfile | void>;
99
+ resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
100
+ chatModify: (mod: import("../Types/index.js").ChatModification, jid: string) => Promise<void>;
101
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
102
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
103
+ removeContact: (jid: string) => Promise<void>;
104
+ placeholderResendCache: import("../Types/index.js").CacheStore;
105
+ addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
77
106
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
78
107
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
79
108
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
80
109
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
81
110
  star: (jid: string, messages: {
82
111
  id: string;
83
- fromMe?: boolean | undefined;
112
+ fromMe?: boolean;
84
113
  }[], star: boolean) => Promise<void>;
114
+ addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
115
+ removeQuickReply: (timestamp: string) => Promise<void>;
85
116
  type: "md";
86
- ws: any;
87
- ev: import("../Types").BaileysEventEmitter & {
88
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
117
+ ws: import("./Client/websocket.js").WebSocketClient;
118
+ ev: import("../Types/index.js").BaileysEventEmitter & {
119
+ process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
89
120
  buffer(): void;
90
- createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
91
- flush(force?: boolean | undefined): boolean;
121
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
122
+ flush(): boolean;
92
123
  isBuffering(): boolean;
124
+ destroy(): void;
93
125
  };
94
126
  authState: {
95
- creds: import("../Types").AuthenticationCreds;
96
- keys: import("../Types").SignalKeyStoreWithTransaction;
127
+ creds: import("../Types/index.js").AuthenticationCreds;
128
+ keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
97
129
  };
98
- signalRepository: import("../Types").SignalRepository;
99
- user: import("../Types").Contact | undefined;
130
+ signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
131
+ user: import("../Types/index.js").Contact | undefined;
100
132
  generateMessageTag: () => string;
101
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
102
- waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
133
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
134
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
103
135
  waitForSocketOpen: () => Promise<void>;
104
136
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
105
137
  sendNode: (frame: BinaryNode) => Promise<void>;
106
- logout: (msg?: string | undefined) => Promise<void>;
107
- end: (error: Error | undefined) => void;
108
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
138
+ logout: (msg?: string) => Promise<void>;
139
+ end: (error: Error | undefined) => Promise<void>;
140
+ registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
141
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
109
142
  uploadPreKeys: (count?: number) => Promise<void>;
110
143
  uploadPreKeysToServerIfRequired: () => Promise<void>;
111
- requestPairingCode: (phoneNumber: string) => Promise<string>;
112
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
113
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
144
+ digestKeyBundle: () => Promise<void>;
145
+ rotateSignedPreKey: () => Promise<void>;
146
+ requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
147
+ updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
148
+ sendUnifiedSession: () => Promise<void>;
149
+ wamBuffer: import("../index.js").BinaryInfo;
150
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
151
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
152
+ executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
153
+ onWhatsApp: (...phoneNumber: string[]) => Promise<{
154
+ jid: string;
155
+ exists: boolean;
156
+ }[] | undefined>;
157
+ fetchAccountReachoutTimelock: () => Promise<import("../Types/index.js").ReachoutTimelockState>;
158
+ fetchNewChatMessageCap: () => Promise<import("../Types/index.js").NewChatMessageCapInfo>;
114
159
  };
115
160
  export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
161
+ export type GroupsSocket = ReturnType<typeof makeGroupsSocket>;
162
+ //# sourceMappingURL=groups.d.ts.map