@genuxofficial/baileys 2.0.0 → 4.0.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.
Files changed (108) hide show
  1. package/WAProto/WAProto.proto +4451 -0
  2. package/WAProto/index.d.ts +219 -2233
  3. package/WAProto/index.js +525 -6773
  4. package/WAProto/shizo.x +1 -0
  5. package/engine-requirements.js +1 -1
  6. package/lib/Defaults/baileys-version.json +1 -1
  7. package/lib/Defaults/index.d.ts +236 -3
  8. package/lib/Defaults/index.js +24 -8
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Signal/libsignal.js +9 -18
  11. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -0
  12. package/lib/Socket/Client/index.d.ts +3 -2
  13. package/lib/Socket/Client/index.js +3 -2
  14. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  15. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  16. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  17. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +3 -3
  18. package/lib/Socket/business.d.ts +43 -43
  19. package/lib/Socket/chats.d.ts +17 -23
  20. package/lib/Socket/chats.js +9 -123
  21. package/lib/Socket/groups.d.ts +27 -32
  22. package/lib/Socket/groups.js +5 -18
  23. package/lib/Socket/index.d.ts +51 -49
  24. package/lib/Socket/index.js +2 -2
  25. package/lib/Socket/messages-recv.d.ts +41 -42
  26. package/lib/Socket/messages-recv.js +20 -39
  27. package/lib/Socket/messages-send.d.ts +33 -38
  28. package/lib/Socket/messages-send.js +16 -37
  29. package/lib/Socket/newsletter.d.ts +30 -35
  30. package/lib/Socket/newsletter.js +22 -26
  31. package/lib/Socket/registration.d.ts +271 -0
  32. package/lib/Socket/registration.js +166 -0
  33. package/lib/Socket/socket.d.ts +10 -9
  34. package/lib/Socket/socket.js +19 -16
  35. package/lib/Socket/usync.d.ts +12 -10
  36. package/lib/Socket/usync.js +15 -10
  37. package/lib/Store/index.d.ts +2 -1
  38. package/lib/Store/index.js +3 -1
  39. package/lib/Store/make-in-memory-store.d.ts +1 -1
  40. package/lib/Store/make-in-memory-store.js +10 -8
  41. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  42. package/lib/Store/make-ordered-dictionary.js +2 -2
  43. package/lib/Types/Auth.d.ts +8 -0
  44. package/lib/Types/Chat.d.ts +2 -12
  45. package/lib/Types/Contact.d.ts +1 -6
  46. package/lib/Types/GroupMetadata.d.ts +0 -7
  47. package/lib/Types/Label.d.ts +0 -11
  48. package/lib/Types/Label.js +1 -1
  49. package/lib/Types/LabelAssociation.js +1 -1
  50. package/lib/Types/Message.d.ts +8 -7
  51. package/lib/Types/Message.js +2 -0
  52. package/lib/Types/Newsletter.js +2 -2
  53. package/lib/Types/Socket.d.ts +6 -7
  54. package/lib/Types/index.js +1 -1
  55. package/lib/Utils/auth-utils.d.ts +1 -1
  56. package/lib/Utils/auth-utils.js +12 -5
  57. package/lib/Utils/business.js +2 -2
  58. package/lib/Utils/chat-utils.d.ts +13 -11
  59. package/lib/Utils/chat-utils.js +2 -28
  60. package/lib/Utils/crypto.d.ts +16 -14
  61. package/lib/Utils/crypto.js +22 -34
  62. package/lib/Utils/decode-wa-message.d.ts +2 -4
  63. package/lib/Utils/decode-wa-message.js +24 -160
  64. package/lib/Utils/event-buffer.js +6 -4
  65. package/lib/Utils/generics.d.ts +12 -40
  66. package/lib/Utils/generics.js +25 -103
  67. package/lib/Utils/link-preview.js +1 -34
  68. package/lib/Utils/lt-hash.d.ts +3 -3
  69. package/lib/Utils/lt-hash.js +45 -11
  70. package/lib/Utils/make-mutex.d.ts +2 -2
  71. package/lib/Utils/messages-media.d.ts +16 -26
  72. package/lib/Utils/messages-media.js +26 -102
  73. package/lib/Utils/messages.d.ts +8 -5
  74. package/lib/Utils/messages.js +15 -17
  75. package/lib/Utils/noise-handler.d.ts +8 -5
  76. package/lib/Utils/noise-handler.js +10 -5
  77. package/lib/Utils/process-message.js +2 -2
  78. package/lib/Utils/use-multi-file-auth-state.js +11 -48
  79. package/lib/Utils/validate-connection.d.ts +3 -2
  80. package/lib/Utils/validate-connection.js +44 -10
  81. package/lib/WABinary/constants.js +5 -5
  82. package/lib/WABinary/decode.d.ts +4 -2
  83. package/lib/WABinary/decode.js +7 -17
  84. package/lib/WABinary/encode.d.ts +3 -1
  85. package/lib/WABinary/encode.js +17 -40
  86. package/lib/WABinary/generic-utils.d.ts +3 -1
  87. package/lib/WABinary/generic-utils.js +2 -2
  88. package/lib/WABinary/jid-utils.d.ts +3 -8
  89. package/lib/WABinary/jid-utils.js +2 -23
  90. package/lib/WAM/BinaryInfo.d.ts +12 -2
  91. package/lib/WAM/constants.d.ts +2 -3
  92. package/lib/WAM/encode.d.ts +3 -1
  93. package/lib/WAM/encode.js +2 -2
  94. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  95. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +2 -2
  96. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  97. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +5 -5
  98. package/lib/WAUSync/USyncQuery.d.ts +0 -2
  99. package/lib/WAUSync/USyncQuery.js +13 -27
  100. package/lib/WAUSync/USyncUser.d.ts +0 -2
  101. package/lib/WAUSync/USyncUser.js +0 -4
  102. package/package.json +60 -55
  103. package/LICENSE +0 -21
  104. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  105. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
  106. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  107. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
  108. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import { proto } from '../../WAProto';
