angularsockets 1.0.1 → 1.0.2

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 (131) hide show
  1. package/README.md +1880 -36
  2. package/WAProto/index.d.ts +50383 -0
  3. package/WAProto/index.js +37203 -11791
  4. package/WASignalGroup/GroupProtocol.js +1697 -0
  5. package/WASignalGroup/ciphertext_message.js +16 -0
  6. package/WASignalGroup/group_cipher.js +120 -0
  7. package/WASignalGroup/group_session_builder.js +46 -0
  8. package/WASignalGroup/index.js +5 -0
  9. package/WASignalGroup/keyhelper.js +21 -0
  10. package/WASignalGroup/protobufs.js +3 -0
  11. package/WASignalGroup/queue_job.js +69 -0
  12. package/WASignalGroup/sender_chain_key.js +50 -0
  13. package/WASignalGroup/sender_key_distribution_message.js +78 -0
  14. package/WASignalGroup/sender_key_message.js +92 -0
  15. package/WASignalGroup/sender_key_name.js +70 -0
  16. package/WASignalGroup/sender_key_record.js +56 -0
  17. package/WASignalGroup/sender_key_state.js +129 -0
  18. package/{lib/Signal/Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -6
  19. package/lib/Defaults/baileys-version.json +1 -1
  20. package/lib/Defaults/index.js +79 -101
  21. package/lib/Signal/libsignal.js +29 -51
  22. package/lib/Socket/Client/web-socket-client.js +0 -2
  23. package/lib/Socket/business.d.ts +42 -43
  24. package/lib/Socket/chats.d.ts +9 -8
  25. package/lib/Socket/chats.js +107 -21
  26. package/lib/Socket/groups.d.ts +7 -7
  27. package/lib/Socket/groups.js +24 -25
  28. package/lib/Socket/index.d.ts +51 -52
  29. package/lib/Socket/messages-recv.d.ts +34 -37
  30. package/lib/Socket/messages-recv.js +37 -175
  31. package/lib/Socket/messages-send.d.ts +16 -10
  32. package/lib/Socket/messages-send.js +540 -346
  33. package/lib/Socket/newsletter.d.ts +26 -28
  34. package/lib/Socket/newsletter.js +4 -4
  35. package/lib/Socket/registration.d.ts +49 -52
  36. package/lib/Socket/registration.js +7 -7
  37. package/lib/Socket/socket.d.ts +1 -0
  38. package/lib/Socket/socket.js +36 -23
  39. package/lib/Socket/usync.d.ts +11 -10
  40. package/lib/Store/make-cache-manager-store.d.ts +2 -1
  41. package/lib/Store/make-in-memory-store.d.ts +2 -2
  42. package/lib/Store/make-in-memory-store.js +5 -1
  43. package/lib/Store/make-ordered-dictionary.js +2 -2
  44. package/lib/Types/Auth.d.ts +0 -1
  45. package/lib/Types/Call.d.ts +1 -1
  46. package/lib/Types/Chat.d.ts +12 -7
  47. package/lib/Types/Events.d.ts +17 -2
  48. package/lib/Types/GroupMetadata.d.ts +3 -2
  49. package/lib/Types/Label.d.ts +11 -0
  50. package/lib/Types/Label.js +1 -1
  51. package/lib/Types/LabelAssociation.js +1 -1
  52. package/lib/Types/Message.d.ts +170 -10
  53. package/lib/Types/Newsletter.js +3 -3
  54. package/lib/Types/Socket.d.ts +7 -2
  55. package/lib/Types/index.d.ts +9 -0
  56. package/lib/Types/index.js +1 -1
  57. package/lib/Utils/auth-utils.js +35 -14
  58. package/lib/Utils/business.d.ts +1 -1
  59. package/lib/Utils/business.js +2 -2
  60. package/lib/Utils/chat-utils.d.ts +11 -12
  61. package/lib/Utils/chat-utils.js +52 -36
  62. package/lib/Utils/crypto.d.ts +15 -16
  63. package/lib/Utils/crypto.js +74 -26
  64. package/lib/Utils/decode-wa-message.d.ts +17 -0
  65. package/lib/Utils/decode-wa-message.js +53 -17
  66. package/lib/Utils/event-buffer.js +10 -7
  67. package/lib/Utils/generics.d.ts +13 -17
  68. package/lib/Utils/generics.js +26 -15
  69. package/lib/Utils/history.d.ts +6 -2
  70. package/lib/Utils/history.js +4 -6
  71. package/lib/Utils/logger.d.ts +1 -3
  72. package/lib/Utils/lt-hash.js +12 -12
  73. package/lib/Utils/make-mutex.d.ts +2 -2
  74. package/lib/Utils/messages-media.d.ts +25 -28
  75. package/lib/Utils/messages-media.js +47 -57
  76. package/lib/Utils/messages.js +461 -44
  77. package/lib/Utils/noise-handler.d.ts +4 -5
  78. package/lib/Utils/noise-handler.js +19 -14
  79. package/lib/Utils/process-message.d.ts +5 -5
  80. package/lib/Utils/process-message.js +75 -23
  81. package/lib/Utils/signal.d.ts +2 -1
  82. package/lib/Utils/signal.js +43 -35
  83. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -1
  84. package/lib/Utils/use-multi-file-auth-state.js +251 -36
  85. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  86. package/lib/Utils/use-single-file-auth-state.js +75 -0
  87. package/lib/Utils/validate-connection.d.ts +1 -1
  88. package/lib/Utils/validate-connection.js +1 -1
  89. package/lib/WABinary/decode.d.ts +1 -2
  90. package/lib/WABinary/decode.js +23 -11
  91. package/lib/WABinary/encode.d.ts +1 -2
  92. package/lib/WABinary/encode.js +46 -22
  93. package/lib/WABinary/generic-utils.d.ts +2 -4
  94. package/lib/WABinary/generic-utils.js +2 -10
  95. package/lib/WABinary/jid-utils.d.ts +1 -1
  96. package/lib/WAM/BinaryInfo.d.ts +2 -11
  97. package/lib/WAM/encode.d.ts +1 -2
  98. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
  99. package/lib/WAUSync/USyncUser.d.ts +0 -2
  100. package/lib/index.js +0 -6
  101. package/package.json +96 -104
  102. package/engine-requirements.js +0 -10
  103. package/lib/Defaults/phonenumber-mcc.json +0 -223
  104. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  105. package/lib/Signal/Group/ciphertext-message.js +0 -15
  106. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  107. package/lib/Signal/Group/group-session-builder.js +0 -64
  108. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  109. package/lib/Signal/Group/group_cipher.js +0 -96
  110. package/lib/Signal/Group/index.d.ts +0 -11
  111. package/lib/Signal/Group/index.js +0 -57
  112. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  113. package/lib/Signal/Group/keyhelper.js +0 -55
  114. package/lib/Signal/Group/queue-job.d.ts +0 -1
  115. package/lib/Signal/Group/queue-job.js +0 -57
  116. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  117. package/lib/Signal/Group/sender-chain-key.js +0 -34
  118. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  119. package/lib/Signal/Group/sender-key-distribution-message.js +0 -66
  120. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  121. package/lib/Signal/Group/sender-key-message.js +0 -69
  122. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  123. package/lib/Signal/Group/sender-key-name.js +0 -51
  124. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  125. package/lib/Signal/Group/sender-key-record.js +0 -53
  126. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  127. package/lib/Signal/Group/sender-key-state.js +0 -99
  128. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  129. package/lib/Socket/dugong.d.ts +0 -175
  130. package/lib/Socket/dugong.js +0 -342
  131. package/lib/index.d.ts +0 -12
@@ -6,7 +6,6 @@ const Types_1 = require("../Types");
6
6
  const Utils_1 = require("../Utils");
7
7
  const WABinary_1 = require("../WABinary");
8
8
  const chats_1 = require("./chats");
9
- const WAUSync_1 = require("../WAUSync");
10
9
  const makeGroupsSocket = (config) => {
11
10
  const sock = (0, chats_1.makeChatsSocket)(config);
12
11
  const { authState, ev, query, upsertMessage } = sock;
@@ -68,9 +67,10 @@ const makeGroupsSocket = (config) => {
68
67
  });
69
68
  return {
70
69
  ...sock,
70
+ groupQuery,
71
71
  groupMetadata,
72
72
  groupCreate: async (subject, participants) => {
73
- const key = (0, Utils_1.generateMessageID)();
73
+ const key = await config.generateMessageID() ?? (0, Utils_1.generateMessageID)();
74
74
  const result = await groupQuery('@g.us', 'set', [
75
75
  {
76
76
  tag: 'create',
@@ -164,7 +164,7 @@ const makeGroupsSocket = (config) => {
164
164
  {
165
165
  tag: 'description',
166
166
  attrs: {
167
- ...(description ? { id: (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
167
+ ...(description ? { id: await config.generateMessageID() ?? (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
168
168
  ...(prev ? { prev } : {})
169
169
  },
170
170
  content: description ? [
@@ -188,12 +188,23 @@ const makeGroupsSocket = (config) => {
188
188
  const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
189
189
  return result === null || result === void 0 ? void 0 : result.attrs.jid;
190
190
  },
191
+ /**
192
+ * revoke a v4 invite for someone
193
+ * @param groupJid group jid
194
+ * @param invitedJid jid of person you invited
195
+ * @returns true if successful
196
+ */
197
+ groupRevokeInviteV4: async (groupJid, invitedJid) => {
198
+ const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }]);
199
+ return !!result;
200
+ },
191
201
  /**
192
202
  * accept a GroupInviteMessage
193
203
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
194
204
  * @param inviteMessage the message to accept
195
205
  */
196
206
  groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
207
+ var _a;
197
208
  key = typeof key === 'string' ? { remoteJid: key } : key;
198
209
  const results = await groupQuery(inviteMessage.groupJid, 'set', [{
199
210
  tag: 'accept',
@@ -225,7 +236,7 @@ const makeGroupsSocket = (config) => {
225
236
  await upsertMessage({
226
237
  key: {
227
238
  remoteJid: inviteMessage.groupJid,
228
- id: (0, Utils_1.generateMessageID)(),
239
+ id: await config.generateMessageIDV2((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id) ?? (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
229
240
  fromMe: false,
230
241
  participant: key.remoteJid,
231
242
  },
@@ -267,35 +278,24 @@ const extractGroupMetadata = (result) => {
267
278
  const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
268
279
  let desc;
269
280
  let descId;
270
- let descOwner;
271
- let descOwnerLid;
272
- let descTime;
273
281
  if (descChild) {
274
282
  desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, 'body');
275
- descOwner = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant_pn || descChild.attrs.participant);
276
- if (group.attrs.addressing_mode === 'lid') {
277
- descOwnerLid = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant);
278
- }
279
283
  descId = descChild.attrs.id;
280
- descTime = descChild.attrs.t ? +descChild.attrs.t : undefined;
281
284
  }
282
- const groupSize = group.attrs.size ? Number(group.attrs.size) : undefined;
283
285
  const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
284
286
  const eph = (_a = (0, WABinary_1.getBinaryNodeChild)(group, 'ephemeral')) === null || _a === void 0 ? void 0 : _a.attrs.expiration;
285
287
  const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
286
288
  const metadata = {
287
289
  id: groupId,
288
- addressingMode: group.attrs.addressing_mode,
289
290
  subject: group.attrs.subject,
290
- subjectOwner: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o_pn || group.attrs.s_o),
291
- ...(group.attrs.addressing_mode === 'lid' ? { subjectOwnerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o) } : {}),
292
- subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
293
- size: groupSize || (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
294
- creation: group.attrs.creation ? +group.attrs.creation : undefined,
295
- owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn || group.attrs.creator),
296
- ...(group.attrs.addressing_mode === 'lid' ? { ownerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) } : {}),
297
- descOwner,
298
- descOwnerLid,
291
+ subjectOwner: group.attrs.s_o,
292
+ subjectTime: +group.attrs.s_t,
293
+ size: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
294
+ creation: +group.attrs.creation,
295
+ owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
296
+ desc,
297
+ descId,
298
+ linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
299
299
  restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
300
300
  announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
301
301
  isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
@@ -304,7 +304,7 @@ const extractGroupMetadata = (result) => {
304
304
  memberAddMode,
305
305
  participants: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
306
306
  return {
307
- id: attrs.jid,
307
+ id: attrs.phone_number ?? attrs.jid,
308
308
  admin: (attrs.type || null),
309
309
  };
310
310
  }),
@@ -313,4 +313,3 @@ const extractGroupMetadata = (result) => {
313
313
  return metadata;
314
314
  };
315
315
  exports.extractGroupMetadata = extractGroupMetadata;
316
-
@@ -1,15 +1,14 @@
1
- /// <reference types="node" />
2
1
  import { UserFacingSocketConfig } from '../Types';
3
2
  declare const makeWASocket: (config: UserFacingSocketConfig) => {
4
3
  register: (code: string) => Promise<import("./registration").ExistsResponse>;
5
- requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions | undefined) => Promise<import("./registration").ExistsResponse>;
6
- logger: import("pino").Logger<import("pino").LoggerOptions>;
4
+ requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions) => Promise<import("./registration").ExistsResponse>;
5
+ logger: Logger;
7
6
  getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
8
7
  getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
9
8
  products: import("../Types").Product[];
10
- nextPageCursor: string | undefined;
9
+ nextPageCursor: any;
11
10
  }>;
12
- getCollections: (jid?: string | undefined, limit?: number) => Promise<{
11
+ getCollections: (jid?: string, limit?: number) => Promise<{
13
12
  collections: import("../Types").CatalogCollection[];
14
13
  }>;
15
14
  productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
@@ -17,28 +16,27 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
17
16
  deleted: number;
18
17
  }>;
19
18
  productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
20
- sendMessageAck: ({ tag, attrs, content }: import("../index").BinaryNode) => Promise<void>;
21
- sendRetryRequest: (node: import("../index").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
19
+ sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
20
+ sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
22
21
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
23
- id: string;
22
+ id: any;
24
23
  to: string;
25
24
  }>;
26
25
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
27
- getPrivacyTokens: (jids: string[]) => Promise<import("../index").BinaryNode>;
26
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
27
+ requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
28
+ getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>;
28
29
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
29
30
  relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
30
31
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
31
- sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
32
- getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
33
- [key: string]: string;
34
- };
35
- readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
32
+ sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
33
+ getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("..").BinaryNode["attrs"];
34
+ readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
36
35
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
37
- getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../index").JidWithDevice[]>;
38
- createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
39
- [key: string]: string;
40
- } | undefined) => Promise<{
41
- nodes: import("../index").BinaryNode[];
36
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
37
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
38
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
39
+ nodes: import("..").BinaryNode[];
42
40
  shouldIncludeDeviceIdentity: boolean;
43
41
  }>;
44
42
  waUploadToServer: import("../Types").WAMediaUploadFunction;
@@ -46,12 +44,14 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
46
44
  [_: string]: string;
47
45
  }>;
48
46
  updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
47
+ sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
48
+ sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
49
49
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
50
50
  subscribeNewsletterUpdates: (jid: string) => Promise<{
51
51
  duration: string;
52
52
  }>;
53
53
  newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
54
- newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
54
+ newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
55
55
  newsletterUpdateName: (jid: string, name: string) => Promise<void>;
56
56
  newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
57
57
  newsletterRemovePicture: (jid: string) => Promise<void>;
@@ -59,16 +59,16 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
59
59
  newsletterFollow: (jid: string) => Promise<void>;
60
60
  newsletterUnmute: (jid: string) => Promise<void>;
61
61
  newsletterMute: (jid: string) => Promise<void>;
62
- newsletterAction: (jid: string, type: "mute" | "follow" | "unfollow" | "unmute") => Promise<void>;
63
- newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
64
- newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
62
+ newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
63
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
64
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
65
65
  newsletterAdminCount: (jid: string) => Promise<number>;
66
66
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
67
67
  newsletterDemote: (jid: string, user: string) => Promise<void>;
68
68
  newsletterDelete: (jid: string) => Promise<void>;
69
- newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
70
- newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
71
- newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
69
+ newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
70
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
71
+ newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
72
72
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
73
73
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
74
74
  groupLeave: (id: string) => Promise<void>;
@@ -76,41 +76,40 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
76
76
  groupRequestParticipantsList: (jid: string) => Promise<{
77
77
  [key: string]: string;
78
78
  }[]>;
79
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
79
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
80
80
  status: string;
81
81
  jid: string;
82
82
  }[]>;
83
83
  groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
84
84
  status: string;
85
85
  jid: string;
86
- content: import("../index").BinaryNode;
86
+ content: import("..").BinaryNode;
87
87
  }[]>;
88
- groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
88
+ groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
89
89
  groupInviteCode: (jid: string) => Promise<string | undefined>;
90
90
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
91
91
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
92
92
  groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
93
93
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
94
94
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
95
- groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
96
- groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
95
+ groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
96
+ groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
97
97
  groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
98
98
  groupFetchAllParticipating: () => Promise<{
99
99
  [_: string]: import("../Types").GroupMetadata;
100
100
  }>;
101
101
  processingMutex: {
102
- mutex<T>(code: () => T | Promise<T>): Promise<T>;
102
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
103
103
  };
104
104
  upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
105
105
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
106
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
107
- presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
108
- profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
106
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
107
+ presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
108
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
109
109
  onWhatsApp: (...jids: string[]) => Promise<{
110
+ exists: boolean;
110
111
  jid: string;
111
- exists: unknown;
112
- lid: unknown;
113
- }[] | undefined>;
112
+ }[]>;
114
113
  fetchBlocklist: () => Promise<string[]>;
115
114
  fetchStatus: (jid: string) => Promise<{
116
115
  status: string | undefined;
@@ -128,25 +127,25 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
128
127
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
129
128
  updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
130
129
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
131
- getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
130
+ getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
132
131
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
133
132
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
134
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
133
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
135
134
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
136
135
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
137
136
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
138
137
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
139
138
  star: (jid: string, messages: {
140
139
  id: string;
141
- fromMe?: boolean | undefined;
140
+ fromMe?: boolean;
142
141
  }[], star: boolean) => Promise<void>;
143
142
  type: "md";
144
143
  ws: any;
145
144
  ev: import("../Types").BaileysEventEmitter & {
146
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
145
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
147
146
  buffer(): void;
148
- createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
149
- flush(force?: boolean | undefined): boolean;
147
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
148
+ flush(force?: boolean): boolean;
150
149
  isBuffering(): boolean;
151
150
  };
152
151
  authState: {
@@ -156,18 +155,18 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
156
155
  signalRepository: import("../Types").SignalRepository;
157
156
  user: import("../Types").Contact | undefined;
158
157
  generateMessageTag: () => string;
159
- query: (node: import("../index").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../index").BinaryNode>;
160
- waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
158
+ query: (node: import("..").BinaryNode, timeoutMs?: number) => Promise<import("..").BinaryNode>;
159
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
161
160
  waitForSocketOpen: () => Promise<void>;
162
161
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
163
- sendNode: (frame: import("../index").BinaryNode) => Promise<void>;
164
- logout: (msg?: string | undefined) => Promise<void>;
162
+ sendNode: (frame: import("..").BinaryNode) => Promise<void>;
163
+ logout: (msg?: string) => Promise<void>;
165
164
  end: (error: Error | undefined) => void;
166
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
165
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
167
166
  uploadPreKeys: (count?: number) => Promise<void>;
168
167
  uploadPreKeysToServerIfRequired: () => Promise<void>;
169
- requestPairingCode: (phoneNumber: string) => Promise<string>;
170
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
171
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../index").BinaryNode>;
168
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
169
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
170
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>;
172
171
  };
173
172
  export default makeWASocket;
@@ -1,4 +1,3 @@
1
- import Long = require('long');
2
1
  import { Boom } from '@hapi/boom';
3
2
  import { proto } from '../../WAProto';
4
3
  import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
@@ -6,33 +5,35 @@ import { BinaryNode } from '../WABinary';
6
5
  export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
7
6
  sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
8
7
  sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
9
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
10
8
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
11
- callId: string;
12
- toJid: string;
13
- isVideo: boolean;
9
+ id: any;
10
+ to: string;
14
11
  }>;
15
- fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
12
+ rejectCall: (callId: string, callFrom: string) => Promise<void>;
13
+ fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
16
14
  requestPlaceholderResend: (messageKey: WAMessageKey) => Promise<string | undefined>;
17
- getPrivacyTokens: (jids: string[]) => Promise<any>;
15
+ getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
18
16
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
19
- relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
17
+ relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
20
18
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
21
19
  sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
20
+ getButtonArgs: (message: proto.IMessage) => BinaryNode["attrs"];
22
21
  readMessages: (keys: WAMessageKey[]) => Promise<void>;
23
22
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
24
- waUploadToServer: import("../Types").WAMediaUploadFunction;
25
- fetchPrivacySettings: (force?: boolean) => Promise<{
26
- [_: string]: string;
27
- }>;
28
23
  getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
24
+ sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
29
25
  createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
30
26
  nodes: BinaryNode[];
31
27
  shouldIncludeDeviceIdentity: boolean;
32
28
  }>;
33
- sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
29
+ waUploadToServer: import("../Types").WAMediaUploadFunction;
30
+ fetchPrivacySettings: (force?: boolean) => Promise<{
31
+ [_: string]: string;
32
+ }>;
34
33
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
35
- sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
34
+ sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<proto.WebMessageInfo>;
35
+ sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
36
+ sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
36
37
  subscribeNewsletterUpdates: (jid: string) => Promise<{
37
38
  duration: string;
38
39
  }>;
@@ -45,16 +46,16 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
45
46
  newsletterFollow: (jid: string) => Promise<void>;
46
47
  newsletterUnmute: (jid: string) => Promise<void>;
47
48
  newsletterMute: (jid: string) => Promise<void>;
48
- newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
49
+ newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
50
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
49
51
  newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
50
52
  newsletterAdminCount: (jid: string) => Promise<number>;
51
53
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
52
54
  newsletterDemote: (jid: string, user: string) => Promise<void>;
53
55
  newsletterDelete: (jid: string) => Promise<void>;
54
- newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
56
+ newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
55
57
  newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
56
58
  newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
57
- groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<any>;
58
59
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
59
60
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
60
61
  groupLeave: (id: string) => Promise<void>;
@@ -75,8 +76,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
75
76
  groupInviteCode: (jid: string) => Promise<string | undefined>;
76
77
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
77
78
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
78
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
79
- groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
79
+ groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
80
80
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
81
81
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
82
82
  groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
@@ -85,39 +85,37 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
85
85
  groupFetchAllParticipating: () => Promise<{
86
86
  [_: string]: import("../Types").GroupMetadata;
87
87
  }>;
88
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
89
88
  processingMutex: {
90
89
  mutex<T>(code: () => Promise<T> | T): Promise<T>;
91
90
  };
92
- upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
91
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
93
92
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
94
93
  sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
95
94
  presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
96
95
  profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
97
96
  onWhatsApp: (...jids: string[]) => Promise<{
97
+ exists: boolean;
98
98
  jid: string;
99
- exists: unknown;
100
- lid: unknown;
101
- }[] | undefined>;
99
+ }[]>;
102
100
  fetchBlocklist: () => Promise<string[]>;
103
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
104
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
101
+ fetchStatus: (jid: string) => Promise<{
102
+ status: string | undefined;
103
+ setAt: Date;
104
+ } | undefined>;
105
105
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
106
106
  removeProfilePicture: (jid: string) => Promise<void>;
107
107
  updateProfileStatus: (status: string) => Promise<void>;
108
108
  updateProfileName: (name: string) => Promise<void>;
109
109
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
110
- updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
111
- updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
112
110
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
113
111
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
114
112
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
115
113
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
116
114
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
117
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
115
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
118
116
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
119
117
  getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
120
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
118
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
121
119
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
122
120
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
123
121
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
@@ -128,9 +126,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
128
126
  id: string;
129
127
  fromMe?: boolean;
130
128
  }[], star: boolean) => Promise<void>;
131
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
132
129
  type: "md";
133
- ws: import("./Client").WebSocketClient;
130
+ ws: any;
134
131
  ev: import("../Types").BaileysEventEmitter & {
135
132
  process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
136
133
  buffer(): void;
@@ -145,8 +142,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
145
142
  signalRepository: import("../Types").SignalRepository;
146
143
  user: import("../Types").Contact | undefined;
147
144
  generateMessageTag: () => string;
148
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
149
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
145
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
146
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
150
147
  waitForSocketOpen: () => Promise<void>;
151
148
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
152
149
  sendNode: (frame: BinaryNode) => Promise<void>;
@@ -155,7 +152,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
155
152
  onUnexpectedError: (err: Error | Boom, msg: string) => void;
156
153
  uploadPreKeys: (count?: number) => Promise<void>;
157
154
  uploadPreKeysToServerIfRequired: () => Promise<void>;
158
- requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
159
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
160
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
155
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
156
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
157
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
161
158
  };