@violetix/baileys 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +3017 -2
  3. package/WAProto/index.d.ts +15932 -0
  4. package/WAProto/index.js +115856 -0
  5. package/engine-requirements.js +13 -0
  6. package/lib/Defaults/index.d.ts +145 -0
  7. package/lib/Defaults/index.d.ts.map +1 -0
  8. package/lib/Defaults/index.js +157 -0
  9. package/lib/Defaults/index.js.map +1 -0
  10. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  12. package/lib/Signal/Group/ciphertext-message.js +12 -0
  13. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  14. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  15. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  16. package/lib/Signal/Group/group-session-builder.js +30 -0
  17. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  18. package/lib/Signal/Group/group_cipher.d.ts +11 -0
  19. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  20. package/lib/Signal/Group/group_cipher.js +82 -0
  21. package/lib/Signal/Group/group_cipher.js.map +1 -0
  22. package/lib/Signal/Group/index.d.ts +12 -0
  23. package/lib/Signal/Group/index.d.ts.map +1 -0
  24. package/lib/Signal/Group/index.js +12 -0
  25. package/lib/Signal/Group/index.js.map +1 -0
  26. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  27. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  28. package/lib/Signal/Group/keyhelper.js +18 -0
  29. package/lib/Signal/Group/keyhelper.js.map +1 -0
  30. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  31. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  32. package/lib/Signal/Group/sender-chain-key.js +26 -0
  33. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  34. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  35. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  36. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  38. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  39. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  40. package/lib/Signal/Group/sender-key-message.js +66 -0
  41. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  42. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  43. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  44. package/lib/Signal/Group/sender-key-name.js +48 -0
  45. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  46. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  47. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  48. package/lib/Signal/Group/sender-key-record.js +41 -0
  49. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  50. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  51. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  52. package/lib/Signal/Group/sender-key-state.js +84 -0
  53. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  54. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  55. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  56. package/lib/Signal/Group/sender-message-key.js +26 -0
  57. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  58. package/lib/Signal/libsignal.d.ts +55 -0
  59. package/lib/Signal/libsignal.d.ts.map +1 -0
  60. package/lib/Signal/libsignal.js +403 -0
  61. package/lib/Signal/libsignal.js.map +1 -0
  62. package/lib/Signal/lid-mapping.d.ts +21 -0
  63. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  64. package/lib/Signal/lid-mapping.js +277 -0
  65. package/lib/Signal/lid-mapping.js.map +1 -0
  66. package/lib/Socket/Client/index.d.ts +3 -0
  67. package/lib/Socket/Client/index.d.ts.map +1 -0
  68. package/lib/Socket/Client/index.js +3 -0
  69. package/lib/Socket/Client/index.js.map +1 -0
  70. package/lib/Socket/Client/types.d.ts +6 -0
  71. package/lib/Socket/Client/types.d.ts.map +1 -0
  72. package/lib/Socket/Client/types.js +93 -0
  73. package/lib/Socket/Client/types.js.map +1 -0
  74. package/lib/Socket/Client/websocket.d.ts +13 -0
  75. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  76. package/lib/Socket/Client/websocket.js +57 -0
  77. package/lib/Socket/Client/websocket.js.map +1 -0
  78. package/lib/Socket/business.d.ts +428 -0
  79. package/lib/Socket/business.d.ts.map +1 -0
  80. package/lib/Socket/business.js +380 -0
  81. package/lib/Socket/business.js.map +1 -0
  82. package/lib/Socket/chats.d.ts +176 -0
  83. package/lib/Socket/chats.d.ts.map +1 -0
  84. package/lib/Socket/chats.js +1238 -0
  85. package/lib/Socket/chats.js.map +1 -0
  86. package/lib/Socket/communities.d.ts +595 -0
  87. package/lib/Socket/communities.d.ts.map +1 -0
  88. package/lib/Socket/communities.js +432 -0
  89. package/lib/Socket/communities.js.map +1 -0
  90. package/lib/Socket/graphql.js +908 -0
  91. package/lib/Socket/groups.d.ts +318 -0
  92. package/lib/Socket/groups.d.ts.map +1 -0
  93. package/lib/Socket/groups.js +364 -0
  94. package/lib/Socket/groups.js.map +1 -0
  95. package/lib/Socket/index.d.ts +947 -0
  96. package/lib/Socket/index.d.ts.map +1 -0
  97. package/lib/Socket/index.js +19 -0
  98. package/lib/Socket/index.js.map +1 -0
  99. package/lib/Socket/interop.js +562 -0
  100. package/lib/Socket/managed-account.js +210 -0
  101. package/lib/Socket/messages-recv.d.ts +367 -0
  102. package/lib/Socket/messages-recv.d.ts.map +1 -0
  103. package/lib/Socket/messages-recv.js +2199 -0
  104. package/lib/Socket/messages-recv.js.map +1 -0
  105. package/lib/Socket/messages-send.d.ts +364 -0
  106. package/lib/Socket/messages-send.d.ts.map +1 -0
  107. package/lib/Socket/messages-send.js +1631 -0
  108. package/lib/Socket/messages-send.js.map +1 -0
  109. package/lib/Socket/mex.d.ts +2 -0
  110. package/lib/Socket/mex.d.ts.map +1 -0
  111. package/lib/Socket/mex.js +42 -0
  112. package/lib/Socket/mex.js.map +1 -0
  113. package/lib/Socket/newsletter.d.ts +315 -0
  114. package/lib/Socket/newsletter.d.ts.map +1 -0
  115. package/lib/Socket/newsletter.js +235 -0
  116. package/lib/Socket/newsletter.js.map +1 -0
  117. package/lib/Socket/privacy.js +448 -0
  118. package/lib/Socket/registration.js +430 -0
  119. package/lib/Socket/socket.d.ts +99 -0
  120. package/lib/Socket/socket.d.ts.map +1 -0
  121. package/lib/Socket/socket.js +1290 -0
  122. package/lib/Socket/socket.js.map +1 -0
  123. package/lib/Store/index.d.ts +4 -0
  124. package/lib/Store/index.d.ts.map +1 -0
  125. package/lib/Store/index.js +4 -0
  126. package/lib/Store/index.js.map +1 -0
  127. package/lib/Store/make-in-memory-store.d.ts +63 -0
  128. package/lib/Store/make-in-memory-store.d.ts.map +1 -0
  129. package/lib/Store/make-in-memory-store.js +462 -0
  130. package/lib/Store/make-in-memory-store.js.map +1 -0
  131. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  132. package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
  133. package/lib/Store/make-ordered-dictionary.js +79 -0
  134. package/lib/Store/make-ordered-dictionary.js.map +1 -0
  135. package/lib/Store/object-repository.d.ts +11 -0
  136. package/lib/Store/object-repository.d.ts.map +1 -0
  137. package/lib/Store/object-repository.js +24 -0
  138. package/lib/Store/object-repository.js.map +1 -0
  139. package/lib/Types/Auth.d.ts +60 -0
  140. package/lib/Types/Auth.d.ts.map +1 -0
  141. package/lib/Types/Auth.js +2 -0
  142. package/lib/Types/Auth.js.map +1 -0
  143. package/lib/Types/Bussines.d.ts +9 -0
  144. package/lib/Types/Bussines.d.ts.map +1 -0
  145. package/lib/Types/Bussines.js +2 -0
  146. package/lib/Types/Bussines.js.map +1 -0
  147. package/lib/Types/Call.d.ts +22 -0
  148. package/lib/Types/Call.d.ts.map +1 -0
  149. package/lib/Types/Call.js +2 -0
  150. package/lib/Types/Call.js.map +1 -0
  151. package/lib/Types/Chat.d.ts +3 -0
  152. package/lib/Types/Chat.d.ts.map +1 -0
  153. package/lib/Types/Chat.js +8 -0
  154. package/lib/Types/Chat.js.map +1 -0
  155. package/lib/Types/Contact.d.ts +11 -0
  156. package/lib/Types/Contact.d.ts.map +1 -0
  157. package/lib/Types/Contact.js +2 -0
  158. package/lib/Types/Contact.js.map +1 -0
  159. package/lib/Types/Events.d.ts +41 -0
  160. package/lib/Types/Events.d.ts.map +1 -0
  161. package/lib/Types/Events.js +2 -0
  162. package/lib/Types/Events.js.map +1 -0
  163. package/lib/Types/GroupMetadata.d.ts +36 -0
  164. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  165. package/lib/Types/GroupMetadata.js +2 -0
  166. package/lib/Types/GroupMetadata.js.map +1 -0
  167. package/lib/Types/Label.d.ts +3 -0
  168. package/lib/Types/Label.d.ts.map +1 -0
  169. package/lib/Types/Label.js +25 -0
  170. package/lib/Types/Label.js.map +1 -0
  171. package/lib/Types/LabelAssociation.d.ts +3 -0
  172. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  173. package/lib/Types/LabelAssociation.js +7 -0
  174. package/lib/Types/LabelAssociation.js.map +1 -0
  175. package/lib/Types/Message.d.ts +22 -0
  176. package/lib/Types/Message.d.ts.map +1 -0
  177. package/lib/Types/Message.js +18 -0
  178. package/lib/Types/Message.js.map +1 -0
  179. package/lib/Types/Mex.d.ts +3 -0
  180. package/lib/Types/Mex.d.ts.map +1 -0
  181. package/lib/Types/Mex.js +49 -0
  182. package/lib/Types/Mex.js.map +1 -0
  183. package/lib/Types/Product.d.ts +5 -0
  184. package/lib/Types/Product.d.ts.map +1 -0
  185. package/lib/Types/Product.js +2 -0
  186. package/lib/Types/Product.js.map +1 -0
  187. package/lib/Types/RichType.d.ts +3 -0
  188. package/lib/Types/RichType.d.ts.map +1 -0
  189. package/lib/Types/RichType.js +23 -0
  190. package/lib/Types/RichType.js.map +1 -0
  191. package/lib/Types/Signal.d.ts +10 -0
  192. package/lib/Types/Signal.d.ts.map +1 -0
  193. package/lib/Types/Signal.js +2 -0
  194. package/lib/Types/Signal.js.map +1 -0
  195. package/lib/Types/Socket.d.ts +33 -0
  196. package/lib/Types/Socket.d.ts.map +1 -0
  197. package/lib/Types/Socket.js +2 -0
  198. package/lib/Types/Socket.js.map +1 -0
  199. package/lib/Types/State.d.ts +6 -0
  200. package/lib/Types/State.d.ts.map +1 -0
  201. package/lib/Types/State.js +56 -0
  202. package/lib/Types/State.js.map +1 -0
  203. package/lib/Types/USync.d.ts +9 -0
  204. package/lib/Types/USync.d.ts.map +1 -0
  205. package/lib/Types/USync.js +2 -0
  206. package/lib/Types/USync.js.map +1 -0
  207. package/lib/Types/index.d.ts +16 -0
  208. package/lib/Types/index.d.ts.map +1 -0
  209. package/lib/Types/index.js +26 -0
  210. package/lib/Types/index.js.map +1 -0
  211. package/lib/Utils/a2ui.d.ts +50 -0
  212. package/lib/Utils/a2ui.js +168 -0
  213. package/lib/Utils/anchor-guard.d.ts +71 -0
  214. package/lib/Utils/anchor-guard.js +404 -0
  215. package/lib/Utils/async-utils.js +7 -0
  216. package/lib/Utils/auth-utils.d.ts +59 -0
  217. package/lib/Utils/auth-utils.d.ts.map +1 -0
  218. package/lib/Utils/auth-utils.js +306 -0
  219. package/lib/Utils/auth-utils.js.map +1 -0
  220. package/lib/Utils/browser-utils.d.ts +10 -0
  221. package/lib/Utils/browser-utils.d.ts.map +1 -0
  222. package/lib/Utils/browser-utils.js +29 -0
  223. package/lib/Utils/browser-utils.js.map +1 -0
  224. package/lib/Utils/business.d.ts +50 -0
  225. package/lib/Utils/business.d.ts.map +1 -0
  226. package/lib/Utils/business.js +245 -0
  227. package/lib/Utils/business.js.map +1 -0
  228. package/lib/Utils/chat-utils.d.ts +409 -0
  229. package/lib/Utils/chat-utils.d.ts.map +1 -0
  230. package/lib/Utils/chat-utils.js +872 -0
  231. package/lib/Utils/chat-utils.js.map +1 -0
  232. package/lib/Utils/companion-reg-client-utils.d.ts +10 -0
  233. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  234. package/lib/Utils/companion-reg-client-utils.js +69 -0
  235. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  236. package/lib/Utils/crypto-worker.js +20 -0
  237. package/lib/Utils/crypto.d.ts +40 -0
  238. package/lib/Utils/crypto.d.ts.map +1 -0
  239. package/lib/Utils/crypto.js +118 -0
  240. package/lib/Utils/crypto.js.map +1 -0
  241. package/lib/Utils/decode-wa-message.d.ts +85 -0
  242. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  243. package/lib/Utils/decode-wa-message.js +467 -0
  244. package/lib/Utils/decode-wa-message.js.map +1 -0
  245. package/lib/Utils/event-buffer.d.ts +13 -0
  246. package/lib/Utils/event-buffer.d.ts.map +1 -0
  247. package/lib/Utils/event-buffer.js +651 -0
  248. package/lib/Utils/event-buffer.js.map +1 -0
  249. package/lib/Utils/generics.d.ts +64 -0
  250. package/lib/Utils/generics.d.ts.map +1 -0
  251. package/lib/Utils/generics.js +442 -0
  252. package/lib/Utils/generics.js.map +1 -0
  253. package/lib/Utils/history.d.ts +77 -0
  254. package/lib/Utils/history.d.ts.map +1 -0
  255. package/lib/Utils/history.js +188 -0
  256. package/lib/Utils/history.js.map +1 -0
  257. package/lib/Utils/identity-change-handler.d.ts +14 -0
  258. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  259. package/lib/Utils/identity-change-handler.js +50 -0
  260. package/lib/Utils/identity-change-handler.js.map +1 -0
  261. package/lib/Utils/ignore-key.d.ts +51 -0
  262. package/lib/Utils/ignore-key.js +174 -0
  263. package/lib/Utils/index.d.ts +29 -0
  264. package/lib/Utils/index.d.ts.map +1 -0
  265. package/lib/Utils/index.js +29 -0
  266. package/lib/Utils/index.js.map +1 -0
  267. package/lib/Utils/link-preview.d.ts +13 -0
  268. package/lib/Utils/link-preview.d.ts.map +1 -0
  269. package/lib/Utils/link-preview.js +85 -0
  270. package/lib/Utils/link-preview.js.map +1 -0
  271. package/lib/Utils/listener-guard.js +48 -0
  272. package/lib/Utils/logger.d.ts +3 -0
  273. package/lib/Utils/logger.d.ts.map +1 -0
  274. package/lib/Utils/logger.js +3 -0
  275. package/lib/Utils/logger.js.map +1 -0
  276. package/lib/Utils/lt-hash.d.ts +7 -0
  277. package/lib/Utils/lt-hash.d.ts.map +1 -0
  278. package/lib/Utils/lt-hash.js +8 -0
  279. package/lib/Utils/lt-hash.js.map +1 -0
  280. package/lib/Utils/make-mutex.d.ts +7 -0
  281. package/lib/Utils/make-mutex.d.ts.map +1 -0
  282. package/lib/Utils/make-mutex.js +33 -0
  283. package/lib/Utils/make-mutex.js.map +1 -0
  284. package/lib/Utils/message-retry-manager.d.ts +80 -0
  285. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  286. package/lib/Utils/message-retry-manager.js +285 -0
  287. package/lib/Utils/message-retry-manager.js.map +1 -0
  288. package/lib/Utils/messages-media.d.ts +166 -0
  289. package/lib/Utils/messages-media.d.ts.map +1 -0
  290. package/lib/Utils/messages-media.js +979 -0
  291. package/lib/Utils/messages-media.js.map +1 -0
  292. package/lib/Utils/messages.d.ts +47 -0
  293. package/lib/Utils/messages.d.ts.map +1 -0
  294. package/lib/Utils/messages.js +1959 -0
  295. package/lib/Utils/messages.js.map +1 -0
  296. package/lib/Utils/meta-ai-msmsg.d.ts +12 -0
  297. package/lib/Utils/meta-ai-msmsg.js +124 -0
  298. package/lib/Utils/noise-handler.d.ts +21 -0
  299. package/lib/Utils/noise-handler.d.ts.map +1 -0
  300. package/lib/Utils/noise-handler.js +206 -0
  301. package/lib/Utils/noise-handler.js.map +1 -0
  302. package/lib/Utils/offline-node-processor.d.ts +10 -0
  303. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  304. package/lib/Utils/offline-node-processor.js +40 -0
  305. package/lib/Utils/offline-node-processor.js.map +1 -0
  306. package/lib/Utils/pre-key-manager.d.ts +26 -0
  307. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  308. package/lib/Utils/pre-key-manager.js +106 -0
  309. package/lib/Utils/pre-key-manager.js.map +1 -0
  310. package/lib/Utils/process-message.d.ts +102 -0
  311. package/lib/Utils/process-message.d.ts.map +1 -0
  312. package/lib/Utils/process-message.js +798 -0
  313. package/lib/Utils/process-message.js.map +1 -0
  314. package/lib/Utils/reporting-utils.d.ts +13 -0
  315. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  316. package/lib/Utils/reporting-utils.js +258 -0
  317. package/lib/Utils/reporting-utils.js.map +1 -0
  318. package/lib/Utils/rich-message-utils.d.ts +49 -0
  319. package/lib/Utils/rich-message-utils.d.ts.map +1 -0
  320. package/lib/Utils/rich-message-utils.js +369 -0
  321. package/lib/Utils/rich-message-utils.js.map +1 -0
  322. package/lib/Utils/session-queue.js +33 -0
  323. package/lib/Utils/signal.d.ts +83 -0
  324. package/lib/Utils/signal.d.ts.map +1 -0
  325. package/lib/Utils/signal.js +201 -0
  326. package/lib/Utils/signal.js.map +1 -0
  327. package/lib/Utils/stanza-ack.d.ts +22 -0
  328. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  329. package/lib/Utils/stanza-ack.js +72 -0
  330. package/lib/Utils/stanza-ack.js.map +1 -0
  331. package/lib/Utils/sync-action-utils.d.ts +3 -0
  332. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  333. package/lib/Utils/sync-action-utils.js +49 -0
  334. package/lib/Utils/sync-action-utils.js.map +1 -0
  335. package/lib/Utils/tc-token-utils.d.ts +30 -0
  336. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  337. package/lib/Utils/tc-token-utils.js +164 -0
  338. package/lib/Utils/tc-token-utils.js.map +1 -0
  339. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  340. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  341. package/lib/Utils/use-multi-file-auth-state.js +196 -0
  342. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  343. package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
  344. package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
  345. package/lib/Utils/use-single-file-auth-state.js +118 -0
  346. package/lib/Utils/use-single-file-auth-state.js.map +1 -0
  347. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  348. package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
  349. package/lib/Utils/use-sqlite-auth-state.js +109 -0
  350. package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
  351. package/lib/Utils/validate-connection.d.ts +44 -0
  352. package/lib/Utils/validate-connection.d.ts.map +1 -0
  353. package/lib/Utils/validate-connection.js +210 -0
  354. package/lib/Utils/validate-connection.js.map +1 -0
  355. package/lib/Utils/worker-pool.js +73 -0
  356. package/lib/WABinary/constants.d.ts +62 -0
  357. package/lib/WABinary/constants.d.ts.map +1 -0
  358. package/lib/WABinary/constants.js +1467 -0
  359. package/lib/WABinary/constants.js.map +1 -0
  360. package/lib/WABinary/decode.d.ts +10 -0
  361. package/lib/WABinary/decode.d.ts.map +1 -0
  362. package/lib/WABinary/decode.js +262 -0
  363. package/lib/WABinary/decode.js.map +1 -0
  364. package/lib/WABinary/encode.d.ts +3 -0
  365. package/lib/WABinary/encode.d.ts.map +1 -0
  366. package/lib/WABinary/encode.js +220 -0
  367. package/lib/WABinary/encode.js.map +1 -0
  368. package/lib/WABinary/generic-utils.d.ts +77 -0
  369. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  370. package/lib/WABinary/generic-utils.js +226 -0
  371. package/lib/WABinary/generic-utils.js.map +1 -0
  372. package/lib/WABinary/index.d.ts +6 -0
  373. package/lib/WABinary/index.d.ts.map +1 -0
  374. package/lib/WABinary/index.js +6 -0
  375. package/lib/WABinary/index.js.map +1 -0
  376. package/lib/WABinary/jid-utils.d.ts +29 -0
  377. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  378. package/lib/WABinary/jid-utils.js +96 -0
  379. package/lib/WABinary/jid-utils.js.map +1 -0
  380. package/lib/WABinary/types.d.ts +6 -0
  381. package/lib/WABinary/types.d.ts.map +1 -0
  382. package/lib/WABinary/types.js +2 -0
  383. package/lib/WABinary/types.js.map +1 -0
  384. package/lib/WAM/BinaryInfo.d.ts +8 -0
  385. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  386. package/lib/WAM/BinaryInfo.js +10 -0
  387. package/lib/WAM/BinaryInfo.js.map +1 -0
  388. package/lib/WAM/constants.d.ts +34927 -0
  389. package/lib/WAM/constants.d.ts.map +1 -0
  390. package/lib/WAM/constants.js +22853 -0
  391. package/lib/WAM/constants.js.map +1 -0
  392. package/lib/WAM/encode.d.ts +2 -0
  393. package/lib/WAM/encode.d.ts.map +1 -0
  394. package/lib/WAM/encode.js +150 -0
  395. package/lib/WAM/encode.js.map +1 -0
  396. package/lib/WAM/index.d.ts +4 -0
  397. package/lib/WAM/index.d.ts.map +1 -0
  398. package/lib/WAM/index.js +4 -0
  399. package/lib/WAM/index.js.map +1 -0
  400. package/lib/WAUSync/Protocols/USyncBusinessProtocol.d.ts +8 -0
  401. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +99 -0
  402. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
  403. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  404. package/lib/WAUSync/Protocols/USyncContactProtocol.js +53 -0
  405. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  406. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  407. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  408. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  409. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  410. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  411. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  412. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  413. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  414. package/lib/WAUSync/Protocols/USyncFeatureProtocol.d.ts +9 -0
  415. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +70 -0
  416. package/lib/WAUSync/Protocols/USyncPictureProtocol.d.ts +12 -0
  417. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
  418. package/lib/WAUSync/Protocols/USyncSidelistProtocol.d.ts +10 -0
  419. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +25 -0
  420. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  421. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  422. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  423. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  424. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.d.ts +11 -0
  425. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +34 -0
  426. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  427. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  428. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +31 -0
  429. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  430. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  431. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  432. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  433. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  434. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
  435. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  436. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  437. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  438. package/lib/WAUSync/Protocols/index.d.ts +11 -0
  439. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  440. package/lib/WAUSync/Protocols/index.js +11 -0
  441. package/lib/WAUSync/Protocols/index.js.map +1 -0
  442. package/lib/WAUSync/USyncQuery.d.ts +32 -0
  443. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  444. package/lib/WAUSync/USyncQuery.js +185 -0
  445. package/lib/WAUSync/USyncQuery.js.map +1 -0
  446. package/lib/WAUSync/USyncUser.d.ts +25 -0
  447. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  448. package/lib/WAUSync/USyncUser.js +48 -0
  449. package/lib/WAUSync/USyncUser.js.map +1 -0
  450. package/lib/WAUSync/index.d.ts +4 -0
  451. package/lib/WAUSync/index.d.ts.map +1 -0
  452. package/lib/WAUSync/index.js +4 -0
  453. package/lib/WAUSync/index.js.map +1 -0
  454. package/lib/index.d.ts +12 -0
  455. package/lib/index.d.ts.map +1 -0
  456. package/lib/index.js +12 -0
  457. package/lib/index.js.map +1 -0
  458. package/package.json +122 -5
