@fer2809fl/baileys 7.0.1 → 7.0.2

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 (273) hide show
  1. package/README.md +259 -595
  2. package/WAProto/WAProto.proto +916 -360
  3. package/WAProto/fix-imports.js +18 -22
  4. package/WAProto/index.d.ts +15471 -8638
  5. package/WAProto/index.js +80576 -45941
  6. package/lib/Defaults/index.d.ts +14 -18
  7. package/lib/Defaults/index.d.ts.map +1 -1
  8. package/lib/Defaults/index.js +110 -115
  9. package/lib/Defaults/index.js.map +1 -1
  10. package/lib/Signal/Group/group_cipher.js.map +1 -1
  11. package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
  12. package/lib/Signal/Group/keyhelper.js.map +1 -1
  13. package/lib/Signal/Group/sender-chain-key.js.map +1 -1
  14. package/lib/Signal/Group/sender-key-message.js.map +1 -1
  15. package/lib/Signal/Group/sender-message-key.js.map +1 -1
  16. package/lib/Signal/libsignal.d.ts.map +1 -1
  17. package/lib/Signal/libsignal.js +17 -45
  18. package/lib/Signal/libsignal.js.map +1 -1
  19. package/lib/Signal/lid-mapping.d.ts +0 -4
  20. package/lib/Signal/lid-mapping.d.ts.map +1 -1
  21. package/lib/Signal/lid-mapping.js +0 -6
  22. package/lib/Signal/lid-mapping.js.map +1 -1
  23. package/lib/Socket/business.d.ts +532 -280
  24. package/lib/Socket/business.d.ts.map +1 -1
  25. package/lib/Socket/business.js +401 -358
  26. package/lib/Socket/chats.d.ts +2 -22
  27. package/lib/Socket/chats.d.ts.map +1 -1
  28. package/lib/Socket/chats.js +43 -314
  29. package/lib/Socket/chats.js.map +1 -1
  30. package/lib/Socket/communities.d.ts +641 -336
  31. package/lib/Socket/communities.d.ts.map +1 -1
  32. package/lib/Socket/communities.js +3 -6
  33. package/lib/Socket/communities.js.map +1 -1
  34. package/lib/Socket/dugong.d.ts +130 -0
  35. package/lib/Socket/dugong.d.ts.map +1 -0
  36. package/lib/Socket/dugong.js +772 -0
  37. package/lib/Socket/dugong.js.map +1 -0
  38. package/lib/Socket/groups.d.ts +2 -23
  39. package/lib/Socket/groups.d.ts.map +1 -1
  40. package/lib/Socket/groups.js +8 -171
  41. package/lib/Socket/groups.js.map +1 -1
  42. package/lib/Socket/index.d.ts +631 -322
  43. package/lib/Socket/index.d.ts.map +1 -1
  44. package/lib/Socket/index.js +12 -9
  45. package/lib/Socket/index.js.map +1 -1
  46. package/lib/Socket/messages-recv.d.ts +52 -84
  47. package/lib/Socket/messages-recv.d.ts.map +1 -1
  48. package/lib/Socket/messages-recv.js +185 -686
  49. package/lib/Socket/messages-recv.js.map +1 -1
  50. package/lib/Socket/messages-send.d.ts +643 -262
  51. package/lib/Socket/messages-send.d.ts.map +1 -1
  52. package/lib/Socket/messages-send.js +1559 -1359
  53. package/lib/Socket/messages-send.js.map +1 -1
  54. package/lib/Socket/mex.d.ts +0 -1
  55. package/lib/Socket/mex.d.ts.map +1 -1
  56. package/lib/Socket/mex.js +8 -22
  57. package/lib/Socket/mex.js.map +1 -1
  58. package/lib/Socket/native-buttons.js +231 -0
  59. package/lib/Socket/newsletter.d.ts +27 -42
  60. package/lib/Socket/newsletter.d.ts.map +1 -1
  61. package/lib/Socket/newsletter.js +439 -402
  62. package/lib/Socket/newsletter.js.map +1 -1
  63. package/lib/Socket/socket.d.ts +2 -6
  64. package/lib/Socket/socket.d.ts.map +1 -1
  65. package/lib/Socket/socket.js +26 -62
  66. package/lib/Socket/socket.js.map +1 -1
  67. package/lib/Types/Auth.d.ts +0 -1
  68. package/lib/Types/Auth.d.ts.map +1 -1
  69. package/lib/Types/Bussines.d.ts +34 -22
  70. package/lib/Types/Call.d.ts +1 -1
  71. package/lib/Types/Call.d.ts.map +1 -1
  72. package/lib/Types/Chat.d.ts +0 -1
  73. package/lib/Types/Chat.d.ts.map +1 -1
  74. package/lib/Types/Contact.d.ts +0 -2
  75. package/lib/Types/Contact.d.ts.map +1 -1
  76. package/lib/Types/Events.d.ts +1 -20
  77. package/lib/Types/Events.d.ts.map +1 -1
  78. package/lib/Types/GroupMetadata.d.ts +1 -4
  79. package/lib/Types/GroupMetadata.d.ts.map +1 -1
  80. package/lib/Types/Message.d.ts +348 -354
  81. package/lib/Types/Message.d.ts.map +1 -1
  82. package/lib/Types/Message.js +0 -4
  83. package/lib/Types/Message.js.map +1 -1
  84. package/lib/Types/{Mex.d.ts → Newsletter.d.ts} +7 -26
  85. package/lib/Types/Newsletter.d.ts.map +1 -0
  86. package/lib/Types/{Mex.js → Newsletter.js} +3 -11
  87. package/lib/Types/Newsletter.js.map +1 -0
  88. package/lib/Types/Signal.d.ts +1 -12
  89. package/lib/Types/Signal.d.ts.map +1 -1
  90. package/lib/Types/Socket.d.ts +148 -135
  91. package/lib/Types/Socket.d.ts.map +1 -1
  92. package/lib/Types/Socket.js.map +1 -1
  93. package/lib/Types/State.d.ts +0 -65
  94. package/lib/Types/State.d.ts.map +1 -1
  95. package/lib/Types/State.js +0 -43
  96. package/lib/Types/State.js.map +1 -1
  97. package/lib/Types/index.d.ts +52 -52
  98. package/lib/Types/index.d.ts.map +1 -1
  99. package/lib/Types/index.js +30 -23
  100. package/lib/Types/index.js.map +1 -1
  101. package/lib/Utils/auth-utils.d.ts +0 -5
  102. package/lib/Utils/auth-utils.d.ts.map +1 -1
  103. package/lib/Utils/auth-utils.js +0 -12
  104. package/lib/Utils/auth-utils.js.map +1 -1
  105. package/lib/Utils/browser-utils.d.ts.map +1 -1
  106. package/lib/Utils/browser-utils.js +0 -1
  107. package/lib/Utils/browser-utils.js.map +1 -1
  108. package/lib/Utils/chat-utils.d.ts +4 -34
  109. package/lib/Utils/chat-utils.d.ts.map +1 -1
  110. package/lib/Utils/chat-utils.js +20 -80
  111. package/lib/Utils/chat-utils.js.map +1 -1
  112. package/lib/Utils/crypto.d.ts +12 -12
  113. package/lib/Utils/crypto.d.ts.map +1 -1
  114. package/lib/Utils/crypto.js.map +1 -1
  115. package/lib/Utils/decode-wa-message.d.ts +0 -18
  116. package/lib/Utils/decode-wa-message.d.ts.map +1 -1
  117. package/lib/Utils/decode-wa-message.js +0 -34
  118. package/lib/Utils/decode-wa-message.js.map +1 -1
  119. package/lib/Utils/event-buffer.d.ts +0 -2
  120. package/lib/Utils/event-buffer.d.ts.map +1 -1
  121. package/lib/Utils/event-buffer.js +1 -49
  122. package/lib/Utils/event-buffer.js.map +1 -1
  123. package/lib/Utils/generics.d.ts +2 -3
  124. package/lib/Utils/generics.d.ts.map +1 -1
  125. package/lib/Utils/generics.js +1 -10
  126. package/lib/Utils/generics.js.map +1 -1
  127. package/lib/Utils/history.d.ts +0 -2
  128. package/lib/Utils/history.d.ts.map +1 -1
  129. package/lib/Utils/history.js +9 -12
  130. package/lib/Utils/history.js.map +1 -1
  131. package/lib/Utils/identity-change-handler.d.ts +0 -7
  132. package/lib/Utils/identity-change-handler.d.ts.map +1 -1
  133. package/lib/Utils/identity-change-handler.js +0 -1
  134. package/lib/Utils/identity-change-handler.js.map +1 -1
  135. package/lib/Utils/index.d.ts +23 -30
  136. package/lib/Utils/index.d.ts.map +1 -1
  137. package/lib/Utils/index.js +2 -9
  138. package/lib/Utils/index.js.map +1 -1
  139. package/lib/Utils/link-preview.js +2 -2
  140. package/lib/Utils/link-preview.js.map +1 -1
  141. package/lib/Utils/message-retry-manager.d.ts +0 -5
  142. package/lib/Utils/message-retry-manager.d.ts.map +1 -1
  143. package/lib/Utils/message-retry-manager.js +0 -40
  144. package/lib/Utils/message-retry-manager.js.map +1 -1
  145. package/lib/Utils/messages-media.d.ts +13 -45
  146. package/lib/Utils/messages-media.d.ts.map +1 -1
  147. package/lib/Utils/messages-media.js +98 -293
  148. package/lib/Utils/messages-media.js.map +1 -1
  149. package/lib/Utils/messages.d.ts +3 -16
  150. package/lib/Utils/messages.d.ts.map +1 -1
  151. package/lib/Utils/messages.js +1123 -1219
  152. package/lib/Utils/messages.js.map +1 -1
  153. package/lib/Utils/noise-handler.d.ts +1 -1
  154. package/lib/Utils/process-message.d.ts.map +1 -1
  155. package/lib/Utils/process-message.js +1 -103
  156. package/lib/Utils/process-message.js.map +1 -1
  157. package/lib/Utils/rich-messages.d.ts +277 -0
  158. package/lib/Utils/rich-messages.d.ts.map +1 -0
  159. package/lib/Utils/rich-messages.js +1144 -0
  160. package/lib/Utils/rich-messages.js.map +1 -0
  161. package/lib/Utils/signal.d.ts +0 -13
  162. package/lib/Utils/signal.d.ts.map +1 -1
  163. package/lib/Utils/signal.js +0 -42
  164. package/lib/Utils/signal.js.map +1 -1
  165. package/lib/Utils/sticker-pack.d.ts +10 -0
  166. package/lib/Utils/sticker-pack.js +111 -0
  167. package/lib/Utils/sync-action-utils.d.ts.map +1 -1
  168. package/lib/Utils/sync-action-utils.js +0 -1
  169. package/lib/Utils/sync-action-utils.js.map +1 -1
  170. package/lib/Utils/tc-token-utils.d.ts +1 -26
  171. package/lib/Utils/tc-token-utils.d.ts.map +1 -1
  172. package/lib/Utils/tc-token-utils.js +5 -151
  173. package/lib/Utils/tc-token-utils.js.map +1 -1
  174. package/lib/Utils/validate-connection.d.ts +0 -1
  175. package/lib/Utils/validate-connection.d.ts.map +1 -1
  176. package/lib/Utils/validate-connection.js +3 -13
  177. package/lib/Utils/validate-connection.js.map +1 -1
  178. package/lib/WABinary/decode.d.ts +1 -1
  179. package/lib/WABinary/decode.d.ts.map +1 -1
  180. package/lib/WABinary/generic-utils.d.ts +3 -1
  181. package/lib/WABinary/generic-utils.d.ts.map +1 -1
  182. package/lib/WABinary/generic-utils.js +78 -0
  183. package/lib/WABinary/generic-utils.js.map +1 -1
  184. package/lib/WABinary/jid-utils.d.ts +0 -11
  185. package/lib/WABinary/jid-utils.d.ts.map +1 -1
  186. package/lib/WABinary/jid-utils.js +0 -33
  187. package/lib/WABinary/jid-utils.js.map +1 -1
  188. package/lib/WAM/encode.d.ts +1 -1
  189. package/lib/WAM/encode.d.ts.map +1 -1
  190. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
  191. package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -26
  192. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
  193. package/lib/WAUSync/Protocols/index.d.ts +0 -1
  194. package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
  195. package/lib/WAUSync/Protocols/index.js +0 -1
  196. package/lib/WAUSync/Protocols/index.js.map +1 -1
  197. package/lib/WAUSync/USyncQuery.d.ts +0 -1
  198. package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
  199. package/lib/WAUSync/USyncQuery.js +2 -6
  200. package/lib/WAUSync/USyncQuery.js.map +1 -1
  201. package/lib/WAUSync/USyncUser.d.ts +0 -4
  202. package/lib/WAUSync/USyncUser.d.ts.map +1 -1
  203. package/lib/WAUSync/USyncUser.js +0 -8
  204. package/lib/WAUSync/USyncUser.js.map +1 -1
  205. package/lib/index.d.ts +1 -1
  206. package/lib/index.d.ts.map +1 -1
  207. package/lib/index.js +1 -4
  208. package/lib/index.js.map +1 -1
  209. package/package.json +30 -34
  210. package/LICENSE +0 -21
  211. package/engine-requirements.js +0 -10
  212. package/lib/Socket/smgss.d.ts +0 -119
  213. package/lib/Socket/smgss.d.ts.map +0 -1
  214. package/lib/Socket/smgss.js +0 -453
  215. package/lib/Socket/smgss.js.map +0 -1
  216. package/lib/Store/index.d.ts +0 -4
  217. package/lib/Store/index.d.ts.map +0 -1
  218. package/lib/Store/index.js +0 -4
  219. package/lib/Store/index.js.map +0 -1
  220. package/lib/Store/make-in-memory-store.d.ts +0 -132
  221. package/lib/Store/make-in-memory-store.d.ts.map +0 -1
  222. package/lib/Store/make-in-memory-store.js +0 -450
  223. package/lib/Store/make-in-memory-store.js.map +0 -1
  224. package/lib/Store/make-ordered-dictionary.d.ts +0 -14
  225. package/lib/Store/make-ordered-dictionary.d.ts.map +0 -1
  226. package/lib/Store/make-ordered-dictionary.js +0 -80
  227. package/lib/Store/make-ordered-dictionary.js.map +0 -1
  228. package/lib/Store/object-repository.d.ts +0 -13
  229. package/lib/Store/object-repository.d.ts.map +0 -1
  230. package/lib/Store/object-repository.js +0 -24
  231. package/lib/Store/object-repository.js.map +0 -1
  232. package/lib/Types/Mex.d.ts.map +0 -1
  233. package/lib/Types/Mex.js.map +0 -1
  234. package/lib/Utils/button-handler.d.ts +0 -28
  235. package/lib/Utils/button-handler.d.ts.map +0 -1
  236. package/lib/Utils/button-handler.js +0 -140
  237. package/lib/Utils/button-handler.js.map +0 -1
  238. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  239. package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
  240. package/lib/Utils/companion-reg-client-utils.js +0 -35
  241. package/lib/Utils/companion-reg-client-utils.js.map +0 -1
  242. package/lib/Utils/interactive.d.ts +0 -60
  243. package/lib/Utils/interactive.d.ts.map +0 -1
  244. package/lib/Utils/interactive.js +0 -224
  245. package/lib/Utils/interactive.js.map +0 -1
  246. package/lib/Utils/message-composer.d.ts +0 -93
  247. package/lib/Utils/message-composer.d.ts.map +0 -1
  248. package/lib/Utils/message-composer.js +0 -311
  249. package/lib/Utils/message-composer.js.map +0 -1
  250. package/lib/Utils/messages-newsletter.d.ts +0 -74
  251. package/lib/Utils/messages-newsletter.d.ts.map +0 -1
  252. package/lib/Utils/messages-newsletter.js +0 -128
  253. package/lib/Utils/messages-newsletter.js.map +0 -1
  254. package/lib/Utils/shortcake-crypto.d.ts +0 -36
  255. package/lib/Utils/shortcake-crypto.d.ts.map +0 -1
  256. package/lib/Utils/shortcake-crypto.js +0 -71
  257. package/lib/Utils/shortcake-crypto.js.map +0 -1
  258. package/lib/Utils/shortcake.d.ts +0 -36
  259. package/lib/Utils/shortcake.d.ts.map +0 -1
  260. package/lib/Utils/shortcake.js +0 -162
  261. package/lib/Utils/shortcake.js.map +0 -1
  262. package/lib/Utils/use-single-file-auth-state.d.ts +0 -6
  263. package/lib/Utils/use-single-file-auth-state.d.ts.map +0 -1
  264. package/lib/Utils/use-single-file-auth-state.js +0 -111
  265. package/lib/Utils/use-single-file-auth-state.js.map +0 -1
  266. package/lib/Utils/use-sqlite-auth-state.d.ts +0 -14
  267. package/lib/Utils/use-sqlite-auth-state.d.ts.map +0 -1
  268. package/lib/Utils/use-sqlite-auth-state.js +0 -107
  269. package/lib/Utils/use-sqlite-auth-state.js.map +0 -1
  270. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  271. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
  272. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
  273. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
