@modzneverdie/baileys 17.1.12 → 17.1.17

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 (113) hide show
  1. package/README.md +364 -0
  2. package/engine-requirements.js +4 -4
  3. package/lib/Defaults/baileys-version.json +1 -1
  4. package/lib/Defaults/index.d.ts +6 -4
  5. package/lib/Defaults/index.js +119 -78
  6. package/lib/Defaults/phonenumber-mcc.json +223 -0
  7. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -1
  8. package/lib/Socket/Client/index.d.ts +3 -2
  9. package/lib/Socket/Client/index.js +3 -2
  10. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  11. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  12. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -2
  13. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +5 -54
  14. package/lib/Socket/business.d.ts +58 -59
  15. package/lib/Socket/chats.d.ts +230 -45
  16. package/lib/Socket/chats.js +238 -139
  17. package/lib/Socket/{setup.ts → dugong.d.ts} +52 -17
  18. package/lib/Socket/dugong.js +484 -0
  19. package/lib/Socket/groups.d.ts +32 -41
  20. package/lib/Socket/groups.js +23 -38
  21. package/lib/Socket/index.d.ts +64 -63
  22. package/lib/Socket/index.js +3 -2
  23. package/lib/Socket/messages-recv.js +65 -9
  24. package/lib/Socket/messages-send.d.ts +47 -49
  25. package/lib/Socket/messages-send.js +399 -415
  26. package/lib/Socket/newsletter.d.ts +37 -39
  27. package/lib/Socket/newsletter.js +136 -71
  28. package/lib/Socket/registration.d.ts +267 -0
  29. package/lib/Socket/registration.js +166 -0
  30. package/lib/Socket/socket.d.ts +10 -10
  31. package/lib/Socket/socket.js +617 -754
  32. package/lib/Socket/usync.d.ts +3 -3
  33. package/lib/Store/index.d.ts +2 -1
  34. package/lib/Store/index.js +3 -1
  35. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  36. package/lib/Store/make-cache-manager-store.js +83 -0
  37. package/lib/Store/make-in-memory-store.d.ts +24 -24
  38. package/lib/Store/make-in-memory-store.js +14 -26
  39. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  40. package/lib/Store/make-ordered-dictionary.js +2 -2
  41. package/lib/Types/Auth.d.ts +7 -0
  42. package/lib/Types/Call.d.ts +1 -1
  43. package/lib/Types/Chat.d.ts +7 -14
  44. package/lib/Types/Contact.d.ts +1 -5
  45. package/lib/Types/Events.d.ts +2 -44
  46. package/lib/Types/GroupMetadata.d.ts +2 -11
  47. package/lib/Types/Label.js +1 -1
  48. package/lib/Types/LabelAssociation.js +1 -1
  49. package/lib/Types/Message.d.ts +21 -148
  50. package/lib/Types/Message.js +2 -0
  51. package/lib/Types/Newsletter.d.ts +97 -73
  52. package/lib/Types/Newsletter.js +38 -18
  53. package/lib/Types/Socket.d.ts +9 -17
  54. package/lib/Types/index.d.ts +1 -8
  55. package/lib/Types/index.js +2 -2
  56. package/lib/Utils/auth-utils.d.ts +3 -3
  57. package/lib/Utils/auth-utils.js +13 -6
  58. package/lib/Utils/business.js +2 -2
  59. package/lib/Utils/chat-utils.d.ts +16 -15
  60. package/lib/Utils/chat-utils.js +35 -36
  61. package/lib/Utils/crypto.d.ts +16 -15
  62. package/lib/Utils/crypto.js +29 -71
  63. package/lib/Utils/decode-wa-message.d.ts +6 -22
  64. package/lib/Utils/decode-wa-message.js +56 -65
  65. package/lib/Utils/event-buffer.d.ts +2 -2
  66. package/lib/Utils/event-buffer.js +7 -11
  67. package/lib/Utils/generics.d.ts +20 -17
  68. package/lib/Utils/generics.js +84 -102
  69. package/lib/Utils/history.d.ts +0 -4
  70. package/lib/Utils/history.js +6 -4
  71. package/lib/Utils/link-preview.d.ts +2 -2
  72. package/lib/Utils/link-preview.js +1 -34
  73. package/lib/Utils/logger.d.ts +3 -10
  74. package/lib/Utils/lt-hash.d.ts +2 -2
  75. package/lib/Utils/lt-hash.js +6 -6
  76. package/lib/Utils/make-mutex.d.ts +2 -2
  77. package/lib/Utils/messages-media.d.ts +24 -28
  78. package/lib/Utils/messages-media.js +236 -298
  79. package/lib/Utils/messages.d.ts +10 -8
  80. package/lib/Utils/messages.js +60 -304
  81. package/lib/Utils/noise-handler.d.ts +12 -10
  82. package/lib/Utils/noise-handler.js +23 -18
  83. package/lib/Utils/process-message.d.ts +4 -5
  84. package/lib/Utils/process-message.js +25 -89
  85. package/lib/Utils/signal.d.ts +1 -2
  86. package/lib/Utils/signal.js +26 -26
  87. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  88. package/lib/Utils/use-multi-file-auth-state.js +0 -6
  89. package/lib/Utils/validate-connection.d.ts +4 -3
  90. package/lib/Utils/validate-connection.js +76 -20
  91. package/lib/WABinary/constants.d.ts +27 -24
  92. package/lib/WABinary/constants.js +13 -1276
  93. package/lib/WABinary/decode.d.ts +4 -3
  94. package/lib/WABinary/decode.js +13 -26
  95. package/lib/WABinary/encode.d.ts +2 -1
  96. package/lib/WABinary/encode.js +152 -137
  97. package/lib/WABinary/generic-utils.d.ts +4 -1
  98. package/lib/WABinary/generic-utils.js +125 -37
  99. package/lib/WABinary/jid-utils.d.ts +5 -10
  100. package/lib/WABinary/jid-utils.js +5 -26
  101. package/lib/WAM/BinaryInfo.d.ts +11 -2
  102. package/lib/WAM/encode.d.ts +2 -1
  103. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  104. package/lib/index.d.ts +2 -6
  105. package/lib/index.js +6 -20
  106. package/package.json +105 -107
  107. package/WAProto/GenerateStatics.sh +0 -4
  108. package/WAProto/WAProto.proto +0 -4775
  109. package/WAProto/index.d.ts +0 -55057
  110. package/WAProto/index.ts.ts +0 -53473
  111. package/lib/Socket/setup.js +0 -433
  112. package/lib/WABinary/jid-utils.js.bak +0 -83
  113. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -0,0 +1,223 @@
