@d0v3riz/baileys 6.7.21 → 6.7.22

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 (356) hide show
  1. package/WAProto/GenerateStatics.sh +2 -3
  2. package/WAProto/index.js +4138 -4136
  3. package/lib/Defaults/index.d.ts +2 -3
  4. package/lib/Defaults/index.js +40 -36
  5. package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
  6. package/lib/Signal/Group/ciphertext-message.js +5 -2
  7. package/lib/Signal/Group/group-session-builder.d.ts +3 -4
  8. package/lib/Signal/Group/group-session-builder.js +41 -7
  9. package/lib/Signal/Group/group_cipher.d.ts +2 -3
  10. package/lib/Signal/Group/group_cipher.js +16 -14
  11. package/lib/Signal/Group/index.d.ts +11 -12
  12. package/lib/Signal/Group/index.js +57 -12
  13. package/lib/Signal/Group/keyhelper.d.ts +1 -2
  14. package/lib/Signal/Group/keyhelper.js +44 -8
  15. package/lib/Signal/Group/queue-job.d.ts +0 -2
  16. package/lib/Signal/Group/queue-job.js +5 -5
  17. package/lib/Signal/Group/sender-chain-key.d.ts +1 -2
  18. package/lib/Signal/Group/sender-chain-key.js +9 -7
  19. package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
  20. package/lib/Signal/Group/sender-key-distribution-message.js +9 -6
  21. package/lib/Signal/Group/sender-key-message.d.ts +1 -2
  22. package/lib/Signal/Group/sender-key-message.js +12 -10
  23. package/lib/Signal/Group/sender-key-name.d.ts +0 -1
  24. package/lib/Signal/Group/sender-key-name.js +5 -2
  25. package/lib/Signal/Group/sender-key-record.d.ts +1 -2
  26. package/lib/Signal/Group/sender-key-record.js +12 -9
  27. package/lib/Signal/Group/sender-key-state.d.ts +2 -3
  28. package/lib/Signal/Group/sender-key-state.js +9 -6
  29. package/lib/Signal/Group/sender-message-key.d.ts +0 -1
  30. package/lib/Signal/Group/sender-message-key.js +7 -5
  31. package/lib/Signal/libsignal.d.ts +2 -3
  32. package/lib/Signal/libsignal.js +55 -22
  33. package/lib/Socket/Client/index.d.ts +2 -3
  34. package/lib/Socket/Client/index.js +18 -3
  35. package/lib/Socket/Client/types.d.ts +1 -2
  36. package/lib/Socket/Client/types.js +6 -4
  37. package/lib/Socket/Client/websocket.d.ts +1 -2
  38. package/lib/Socket/Client/websocket.js +26 -14
  39. package/lib/Socket/business.d.ts +64 -66
  40. package/lib/Socket/business.js +37 -32
  41. package/lib/Socket/chats.d.ts +19 -21
  42. package/lib/Socket/chats.js +141 -176
  43. package/lib/Socket/groups.d.ts +35 -37
  44. package/lib/Socket/groups.js +63 -56
  45. package/lib/Socket/index.d.ts +70 -102
  46. package/lib/Socket/index.js +9 -16
  47. package/lib/Socket/messages-recv.d.ts +49 -51
  48. package/lib/Socket/messages-recv.js +173 -180
  49. package/lib/Socket/messages-send.d.ts +46 -48
  50. package/lib/Socket/messages-send.js +84 -75
  51. package/lib/Socket/mex.d.ts +1 -2
  52. package/lib/Socket/mex.js +16 -12
  53. package/lib/Socket/newsletter.d.ts +44 -46
  54. package/lib/Socket/newsletter.js +27 -23
  55. package/lib/Socket/socket.d.ts +12 -13
  56. package/lib/Socket/socket.js +115 -135
  57. package/lib/Socket/usync.d.ts +14 -15
  58. package/lib/Socket/usync.js +11 -9
  59. package/lib/Types/Auth.d.ts +3 -4
  60. package/lib/Types/Auth.js +2 -2
  61. package/lib/Types/Call.d.ts +0 -1
  62. package/lib/Types/Call.js +2 -2
  63. package/lib/Types/Chat.d.ts +7 -10
  64. package/lib/Types/Chat.js +4 -2
  65. package/lib/Types/Contact.d.ts +0 -1
  66. package/lib/Types/Contact.js +2 -2
  67. package/lib/Types/Events.d.ts +10 -11
  68. package/lib/Types/Events.js +2 -2
  69. package/lib/Types/GroupMetadata.d.ts +2 -3
  70. package/lib/Types/GroupMetadata.js +2 -2
  71. package/lib/Types/Label.d.ts +0 -1
  72. package/lib/Types/Label.js +5 -3
  73. package/lib/Types/LabelAssociation.d.ts +0 -1
  74. package/lib/Types/LabelAssociation.js +5 -3
  75. package/lib/Types/Message.d.ts +7 -9
  76. package/lib/Types/Message.js +7 -7
  77. package/lib/Types/Newsletter.d.ts +0 -1
  78. package/lib/Types/Newsletter.js +7 -5
  79. package/lib/Types/Product.d.ts +1 -2
  80. package/lib/Types/Product.js +2 -2
  81. package/lib/Types/Signal.d.ts +1 -2
  82. package/lib/Types/Signal.js +2 -2
  83. package/lib/Types/Socket.d.ts +7 -8
  84. package/lib/Types/Socket.js +2 -3
  85. package/lib/Types/State.d.ts +2 -14
  86. package/lib/Types/State.js +2 -13
  87. package/lib/Types/USync.d.ts +2 -3
  88. package/lib/Types/USync.js +2 -2
  89. package/lib/Types/index.d.ts +14 -15
  90. package/lib/Types/index.js +31 -15
  91. package/lib/Utils/auth-utils.d.ts +2 -3
  92. package/lib/Utils/auth-utils.js +34 -25
  93. package/lib/Utils/baileys-event-stream.d.ts +1 -2
  94. package/lib/Utils/baileys-event-stream.js +22 -15
  95. package/lib/Utils/business.d.ts +2 -3
  96. package/lib/Utils/business.js +70 -61
  97. package/lib/Utils/chat-utils.d.ts +7 -8
  98. package/lib/Utils/chat-utils.js +137 -130
  99. package/lib/Utils/crypto.d.ts +1 -2
  100. package/lib/Utils/crypto.js +86 -37
  101. package/lib/Utils/decode-wa-message.d.ts +4 -5
  102. package/lib/Utils/decode-wa-message.js +44 -38
  103. package/lib/Utils/event-buffer.d.ts +4 -4
  104. package/lib/Utils/event-buffer.js +50 -37
  105. package/lib/Utils/generics.d.ts +8 -9
  106. package/lib/Utils/generics.js +114 -87
  107. package/lib/Utils/history.d.ts +3 -4
  108. package/lib/Utils/history.js +40 -32
  109. package/lib/Utils/index.d.ts +17 -18
  110. package/lib/Utils/index.js +33 -18
  111. package/lib/Utils/link-preview.d.ts +3 -4
  112. package/lib/Utils/link-preview.js +47 -10
  113. package/lib/Utils/logger.d.ts +6 -8
  114. package/lib/Utils/logger.js +7 -3
  115. package/lib/Utils/lt-hash.d.ts +8 -9
  116. package/lib/Utils/lt-hash.js +26 -23
  117. package/lib/Utils/make-mutex.d.ts +0 -1
  118. package/lib/Utils/make-mutex.js +9 -5
  119. package/lib/Utils/messages-media.d.ts +10 -11
  120. package/lib/Utils/messages-media.js +203 -141
  121. package/lib/Utils/messages.d.ts +6 -7
  122. package/lib/Utils/messages.js +199 -190
  123. package/lib/Utils/noise-handler.d.ts +4 -5
  124. package/lib/Utils/noise-handler.js +26 -22
  125. package/lib/Utils/process-message.d.ts +4 -5
  126. package/lib/Utils/process-message.js +104 -95
  127. package/lib/Utils/signal.d.ts +4 -5
  128. package/lib/Utils/signal.js +52 -47
  129. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
  130. package/lib/Utils/use-multi-file-auth-state.js +26 -23
  131. package/lib/Utils/validate-connection.d.ts +3 -4
  132. package/lib/Utils/validate-connection.js +58 -52
  133. package/lib/WABinary/constants.d.ts +0 -1
  134. package/lib/WABinary/constants.js +11 -9
  135. package/lib/WABinary/decode.d.ts +1 -2
  136. package/lib/WABinary/decode.js +51 -13
  137. package/lib/WABinary/encode.d.ts +1 -2
  138. package/lib/WABinary/encode.js +41 -5
  139. package/lib/WABinary/generic-utils.d.ts +3 -4
  140. package/lib/WABinary/generic-utils.js +38 -30
  141. package/lib/WABinary/index.d.ts +5 -6
  142. package/lib/WABinary/index.js +21 -6
  143. package/lib/WABinary/jid-utils.d.ts +0 -1
  144. package/lib/WABinary/jid-utils.js +35 -21
  145. package/lib/WABinary/types.d.ts +1 -2
  146. package/lib/WABinary/types.js +2 -2
  147. package/lib/WAM/BinaryInfo.d.ts +1 -2
  148. package/lib/WAM/BinaryInfo.js +5 -2
  149. package/lib/WAM/constants.d.ts +0 -1
  150. package/lib/WAM/constants.js +6 -4
  151. package/lib/WAM/encode.d.ts +1 -2
  152. package/lib/WAM/encode.js +14 -12
  153. package/lib/WAM/index.d.ts +3 -4
  154. package/lib/WAM/index.js +19 -4
  155. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
  156. package/lib/WAUSync/Protocols/USyncContactProtocol.js +9 -6
  157. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
  158. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +12 -9
  159. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
  160. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -6
  161. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
  162. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +11 -7
  163. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
  164. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +21 -19
  165. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +2 -3
  166. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +5 -2
  167. package/lib/WAUSync/Protocols/index.d.ts +4 -5
  168. package/lib/WAUSync/Protocols/index.js +20 -5
  169. package/lib/WAUSync/USyncQuery.d.ts +3 -4
  170. package/lib/WAUSync/USyncQuery.js +20 -18
  171. package/lib/WAUSync/USyncUser.d.ts +5 -6
  172. package/lib/WAUSync/USyncUser.js +5 -2
  173. package/lib/WAUSync/index.d.ts +3 -4
  174. package/lib/WAUSync/index.js +19 -4
  175. package/lib/index.d.ts +8 -9
  176. package/lib/index.js +30 -11
  177. package/package.json +26 -26
  178. package/WAProto/fix-imports.js +0 -29
  179. package/lib/Defaults/index.d.ts.map +0 -1
  180. package/lib/Defaults/index.js.map +0 -1
  181. package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
  182. package/lib/Signal/Group/ciphertext-message.js.map +0 -1
  183. package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
  184. package/lib/Signal/Group/group-session-builder.js.map +0 -1
  185. package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
  186. package/lib/Signal/Group/group_cipher.js.map +0 -1
  187. package/lib/Signal/Group/index.d.ts.map +0 -1
  188. package/lib/Signal/Group/index.js.map +0 -1
  189. package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
  190. package/lib/Signal/Group/keyhelper.js.map +0 -1
  191. package/lib/Signal/Group/queue-job.d.ts.map +0 -1
  192. package/lib/Signal/Group/queue-job.js.map +0 -1
  193. package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
  194. package/lib/Signal/Group/sender-chain-key.js.map +0 -1
  195. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
  196. package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
  197. package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
  198. package/lib/Signal/Group/sender-key-message.js.map +0 -1
  199. package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
  200. package/lib/Signal/Group/sender-key-name.js.map +0 -1
  201. package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
  202. package/lib/Signal/Group/sender-key-record.js.map +0 -1
  203. package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
  204. package/lib/Signal/Group/sender-key-state.js.map +0 -1
  205. package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
  206. package/lib/Signal/Group/sender-message-key.js.map +0 -1
  207. package/lib/Signal/libsignal.d.ts.map +0 -1
  208. package/lib/Signal/libsignal.js.map +0 -1
  209. package/lib/Socket/Client/index.d.ts.map +0 -1
  210. package/lib/Socket/Client/index.js.map +0 -1
  211. package/lib/Socket/Client/types.d.ts.map +0 -1
  212. package/lib/Socket/Client/types.js.map +0 -1
  213. package/lib/Socket/Client/websocket.d.ts.map +0 -1
  214. package/lib/Socket/Client/websocket.js.map +0 -1
  215. package/lib/Socket/business.d.ts.map +0 -1
  216. package/lib/Socket/business.js.map +0 -1
  217. package/lib/Socket/chats.d.ts.map +0 -1
  218. package/lib/Socket/chats.js.map +0 -1
  219. package/lib/Socket/communities.d.ts +0 -219
  220. package/lib/Socket/communities.d.ts.map +0 -1
  221. package/lib/Socket/communities.js +0 -351
  222. package/lib/Socket/communities.js.map +0 -1
  223. package/lib/Socket/groups.d.ts.map +0 -1
  224. package/lib/Socket/groups.js.map +0 -1
  225. package/lib/Socket/index.d.ts.map +0 -1
  226. package/lib/Socket/index.js.map +0 -1
  227. package/lib/Socket/messages-recv.d.ts.map +0 -1
  228. package/lib/Socket/messages-recv.js.map +0 -1
  229. package/lib/Socket/messages-send.d.ts.map +0 -1
  230. package/lib/Socket/messages-send.js.map +0 -1
  231. package/lib/Socket/mex.d.ts.map +0 -1
  232. package/lib/Socket/mex.js.map +0 -1
  233. package/lib/Socket/newsletter.d.ts.map +0 -1
  234. package/lib/Socket/newsletter.js.map +0 -1
  235. package/lib/Socket/socket.d.ts.map +0 -1
  236. package/lib/Socket/socket.js.map +0 -1
  237. package/lib/Socket/usync.d.ts.map +0 -1
  238. package/lib/Socket/usync.js.map +0 -1
  239. package/lib/Types/Auth.d.ts.map +0 -1
  240. package/lib/Types/Auth.js.map +0 -1
  241. package/lib/Types/Call.d.ts.map +0 -1
  242. package/lib/Types/Call.js.map +0 -1
  243. package/lib/Types/Chat.d.ts.map +0 -1
  244. package/lib/Types/Chat.js.map +0 -1
  245. package/lib/Types/Contact.d.ts.map +0 -1
  246. package/lib/Types/Contact.js.map +0 -1
  247. package/lib/Types/Events.d.ts.map +0 -1
  248. package/lib/Types/Events.js.map +0 -1
  249. package/lib/Types/GroupMetadata.d.ts.map +0 -1
  250. package/lib/Types/GroupMetadata.js.map +0 -1
  251. package/lib/Types/Label.d.ts.map +0 -1
  252. package/lib/Types/Label.js.map +0 -1
  253. package/lib/Types/LabelAssociation.d.ts.map +0 -1
  254. package/lib/Types/LabelAssociation.js.map +0 -1
  255. package/lib/Types/Message.d.ts.map +0 -1
  256. package/lib/Types/Message.js.map +0 -1
  257. package/lib/Types/Newsletter.d.ts.map +0 -1
  258. package/lib/Types/Newsletter.js.map +0 -1
  259. package/lib/Types/Product.d.ts.map +0 -1
  260. package/lib/Types/Product.js.map +0 -1
  261. package/lib/Types/Signal.d.ts.map +0 -1
  262. package/lib/Types/Signal.js.map +0 -1
  263. package/lib/Types/Socket.d.ts.map +0 -1
  264. package/lib/Types/Socket.js.map +0 -1
  265. package/lib/Types/State.d.ts.map +0 -1
  266. package/lib/Types/State.js.map +0 -1
  267. package/lib/Types/USync.d.ts.map +0 -1
  268. package/lib/Types/USync.js.map +0 -1
  269. package/lib/Types/index.d.ts.map +0 -1
  270. package/lib/Types/index.js.map +0 -1
  271. package/lib/Utils/auth-utils.d.ts.map +0 -1
  272. package/lib/Utils/auth-utils.js.map +0 -1
  273. package/lib/Utils/baileys-event-stream.d.ts.map +0 -1
  274. package/lib/Utils/baileys-event-stream.js.map +0 -1
  275. package/lib/Utils/business.d.ts.map +0 -1
  276. package/lib/Utils/business.js.map +0 -1
  277. package/lib/Utils/chat-utils.d.ts.map +0 -1
  278. package/lib/Utils/chat-utils.js.map +0 -1
  279. package/lib/Utils/crypto.d.ts.map +0 -1
  280. package/lib/Utils/crypto.js.map +0 -1
  281. package/lib/Utils/decode-wa-message.d.ts.map +0 -1
  282. package/lib/Utils/decode-wa-message.js.map +0 -1
  283. package/lib/Utils/event-buffer.d.ts.map +0 -1
  284. package/lib/Utils/event-buffer.js.map +0 -1
  285. package/lib/Utils/generics.d.ts.map +0 -1
  286. package/lib/Utils/generics.js.map +0 -1
  287. package/lib/Utils/history.d.ts.map +0 -1
  288. package/lib/Utils/history.js.map +0 -1
  289. package/lib/Utils/index.d.ts.map +0 -1
  290. package/lib/Utils/index.js.map +0 -1
  291. package/lib/Utils/link-preview.d.ts.map +0 -1
  292. package/lib/Utils/link-preview.js.map +0 -1
  293. package/lib/Utils/logger.d.ts.map +0 -1
  294. package/lib/Utils/logger.js.map +0 -1
  295. package/lib/Utils/lt-hash.d.ts.map +0 -1
  296. package/lib/Utils/lt-hash.js.map +0 -1
  297. package/lib/Utils/make-mutex.d.ts.map +0 -1
  298. package/lib/Utils/make-mutex.js.map +0 -1
  299. package/lib/Utils/messages-media.d.ts.map +0 -1
  300. package/lib/Utils/messages-media.js.map +0 -1
  301. package/lib/Utils/messages.d.ts.map +0 -1
  302. package/lib/Utils/messages.js.map +0 -1
  303. package/lib/Utils/noise-handler.d.ts.map +0 -1
  304. package/lib/Utils/noise-handler.js.map +0 -1
  305. package/lib/Utils/process-message.d.ts.map +0 -1
  306. package/lib/Utils/process-message.js.map +0 -1
  307. package/lib/Utils/signal.d.ts.map +0 -1
  308. package/lib/Utils/signal.js.map +0 -1
  309. package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
  310. package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
  311. package/lib/Utils/validate-connection.d.ts.map +0 -1
  312. package/lib/Utils/validate-connection.js.map +0 -1
  313. package/lib/WABinary/constants.d.ts.map +0 -1
  314. package/lib/WABinary/constants.js.map +0 -1
  315. package/lib/WABinary/decode.d.ts.map +0 -1
  316. package/lib/WABinary/decode.js.map +0 -1
  317. package/lib/WABinary/encode.d.ts.map +0 -1
  318. package/lib/WABinary/encode.js.map +0 -1
  319. package/lib/WABinary/generic-utils.d.ts.map +0 -1
  320. package/lib/WABinary/generic-utils.js.map +0 -1
  321. package/lib/WABinary/index.d.ts.map +0 -1
  322. package/lib/WABinary/index.js.map +0 -1
  323. package/lib/WABinary/jid-utils.d.ts.map +0 -1
  324. package/lib/WABinary/jid-utils.js.map +0 -1
  325. package/lib/WABinary/types.d.ts.map +0 -1
  326. package/lib/WABinary/types.js.map +0 -1
  327. package/lib/WAM/BinaryInfo.d.ts.map +0 -1
  328. package/lib/WAM/BinaryInfo.js.map +0 -1
  329. package/lib/WAM/constants.d.ts.map +0 -1
  330. package/lib/WAM/constants.js.map +0 -1
  331. package/lib/WAM/encode.d.ts.map +0 -1
  332. package/lib/WAM/encode.js.map +0 -1
  333. package/lib/WAM/index.d.ts.map +0 -1
  334. package/lib/WAM/index.js.map +0 -1
  335. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
  336. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
  337. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
  338. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
  339. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
  340. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
  341. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
  342. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
  343. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
  344. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
  345. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
  346. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
  347. package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
  348. package/lib/WAUSync/Protocols/index.js.map +0 -1
  349. package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
  350. package/lib/WAUSync/USyncQuery.js.map +0 -1
  351. package/lib/WAUSync/USyncUser.d.ts.map +0 -1
  352. package/lib/WAUSync/USyncUser.js.map +0 -1
  353. package/lib/WAUSync/index.d.ts.map +0 -1
  354. package/lib/WAUSync/index.js.map +0 -1
  355. package/lib/index.d.ts.map +0 -1
  356. package/lib/index.js.map +0 -1