@@ -1,428 +1,422 @@
1
- import type { Readable } from 'stream';
2
- import type { URL } from 'url';
3
- import { proto } from '../../WAProto/index.js';
4
- import type { MediaType } from '../Defaults/index.js';
5
- import type { BinaryNode } from '../WABinary/index.js';
6
- import type { GroupMetadata } from './GroupMetadata.js';
7
- import type { CacheStore } from './Socket.js';
1
+ import type { Readable } from "stream";
2
+ import type { URL } from "url";
3
+ import { proto } from "../../WAProto/index.js";
4
+ import type { MediaType } from "../Defaults/index.js";
5
+ import type { BinaryNode } from "../WABinary/index.js";
6
+ import type { GroupMetadata } from "./GroupMetadata.js";
7
+ import type { CacheStore } from "./Socket.js";
8
8
  export { proto as WAProto };
9
- export declare const ButtonHeaderType: typeof proto.Message.ButtonsMessage.HeaderType;
10
- export declare const ButtonType: typeof proto.Message.ButtonsMessage.Button.Type;
11
- export declare const CarouselCardType: typeof proto.Message.InteractiveMessage.CarouselMessage.CarouselCardType;
12
- export declare const ListType: typeof proto.Message.ListMessage.ListType;
13
9
  export type WAMessage = proto.IWebMessageInfo & {
14
- key: WAMessageKey;
15
- messageStubParameters?: any;
16
- category?: string;
17
- retryCount?: number;
18
- isSystemNotification?: boolean;
10
+ key: WAMessageKey;
11
+ messageStubParameters?: any;
12
+ category?: string;
13
+ retryCount?: number;
19
14
  };
