@jkt48connect-corp/baileys 7.2.8 → 7.3.0

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": [2, 3000, 1019707846]
2
+ "version": [2, 3000, 1019097045]
3
3
  }
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import { proto } from '../../WAProto';
2
4
  import type { MediaType, SocketConfig } from '../Types';
3
5
  export declare const UNAUTHORIZED_CODES: number[];
@@ -231,16 +233,16 @@ export declare const DEF_CALLBACK_PREFIX = "CB:";
231
233
  export declare const DEF_TAG_PREFIX = "TAG:";
232
234
  export declare const PHONE_CONNECTION_CB = "CB:Pong";
233
235
  export declare const WA_DEFAULT_EPHEMERAL: number;
234
- export declare const MOBILE_TOKEN: any;
236
+ export declare const MOBILE_TOKEN: Buffer;
235
237
  export declare const MOBILE_REGISTRATION_ENDPOINT = "https://v.whatsapp.net/v2";
236
- export declare const MOBILE_USERAGENT = "WhatsApp/2.24.6.77 iOS/15.3.1 Device/Apple-iPhone_7";
237
- export declare const REGISTRATION_PUBLIC_KEY: any;
238
+ export declare const MOBILE_USERAGENT: string;
239
+ export declare const REGISTRATION_PUBLIC_KEY: Buffer;
238
240
  export declare const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
239
241
  export declare const DICT_VERSION = 2;
240
- export declare const KEY_BUNDLE_TYPE: any;
241
- export declare const NOISE_WA_HEADER: any;
242
+ export declare const KEY_BUNDLE_TYPE: Buffer;
243
+ export declare const NOISE_WA_HEADER: Buffer;
242
244
  export declare const PROTOCOL_VERSION: number[];
243
- export declare const MOBILE_NOISE_HEADER: any;
245
+ export declare const MOBILE_NOISE_HEADER: Buffer;
244
246
  /** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
245
247
  export declare const URL_REGEX: RegExp;
246
248
  export declare const WA_CERT_DETAILS: {
@@ -271,7 +273,7 @@ export declare const MEDIA_HKDF_KEY_MAPPING: {
271
273
  'payment-bg-image': string;
272
274
  ptv: string;
273
275
  };
274
- export declare const MEDIA_KEYS: MediaType[];
276
+ export declare const MEDIA_KEYS: ("ppic" | "product" | "image" | "video" | "sticker" | "audio" | "gif" | "ptt" | "thumbnail-document" | "thumbnail-image" | "thumbnail-link" | "thumbnail-video" | "md-app-state" | "md-msg-hist" | "document" | "product-catalog-image" | "payment-bg-image" | "ptv")[];
275
277
  export declare const MIN_PREKEY_COUNT = 5;
276
278
  export declare const INITIAL_PREKEY_COUNT = 30;
277
279
  export declare const DEFAULT_CACHE_TTLS: {
@@ -44,7 +44,8 @@ exports.PROCESSABLE_HISTORY_TYPES = [
44
44
  WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
45
45
  WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
46
46
  WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
47
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL
47
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
48
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND,
48
49
  ];
49
50
  exports.DEFAULT_CONNECTION_CONFIG = {
50
51
  version: baileys_version_json_1.version,
@@ -74,7 +75,6 @@ exports.DEFAULT_CONNECTION_CONFIG = {
74
75
  patch: false,
75
76
  snapshot: false,
76
77
  },
77
- countryCode: 'US',
78
78
  getMessage: async () => undefined,
79
79
  cachedGroupMetadata: async () => undefined,
80
80
  makeSignalRepository: libsignal_1.makeLibSignalRepository
@@ -114,8 +114,8 @@ exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
114
114
  exports.MIN_PREKEY_COUNT = 5;
115
115
  exports.INITIAL_PREKEY_COUNT = 30;
116
116
  exports.DEFAULT_CACHE_TTLS = {
117
- SIGNAL_STORE: 5 * 60, // 5 minutes
118
- MSG_RETRY: 60 * 60, // 1 hour
119
- CALL_OFFER: 5 * 60, // 5 minutes
117
+ SIGNAL_STORE: 5 * 60,
118
+ MSG_RETRY: 60 * 60,
119
+ CALL_OFFER: 5 * 60,
120
120
  USER_DEVICES: 5 * 60, // 5 minutes
121
121
  };
@@ -1,3 +1,2 @@
1
- export * from './abstract-socket-client';
2
- export * from './mobile-socket-client';
3
- export * from './web-socket-client';
1
+ export * from './types';
2
+ export * from './websocket';
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./abstract-socket-client"), exports);
18
- __exportStar(require("./mobile-socket-client"), exports);
19
- __exportStar(require("./web-socket-client"), exports);
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./websocket"), exports);
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { EventEmitter } from 'events';
4
+ import { URL } from 'url';
5
+ import { SocketConfig } from '../../Types';
6
+ export declare abstract class AbstractSocketClient extends EventEmitter {
7
+ url: URL;
8
+ config: SocketConfig;
9
+ abstract get isOpen(): boolean;
10
+ abstract get isClosed(): boolean;
11
+ abstract get isClosing(): boolean;
12
+ abstract get isConnecting(): boolean;
13
+ constructor(url: URL, config: SocketConfig);
14
+ abstract connect(): Promise<void>;
15
+ abstract close(): Promise<void>;
16
+ abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
17
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractSocketClient = void 0;
4
+ const events_1 = require("events");
5
+ class AbstractSocketClient extends events_1.EventEmitter {
6
+ constructor(url, config) {
7
+ super();
8
+ this.url = url;
9
+ this.config = config;
10
+ this.setMaxListeners(0);
11
+ }
12
+ }
13
+ exports.AbstractSocketClient = AbstractSocketClient;
@@ -1,5 +1,5 @@
1
1
  import WebSocket from 'ws';
2
- import { AbstractSocketClient } from './abstract-socket-client';
2
+ import { AbstractSocketClient } from './types';
3
3
  export declare class WebSocketClient extends AbstractSocketClient {
4
4
  protected socket: WebSocket | null;
5
5
  get isOpen(): boolean;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.WebSocketClient = void 0;
7
7
  const ws_1 = __importDefault(require("ws"));
8
8
  const Defaults_1 = require("../../Defaults");
9
- const abstract_socket_client_1 = require("./abstract-socket-client");
10
- class WebSocketClient extends abstract_socket_client_1.AbstractSocketClient {
9
+ const types_1 = require("./types");
10
+ class WebSocketClient extends types_1.AbstractSocketClient {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.socket = null;
@@ -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
78
  requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
77
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
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
111
  requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
110
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
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)();