1
+ {
2
+ "93": 412,
3
+ "355": 276,
4
+ "213": 603,
5
+ "1-684": 544,
6
+ "376": 213,
7
+ "244": 631,
8
+ "1-264": 365,
9
+ "1-268": 344,
10
+ "54": 722,
11
+ "374": 283,
12
+ "297": 363,
13
+ "61": 505,
14
+ "43": 232,
15
+ "994": 400,
16
+ "1-242": 364,
17
+ "973": 426,
18
+ "880": 470,
19
+ "1-246": 342,
20
+ "375": 257,
21
+ "32": 206,
22
+ "501": 702,
23
+ "229": 616,
24
+ "1-441": 350,
25
+ "975": 402,
26
+ "591": 736,
27
+ "387": 218,
28
+ "267": 652,
29
+ "55": 724,
30
+ "1-284": 348,
31
+ "673": 528,
32
+ "359": 284,
33
+ "226": 613,
34
+ "257": 642,
35
+ "855": 456,
36
+ "237": 624,
37
+ "238": 625,
38
+ "1-345": 346,
39
+ "236": 623,
40
+ "235": 622,
41
+ "56": 730,
42
+ "86": 454,
43
+ "57": 732,
44
+ "269": 654,
45
+ "682": 548,
46
+ "506": 712,
47
+ "385": 219,
48
+ "53": 368,
49
+ "357": 280,
50
+ "420": 230,
51
+ "243": 630,
52
+ "45": 238,
53
+ "253": 638,
54
+ "1-767": 366,
55
+ "1-809": 370,
56
+ "1-849": 370,
57
+ "1-829": 370,
58
+ "593": 740,
59
+ "20": 602,
60
+ "503": 706,
61
+ "240": 627,
62
+ "291": 657,
63
+ "372": 248,
64
+ "251": 636,
65
+ "500": 750,
66
+ "298": 288,
67
+ "679": 542,
68
+ "358": 244,
69
+ "33": 208,
70
+ "689": 547,
71
+ "241": 628,
72
+ "220": 607,
73
+ "995": 282,
74
+ "49": 262,
75
+ "233": 620,
76
+ "350": 266,
77
+ "30": 202,
78
+ "299": 290,
79
+ "1-473": 352,
80
+ "1-671": 535,
81
+ "502": 704,
82
+ "224": 537,
83
+ "592": 738,
84
+ "509": 372,
85
+ "504": 708,
86
+ "852": 454,
87
+ "36": 216,
88
+ "354": 274,
89
+ "91": 404,
90
+ "62": 510,
91
+ "98": 432,
92
+ "964": 418,
93
+ "353": 234,
94
+ "972": 425,
95
+ "39": 222,
96
+ "225": 612,
97
+ "1-876": 338,
98
+ "81": 440,
99
+ "962": 416,
100
+ "254": 639,
101
+ "686": 545,
102
+ "383": 221,
103
+ "965": 419,
104
+ "371": 247,
105
+ "961": 415,
106
+ "266": 651,
107
+ "231": 618,
108
+ "218": 606,
109
+ "423": 295,
110
+ "370": 246,
111
+ "352": 270,
112
+ "389": 294,
113
+ "261": 646,
114
+ "265": 650,
115
+ "60": 502,
116
+ "960": 472,
117
+ "223": 610,
118
+ "356": 278,
119
+ "692": 551,
120
+ "222": 609,
121
+ "230": 617,
122
+ "52": 334,
123
+ "691": 550,
124
+ "373": 259,
125
+ "377": 212,
126
+ "976": 428,
127
+ "382": 297,
128
+ "1-664": 354,
129
+ "212": 604,
130
+ "258": 643,
131
+ "95": 414,
132
+ "264": 649,
133
+ "674": 536,
134
+ "977": 429,
135
+ "31": 204,
136
+ "687": 546,
137
+ "64": 530,
138
+ "505": 710,
139
+ "227": 614,
140
+ "234": 621,
141
+ "683": 555,
142
+ "1-670": 534,
143
+ "47": 242,
144
+ "968": 226,
145
+ "92": 410,
146
+ "680": 552,
147
+ "970": 423,
148
+ "507": 714,
149
+ "675": 537,
150
+ "595": 744,
151
+ "51": 716,
152
+ "63": 515,
153
+ "48": 260,
154
+ "351": 268,
155
+ "1-787, 1-939": 330,
156
+ "974": 427,
157
+ "242": 630,
158
+ "40": 226,
159
+ "7": 250,
160
+ "250": 635,
161
+ "290": 658,
162
+ "1-869": 356,
163
+ "1-758": 358,
164
+ "508": 308,
165
+ "1-784": 360,
166
+ "685": 544,
167
+ "378": 292,
168
+ "239": 626,
169
+ "966": 420,
170
+ "221": 608,
171
+ "381": 220,
172
+ "248": 633,
173
+ "232": 619,
174
+ "65": 525,
175
+ "386": 293,
176
+ "677": 540,
177
+ "27": 655,
178
+ "211": 659,
179
+ "34": 214,
180
+ "94": 413,
181
+ "249": 634,
182
+ "597": 746,
183
+ "268": 653,
184
+ "46": 240,
185
+ "41": 228,
186
+ "963": 417,
187
+ "886": 466,
188
+ "992": 436,
189
+ "255": 640,
190
+ "66": 520,
191
+ "228": 615,
192
+ "690": 554,
193
+ "676": 539,
194
+ "1-868": 374,
195
+ "216": 605,
196
+ "90": 286,
197
+ "993": 438,
198
+ "1-649": 376,
199
+ "688": 553,
200
+ "1-340": 332,
201
+ "256": 641,
202
+ "380": 255,
203
+ "971": 424,
204
+ "44": 234,
205
+ "1": 310,
206
+ "598": 748,
207
+ "998": 434,
208
+ "678": 541,
209
+ "379": 225,
210
+ "58": 734,
211
+ "681": 543,
212
+ "967": 421,
213
+ "260": 645,
214
+ "263": 648,
215
+ "670": 514,
216
+ "245": 632,
217
+ "856": 457,
218
+ "599": 362,
219
+ "850": 467,
220
+ "262": 647,
221
+ "82": 450,
222
+ "84": 452
223
+ }
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import { EventEmitter } from 'events';
2
4
  import { URL } from 'url';