20
15
  export type WAMessageContent = proto.IMessage;
21
16
  export type WAContactMessage = proto.Message.IContactMessage;
22
17
  export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
23
18
  export type WAMessageKey = proto.IMessageKey & {
24
- remoteJidAlt?: string;
25
- remoteJidUsername?: string;
26
- participantAlt?: string;
27
- participantUsername?: string;
28
- server_id?: string;
29
- addressingMode?: string;
30
- isViewOnce?: boolean;
19
+ remoteJidAlt?: string;
20
+ participantAlt?: string;
21
+ server_id?: string;
22
+ addressingMode?: string;
23
+ isViewOnce?: boolean;
31
24
  };
32
25
  export type WATextMessage = proto.Message.IExtendedTextMessage;
33
26
  export type WAContextInfo = proto.IContextInfo;
34
27
  export type WALocationMessage = proto.Message.ILocationMessage;
35
- export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
28
+ export type WAGenericMediaMessage =
29
+ | proto.Message.IVideoMessage
30
+ | proto.Message.IImageMessage
31
+ | proto.Message.IAudioMessage
32
+ | proto.Message.IDocumentMessage
33
+ | proto.Message.IStickerMessage;
36
34
  export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
37
35
  export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
38
- import type { ILogger } from '../Utils/logger.js';
36
+ import type { ILogger } from "../Utils/logger.js";
39
37
  export type WAMediaPayloadURL = {
40
- url: URL | string;
38
+ url: URL | string;
41
39
  };