2
4
  import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
3
5
  import { BinaryNode } from '../WABinary';
@@ -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
  }[]>;
@@ -34,38 +36,34 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
34
36
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
35
37
  * @param inviteMessage the message to accept
36
38
  */
37
- groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
39
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
38
40
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
39
41
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
40
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
41
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
42
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
42
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
43
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
44
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
43
45
  groupFetchAllParticipating: () => Promise<{
44
46
  [_: string]: GroupMetadata;
45
47
  }>;
46
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
47
48
  processingMutex: {
48
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
49
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
49
50
  };
50
51
  fetchPrivacySettings: (force?: boolean) => Promise<{
51
52
  [_: string]: string;
52
53
  }>;
53
54
  upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
54
55
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
55
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
56
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
57
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
56
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
57
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
58
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
58
59
  onWhatsApp: (...jids: string[]) => Promise<{
59
60
  jid: string;
60
61
  exists: unknown;
61
- lid: unknown;
62
62
  }[] | undefined>;
63
63
  fetchBlocklist: () => Promise<string[]>;
64
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
65
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
64
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
65
+ fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
66
66
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
67
- updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
68
- updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
69
67
  removeProfilePicture: (jid: string) => Promise<void>;
70
68
  updateProfileStatus: (status: string) => Promise<void>;
71
69
  updateProfileName: (name: string) => Promise<void>;
@@ -79,29 +77,26 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
79
77
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
80
78
  updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
81
79
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
82
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
80
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
83
81
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
84
82
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
85
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
86
- addOrEditContact: (jid: string, contact: import("../Types").ContactAction) => Promise<void>;
87
- removeContact: (jid: string) => Promise<void>;
88
- addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
83
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
89
84
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
90
85
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
91
86
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
92
87
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
93
88
  star: (jid: string, messages: {
94
89
  id: string;
95
- fromMe?: boolean;
90
+ fromMe?: boolean | undefined;
96
91
  }[], star: boolean) => Promise<void>;