3
5
  import { SocketConfig } from '../../Types';
@@ -11,6 +13,5 @@ export declare abstract class AbstractSocketClient extends EventEmitter {
11
13
  constructor(url: URL, config: SocketConfig);
12
14
  abstract connect(): Promise<void>;
13
15
  abstract close(): Promise<void>;
14
- abstract restart(): Promise<void>;
15
16
  abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
16
17
  }
@@ -1,2 +1,3 @@
1
- export * from './types';
2
- export * from './websocket';
1
+ export * from './abstract-socket-client';
2
+ export * from './mobile-socket-client';
3
+ export * from './web-socket-client';
@@ -14,5 +14,6 @@ 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("./types"), exports);
18
- __exportStar(require("./websocket"), exports);
17
+ __exportStar(require("./abstract-socket-client"), exports);
18
+ __exportStar(require("./mobile-socket-client"), exports);
19
+ __exportStar(require("./web-socket-client"), exports);
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import { Socket } from 'net';
3
+ import { AbstractSocketClient } from './abstract-socket-client';
4
+ export declare class MobileSocketClient extends AbstractSocketClient {
5
+ protected socket: Socket | null;
6
+ get isOpen(): boolean;
7
+ get isClosed(): boolean;
8
+ get isClosing(): boolean;
9
+ get isConnecting(): boolean;
10
+ connect(): Promise<void>;
11
+ close(): Promise<void>;
12
+ send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
13
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileSocketClient = void 0;
4
+ const net_1 = require("net");
5
+ const abstract_socket_client_1 = require("./abstract-socket-client");
6
+ class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.socket = null;
10
+ }
11
+ get isOpen() {
12
+ var _a;
13
+ return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
14
+ }
15
+ get isClosed() {
16
+ var _a;
17
+ return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
18
+ }
19
+ get isClosing() {
20
+ var _a;
21
+ return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
22
+ }
23
+ get isConnecting() {
24
+ var _a;
25
+ return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
26
+ }
27
+ async connect() {
28
+ var _a;
29
+ if (this.socket) {
30
+ return;
31
+ }
32
+ if (this.config.agent) {
33
+ throw new Error('There are not support for proxy agent for mobile connection');
34
+ }
35
+ else {
36
+ this.socket = (0, net_1.connect)({
37
+ host: this.url.hostname,
38
+ port: Number(this.url.port) || 443
39
+ });
40
+ }
41
+ this.socket.setMaxListeners(0);
42
+ const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
43
+ for (const event of events) {
44
+ (_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
45
+ }
46
+ this.socket.on('data', (...args) => this.emit('message', ...args));
47
+ this.socket.on('ready', (...args) => this.emit('open', ...args));
48
+ }
49
+ async close() {
50
+ if (!this.socket) {
51
+ return;
52
+ }
53
+ return new Promise(resolve => {
54
+ this.socket.end(resolve);
55
+ this.socket = null;
56
+ });
57
+ }
58
+ send(str, cb) {
59
+ if (this.socket === null) {
60
+ return false;
61
+ }
62
+ return this.socket.write(str, undefined, cb);
63
+ }
64
+ }
65
+ exports.MobileSocketClient = MobileSocketClient;
@@ -1,5 +1,5 @@
1
1
  import WebSocket from 'ws';
