@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,49 @@
1
+ export var XWAPaths;
2
+ (function (XWAPaths) {
3
+ XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
4
+ XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
5
+ XWAPaths["xwa2_newsletter_subscribed"] = "xwa2_newsletter_subscribed";
6
+ XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
7
+ XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
8
+ XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
9
+ XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
10
+ XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
11
+ XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
12
+ XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
13
+ XWAPaths["xwa2_newsletter_join_v2"] = "xwa2_newsletter_join_v2";
14
+ XWAPaths["xwa2_newsletter_leave_v2"] = "xwa2_newsletter_leave_v2";
15
+ XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
16
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
17
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
18
+ XWAPaths["xwa2_fetch_account_reachout_timelock"] = "xwa2_fetch_account_reachout_timelock";
19
+ XWAPaths["xwa2_message_capping_info"] = "xwa2_message_capping_info";
20
+ XWAPaths["xwa2_username_check"] = "xwa2_username_check";
21
+ XWAPaths["xwa2_username_set"] = "xwa2_username_set";
22
+ XWAPaths["xwa2_username_delete"] = "xwa2_username_delete";
23
+ XWAPaths["xwa2_username_get"] = "xwa2_username_get";
24
+ XWAPaths["xwa2_username_pin_set"] = "xwa2_username_pin_set";
25
+ })(XWAPaths || (XWAPaths = {}));
26
+ export var QueryIds;
27
+ (function (QueryIds) {
28
+ QueryIds["CREATE"] = "8823471724422422";
29
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
30
+ QueryIds["METADATA"] = "6563316087068696";
31
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
32
+ QueryIds["SUBSCRIBED"] = "6388546374527196";
33
+ QueryIds["FOLLOW"] = "24404358912487870";
34
+ QueryIds["UNFOLLOW"] = "9767147403369991";
35
+ QueryIds["MUTE"] = "29766401636284406";
36
+ QueryIds["UNMUTE"] = "9864994326891137";
37
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
38
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
39
+ QueryIds["DEMOTE"] = "6551828931592903";
40
+ QueryIds["DELETE"] = "30062808666639665";
41
+ QueryIds["REACHOUT_TIMELOCK"] = "23983697327930364";
42
+ QueryIds["MESSAGE_CAPPING_INFO"] = "24503548349331633";
43
+ // Username query ids, captured from WA 2.26.26.4 (Settings > Profile > Username)
44
+ QueryIds["USERNAME_CHECK"] = "26124072630599518";
45
+ QueryIds["USERNAME_SET"] = "27108705368767936";
46
+ QueryIds["USERNAME_GET"] = "32618050064506055";
47
+ QueryIds["USERNAME_PIN_SET"] = "25529696019976770";
48
+ })(QueryIds || (QueryIds = {}));
49
+ //# sourceMappingURL=Mex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mex.js","sourceRoot":"","sources":["../../src/Types/Mex.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,QAAQ,CAAC;AACpB,CAAC,UAAU,QAAQ;IACf,QAAQ,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAC;IAC9D,QAAQ,CAAC,6BAA6B,CAAC,GAAG,6BAA6B,CAAC;IACxE,QAAQ,CAAC,4BAA4B,CAAC,GAAG,4BAA4B,CAAC;IACtE,QAAQ,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IAC1D,QAAQ,CAAC,0BAA0B,CAAC,GAAG,iBAAiB,CAAC;IACzD,QAAQ,CAAC,6BAA6B,CAAC,GAAG,uBAAuB,CAAC;IAClE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;IAChE,QAAQ,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;IACpE,QAAQ,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAC;IAC9D,QAAQ,CAAC,0BAA0B,CAAC,GAAG,0BAA0B,CAAC;IAClE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;IAChE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,0BAA0B,CAAC;IAClE,QAAQ,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC;IAC1E,QAAQ,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAC;IAC9D,QAAQ,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;IACpE,QAAQ,CAAC,sCAAsC,CAAC,GAAG,sCAAsC,CAAC;IAC1F,QAAQ,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;AACxE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;AAChC,MAAM,CAAC,IAAI,QAAQ,CAAC;AACpB,CAAC,UAAU,QAAQ;IACf,QAAQ,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;IACxC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,mBAAmB,CAAC;IAClD,QAAQ,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,GAAG,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,GAAG,mBAAmB,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;IACxC,QAAQ,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC;IACzC,QAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;IACpD,QAAQ,CAAC,sBAAsB,CAAC,GAAG,mBAAmB,CAAC;AAC3D,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { makeBusinessSocket } from '../Socket/business.js';
2
+ export type Product = Awaited<ReturnType<ReturnType<typeof makeBusinessSocket>['productCreate']>>;
3
+ export type CatalogResult = { products: Product[]; nextPageCursor?: string };
4
+ export type ProductUpdate = Partial<Pick<Product, 'name' | 'description' | 'price' | 'currency' | 'retailerId' | 'url' | 'isHidden' | 'availability'>>;
5
+ export type ProductCreate = ProductUpdate & { name: string; price: number; currency: string; images: import('./Message.js').WAMediaUpload[] };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Product.d.ts","sourceRoot":"","sources":["../../src/Types/Product.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Product.js","sourceRoot":"","sources":["../../src/Types/Product.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export const CodeHighlightType: any;
2
+ export const RichSubMessageType: any;
3
+ //# sourceMappingURL=RichType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichType.d.ts","sourceRoot":"","sources":["../../src/Types/RichType.js"],"names":[],"mappings":"AAAA,oCAA6B;AAS7B,qCAA8B"}
@@ -0,0 +1,23 @@
1
+ export var CodeHighlightType;
2
+ (function (CodeHighlightType) {
3
+ CodeHighlightType[CodeHighlightType["DEFAULT"] = 0] = "DEFAULT";
4
+ CodeHighlightType[CodeHighlightType["KEYWORD"] = 1] = "KEYWORD";
5
+ CodeHighlightType[CodeHighlightType["METHOD"] = 2] = "METHOD";
6
+ CodeHighlightType[CodeHighlightType["STRING"] = 3] = "STRING";
7
+ CodeHighlightType[CodeHighlightType["NUMBER"] = 4] = "NUMBER";
8
+ CodeHighlightType[CodeHighlightType["COMMENT"] = 5] = "COMMENT";
9
+ })(CodeHighlightType || (CodeHighlightType = {}));
10
+ export var RichSubMessageType;
11
+ (function (RichSubMessageType) {
12
+ RichSubMessageType[RichSubMessageType["UNKNOWN"] = 0] = "UNKNOWN";
13
+ RichSubMessageType[RichSubMessageType["GRID_IMAGE"] = 1] = "GRID_IMAGE";
14
+ RichSubMessageType[RichSubMessageType["TEXT"] = 2] = "TEXT";
15
+ RichSubMessageType[RichSubMessageType["INLINE_IMAGE"] = 3] = "INLINE_IMAGE";
16
+ RichSubMessageType[RichSubMessageType["TABLE"] = 4] = "TABLE";
17
+ RichSubMessageType[RichSubMessageType["CODE"] = 5] = "CODE";
18
+ RichSubMessageType[RichSubMessageType["DYNAMIC"] = 6] = "DYNAMIC";
19
+ RichSubMessageType[RichSubMessageType["MAP"] = 7] = "MAP";
20
+ RichSubMessageType[RichSubMessageType["LATEX"] = 8] = "LATEX";
21
+ RichSubMessageType[RichSubMessageType["CONTENT_ITEMS"] = 9] = "CONTENT_ITEMS";
22
+ })(RichSubMessageType || (RichSubMessageType = {}));
23
+ //# sourceMappingURL=RichType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichType.js","sourceRoot":"","sources":["../../src/Types/RichType.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,iBAAiB,CAAC;AAC7B,CAAC,UAAU,iBAAiB;IACxB,iBAAiB,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAChE,iBAAiB,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAChE,iBAAiB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9D,iBAAiB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9D,iBAAiB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9D,iBAAiB,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;AACpE,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC,CAAC;AAClD,MAAM,CAAC,IAAI,kBAAkB,CAAC;AAC9B,CAAC,UAAU,kBAAkB;IACzB,kBAAkB,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,kBAAkB,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC;IACxE,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IAC5D,kBAAkB,CAAC,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC;IAC5E,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;IAC9D,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IAC5D,kBAAkB,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,kBAAkB,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAC1D,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;IAC9D,kBAAkB,CAAC,kBAAkB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;AAClF,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { makeLibSignalRepository } from '../Signal/libsignal.js';
2
+ export type SignalRepository = ReturnType<typeof makeLibSignalRepository>;
3
+ export type SignalAuthState = import('./Auth.js').AuthenticationState;
4
+ export type E2ESession = {
5
+ jid: string;
6
+ registrationId: number;
7
+ identityKey: Uint8Array;
8
+ signedPreKey: { keyId: number; publicKey: Uint8Array; signature: Uint8Array };
9
+ preKey?: { keyId: number; publicKey: Uint8Array };
10
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../src/Types/Signal.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { proto } from '../../WAProto/index.js';
2
+ //# sourceMappingURL=Signal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Signal.js","sourceRoot":"","sources":["../../src/Types/Signal.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type makeWASocket from '../Socket/index.js';
2
+ import type { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
3
+ import type { AuthenticationState, Awaitable } from './Auth.js';
4
+ import type { GroupMetadata } from './GroupMetadata.js';
5
+ import type { WAMessageContent, WAMessageKey } from './Message.js';
6
+ export type WAVersion = [number, number, number];
7
+ export type WABrowserDescription = [string, string, string];
8
+ export type SocketConfig = Omit<Partial<typeof DEFAULT_CONNECTION_CONFIG>,
9
+ 'auth' | 'version' | 'getMessage' | 'cachedGroupMetadata' | 'shouldIgnoreJid' | 'customUploadHosts' | 'patchMessageBeforeSending'> & {
10
+ auth: AuthenticationState;
11
+ version?: WAVersion | (() => Awaitable<WAVersion>);
12
+ getMessage?: (key: WAMessageKey) => Promise<WAMessageContent | undefined>;
13
+ cachedGroupMetadata?: (jid: string) => Promise<GroupMetadata | undefined>;
14
+ shouldIgnoreJid?: (jid: string) => boolean;
15
+ customUploadHosts?: { hostname: string; maxContentLengthBytes?: number }[];
16
+ patchMessageBeforeSending?: (message: WAMessageContent, recipientJids?: string[]) => Awaitable<
17
+ WAMessageContent | { recipientJid: string; message: WAMessageContent }[]
18
+ >;
19
+ /** Preserve socket extensions that are not part of the default config. */
20
+ [option: string]: unknown;
21
+ };
22
+ export type UserFacingSocketConfig = SocketConfig;
23
+ export type WASocket = ReturnType<typeof makeWASocket>;
24
+ export interface ConnectionState {
25
+ connection: 'open' | 'connecting' | 'close';
26
+ lastDisconnect?: { error?: Error; date: Date };
27
+ qr?: string;
28
+ receivedPendingNotifications?: boolean;
29
+ isNewLogin?: boolean;
30
+ isOnline?: boolean;
31
+ passkeyRequired?: boolean;
32
+ pairingCodeExpired?: boolean;
33
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Socket.d.ts","sourceRoot":"","sources":["../../src/Types/Socket.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { proto } from '../../WAProto/index.js';
2
+ //# sourceMappingURL=Socket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../src/Types/Socket.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const SyncState: any;
2
+ export const ReachoutTimelockEnforcementType: any;
3
+ export const NewChatMessageCappingStatusType: any;
4
+ export const NewChatMessageCappingMVStatusType: any;
5
+ export const NewChatMessageCappingOTEStatusType: any;
6
+ //# sourceMappingURL=State.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../src/Types/State.js"],"names":[],"mappings":"AACA,4BAAqB;AAWrB,kDAA2C;AAsB3C,kDAA2C;AAO3C,oDAA6C;AAO7C,qDAA8C"}
@@ -0,0 +1,56 @@
1
+ import { Boom } from '@hapi/boom';
2
+ export var SyncState;
3
+ (function (SyncState) {
4
+ /** The socket is connecting, but we haven't received pending notifications yet. */
5
+ SyncState[SyncState["Connecting"] = 0] = "Connecting";
6
+ /** Pending notifications received. Buffering events until we decide whether to sync or not. */
7
+ SyncState[SyncState["AwaitingInitialSync"] = 1] = "AwaitingInitialSync";
8
+ /** The initial app state sync (history, etc.) is in progress. Buffering continues. */
9
+ SyncState[SyncState["Syncing"] = 2] = "Syncing";
10
+ /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
11
+ SyncState[SyncState["Online"] = 3] = "Online";
12
+ })(SyncState || (SyncState = {}));
13
+ export var ReachoutTimelockEnforcementType;
14
+ (function (ReachoutTimelockEnforcementType) {
15
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_ALCOHOL"] = "BIZ_COMMERCE_VIOLATION_ALCOHOL";
16
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_ADULT"] = "BIZ_COMMERCE_VIOLATION_ADULT";
17
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_ANIMALS"] = "BIZ_COMMERCE_VIOLATION_ANIMALS";
18
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_BODY_PARTS_FLUIDS"] = "BIZ_COMMERCE_VIOLATION_BODY_PARTS_FLUIDS";
19
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_DATING"] = "BIZ_COMMERCE_VIOLATION_DATING";
20
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_DIGITAL_SERVICES_PRODUCTS"] = "BIZ_COMMERCE_VIOLATION_DIGITAL_SERVICES_PRODUCTS";
21
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_DRUGS"] = "BIZ_COMMERCE_VIOLATION_DRUGS";
22
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_DRUGS_ONLY_OTC"] = "BIZ_COMMERCE_VIOLATION_DRUGS_ONLY_OTC";
23
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_GAMBLING"] = "BIZ_COMMERCE_VIOLATION_GAMBLING";
24
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_HEALTHCARE"] = "BIZ_COMMERCE_VIOLATION_HEALTHCARE";
25
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_REAL_FAKE_CURRENCY"] = "BIZ_COMMERCE_VIOLATION_REAL_FAKE_CURRENCY";
26
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_SUPPLEMENTS"] = "BIZ_COMMERCE_VIOLATION_SUPPLEMENTS";
27
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_TOBACCO"] = "BIZ_COMMERCE_VIOLATION_TOBACCO";
28
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_VIOLENT_CONTENT"] = "BIZ_COMMERCE_VIOLATION_VIOLENT_CONTENT";
29
+ ReachoutTimelockEnforcementType["BIZ_COMMERCE_VIOLATION_WEAPONS"] = "BIZ_COMMERCE_VIOLATION_WEAPONS";
30
+ ReachoutTimelockEnforcementType["BIZ_QUALITY"] = "BIZ_QUALITY";
31
+ /** This means there is no restriction */
32
+ ReachoutTimelockEnforcementType["DEFAULT"] = "DEFAULT";
33
+ ReachoutTimelockEnforcementType["WEB_COMPANION_ONLY"] = "WEB_COMPANION_ONLY";
34
+ })(ReachoutTimelockEnforcementType || (ReachoutTimelockEnforcementType = {}));
35
+ export var NewChatMessageCappingStatusType;
36
+ (function (NewChatMessageCappingStatusType) {
37
+ NewChatMessageCappingStatusType["NONE"] = "NONE";
38
+ NewChatMessageCappingStatusType["FIRST_WARNING"] = "FIRST_WARNING";
39
+ NewChatMessageCappingStatusType["SECOND_WARNING"] = "SECOND_WARNING";
40
+ NewChatMessageCappingStatusType["CAPPED"] = "CAPPED";
41
+ })(NewChatMessageCappingStatusType || (NewChatMessageCappingStatusType = {}));
42
+ export var NewChatMessageCappingMVStatusType;
43
+ (function (NewChatMessageCappingMVStatusType) {
44
+ NewChatMessageCappingMVStatusType["NOT_ELIGIBLE"] = "NOT_ELIGIBLE";
45
+ NewChatMessageCappingMVStatusType["NOT_ACTIVE"] = "NOT_ACTIVE";
46
+ NewChatMessageCappingMVStatusType["ACTIVE"] = "ACTIVE";
47
+ NewChatMessageCappingMVStatusType["ACTIVE_UPGRADE_AVAILABLE"] = "ACTIVE_UPGRADE_AVAILABLE";
48
+ })(NewChatMessageCappingMVStatusType || (NewChatMessageCappingMVStatusType = {}));
49
+ export var NewChatMessageCappingOTEStatusType;
50
+ (function (NewChatMessageCappingOTEStatusType) {
51
+ NewChatMessageCappingOTEStatusType["NOT_ELIGIBLE"] = "NOT_ELIGIBLE";
52
+ NewChatMessageCappingOTEStatusType["ELIGIBLE"] = "ELIGIBLE";
53
+ NewChatMessageCappingOTEStatusType["ACTIVE_IN_CURRENT_CYCLE"] = "ACTIVE_IN_CURRENT_CYCLE";
54
+ NewChatMessageCappingOTEStatusType["EXHAUSTED"] = "EXHAUSTED";
55
+ })(NewChatMessageCappingOTEStatusType || (NewChatMessageCappingOTEStatusType = {}));
56
+ //# sourceMappingURL=State.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.js","sourceRoot":"","sources":["../../src/Types/State.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,MAAM,CAAC,IAAI,SAAS,CAAC;AACrB,CAAC,UAAU,SAAS;IAChB,mFAAmF;IACnF,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC;IACtD,+FAA+F;IAC/F,SAAS,CAAC,SAAS,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB,CAAC;IACxE,sFAAsF;IACtF,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAChD,uHAAuH;IACvH,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAClD,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC;AAClC,MAAM,CAAC,IAAI,+BAA+B,CAAC;AAC3C,CAAC,UAAU,+BAA+B;IACtC,+BAA+B,CAAC,gCAAgC,CAAC,GAAG,gCAAgC,CAAC;IACrG,+BAA+B,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC;IACjG,+BAA+B,CAAC,gCAAgC,CAAC,GAAG,gCAAgC,CAAC;IACrG,+BAA+B,CAAC,0CAA0C,CAAC,GAAG,0CAA0C,CAAC;IACzH,+BAA+B,CAAC,+BAA+B,CAAC,GAAG,+BAA+B,CAAC;IACnG,+BAA+B,CAAC,kDAAkD,CAAC,GAAG,kDAAkD,CAAC;IACzI,+BAA+B,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC;IACjG,+BAA+B,CAAC,uCAAuC,CAAC,GAAG,uCAAuC,CAAC;IACnH,+BAA+B,CAAC,iCAAiC,CAAC,GAAG,iCAAiC,CAAC;IACvG,+BAA+B,CAAC,mCAAmC,CAAC,GAAG,mCAAmC,CAAC;IAC3G,+BAA+B,CAAC,2CAA2C,CAAC,GAAG,2CAA2C,CAAC;IAC3H,+BAA+B,CAAC,oCAAoC,CAAC,GAAG,oCAAoC,CAAC;IAC7G,+BAA+B,CAAC,gCAAgC,CAAC,GAAG,gCAAgC,CAAC;IACrG,+BAA+B,CAAC,wCAAwC,CAAC,GAAG,wCAAwC,CAAC;IACrH,+BAA+B,CAAC,gCAAgC,CAAC,GAAG,gCAAgC,CAAC;IACrG,+BAA+B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;IAC/D,yCAAyC;IACzC,+BAA+B,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACvD,+BAA+B,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AACjF,CAAC,CAAC,CAAC,+BAA+B,IAAI,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC,CAAC;AAC9E,MAAM,CAAC,IAAI,+BAA+B,CAAC;AAC3C,CAAC,UAAU,+BAA+B;IACtC,+BAA+B,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACjD,+BAA+B,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;IACnE,+BAA+B,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;IACrE,+BAA+B,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACzD,CAAC,CAAC,CAAC,+BAA+B,IAAI,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC,CAAC;AAC9E,MAAM,CAAC,IAAI,iCAAiC,CAAC;AAC7C,CAAC,UAAU,iCAAiC;IACxC,iCAAiC,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;IACnE,iCAAiC,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAC/D,iCAAiC,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACvD,iCAAiC,CAAC,0BAA0B,CAAC,GAAG,0BAA0B,CAAC;AAC/F,CAAC,CAAC,CAAC,iCAAiC,IAAI,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClF,MAAM,CAAC,IAAI,kCAAkC,CAAC;AAC9C,CAAC,UAAU,kCAAkC;IACzC,kCAAkC,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;IACpE,kCAAkC,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC5D,kCAAkC,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;IAC1F,kCAAkC,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAClE,CAAC,CAAC,CAAC,kCAAkC,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { BinaryNode } from '../WABinary/types.js';
2
+ import type { USyncUser } from '../WAUSync/USyncUser.js';
3
+ export interface USyncProtocol {
4
+ name: string;
5
+ getQueryElement(): BinaryNode;
6
+ getUserElement(user: USyncUser): BinaryNode | null;
7
+ parser(node: BinaryNode): unknown;
8
+ }
9
+ export type USyncQueryResult = NonNullable<ReturnType<import('../WAUSync/USyncQuery.js').USyncQuery['parseUSyncQueryResult']>>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"USync.d.ts","sourceRoot":"","sources":["../../src/Types/USync.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { USyncUser } from '../WAUSync/index.js';
2
+ //# sourceMappingURL=USync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"USync.js","sourceRoot":"","sources":["../../src/Types/USync.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export * from "./Auth.js";
2
+ export * from "./GroupMetadata.js";
3
+ export * from "./Chat.js";
4
+ export * from "./Contact.js";
5
+ export * from "./State.js";
6
+ export * from "./Message.js";
7
+ export * from "./Socket.js";
8
+ export * from "./Events.js";
9
+ export * from "./Product.js";
10
+ export * from "./Call.js";
11
+ export * from "./Signal.js";
12
+ export * from "./USync.js";
13
+ export * from "./Bussines.js";
14
+ export * from "./Mex.js";
15
+ export const DisconnectReason: any;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Types/index.js"],"names":[],"mappings":";;;;;;;;;;;;AAYA,mCAA4B"}
@@ -0,0 +1,26 @@
1
+ export * from './Auth.js';
2
+ export * from './GroupMetadata.js';
3
+ export * from './Chat.js';
4
+ export * from './Contact.js';
5
+ export * from './State.js';
6
+ export * from './Message.js';
7
+ export * from './Socket.js';
8
+ export * from './Events.js';
9
+ export * from './Product.js';
10
+ export * from './Call.js';
11
+ export * from './Signal.js';
12
+ export * from './Mex.js';
13
+ export var DisconnectReason;
14
+ (function (DisconnectReason) {
15
+ DisconnectReason[DisconnectReason["connectionClosed"] = 428] = "connectionClosed";
16
+ DisconnectReason[DisconnectReason["connectionLost"] = 408] = "connectionLost";
17
+ DisconnectReason[DisconnectReason["connectionReplaced"] = 440] = "connectionReplaced";
18
+ DisconnectReason[DisconnectReason["timedOut"] = 408] = "timedOut";
19
+ DisconnectReason[DisconnectReason["loggedOut"] = 401] = "loggedOut";
20
+ DisconnectReason[DisconnectReason["badSession"] = 500] = "badSession";
21
+ DisconnectReason[DisconnectReason["restartRequired"] = 515] = "restartRequired";
22
+ DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
23
+ DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
24
+ DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
25
+ })(DisconnectReason || (DisconnectReason = {}));
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Types/index.js"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,MAAM,CAAC,IAAI,gBAAgB,CAAC;AAC5B,CAAC,UAAU,gBAAgB;IACvB,gBAAgB,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,GAAG,CAAC,GAAG,kBAAkB,CAAC;IAClF,gBAAgB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC,GAAG,gBAAgB,CAAC;IAC9E,gBAAgB,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC,GAAG,oBAAoB,CAAC;IACtF,gBAAgB,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,GAAG,UAAU,CAAC;IAClE,gBAAgB,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,GAAG,WAAW,CAAC;IACpE,gBAAgB,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAG,YAAY,CAAC;IACtE,gBAAgB,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,GAAG,CAAC,GAAG,iBAAiB,CAAC;IAChF,gBAAgB,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,GAAG,CAAC,GAAG,qBAAqB,CAAC;IACxF,gBAAgB,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,GAAG,WAAW,CAAC;IACpE,gBAAgB,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC,GAAG,oBAAoB,CAAC;AAC1F,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ export type A2UIWidget = {
2
+ uuid: string;
3
+ data: string;
4
+ type: string;
5
+ fallback?: string;
6
+ };
7
+ export type A2UIBuildOptions = {
8
+ uuid?: string;
9
+ surfaceId?: string;
10
+ type?: string;
11
+ /** `false` emits a bare `{ components }` payload instead of the `createSurface` envelope. */
12
+ wrapped?: boolean;
13
+ };
14
+ export type A2UIChoice = {
15
+ label: string;
16
+ value: unknown;
17
+ };
18
+ export type A2UIListCardItem = {
19
+ title: string;
20
+ price?: string;
21
+ trailingLabel?: string;
22
+ assetId?: string;
23
+ assetType?: string;
24
+ emphasis?: string;
25
+ };
26
+ /** Every method registers a component and returns its id; container methods take those ids. */
27
+ export declare class A2UI {
28
+ constructor(options?: { catalogId?: string; version?: string });
29
+ text(text: string, options?: { id?: string; variant?: string }): string;
30
+ image(url: string, options?: { id?: string; variant?: string; fit?: string }): string;
31
+ video(url: string, options?: { id?: string }): string;
32
+ checkbox(label: string, options?: { id?: string; value?: boolean }): string;
33
+ textField(label: string, options?: { id?: string; variant?: string }): string;
34
+ button(childId: string, options?: { id?: string; variant?: string; action?: any }): string;
35
+ card(childId: string, options?: { id?: string }): string;
36
+ column(children: string[], options?: { id?: string; justify?: string; align?: string }): string;
37
+ row(children: string[], options?: { id?: string }): string;
38
+ divider(options?: { id?: string }): string;
39
+ choicePicker(label: string, options: A2UIChoice[], extra?: {
40
+ id?: string;
41
+ variant?: string;
42
+ value?: unknown;
43
+ displayStyle?: string;
44
+ filterable?: boolean;
45
+ }): string;
46
+ root(children: string[]): this;
47
+ listCard(input: { title: string; items: A2UIListCardItem[]; fallbackText?: string; uuid?: string }): this;
48
+ build(options?: A2UIBuildOptions): A2UIWidget;
49
+ }
50
+ export declare const buildA2UIWidget: (a2ui: A2UI | A2UIWidget, options?: A2UIBuildOptions) => A2UIWidget;
@@ -0,0 +1,168 @@
1
+ // A2UI (Agent-to-UI) widget builder. Declarative components — Text, Image, Video, Button,
2
+ // Card, Column, Row, Divider, CheckBox, TextField, ChoicePicker, plus the `listCard` shortcut
3
+ // — compiled into the JSON payload WhatsApp carries in `interactiveMessage.bloksWidget`.
4
+ //
5
+ // Ported from @rennzsync/baileys (MIT).
6
+ //
7
+ // Every builder method registers a component and returns its id; ids are what the container
8
+ // methods take, so a tree is written bottom-up:
9
+ //
10
+ // const ui = new A2UI()
11
+ // const title = ui.text('Hello', { variant: 'h1' })
12
+ // const button = ui.button(ui.text('Press me'), { action: { name: 'noop' } })
13
+ // ui.root([ui.card(ui.column([title, button]))])
14
+ // await sock.sendMessage(jid, { a2ui: ui, text: 'Widget' })
15
+ //
16
+ // This is an internal WhatsApp format: a send can succeed while the recipient's client renders
17
+ // nothing. Verify against your target client build before relying on it.
18
+ import { randomUUID } from 'crypto';
19
+ const DEFAULT_CATALOG_ID = 'https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json';
20
+ export class A2UI {
21
+ constructor({ catalogId = DEFAULT_CATALOG_ID, version = 'v0.9' } = {}) {
22
+ this._version = version;
23
+ this._catalogId = catalogId;
24
+ this._components = new Map();
25
+ this._counter = 0;
26
+ this._rootChildren = [];
27
+ this._listCardPayload = undefined;
28
+ }
29
+ #nextId(prefix) {
30
+ return `${prefix}_${(this._counter++).toString(36)}`;
31
+ }
32
+ #reg(id, component, extra = {}) {
33
+ id ??= this.#nextId(component.toLowerCase());
34
+ if (this._components.has(id)) {
35
+ throw new Error(`Component id "${id}" already used`);
36
+ }
37
+ this._components.set(id, { id, component, ...extra });
38
+ return id;
39
+ }
40
+ text(text, { id, variant = 'body' } = {}) {
41
+ return this.#reg(id, 'Text', { text, variant });
42
+ }
43
+ image(url, { id, variant, fit = 'cover' } = {}) {
44
+ return this.#reg(id, 'Image', { url, ...(variant ? { variant } : {}), fit });
45
+ }
46
+ video(url, { id } = {}) {
47
+ return this.#reg(id, 'Video', { url });
48
+ }
49
+ checkbox(label, { id, value = false } = {}) {
50
+ return this.#reg(id, 'CheckBox', { label, value });
51
+ }
52
+ textField(label, { id, variant = 'text' } = {}) {
53
+ return this.#reg(id, 'TextField', { label, variant });
54
+ }
55
+ button(childId, { id, variant = 'primary', action } = {}) {
56
+ if (!childId) {
57
+ throw new TypeError('button(childId) requires the id of a child component (e.g. from .text())');
58
+ }
59
+ return this.#reg(id, 'Button', { child: childId, variant, ...(action ? { action } : {}) });
60
+ }
61
+ card(childId, { id } = {}) {
62
+ if (!childId) {
63
+ throw new TypeError('card(childId) requires the id of a child component');
64
+ }
65
+ return this.#reg(id, 'Card', { child: childId });
66
+ }
67
+ column(children = [], { id, justify, align } = {}) {
68
+ if (!children.length) {
69
+ throw new TypeError('column(children) requires at least one child id');
70
+ }
71
+ return this.#reg(id, 'Column', { children, ...(justify ? { justify } : {}), ...(align ? { align } : {}) });
72
+ }
73
+ row(children = [], { id } = {}) {
74
+ if (!children.length) {
75
+ throw new TypeError('row(children) requires at least one child id');
76
+ }
77
+ return this.#reg(id, 'Row', { children });
78
+ }
79
+ divider({ id } = {}) {
80
+ return this.#reg(id, 'Divider', {});
81
+ }
82
+ choicePicker(label, options, { id, variant = 'mutuallyExclusive', value, displayStyle = 'checkbox', filterable = false } = {}) {
83
+ if (!Array.isArray(options) || !options.length) {
84
+ throw new TypeError('choicePicker(label, options) requires a non-empty options array of {label, value}');
85
+ }
86
+ return this.#reg(id, 'ChoicePicker', {
87
+ label,
88
+ variant,
89
+ ...(value !== undefined ? { value } : {}),
90
+ options,
91
+ displayStyle,
92
+ filterable
93
+ });
94
+ }
95
+ /** Names the top-level components. Required before `build()` unless `listCard` was used. */
96
+ root(children) {
97
+ if (!Array.isArray(children) || !children.length) {
98
+ throw new TypeError('root(children) requires a non-empty array of top-level component ids');
99
+ }
100
+ this._rootChildren = children;
101
+ return this;
102
+ }
103
+ /**
104
+ * Shortcut for the product-list widget, which uses its own payload shape rather than the
105
+ * component catalog. It replaces whatever the component methods built — `build()` returns
106
+ * this payload and ignores `root()`.
107
+ */
108
+ listCard({ title, items, fallbackText, uuid = randomUUID() } = {}) {
109
+ if (!title) {
110
+ throw new TypeError('listCard requires a title');
111
+ }
112
+ if (!Array.isArray(items) || !items.length) {
113
+ throw new TypeError('listCard requires a non-empty items array');
114
+ }
115
+ this._listCardPayload = {
116
+ uuid,
117
+ data: JSON.stringify({
118
+ type: 'list_card',
119
+ title,
120
+ fallback_text: fallbackText ?? '',
121
+ items: items.map(item => ({
122
+ asset_id: item.assetId ?? randomUUID().replace(/-/g, '').slice(0, 17),
123
+ asset_type: item.assetType ?? 'PRODUCT_ITEM',
124
+ title: item.title,
125
+ trailing_label: item.price ?? item.trailingLabel ?? '',
126
+ trailing_emphasis: item.emphasis ?? 'strong'
127
+ }))
128
+ }),
129
+ type: 'im_a2ui',
130
+ fallback: fallbackText ?? ''
131
+ };
132
+ return this;
133
+ }
134
+ /** Compiles the tree into the `bloksWidget` payload. Called for you by `sendMessage`. */
135
+ build({ uuid = randomUUID(), surfaceId, type = 'im_a2ui', wrapped = true } = {}) {
136
+ if (this._listCardPayload) {
137
+ return this._listCardPayload;
138
+ }
139
+ if (!this._rootChildren.length) {
140
+ throw new Error('Call root([...ids]) before build()');
141
+ }
142
+ const root = { id: 'root', component: 'Column', children: this._rootChildren };
143
+ const components = [root, ...this._components.values()];
144
+ const data = wrapped
145
+ ? {
146
+ version: this._version,
147
+ createSurface: {
148
+ surfaceId: surfaceId ?? `starcore-widget=${uuid}`,
149
+ catalogId: this._catalogId,
150
+ components
151
+ }
152
+ }
153
+ : { components };
154
+ return {
155
+ uuid,
156
+ data: JSON.stringify(data),
157
+ type
158
+ };
159
+ }
160
+ }
161
+ /** Accepts an `A2UI` instance or an already-built payload, and returns the payload. */
162
+ export const buildA2UIWidget = (a2ui, options = {}) => {
163
+ const widget = typeof a2ui?.build === 'function' ? a2ui.build(options) : a2ui;
164
+ if (!widget || typeof widget.data !== 'string') {
165
+ throw new TypeError('a2ui must be an A2UI instance or a built widget payload with a `data` string');
166
+ }
167
+ return widget;
168
+ };
@@ -0,0 +1,71 @@
1
+ export type AnchorGuardLimits = {
2
+ maxText: number;
3
+ maxCaption: number;
4
+ maxMentions: number;
5
+ maxGroupMentions: number;
6
+ maxButtons: number;
7
+ maxSections: number;
8
+ maxRows: number;
9
+ maxCards: number;
10
+ maxDepth: number;
11
+ maxNodes: number;
12
+ maxBytes: number;
13
+ maxParamsJson: number;
14
+ maxInvisibleRun: number;
15
+ maxCombiningRun: number;
16
+ maxNewlines: number;
17
+ };
18
+ export declare const ANCHORGUARD_DEFAULTS: AnchorGuardLimits;
19
+ export type AnchorGuardDetectOptions = Partial<AnchorGuardLimits> & {
20
+ /** Pre-computed encoded size, checked against `maxBytes` without re-encoding. */
21
+ byteLength?: number;
22
+ /** Pass the `proto` namespace to also measure the encoded size. Costs an encode per check. */
23
+ proto?: any;
24
+ };
25
+ export type AnchorGuardDetectResult = {
26
+ flagged: boolean;
27
+ reasons: string[];
28
+ };
29
+ export declare const detectBug: (message: any, options?: AnchorGuardDetectOptions) => AnchorGuardDetectResult;
30
+ export type AnchorGuardDetection = {
31
+ direction: 'incoming' | 'outgoing' | 'group-add';
32
+ jid?: string;
33
+ sender?: string;
34
+ message?: any;
35
+ content?: any;
36
+ reasons: string[];
37
+ burst?: boolean;
38
+ };
39
+ export type AnchorGuardOptions = {
40
+ /** Delete a flagged inbound message. Default `true`. */
41
+ autoDelete?: boolean;
42
+ /** `'auto'` revokes own messages and deletes others locally. Default `'auto'`. */
43
+ deleteMode?: 'auto' | 'everyone' | 'me';
44
+ /** Guard `messages.upsert`. Default `true`. */
45
+ guardIncoming?: boolean;
46
+ /** Wrap `sock.sendMessage` and reject crash payloads. Default `false`. */
47
+ guardOutgoing?: boolean;
48
+ /** Block the sender of a flagged message. Default `false`. */
49
+ blockOnBug?: boolean;
50
+ /** Only guard own chats. Default `false`. */
51
+ selfOnly?: boolean;
52
+ thresholds?: Partial<AnchorGuardLimits>;
53
+ onDetect?: (detection: AnchorGuardDetection) => void | Promise<void>;
54
+ proto?: any;
55
+ /** Messages from one sender inside `burstWindowMs` before it counts as a burst. `0` disables. */
56
+ burstThreshold?: number;
57
+ burstWindowMs?: number;
58
+ /** Remove the sender from the group on burst. Needs admin. Default `false`. */
59
+ kickOnBurst?: boolean;
60
+ /** Flag/kick when a burst-flagged inviter adds this account to a group. Default `false`. */
61
+ guardGroupAdds?: boolean;
62
+ /** Guard Meta AI's numbers instead of exempting them. Default `false`. */
63
+ metaAiNumbers?: boolean;
64
+ ownJid?: string;
65
+ logger?: any;
66
+ };
67
+ export declare const createAnchorGuard: (sock: any, options?: AnchorGuardOptions) => {
68
+ detect: (message: any) => AnchorGuardDetectResult;
69
+ stop: () => void;
70
+ };
71
+ export declare const createAntiBugGuard: typeof createAnchorGuard;