@pontalabs/baileys 1.0.5 → 1.0.6

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 (447) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +267 -839
  3. package/WAProto/GenerateStatics.sh +3 -4
  4. package/WAProto/WAProto.proto +1215 -511
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.d.ts +14017 -55
  7. package/WAProto/index.js +97689 -29
  8. package/engine-requirements.js +10 -0
  9. package/lib/Defaults/index.d.ts +72 -74
  10. package/lib/Defaults/index.d.ts.map +1 -0
  11. package/lib/Defaults/index.js +94 -108
  12. package/lib/Defaults/index.js.map +1 -0
  13. package/lib/Signal/Group/ciphertext-message.d.ts +8 -7
  14. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  15. package/lib/Signal/Group/ciphertext-message.js +9 -16
  16. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  17. package/lib/Signal/Group/group-session-builder.d.ts +11 -13
  18. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  19. package/lib/Signal/Group/group-session-builder.js +19 -61
  20. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  21. package/lib/Signal/Group/group_cipher.d.ts +14 -16
  22. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  23. package/lib/Signal/Group/group_cipher.js +41 -70
  24. package/lib/Signal/Group/group_cipher.js.map +1 -0
  25. package/lib/Signal/Group/index.d.ts +12 -11
  26. package/lib/Signal/Group/index.d.ts.map +1 -0
  27. package/lib/Signal/Group/index.js +12 -61
  28. package/lib/Signal/Group/index.js.map +1 -0
  29. package/lib/Signal/Group/keyhelper.d.ts +9 -14
  30. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  31. package/lib/Signal/Group/keyhelper.js +10 -58
  32. package/lib/Signal/Group/keyhelper.js.map +1 -0
  33. package/lib/Signal/Group/sender-chain-key.d.ts +13 -13
  34. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  35. package/lib/Signal/Group/sender-chain-key.js +13 -34
  36. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -16
  38. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  39. package/lib/Signal/Group/sender-key-distribution-message.js +28 -36
  40. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  41. package/lib/Signal/Group/sender-key-message.d.ts +18 -18
  42. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  43. package/lib/Signal/Group/sender-key-message.js +38 -45
  44. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  45. package/lib/Signal/Group/sender-key-name.d.ts +14 -15
  46. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  47. package/lib/Signal/Group/sender-key-name.js +20 -31
  48. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  49. package/lib/Signal/Group/sender-key-record.d.ts +24 -25
  50. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  51. package/lib/Signal/Group/sender-key-record.js +18 -35
  52. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  53. package/lib/Signal/Group/sender-key-state.d.ts +29 -34
  54. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  55. package/lib/Signal/Group/sender-key-state.js +37 -100
  56. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  57. package/lib/Signal/Group/sender-message-key.d.ts +11 -10
  58. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  59. package/lib/Signal/Group/sender-message-key.js +15 -22
  60. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  61. package/lib/Signal/libsignal.d.ts +5 -8
  62. package/lib/Signal/libsignal.d.ts.map +1 -0
  63. package/lib/Signal/libsignal.js +288 -142
  64. package/lib/Signal/libsignal.js.map +1 -0
  65. package/lib/Signal/lid-mapping.d.ts +23 -28
  66. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  67. package/lib/Signal/lid-mapping.js +277 -184
  68. package/lib/Signal/lid-mapping.js.map +1 -0
  69. package/lib/Socket/Client/index.d.ts +3 -2
  70. package/lib/Socket/Client/index.d.ts.map +1 -0
  71. package/lib/Socket/Client/index.js +3 -22
  72. package/lib/Socket/Client/index.js.map +1 -0
  73. package/lib/Socket/Client/types.d.ts +15 -15
  74. package/lib/Socket/Client/types.d.ts.map +1 -0
  75. package/lib/Socket/Client/types.js +8 -15
  76. package/lib/Socket/Client/types.js.map +1 -0
  77. package/lib/Socket/Client/websocket.d.ts +12 -12
  78. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  79. package/lib/Socket/Client/websocket.js +29 -37
  80. package/lib/Socket/Client/websocket.js.map +1 -0
  81. package/lib/Socket/business.d.ts +208 -178
  82. package/lib/Socket/business.d.ts.map +1 -0
  83. package/lib/Socket/business.js +91 -127
  84. package/lib/Socket/business.js.map +1 -0
  85. package/lib/Socket/chats.d.ts +120 -93
  86. package/lib/Socket/chats.d.ts.map +1 -0
  87. package/lib/Socket/chats.js +727 -652
  88. package/lib/Socket/chats.js.map +1 -0
  89. package/lib/Socket/communities.d.ts +273 -0
  90. package/lib/Socket/communities.d.ts.map +1 -0
  91. package/lib/Socket/communities.js +431 -0
  92. package/lib/Socket/communities.js.map +1 -0
  93. package/lib/Socket/dugong.js +261 -0
  94. package/lib/Socket/dugong.js.bak +204 -0
  95. package/lib/Socket/groups.d.ts +143 -111
  96. package/lib/Socket/groups.d.ts.map +1 -0
  97. package/lib/Socket/groups.js +165 -177
  98. package/lib/Socket/groups.js.map +1 -0
  99. package/lib/Socket/index.d.ts +252 -183
  100. package/lib/Socket/index.d.ts.map +1 -0
  101. package/lib/Socket/index.js +38 -18
  102. package/lib/Socket/index.js.bak +44 -0
  103. package/lib/Socket/index.js.map +1 -0
  104. package/lib/Socket/messages-recv.d.ts +196 -167
  105. package/lib/Socket/messages-recv.d.ts.map +1 -0
  106. package/lib/Socket/messages-recv.js +1443 -1563
  107. package/lib/Socket/messages-recv.js.map +1 -0
  108. package/lib/Socket/messages-send.d.ts +192 -158
  109. package/lib/Socket/messages-send.d.ts.map +1 -0
  110. package/lib/Socket/messages-send.js +1102 -1208
  111. package/lib/Socket/messages-send.js.bak +1400 -0
  112. package/lib/Socket/messages-send.js.map +1 -0
  113. package/lib/Socket/mex.d.ts +3 -0
  114. package/lib/Socket/mex.d.ts.map +1 -0
  115. package/lib/Socket/mex.js +42 -0
  116. package/lib/Socket/mex.js.map +1 -0
  117. package/lib/Socket/newsletter.d.ts +163 -138
  118. package/lib/Socket/newsletter.d.ts.map +1 -0
  119. package/lib/Socket/newsletter.js +153 -249
  120. package/lib/Socket/newsletter.js.map +1 -0
  121. package/lib/Socket/socket.d.ts +50 -36
  122. package/lib/Socket/socket.d.ts.map +1 -0
  123. package/lib/Socket/socket.js +749 -820
  124. package/lib/Socket/socket.js.map +1 -0
  125. package/lib/Store/index.d.ts +4 -4
  126. package/lib/Store/index.d.ts.map +1 -0
  127. package/lib/Store/index.js +4 -24
  128. package/lib/Store/index.js.map +1 -0
  129. package/lib/Store/make-in-memory-store.d.ts +44 -104
  130. package/lib/Store/make-in-memory-store.d.ts.map +1 -0
  131. package/lib/Store/make-in-memory-store.js +199 -213
  132. package/lib/Store/make-in-memory-store.js.map +1 -0
  133. package/lib/Store/make-ordered-dictionary.d.ts +13 -12
  134. package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
  135. package/lib/Store/make-ordered-dictionary.js +38 -45
  136. package/lib/Store/make-ordered-dictionary.js.map +1 -0
  137. package/lib/Store/object-repository.d.ts +11 -10
  138. package/lib/Store/object-repository.d.ts.map +1 -0
  139. package/lib/Store/object-repository.js +9 -16
  140. package/lib/Store/object-repository.js.map +1 -0
  141. package/lib/Types/Auth.d.ts +93 -97
  142. package/lib/Types/Auth.d.ts.map +1 -0
  143. package/lib/Types/Auth.js +2 -3
  144. package/lib/Types/Auth.js.map +1 -0
  145. package/lib/Types/Bussines.d.ts +25 -0
  146. package/lib/Types/Bussines.d.ts.map +1 -0
  147. package/lib/Types/Bussines.js +2 -3
  148. package/lib/Types/Bussines.js.map +1 -0
  149. package/lib/Types/Call.d.ts +14 -13
  150. package/lib/Types/Call.d.ts.map +1 -0
  151. package/lib/Types/Call.js +2 -3
  152. package/lib/Types/Call.js.map +1 -0
  153. package/lib/Types/Chat.d.ts +78 -97
  154. package/lib/Types/Chat.d.ts.map +1 -0
  155. package/lib/Types/Chat.js +8 -9
  156. package/lib/Types/Chat.js.map +1 -0
  157. package/lib/Types/Contact.d.ts +12 -9
  158. package/lib/Types/Contact.d.ts.map +1 -0
  159. package/lib/Types/Contact.js +2 -3
  160. package/lib/Types/Contact.js.map +1 -0
  161. package/lib/Types/Events.d.ts +206 -176
  162. package/lib/Types/Events.d.ts.map +1 -0
  163. package/lib/Types/Events.js +2 -3
  164. package/lib/Types/Events.js.map +1 -0
  165. package/lib/Types/GroupMetadata.d.ts +53 -48
  166. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  167. package/lib/Types/GroupMetadata.js +2 -3
  168. package/lib/Types/GroupMetadata.js.map +1 -0
  169. package/lib/Types/Label.d.ts +13 -14
  170. package/lib/Types/Label.d.ts.map +1 -0
  171. package/lib/Types/Label.js +24 -30
  172. package/lib/Types/Label.js.map +1 -0
  173. package/lib/Types/LabelAssociation.d.ts +15 -20
  174. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  175. package/lib/Types/LabelAssociation.js +6 -12
  176. package/lib/Types/LabelAssociation.js.map +1 -0
  177. package/lib/Types/Message.d.ts +248 -412
  178. package/lib/Types/Message.d.ts.map +1 -0
  179. package/lib/Types/Message.js +17 -19
  180. package/lib/Types/Message.js.map +1 -0
  181. package/lib/Types/Mex.d.ts +141 -0
  182. package/lib/Types/Mex.d.ts.map +1 -0
  183. package/lib/Types/Mex.js +37 -0
  184. package/lib/Types/Mex.js.map +1 -0
  185. package/lib/Types/Product.d.ts +58 -71
  186. package/lib/Types/Product.d.ts.map +1 -0
  187. package/lib/Types/Product.js +2 -3
  188. package/lib/Types/Product.js.map +1 -0
  189. package/lib/Types/RichType.d.ts +3 -0
  190. package/lib/Types/RichType.d.ts.map +1 -0
  191. package/lib/Types/RichType.js +23 -0
  192. package/lib/Types/RichType.js.bak +23 -0
  193. package/lib/Types/RichType.js.map +1 -0
  194. package/lib/Types/Signal.d.ts +71 -82
  195. package/lib/Types/Signal.d.ts.map +1 -0
  196. package/lib/Types/Signal.js +2 -3
  197. package/lib/Types/Signal.js.map +1 -0
  198. package/lib/Types/Socket.d.ts +76 -81
  199. package/lib/Types/Socket.d.ts.map +1 -0
  200. package/lib/Types/Socket.js +3 -3
  201. package/lib/Types/Socket.js.map +1 -0
  202. package/lib/Types/State.d.ts +75 -19
  203. package/lib/Types/State.d.ts.map +1 -0
  204. package/lib/Types/State.js +56 -14
  205. package/lib/Types/State.js.map +1 -0
  206. package/lib/Types/USync.d.ts +8 -8
  207. package/lib/Types/USync.d.ts.map +1 -0
  208. package/lib/Types/USync.js +2 -3
  209. package/lib/Types/USync.js.map +1 -0
  210. package/lib/Types/index.d.ts +47 -62
  211. package/lib/Types/index.d.ts.map +1 -0
  212. package/lib/Types/index.js +26 -50
  213. package/lib/Types/index.js.map +1 -0
  214. package/lib/Utils/auth-utils.d.ts +13 -10
  215. package/lib/Utils/auth-utils.d.ts.map +1 -0
  216. package/lib/Utils/auth-utils.js +213 -472
  217. package/lib/Utils/auth-utils.js.map +1 -0
  218. package/lib/Utils/browser-utils.d.ts +4 -0
  219. package/lib/Utils/browser-utils.d.ts.map +1 -0
  220. package/lib/Utils/browser-utils.js +28 -0
  221. package/lib/Utils/browser-utils.js.map +1 -0
  222. package/lib/Utils/business.d.ts +14 -20
  223. package/lib/Utils/business.d.ts.map +1 -0
  224. package/lib/Utils/business.js +110 -134
  225. package/lib/Utils/business.js.map +1 -0
  226. package/lib/Utils/chat-utils.d.ts +88 -70
  227. package/lib/Utils/chat-utils.d.ts.map +1 -0
  228. package/lib/Utils/chat-utils.js +466 -403
  229. package/lib/Utils/chat-utils.js.map +1 -0
  230. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  231. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  232. package/lib/Utils/companion-reg-client-utils.js +35 -0
  233. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  234. package/lib/Utils/crypto.d.ts +27 -46
  235. package/lib/Utils/crypto.d.ts.map +1 -0
  236. package/lib/Utils/crypto.js +117 -188
  237. package/lib/Utils/crypto.js.map +1 -0
  238. package/lib/Utils/decode-wa-message.d.ts +58 -45
  239. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  240. package/lib/Utils/decode-wa-message.js +213 -303
  241. package/lib/Utils/decode-wa-message.js.map +1 -0
  242. package/lib/Utils/event-buffer.d.ts +14 -17
  243. package/lib/Utils/event-buffer.d.ts.map +1 -0
  244. package/lib/Utils/event-buffer.js +321 -296
  245. package/lib/Utils/event-buffer.js.map +1 -0
  246. package/lib/Utils/generics.d.ts +66 -92
  247. package/lib/Utils/generics.d.ts.map +1 -0
  248. package/lib/Utils/generics.js +270 -436
  249. package/lib/Utils/generics.js.map +1 -0
  250. package/lib/Utils/history.d.ts +24 -23
  251. package/lib/Utils/history.d.ts.map +1 -0
  252. package/lib/Utils/history.js +106 -76
  253. package/lib/Utils/history.js.map +1 -0
  254. package/lib/Utils/identity-change-handler.d.ts +44 -0
  255. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  256. package/lib/Utils/identity-change-handler.js +50 -0
  257. package/lib/Utils/identity-change-handler.js.map +1 -0
  258. package/lib/Utils/index.d.ts +24 -21
  259. package/lib/Utils/index.d.ts.map +1 -0
  260. package/lib/Utils/index.js +24 -41
  261. package/lib/Utils/index.js.map +1 -0
  262. package/lib/Utils/link-preview.d.ts +12 -14
  263. package/lib/Utils/link-preview.d.ts.map +1 -0
  264. package/lib/Utils/link-preview.js +40 -75
  265. package/lib/Utils/link-preview.js.map +1 -0
  266. package/lib/Utils/logger.d.ts +10 -11
  267. package/lib/Utils/logger.d.ts.map +1 -0
  268. package/lib/Utils/logger.js +3 -7
  269. package/lib/Utils/logger.js.map +1 -0
  270. package/lib/Utils/lt-hash.d.ts +8 -14
  271. package/lib/Utils/lt-hash.d.ts.map +1 -0
  272. package/lib/Utils/lt-hash.js +3 -53
  273. package/lib/Utils/lt-hash.js.map +1 -0
  274. package/lib/Utils/make-mutex.d.ts +7 -7
  275. package/lib/Utils/make-mutex.d.ts.map +1 -0
  276. package/lib/Utils/make-mutex.js +28 -44
  277. package/lib/Utils/make-mutex.js.map +1 -0
  278. package/lib/Utils/message-retry-manager.d.ts +115 -88
  279. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  280. package/lib/Utils/message-retry-manager.js +265 -160
  281. package/lib/Utils/message-retry-manager.js.map +1 -0
  282. package/lib/Utils/messages-media.d.ts +105 -107
  283. package/lib/Utils/messages-media.d.ts.map +1 -0
  284. package/lib/Utils/messages-media.js +548 -619
  285. package/lib/Utils/messages-media.js.bak +786 -0
  286. package/lib/Utils/messages-media.js.map +1 -0
  287. package/lib/Utils/messages.d.ts +52 -66
  288. package/lib/Utils/messages.d.ts.map +1 -0
  289. package/lib/Utils/messages.js +1730 -1558
  290. package/lib/Utils/messages.js.backup +1768 -0
  291. package/lib/Utils/messages.js.bak +1809 -0
  292. package/lib/Utils/messages.js.bak2 +893 -0
  293. package/lib/Utils/messages.js.bak3 +1183 -0
  294. package/lib/Utils/messages.js.map +1 -0
  295. package/lib/Utils/noise-handler.d.ts +18 -18
  296. package/lib/Utils/noise-handler.d.ts.map +1 -0
  297. package/lib/Utils/noise-handler.js +176 -130
  298. package/lib/Utils/noise-handler.js.map +1 -0
  299. package/lib/Utils/offline-node-processor.d.ts +17 -0
  300. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  301. package/lib/Utils/offline-node-processor.js +40 -0
  302. package/lib/Utils/offline-node-processor.js.map +1 -0
  303. package/lib/Utils/pre-key-manager.d.ts +28 -0
  304. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  305. package/lib/Utils/pre-key-manager.js +106 -0
  306. package/lib/Utils/pre-key-manager.js.map +1 -0
  307. package/lib/Utils/process-message.d.ts +43 -32
  308. package/lib/Utils/process-message.d.ts.map +1 -0
  309. package/lib/Utils/process-message.js +484 -282
  310. package/lib/Utils/process-message.js.map +1 -0
  311. package/lib/Utils/reporting-utils.d.ts +11 -0
  312. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  313. package/lib/Utils/reporting-utils.js +258 -0
  314. package/lib/Utils/reporting-utils.js.map +1 -0
  315. package/lib/Utils/rich-message-utils.d.ts +49 -0
  316. package/lib/Utils/rich-message-utils.d.ts.map +1 -0
  317. package/lib/Utils/rich-message-utils.js +1220 -724
  318. package/lib/Utils/rich-message-utils.js.backup +706 -0
  319. package/lib/Utils/rich-message-utils.js.bak +246 -0
  320. package/lib/Utils/rich-message-utils.js.map +1 -0
  321. package/lib/Utils/rich-message-utils.js.original +1332 -0
  322. package/lib/Utils/signal.d.ts +37 -32
  323. package/lib/Utils/signal.d.ts.map +1 -0
  324. package/lib/Utils/signal.js +140 -105
  325. package/lib/Utils/signal.js.map +1 -0
  326. package/lib/Utils/stanza-ack.d.ts +11 -0
  327. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  328. package/lib/Utils/stanza-ack.js +38 -0
  329. package/lib/Utils/stanza-ack.js.map +1 -0
  330. package/lib/Utils/sync-action-utils.d.ts +19 -0
  331. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  332. package/lib/Utils/sync-action-utils.js +49 -0
  333. package/lib/Utils/sync-action-utils.js.map +1 -0
  334. package/lib/Utils/tc-token-utils.d.ts +37 -0
  335. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  336. package/lib/Utils/tc-token-utils.js +163 -0
  337. package/lib/Utils/tc-token-utils.js.map +1 -0
  338. package/lib/Utils/use-multi-file-auth-state.d.ts +5 -5
  339. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  340. package/lib/Utils/use-multi-file-auth-state.js +70 -120
  341. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  342. package/lib/Utils/use-single-file-auth-state.d.ts +11 -13
  343. package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
  344. package/lib/Utils/use-single-file-auth-state.js +92 -66
  345. package/lib/Utils/use-single-file-auth-state.js.map +1 -0
  346. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  347. package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
  348. package/lib/Utils/use-sqlite-auth-state.js +109 -0
  349. package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
  350. package/lib/Utils/validate-connection.d.ts +11 -13
  351. package/lib/Utils/validate-connection.d.ts.map +1 -0
  352. package/lib/Utils/validate-connection.js +128 -113
  353. package/lib/Utils/validate-connection.js.map +1 -0
  354. package/lib/WABinary/constants.d.ts +25 -27
  355. package/lib/WABinary/constants.d.ts.map +1 -0
  356. package/lib/WABinary/constants.js +1451 -1292
  357. package/lib/WABinary/constants.js.bak +1373 -0
  358. package/lib/WABinary/constants.js.map +1 -0
  359. package/lib/WABinary/decode.d.ts +7 -9
  360. package/lib/WABinary/decode.d.ts.map +1 -0
  361. package/lib/WABinary/decode.js +163 -189
  362. package/lib/WABinary/decode.js.map +1 -0
  363. package/lib/WABinary/encode.d.ts +3 -3
  364. package/lib/WABinary/encode.d.ts.map +1 -0
  365. package/lib/WABinary/encode.js +110 -155
  366. package/lib/WABinary/encode.js.map +1 -0
  367. package/lib/WABinary/generic-utils.d.ts +14 -27
  368. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  369. package/lib/WABinary/generic-utils.js +177 -105
  370. package/lib/WABinary/generic-utils.js.map +1 -0
  371. package/lib/WABinary/index.d.ts +6 -5
  372. package/lib/WABinary/index.d.ts.map +1 -0
  373. package/lib/WABinary/index.js +6 -25
  374. package/lib/WABinary/index.js.map +1 -0
  375. package/lib/WABinary/jid-utils.d.ts +41 -51
  376. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  377. package/lib/WABinary/jid-utils.js +83 -120
  378. package/lib/WABinary/jid-utils.js.map +1 -0
  379. package/lib/WABinary/types.d.ts +10 -13
  380. package/lib/WABinary/types.d.ts.map +1 -0
  381. package/lib/WABinary/types.js +2 -3
  382. package/lib/WABinary/types.js.map +1 -0
  383. package/lib/WAM/BinaryInfo.d.ts +8 -15
  384. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  385. package/lib/WAM/BinaryInfo.js +7 -14
  386. package/lib/WAM/BinaryInfo.js.map +1 -0
  387. package/lib/WAM/constants.d.ts +30 -37
  388. package/lib/WAM/constants.d.ts.map +1 -0
  389. package/lib/WAM/constants.js +19193 -11711
  390. package/lib/WAM/constants.js.map +1 -0
  391. package/lib/WAM/encode.d.ts +3 -3
  392. package/lib/WAM/encode.d.ts.map +1 -0
  393. package/lib/WAM/encode.js +95 -109
  394. package/lib/WAM/encode.js.map +1 -0
  395. package/lib/WAM/index.d.ts +4 -3
  396. package/lib/WAM/index.d.ts.map +1 -0
  397. package/lib/WAM/index.js +4 -23
  398. package/lib/WAM/index.js.map +1 -0
  399. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
  400. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  401. package/lib/WAUSync/Protocols/USyncContactProtocol.js +37 -21
  402. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  403. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +19 -22
  404. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  405. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +18 -26
  406. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  407. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +11 -12
  408. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  409. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -20
  410. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  411. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +11 -12
  412. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  413. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +16 -24
  414. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  415. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  416. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  417. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  418. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  419. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  420. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  421. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  422. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  423. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  424. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  425. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  426. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  427. package/lib/WAUSync/Protocols/index.d.ts +6 -6
  428. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  429. package/lib/WAUSync/Protocols/index.js +6 -26
  430. package/lib/WAUSync/Protocols/index.js.map +1 -0
  431. package/lib/WAUSync/USyncQuery.d.ts +27 -28
  432. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  433. package/lib/WAUSync/USyncQuery.js +68 -62
  434. package/lib/WAUSync/USyncQuery.js.map +1 -0
  435. package/lib/WAUSync/USyncUser.d.ts +15 -10
  436. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  437. package/lib/WAUSync/USyncUser.js +20 -19
  438. package/lib/WAUSync/USyncUser.js.map +1 -0
  439. package/lib/WAUSync/index.d.ts +4 -3
  440. package/lib/WAUSync/index.d.ts.map +1 -0
  441. package/lib/WAUSync/index.js +4 -23
  442. package/lib/WAUSync/index.js.map +1 -0
  443. package/lib/index.d.ts +11 -12
  444. package/lib/index.d.ts.map +1 -0
  445. package/lib/index.js +12 -39
  446. package/lib/index.js.map +1 -0
  447. package/package.json +86 -42