2
- import { AbstractSocketClient } from './types';
2
+ import { AbstractSocketClient } from './abstract-socket-client';
3
3
  export declare class WebSocketClient extends AbstractSocketClient {
4
4
  protected socket: WebSocket | null;
5
5
  get isOpen(): boolean;
@@ -8,6 +8,5 @@ export declare class WebSocketClient extends AbstractSocketClient {
8
8
  get isConnecting(): boolean;
9
9
  connect(): Promise<void>;
10
10
  close(): Promise<void>;
11
- restart(): Promise<void>;
12
11
  send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
13
12
  }
@@ -6,16 +6,11 @@ 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 types_1 = require("./types");
10
- class WebSocketClient extends types_1.AbstractSocketClient {
9
+ const abstract_socket_client_1 = require("./abstract-socket-client");
10
+ class WebSocketClient extends abstract_socket_client_1.AbstractSocketClient {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.socket = null;
14
- // queue & dispatch variables for throttling outgoing messages to avoid rate limits
15
- this._queue = [];
16
- this._isDispatching = false;
17
- this._lastDispatch = 0;
18
- this._minSendIntervalMs = (Defaults_1.DEFAULT_CONNECTION_CONFIG && Defaults_1.DEFAULT_CONNECTION_CONFIG.minSendIntervalMs) || 50;
19
14
  }
20
15
  get isOpen() {
21
16
  var _a;
@@ -58,54 +53,10 @@ class WebSocketClient extends types_1.AbstractSocketClient {
58
53
  this.socket.close();
59
54
  this.socket = null;
60
55
  }
61
- async restart() {
62
- if (this.socket) {
63
- await new Promise(resolve => {
64
- this.socket.once('close', resolve);
65
- this.socket.terminate();
66
- });
67
- this.socket = null;
68
- }
69
- await this.connect();
70
- }
71
56
  send(str, cb) {
72
- // throttle sends to reduce rate-limit likelihood
73
- const doSend = () => {
74
- var _a;
75
- (_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(str, cb);
76
- return Boolean(this.socket);
77
- };
78
- this._queue.push(doSend);
79
- this._dispatch();
80
- return true;
81
- }
82
-
83
- _dispatch() {
84
- if (this._isDispatching) {
85
- return;
86
- }
87
- this._isDispatching = true;
88
- const tick = () => {
89
- const now = Date.now();
90
- if (this._queue.length === 0) {
91
- this._isDispatching = false;
92
- return;
93
- }
94
- const delta = now - this._lastDispatch;
95
- const wait = Math.max(0, this._minSendIntervalMs - delta);
96
- setTimeout(() => {
97
- const fn = this._queue.shift();
98
- this._lastDispatch = Date.now();
99
- try {
100
- fn && fn();
101
- }
102
- catch (_err) {
103
- // ignore send errors here; they'll surface elsewhere
104
- }
105
- tick();
106
- }, wait);
107
- };
108
- tick();
57
+ var _a;
58
+ (_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(str, cb);
59
+ return Boolean(this.socket);
109
60
  }
110
61
  }
111
62
  exports.WebSocketClient = WebSocketClient;
@@ -1,7 +1,8 @@
1
+ /// <reference types="node" />
1
2
  import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
2
3
  import { BinaryNode } from '../WABinary';
3
4
  export declare const makeBusinessSocket: (config: SocketConfig) => {
4
- logger: import("../Utils/logger").ILogger;
5
+ logger: import("pino").Logger<import("pino").LoggerOptions>;
5
6
  getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
6
7
  getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
7
8
  products: import("../Types").Product[];
@@ -15,40 +16,41 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
15
16
  deleted: number;
16
17
  }>;
17
18
  productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>;
18
- sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
19
+ sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
19
20
  sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
20
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
21
21
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
22
- callId: string;
23
- toJid: string;
24
- isVideo: boolean;
22
+ id: string;
23
+ to: string;
25
24
  }>;
26
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
27
- requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
28
- getPrivacyTokens: (jids: string[]) => Promise<any>;
25
+ rejectCall: (callId: string, callFrom: string) => Promise<void>;
26
+ getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
29
27
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
30
- relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
28
+ relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
31
29
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
32
- sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
33
- readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
30
+ sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
31
+ getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
32
+ [key: string]: string;
33
+ };
34
+ readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
34
35
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
35
- waUploadToServer: import("../Types").WAMediaUploadFunction;
36
- fetchPrivacySettings: (force?: boolean) => Promise<{
37
- [_: string]: string;
38
- }>;
39
36
  getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
40
- createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
37
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
38
+ [key: string]: string;
39
+ } | undefined) => Promise<{
41
40
  nodes: BinaryNode[];
42
41
  shouldIncludeDeviceIdentity: boolean;
43
42
  }>;