42
40
  export type WAMediaPayloadStream = {
43
- stream: Readable;
41
+ stream: Readable;
44
42
  };
45
43
  export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
46
44
  /** Set of message types that are supported by the library */
47
45
  export type MessageType = keyof proto.Message;
48
46
  export declare enum WAMessageAddressingMode {
49
- PN = "pn",
50
- LID = "lid"
47
+ PN = "pn",
48
+ LID = "lid",
51
49
  }
52
- export type MessageWithContextInfo = 'imageMessage' | 'contactMessage' | 'locationMessage' | 'extendedTextMessage' | 'documentMessage' | 'audioMessage' | 'videoMessage' | 'call' | 'contactsArrayMessage' | 'liveLocationMessage' | 'templateMessage' | 'stickerMessage' | 'groupInviteMessage' | 'templateButtonReplyMessage' | 'productMessage' | 'listMessage' | 'orderMessage' | 'listResponseMessage' | 'buttonsMessage' | 'buttonsResponseMessage' | 'interactiveMessage' | 'interactiveResponseMessage' | 'pollCreationMessage' | 'requestPhoneNumberMessage' | 'messageHistoryBundle' | 'eventMessage' | 'newsletterAdminInviteMessage' | 'albumMessage' | 'stickerPackMessage' | 'pollResultSnapshotMessage' | 'messageHistoryNotice';
50
+ export type MessageWithContextInfo =
51
+ | "imageMessage"
52
+ | "contactMessage"
53
+ | "locationMessage"
54
+ | "extendedTextMessage"
55
+ | "documentMessage"
56
+ | "audioMessage"
57
+ | "videoMessage"
58
+ | "call"
59
+ | "contactsArrayMessage"
60
+ | "liveLocationMessage"
61
+ | "templateMessage"
62
+ | "stickerMessage"
63
+ | "groupInviteMessage"
64
+ | "templateButtonReplyMessage"
65
+ | "productMessage"
66
+ | "listMessage"
67
+ | "orderMessage"
68
+ | "listResponseMessage"
69
+ | "buttonsMessage"
70
+ | "buttonsResponseMessage"
71
+ | "interactiveMessage"
72
+ | "interactiveResponseMessage"
73
+ | "pollCreationMessage"
74
+ | "requestPhoneNumberMessage"
75
+ | "messageHistoryBundle"
76
+ | "eventMessage"
77
+ | "newsletterAdminInviteMessage"
78
+ | "albumMessage"
79
+ | "stickerPackMessage"
80
+ | "pollResultSnapshotMessage"
81
+ | "messageHistoryNotice";
53
82
  export type DownloadableMessage = {
54
- mediaKey?: Uint8Array | null;
55
- directPath?: string | null;
56
- url?: string | null;
57
- };
58
- export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
83
+ mediaKey?: Uint8Array | null;
84
+ directPath?: string | null;
85
+ url?: string | null;
86
+ };
87
+ export type MessageReceiptType =
88
+ | "read"
89
+ | "read-self"
90
+ | "hist_sync"
91
+ | "peer_msg"
92
+ | "sender"
93
+ | "inactive"
94
+ | "played"
95
+ | undefined;
59
96
  export type MediaConnInfo = {
60
- auth: string;
61
- ttl: number;
62
- hosts: {
63
- hostname: string;
64
- maxContentLengthBytes: number;
65
- }[];
66
- fetchDate: Date;
97
+ auth: string;
98
+ ttl: number;
99
+ hosts: {
100
+ hostname: string;
101
+ maxContentLengthBytes: number;
102
+ }[];
103
+ fetchDate: Date;
67
104
  };
