@jkt48connect-corp/baileys 7.3.2 → 7.3.4

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 (80) hide show
  1. package/README.md +459 -143
  2. package/WAProto/WAProto.proto +227 -2
  3. package/lib/Defaults/baileys-version.json +1 -1
  4. package/lib/Defaults/index.d.ts +9 -7
  5. package/lib/Defaults/index.js +6 -4
  6. package/lib/Socket/Client/index.d.ts +2 -3
  7. package/lib/Socket/Client/index.js +2 -3
  8. package/lib/Socket/Client/types.d.ts +17 -0
  9. package/lib/Socket/Client/types.js +13 -0
  10. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
  11. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
  12. package/lib/Socket/business.d.ts +8 -3
  13. package/lib/Socket/chats.d.ts +21 -19
  14. package/lib/Socket/chats.js +51 -48
  15. package/lib/Socket/groups.d.ts +28 -26
  16. package/lib/Socket/groups.js +2 -1
  17. package/lib/Socket/index.d.ts +6 -3
  18. package/lib/Socket/messages-recv.d.ts +8 -3
  19. package/lib/Socket/messages-recv.js +308 -149
  20. package/lib/Socket/messages-send.d.ts +23 -26
  21. package/lib/Socket/messages-send.js +193 -166
  22. package/lib/Socket/newsletter.d.ts +2 -2
  23. package/lib/Socket/newsletter.js +3 -3
  24. package/lib/Socket/registration.d.ts +8 -3
  25. package/lib/Socket/socket.d.ts +8 -6
  26. package/lib/Socket/socket.js +19 -14
  27. package/lib/Socket/usync.d.ts +37 -0
  28. package/lib/Socket/usync.js +70 -0
  29. package/lib/Store/make-cache-manager-store.d.ts +2 -2
  30. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  31. package/lib/Types/Call.d.ts +1 -1
  32. package/lib/Types/Chat.d.ts +12 -7
  33. package/lib/Types/Events.d.ts +17 -2
  34. package/lib/Types/GroupMetadata.d.ts +3 -1
  35. package/lib/Types/Label.d.ts +11 -0
  36. package/lib/Types/Message.d.ts +324 -328
  37. package/lib/Types/Socket.d.ts +7 -0
  38. package/lib/Types/USync.d.ts +25 -0
  39. package/lib/Types/USync.js +2 -0
  40. package/lib/Types/index.d.ts +9 -0
  41. package/lib/Utils/chat-utils.d.ts +4 -4
  42. package/lib/Utils/chat-utils.js +41 -20
  43. package/lib/Utils/crypto.d.ts +1 -1
  44. package/lib/Utils/crypto.js +4 -2
  45. package/lib/Utils/decode-wa-message.d.ts +17 -0
  46. package/lib/Utils/decode-wa-message.js +42 -14
  47. package/lib/Utils/generics.d.ts +4 -10
  48. package/lib/Utils/generics.js +30 -14
  49. package/lib/Utils/history.d.ts +6 -2
  50. package/lib/Utils/history.js +3 -0
  51. package/lib/Utils/messages.d.ts +0 -1
  52. package/lib/Utils/messages.js +247 -39
  53. package/lib/Utils/signal.d.ts +2 -1
  54. package/lib/Utils/signal.js +11 -19
  55. package/lib/Utils/use-multi-file-auth-state.js +11 -3
  56. package/lib/Utils/validate-connection.d.ts +2 -2
  57. package/lib/Utils/validate-connection.js +1 -1
  58. package/lib/WABinary/encode.d.ts +1 -1
  59. package/lib/WABinary/encode.js +16 -10
  60. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  61. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  62. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  63. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  64. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  65. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  66. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  67. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  68. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  69. package/lib/WAUSync/Protocols/index.js +20 -0
  70. package/lib/WAUSync/USyncQuery.d.ts +26 -0
  71. package/lib/WAUSync/USyncQuery.js +79 -0
  72. package/lib/WAUSync/USyncUser.d.ts +10 -0
  73. package/lib/WAUSync/USyncUser.js +22 -0
  74. package/lib/WAUSync/index.d.ts +3 -0
  75. package/lib/WAUSync/index.js +19 -0
  76. package/lib/index.d.ts +1 -0
  77. package/lib/index.js +1 -0
  78. package/package.json +23 -18
  79. package/LICENSE +0 -21
  80. package/lib/index.ts +0 -13