97
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
92
+ executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
98
93
  type: "md";
99
- ws: import("./Client").WebSocketClient;
94
+ ws: any;
100
95
  ev: import("../Types").BaileysEventEmitter & {
101
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
96
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
102
97
  buffer(): void;
103
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
104
- flush(force?: boolean): boolean;
98
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
99
+ flush(force?: boolean | undefined): boolean;
105
100
  isBuffering(): boolean;
106
101
  };
107
102
  authState: {
@@ -111,18 +106,18 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
111
106
  signalRepository: import("../Types").SignalRepository;
112
107
  user: import("../Types").Contact | undefined;
113
108
  generateMessageTag: () => string;
114
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
115
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
109
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
110
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
116
111
  waitForSocketOpen: () => Promise<void>;
117
112
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
118
113
  sendNode: (frame: BinaryNode) => Promise<void>;
119
- logout: (msg?: string) => Promise<void>;
114
+ logout: (msg?: string | undefined) => Promise<void>;
120
115
  end: (error: Error | undefined) => void;
121
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
116
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
122
117
  uploadPreKeys: (count?: number) => Promise<void>;
123
118
  uploadPreKeysToServerIfRequired: () => Promise<void>;
124
119
  requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
125
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
126
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
120
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number | undefined) => Promise<void>;
121
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
127
122
  };
128
123
  export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