@@ -0,0 +1,188 @@
1
+ import { pipeline } from 'stream/promises';
2
+ import { promisify } from 'util';
3
+ import { createInflate, inflate } from 'zlib';
4
+ import $protobuf from 'protobufjs/minimal.js';
5
+ import { proto } from '../../WAProto/index.js';
6
+ import { WAMessageStubType } from '../Types/index.js';
7
+ import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser } from '../WABinary/index.js';
8
+ import { toNumber } from './generics.js';
9
+ import { normalizeMessageContent } from './messages.js';
10
+ import { downloadContentFromMessage } from './messages-media.js';
11
+ const inflatePromise = promisify(inflate);
12
+ const extractPnFromMessages = (messages) => {
13
+ for (const msgItem of messages) {
14
+ const message = msgItem.message;
15
+ // Only extract from outgoing messages (fromMe: true) in 1:1 chats
16
+ // because userReceipt.userJid is the recipient's JID
17
+ if (!message?.key?.fromMe || !message.userReceipt?.length) {
18
+ continue;
19
+ }
20
+ const userJid = message.userReceipt[0]?.userJid;
21
+ if (userJid && (isPnUser(userJid) || isHostedPnUser(userJid))) {
22
+ return userJid;
23
+ }
24
+ }
25
+ return undefined;
26
+ };
27
+ const HISTORY_SYNC_CONVERSATIONS_FIELD = 2;
28
+ const WIRE_TYPE_LENGTH_DELIMITED = 2;
29
+ /**
30
+ * Decodes a HistorySync one conversation at a time. `proto.HistorySync.decode` materializes
31
+ * the whole tree, so for a large chunk every message of every chat is alive at once; walking
32
+ * the top-level fields instead lets each conversation be reduced and dropped before the next
33
+ * one is decoded. Non-conversation fields are copied raw and decoded together at the end.
34
+ */
35
+ export const decodeHistorySyncStreaming = (buffer, onConversation) => {
36
+ const reader = $protobuf.Reader.create(buffer);
37
+ const rest = [];
38
+ while (reader.pos < reader.len) {
39
+ const start = reader.pos;
40
+ const tag = reader.uint32();
41
+ if (tag >>> 3 === HISTORY_SYNC_CONVERSATIONS_FIELD && (tag & 7) === WIRE_TYPE_LENGTH_DELIMITED) {
42
+ onConversation(proto.Conversation.decode(reader, reader.uint32()));
43
+ }
44
+ else {
45
+ reader.skipType(tag & 7);
46
+ rest.push(buffer.subarray(start, reader.pos));
47
+ }
48
+ }
49
+ return proto.HistorySync.decode(rest.length === 1 ? rest[0] : Buffer.concat(rest));
50
+ };
51
+ const inflateHistoryStream = async (msg, options) => {
52
+ const stream = await downloadContentFromMessage(msg, 'md-msg-hist', { options });
53
+ // Pipe decrypted stream directly through zlib inflate
54
+ // This avoids allocating an intermediate buffer for the compressed data
55
+ const inflater = createInflate();
56
+ const chunks = [];
57
+ inflater.on('data', (chunk) => chunks.push(chunk));
58
+ await pipeline(stream, inflater);
59
+ return Buffer.concat(chunks);
60
+ };
61
+ export const downloadHistory = async (msg, options) => {
62
+ return proto.HistorySync.decode(await inflateHistoryStream(msg, options));
63
+ };
64
+ const createHistoryAccumulator = (logger) => {
65
+ const messages = [];
66
+ const contacts = [];
67
+ const chats = [];
68
+ const convLidPnMappings = [];
69
+ const addConversation = (chat) => {
70
+ contacts.push({
71
+ id: chat.id,
72
+ name: chat.displayName || chat.name || chat.username || undefined,
73
+ username: chat.username || undefined,
74
+ lid: chat.lidJid || chat.accountLid || undefined,
75
+ phoneNumber: chat.pnJid || undefined
76
+ });
77
+ const chatId = chat.id;
78
+ const isLid = isLidUser(chatId) || isHostedLidUser(chatId);
79
+ const isPn = isPnUser(chatId) || isHostedPnUser(chatId);
80
+ if (isLid && chat.pnJid) {
81
+ convLidPnMappings.push({ lid: chatId, pn: chat.pnJid });
82
+ }
83
+ else if (isPn && chat.lidJid) {
84
+ convLidPnMappings.push({ lid: chat.lidJid, pn: chatId });
85
+ }
86
+ else if (isLid && !chat.pnJid) {
87
+ // Fallback: extract PN from userReceipt in messages when pnJid is missing
88
+ const pnFromReceipt = extractPnFromMessages(chat.messages || []);
89
+ if (pnFromReceipt) {
90
+ convLidPnMappings.push({ lid: chatId, pn: pnFromReceipt });
91
+ }
92
+ }
93
+ const msgs = chat.messages || [];
94
+ delete chat.messages;
95
+ for (const item of msgs) {
96
+ const message = item.message;
97
+ messages.push(message);
98
+ if (!chat.messages?.length) {
99
+ // keep only the most recent message in the chat array
100
+ chat.messages = [{ message }];
101
+ }
102
+ if (!message.key.fromMe && !chat.lastMessageRecvTimestamp) {
103
+ chat.lastMessageRecvTimestamp = toNumber(message.messageTimestamp);
104
+ }
105
+ if ((message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP ||
106
+ message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB) &&
107
+ message.messageStubParameters?.[0]) {
108
+ contacts.push({
109
+ id: message.participant || message.key.participant || message.key.remoteJid,
110
+ verifiedName: message.messageStubParameters?.[0]
111
+ });
112
+ }
113
+ }
114
+ chats.push(chat);
115
+ };
116
+ const finish = (item) => {
117
+ logger?.trace({ progress: item.progress }, 'processing history of type ' + item.syncType?.toString());
118
+ // Extract LID-PN mappings for all sync types
119
+ const lidPnMappings = [];
120
+ for (const m of item.phoneNumberToLidMappings || []) {
121
+ if (m.lidJid && m.pnJid) {
122
+ lidPnMappings.push({ lid: m.lidJid, pn: m.pnJid });
123
+ }
124
+ }
125
+ switch (item.syncType) {
126
+ case proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
127
+ case proto.HistorySync.HistorySyncType.RECENT:
128
+ case proto.HistorySync.HistorySyncType.FULL:
129
+ case proto.HistorySync.HistorySyncType.ON_DEMAND:
130
+ for (const chat of item.conversations || []) {
131
+ addConversation(chat);
132
+ }
133
+ break;
134
+ case proto.HistorySync.HistorySyncType.PUSH_NAME:
135
+ for (const c of item.pushnames || []) {
136
+ contacts.push({ id: c.id, notify: c.pushname });
137
+ }
138
+ break;
139
+ }
140
+ return {
141
+ chats,
142
+ contacts,
143
+ messages,
144
+ lidPnMappings: [...lidPnMappings, ...convLidPnMappings],
145
+ pastParticipants: item.pastParticipants,
146
+ syncType: item.syncType,
147
+ progress: item.progress
148
+ };
149
+ };
150
+ return { addConversation, finish };
151
+ };
152
+ export const processHistoryMessage = (item, logger) => createHistoryAccumulator(logger).finish(item);
153
+ const HISTORY_SYNC_TYPE_FIELD = 1;
154
+ const CONVERSATION_SYNC_TYPES = new Set([
155
+ proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
156
+ proto.HistorySync.HistorySyncType.RECENT,
157
+ proto.HistorySync.HistorySyncType.FULL,
158
+ proto.HistorySync.HistorySyncType.ON_DEMAND
159
+ ]);
160
+ /** Reads only the `syncType` varint, skipping every other field without decoding it. */
161
+ const peekHistorySyncType = (buffer) => {
162
+ const reader = $protobuf.Reader.create(buffer);
163
+ while (reader.pos < reader.len) {
164
+ const tag = reader.uint32();
165
+ if (tag >>> 3 === HISTORY_SYNC_TYPE_FIELD && (tag & 7) === 0) {
166
+ return reader.int32();
167
+ }
168
+ reader.skipType(tag & 7);
169
+ }
170
+ return undefined;
171
+ };
172
+ export const downloadAndProcessHistorySyncNotification = async (msg, options, logger) => {
173
+ const buffer = msg.initialHistBootstrapInlinePayload
174
+ ? await inflatePromise(msg.initialHistBootstrapInlinePayload)
175
+ : await inflateHistoryStream(msg, options);
176
+ const acc = createHistoryAccumulator(logger);
177
+ // conversations are reduced as they are decoded, only for the sync types that carry chats
178
+ // (same gate as processHistoryMessage); `rest` holds every other field
179
+ const wantsConversations = CONVERSATION_SYNC_TYPES.has(peekHistorySyncType(buffer));
180
+ const rest = decodeHistorySyncStreaming(buffer, wantsConversations ? acc.addConversation : () => { });
181
+ return acc.finish(rest);
182
+ };
183
+ export const getHistoryMsg = (message) => {
184
+ const normalizedContent = !!message ? normalizeMessageContent(message) : undefined;
185
+ const anyHistoryMsg = normalizedContent?.protocolMessage?.historySyncNotification;
186
+ return anyHistoryMsg;
187
+ };
188
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/Utils/history.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAC1C,MAAM,qBAAqB,GAAG,CAAC,QAAQ,E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AAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KAC1B,CAAC;AACN,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,yCAAyC,GAAG,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACpF,IAAI,UAAU,CAAC;IACf,IAAI,GAAG,CAAC,iCAAiC,EAAE,CAAC;QACxC,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,cAAc,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACvG,CAAC;SACI,CAAC;QACF,UAAU,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,EAAE;IACrC,MAAM,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,MAAM,aAAa,GAAG,iBAAiB,EAAE,eAAe,EAAE,uBAAuB,CAAC;IAClF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export function handleIdentityChange(node: any, ctx: any): Promise<{
2
+ action: string;
3
+ device?: undefined;
4
+ error?: undefined;
5
+ } | {
6
+ action: string;
7
+ device: number;
8
+ error?: undefined;
9
+ } | {
10
+ action: string;
11
+ error: unknown;
12
+ device?: undefined;
13
+ }>;
14
+ //# sourceMappingURL=identity-change-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-change-handler.d.ts","sourceRoot":"","sources":["../../src/Utils/identity-change-handler.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GA6CC"}
@@ -0,0 +1,50 @@
1
+ import NodeCache from '@cacheable/node-cache';
2
+ import { areJidsSameUser, getBinaryNodeChild, jidDecode } from '../WABinary/index.js';
3
+ import { isStringNullOrEmpty } from './generics.js';
4
+ export async function handleIdentityChange(node, ctx) {
5
+ const from = node.attrs.from;
6
+ if (!from) {
7
+ return { action: 'invalid_notification' };
8
+ }
9
+ const identityNode = getBinaryNodeChild(node, 'identity');
10
+ if (!identityNode) {
11
+ return { action: 'no_identity_node' };
12
+ }
13
+ ctx.logger.info({ jid: from }, 'identity changed');
14
+ const decoded = jidDecode(from);
15
+ if (decoded?.device && decoded.device !== 0) {
16
+ ctx.logger.debug({ jid: from, device: decoded.device }, 'ignoring identity change from companion device');
17
+ return { action: 'skipped_companion_device', device: decoded.device };
18
+ }
19
+ const isSelfPrimary = ctx.meId && (areJidsSameUser(from, ctx.meId) || (ctx.meLid && areJidsSameUser(from, ctx.meLid)));
20
+ if (isSelfPrimary) {
21
+ ctx.logger.info({ jid: from }, 'self primary identity changed');
22
+ return { action: 'skipped_self_primary' };
23
+ }
24
+ if (ctx.debounceCache.get(from)) {
25
+ ctx.logger.debug({ jid: from }, 'skipping identity assert (debounced)');
26
+ return { action: 'debounced' };
27
+ }
28
+ ctx.debounceCache.set(from, true);
29
+ const isOfflineNotification = !isStringNullOrEmpty(node.attrs.offline);
30
+ const hasExistingSession = await ctx.validateSession(from);
31
+ if (!hasExistingSession.exists) {
32
+ ctx.logger.debug({ jid: from }, 'no old session, skipping session refresh');
33
+ return { action: 'skipped_no_session' };
34
+ }
35
+ ctx.logger.debug({ jid: from }, 'old session exists, will refresh session');
36
+ if (isOfflineNotification) {
37
+ ctx.logger.debug({ jid: from }, 'skipping session refresh during offline processing');
38
+ return { action: 'skipped_offline' };
39
+ }
40
+ ctx.onBeforeSessionRefresh?.(from);
41
+ try {
42
+ await ctx.assertSessions([from], true);
43
+ return { action: 'session_refreshed' };
44
+ }
45
+ catch (error) {
46
+ ctx.logger.warn({ error, jid: from }, 'failed to assert sessions after identity change');
47
+ return { action: 'session_refresh_failed', error };
48
+ }
49
+ }
50
+ //# sourceMappingURL=identity-change-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-change-handler.js","sourceRoot":"","sources":["../../src/Utils/identity-change-handler.js"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAI,EAAE,GAAG;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;IAC9C,CAAC;IACD,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC1C,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,gDAAgD,CAAC,CAAC;QAC1G,OAAO,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAC1E,CAAC;IACD,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,G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tF,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACzC,CAAC;IACD,GAAG,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC;QACD,MAAM,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACX,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,iDAAiD,CAAC,CAAC;QACzF,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC;IACvD,CAAC;AACL,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { BinaryNode } from '../WABinary/index.js';
2
+ export declare const IGNORE_KEY_KINDS: readonly ['message', 'receipt', 'notification', 'presence', 'chatstate', 'call'];
3
+ export type WaIgnoreKeyKind = (typeof IGNORE_KEY_KINDS)[number];
4
+ export type WaIgnoreKeyContext = {
5
+ /** Stanza tag. */
6
+ kind: WaIgnoreKeyKind;
7
+ /** Deviceless chat JID; userless `from` values are kept verbatim. */
8
+ remoteJid: string | null;
9
+ /** Resolved against the account's own PN and LID. */
10
+ fromMe: boolean;
11
+ /** Stanza id. */
12
+ id: string | undefined;
13
+ /** Author in groups / broadcasts; `null` otherwise. */
14
+ participant: string | null;
15
+ };
16
+ export type WaIgnoreKey = {
17
+ /** Chat JID; array entries OR. Alt `sender_pn` / `sender_lid` attrs are matched too. */
18
+ remoteJid?: string | readonly string[];
19
+ /** Whether the stanza was sent by this account. */
20
+ fromMe?: boolean;
21
+ /** Stanza id. */
22
+ id?: string;
23
+ /** Author in groups / broadcasts. Alt forms are matched too. */
24
+ participant?: string;
25
+ /** Restrict to specific tags. Default: all six. */
26
+ only?: readonly WaIgnoreKeyKind[];
27
+ };
28
+ export type WaIgnoreKeyPredicate = (ctx: WaIgnoreKeyContext) => boolean;
29
+ export type WaIgnoreKeyInput = WaIgnoreKey | WaIgnoreKeyPredicate;
30
+ export type WaIgnoreKeyEntry = {
31
+ remoteJid?: string[];
32
+ participant?: string;
33
+ fromMe?: boolean;
34
+ id?: string;
35
+ only?: readonly WaIgnoreKeyKind[];
36
+ predicate?: WaIgnoreKeyPredicate;
37
+ };
38
+ export declare const isIgnorableKind: (tag: string) => boolean;
39
+ export declare const normalizeIgnoreKey: (input: WaIgnoreKeyInput) => WaIgnoreKeyEntry;
40
+ export declare const buildIgnoreContext: (node: BinaryNode, meId?: string, meLid?: string) => WaIgnoreKeyContext;
41
+ export declare const matchesIgnoreKey: (entry: WaIgnoreKeyEntry, ctx: WaIgnoreKeyContext, node: BinaryNode) => boolean;
42
+ export declare const ignoredStanzaNeedsAck: (tag: string) => boolean;
43
+ export declare const makeIgnoreKeyRegistry: (deps: {
44
+ getMeId: () => string | undefined;
45
+ getMeLid: () => string | undefined;
46
+ logger?: any;
47
+ }) => {
48
+ register: (input: WaIgnoreKeyInput) => () => void;
49
+ shouldDrop: (node: BinaryNode) => boolean;
50
+ readonly size: number;
51
+ };
@@ -0,0 +1,174 @@
1
+ import { areJidsSameUser, jidDecode, jidEncode } from '../WABinary/index.js';
2
+ /**
3
+ * Stanza tags a filter may drop. Stream control, `iq` replies and the auth-critical
4
+ * `success` / `failure` tags are deliberately absent so the connection flow stays intact.
5
+ */
6
+ export const IGNORE_KEY_KINDS = ['message', 'receipt', 'notification', 'presence', 'chatstate', 'call'];
7
+ const IGNORE_KEY_KIND_SET = new Set(IGNORE_KEY_KINDS);
8
+ /**
9
+ * Kinds the server re-delivers until acked. Dropping one without an ack makes the server
10
+ * retry it forever, so the filter acks on the handler's behalf. Presence and chat-state are
11
+ * fire-and-forget and must not be acked.
12
+ */
13
+ const ACKED_KINDS = new Set(['message', 'receipt', 'notification', 'call']);
14
+ /**
15
+ * A JID arrives in whichever namespace the sender used, and the alt attributes carry the other
16
+ * form. Matching every one of these lets a filter written with a phone number also catch the
17
+ * LID-addressed copy of the same stanza (and vice versa).
18
+ */
19
+ const REMOTE_JID_ATTRS = ['from', 'sender_pn', 'sender_lid'];
20
+ const PARTICIPANT_ATTRS = ['participant', 'participant_pn', 'participant_lid'];
21
+ const DESCRIPTOR_FIELDS = ['remoteJid', 'fromMe', 'id', 'participant'];
22
+ /** Deviceless user-form JID. Userless values (e.g. `s.whatsapp.net`) are kept verbatim. */
23
+ const stripDevice = (jid) => {
24
+ if (!jid) {
25
+ return null;
26
+ }
27
+ const decoded = jidDecode(jid);
28
+ if (!decoded?.user) {
29
+ return jid;
30
+ }
31
+ return jidEncode(decoded.user, decoded.server);
32
+ };
33
+ /**
34
+ * Compares deviceless JIDs as whole strings rather than by user part. `areJidsSameUser` ignores
35
+ * the server, so it reports `5551234@s.whatsapp.net` and `5551234@lid` as the same user — two
36
+ * unrelated accounts that would then share a filter. Server equality is required here; the
37
+ * PN/LID crossover is handled by the alt attributes instead.
38
+ */
39
+ const sameJid = (a, b) => {
40
+ if (!a || !b) {
41
+ return false;
42
+ }
43
+ return stripDevice(a) === stripDevice(b);
44
+ };
45
+ export const isIgnorableKind = (tag) => IGNORE_KEY_KIND_SET.has(tag);
46
+ /** Validates a descriptor or predicate and freezes it into an internal entry. */
47
+ export const normalizeIgnoreKey = (input) => {
48
+ if (typeof input === 'function') {
49
+ return { predicate: input };
50
+ }
51
+ if (!input || typeof input !== 'object' || Array.isArray(input)) {
52
+ throw new Error('ignoreKey expects a descriptor object or a predicate function');
53
+ }
54
+ if (!DESCRIPTOR_FIELDS.some(field => input[field] !== undefined)) {
55
+ throw new Error('ignoreKey descriptor needs at least one of remoteJid, fromMe, id, participant');
56
+ }
57
+ const entry = {};
58
+ if (input.remoteJid !== undefined) {
59
+ const jids = (Array.isArray(input.remoteJid) ? input.remoteJid : [input.remoteJid]).filter(Boolean);
60
+ if (!jids.length) {
61
+ throw new Error('ignoreKey remoteJid cannot be empty');
62
+ }
63
+ entry.remoteJid = jids;
64
+ }
65
+ if (input.participant !== undefined) {
66
+ if (typeof input.participant !== 'string' || !input.participant) {
67
+ throw new Error('ignoreKey participant must be a non-empty jid');
68
+ }
69
+ entry.participant = input.participant;
70
+ }
71
+ if (input.fromMe !== undefined) {
72
+ entry.fromMe = !!input.fromMe;
73
+ }
74
+ if (input.id !== undefined) {
75
+ if (typeof input.id !== 'string' || !input.id) {
76
+ throw new Error('ignoreKey id must be a non-empty string');
77
+ }
78
+ entry.id = input.id;
79
+ }
80
+ if (input.only !== undefined) {
81
+ const only = Array.isArray(input.only) ? input.only : [input.only];
82
+ if (!only.length) {
83
+ throw new Error('ignoreKey only cannot be empty');
84
+ }
85
+ const unknown = only.filter(kind => !IGNORE_KEY_KIND_SET.has(kind));
86
+ if (unknown.length) {
87
+ throw new Error(`ignoreKey only has unknown kinds: ${unknown.join(', ')}`);
88
+ }
89
+ entry.only = only;
90
+ }
91
+ return entry;
92
+ };
93
+ /**
94
+ * Parses the wire node into the shape filters match on, so a predicate never has to walk a
95
+ * BinaryNode. `remoteJid` and `participant` are device-stripped to line up with the
96
+ * `event.key.remoteJid` a handler would see.
97
+ */
98
+ export const buildIgnoreContext = (node, meId, meLid) => {
99
+ const attrs = node.attrs || {};
100
+ const author = attrs.participant || attrs.participant_pn || attrs.participant_lid || attrs.from;
101
+ const fromMe = !!author && ((!!meId && areJidsSameUser(author, meId)) || (!!meLid && areJidsSameUser(author, meLid)));
102
+ return {
103
+ kind: node.tag,
104
+ remoteJid: stripDevice(attrs.from),
105
+ fromMe,
106
+ id: attrs.id,
107
+ participant: stripDevice(attrs.participant || attrs.participant_pn || attrs.participant_lid)
108
+ };
109
+ };
110
+ export const matchesIgnoreKey = (entry, ctx, node) => {
111
+ if (entry.predicate) {
112
+ return !!entry.predicate(ctx);
113
+ }
114
+ if (entry.only && !entry.only.includes(ctx.kind)) {
115
+ return false;
116
+ }
117
+ if (entry.id !== undefined && entry.id !== ctx.id) {
118
+ return false;
119
+ }
120
+ if (entry.fromMe !== undefined && entry.fromMe !== ctx.fromMe) {
121
+ return false;
122
+ }
123
+ const attrs = node.attrs || {};
124
+ if (entry.remoteJid && !entry.remoteJid.some(wanted => REMOTE_JID_ATTRS.some(attr => sameJid(attrs[attr], wanted)))) {
125
+ return false;
126
+ }
127
+ if (entry.participant && !PARTICIPANT_ATTRS.some(attr => sameJid(attrs[attr], entry.participant))) {
128
+ return false;
129
+ }
130
+ return true;
131
+ };
132
+ export const ignoredStanzaNeedsAck = (tag) => ACKED_KINDS.has(tag);
133
+ /**
134
+ * Holds the registered filters and answers the one question the socket asks per stanza.
135
+ *
136
+ * `category='peer'` traffic from this account's own devices is never dropped: those stanzas
137
+ * carry app-state key shares, history sync and PDO responses between the account's devices, so
138
+ * the common `{ fromMe: true }` filter would otherwise swallow the app-state key share and leave
139
+ * the collections blocked on a key they re-request on every sync. The exemption only applies
140
+ * when the sender really is this account — resolved against both `meJid` and `meLid` — so a
141
+ * foreign stanza cannot dodge a filter by stamping the attribute.
142
+ */
143
+ export const makeIgnoreKeyRegistry = ({ getMeId, getMeLid, logger }) => {
144
+ const entries = new Set();
145
+ const register = (input) => {
146
+ const entry = normalizeIgnoreKey(input);
147
+ entries.add(entry);
148
+ return () => {
149
+ entries.delete(entry);
150
+ };
151
+ };
152
+ const shouldDrop = (node) => {
153
+ if (!entries.size || !isIgnorableKind(node.tag)) {
154
+ return false;
155
+ }
156
+ const ctx = buildIgnoreContext(node, getMeId(), getMeLid());
157
+ if (ctx.fromMe && node.attrs?.category === 'peer') {
158
+ return false;
159
+ }
160
+ for (const entry of entries) {
161
+ try {
162
+ if (matchesIgnoreKey(entry, ctx, node)) {
163
+ return true;
164
+ }
165
+ }
166
+ catch (err) {
167
+ // A throwing predicate must not take the stanza with it; the stanza stays.
168
+ logger?.error({ err, kind: ctx.kind, id: ctx.id }, 'ignoreKey filter threw, keeping stanza');
169
+ }
170
+ }
171
+ return false;
172
+ };
173
+ return { register, shouldDrop, get size() { return entries.size; } };
174
+ };
@@ -0,0 +1,29 @@
1
+ export * from "./generics.js";
2
+ export * from "./decode-wa-message.js";
3
+ export * from "./messages.js";
4
+ export * from "./messages-media.js";
5
+ export * from "./validate-connection.js";
6
+ export * from "./crypto.js";
7
+ export * from "./signal.js";
8
+ export * from "./noise-handler.js";
9
+ export * from "./history.js";
10
+ export * from "./chat-utils.js";
11
+ export * from "./lt-hash.js";
12
+ export * from "./auth-utils.js";
13
+ export * from "./use-multi-file-auth-state.js";
14
+ export * from "./use-single-file-auth-state.js";
15
+ export * from "./use-sqlite-auth-state.js";
16
+ export * from "./link-preview.js";
17
+ export * from "./event-buffer.js";
18
+ export * from "./process-message.js";
19
+ export * from "./rich-message-utils.js";
20
+ export * from "./message-retry-manager.js";
21
+ export * from "./browser-utils.js";
22
+ export * from "./companion-reg-client-utils.js";
23
+ export * from "./identity-change-handler.js";
24
+ export * from "./stanza-ack.js";
25
+ export * from "./ignore-key.js";
26
+ export * from "./anchor-guard.js";
27
+ export * from "./a2ui.js";
28
+ export * from "./meta-ai-msmsg.js";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Utils/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ export * from './generics.js';
2
+ export * from './decode-wa-message.js';
3
+ export * from './messages.js';
4
+ export * from './messages-media.js';
5
+ export * from './validate-connection.js';
6
+ export * from './crypto.js';
7
+ export * from './signal.js';
8
+ export * from './noise-handler.js';
9
+ export * from './history.js';
10
+ export * from './chat-utils.js';
11
+ export * from './lt-hash.js';
12
+ export * from './auth-utils.js';
13
+ export * from './use-multi-file-auth-state.js';
14
+ export * from './use-single-file-auth-state.js';
15
+ export * from './use-sqlite-auth-state.js';
16
+ export * from './link-preview.js';
17
+ export * from './event-buffer.js';
18
+ export * from './process-message.js';
19
+ export * from './rich-message-utils.js';
20
+ export * from './message-retry-manager.js';
21
+ export * from './browser-utils.js';
22
+ export * from './companion-reg-client-utils.js';
23
+ export * from './identity-change-handler.js';
24
+ export * from './stanza-ack.js';
25
+ export * from './ignore-key.js';
26
+ export * from './anchor-guard.js';
27
+ export * from './a2ui.js';
28
+ export * from './meta-ai-msmsg.js';
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Utils/index.js"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export function getUrlInfo(text: any, opts?: {
2
+ thumbnailWidth: number;
3
+ fetchOpts: {
4
+ timeout: number;
5
+ };
6
+ }): Promise<{
7
+ 'canonical-url': any;
8
+ 'matched-text': any;
9
+ title: any;
10
+ description: any;
11
+ originalThumbnailUrl: any;
12
+ } | undefined>;
13
+ //# sourceMappingURL=link-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-preview.d.ts","sourceRoot":"","sources":["../../src/Utils/link-preview.js"],"names":[],"mappings":"AAeO;;;;;;;;;;;eAoEN"}