@@ -1,33 +1,34 @@
1
+ /// <reference types="node" />
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { proto } from '../../WAProto';
3
4
  import { ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
4
5
  import { BinaryNode } from '../WABinary';
6
+ import { USyncQuery } from '../WAUSync';
5
7
  export declare const makeChatsSocket: (config: SocketConfig) => {
8
+ interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
6
9
  processingMutex: {
7
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
10
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
8
11
  };
9
12
  fetchPrivacySettings: (force?: boolean) => Promise<{
10
13
  [_: string]: string;
11
14
  }>;
12
15
  upsertMessage: (msg: proto.IWebMessageInfo, type: MessageUpsertType) => Promise<void>;
13
16
  appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
17
+ fetchUserLid: (jid: string) => Promise<string | undefined>;
14
18
  sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
15
19
  presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
16
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
17
20
  onWhatsApp: (...jids: string[]) => Promise<{
18
- exists: boolean;
19
21
  jid: string;
20
- }[]>;
22
+ exists: unknown;
23
+ }[] | undefined>;
21
24
  fetchBlocklist: () => Promise<string[]>;
22
- fetchStatus: (jid: string) => Promise<{
23
- status: string | undefined;
24
- setAt: Date;
25
- } | undefined>;
25
+ fetchStatus: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
26
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
26
27
  updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
27
28
  removeProfilePicture: (jid: string) => Promise<void>;
28
29
  updateProfileStatus: (status: string) => Promise<void>;
29
30
  updateProfileName: (name: string) => Promise<void>;
30
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
31
+ updateBlockStatus: (jid: string, action: 'block' | 'unblock') => Promise<void>;
31
32
  updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>;
32
33
  updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>;
33
34
  updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>;
@@ -38,7 +39,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
38
39
  getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
39
40
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
40
41
  chatModify: (mod: ChatModification, jid: string) => Promise<void>;
41
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
42
+ cleanDirtyBits: (type: 'account_sync' | 'groups', fromTimestamp?: number | string) => Promise<void>;
42
43
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
43
44
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
44
45
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -47,13 +48,14 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
47
48
  id: string;
48
49
  fromMe?: boolean;
49
50
  }[], star: boolean) => Promise<void>;
51
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
50
52
  type: "md";
51
53
  ws: any;
52
54
  ev: import("../Types").BaileysEventEmitter & {
53
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
55
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
54
56
  buffer(): void;
55
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
56
- flush(force?: boolean): boolean;
57
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
58
+ flush(force?: boolean | undefined): boolean;
57
59
  isBuffering(): boolean;
58
60
  };
59
61
  authState: {
@@ -63,17 +65,17 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
63
65
  signalRepository: import("../Types").SignalRepository;
64
66
  user: import("../Types").Contact | undefined;
65
67
  generateMessageTag: () => string;
66
- query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
67
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
68
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
69
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
68
70
  waitForSocketOpen: () => Promise<void>;
69
71
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
70
72
  sendNode: (frame: BinaryNode) => Promise<void>;
71
- logout: (msg?: string) => Promise<void>;
73
+ logout: (msg?: string | undefined) => Promise<void>;
72
74
  end: (error: Error | undefined) => void;
73
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
75
+ onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
74
76
  uploadPreKeys: (count?: number) => Promise<void>;
75
77
  uploadPreKeysToServerIfRequired: () => Promise<void>;
76
- requestPairingCode: (phoneNumber: string) => Promise<string>;
77
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
78
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
79
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
78
80
  sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
79
81
  };
@@ -12,12 +12,13 @@ const Utils_1 = require("../Utils");
12
12
  const make_mutex_1 = require("../Utils/make-mutex");
13
13
  const process_message_1 = __importDefault(require("../Utils/process-message"));
14
14
  const WABinary_1 = require("../WABinary");
15
- const socket_1 = require("./socket");
15
+ const WAUSync_1 = require("../WAUSync");
16
+ const usync_1 = require("./usync");
16
17
  const MAX_SYNC_ATTEMPTS = 2;
17
18
  const makeChatsSocket = (config) => {
18
19
  const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config;
19
- const sock = (0, socket_1.makeSocket)(config);
20
- const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError, } = sock;
20
+ const sock = (0, usync_1.makeUSyncSocket)(config);
21
+ const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError } = sock;
21
22
  let privacySettings;
