@vanzxy/baileys 1.3.7 → 1.3.8

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 (122) hide show
  1. package/README.md +1 -1
  2. package/WAProto/index.d.ts +9 -0
  3. package/lib/Defaults/index.d.ts +147 -0
  4. package/lib/Defaults/index.js +2 -2
  5. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  6. package/lib/Signal/Group/group-session-builder.d.ts +7 -0
  7. package/lib/Signal/Group/group_cipher.d.ts +10 -0
  8. package/lib/Signal/Group/index.d.ts +11 -0
  9. package/lib/Signal/Group/keyhelper.d.ts +6 -0
  10. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  11. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  12. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  13. package/lib/Signal/Group/sender-key-name.d.ts +11 -0
  14. package/lib/Signal/Group/sender-key-record.d.ts +12 -0
  15. package/lib/Signal/Group/sender-key-state.d.ts +16 -0
  16. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  17. package/lib/Signal/libsignal.d.ts +54 -0
  18. package/lib/Signal/lid-mapping.d.ts +20 -0
  19. package/lib/Socket/Client/index.d.ts +2 -0
  20. package/lib/Socket/Client/types.d.ts +5 -0
  21. package/lib/Socket/Client/websocket.d.ts +12 -0
  22. package/lib/Socket/business.d.ts +395 -0
  23. package/lib/Socket/chats.d.ts +136 -0
  24. package/lib/Socket/communities.d.ts +561 -0
  25. package/lib/Socket/communities.js +4 -2
  26. package/lib/Socket/dugong.d.ts +117 -0
  27. package/lib/Socket/dugong.js +26 -1
  28. package/lib/Socket/groups.d.ts +285 -0
  29. package/lib/Socket/index.d.ts +531 -0
  30. package/lib/Socket/messages-recv.d.ts +333 -0
  31. package/lib/Socket/messages-send.d.ts +329 -0
  32. package/lib/Socket/mex.d.ts +1 -0
  33. package/lib/Socket/newsletter.d.ts +281 -0
  34. package/lib/Socket/newsletter.js +19 -19
  35. package/lib/Socket/socket.d.ts +60 -0
  36. package/lib/Store/index.d.ts +3 -0
  37. package/lib/Store/make-in-memory-store.d.ts +62 -0
  38. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  39. package/lib/Store/object-repository.d.ts +10 -0
  40. package/lib/Types/Auth.d.ts +117 -0
  41. package/lib/Types/Bussines.d.ts +25 -0
  42. package/lib/Types/Call.d.ts +15 -0
  43. package/lib/Types/Chat.d.ts +124 -0
  44. package/lib/Types/Contact.d.ts +26 -0
  45. package/lib/Types/Events.d.ts +256 -0
  46. package/lib/Types/GroupMetadata.d.ts +71 -0
  47. package/lib/Types/Label.d.ts +2 -0
  48. package/lib/Types/LabelAssociation.d.ts +2 -0
  49. package/lib/Types/Message.d.ts +11 -0
  50. package/lib/Types/Mex.d.ts +2 -0
  51. package/lib/Types/Product.d.ts +79 -0
  52. package/lib/Types/RichType.d.ts +2 -0
  53. package/lib/Types/Signal.d.ts +87 -0
  54. package/lib/Types/Socket.d.ts +136 -0
  55. package/lib/Types/State.d.ts +5 -0
  56. package/lib/Types/USync.d.ts +26 -0
  57. package/lib/Types/index.d.ts +66 -0
  58. package/lib/Utils/auth-utils.d.ts +57 -0
  59. package/lib/Utils/browser-utils.d.ts +8 -0
  60. package/lib/Utils/business.d.ts +49 -0
  61. package/lib/Utils/business.js +2 -1
  62. package/lib/Utils/chat-utils.d.ts +407 -0
  63. package/lib/Utils/chat-utils.js +15 -1
  64. package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
  65. package/lib/Utils/crypto.d.ts +41 -0
  66. package/lib/Utils/decode-wa-message.d.ts +83 -0
  67. package/lib/Utils/decode-wa-message.js +1 -3
  68. package/lib/Utils/event-buffer.d.ts +12 -0
  69. package/lib/Utils/generics.d.ts +63 -0
  70. package/lib/Utils/generics.js +2 -4
  71. package/lib/Utils/history.d.ts +90 -0
  72. package/lib/Utils/identity-change-handler.d.ts +13 -0
  73. package/lib/Utils/index.d.ts +24 -0
  74. package/lib/Utils/link-preview.d.ts +12 -0
  75. package/lib/Utils/logger.d.ts +2 -0
  76. package/lib/Utils/lt-hash.d.ts +12 -0
  77. package/lib/Utils/lt-hash.js +21 -2
  78. package/lib/Utils/make-mutex.d.ts +6 -0
  79. package/lib/Utils/message-retry-manager.d.ts +79 -0
  80. package/lib/Utils/messages-media.d.ts +135 -0
  81. package/lib/Utils/messages.d.ts +44 -0
  82. package/lib/Utils/noise-handler.d.ts +20 -0
  83. package/lib/Utils/offline-node-processor.d.ts +9 -0
  84. package/lib/Utils/pre-key-manager.d.ts +25 -0
  85. package/lib/Utils/process-message.d.ts +82 -0
  86. package/lib/Utils/reporting-utils.d.ts +12 -0
  87. package/lib/Utils/rich-message-utils.d.ts +48 -0
  88. package/lib/Utils/signal.d.ts +82 -0
  89. package/lib/Utils/stanza-ack.d.ts +16 -0
  90. package/lib/Utils/sync-action-utils.d.ts +2 -0
  91. package/lib/Utils/tc-token-utils.d.ts +29 -0
  92. package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
  93. package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
  94. package/lib/Utils/use-single-file-auth-state.js +6 -1
  95. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  96. package/lib/Utils/use-sqlite-auth-state.js +12 -0
  97. package/lib/Utils/validate-connection.d.ts +42 -0
  98. package/lib/WABinary/constants.d.ts +61 -0
  99. package/lib/WABinary/decode.d.ts +9 -0
  100. package/lib/WABinary/encode.d.ts +2 -0
  101. package/lib/WABinary/generic-utils.d.ts +74 -0
  102. package/lib/WABinary/index.d.ts +5 -0
  103. package/lib/WABinary/jid-utils.d.ts +28 -0
  104. package/lib/WABinary/types.d.ts +19 -0
  105. package/lib/WAM/BinaryInfo.d.ts +7 -0
  106. package/lib/WAM/constants.d.ts +34926 -0
  107. package/lib/WAM/encode.d.ts +1 -0
  108. package/lib/WAM/index.d.ts +3 -0
  109. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
  110. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
  111. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  112. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  113. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
  114. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
  115. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
  116. package/lib/WAUSync/Protocols/index.d.ts +7 -0
  117. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  118. package/lib/WAUSync/USyncUser.d.ts +16 -0
  119. package/lib/WAUSync/index.d.ts +3 -0
  120. package/lib/index.d.ts +12 -0
  121. package/package.json +12 -7
  122. package/postinstall-banner.js +23 -0