@@ -69,7 +69,7 @@ const makeGroupsSocket = (config) => {
69
69
  ...sock,
70
70
  groupMetadata,
71
71
  groupCreate: async (subject, participants) => {
72
- const key = (0, Utils_1.generateMessageIDV2)();
72
+ const key = (0, Utils_1.generateMessageID)();
73
73
  const result = await groupQuery('@g.us', 'set', [
74
74
  {
75
75
  tag: 'create',
@@ -163,7 +163,7 @@ const makeGroupsSocket = (config) => {
163
163
  {
164
164
  tag: 'description',
165
165
  attrs: {
166
- ...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: 'true' }),
166
+ ...(description ? { id: (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
167
167
  ...(prev ? { prev } : {})
168
168
  },
169
169
  content: description ? [
@@ -277,15 +277,9 @@ const extractGroupMetadata = (result) => {
277
277
  const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
278
278
  let desc;
279
279
  let descId;
280
- let descOwner;
281
- let descOwnerPn;
282
- let descTime;
283
280
  if (descChild) {
284
281
  desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, 'body');
285
- descOwner = descChild.attrs.participant;
286
- descOwnerPn = descChild.attrs.participant_pn ? (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant_pn) : undefined;
287
282
  descId = descChild.attrs.id;
288
- descTime = descChild.attrs.t ? +descChild.attrs.t : undefined;
289
283
  }
290
284
  const groupSize = group.attrs.size ? Number(group.attrs.size) : undefined;
291
285
  const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
@@ -293,20 +287,14 @@ const extractGroupMetadata = (result) => {
293
287
  const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
294
288
  const metadata = {
295
289
  id: groupId,
296
- addressingMode: group.attrs.addressing_mode,
297
290
  subject: group.attrs.subject,
298
291
  subjectOwner: group.attrs.s_o,
299
- subjectOwnerPn: group.attrs.s_o_pn ? (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o_pn) : undefined,
300
- subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
292
+ subjectTime: +group.attrs.s_t,
301
293
  size: groupSize || (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
302
- creation: group.attrs.creation ? +group.attrs.creation : undefined,
294
+ creation: +group.attrs.creation,
303
295
  owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
304
- onwerPn: group.attrs.creator_pn ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn) : undefined,
305
296
  desc,
306
297
  descId,
307
- descOwner,
308
- descOwnerPn,
309
- descTime,
310
298
  linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
311
299
  restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
312
300
  announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
@@ -316,8 +304,7 @@ const extractGroupMetadata = (result) => {
316
304
  memberAddMode,
317
305
  participants: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
318
306
  return {
319
- id: attrs.phone_number || attrs.jid,
320
- lid: attrs.lid || attrs.jid,
307
+ id: attrs.jid,
321
308
  admin: (attrs.type || null),
322
309
  };
323
310
  }),
@@ -1,12 +1,17 @@
1
+ /// <reference types="long" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
1
4
  import { UserFacingSocketConfig } from '../Types';
2
5
  declare const makeWASocket: (config: UserFacingSocketConfig) => {
6
+ register: (code: string) => Promise<import("./registration").ExistsResponse>;
7
+ requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions | undefined) => Promise<import("./registration").ExistsResponse>;
3
8
  logger: import("../Utils/logger").ILogger;
4
9
  getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
5
10
  getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
6
11
  products: import("../Types").Product[];
7
12
  nextPageCursor: string | undefined;
8
13
  }>;
9
- getCollections: (jid?: string, limit?: number) => Promise<{
14
+ getCollections: (jid?: string | undefined, limit?: number) => Promise<{
10
15
  collections: import("../Types").CatalogCollection[];
11
16
  }>;
12
17
  productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
@@ -14,31 +19,35 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
14
19
  deleted: number;
15
20
  }>;
16
21
  productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
17
- sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
18
- sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
22
+ sendMessageAck: ({ tag, attrs, content }: import("../index").BinaryNode, errorCode?: number | undefined) => Promise<void>;
23
+ sendRetryRequest: (node: import("../index").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
19
24
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
20
25
  offerCall: (toJid: string, isVideo?: boolean) => Promise<{
21
26
  callId: string;
22
27
  toJid: string;
23
28
  isVideo: boolean;
24
29
  }>;
25
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
30
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>;
26
31
  requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
27
- getPrivacyTokens: (jids: string[]) => Promise<any>;
32
+ getPrivacyTokens: (jids: string[]) => Promise<import("../index").BinaryNode>;
28
33
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
29
34
  relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
30
35
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
31
36
  sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
32
- getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("..").BinaryNode["attrs"];
37
+ getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
38
+ [key: string]: string;
39
+ };
33
40
  readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
34
41
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
35
42
  waUploadToServer: import("../Types").WAMediaUploadFunction;
36
43
  fetchPrivacySettings: (force?: boolean) => Promise<{
37
44
  [_: string]: string;
38
45
  }>;
39
- getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
40
- createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
41
- nodes: import("..").BinaryNode[];
46
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../index").JidWithDevice[]>;
47
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
48
+ [key: string]: string;
49
+ } | undefined) => Promise<{
50
+ nodes: import("../index").BinaryNode[];
42
51
  shouldIncludeDeviceIdentity: boolean;
43
52
  }>;
44
53
  sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
@@ -48,7 +57,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
48
57
  duration: string;
49
58
  }>;
50
59
  newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
51
- newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
60
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
52
61
  newsletterUpdateName: (jid: string, name: string) => Promise<void>;
53
62
  newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
54
63
  newsletterRemovePicture: (jid: string) => Promise<void>;
@@ -56,15 +65,15 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
56
65
  newsletterFollow: (jid: string) => Promise<void>;
57
66
  newsletterUnmute: (jid: string) => Promise<void>;
58
67
  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>;
68
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
69
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
61
70
  newsletterAdminCount: (jid: string) => Promise<number>;
62
71
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
63
72
  newsletterDemote: (jid: string, user: string) => Promise<void>;
64
73
  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[]>;
74
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
75
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
76
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
68
77
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
69
78
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
70
79
  groupLeave: (id: string) => Promise<void>;
@@ -72,49 +81,45 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
72
81
  groupRequestParticipantsList: (jid: string) => Promise<{
73
82
  [key: string]: string;
74
83
  }[]>;
75
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
84
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
76
85
  status: string;
77
86
  jid: string;
78
87
  }[]>;
79
88
  groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
80
89
  status: string;
81
90
  jid: string;
82
- content: import("..").BinaryNode;
91
+ content: import("../index").BinaryNode;
83
92
  }[]>;
84
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
93
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
85
94
  groupInviteCode: (jid: string) => Promise<string | undefined>;
86
95
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
87
96
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
88
97
  groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
89
- groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
98
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
90
99
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
91
100
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
92
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
93
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
101
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
102
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
94
103
  groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
95
104
  groupFetchAllParticipating: () => Promise<{
96
105
  [_: string]: import("../Types").GroupMetadata;
97
106
  }>;
98
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
99
107
  processingMutex: {
100
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
108
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
101
109
  };
102
110
  upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
103
111
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
104
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
105
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
106
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
112
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
113
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
114
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
107
115
  onWhatsApp: (...jids: string[]) => Promise<{
108
116
  jid: string;
109
117
  exists: unknown;
110
- lid: unknown;
111
118
  }[] | undefined>;
112
119
  fetchBlocklist: () => Promise<string[]>;
113
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
114
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
120
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
121
+ fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
115
122
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
116
- updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
117
- updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
118
123
  removeProfilePicture: (jid: string) => Promise<void>;
119
124
  updateProfileStatus: (status: string) => Promise<void>;
120
125
  updateProfileName: (name: string) => Promise<void>;
@@ -128,29 +133,26 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
128
133
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
129
134
  updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
130
135
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
131
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
136
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
132
137
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
133
138
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
134
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
135
- addOrEditContact: (jid: string, contact: import("../Types").ContactAction) => Promise<void>;
136
- removeContact: (jid: string) => Promise<void>;
137
- addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
139
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
138
140
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
139
141
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
140
142
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
141
143
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
142
144
  star: (jid: string, messages: {
143
145
  id: string;
144
- fromMe?: boolean;
146
+ fromMe?: boolean | undefined;
145
147
  }[], star: boolean) => Promise<void>;
146
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
148
+ executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
147
149
  type: "md";
148
- ws: import("./Client").WebSocketClient;
150
+ ws: any;
149
151
  ev: import("../Types").BaileysEventEmitter & {
150
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
152
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
151
153
  buffer(): void;
152
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
153
- flush(force?: boolean): boolean;
154
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
155
+ flush(force?: boolean | undefined): boolean;
154
156
  isBuffering(): boolean;
155
157
  };
156
158
  authState: {
@@ -160,18 +162,18 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
160
162
  signalRepository: import("../Types").SignalRepository;
161
163
  user: import("../Types").Contact | undefined;
162
164
  generateMessageTag: () => string;
163
- query: (node: import("..").BinaryNode, timeoutMs?: number) => Promise<any>;
164
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
165
+ query: (node: import("../index").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../index").BinaryNode>;
166
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
165
167
  waitForSocketOpen: () => Promise<void>;
166
168
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
167
- sendNode: (frame: import("..").BinaryNode) => Promise<void>;
168
- logout: (msg?: string) => Promise<void>;
169
+ sendNode: (frame: import("../index").BinaryNode) => Promise<void>;
170
+ logout: (msg?: string | undefined) => Promise<void>;
169
171
  end: (error: Error | undefined) => void;
170
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
172
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
171
173
  uploadPreKeys: (count?: number) => Promise<void>;
172
174
  uploadPreKeysToServerIfRequired: () => Promise<void>;
173
175
  requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
174
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
175
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
176
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number | undefined) => Promise<void>;
177
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../index").BinaryNode>;
176
178
  };
177
179
  export default makeWASocket;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Defaults_1 = require("../Defaults");
4
- const business_1 = require("./business");
4
+ const registration_1 = require("./registration");
5
5
  // export the last socket layer
6
- const makeWASocket = (config) => ((0, business_1.makeBusinessSocket)({
6
+ const makeWASocket = (config) => ((0, registration_1.makeRegistrationSocket)({
7
7
  ...Defaults_1.DEFAULT_CONNECTION_CONFIG,
8
8
  ...config
9
9
  }));