22
23
  let needToFlushWithAppStateSync = false;
23
24
  let pendingAppStateSync = false;
@@ -139,35 +140,53 @@ const makeChatsSocket = (config) => {
139
140
  const users = (0, WABinary_1.getBinaryNodeChildren)(listNode, 'user');
140
141
  return users;
141
142
  };
142
- const onWhatsApp = async (...jids) => {
143
- const query = { tag: 'contact', attrs: {} };
144
- const list = jids.map((jid) => {
145
- // insures only 1 + is there
146
- const content = `+${jid.replace('+', '')}`;
147
- return {
143
+ const fetchUserLid = async (jid) => {
144
+ const [result] = await interactiveQuery([
145
+ {
148
146
  tag: 'user',
149
- attrs: {},
150
- content: [{
151
- tag: 'contact',
152
- attrs: {},
153
- content,
154
- }],
155
- };
147
+ attrs: { jid }
148
+ }
149
+ ], {
150
+ tag: 'lid',
151
+ attrs: {}
156
152
  });
157
- const results = await interactiveQuery(list, query);
158
- return results.map(user => {
159
- const contact = (0, WABinary_1.getBinaryNodeChild)(user, 'contact');
160
- return { exists: (contact === null || contact === void 0 ? void 0 : contact.attrs.type) === 'in', jid: user.attrs.jid };
161
- }).filter(item => item.exists);
162
- };
163
- const fetchStatus = async (jid) => {
164
- const [result] = await interactiveQuery([{ tag: 'user', attrs: { jid } }], { tag: 'status', attrs: {} });
165
153
  if (result) {
166
- const status = (0, WABinary_1.getBinaryNodeChild)(result, 'status');
167
- return {
168
- status: status === null || status === void 0 ? void 0 : status.content.toString(),
169
- setAt: new Date(+((status === null || status === void 0 ? void 0 : status.attrs.t) || 0) * 1000)
170
- };
154
+ const lid = (0, WABinary_1.getBinaryNodeChild)(result, 'lid');
155
+ return lid.attrs.val;
156
+ }
157
+ };
158
+ const onWhatsApp = async (...jids) => {
159
+ const usyncQuery = new WAUSync_1.USyncQuery()
160
+ .withContactProtocol();
161
+ for (const jid of jids) {
162
+ const phone = `+${jid.replace('+', '').split('@')[0].split(':')[0]}`;
163
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withPhone(phone));
164
+ }
165
+ const results = await sock.executeUSyncQuery(usyncQuery);
166
+ if (results) {
167
+ return results.list.filter((a) => !!a.contact).map(({ contact, id }) => ({ jid: id, exists: contact }));
168
+ }
169
+ };
170
+ const fetchStatus = async (...jids) => {
171
+ const usyncQuery = new WAUSync_1.USyncQuery()
172
+ .withStatusProtocol();
173
+ for (const jid of jids) {
174
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
175
+ }
176
+ const result = await sock.executeUSyncQuery(usyncQuery);
177
+ if (result) {
178
+ return result.list;
179
+ }
180
+ };
181
+ const fetchDisappearingDuration = async (...jids) => {
182
+ const usyncQuery = new WAUSync_1.USyncQuery()
183
+ .withDisappearingModeProtocol();
184
+ for (const jid of jids) {
185
+ usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
186
+ }
187
+ const result = await sock.executeUSyncQuery(usyncQuery);
188
+ if (result) {
189
+ return result.list;
171
190
  }
172
191
  };
173
192
  /** update the profile picture for yourself or a group */
@@ -458,24 +477,6 @@ const makeChatsSocket = (config) => {
458
477
  * type = "preview" for a low res picture
459
478
  * type = "image for the high res picture"
460
479
  */
461
- const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
462
- var _a;
463
- jid = (0, WABinary_1.jidNormalizedUser)(jid);
464
- const result = await query({
465
- tag: 'iq',
466
- attrs: {
467
- target: jid,
468
- to: WABinary_1.S_WHATSAPP_NET,
469
- type: 'get',
470
- xmlns: 'w:profile:picture'
471
- },
472
- content: [
473
- { tag: 'picture', attrs: { type, query: 'url' } }
474
- ]
475
- }, timeoutMs);
476
- const child = (0, WABinary_1.getBinaryNodeChild)(result, 'picture');
477
- return (_a = child === null || child === void 0 ? void 0 : child.attrs) === null || _a === void 0 ? void 0 : _a.url;
478
- };
479
480
  const sendPresenceUpdate = async (type, toJid) => {
480
481
  const me = authState.creds.me;
481
482
  if (type === 'available' || type === 'unavailable') {
@@ -832,16 +833,18 @@ const makeChatsSocket = (config) => {
832
833
  });
833
834
  return {
834
835
  ...sock,
836
+ interactiveQuery,
835
837
  processingMutex,
836
838
  fetchPrivacySettings,
837
839
  upsertMessage,
838
840
  appPatch,
841
+ fetchUserLid,
839
842
  sendPresenceUpdate,
840
843
  presenceSubscribe,
841
- profilePictureUrl,
842
844
  onWhatsApp,
843
845
  fetchBlocklist,
844
846
  fetchStatus,
847
+ fetchDisappearingDuration,
845
848
  updateProfilePicture,
846
849
  removeProfilePicture,
847
850
  updateProfileStatus,
@@ -1,7 +1,9 @@
1
+ /// <reference types="node" />
1
2
  import { proto } from '../../WAProto';
2
3
  import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
3
4
  import { BinaryNode } from '../WABinary';
4
5
  export declare const makeGroupsSocket: (config: SocketConfig) => {
6
+ groupQuery: (jid: string, type: 'get' | 'set', content: BinaryNode[]) => Promise<BinaryNode>;
5
7
  groupMetadata: (jid: string) => Promise<GroupMetadata>;
6
8
  groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
7
9
  groupLeave: (id: string) => Promise<void>;
@@ -9,7 +11,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
9
11
  groupRequestParticipantsList: (jid: string) => Promise<{
10
12
  [key: string]: string;
11
13
  }[]>;
12
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
14
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
13
15
  status: string;
14
16
  jid: string;
15
17
  }[]>;
@@ -30,32 +32,31 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
30
32
  groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
31
33
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
32
34
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
33
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
34
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
35
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
35
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
36
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
37
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
36
38
  groupFetchAllParticipating: () => Promise<{
37
39
  [_: string]: GroupMetadata;
38
40
  }>;
41
+ interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
39
42
  processingMutex: {
40
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
43
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
41
44
  };
42
45
  fetchPrivacySettings: (force?: boolean) => Promise<{
43
46
  [_: string]: string;
44
47
  }>;
45
48
  upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
46
49
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
47
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
48
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
49
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
50
+ fetchUserLid: (jid: string) => Promise<string | undefined>;
51
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
52
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
50
53
  onWhatsApp: (...jids: string[]) => Promise<{
51
- exists: boolean;
52
54
  jid: string;
53
- }[]>;
55
+ exists: unknown;
56
+ }[] | undefined>;
54
57
  fetchBlocklist: () => Promise<string[]>;
55
- fetchStatus: (jid: string) => Promise<{
56
- status: string | undefined;
57
- setAt: Date;
58
- } | undefined>;
58
+ fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
59
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
59
60
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
60
61
  removeProfilePicture: (jid: string) => Promise<void>;
61
62
  updateProfileStatus: (status: string) => Promise<void>;
@@ -68,25 +69,26 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
68
69
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
69
70
  updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
70
71
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
71
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
72
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
72
73
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
73
74
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
74
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
75
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
75
76
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
76
77
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
77
78
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
78
79
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
79
80
  star: (jid: string, messages: {
80
81
  id: string;
81
- fromMe?: boolean;
82
+ fromMe?: boolean | undefined;
82
83
  }[], star: boolean) => Promise<void>;
84
+ executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
83
85
  type: "md";
84
86
  ws: any;
85
87
  ev: import("../Types").BaileysEventEmitter & {
86
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
88
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
87
89
  buffer(): void;
88
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
89
- flush(force?: boolean): boolean;
90
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
91
+ flush(force?: boolean | undefined): boolean;
90
92
  isBuffering(): boolean;
91
93
  };
92
94
  authState: {
@@ -96,18 +98,18 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
96
98
  signalRepository: import("../Types").SignalRepository;
97
99
  user: import("../Types").Contact | undefined;
98
100
  generateMessageTag: () => string;
99
- query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
100
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
101
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
102
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
101
103
  waitForSocketOpen: () => Promise<void>;
102
104
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
103
105
  sendNode: (frame: BinaryNode) => Promise<void>;
104
- logout: (msg?: string) => Promise<void>;
106
+ logout: (msg?: string | undefined) => Promise<void>;
105
107
  end: (error: Error | undefined) => void;
106
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
108
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
107
109
  uploadPreKeys: (count?: number) => Promise<void>;
108
110
  uploadPreKeysToServerIfRequired: () => Promise<void>;
109
- requestPairingCode: (phoneNumber: string) => Promise<string>;
110
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
111
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
112
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
111
113
  sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
112
114
  };
113
115
  export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
@@ -67,6 +67,7 @@ const makeGroupsSocket = (config) => {
67
67
  });
68
68
  return {
69
69
  ...sock,
70
+ groupQuery,
70
71
  groupMetadata,
71
72
  groupCreate: async (subject, participants) => {
72
73
  const key = (0, Utils_1.generateMessageID)();
@@ -296,7 +297,7 @@ const extractGroupMetadata = (result) => {
296
297
  admin: (attrs.type || null),
297
298
  };
298
299
  }),
299
- ephemeralDuration: eph ? +eph : undefined
300
+ ephemeralDuration: eph ? +eph : 0
300
301
  };
301
302
  return metadata;
302
303
  };