44
- sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
43
+ waUploadToServer: import("../Types").WAMediaUploadFunction;
44
+ fetchPrivacySettings: (force?: boolean) => Promise<{
45
+ [_: string]: string;
46
+ }>;
45
47
  updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
46
- sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
48
+ sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
47
49
  subscribeNewsletterUpdates: (jid: string) => Promise<{
48
50
  duration: string;
49
51
  }>;
50
52
  newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
51
- newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
53
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
52
54
  newsletterUpdateName: (jid: string, name: string) => Promise<void>;
53
55
  newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
54
56
  newsletterRemovePicture: (jid: string) => Promise<void>;
@@ -56,16 +58,16 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
56
58
  newsletterFollow: (jid: string) => Promise<void>;
57
59
  newsletterUnmute: (jid: string) => Promise<void>;
58
60
  newsletterMute: (jid: string) => Promise<void>;
59
- newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
60
- newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
61
+ newsletterAction: (jid: string, type: "mute" | "follow" | "unfollow" | "unmute") => Promise<void>;
62
+ newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
63
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
61
64
  newsletterAdminCount: (jid: string) => Promise<number>;
62
65
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
63
66
  newsletterDemote: (jid: string, user: string) => Promise<void>;
64
67
  newsletterDelete: (jid: string) => Promise<void>;