@@ -1,484 +1,320 @@
1
- import { AxiosRequestConfig } from 'axios'
2
- import { ILogger } from '../Utils/logger'
3
- import type { Readable } from 'stream'
4
- import type { URL } from 'url'
5
- import { proto } from '../../WAProto'
6
- import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults'
7
- import { BinaryNode } from '../WABinary'
8
- import type { GroupMetadata } from './GroupMetadata'
9
- import { CacheStore } from './Socket'
10
-
11
- export { proto as WAProto }
12
-
13
- export type WAMessage = proto.IWebMessageInfo
14
-
15
- export type WAMessageContent = proto.IMessage
16
-
17
- export type WAContactMessage = proto.Message.IContactMessage
18
-
19
- export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage
20
-
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
+ export { proto as WAProto };
9
+ export type WAMessage = proto.IWebMessageInfo & {
10
+ key: WAMessageKey;
11
+ messageStubParameters?: any;
12
+ category?: string;
13
+ retryCount?: number;
14
+ };
15
+ export type WAMessageContent = proto.IMessage;
16
+ export type WAContactMessage = proto.Message.IContactMessage;
17
+ export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
21
18
  export type WAMessageKey = proto.IMessageKey & {
22
- remoteJidAlt?: string
23
- participantAlt?: string
24
- newsletter_server_id?: string
25
- isViewOnce?: boolean
19
+ remoteJidAlt?: string;
20
+ remoteJidUsername?: string;
21
+ participantAlt?: string;
22
+ participantUsername?: string;
23
+ server_id?: string;
24
+ addressingMode?: string;
25
+ isViewOnce?: boolean;
26
26
  };