@@ -16,13 +16,15 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
16
16
  deleted: number;
17
17
  }>;
18
18
  productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
19
- sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode) => Promise<void>;
19
+ sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
20
20
  sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
21
21
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
22
22
  id: any;
23
23
  to: string;
24
24
  }>;
25
25
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
26
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
27
+ requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
26
28
  getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>;
27
29
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
28
30
  relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
@@ -32,6 +34,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
32
34
  readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
33
35
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
34
36
  getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
37
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
35
38
  createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
36
39
  nodes: import("..").BinaryNode[];
37
40
  shouldIncludeDeviceIdentity: boolean;
@@ -57,7 +60,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
57
60
  newsletterUnmute: (jid: string) => Promise<void>;
58
61
  newsletterMute: (jid: string) => Promise<void>;
59
62
  newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
60
- newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
63
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
61
64
  newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
62
65
  newsletterAdminCount: (jid: string) => Promise<number>;
63
66
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
@@ -162,7 +165,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
162
165
  onUnexpectedError: (err: Error | Boom, msg: string) => void;
163
166
  uploadPreKeys: (count?: number) => Promise<void>;
164
167
  uploadPreKeysToServerIfRequired: () => Promise<void>;
165
- requestPairingCode: (phoneNumber: string) => Promise<string>;
168
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
166
169
  waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