65
- newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
66
- newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
67
- newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
68
- groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<any>;
68
+ newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
69
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
70
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
69
71
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
70
72
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
71
73
  groupLeave: (id: string) => Promise<void>;
@@ -73,7 +75,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
73
75
  groupRequestParticipantsList: (jid: string) => Promise<{
74
76
  [key: string]: string;
75
77
  }[]>;
76
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
78
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
77
79
  status: string;
78
80
  jid: string;
79
81
  }[]>;
@@ -82,71 +84,68 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
82
84
  jid: string;
83
85
  content: BinaryNode;
84
86
  }[]>;
85
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
87
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
86
88
  groupInviteCode: (jid: string) => Promise<string | undefined>;
87
89
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
88
90
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
89
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
90
- groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
91
+ groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
91
92
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
92
93
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
93
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
94
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
94
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
95
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
95
96
  groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
96
97
  groupFetchAllParticipating: () => Promise<{
97
98
  [_: string]: import("../Types").GroupMetadata;
98
99
  }>;
99
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
100
100
  processingMutex: {
101
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
101
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
102
102
  };
103
- upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
103
+ upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
104
104
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
105
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
106
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
107
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
105
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
106
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
107
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
108
108
  onWhatsApp: (...jids: string[]) => Promise<{
109
109
  jid: string;
110
110
  exists: unknown;
111
111
  lid: unknown;
112
112
  }[] | undefined>;
113
113
  fetchBlocklist: () => Promise<string[]>;
114
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
115
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
114
+ fetchStatus: (jid: string) => Promise<{
115
+ status: string | undefined;
116
+ setAt: Date;
117
+ } | undefined>;
116
118
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
117
119
  removeProfilePicture: (jid: string) => Promise<void>;
118
120
  updateProfileStatus: (status: string) => Promise<void>;
119
121
  updateProfileName: (name: string) => Promise<void>;
120
122
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
121
- updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
122
- updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
123
123
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
124
124
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
125
125
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
126
126
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
127
127
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
128
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
128
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
129
129
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
130
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
131
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
130
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
131
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
132
132
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
133
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
133
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
134
134
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
135
135
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
136
136
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
137
137
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
138
138
  star: (jid: string, messages: {
139
139
  id: string;
140
- fromMe?: boolean;
140
+ fromMe?: boolean | undefined;
141
141
  }[], star: boolean) => Promise<void>;
142
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
143
142
  type: "md";
144
- ws: import("./Client").WebSocketClient;
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>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
149
- flush(force?: boolean): boolean;
147
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
148
+ flush(force?: boolean | undefined): boolean;
150
149
  isBuffering(): boolean;
151
150
  };
152
151
  authState: {
@@ -156,17 +155,17 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
156
155
  signalRepository: import("../Types").SignalRepository;
157
156
  user: import("../Types").Contact | undefined;
158
157
  generateMessageTag: () => string;
159
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
160
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
158
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
159
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
161
160
  waitForSocketOpen: () => Promise<void>;
162
161
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
163
162
  sendNode: (frame: BinaryNode) => Promise<void>;
164
- logout: (msg?: string) => Promise<void>;
163
+ logout: (msg?: string | undefined) => Promise<void>;
165
164
  end: (error: Error | undefined) => void;
166
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
165
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
167
166
  uploadPreKeys: (count?: number) => Promise<void>;
168
167
  uploadPreKeysToServerIfRequired: () => Promise<void>;
169
- requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
170
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
171
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
168
+ requestPairingCode: (phoneNumber: string) => Promise<string>;
169
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
170
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
172
171
  };