27
-
28
- export type WATextMessage = proto.Message.IExtendedTextMessage
29
-
30
- export type WAContextInfo = proto.IContextInfo
31
-
32
- export type WALocationMessage = proto.Message.ILocationMessage
33
-
34
- export type WAOrderMessage = proto.Message.IOrderMessage
35
-
36
- export type WAEventMessage = proto.Message.IEventMessage
37
-
38
- export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage
39
-
40
- export declare const WAMessageStubType = proto.WebMessageInfo.StubType
41
-
42
- export declare const WAMessageStatus = proto.WebMessageInfo.Status
43
-
44
- export type WAMediaUpload = Buffer | {
45
- url: URL | string
46
- } | {
47
- stream: Readable
48
- }
49
-
27
+ export type WATextMessage = proto.Message.IExtendedTextMessage;
28
+ export type WAContextInfo = proto.IContextInfo;
29
+ export type WALocationMessage = proto.Message.ILocationMessage;
30
+ export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
31
+ export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
32
+ export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
33
+ import type { ILogger } from '../Utils/logger.js';
34
+ export type WAMediaPayloadURL = {
35
+ url: URL | string;
36
+ };
37
+ export type WAMediaPayloadStream = {
38
+ stream: Readable;
39
+ };
40
+ export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
50
41
  /** Set of message types that are supported by the library */