167
170
  sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>;
168
171
  };
@@ -3,13 +3,15 @@ import { proto } from '../../WAProto';
3
3
  import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
4
4
  import { BinaryNode } from '../WABinary';
5
5
  export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
6
- sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
6
+ sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
7
7
  sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
8
8
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
9
9
  id: any;
10
10
  to: string;
11
11
  }>;
12
12
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
13
+ fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
14
+ requestPlaceholderResend: (messageKey: WAMessageKey) => Promise<string | undefined>;
13
15
  getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
14
16
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
15
17
  relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
@@ -19,6 +21,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
19
21
  readMessages: (keys: WAMessageKey[]) => Promise<void>;
20
22
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
21
23
  getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
24
+ sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
22
25
  createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
23
26
  nodes: BinaryNode[];
24
27
  shouldIncludeDeviceIdentity: boolean;
@@ -28,6 +31,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
28
31
  [_: string]: string;
29
32
  }>;
30
33
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
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>;
31
36
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
32
37
  subscribeNewsletterUpdates: (jid: string) => Promise<{
33
38
  duration: string;
@@ -42,7 +47,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
42
47
  newsletterUnmute: (jid: string) => Promise<void>;
43
48
  newsletterMute: (jid: string) => Promise<void>;
44
49
  newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
45
- newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
50
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
46
51
  newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
47
52
  newsletterAdminCount: (jid: string) => Promise<number>;
48
53
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
@@ -147,7 +152,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
147
152
  onUnexpectedError: (err: Error | Boom, msg: string) => void;
148
153
  uploadPreKeys: (count?: number) => Promise<void>;
149
154
  uploadPreKeysToServerIfRequired: () => Promise<void>;
150
- requestPairingCode: (phoneNumber: string) => Promise<string>;
155
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
151
156
  waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
152
157
  sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
153
158
  };