dcodeindra-baileyspro 2.3.9

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2534 -0
  3. package/WAProto/Adv/Adv.d.ts +518 -0
  4. package/WAProto/Adv/Adv.js +1734 -0
  5. package/WAProto/Adv/Adv.proto +36 -0
  6. package/WAProto/BotMetadata/BotMetadata.d.ts +5745 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +16291 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +463 -0
  9. package/WAProto/Cert/Cert.d.ts +497 -0
  10. package/WAProto/Cert/Cert.js +1503 -0
  11. package/WAProto/Cert/Cert.proto +28 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +391 -0
  13. package/WAProto/ChatLockSettings/ChatLockSettings.js +1155 -0
  14. package/WAProto/ChatLockSettings/ChatLockSettings.proto +7 -0
  15. package/WAProto/CompanionReg/CompanionReg.d.ts +1055 -0
  16. package/WAProto/CompanionReg/CompanionReg.js +3532 -0
  17. package/WAProto/CompanionReg/CompanionReg.proto +89 -0
  18. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +187 -0
  19. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +520 -0
  20. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +14 -0
  21. package/WAProto/E2E/E2E.d.ts +28417 -0
  22. package/WAProto/E2E/E2E.js +98438 -0
  23. package/WAProto/E2E/E2E.proto +2289 -0
  24. package/WAProto/Ephemeral/Ephemeral.d.ts +95 -0
  25. package/WAProto/Ephemeral/Ephemeral.js +269 -0
  26. package/WAProto/Ephemeral/Ephemeral.proto +6 -0
  27. package/WAProto/HistorySync/HistorySync.d.ts +40728 -0
  28. package/WAProto/HistorySync/HistorySync.js +142980 -0
  29. package/WAProto/HistorySync/HistorySync.proto +207 -0
  30. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +189 -0
  31. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +585 -0
  32. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +11 -0
  33. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +461 -0
  34. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +1559 -0
  35. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +37 -0
  36. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +29294 -0
  37. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +101732 -0
  38. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +76 -0
  39. package/WAProto/MmsRetry/MmsRetry.d.ts +200 -0
  40. package/WAProto/MmsRetry/MmsRetry.js +586 -0
  41. package/WAProto/MmsRetry/MmsRetry.proto +17 -0
  42. package/WAProto/Protocol/Protocol.d.ts +218 -0
  43. package/WAProto/Protocol/Protocol.js +701 -0
  44. package/WAProto/Protocol/Protocol.proto +20 -0
  45. package/WAProto/Reporting/Reporting.d.ts +301 -0
  46. package/WAProto/Reporting/Reporting.js +989 -0
  47. package/WAProto/Reporting/Reporting.proto +19 -0
  48. package/WAProto/ServerSync/ServerSync.d.ts +1050 -0
  49. package/WAProto/ServerSync/ServerSync.js +3176 -0
  50. package/WAProto/ServerSync/ServerSync.proto +59 -0
  51. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +1507 -0
  52. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +4756 -0
  53. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +88 -0
  54. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +617 -0
  55. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1940 -0
  56. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +38 -0
  57. package/WAProto/StatusAttributions/StatusAttributions.d.ts +636 -0
  58. package/WAProto/StatusAttributions/StatusAttributions.js +2037 -0
  59. package/WAProto/StatusAttributions/StatusAttributions.proto +61 -0
  60. package/WAProto/SyncAction/SyncAction.d.ts +7227 -0
  61. package/WAProto/SyncAction/SyncAction.js +22271 -0
  62. package/WAProto/SyncAction/SyncAction.proto +423 -0
  63. package/WAProto/UserPassword/UserPassword.d.ts +298 -0
  64. package/WAProto/UserPassword/UserPassword.js +898 -0
  65. package/WAProto/UserPassword/UserPassword.proto +27 -0
  66. package/WAProto/VnameCert/VnameCert.d.ts +658 -0
  67. package/WAProto/VnameCert/VnameCert.js +2225 -0
  68. package/WAProto/VnameCert/VnameCert.proto +60 -0
  69. package/WAProto/Wa6/Wa6.d.ts +1613 -0
  70. package/WAProto/Wa6/Wa6.js +6299 -0
  71. package/WAProto/Wa6/Wa6.proto +229 -0
  72. package/WAProto/Web/Web.d.ts +31718 -0
  73. package/WAProto/Web/Web.js +113402 -0
  74. package/WAProto/Web/Web.proto +545 -0
  75. package/WAProto/index.d.ts +49 -0
  76. package/WAProto/index.js +28 -0
  77. package/WASignalGroup/GroupProtocol.js +1771 -0
  78. package/WASignalGroup/ciphertext_message.js +10 -0
  79. package/WASignalGroup/group_cipher.js +103 -0
  80. package/WASignalGroup/group_session_builder.js +39 -0
  81. package/WASignalGroup/index.js +5 -0
  82. package/WASignalGroup/keyhelper.js +17 -0
  83. package/WASignalGroup/protobufs.js +2 -0
  84. package/WASignalGroup/queue_job.js +64 -0
  85. package/WASignalGroup/sender_chain_key.js +38 -0
  86. package/WASignalGroup/sender_key_distribution_message.js +68 -0
  87. package/WASignalGroup/sender_key_message.js +79 -0
  88. package/WASignalGroup/sender_key_name.js +59 -0
  89. package/WASignalGroup/sender_key_record.js +47 -0
  90. package/WASignalGroup/sender_key_state.js +110 -0
  91. package/WASignalGroup/sender_message_key.js +30 -0
  92. package/check-node-version.js +10 -0
  93. package/lib/Defaults/baileys-version.json +3 -0
  94. package/lib/Defaults/index.d.ts +51 -0
  95. package/lib/Defaults/index.js +108 -0
  96. package/lib/Defaults/phonenumber-mcc.json +223 -0
  97. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  98. package/lib/Signal/Group/ciphertext-message.js +19 -0
  99. package/lib/Signal/Group/group-session-builder.d.ts +17 -0
  100. package/lib/Signal/Group/group-session-builder.js +72 -0
  101. package/lib/Signal/Group/group_cipher.d.ts +19 -0
  102. package/lib/Signal/Group/group_cipher.js +99 -0
  103. package/lib/Signal/Group/index.d.ts +11 -0
  104. package/lib/Signal/Group/index.js +61 -0
  105. package/lib/Signal/Group/keyhelper.d.ts +16 -0
  106. package/lib/Signal/Group/keyhelper.js +66 -0
  107. package/lib/Signal/Group/queue-job.d.ts +1 -0
  108. package/lib/Signal/Group/queue-job.js +64 -0
  109. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  110. package/lib/Signal/Group/sender-chain-key.js +39 -0
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  112. package/lib/Signal/Group/sender-key-distribution-message.js +71 -0
  113. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  114. package/lib/Signal/Group/sender-key-message.js +73 -0
  115. package/lib/Signal/Group/sender-key-name.d.ts +19 -0
  116. package/lib/Signal/Group/sender-key-name.js +59 -0
  117. package/lib/Signal/Group/sender-key-record.d.ts +32 -0
  118. package/lib/Signal/Group/sender-key-record.js +53 -0
  119. package/lib/Signal/Group/sender-key-record.ts +77 -0
  120. package/lib/Signal/Group/sender-key-state.d.ts +44 -0
  121. package/lib/Signal/Group/sender-key-state.js +104 -0
  122. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  123. package/lib/Signal/Group/sender-message-key.js +33 -0
  124. package/lib/Signal/libsignal.d.ts +3 -0
  125. package/lib/Signal/libsignal.js +153 -0
  126. package/lib/Socket/Client/index.d.ts +2 -0
  127. package/lib/Socket/Client/index.js +18 -0
  128. package/lib/Socket/Client/types.d.ts +15 -0
  129. package/lib/Socket/Client/types.js +14 -0
  130. package/lib/Socket/Client/websocket.d.ts +12 -0
  131. package/lib/Socket/Client/websocket.js +57 -0
  132. package/lib/Socket/business.d.ts +181 -0
  133. package/lib/Socket/business.js +259 -0
  134. package/lib/Socket/chats.d.ts +95 -0
  135. package/lib/Socket/chats.js +906 -0
  136. package/lib/Socket/community.d.ts +131 -0
  137. package/lib/Socket/community.js +369 -0
  138. package/lib/Socket/groups.d.ts +122 -0
  139. package/lib/Socket/groups.js +360 -0
  140. package/lib/Socket/index.d.ts +183 -0
  141. package/lib/Socket/index.js +10 -0
  142. package/lib/Socket/messages-recv.d.ts +170 -0
  143. package/lib/Socket/messages-recv.js +1074 -0
  144. package/lib/Socket/messages-send.d.ts +161 -0
  145. package/lib/Socket/messages-send.js +982 -0
  146. package/lib/Socket/newsletter.d.ts +140 -0
  147. package/lib/Socket/newsletter.js +242 -0
  148. package/lib/Socket/socket.d.ts +43 -0
  149. package/lib/Socket/socket.js +749 -0
  150. package/lib/Socket/usync.d.ts +36 -0
  151. package/lib/Socket/usync.js +71 -0
  152. package/lib/Store/index.d.ts +4 -0
  153. package/lib/Store/index.js +20 -0
  154. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  155. package/lib/Store/make-cache-manager-store.js +77 -0
  156. package/lib/Store/make-in-memory-store.d.ts +117 -0
  157. package/lib/Store/make-in-memory-store.js +420 -0
  158. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  159. package/lib/Store/make-ordered-dictionary.js +83 -0
  160. package/lib/Store/object-repository.d.ts +10 -0
  161. package/lib/Store/object-repository.js +28 -0
  162. package/lib/Types/Auth.d.ts +103 -0
  163. package/lib/Types/Auth.js +2 -0
  164. package/lib/Types/Call.d.ts +13 -0
  165. package/lib/Types/Call.js +2 -0
  166. package/lib/Types/Chat.d.ts +115 -0
  167. package/lib/Types/Chat.js +6 -0
  168. package/lib/Types/Contact.d.ts +35 -0
  169. package/lib/Types/Contact.js +2 -0
  170. package/lib/Types/Events.d.ts +208 -0
  171. package/lib/Types/Events.js +2 -0
  172. package/lib/Types/GroupMetadata.d.ts +81 -0
  173. package/lib/Types/GroupMetadata.js +2 -0
  174. package/lib/Types/Label.d.ts +46 -0
  175. package/lib/Types/Label.js +28 -0
  176. package/lib/Types/LabelAssociation.d.ts +29 -0
  177. package/lib/Types/LabelAssociation.js +10 -0
  178. package/lib/Types/Message.d.ts +480 -0
  179. package/lib/Types/Message.js +9 -0
  180. package/lib/Types/MexUpdates.d.ts +9 -0
  181. package/lib/Types/MexUpdates.js +18 -0
  182. package/lib/Types/Newsletter.d.ts +92 -0
  183. package/lib/Types/Newsletter.js +33 -0
  184. package/lib/Types/Product.d.ts +78 -0
  185. package/lib/Types/Product.js +2 -0
  186. package/lib/Types/Signal.d.ts +57 -0
  187. package/lib/Types/Signal.js +2 -0
  188. package/lib/Types/Socket.d.ts +116 -0
  189. package/lib/Types/Socket.js +2 -0
  190. package/lib/Types/State.d.ts +27 -0
  191. package/lib/Types/State.js +2 -0
  192. package/lib/Types/USync.d.ts +25 -0
  193. package/lib/Types/USync.js +2 -0
  194. package/lib/Types/index.d.ts +70 -0
  195. package/lib/Types/index.js +42 -0
  196. package/lib/Utils/auth-utils.d.ts +18 -0
  197. package/lib/Utils/auth-utils.js +198 -0
  198. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  199. package/lib/Utils/baileys-event-stream.js +64 -0
  200. package/lib/Utils/business.d.ts +22 -0
  201. package/lib/Utils/business.js +243 -0
  202. package/lib/Utils/chat-utils.d.ts +72 -0
  203. package/lib/Utils/chat-utils.js +762 -0
  204. package/lib/Utils/crypto.d.ts +40 -0
  205. package/lib/Utils/crypto.js +150 -0
  206. package/lib/Utils/decode-wa-message.d.ts +252 -0
  207. package/lib/Utils/decode-wa-message.js +232 -0
  208. package/lib/Utils/event-buffer.d.ts +35 -0
  209. package/lib/Utils/event-buffer.js +539 -0
  210. package/lib/Utils/generics.d.ts +96 -0
  211. package/lib/Utils/generics.js +553 -0
  212. package/lib/Utils/history.d.ts +29 -0
  213. package/lib/Utils/history.js +109 -0
  214. package/lib/Utils/index.d.ts +19 -0
  215. package/lib/Utils/index.js +35 -0
  216. package/lib/Utils/link-preview.d.ts +21 -0
  217. package/lib/Utils/link-preview.js +112 -0
  218. package/lib/Utils/logger.d.ts +11 -0
  219. package/lib/Utils/logger.js +7 -0
  220. package/lib/Utils/lt-hash.d.ts +12 -0
  221. package/lib/Utils/lt-hash.js +53 -0
  222. package/lib/Utils/make-mutex.d.ts +7 -0
  223. package/lib/Utils/make-mutex.js +45 -0
  224. package/lib/Utils/messages-media.d.ts +104 -0
  225. package/lib/Utils/messages-media.js +751 -0
  226. package/lib/Utils/messages.d.ts +80 -0
  227. package/lib/Utils/messages.js +1741 -0
  228. package/lib/Utils/noise-handler.d.ts +19 -0
  229. package/lib/Utils/noise-handler.js +150 -0
  230. package/lib/Utils/process-message.d.ts +41 -0
  231. package/lib/Utils/process-message.js +391 -0
  232. package/lib/Utils/signal.d.ts +33 -0
  233. package/lib/Utils/signal.js +154 -0
  234. package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
  235. package/lib/Utils/use-mongo-file-auth-state.js +75 -0
  236. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  237. package/lib/Utils/use-multi-file-auth-state.js +123 -0
  238. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  239. package/lib/Utils/use-single-file-auth-state.js +75 -0
  240. package/lib/Utils/validate-connection.d.ts +10 -0
  241. package/lib/Utils/validate-connection.js +174 -0
  242. package/lib/WABinary/constants.d.ts +27 -0
  243. package/lib/WABinary/constants.js +45 -0
  244. package/lib/WABinary/decode.d.ts +6 -0
  245. package/lib/WABinary/decode.js +255 -0
  246. package/lib/WABinary/encode.d.ts +2 -0
  247. package/lib/WABinary/encode.js +243 -0
  248. package/lib/WABinary/generic-utils.d.ts +16 -0
  249. package/lib/WABinary/generic-utils.js +125 -0
  250. package/lib/WABinary/index.d.ts +5 -0
  251. package/lib/WABinary/index.js +21 -0
  252. package/lib/WABinary/jid-utils.d.ts +34 -0
  253. package/lib/WABinary/jid-utils.js +73 -0
  254. package/lib/WABinary/types.d.ts +18 -0
  255. package/lib/WABinary/types.js +2 -0
  256. package/lib/WAM/BinaryInfo.d.ts +16 -0
  257. package/lib/WAM/BinaryInfo.js +14 -0
  258. package/lib/WAM/constants.d.ts +39 -0
  259. package/lib/WAM/constants.js +15362 -0
  260. package/lib/WAM/encode.d.ts +2 -0
  261. package/lib/WAM/encode.js +156 -0
  262. package/lib/WAM/index.d.ts +3 -0
  263. package/lib/WAM/index.js +19 -0
  264. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
  265. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -0
  266. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  267. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  268. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  269. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +58 -0
  270. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  271. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  272. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
  273. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
  274. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  275. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  276. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  277. package/lib/WAUSync/Protocols/index.js +22 -0
  278. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  279. package/lib/WAUSync/USyncQuery.js +88 -0
  280. package/lib/WAUSync/USyncUser.d.ts +12 -0
  281. package/lib/WAUSync/USyncUser.js +27 -0
  282. package/lib/WAUSync/index.d.ts +3 -0
  283. package/lib/WAUSync/index.js +19 -0
  284. package/lib/index.d.ts +13 -0
  285. package/lib/index.js +45 -0
  286. package/package.json +63 -0