51
- export type MessageType = keyof proto.Message
52
-
42
+ export type MessageType = keyof proto.Message;
53
43
  export declare enum WAMessageAddressingMode {
54
- PN = 'pn',
55
- LID = 'lid'
44
+ PN = "pn",
45
+ LID = "lid"
56
46
  }
57
-
47
+ 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';
58
48
  export type DownloadableMessage = {
59
- mediaKey?: Uint8Array | null
60
- directPath?: string | null
61
- url?: string | null
62
- }
63
-
64
- export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined
65
-
49
+ mediaKey?: Uint8Array | null;
50
+ directPath?: string | null;
51
+ url?: string | null;
52
+ };
53
+ export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
66
54
  export type MediaConnInfo = {
67
- auth: string
68
- ttl: number
55
+ auth: string;
56
+ ttl: number;
69
57
  hosts: {
70
- hostname: string
71
- maxContentLengthBytes: number
72
- }[]
73
- fetchDate: Date
74
- }
75
-
76
- export interface StickerPack {
77
- stickers: Sticker[]
78
- cover: WAMediaUpload
79
- name: string
80
- publisher: string
81
- description?: string
82
- packId?: string
83
- }
84
-
85
- export interface Carousel {
86
- image?: WAMediaUpload
87
- video?: WAMediaUpload
88
- product?: WASendableProduct
89
- title?: string
90
- body?: string
91
- footer?: string
92
- buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[]
93
- }
94
-
58
+ hostname: string;
59
+ maxContentLengthBytes: number;
60
+ }[];
61
+ fetchDate: Date;
62
+ };
95
63
  export interface WAUrlInfo {
96
- 'canonical-url': string
97
- 'matched-text': string
98
- title: string
99
- description?: string
100
- jpegThumbnail?: Buffer
101
- highQualityThumbnail?: proto.Message.IImageMessage
102
- originalThumbnailUrl?: string
64
+ 'canonical-url': string;
65
+ 'matched-text': string;
66
+ title: string;
67
+ description?: string;
68
+ jpegThumbnail?: Buffer;
69
+ highQualityThumbnail?: proto.Message.IImageMessage;
70
+ originalThumbnailUrl?: string;
103
71
  }