68
105
  export interface WAUrlInfo {
69
- 'canonical-url': string;
70
- 'matched-text': string;
71
- title: string;
72
- description?: string;
73
- jpegThumbnail?: Buffer;
74
- highQualityThumbnail?: proto.Message.IImageMessage;
75
- originalThumbnailUrl?: string;
106
+ "canonical-url": string;
107
+ "matched-text": string;
108
+ title: string;
109
+ description?: string;
110
+ jpegThumbnail?: Buffer;
111
+ highQualityThumbnail?: proto.Message.IImageMessage;
112
+ originalThumbnailUrl?: string;
76
113
  }
77
114
  type Mentionable = {
78
- /** list of jids that are mentioned in the accompanying text */
79
- mentions?: string[];
80
- /** mention all */
81
- mentionAll?: boolean;
115
+ /** list of jids that are mentioned in the accompanying text */
116
+ mentions?: string[];
117
+ /** mention all */
118
+ mentionAll?: boolean;
82
119
  };
83
120
  type Contextable = {
84
- /** add contextInfo to the message */
85
- contextInfo?: proto.IContextInfo;
121
+ /** add contextInfo to the message */
122
+ contextInfo?: proto.IContextInfo;
86
123
  };
87
124
  type ViewOnce = {
88
- viewOnce?: boolean;
89
- viewOnceV2?: boolean;
90
- viewOnceV2Extension?: boolean;
91
- };
92
- type AiLabelable = {
93
- ai?: boolean;
125
+ viewOnce?: boolean;
94
126
  };
95
127
  type Editable = {
96
- edit?: WAMessageKey;
128
+ edit?: WAMessageKey;
97
129
  };
98
130
  type WithDimensions = {
99
- width?: number;
100
- height?: number;
131
+ width?: number;
132
+ height?: number;
101
133
  };
102
134
  export type PollMessageOptions = {
103
- name: string;
104
- selectableCount?: number;
105
- values: string[];
106
- /** 32 byte message secret to encrypt poll selections */
107
- messageSecret?: Uint8Array;
108
- toAnnouncementGroup?: boolean;
135
+ name: string;
136
+ selectableCount?: number;
137
+ values: string[];
138
+ /** 32 byte message secret to encrypt poll selections */
139
+ messageSecret?: Uint8Array;
140
+ toAnnouncementGroup?: boolean;
109
141
  };
110
142
  export type EventMessageOptions = {
111
- name: string;
112
- description?: string;
113
- startDate: Date;
114
- endDate?: Date;
115
- location?: WALocationMessage;
116
- call?: 'audio' | 'video';
117
- isCancelled?: boolean;
118
- isScheduleCall?: boolean;
119
- extraGuestsAllowed?: boolean;
120
- messageSecret?: Uint8Array<ArrayBufferLike>;
121
- };
122
- export type AlbumMessageOptions = {
123
- /** Number of images expected in the album */
124
- expectedImageCount?: number;
125
- /** Number of videos expected in the album */
126
- expectedVideoCount?: number;
143
+ name: string;
144
+ description?: string;
145
+ startDate: Date;
146
+ endDate?: Date;
147
+ location?: WALocationMessage;
148
+ call?: "audio" | "video";
149
+ isCancelled?: boolean;
150
+ isScheduleCall?: boolean;
151
+ extraGuestsAllowed?: boolean;
152
+ messageSecret?: Uint8Array<ArrayBufferLike>;
127
153
  };
128
154
  type SharePhoneNumber = {
129
- sharePhoneNumber: boolean;
155
+ sharePhoneNumber: boolean;
130
156
  };