@@ -0,0 +1,480 @@
1
+ import { AxiosRequestConfig } from 'axios'
2
+ import { ILogger } from '../Utils/logger'
3
+ import type { Readable } from 'stream'
4
+ import type { URL } from 'url'
5
+ import { proto } from '../../WAProto'
6
+ import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults'
7
+ import { BinaryNode } from '../WABinary'
8
+ import type { GroupMetadata } from './GroupMetadata'
9
+ import { CacheStore } from './Socket'
10
+
11
+ export { proto as WAProto }
12
+
13
+ export type WAMessage = proto.IWebMessageInfo
14
+ export type WAMessageContent = proto.IMessage
15
+ export type WAContactMessage = proto.Message.IContactMessage
16
+ export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage
17
+ export type WATextMessage = proto.Message.IExtendedTextMessage
18
+ export type WAContextInfo = proto.IContextInfo
19
+ export type WAEventMessage = proto.Message.IEventMessage
20
+ export type WALocationMessage = proto.Message.ILocationMessage
21
+ export type WAOrderMessage = proto.Message.IOrderMessage
22
+ export type WAGenericMediaMessage =
23
+ | proto.Message.IVideoMessage
24
+ | proto.Message.IImageMessage
25
+ | proto.Message.IAudioMessage
26
+ | proto.Message.IDocumentMessage
27
+ | proto.Message.IStickerMessage
28
+
29
+ export const WAMessageStubType = proto.WebMessageInfo.StubType
30
+ export const WAMessageStatus = proto.WebMessageInfo.Status
31
+
32
+ // Actualización de WAMessageKey para incluir ambos conjuntos de propiedades
33
+ export type WAMessageKey = proto.IMessageKey & {
34
+ newsletter_server_id?: string
35
+ senderLid?: string
36
+ participantLid?: string
37
+ senderPn?: string
38
+ }
39
+
40
+ export type WAMediaPayloadURL = { url: URL | string }
41
+ export type WAMediaPayloadStream = { stream: Readable }
42
+ export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL
43
+
44
+ /** Set of message types that are supported by the library */
45
+ export type MessageType = keyof proto.Message
46
+
47
+ export type DownloadableMessage = {
48
+ mediaKey?: Uint8Array | null
49
+ directPath?: string | null
50
+ url?: string | null
51
+ }
52
+
53
+ export type MessageReceiptType =
54
+ | 'read'
55
+ | 'read-self'
56
+ | 'hist_sync'
57
+ | 'peer_msg'
58
+ | 'sender'
59
+ | 'inactive'
60
+ | 'played'
61
+ | undefined
62
+
63
+ export type MediaConnInfo = {
64
+ auth: string
65
+ ttl: number
66
+ hosts: { hostname: string; maxContentLengthBytes: number }[]
67
+ fetchDate: Date
68
+ }
69
+
70
+ export interface Carousel {
71
+ image?: WAMediaUpload
72
+ video?: WAMediaUpload
73
+ product?: WASendableProduct
74
+ title?: string
75
+ body?: string
76
+ footer?: string
77
+ buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[]
78
+ }
79
+
80
+ export interface WAUrlInfo {
81
+ 'canonical-url': string
82
+ 'matched-text': string
83
+ title: string
84
+ description?: string
85
+ jpegThumbnail?: Buffer
86
+ highQualityThumbnail?: proto.Message.IImageMessage
87
+ originalThumbnailUrl?: string
88
+ }
89
+
90
+ // Tipos combinados
91
+ type Mentionable = {
92
+ /** list of jids that are mentioned in the accompanying text */
93
+ mentions?: string[]
94
+ }
95
+
96
+ type Contextable = {
97
+ /** add contextInfo to the message */
98
+ contextInfo?: proto.IContextInfo
99
+ }
100
+
101
+ type Ephemeral = {
102
+ ephemeral?: boolean
103
+ }
104
+
105
+ type ViewOnce = {
106
+ viewOnce?: boolean
107
+ }
108
+
109
+ type ViewOnceV2 = {
110
+ viewOnceV2?: boolean
111
+ }
112
+
113
+ type ViewOnceV2Ext = {
114
+ viewOnceV2Ext?: boolean
115
+ }
116
+
117
+ type Buttonable = {
118
+ /** add buttons to the message */
119
+ buttons?: proto.Message.ButtonsMessage.IButton[]
120
+ }
121
+
122
+ type Templatable = {
123
+ /** add buttons to the message (conflicts with normal buttons)*/
124
+ templateButtons?: proto.IHydratedTemplateButton[]
125
+ footer?: string
126
+ }
127
+
128
+ type Interactiveable = {
129
+ /** add buttons to the message (conflicts with normal buttons)*/
130
+ interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]
131
+ title?: string
132
+ subtitle?: string
133
+ footer?: string
134
+ hasMediaAttachment?: boolean
135
+ }
136
+
137
+ type Shopable = {
138
+ shop?: proto.Message.InteractiveMessage.ShopMessage
139
+ title?: string
140
+ subtitle?: string
141
+ footer?: string
142
+ hasMediaAttachment?: boolean
143
+ }
144
+
145
+ type Collectionable = {
146
+ collection?: proto.Message.InteractiveMessage.CollectionMessage
147
+ title?: string
148
+ subtitle?: string
149
+ footer?: string
150
+ hasMediaAttachment?: boolean
151
+ }
152
+
153
+ type Listable = {
154
+ /** Sections of the List */
155
+ sections?: proto.Message.ListMessage.ISection[]
156
+ /** Title of a List Message only */
157
+ title?: string
158
+ /** Text of the button on the list (required) */
159
+ buttonText?: string
160
+ /** ListType of a List Message only */
161
+ listType?: proto.Message.ListMessage.ListType
162
+ }
163
+
164
+ type Cardsable = {
165
+ cards?: Carousel[]
166
+ title?: string
167
+ subtitle?: string
168
+ footer?: string
169
+ }
170
+
171
+ type Editable = {
172
+ edit?: WAMessageKey
173
+ }
174
+
175
+ type WithDimensions = {
176
+ width?: number
177
+ height?: number
178
+ }
179
+
180
+ export type PollMessageOptions = {
181
+ name: string
182
+ selectableCount?: number
183
+ values: string[]
184
+ /** 32 byte message secret to encrypt poll selections */
185
+ messageSecret?: Uint8Array
186
+ toAnnouncementGroup?: boolean
187
+ }
188
+
189
+ export type PollResultOptions = {
190
+ name: string
191
+ values: string[]
192
+ }
193
+
194
+ type SharePhoneNumber = {
195
+ sharePhoneNumber: boolean
196
+ }
197
+
198
+ type RequestPhoneNumber = {
199
+ requestPhoneNumber: boolean
200
+ }
201
+
202
+ export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING
203
+
204
+ export type AnyMediaMessageContent = (({
205
+ image: WAMediaUpload
206
+ caption?: string
207
+ jpegThumbnail?: string
208
+ /** if set to true, will send as a `view once` image */
209
+ ptv?: boolean
210
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | ({
211
+ video: WAMediaUpload
212
+ caption?: string
213
+ gifPlayback?: boolean
214
+ jpegThumbnail?: string
215
+ /** if set to true, will send as a `video note` */
216
+ ptv?: boolean
217
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | {
218
+ audio: WAMediaUpload
219
+ /** if set to true, will send as a `voice note` */
220
+ ptt?: boolean
221
+ /** optionally tell the duration of the audio */
222
+ seconds?: number
223
+ } | ({
224
+ sticker: WAMediaUpload
225
+ isAnimated?: boolean
226
+ } & WithDimensions) | ({
227
+ document: WAMediaUpload
228
+ mimetype: string
229
+ fileName?: string
230
+ caption?: string
231
+ } & Contextable & Buttonable & Templatable & Interactiveable )) & {
232
+ mimetype?: string
233
+ } & Editable
234
+
235
+ export type ButtonReplyInfo = {
236
+ displayText: string
237
+ id: string
238
+ index: number
239
+ }
240
+
241
+ export type GroupInviteInfo = {
242
+ code: string
243
+ expiration: number
244
+ caption: string
245
+ jid: string
246
+ name: string
247
+ jpegThumbnail?: string
248
+ } | {
249
+ inviteCode: string
250
+ inviteExpiration: number
251
+ text: string
252
+ jid: string
253
+ subject: string
254
+ }
255
+
256
+ export type CallCreationInfo = {
257
+ time?: number
258
+ type?: number
259
+ name: string
260
+ }
261
+
262
+ export type AdminInviteInfo = {
263
+ jid: string
264
+ name: string
265
+ caption: string
266
+ expiration: number
267
+ jpegThumbnail: string
268
+ }
269
+
270
+ export type PinInfo = {
271
+ key: WAMessageKey
272
+ type?: number
273
+ time?: number
274
+ } | {
275
+ pin: WAMessageKey
276
+ type: proto.PinInChat.Type
277
+ /**
278
+ * 24 hours, 7 days, 30 days
279
+ */
280
+ time?: 86400 | 604800 | 2592000
281
+ }
282
+
283
+ export type KeepInfo = {
284
+ key: WAMessageKey
285
+ type: number
286
+ }
287
+
288
+ export type PaymentInfo = {
289
+ note: string
290
+ currency?: string
291
+ offset?: number
292
+ amount?: number
293
+ expiry?: number
294
+ from?: string
295
+ image?: {
296
+ placeholderArgb: fixed32
297
+ textArgb: fixed32
298
+ subtextArgb: fixed32
299
+ }
300
+ }
301
+
302
+ export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
303
+ productImage: WAMediaUpload
304
+ }
305
+
306
+ export type AnyRegularMessageContent = (({
307
+ text: string
308
+ linkPreview?: WAUrlInfo | null
309
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | AnyMediaMessageContent | ({
310
+ poll: PollMessageOptions
311
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | {
312
+ contacts: {
313
+ displayName?: string
314
+ contacts: proto.Message.IContactMessage[]
315
+ }
316
+ } | {
317
+ location: WALocationMessage
318
+ } | {
319
+ react: proto.Message.IReactionMessage
320
+ } | {
321
+ buttonReply: ButtonReplyInfo
322
+ type: 'template' | 'plain' | 'list' | 'interactive'
323
+ } | {
324
+ groupInvite: GroupInviteInfo
325
+ } | {
326
+ pin: PinInfo
327
+ } | {
328
+ keep: KeepInfo
329
+ } | {
330
+ call: CallCreationInfo
331
+ } | {
332
+ event: WAEventMessage
333
+ } | {
334
+ adminInvite: AdminInviteInfo
335
+ } | {
336
+ payment: PaymentInfo
337
+ } | {
338
+ paymentInvite: {
339
+ type: number
340
+ expiry: number
341
+ }
342
+ } | {
343
+ pollResult: PollResultOptions
344
+ } | {
345
+ order: WAOrderMessage
346
+ } | {
347
+ product: WASendableProduct
348
+ businessOwnerJid?: string
349
+ body?: string
350
+ footer?: string
351
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce & ViewOnceV2 & ViewOnceV2Ext
352
+
353
+ export type AnyMessageContent = AnyRegularMessageContent | {
354
+ forward: WAMessage
355
+ force?: boolean
356
+ } | {
357
+ /** Delete your message or anyone's message in a group (admin required) */
358
+ delete: WAMessageKey
359
+ } | {
360
+ disappearingMessagesInChat: boolean | number
361
+ }
362
+
363
+ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>
364
+
365
+ type MinimalRelayOptions = {
366
+ /** override the message ID with a custom provided string */
367
+ messageId?: string
368
+ /** should we use group metadata cache, or fetch afresh from the server default assumed to be "true" */
369
+ useCachedGroupMetadata?: boolean
370
+ }
371
+
372
+ export type MessageRelayOptions = MinimalRelayOptions & {
373
+ /** only send to a specific participant used when a message decryption fails for a single user */
374
+ participant?: {
375
+ jid: string
376
+ count: number
377
+ }
378
+ /** additional attributes to add to the WA binary node */
379
+ additionalAttributes?: {
380
+ [_: string]: string
381
+ }
382
+ additionalNodes?: BinaryNode[]
383
+ /** should we use the devices cache, or fetch afresh from the server default assumed to be "true" */
384
+ useUserDevicesCache?: boolean
385
+ /** jid list of participants for status@broadcast */
386
+ statusJidList?: string[]
387
+ newsletter?: boolean
388
+ }
389
+
390
+ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
391
+ /** optional, if you want to manually set the timestamp of the message */
392
+ timestamp?: Date
393
+ /** the message you want to quote */
394
+ quoted?: WAMessage
395
+ /** disappearing messages settings */
396
+ ephemeralExpiration?: number | string
397
+ /** timeout for media upload to WA server */
398
+ mediaUploadTimeoutMs?: number
399
+ /** jid list of participants for status@broadcast */
400
+ statusJidList?: string[]
401
+ /** backgroundcolor for status */
402
+ backgroundColor?: string
403
+ /** font type for status */
404
+ font?: number
405
+ /** if it is broadcast */
406
+ broadcast?: boolean
407
+ newsletter?: boolean
408
+ additionalNodes?: BinaryNode[]
409
+ }
410
+
411
+ export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
412
+ userJid: string
413
+ }
414
+
415
+ export type WAMediaUploadFunctionOpts = {
416
+ fileEncSha256B64: string
417
+ mediaType: MediaType
418
+ newsletter?: boolean
419
+ timeoutMs?: number
420
+ }
421
+
422
+ export type WAMediaUploadFunction = (encFilePath: string | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
423
+ mediaUrl: string
424
+ directPath: string
425
+ handle?: string
426
+ }>
427
+
428
+ export type MediaGenerationOptions = {
429
+ logger?: ILogger
430
+ mediaTypeOverride?: MediaType
431
+ upload: WAMediaUploadFunction
432
+ /** cache media so it does not have to be uploaded again */
433
+ mediaCache?: CacheStore
434
+ mediaUploadTimeoutMs?: number
435
+ options?: AxiosRequestConfig
436
+ backgroundColor?: string
437
+ font?: number
438
+ /** The message is for newsletter? */
439
+ newsletter?: boolean
440
+ }
441
+
442
+ export type MessageContentGenerationOptions = MediaGenerationOptions & {
443
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>
444
+ getProfilePicUrl?: (jid: string, type?: 'image' | 'preview') => Promise<string | undefined>
445
+ }
446
+
447
+ export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent
448
+
449
+ /**
450
+ * Type of message upsert
451
+ * 1. notify => notify the user, this message was just received
452
+ * 2. append => append the message to the chat history, no notification required
453
+ */
454
+ export type MessageUpsertType = 'append' | 'notify'
455
+
456
+ export type MessageUserReceipt = proto.IUserReceipt
457
+
458
+ export type WAMessageUpdate = {
459
+ update: Partial<WAMessage>
460
+ key: proto.IMessageKey
461
+ }
462
+
463
+ export type WAMessageCursor = {
464
+ before: WAMessageKey | undefined
465
+ } | {
466
+ after: WAMessageKey | undefined
467
+ }
468
+
469
+ export type MessageUserReceiptUpdate = {
470
+ key: proto.IMessageKey
471
+ receipt: MessageUserReceipt
472
+ }
473
+
474
+ export type MediaDecryptionKeyInfo = {
475
+ iv: Buffer
476
+ cipherKey: Buffer
477
+ macKey?: Buffer
478
+ }
479
+
480
+ export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>
@@ -0,0 +1,9 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ const WAProto_1 = require("../../WAProto")
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ module.exports = {
6
+ WAMessageStubType: WAProto_1.proto.WebMessageInfo.StubType,
7
+ WAMessageStatus: WAProto_1.proto.WebMessageInfo.Status,
8
+ WAProto: WAProto_1.proto
9
+ }
@@ -0,0 +1,9 @@
1
+ export declare const enum MexUpdatesOperations {
2
+ OWNER_COMMUNITY = "NotificationCommunityOwnerUpdate",
3
+ GROUP_LIMIT_SHARING = "NotificationGroupLimitSharingPropertyUpdate"
4
+ }
5
+
6
+ export declare const enum XWAPathsUpdates {
7
+ GROUP_SHARING_CHANGE = "xwa2_notify_group_on_prop_change",
8
+ COMMUNITY_OWNER_CHANGE = "xwa2_notify_group_on_participants_roles_change"
9
+ }
@@ -0,0 +1,18 @@
1
+ "use strict"
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
4
+
5
+ const MexUpdatesOperations = {
6
+ OWNER_COMMUNITY: "NotificationCommunityOwnerUpdate",
7
+ GROUP_LIMIT_SHARING: "NotificationGroupLimitSharingPropertyUpdate"
8
+ }
9
+
10
+ const XWAPathsMexUpdates = {
11
+ GROUP_SHARING_CHANGE: "xwa2_notify_group_on_prop_change",
12
+ COMMUNITY_OWNER_CHANGE: "xwa2_notify_group_on_participants_roles_change"
13
+ }
14
+
15
+ module.exports = {
16
+ MexUpdatesOperations,
17
+ XWAPathsMexUpdates
18
+ }
@@ -0,0 +1,92 @@
1
+ import { proto } from '../../WAProto'
2
+ export type NewsletterReactionMode = 'ALL' | 'BASIC' | 'NONE'
3
+ export type NewsletterState = 'ACTIVE' | 'GEOSUSPENDED' | 'SUSPENDED'
4
+ export type NewsletterVerification = 'VERIFIED' | 'UNVERIFIED'
5
+ export type NewsletterMute = 'ON' | 'OFF' | 'UNDEFINED'
6
+ export type NewsletterViewRole = 'ADMIN' | 'GUEST' | 'OWNER' | 'SUBSCRIBER'
7
+ export type NewsletterViewerMetadata = {
8
+ mute: NewsletterMute
9
+ view_role: NewsletterViewRole
10
+ }
11
+ export type NewsletterMetadata = {
12
+ /**jid of newsletter */
13
+ id: string
14
+ /**state of newsletter */
15
+ state: NewsletterState
16
+ /**creation timestamp of newsletter */
17
+ creation_time: number
18
+ /**name of newsletter */
19
+ name: string
20
+ /**timestamp of last name modification of newsletter */
21
+ nameTime: number
22
+ /**description of newsletter */
23
+ description: string
24
+ /**timestamp of last description modification of newsletter */
25
+ descriptionTime: number
26
+ /**invite code of newsletter */
27
+ invite: string
28
+ /**i dont know */
29
+ handle: null
30
+ /**direct path of picture */
31
+ picture: string | null
32
+ /**direct path of picture preview (lower quality) */
33
+ preview: string | null
34
+ /**reaction mode of newsletter */
35
+ reaction_codes?: NewsletterReactionMode
36
+ /**subscribers count of newsletter */
37
+ subscribers: number
38
+ /**verification state of newsletter */
39
+ verification: NewsletterVerification
40
+ /**viewer metadata */
41
+ viewer_metadata: NewsletterViewerMetadata
42
+ }
43
+ export type SubscriberAction = 'promote' | 'demote'
44
+ export type ReactionModeUpdate = {
45
+ reaction_codes: {
46
+ blocked_codes: null
47
+ enabled_ts_sec: null
48
+ value: NewsletterReactionMode
49
+ }
50
+ }
51
+ /**only exists reaction mode update */
52
+ export type NewsletterSettingsUpdate = ReactionModeUpdate
53
+ export type NewsletterReaction = {
54
+ count: number
55
+ code: string
56
+ }
57
+ export type NewsletterFetchedUpdate = {
58
+ /**id of message in newsletter, starts from 100 */
59
+ server_id: string
60
+ /**count of views in this message */
61
+ views?: number
62
+ /**reactions in this message */
63
+ reactions: NewsletterReaction[]
64
+ /**the message, if you requested only updates, you will not receive message */
65
+ message?: proto.IWebMessageInfo
66
+ }
67
+ export declare const enum MexOperations {
68
+ PROMOTE = "NotificationNewsletterAdminPromote",
69
+ DEMOTE = "NotificationNewsletterAdminDemote",
70
+ UPDATE = "NotificationNewsletterUpdate"
71
+ }
72
+ export declare const enum XWAPaths {
73
+ PROMOTE = "xwa2_notify_newsletter_admin_promote",
74
+ DEMOTE = "xwa2_notify_newsletter_admin_demote",
75
+ ADMIN_COUNT = "xwa2_newsletter_admin",
76
+ CREATE = "xwa2_newsletter_create",
77
+ NEWSLETTER = "xwa2_newsletter",
78
+ METADATA_UPDATE = "xwa2_notify_newsletter_on_metadata_update"
79
+ }
80
+ export declare const enum QueryIds {
81
+ JOB_MUTATION = "7150902998257522",
82
+ METADATA = "6620195908089573",
83
+ UNFOLLOW = "7238632346214362",
84
+ FOLLOW = "7871414976211147",
85
+ UNMUTE = "7337137176362961",
86
+ MUTE = "25151904754424642",
87
+ CREATE = "6996806640408138",
88
+ ADMIN_COUNT = "7130823597031706",
89
+ CHANGE_OWNER = "7341777602580933",
90
+ DELETE = "8316537688363079",
91
+ DEMOTE = "6551828931592903"
92
+ }
@@ -0,0 +1,33 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ const MexOperations = {
4
+ PROMOTE: "NotificationNewsletterAdminPromote",
5
+ DEMOTE: "NotificationNewsletterAdminDemote",
6
+ UPDATE: "NotificationNewsletterUpdate"
7
+ }
8
+ const XWAPaths = {
9
+ PROMOTE: "xwa2_notify_newsletter_admin_promote",
10
+ DEMOTE: "xwa2_notify_newsletter_admin_demote",
11
+ ADMIN_COUNT: "xwa2_newsletter_admin",
12
+ CREATE: "xwa2_newsletter_create",
13
+ NEWSLETTER: "xwa2_newsletter",
14
+ METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
15
+ }
16
+ const QueryIds = {
17
+ JOB_MUTATION: "7150902998257522",
18
+ METADATA: "6620195908089573",
19
+ UNFOLLOW: "7238632346214362",
20
+ FOLLOW: "7871414976211147",
21
+ UNMUTE: "7337137176362961",
22
+ MUTE: "25151904754424642",
23
+ CREATE: "6996806640408138",
24
+ ADMIN_COUNT: "7130823597031706",
25
+ CHANGE_OWNER: "7341777602580933",
26
+ DELETE: "8316537688363079",
27
+ DEMOTE: "6551828931592903"
28
+ }
29
+ module.exports = {
30
+ MexOperations,
31
+ XWAPaths,
32
+ QueryIds
33
+ }