104
-
105
72
  type Mentionable = {
106
73
  /** list of jids that are mentioned in the accompanying text */
107
- mentions?: string[]
108
- }
109
-
74
+ mentions?: string[];
75
+ /** mention all */
76
+ mentionAll?: boolean;
77
+ };
110
78
  type Contextable = {
111
79
  /** add contextInfo to the message */
112
- contextInfo?: proto.IContextInfo
113
- }
114
-
115
- type Ephemeral = {
116
- ephemeral?: boolean
117
- }
118
-
80
+ contextInfo?: proto.IContextInfo;
81
+ };
119
82
  type ViewOnce = {
120
- viewOnce?: boolean
121
- }
122
-
123
- type ViewOnceExt = {
124
- viewOnceExt?: boolean
125
- }
126
-
127
- type Buttonable = {
128
- /** add buttons to the message */
129
- buttons?: proto.Message.ButtonsMessage.IButton[]
130
- }
131
-
132
- type Templatable = {
133
- /** add buttons to the message (conflicts with normal buttons)*/
134
- templateButtons?: proto.IHydratedTemplateButton[]
135
- footer?: string
136
- }
137
-
138
- type Interactiveable = {
139
- /** add buttons to the message (conflicts with normal buttons)*/
140
- interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]
141
- title?: string
142
- subtitle?: string
143
- footer?: string
144
- hasMediaAttachment?: boolean
145
- }
146
-
147
- type Shopable = {
148
- shop?: proto.Message.InteractiveMessage.ShopMessage
149
- title?: string
150
- subtitle?: string
151
- footer?: string
152
- hasMediaAttachment?: boolean
153
- }
154
-
155
- type Collectionable = {
156
- collection?: proto.Message.InteractiveMessage.CollectionMessage
157
- title?: string
158
- subtitle?: string
159
- footer?: string
160
- hasMediaAttachment?: boolean
161
- }
162
-
163
- type Listable = {
164
- /** Sections of the List */
165
- sections?: proto.Message.ListMessage.ISection[]
166
- /** Title of a List Message only */
167
- title?: string
168
- /** Text of the button on the list (required) */
169
- buttonText?: string
170
- /** ListType of a List Message only */
171
- listType?: proto.Message.ListMessage.ListType
172
- }
173
-
174
- type Cardsable = {
175
- cards?: Carousel[]
176
- title?: string
177
- subtitle?: string
178
- footer?: string
179
- }
180
-
83
+ viewOnce?: boolean;
84
+ };
181
85
  type Editable = {
182
- edit?: WAMessageKey
183
- }
184
-
86
+ edit?: WAMessageKey;
87
+ };
185
88
  type WithDimensions = {
186
- width?: number
187
- height?: number
188
- }
189
-
190
- export type Sticker = {
191
- data: WAMediaUpload
192
- emojis?: string[]
193
- accessibilityLabel?: string
194
- }
195
-
89
+ width?: number;
90
+ height?: number;
91
+ };
196
92
  export type PollMessageOptions = {
197
- name: string
198
- selectableCount?: number
199
- values: string[]
93
+ name: string;
94
+ selectableCount?: number;
95
+ values: string[];
200
96
  /** 32 byte message secret to encrypt poll selections */
201
- messageSecret?: Uint8Array
202
- toAnnouncementGroup?: boolean
203
- }
204
-
205
- export type PollResultOptions = {
206
- name: string
207
- values: string[]
208
- }
209
-
97
+ messageSecret?: Uint8Array;
98
+ toAnnouncementGroup?: boolean;
99
+ };
100
+ export type EventMessageOptions = {
101
+ name: string;
102
+ description?: string;
103
+ startDate: Date;
104
+ endDate?: Date;
105
+ location?: WALocationMessage;
106
+ call?: 'audio' | 'video';
107
+ isCancelled?: boolean;
108
+ isScheduleCall?: boolean;
109
+ extraGuestsAllowed?: boolean;
110
+ messageSecret?: Uint8Array<ArrayBufferLike>;
111
+ };
112
+ export type AlbumMessageOptions = {
113
+ /** Number of images expected in the album */
114
+ expectedImageCount?: number;
115
+ /** Number of videos expected in the album */
116
+ expectedVideoCount?: number;
117
+ };
210
118
  type SharePhoneNumber = {
211
- sharePhoneNumber: boolean
212
- }
213
-
119
+ sharePhoneNumber: boolean;
120
+ };
214
121
  type RequestPhoneNumber = {
215
- requestPhoneNumber: boolean
216
- }
217
-
218
- export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING
219
-
122
+ requestPhoneNumber: boolean;
123
+ };
220
124
  export type AnyMediaMessageContent = (({
221
- image: WAMediaUpload
222
- caption?: string
223
- jpegThumbnail?: string
224
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | ({
225
- video: WAMediaUpload
226
- caption?: string
227
- gifPlayback?: boolean
228
- jpegThumbnail?: string
229
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | {
230
- audio: WAMediaUpload
125
+ image: WAMediaUpload;
126
+ caption?: string;
127
+ jpegThumbnail?: string;
128
+ } & Mentionable & Contextable & WithDimensions) | ({
129
+ video: WAMediaUpload;
130
+ caption?: string;
131
+ gifPlayback?: boolean;
132
+ jpegThumbnail?: string;
133
+ /** if set to true, will send as a `video note` */
134
+ ptv?: boolean;
135
+ } & Mentionable & Contextable & WithDimensions) | {
136
+ audio: WAMediaUpload;
231
137
  /** if set to true, will send as a `voice note` */
232
- ptt?: boolean
138
+ ptt?: boolean;
233
139
  /** optionally tell the duration of the audio */
234
- seconds?: number
140
+ seconds?: number;
235
141
  } | ({
236
- sticker: WAMediaUpload
237
- isAnimated?: boolean
142
+ sticker: WAMediaUpload;
143
+ isAnimated?: boolean;
238
144
  } & WithDimensions) | ({
239
- document: WAMediaUpload
240
- mimetype: string
241
- fileName?: string
242
- caption?: string
243
- } & Contextable & Buttonable & Templatable & Interactiveable )) & {
244
- mimetype?: string
245
- } & Editable
246
-
145
+ document: WAMediaUpload;
146
+ mimetype: string;
147
+ fileName?: string;
148
+ caption?: string;
149
+ } & Contextable)) & {
150
+ mimetype?: string;
151
+ } & Editable & {
152
+ /** key of the parent albumMessage to associate this media with */
153
+ albumParentKey?: WAMessageKey;
154
+ };
247
155
  export type ButtonReplyInfo = {
248
- displayText: string
249
- id: string
250
- index: number
251
- }
252
-
156
+ displayText: string;
157
+ id: string;
158
+ index: number;
159
+ };
253
160
  export type GroupInviteInfo = {
254
- code: string
255
- expiration: number
256
- caption: string
257
- jid: string
258
- name: string
259
- jpegThumbnail?: string
260
- }
261
-
262
- export type CallCreationInfo = {
263
- time?: number
264
- type?: number
265
- name: string
266
- }
267
-
268
- export type AdminInviteInfo = {
269
- jid: string
270
- name: string
271
- caption: string
272
- expiration: number
273
- jpegThumbnail: string
274
- }
275
-
276
- export type PinInfo = {
277
- key: WAMessageKey
278
- type?: number
279
- time?: number
280
- }
281
-
282
- export type KeepInfo = {
283
- key: WAMessageKey
284
- type: number
285
- }
286
-
287
- export type PaymentInfo = {
288
- note: string
289
- currency?: string
290
- offset?: number
291
- amount?: number
292
- expiry?: number
293
- from?: string
294
- image?: {
295
- placeholderArgb: number
296
- textArgb: number
297
- subtextArgb: number
298
- }
299
- }
300
-
161
+ inviteCode: string;
162
+ inviteExpiration: number;
163
+ text: string;
164
+ jid: string;
165
+ subject: string;
166
+ };
301
167
  export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