131
157
  type RequestPhoneNumber = {
132
- requestPhoneNumber: boolean;
133
- };
134
- export type AnyMediaMessageContent = (({
135
- image: WAMediaUpload;
136
- caption?: string;
137
- jpegThumbnail?: string;
138
- } & Mentionable & Contextable & WithDimensions) | ({
139
- video: WAMediaUpload;
140
- caption?: string;
141
- gifPlayback?: boolean;
142
- jpegThumbnail?: string;
143
- /** if set to true, will send as a `video note` */
144
- ptv?: boolean;
145
- } & Mentionable & Contextable & WithDimensions) | {
146
- audio: WAMediaUpload;
147
- /** if set to true, will send as a `voice note` */
148
- ptt?: boolean;
149
- /** optionally tell the duration of the audio */
150
- seconds?: number;
151
- } | ({
152
- sticker: WAMediaUpload;
153
- isAnimated?: boolean;
154
- isLottie?: boolean;
155
- } & WithDimensions) | ({
156
- document: WAMediaUpload;
157
- mimetype: string;
158
- fileName?: string;
159
- caption?: string;
160
- } & Contextable)) & {
161
- mimetype?: string;
162
- } & Editable & {
163
- /** key of the parent albumMessage to associate this media with */
164
- albumParentKey?: WAMessageKey;
165
- };
158
+ requestPhoneNumber: boolean;
159
+ };
160
+ export type AnyMediaMessageContent = (
161
+ | ({
162
+ image: WAMediaUpload;
163
+ caption?: string;
164
+ jpegThumbnail?: string;
165
+ } & Mentionable &
166
+ Contextable &
167
+ WithDimensions)
168
+ | ({
169
+ video: WAMediaUpload;
170
+ caption?: string;
171
+ gifPlayback?: boolean;
172
+ jpegThumbnail?: string;
173
+ /** if set to true, will send as a `video note` */
174
+ ptv?: boolean;
175
+ } & Mentionable &
176
+ Contextable &
177
+ WithDimensions)
178
+ | {
179
+ audio: WAMediaUpload;
180
+ /** if set to true, will send as a `voice note` */
181
+ ptt?: boolean;
182
+ /** optionally tell the duration of the audio */
183
+ seconds?: number;
184
+ }
185
+ | ({
186
+ sticker: WAMediaUpload;
187
+ isAnimated?: boolean;
188
+ } & WithDimensions)
189
+ | ({
190
+ document: WAMediaUpload;
191
+ mimetype: string;
192
+ fileName?: string;
193
+ caption?: string;
194
+ } & Contextable)
195
+ ) & {
196
+ mimetype?: string;
197
+ } & Editable;
166
198
  export type ButtonReplyInfo = {
167
- displayText: string;
168
- id: string;
169
- index: number;
199
+ displayText: string;
200
+ id: string;
201
+ index: number;
170
202
  };