@@ -26,7 +26,7 @@ export class Dugong {
26
26
  detectType(content) {
27
27
  if (content.requestPaymentMessage) return "PAYMENT";
28
28
  if (content.productMessage) return "PRODUCT";
29
- if (content.groupInvite) return "GROUP_INVITE"; // Vanz@Fix: was missing
29
+ if (content.groupInviteMessage) return "GROUP_INVITE"; // Vanz@Fix (bug: field name mismatch — real message content is `groupInviteMessage`, not `groupInvite`, so this never actually matched a received message)
30
30
  if (content.interactiveButtons) return "INTERACTIVE_BUTTONS";
31
31
  if (content.interactiveMessage?.carouselMessage) return "CAROUSEL";
32
32
  if (content.interactiveMessage) return "INTERACTIVE";
@@ -586,6 +586,31 @@ export class Dugong {
586
586
  });
587
587
  return msg;
588
588
  }
589
+ async handleGroupInvite(content, jid, quoted) {
590
+ const inviteData = content.groupInviteMessage;
591
+ const msg = await generateWAMessageFromContent(
592
+ jid,
593
+ {
594
+ groupInviteMessage: {
595
+ groupJid: inviteData.groupJid,
596
+ inviteCode: inviteData.inviteCode,
597
+ inviteExpiration: inviteData.inviteExpiration ?? 0,
598
+ groupName: inviteData.groupName,
599
+ jpegThumbnail: inviteData.jpegThumbnail,
600
+ caption: inviteData.caption,
601
+ groupType: inviteData.groupType,
602
+ },
603
+ },
604
+ {
605
+ quoted,
606
+ userJid: jidNormalizedUser(this.sock.authState?.creds?.me?.id || ""),
607
+ },
608
+ );
609
+ await this.relayMessage(jid, msg.message, {
610
+ messageId: msg.key.id,
611
+ });
612
+ return msg;
613
+ }
589
614
  async handleGroupStory(content, jid, _quoted, options = {}) {
590
615
  const storyData = content.groupStatusMessage;
591
616
  let waMsgContent;
@@ -0,0 +1,285 @@
1
+ export function makeGroupsSocket(config: any): {
2
+ groupQuery: (jid: any, type: any, content: any) => Promise<any>;
3
+ groupMetadata: (jid: any) => Promise<{
4
+ id: any;
5
+ notify: any;
6
+ addressingMode: any;
7
+ subject: any;
8
+ subjectOwner: any;
9
+ subjectOwnerPn: any;
10
+ subjectOwnerUsername: any;
11
+ subjectTime: number;
12
+ size: any;
13
+ creation: number;
14
+ owner: string | undefined;
15
+ ownerPn: string | undefined;
16
+ ownerUsername: any;
17
+ owner_country_code: any;
18
+ desc: any;
19
+ descId: any;
20
+ descOwner: string | undefined;
21
+ descOwnerPn: string | undefined;
22
+ descOwnerUsername: any;
23
+ descTime: number | undefined;
24
+ linkedParent: any;
25
+ restrict: boolean;
26
+ announce: boolean;
27
+ isCommunity: boolean;
28
+ isCommunityAnnounce: boolean;
29
+ joinApprovalMode: boolean;
30
+ memberAddMode: boolean;
31
+ participants: any;
32
+ ephemeralDuration: number | undefined;
33
+ }>;
34
+ groupCreate: (subject: any, participants: any) => Promise<{
35
+ id: any;
36
+ notify: any;
37
+ addressingMode: any;
38
+ subject: any;
39
+ subjectOwner: any;
40
+ subjectOwnerPn: any;
41
+ subjectOwnerUsername: any;
42
+ subjectTime: number;
43
+ size: any;
44
+ creation: number;
45
+ owner: string | undefined;
46
+ ownerPn: string | undefined;
47
+ ownerUsername: any;
48
+ owner_country_code: any;
49
+ desc: any;
50
+ descId: any;
51
+ descOwner: string | undefined;
52
+ descOwnerPn: string | undefined;
53
+ descOwnerUsername: any;
54
+ descTime: number | undefined;
55
+ linkedParent: any;
56
+ restrict: boolean;
57
+ announce: boolean;
58
+ isCommunity: boolean;
59
+ isCommunityAnnounce: boolean;
60
+ joinApprovalMode: boolean;
61
+ memberAddMode: boolean;
62
+ participants: any;
63
+ ephemeralDuration: number | undefined;
64
+ }>;
65
+ groupLeave: (id: any) => Promise<void>;
66
+ groupUpdateSubject: (jid: any, subject: any) => Promise<void>;
67
+ groupRequestParticipantsList: (jid: any) => Promise<any>;
68
+ groupRequestParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
69
+ groupParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any[]>;
70
+ groupUpdateDescription: (jid: any, description: any) => Promise<void>;
71
+ groupInviteCode: (jid: any) => Promise<any>;
72
+ groupRevokeInvite: (jid: any) => Promise<any>;
73
+ groupAcceptInvite: (code: any) => Promise<any>;
74
+ /**
75
+ * revoke a v4 invite for someone
76
+ * @param groupJid group jid
77
+ * @param invitedJid jid of person you invited
78
+ * @returns true if successful
79
+ */
80
+ groupRevokeInviteV4: (groupJid: any, invitedJid: any) => Promise<boolean>;
81
+ /**
82
+ * accept a GroupInviteMessage
83
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
84
+ * @param inviteMessage the message to accept
85
+ */
86
+ groupAcceptInviteV4: (...args: any[]) => Promise<any>;
87
+ groupGetInviteInfo: (code: any) => Promise<{
88
+ id: any;
89
+ notify: any;
90
+ addressingMode: any;
91
+ subject: any;
92
+ subjectOwner: any;
93
+ subjectOwnerPn: any;
94
+ subjectOwnerUsername: any;
95
+ subjectTime: number;
96
+ size: any;
97
+ creation: number;
98
+ owner: string | undefined;
99
+ ownerPn: string | undefined;
100
+ ownerUsername: any;
101
+ owner_country_code: any;
102
+ desc: any;
103
+ descId: any;
104
+ descOwner: string | undefined;
105
+ descOwnerPn: string | undefined;
106
+ descOwnerUsername: any;
107
+ descTime: number | undefined;
108
+ linkedParent: any;
109
+ restrict: boolean;
110
+ announce: boolean;
111
+ isCommunity: boolean;
112
+ isCommunityAnnounce: boolean;
113
+ joinApprovalMode: boolean;
114
+ memberAddMode: boolean;
115
+ participants: any;
116
+ ephemeralDuration: number | undefined;
117
+ }>;
118
+ groupToggleEphemeral: (jid: any, ephemeralExpiration: any) => Promise<void>;
119
+ groupSettingUpdate: (jid: any, setting: any) => Promise<void>;
120
+ groupMemberAddMode: (jid: any, mode: any) => Promise<void>;
121
+ groupJoinApprovalMode: (jid: any, mode: any) => Promise<void>;
122
+ groupFetchAllParticipating: () => Promise<{}>;
123
+ findUserId: (pnLid: any) => Promise<{
124
+ lid: undefined;
125
+ phoneNumber: undefined;
126
+ }>;
127
+ serverProps: {
128
+ privacyTokenOn1to1: boolean;
129
+ profilePicPrivacyToken: boolean;
130
+ lidTrustedTokenIssueToLid: boolean;
131
+ };
132
+ createCallLink: (type: any, event: any, timeoutMs: any) => Promise<any>;
133
+ getBotListV2: () => Promise<{
134
+ jid: any;
135
+ personaId: any;
136
+ }[]>;
137
+ messageMutex: {
138
+ mutex(code: any): any;
139
+ };
140
+ receiptMutex: {
141
+ mutex(code: any): any;
142
+ };
143
+ appStatePatchMutex: {
144
+ mutex(code: any): any;
145
+ };
146
+ notificationMutex: {
147
+ mutex(code: any): any;
148
+ };
149
+ fetchPrivacySettings: (force?: boolean) => Promise<any>;
150
+ upsertMessage: (...args: any[]) => Promise<any>;
151
+ appPatch: (patchCreate: any) => Promise<void>;
152
+ sendPresenceUpdate: (type: any, toJid: any) => Promise<void>;
153
+ presenceSubscribe: (toJid: any) => Promise<void>;
154
+ profilePictureUrl: (jid: any, type?: string, timeoutMs?: number, shouldIncludeTcToken?: boolean) => Promise<any>;
155
+ fetchBlocklist: () => Promise<any>;
156
+ fetchStatus: (...jids: any[]) => Promise<any>;
157
+ fetchDisappearingDuration: (...jids: any[]) => Promise<any>;
158
+ updateProfilePicture: (jid: any, content: any, dimensions: any) => Promise<void>;
159
+ removeProfilePicture: (jid: any) => Promise<void>;
160
+ updateProfileStatus: (status: any) => Promise<void>;
161
+ updateProfileName: (name: any) => Promise<void>;
162
+ updateBlockStatus: (jid: any, action: any) => Promise<void>;
163
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: any) => Promise<void>;
164
+ updateCallPrivacy: (value: any) => Promise<void>;
165
+ updateMessagesPrivacy: (value: any) => Promise<void>;
166
+ updateLastSeenPrivacy: (value: any) => Promise<void>;
167
+ updateOnlinePrivacy: (value: any) => Promise<void>;
168
+ updateProfilePicturePrivacy: (value: any) => Promise<void>;
169
+ updateStatusPrivacy: (value: any) => Promise<void>;
170
+ updateReadReceiptsPrivacy: (value: any) => Promise<void>;
171
+ updateGroupsAddPrivacy: (value: any) => Promise<void>;
172
+ updateDefaultDisappearingMode: (duration: any) => Promise<void>;
173
+ getBusinessProfile: (jid: any) => Promise<{
174
+ wid: any;
175
+ address: any;
176
+ description: any;
177
+ website: any[];
178
+ email: any;
179
+ category: any;
180
+ business_hours: {
181
+ timezone: any;
182
+ business_config: any;
183
+ };
184
+ } | undefined>;
185
+ resyncAppState: (...args: any[]) => Promise<any>;
186
+ chatModify: (mod: any, jid: any) => Promise<void>;
187
+ cleanDirtyBits: (type: any, fromTimestamp: any) => Promise<void>;
188
+ addOrEditContact: (jid: any, contact: any) => Promise<void>;
189
+ removeContact: (jid: any) => Promise<void>;
190
+ placeholderResendCache: any;
191
+ addLabel: (jid: any, labels: any) => Promise<void>;
192
+ addChatLabel: (jid: any, labelId: any) => Promise<void>;
193
+ removeChatLabel: (jid: any, labelId: any) => Promise<void>;
194
+ addMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
195
+ removeMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
196
+ star: (jid: any, messages: any, star: any) => Promise<void>;
197
+ addOrEditQuickReply: (quickReply: any) => Promise<void>;
198
+ removeQuickReply: (timestamp: any) => Promise<void>;
199
+ type: string;
200
+ ws: import("./Client/websocket.js").WebSocketClient;
201
+ ev: {
202
+ process(handler: any): () => void;
203
+ emit(event: any, evData: any): any;
204
+ isBuffering(): boolean;
205
+ buffer: () => void;
206
+ flush: () => boolean;
207
+ createBufferedFunction(work: any): (...args: any[]) => Promise<any>;
208
+ on: (...args: any[]) => any;
209
+ off: (...args: any[]) => any;
210
+ removeAllListeners: (...args: any[]) => any;
211
+ destroy(): void;
212
+ };
213
+ authState: {
214
+ creds: any;
215
+ keys: {
216
+ get: (type: any, ids: any) => Promise<any>;
217
+ set: (data: any) => Promise<void>;
218
+ isInTransaction: () => boolean;
219
+ transaction: (work: any, key: any) => Promise<any>;
220
+ };
221
+ };
222
+ signalRepository: any;
223
+ user: any;
224
+ generateMessageTag: () => string;
225
+ query: (node: any, timeoutMs: any) => Promise<any>;
226
+ waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
227
+ waitForSocketOpen: () => Promise<void>;
228
+ sendRawMessage: (data: any) => Promise<void>;
229
+ sendNode: (frame: any) => Promise<void>;
230
+ logout: (msg: any) => Promise<void>;
231
+ end: (error: any) => Promise<void>;
232
+ registerSocketEndHandler: (handler: any) => void;
233
+ onUnexpectedError: (err: any, msg: any) => void;
234
+ uploadPreKeys: (count?: number) => Promise<void>;
235
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
236
+ digestKeyBundle: () => Promise<void>;
237
+ rotateSignedPreKey: () => Promise<void>;
238
+ requestPairingCode: (phoneNumber: any, customPairingCode: any) => Promise<any>;
239
+ updateServerTimeOffset: ({ attrs }: {
240
+ attrs: any;
241
+ }) => void;
242
+ sendUnifiedSession: () => Promise<void>;
243
+ wamBuffer: import("../index.js").BinaryInfo;
244
+ waitForConnectionUpdate: (check: any, timeoutMs: any) => Promise<void>;
245
+ sendWAMBuffer: (wamBuffer: any) => Promise<any>;
246
+ executeUSyncQuery: (usyncQuery: any) => Promise<any>;
247
+ onWhatsApp: (...phoneNumber: any[]) => Promise<any>;
248
+ fetchAccountReachoutTimelock: () => Promise<{
249
+ isActive: boolean;
250
+ timeEnforcementEnds: Date | undefined;
251
+ enforcementType: any;
252
+ }>;
253
+ fetchNewChatMessageCap: () => Promise<any>;
254
+ };
255
+ export function extractGroupMetadata(result: any): {
256
+ id: any;
257
+ notify: any;
258
+ addressingMode: any;
259
+ subject: any;
260
+ subjectOwner: any;
261
+ subjectOwnerPn: any;
262
+ subjectOwnerUsername: any;
263
+ subjectTime: number;
264
+ size: any;
265
+ creation: number;
266
+ owner: string | undefined;
267
+ ownerPn: string | undefined;
268
+ ownerUsername: any;
269
+ owner_country_code: any;
270
+ desc: any;
271
+ descId: any;
272
+ descOwner: string | undefined;
273
+ descOwnerPn: string | undefined;
274
+ descOwnerUsername: any;
275
+ descTime: number | undefined;
276
+ linkedParent: any;
277
+ restrict: boolean;
278
+ announce: boolean;
279
+ isCommunity: boolean;
280
+ isCommunityAnnounce: boolean;
281
+ joinApprovalMode: boolean;
282
+ memberAddMode: boolean;
283
+ participants: any;
284
+ ephemeralDuration: number | undefined;
285
+ };