302
- productImage: WAMediaUpload
303
- }
304
-
168
+ productImage: WAMediaUpload;
169
+ };
305
170
  export type AnyRegularMessageContent = (({
306
- text: string
307
- linkPreview?: WAUrlInfo | null
308
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | AnyMediaMessageContent | ({
309
- poll: PollMessageOptions
310
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | {
171
+ text: string;
172
+ linkPreview?: WAUrlInfo | null;
173
+ } & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
174
+ event: EventMessageOptions;
175
+ } | ({
176
+ poll: PollMessageOptions;
177
+ } & Mentionable & Contextable & Editable) | ({
178
+ album: AlbumMessageOptions;
179
+ } & Contextable & Mentionable) | {
311
180
  contacts: {
312
- displayName?: string
313
- contacts: proto.Message.IContactMessage[]
314
- }
315
- } | {
316
- location: WALocationMessage
181
+ displayName?: string;
182
+ contacts: proto.Message.IContactMessage[];
183
+ };
317
184
  } | {
318
- react: proto.Message.IReactionMessage
185
+ location: WALocationMessage;
319
186
  } | {
320
- buttonReply: ButtonReplyInfo
321
- type: 'template' | 'plain' | 'list' | 'interactive'
187
+ react: proto.Message.IReactionMessage;
322
188
  } | {
323
- groupInvite: GroupInviteInfo
189
+ buttonReply: ButtonReplyInfo;
190
+ type: 'template' | 'plain';
324
191
  } | {
325
- pin: PinInfo
192
+ groupInvite: GroupInviteInfo;
326
193
  } | {
327
- keep: KeepInfo
194
+ listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
328
195
  } | {
329
- call: CallCreationInfo
196
+ pin: WAMessageKey;
197
+ type: proto.PinInChat.Type;
198
+ /**
199
+ * 24 hours, 7 days, 30 days
200
+ */
201
+ time?: 86400 | 604800 | 2592000;
330
202
  } | {
331
- event: WAEventMessage
332
- } | {
333
- adminInvite: AdminInviteInfo
334
- } | {
335
- payment: PaymentInfo
336
- } | {
337
- paymentInvite: {
338
- type: number
339
- expiry: number
340
- }
341
- } | {
342
- pollResult: PollResultOptions
343
- } | {
344
- order: WAOrderMessage
345
- } | {
346
- product: WASendableProduct
347
- businessOwnerJid?: string
348
- body?: string
349
- footer?: string
350
- } | {
351
- stickerPack: StickerPack
352
- } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce & ViewOnceExt
353
-
203
+ product: WASendableProduct;
204
+ businessOwnerJid?: string;
205
+ body?: string;
206
+ footer?: string;
207
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
354
208
  export type AnyMessageContent = AnyRegularMessageContent | {
355
- forward: WAMessage
356
- force?: boolean
209
+ forward: WAMessage;
210
+ force?: boolean;
357
211
  } | {
358
212
  /** Delete your message or anyone's message in a group (admin required) */
359
- delete: WAMessageKey
213
+ delete: WAMessageKey;
360
214
  } | {
361
- disappearingMessagesInChat: boolean | number
362
- }
363
-
364
- export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>
365
-
215
+ disappearingMessagesInChat: boolean | number;
216
+ } | {
217
+ limitSharing: boolean;
218
+ };
219
+ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
366
220
  type MinimalRelayOptions = {
367
221
  /** override the message ID with a custom provided string */
368
- messageId?: string
369
- /** should we use group metadata cache, or fetch afresh from the server default assumed to be "true" */
370
- useCachedGroupMetadata?: boolean
371
- }
372
-
222
+ messageId?: string;
223
+ /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
224
+ useCachedGroupMetadata?: boolean;
225
+ };
373
226
  export type MessageRelayOptions = MinimalRelayOptions & {
374
- /** only send to a specific participant used when a message decryption fails for a single user */
227
+ /** only send to a specific participant; used when a message decryption fails for a single user */
375
228
  participant?: {
376
- jid: string
377
- count: number
378
- }
229
+ jid: string;
230
+ count: number;
231
+ };
379
232
  /** additional attributes to add to the WA binary node */
380
233
  additionalAttributes?: {
381
- [_: string]: string
382
- }
383
- additionalNodes?: BinaryNode[]
384
- /** should we use the devices cache, or fetch afresh from the server default assumed to be "true" */
385
- useUserDevicesCache?: boolean
234
+ [_: string]: string;
235
+ };
236
+ additionalNodes?: BinaryNode[];
237
+ /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
238
+ useUserDevicesCache?: boolean;
386
239
  /** jid list of participants for status@broadcast */