171
203
  export type GroupInviteInfo = {
172
- inviteCode: string;
173
- inviteExpiration: number;
174
- text: string;
175
- jid: string;
176
- subject: string;
177
- };
178
- export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
179
- productImage: WAMediaUpload;
180
- };
181
- export type AnyRegularMessageContent = (({
182
- text: string;
183
- linkPreview?: WAUrlInfo | null;
184
- } & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
185
- event: EventMessageOptions;
186
- } | ({
187
- poll: PollMessageOptions;
188
- } & Mentionable & Contextable & Editable) | ({
189
- album: AlbumMessageOptions;
190
- } & Contextable & Mentionable) | {
191
- contacts: {
204
+ inviteCode: string;
205
+ inviteExpiration: number;
206
+ text: string;
207
+ jid: string;
208
+ subject: string;
209
+ };
210
+ export type WASendableProduct = Omit<
211
+ proto.Message.ProductMessage.IProductSnapshot,
212
+ "productImage"
213
+ > & {
214
+ productImage: WAMediaUpload;
215
+ };
216
+ export type StickerPackItem =
217
+ | WAMediaUpload
218
+ | {
219
+ sticker: WAMediaUpload;
220
+ emojis?: string[];
221
+ accessibilityLabel?: string;
222
+ };
223
+ export type StickerPackContent = {
224
+ name: string;
225
+ publisher?: string;
226
+ description?: string;
227
+ packId?: string;
228
+ stickers: StickerPackItem[];
229
+ cover?: WAMediaUpload;
230
+ };
231
+ export type AnyRegularMessageContent = (
232
+ | ({
233
+ text: string;
234
+ linkPreview?: WAUrlInfo | null;
235
+ } & Mentionable &
236
+ Contextable &
237
+ Editable)
238
+ | AnyMediaMessageContent
239
+ | {
240
+ event: EventMessageOptions;
241
+ }
242
+ | ({
243
+ poll: PollMessageOptions;
244
+ } & Mentionable &
245
+ Contextable &
246
+ Editable)
247
+ | {
248
+ contacts: {
192
249
  displayName?: string;
193
250
  contacts: proto.Message.IContactMessage[];
251
+ };
252
+ }
253
+ | {
254
+ location: WALocationMessage;
255
+ }
256
+ | {
257
+ react: proto.Message.IReactionMessage;
258
+ }
259
+ | {
260
+ buttonReply: ButtonReplyInfo;
261
+ type: "template" | "plain";
262
+ }
263
+ | {
264
+ groupInvite: GroupInviteInfo;
265
+ }
266
+ | {
267
+ listReply: Omit<proto.Message.IListResponseMessage, "contextInfo">;
268
+ }
269
+ | {
270
+ pin: WAMessageKey;
271
+ type: proto.PinInChat.Type;
272
+ /**
273
+ * 24 hours, 7 days, 30 days
274
+ */
275
+ time?: 86400 | 604800 | 2592000;
276
+ }
277
+ | {
278
+ product: WASendableProduct;
279
+ businessOwnerJid?: string;
280
+ body?: string;
281
+ footer?: string;
282
+ }
283
+ | ({
284
+ stickerPack: StickerPackContent;
285
+ } & Mentionable &
286
+ Contextable)
287
+ | SharePhoneNumber
288
+ | RequestPhoneNumber
289
+ ) &
290
+ ViewOnce;
291
+ export type AnyMessageContent =
292
+ | AnyRegularMessageContent
293
+ | {
294
+ forward: WAMessage;
295
+ force?: boolean;
296
+ }
297
+ | {
298
+ /** Delete your message or anyone's message in a group (admin required) */
299
+ delete: WAMessageKey;
300
+ }
301
+ | {
302
+ disappearingMessagesInChat: boolean | number;
303
+ }
304
+ | {
305
+ limitSharing: boolean;
194
306
  };
195
- } | {
196
- location: WALocationMessage;
197
- } | {
198
- react: proto.Message.IReactionMessage;
199
- } | {
200
- buttonReply: ButtonReplyInfo;
201
- type: 'template' | 'plain';
202
- } | {
203
- groupInvite: GroupInviteInfo;
204
- } | {
205
- listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
206
- } | {
207
- pin: WAMessageKey;
208
- type: proto.PinInChat.Type;
209
- /**
210
- * 24 hours, 7 days, 30 days
211
- */
212
- time?: 86400 | 604800 | 2592000;
213
- } | {
214
- product: WASendableProduct;
215
- businessOwnerJid?: string;
216
- body?: string;
217
- footer?: string;
218
- } | SharePhoneNumber | RequestPhoneNumber | ({
219
- buttons: WAButtonContent[];
220
- footer?: string;
221
- text?: string;
222
- } & Contextable & Mentionable) | ({
223
- sections: WAListSection[];
224
- title?: string;
225
- buttonText: string;
226
- footer?: string;
227
- description: string;
228
- } & Contextable & Mentionable) | ({
229
- templateButtons: WATemplateButton[];
230
- footer?: string;
231
- id?: string;
232
- text?: string;
233
- } & Contextable) | ({
234
- nativeFlow: WAButtonContent[] | {
235
- buttons: WAButtonContent[];
236
- };
237
- footer?: string;
238
- title?: string;
239
- subtitle?: string;
240
- text?: string;
241
- audioFooter?: WAMediaUpload;
242
- } & Contextable & Mentionable) | ({
243
- cards: WACarouselCard[];
244
- footer?: string;
245
- } & Contextable) | (proto.IMessage & {
246
- raw: true;
247
- })) & ViewOnce & AiLabelable;
248
- export type WAButtonContent = {
249
- text?: string;
250
- buttonText?: string;
251
- icon?: string;
252
- } & ({
253
- id: string;
254
- } | {
255
- url: string;
256
- useWebview?: boolean;
257
- } | {
258
- call: string;
259
- } | {
260
- copy: string;
261
- } | {
262
- sections: WAListSection[];
263
- } | {
264
- name: string;
265
- paramsJson?: string;
266
- });
267
- export type WAListSection = {
268
- title?: string;
269
- rows: {
270
- title: string;
271
- rowId: string;
272
- description?: string;
273
- }[];
274
- };
275
- export type WATemplateButton = {
276
- text?: string;
277
- buttonText?: string;
278
- id: string;
279
- } | {
280
- text?: string;
281
- buttonText?: string;
282
- url: string;
283
- } | {
284
- text?: string;
285
- buttonText?: string;
286
- call: string;
287
- };
288
- export type WACarouselCard = {
289
- text?: string;
290
- caption?: string;
291
- title?: string;
292
- subtitle?: string;
293
- footer?: string;
294
- thumbnail?: WAMediaUpload;
295
- audioFooter?: WAMediaUpload;
296
- nativeFlow?: WAButtonContent[];
297
- } & AnyMediaMessageContent & Contextable;
298
- export type WAStickerPackSticker = {
299
- sticker: WAMediaUpload;
300
- data?: WAMediaUpload;
301
- isAnimated?: boolean;
302
- isLottie?: boolean;
303
- emojis?: string[];
304
- accessibilityLabel?: string;
305
- };
306
- export type WAStickerPackContent = {
307
- name: string;
308
- publisher?: string;
309
- packId?: string;
310
- description?: string;
311
- cover: WAMediaUpload;
312
- stickers: WAStickerPackSticker[];
313
- };
314
- export type AnyMessageContent = AnyRegularMessageContent | {
315
- forward: WAMessage;
316
- force?: boolean;
317
- } | {
318
- /** Delete your message or anyone's message in a group (admin required) */
319
- delete: WAMessageKey;
320
- } | {
321
- disappearingMessagesInChat: boolean | number;
322
- } | {
323
- limitSharing: boolean;
324
- } | {
325
- stickerPack: WAStickerPackContent;
326
- } & Mentionable & Contextable;
327
- export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
307
+ export type GroupMetadataParticipants = Pick<GroupMetadata, "participants">;
328
308
  type MinimalRelayOptions = {
329
- /** override the message ID with a custom provided string */
330
- messageId?: string;
331
- /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
332
- useCachedGroupMetadata?: boolean;
309
+ /** override the message ID with a custom provided string */
310
+ messageId?: string;
311
+ /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
312
+ useCachedGroupMetadata?: boolean;
333
313
  };
334
314
  export type MessageRelayOptions = MinimalRelayOptions & {
335
- /** only send to a specific participant; used when a message decryption fails for a single user */
336
- participant?: {
337
- jid: string;
338
- count: number;
339
- };
340
- /** additional attributes to add to the WA binary node */
341
- additionalAttributes?: {
342
- [_: string]: string;
343
- };
344
- additionalNodes?: BinaryNode[];
345
- /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
346
- useUserDevicesCache?: boolean;
347
- /** jid list of participants for status@broadcast */
348
- statusJidList?: string[];
315
+ /** only send to a specific participant; used when a message decryption fails for a single user */
316
+ participant?: {
317
+ jid: string;
318
+ count: number;
319
+ };
320
+ /** additional attributes to add to the WA binary node */
321
+ additionalAttributes?: {
322
+ [_: string]: string;
323
+ };
324
+ additionalNodes?: BinaryNode[];
325
+ /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
326
+ useUserDevicesCache?: boolean;
327
+ /** jid list of participants for status@broadcast */
328
+ statusJidList?: string[];
349
329
  };