@@ -1,18 +1,25 @@
1
- import NodeCache from '@cacheable/node-cache';
2
- import { randomBytes } from 'crypto';
3
- import { DEFAULT_CACHE_TTLS } from '../Defaults/index.js';
4
- import { Curve, signedKeyPair } from './crypto.js';
5
- import { delay, generateRegistrationId } from './generics.js';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initAuthCreds = exports.addTransactionCapability = void 0;
7
+ exports.makeCacheableSignalKeyStore = makeCacheableSignalKeyStore;
8
+ const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
9
+ const crypto_1 = require("crypto");
10
+ const Defaults_1 = require("../Defaults");
11
+ const crypto_2 = require("./crypto");
12
+ const generics_1 = require("./generics");
6
13
  /**
7
14
  * Adds caching capability to a SignalKeyStore
8
15
  * @param store the store to add caching to
9
16
  * @param logger to log trace events
10
17
  * @param _cache cache store to use
11
18
  */
12
- export function makeCacheableSignalKeyStore(store, logger, _cache) {
19
+ function makeCacheableSignalKeyStore(store, logger, _cache) {
13
20
  const cache = _cache ||
14
- new NodeCache({
15
- stdTTL: DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes
21
+ new node_cache_1.default({
22
+ stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes
16
23
  useClones: false,
17
24
  deleteOnExpire: true
18
25
  });
@@ -25,7 +32,7 @@ export function makeCacheableSignalKeyStore(store, logger, _cache) {
25
32
  const idsToFetch = [];
26
33
  for (const id of ids) {
27
34
  const item = cache.get(getUniqueId(type, id));
28
- if (typeof item !== 'undefined') {
35
+ if (typeof item !== 'undefined' && item !== null) {
29
36
  data[id] = item;
30
37
  }
31
38
  else {
@@ -33,7 +40,7 @@ export function makeCacheableSignalKeyStore(store, logger, _cache) {
33
40
  }
34
41
  }
35
42
  if (idsToFetch.length) {
36
- logger?.trace({ items: idsToFetch.length }, 'loading from store');
43
+ logger === null || logger === void 0 ? void 0 : logger.trace({ items: idsToFetch.length }, 'loading from store');
37
44
  const fetched = await store.get(type, idsToFetch);
38
45
  for (const id of idsToFetch) {
39
46
  const item = fetched[id];
@@ -53,12 +60,13 @@ export function makeCacheableSignalKeyStore(store, logger, _cache) {
53
60
  keys += 1;
54
61
  }
55
62
  }
56
- logger?.trace({ keys }, 'updated cache');
63
+ logger === null || logger === void 0 ? void 0 : logger.trace({ keys }, 'updated cache');
57
64
  await store.set(data);
58
65
  },
59
66
  async clear() {
67
+ var _a;
60
68
  cache.flushAll();
61
- await store.clear?.();
69
+ await ((_a = store.clear) === null || _a === void 0 ? void 0 : _a.call(store));
62
70
  }
63
71
  };
64
72
  }
@@ -69,7 +77,7 @@ export function makeCacheableSignalKeyStore(store, logger, _cache) {
69
77
  * @param logger logger to log events
70
78
  * @returns SignalKeyStore with transaction capability
71
79
  */
72
- export const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetweenTriesMs }) => {
80
+ const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetweenTriesMs }) => {
73
81
  // number of queries made to the DB during the transaction
74
82
  // only there for logging purposes
75
83
  let dbQueriesInTransaction = 0;
@@ -89,7 +97,8 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
89
97
  Object.assign(transactionCache[type], result);
90
98
  }
91
99
  return ids.reduce((dict, id) => {
92
- const value = transactionCache[type]?.[id];
100
+ var _a;
101
+ const value = (_a = transactionCache[type]) === null || _a === void 0 ? void 0 : _a[id];
93
102
  if (value) {
94
103
  dict[id] = value;
95
104
  }
@@ -103,8 +112,7 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
103
112
  set: data => {
104
113
  if (isInTransaction()) {
105
114
  logger.trace({ types: Object.keys(data) }, 'caching in transaction');
106
- for (const key_ in data) {
107
- const key = key_;
115
+ for (const key in data) {
108
116
  transactionCache[key] = transactionCache[key] || {};
109
117
  Object.assign(transactionCache[key], data[key]);
110
118
  mutations[key] = mutations[key] || {};
@@ -141,7 +149,7 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
141
149
  }
142
150
  catch (error) {
143
151
  logger.warn(`failed to commit ${Object.keys(mutations).length} mutations, tries left=${tries}`);
144
- await delay(delayBetweenTriesMs);
152
+ await (0, generics_1.delay)(delayBetweenTriesMs);
145
153
  }
146
154
  }
147
155
  }
@@ -165,15 +173,16 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
165
173
  return transactionsInProgress > 0;
166
174
  }
167
175
  };
168
- export const initAuthCreds = () => {
169
- const identityKey = Curve.generateKeyPair();
176
+ exports.addTransactionCapability = addTransactionCapability;
177
+ const initAuthCreds = () => {
178
+ const identityKey = crypto_2.Curve.generateKeyPair();
170
179
  return {
171
- noiseKey: Curve.generateKeyPair(),
172
- pairingEphemeralKeyPair: Curve.generateKeyPair(),
180
+ noiseKey: crypto_2.Curve.generateKeyPair(),
181
+ pairingEphemeralKeyPair: crypto_2.Curve.generateKeyPair(),
173
182
  signedIdentityKey: identityKey,
174
- signedPreKey: signedKeyPair(identityKey, 1),
175
- registrationId: generateRegistrationId(),
176
- advSecretKey: randomBytes(32).toString('base64'),
183
+ signedPreKey: (0, crypto_2.signedKeyPair)(identityKey, 1),
184
+ registrationId: (0, generics_1.generateRegistrationId)(),
185
+ advSecretKey: (0, crypto_1.randomBytes)(32).toString('base64'),
177
186
  processedHistoryMessages: [],
178
187
  nextPreKeyId: 1,
179
188
  firstUnuploadedPreKeyId: 1,
@@ -187,4 +196,4 @@ export const initAuthCreds = () => {
187
196
  routingInfo: undefined
188
197
  };
189
198
  };
190
- //# sourceMappingURL=auth-utils.js.map
199
+ exports.initAuthCreds = initAuthCreds;
@@ -1,4 +1,4 @@
1
- import type { BaileysEventEmitter } from '../Types/index.js';
1
+ import type { BaileysEventEmitter } from '../Types';
2
2
  /**
3
3
  * Captures events from a baileys event emitter & stores them in a file
4
4
  * @param ev The event emitter to read events from
@@ -14,4 +14,3 @@ export declare const readAndEmitEventStream: (filename: string, delayIntervalMs?
14
14
  ev: BaileysEventEmitter;
15
15
  task: Promise<void>;
16
16
  };
17
- //# sourceMappingURL=baileys-event-stream.d.ts.map
@@ -1,39 +1,46 @@
1
- import EventEmitter from 'events';
2
- import { createReadStream } from 'fs';
3
- import { writeFile } from 'fs/promises';
4
- import { createInterface } from 'readline';
5
- import { delay } from './generics.js';
6
- import { makeMutex } from './make-mutex.js';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readAndEmitEventStream = exports.captureEventStream = void 0;
7
+ const events_1 = __importDefault(require("events"));
8
+ const fs_1 = require("fs");
9
+ const promises_1 = require("fs/promises");
10
+ const readline_1 = require("readline");
11
+ const generics_1 = require("./generics");
12
+ const make_mutex_1 = require("./make-mutex");
7
13
  /**
8
14
  * Captures events from a baileys event emitter & stores them in a file
9
15
  * @param ev The event emitter to read events from
10
16
  * @param filename File to save to
11
17
  */
12
- export const captureEventStream = (ev, filename) => {
18
+ const captureEventStream = (ev, filename) => {
13
19
  const oldEmit = ev.emit;
14
20
  // write mutex so data is appended in order
15
- const writeMutex = makeMutex();
21
+ const writeMutex = (0, make_mutex_1.makeMutex)();
16
22
  // monkey patch eventemitter to capture all events
17
23
  ev.emit = function (...args) {
18
24
  const content = JSON.stringify({ timestamp: Date.now(), event: args[0], data: args[1] }) + '\n';
19
25
  const result = oldEmit.apply(ev, args);
20
26
  writeMutex.mutex(async () => {
21
- await writeFile(filename, content, { flag: 'a' });
27
+ await (0, promises_1.writeFile)(filename, content, { flag: 'a' });
22
28
  });
23
29
  return result;
24
30
  };
25
31
  };
32
+ exports.captureEventStream = captureEventStream;
26
33
  /**
27
34
  * Read event file and emit events from there
28
35
  * @param filename filename containing event data
29
36
  * @param delayIntervalMs delay between each event emit
30
37
  */
31
- export const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
32
- const ev = new EventEmitter();
38
+ const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
39
+ const ev = new events_1.default();
33
40
  const fireEvents = async () => {
34
41
  // from: https://stackoverflow.com/questions/6156501/read-a-file-one-line-at-a-time-in-node-js
35
- const fileStream = createReadStream(filename);
36
- const rl = createInterface({
42
+ const fileStream = (0, fs_1.createReadStream)(filename);
43
+ const rl = (0, readline_1.createInterface)({
37
44
  input: fileStream,
38
45
  crlfDelay: Infinity
39
46
  });
@@ -43,7 +50,7 @@ export const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
43
50
  if (line) {
44
51
  const { event, data } = JSON.parse(line);
45
52
  ev.emit(event, data);
46
- delayIntervalMs && (await delay(delayIntervalMs));
53
+ delayIntervalMs && (await (0, generics_1.delay)(delayIntervalMs));
47
54
  }
48
55
  }
49
56
  fileStream.close();
@@ -53,4 +60,4 @@ export const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
53
60
  task: fireEvents()
54
61
  };
55
62
  };
56
- //# sourceMappingURL=baileys-event-stream.js.map
63
+ exports.readAndEmitEventStream = readAndEmitEventStream;
@@ -1,5 +1,5 @@
1
- import type { CatalogCollection, OrderDetails, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types/index.js';
2
- import { type BinaryNode } from '../WABinary/index.js';
1
+ import { CatalogCollection, OrderDetails, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types';
2
+ import { BinaryNode } from '../WABinary';
3
3
  export declare const parseCatalogNode: (node: BinaryNode) => {
4
4
  products: Product[];
5
5
  nextPageCursor: string | undefined;
@@ -20,4 +20,3 @@ export declare function uploadingNecessaryImagesOfProduct<T extends ProductUpdat
20
20
  export declare const uploadingNecessaryImages: (images: WAMediaUpload[], waUploadToServer: WAMediaUploadFunction, timeoutMs?: number) => Promise<{
21
21
  url: string;
22
22
  }[]>;
23
- //# sourceMappingURL=business.d.ts.map
@@ -1,26 +1,31 @@
1
- import { Boom } from '@hapi/boom';
2
- import { createHash } from 'crypto';
3
- import { createWriteStream, promises as fs } from 'fs';
4
- import { tmpdir } from 'os';
5
- import { join } from 'path';
6
- import { getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString } from '../WABinary/index.js';
7
- import { generateMessageIDV2 } from './generics.js';
8
- import { getStream, getUrlFromDirectPath } from './messages-media.js';
9
- export const parseCatalogNode = (node) => {
10
- const catalogNode = getBinaryNodeChild(node, 'product_catalog');
11
- const products = getBinaryNodeChildren(catalogNode, 'product').map(parseProductNode);
12
- const paging = getBinaryNodeChild(catalogNode, 'paging');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadingNecessaryImages = exports.parseProductNode = exports.toProductNode = exports.parseOrderDetailsNode = exports.parseCollectionsNode = exports.parseCatalogNode = void 0;
4
+ exports.uploadingNecessaryImagesOfProduct = uploadingNecessaryImagesOfProduct;
5
+ const boom_1 = require("@hapi/boom");
6
+ const crypto_1 = require("crypto");
7
+ const fs_1 = require("fs");
8
+ const os_1 = require("os");
9
+ const path_1 = require("path");
10
+ const WABinary_1 = require("../WABinary");
11
+ const generics_1 = require("./generics");
12
+ const messages_media_1 = require("./messages-media");
13
+ const parseCatalogNode = (node) => {
14
+ const catalogNode = (0, WABinary_1.getBinaryNodeChild)(node, 'product_catalog');
15
+ const products = (0, WABinary_1.getBinaryNodeChildren)(catalogNode, 'product').map(exports.parseProductNode);
16
+ const paging = (0, WABinary_1.getBinaryNodeChild)(catalogNode, 'paging');
13
17
  return {
14
18
  products,
15
- nextPageCursor: paging ? getBinaryNodeChildString(paging, 'after') : undefined
19
+ nextPageCursor: paging ? (0, WABinary_1.getBinaryNodeChildString)(paging, 'after') : undefined
16
20
  };
17
21
  };
18
- export const parseCollectionsNode = (node) => {
19
- const collectionsNode = getBinaryNodeChild(node, 'collections');
20
- const collections = getBinaryNodeChildren(collectionsNode, 'collection').map(collectionNode => {
21
- const id = getBinaryNodeChildString(collectionNode, 'id');
22
- const name = getBinaryNodeChildString(collectionNode, 'name');
23
- const products = getBinaryNodeChildren(collectionNode, 'product').map(parseProductNode);
22
+ exports.parseCatalogNode = parseCatalogNode;
23
+ const parseCollectionsNode = (node) => {
24
+ const collectionsNode = (0, WABinary_1.getBinaryNodeChild)(node, 'collections');
25
+ const collections = (0, WABinary_1.getBinaryNodeChildren)(collectionsNode, 'collection').map(collectionNode => {
26
+ const id = (0, WABinary_1.getBinaryNodeChildString)(collectionNode, 'id');
27
+ const name = (0, WABinary_1.getBinaryNodeChildString)(collectionNode, 'name');
28
+ const products = (0, WABinary_1.getBinaryNodeChildren)(collectionNode, 'product').map(exports.parseProductNode);
24
29
  return {
25
30
  id,
26
31
  name,
@@ -32,30 +37,32 @@ export const parseCollectionsNode = (node) => {
32
37
  collections
33
38
  };
34
39
  };
35
- export const parseOrderDetailsNode = (node) => {
36
- const orderNode = getBinaryNodeChild(node, 'order');
37
- const products = getBinaryNodeChildren(orderNode, 'product').map(productNode => {
38
- const imageNode = getBinaryNodeChild(productNode, 'image');
40
+ exports.parseCollectionsNode = parseCollectionsNode;
41
+ const parseOrderDetailsNode = (node) => {
42
+ const orderNode = (0, WABinary_1.getBinaryNodeChild)(node, 'order');
43
+ const products = (0, WABinary_1.getBinaryNodeChildren)(orderNode, 'product').map(productNode => {
44
+ const imageNode = (0, WABinary_1.getBinaryNodeChild)(productNode, 'image');
39
45
  return {
40
- id: getBinaryNodeChildString(productNode, 'id'),
41
- name: getBinaryNodeChildString(productNode, 'name'),
42
- imageUrl: getBinaryNodeChildString(imageNode, 'url'),
43
- price: +getBinaryNodeChildString(productNode, 'price'),
44
- currency: getBinaryNodeChildString(productNode, 'currency'),
45
- quantity: +getBinaryNodeChildString(productNode, 'quantity')
46
+ id: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'id'),
47
+ name: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'name'),
48
+ imageUrl: (0, WABinary_1.getBinaryNodeChildString)(imageNode, 'url'),
49
+ price: +(0, WABinary_1.getBinaryNodeChildString)(productNode, 'price'),
50
+ currency: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'currency'),
51
+ quantity: +(0, WABinary_1.getBinaryNodeChildString)(productNode, 'quantity')
46
52
  };
47
53
  });
48
- const priceNode = getBinaryNodeChild(orderNode, 'price');
54
+ const priceNode = (0, WABinary_1.getBinaryNodeChild)(orderNode, 'price');
49
55
  const orderDetails = {
50
56
  price: {
51
- total: +getBinaryNodeChildString(priceNode, 'total'),
52
- currency: getBinaryNodeChildString(priceNode, 'currency')
57
+ total: +(0, WABinary_1.getBinaryNodeChildString)(priceNode, 'total'),
58
+ currency: (0, WABinary_1.getBinaryNodeChildString)(priceNode, 'currency')
53
59
  },
54
60
  products
55
61
  };
56
62
  return orderDetails;
57
63
  };
58
- export const toProductNode = (productId, product) => {
64
+ exports.parseOrderDetailsNode = parseOrderDetailsNode;
65
+ const toProductNode = (productId, product) => {
59
66
  const attrs = {};
60
67
  const content = [];
61
68
  if (typeof productId !== 'undefined') {
@@ -92,7 +99,7 @@ export const toProductNode = (productId, product) => {
92
99
  attrs: {},
93
100
  content: product.images.map(img => {
94
101
  if (!('url' in img)) {
95
- throw new Boom('Expected img for product to already be uploaded', { statusCode: 400 });
102
+ throw new boom_1.Boom('Expected img for product to already be uploaded', { statusCode: 400 });
96
103
  }
97
104
  return {
98
105
  tag: 'image',
@@ -150,36 +157,38 @@ export const toProductNode = (productId, product) => {
150
157
  };
151
158
  return node;
152
159
  };
153
- export const parseProductNode = (productNode) => {
160
+ exports.toProductNode = toProductNode;
161
+ const parseProductNode = (productNode) => {
154
162
  const isHidden = productNode.attrs.is_hidden === 'true';
155
- const id = getBinaryNodeChildString(productNode, 'id');
156
- const mediaNode = getBinaryNodeChild(productNode, 'media');
157
- const statusInfoNode = getBinaryNodeChild(productNode, 'status_info');
163
+ const id = (0, WABinary_1.getBinaryNodeChildString)(productNode, 'id');
164
+ const mediaNode = (0, WABinary_1.getBinaryNodeChild)(productNode, 'media');
165
+ const statusInfoNode = (0, WABinary_1.getBinaryNodeChild)(productNode, 'status_info');
158
166
  const product = {
159
167
  id,
160
168
  imageUrls: parseImageUrls(mediaNode),
161
169
  reviewStatus: {
162
- whatsapp: getBinaryNodeChildString(statusInfoNode, 'status')
170
+ whatsapp: (0, WABinary_1.getBinaryNodeChildString)(statusInfoNode, 'status')
163
171
  },
164
172
  availability: 'in stock',
165
- name: getBinaryNodeChildString(productNode, 'name'),
166
- retailerId: getBinaryNodeChildString(productNode, 'retailer_id'),
167
- url: getBinaryNodeChildString(productNode, 'url'),
168
- description: getBinaryNodeChildString(productNode, 'description'),
169
- price: +getBinaryNodeChildString(productNode, 'price'),
170
- currency: getBinaryNodeChildString(productNode, 'currency'),
173
+ name: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'name'),
174
+ retailerId: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'retailer_id'),
175
+ url: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'url'),
176
+ description: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'description'),
177
+ price: +(0, WABinary_1.getBinaryNodeChildString)(productNode, 'price'),
178
+ currency: (0, WABinary_1.getBinaryNodeChildString)(productNode, 'currency'),
171
179
  isHidden
172
180
  };
173
181
  return product;
174
182
  };
183
+ exports.parseProductNode = parseProductNode;
175
184
  /**
176
185
  * Uploads images not already uploaded to WA's servers
177
186
  */
178
- export async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 30000) {
187
+ async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 30000) {
179
188
  product = {
180
189
  ...product,
181
190
  images: product.images
182
- ? await uploadingNecessaryImages(product.images, waUploadToServer, timeoutMs)
191
+ ? await (0, exports.uploadingNecessaryImages)(product.images, waUploadToServer, timeoutMs)
183
192
  : product.images
184
193
  };
185
194
  return product;
@@ -187,7 +196,7 @@ export async function uploadingNecessaryImagesOfProduct(product, waUploadToServe
187
196
  /**
188
197
  * Uploads images not already uploaded to WA's servers
189
198
  */
190
- export const uploadingNecessaryImages = async (images, waUploadToServer, timeoutMs = 30000) => {
199
+ const uploadingNecessaryImages = async (images, waUploadToServer, timeoutMs = 30000) => {
191
200
  const results = await Promise.all(images.map(async (img) => {
192
201
  if ('url' in img) {
193
202
  const url = img.url.toString();
@@ -195,10 +204,10 @@ export const uploadingNecessaryImages = async (images, waUploadToServer, timeout
195
204
  return { url };
196
205
  }
197
206
  }
198
- const { stream } = await getStream(img);
199
- const hasher = createHash('sha256');
200
- const filePath = join(tmpdir(), 'img' + generateMessageIDV2());
201
- const encFileWriteStream = createWriteStream(filePath);
207
+ const { stream } = await (0, messages_media_1.getStream)(img);
208
+ const hasher = (0, crypto_1.createHash)('sha256');
209
+ const filePath = (0, path_1.join)((0, os_1.tmpdir)(), 'img' + (0, generics_1.generateMessageIDV2)());
210
+ const encFileWriteStream = (0, fs_1.createWriteStream)(filePath);
202
211
  for await (const block of stream) {
203
212
  hasher.update(block);
204
213
  encFileWriteStream.write(block);
@@ -209,23 +218,23 @@ export const uploadingNecessaryImages = async (images, waUploadToServer, timeout
209
218
  fileEncSha256B64: sha,
210
219
  timeoutMs
211
220
  });
212
- await fs.unlink(filePath).catch(err => console.log('Error deleting temp file ', err));
213
- return { url: getUrlFromDirectPath(directPath) };
221
+ await fs_1.promises.unlink(filePath).catch(err => console.log('Error deleting temp file ', err));
222
+ return { url: (0, messages_media_1.getUrlFromDirectPath)(directPath) };
214
223
  }));
215
224
  return results;
216
225
  };
226
+ exports.uploadingNecessaryImages = uploadingNecessaryImages;
217
227
  const parseImageUrls = (mediaNode) => {
218
- const imgNode = getBinaryNodeChild(mediaNode, 'image');
228
+ const imgNode = (0, WABinary_1.getBinaryNodeChild)(mediaNode, 'image');
219
229
  return {
220
- requested: getBinaryNodeChildString(imgNode, 'request_image_url'),
221
- original: getBinaryNodeChildString(imgNode, 'original_image_url')
230
+ requested: (0, WABinary_1.getBinaryNodeChildString)(imgNode, 'request_image_url'),
231
+ original: (0, WABinary_1.getBinaryNodeChildString)(imgNode, 'original_image_url')
222
232
  };
223
233
  };
224
234
  const parseStatusInfo = (mediaNode) => {
225
- const node = getBinaryNodeChild(mediaNode, 'status_info');
235
+ const node = (0, WABinary_1.getBinaryNodeChild)(mediaNode, 'status_info');
226
236
  return {
227
- status: getBinaryNodeChildString(node, 'status'),
228
- canAppeal: getBinaryNodeChildString(node, 'can_appeal') === 'true'
237
+ status: (0, WABinary_1.getBinaryNodeChildString)(node, 'status'),
238
+ canAppeal: (0, WABinary_1.getBinaryNodeChildString)(node, 'can_appeal') === 'true'
229
239
  };
230
240
  };
231
- //# sourceMappingURL=business.js.map
@@ -1,8 +1,8 @@
1
- import type { AxiosRequestConfig } from 'axios';
2
- import { proto } from '../../WAProto/index.js';
3
- import type { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types/index.js';
4
- import { type BinaryNode } from '../WABinary/index.js';
5
- import type { ILogger } from './logger.js';
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { proto } from '../../WAProto';
3
+ import { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';
4
+ import { BinaryNode } from '../WABinary';
5
+ import { ILogger } from './logger';
6
6
  type FetchAppStateSyncKey = (keyId: string) => Promise<proto.Message.IAppStateSyncKeyData | null | undefined>;
7
7
  export type ChatMutationMap = {
8
8
  [index: string]: ChatMutation;
@@ -13,7 +13,7 @@ export declare const encodeSyncdPatch: ({ type, index, syncAction, apiVersion, o
13
13
  state: LTHashState;
14
14
  }>;
15
15
  export declare const decodeSyncdMutations: (msgMutations: (proto.ISyncdMutation | proto.ISyncdRecord)[], initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{
16
- hash: Buffer<ArrayBufferLike>;
16
+ hash: Buffer<any>;
17
17
  indexValueMap: {
18
18
  [indexMacBase64: string]: {
19
19
  valueMac: Uint8Array | Buffer;
@@ -21,7 +21,7 @@ export declare const decodeSyncdMutations: (msgMutations: (proto.ISyncdMutation
21
21
  };
22
22
  }>;
23
23
  export declare const decodeSyncdPatch: (msg: proto.ISyncdPatch, name: WAPatchName, initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{
24
- hash: Buffer<ArrayBufferLike>;
24
+ hash: Buffer<any>;
25
25
  indexValueMap: {
26
26
  [indexMacBase64: string]: {
27
27
  valueMac: Uint8Array | Buffer;
@@ -68,4 +68,3 @@ export declare const decodePatches: (name: WAPatchName, syncds: proto.ISyncdPatc
68
68
  export declare const chatModificationToAppPatch: (mod: ChatModification, jid: string) => WAPatchCreate;
69
69
  export declare const processSyncAction: (syncAction: ChatMutation, ev: BaileysEventEmitter, me: Contact, initialSyncOpts?: InitialAppStateSyncOptions, logger?: ILogger) => void;
70
70
  export {};
71
- //# sourceMappingURL=chat-utils.d.ts.map