387
- statusJidList?: string[]
388
- newsletter?: boolean
389
- }
390
-
240
+ statusJidList?: string[];
241
+ };
391
242
  export type MiscMessageGenerationOptions = MinimalRelayOptions & {
392
243
  /** optional, if you want to manually set the timestamp of the message */
393
- timestamp?: Date
244
+ timestamp?: Date;
394
245
  /** the message you want to quote */
395
- quoted?: WAMessage
246
+ quoted?: WAMessage;
396
247
  /** disappearing messages settings */
397
- ephemeralExpiration?: number | string
248
+ ephemeralExpiration?: number | string;
398
249
  /** timeout for media upload to WA server */
399
- mediaUploadTimeoutMs?: number
250
+ mediaUploadTimeoutMs?: number;
400
251
  /** jid list of participants for status@broadcast */
401
- statusJidList?: string[]
252
+ statusJidList?: string[];
402
253
  /** backgroundcolor for status */
403
- backgroundColor?: string
254
+ backgroundColor?: string;
404
255
  /** font type for status */
405
- font?: number
256
+ font?: number;
406
257
  /** if it is broadcast */
407
- broadcast?: boolean
408
- newsletter?: boolean
409
- additionalNodes?: BinaryNode[]
410
- }
411
-
258
+ broadcast?: boolean;
259
+ };
412
260
  export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