350
330
  export type MiscMessageGenerationOptions = MinimalRelayOptions & {
351
- /** optional, if you want to manually set the timestamp of the message */
352
- timestamp?: Date;
353
- /** the message you want to quote */
354
- quoted?: WAMessage;
355
- /** disappearing messages settings */
356
- ephemeralExpiration?: number | string;
357
- /** timeout for media upload to WA server */
358
- mediaUploadTimeoutMs?: number;
359
- /** jid list of participants for status@broadcast */
360
- statusJidList?: string[];
361
- /** backgroundcolor for status */
362
- backgroundColor?: string;
363
- /** font type for status */
364
- font?: number;
365
- /** if it is broadcast */
366
- broadcast?: boolean;
367
- };
368
- export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
331
+ /** optional, if you want to manually set the timestamp of the message */
332
+ timestamp?: Date;
333
+ /** the message you want to quote */
334
+ quoted?: WAMessage;
335
+ /** disappearing messages settings */
336
+ ephemeralExpiration?: number | string;
337
+ /** timeout for media upload to WA server */
338
+ mediaUploadTimeoutMs?: number;
339
+ /** jid list of participants for status@broadcast */
340
+ statusJidList?: string[];
341
+ /** backgroundcolor for status */
342
+ backgroundColor?: string;
343
+ /** font type for status */
344
+ font?: number;
345
+ /** if it is broadcast */
346
+ broadcast?: boolean;
347
+ };
348
+ export type MessageGenerationOptionsFromContent =
349
+ MiscMessageGenerationOptions & {
369
350
  userJid: string;
370
- };
371
- export type WAMediaUploadFunction = (encFilePath: string, opts: {
351
+ };
352
+ export type WAMediaUploadFunction = (
353
+ encFilePath: string,
354
+ opts: {
372
355
  fileEncSha256B64: string;
373
356
  mediaType: MediaType;
357
+ newsletter?: boolean;
374
358
  timeoutMs?: number;
375
- }) => Promise<{
376
- mediaUrl: string;
377
- directPath: string;
378
- meta_hmac?: string;
379
- ts?: number;
380
- fbid?: number;
359
+ },
360
+ ) => Promise<{
361
+ mediaUrl: string;
362
+ directPath: string;
363
+ meta_hmac?: string;
364
+ ts?: number;
365
+ fbid?: number;
381
366
  }>;
382
367
  export type MediaGenerationOptions = {
383
- logger?: ILogger;
384
- mediaTypeOverride?: MediaType;
385
- upload: WAMediaUploadFunction;
386
- /** cache media so it does not have to be uploaded again */
387
- mediaCache?: CacheStore;
388
- mediaUploadTimeoutMs?: number;
389
- options?: RequestInit;
390
- backgroundColor?: string;
391
- font?: number;
368
+ logger?: ILogger;
369
+ mediaTypeOverride?: MediaType;
370
+ upload: WAMediaUploadFunction;
371
+ /** cache media so it does not have to be uploaded again */
372
+ mediaCache?: CacheStore;
373
+ mediaUploadTimeoutMs?: number;
374
+ options?: RequestInit;
375
+ backgroundColor?: string;
376
+ font?: number;
392
377
  };
393
378
  export type MessageContentGenerationOptions = MediaGenerationOptions & {
394
- getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
395
- getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
396
- getCallLink?: (type: 'audio' | 'video', event?: {
397
- startTime: number;
398
- }) => Promise<string | undefined>;
399
- jid?: string;
400
- };
401
- export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
379
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
380
+ getProfilePicUrl?: (
381
+ jid: string,
382
+ type: "image" | "preview",
383
+ ) => Promise<string | undefined>;
384
+ getCallLink?: (
385
+ type: "audio" | "video",
386
+ event?: {
387
+ startTime: number;
388
+ },
389
+ ) => Promise<string | undefined>;
390
+ jid?: string;
391
+ };
392
+ export type MessageGenerationOptions = MessageContentGenerationOptions &
393
+ MessageGenerationOptionsFromContent;
402
394
  /**
403
395
  * Type of message upsert
404
396
  * 1. notify => notify the user, this message was just received
405
397
  * 2. append => append the message to the chat history, no notification required
406
398
  */
407
- export type MessageUpsertType = 'append' | 'notify';
399
+ export type MessageUpsertType = "append" | "notify";
408
400
  export type MessageUserReceipt = proto.IUserReceipt;
409
401
  export type WAMessageUpdate = {
410
- update: Partial<WAMessage>;
411
- key: WAMessageKey;
412
- };
413
- export type WAMessageCursor = {
414
- before: WAMessageKey | undefined;
415
- } | {
416
- after: WAMessageKey | undefined;
417
- };
402
+ update: Partial<WAMessage>;
403
+ key: WAMessageKey;
404
+ };
405
+ export type WAMessageCursor =
406
+ | {
407
+ before: WAMessageKey | undefined;
408
+ }
409
+ | {
410
+ after: WAMessageKey | undefined;
411
+ };
418
412
  export type MessageUserReceiptUpdate = {
419
- key: WAMessageKey;
420
- receipt: MessageUserReceipt;
413
+ key: WAMessageKey;
414
+ receipt: MessageUserReceipt;
421
415
  };
422
416
  export type MediaDecryptionKeyInfo = {
423
- iv: Uint8Array;
424
- cipherKey: Uint8Array;
425
- macKey?: Uint8Array;
417
+ iv: Uint8Array;
418
+ cipherKey: Uint8Array;
419
+ macKey?: Uint8Array;
426
420
  };
427
- export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
428
- //# sourceMappingURL=Message.d.ts.map
421
+ export type MinimalMessage = Pick<WAMessage, "key" | "messageTimestamp">;
422
+ //# sourceMappingURL=Message.d.ts.map