413
- userJid: string
414
- }
415
-
416
- export type WAMediaUploadFunctionOpts = {
417
- fileEncSha256B64: string
418
- mediaType: MediaType
419
- newsletter?: boolean
420
- timeoutMs?: number
421
- }
422
-
423
- export type WAMediaUploadFunction = (encFilePath: string | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
424
- mediaUrl: string
425
- directPath: string
426
- handle?: string
427
- meta_hmac?: string
428
- ts?: number
429
- fbid?: number
430
- }>
431
-
261
+ userJid: string;
262
+ };
263
+ export type WAMediaUploadFunction = (encFilePath: string, opts: {
264
+ fileEncSha256B64: string;
265
+ mediaType: MediaType;
266
+ timeoutMs?: number;
267
+ }) => Promise<{
268
+ mediaUrl: string;
269
+ directPath: string;
270
+ meta_hmac?: string;
271
+ ts?: number;
272
+ fbid?: number;
273
+ }>;
432
274
  export type MediaGenerationOptions = {
433
- logger?: ILogger
434
- mediaTypeOverride?: MediaType
435
- upload: WAMediaUploadFunction
275
+ logger?: ILogger;
276
+ mediaTypeOverride?: MediaType;
277
+ upload: WAMediaUploadFunction;
436
278
  /** cache media so it does not have to be uploaded again */
437
- mediaCache?: CacheStore
438
- mediaUploadTimeoutMs?: number
439
- options?: AxiosRequestConfig
440
- backgroundColor?: string
441
- font?: number
442
- /** The message is for newsletter? */
443
- newsletter?: boolean
444
- }
445
-
279
+ mediaCache?: CacheStore;
280
+ mediaUploadTimeoutMs?: number;
281
+ options?: RequestInit;
282
+ backgroundColor?: string;
283
+ font?: number;
284
+ };
446
285
  export type MessageContentGenerationOptions = MediaGenerationOptions & {
447
- getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>
448
- getProfilePicUrl?: (jid: string) => Promise<string | undefined>
449
- getCallLink?: (type: 'audio' | 'video', event?: number) => Promise<string | undefined>
450
- }
451
-
452
- export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent
286
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
287
+ getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
288
+ getCallLink?: (type: 'audio' | 'video', event?: {
289
+ startTime: number;
290
+ }) => Promise<string | undefined>;
291
+ jid?: string;
292
+ };
293
+ export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
453
294
  /**
454
295
  * Type of message upsert
455
296
  * 1. notify => notify the user, this message was just received
456
297
  * 2. append => append the message to the chat history, no notification required
457
298
  */
458
- export type MessageUpsertType = 'append' | 'notify'
459
-
460
- export type MessageUserReceipt = proto.IUserReceipt
461
-
299
+ export type MessageUpsertType = 'append' | 'notify';
300
+ export type MessageUserReceipt = proto.IUserReceipt;
462
301
  export type WAMessageUpdate = {
463
- update: Partial<WAMessage>
464
- key: proto.IMessageKey
465
- }
466
-
302
+ update: Partial<WAMessage>;
303
+ key: WAMessageKey;
304
+ };
467
305
  export type WAMessageCursor = {
468
- before: WAMessageKey | undefined
306
+ before: WAMessageKey | undefined;
469
307
  } | {
470
- after: WAMessageKey | undefined
471
- }
472
-
308
+ after: WAMessageKey | undefined;
309
+ };
473
310
  export type MessageUserReceiptUpdate = {
474
- key: proto.IMessageKey
475
- receipt: MessageUserReceipt
476
- }
477
-
311
+ key: WAMessageKey;
312
+ receipt: MessageUserReceipt;
313
+ };
478
314
  export type MediaDecryptionKeyInfo = {
479
- iv: Buffer
480
- cipherKey: Buffer
481
- macKey?: Buffer
482
- }
483
-
484
- export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>
315
+ iv: Uint8Array;
316
+ cipherKey: Uint8Array;
317
+ macKey?: Uint8Array;
318
+ };
319
+ export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
320
+ //# sourceMappingURL=Message.d.ts.map