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,115 @@
1
+ import type { proto } from '../../WAProto'
2
+ import type { AccountSettings } from './Auth'
3
+ import type { ContactAction } from './Contact'
4
+ import type { BufferedEventData } from './Events'
5
+ import type { LabelActionBody } from './Label'
6
+ import type { ChatLabelAssociationActionBody } from './LabelAssociation'
7
+ import type { MessageLabelAssociationActionBody } from './LabelAssociation'
8
+ import type { MinimalMessage, WAMessageKey } from './Message'
9
+ /** privacy settings in WhatsApp Web */
10
+ export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none'
11
+ export type WAPrivacyOnlineValue = 'all' | 'match_last_seen'
12
+ export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist'
13
+ export type WAReadReceiptsValue = 'all' | 'none'
14
+ export type WAPrivacyCallValue = 'all' | 'known'
15
+ export type WAPrivacyMessagesValue = 'all' | 'contacts'
16
+ /** set of statuses visible to other people see updatePresence() in WhatsAppWeb.Send */
17
+ export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
18
+ export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"]
19
+ export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number]
20
+ export type BotListInfo = {
21
+ jid: string
22
+ personaId: string
23
+ }
24
+ export interface PresenceData {
25
+ lastKnownPresence: WAPresence
26
+ lastSeen?: number
27
+ }
28
+ export type ChatMutation = {
29
+ syncAction: proto.ISyncActionData
30
+ index: string[]
31
+ }
32
+ export type WAPatchCreate = {
33
+ syncAction: proto.ISyncActionValue
34
+ index: string[]
35
+ type: WAPatchName
36
+ apiVersion: number
37
+ operation: proto.SyncdMutation.SyncdOperation
38
+ }
39
+ export type Chat = proto.IConversation & {
40
+ /** unix timestamp of when the last message was received in the chat */
41
+ lastMessageRecvTimestamp?: number
42
+ }
43
+ export type ChatUpdate = Partial<Chat & {
44
+ /**
45
+ * if specified in the update,
46
+ * the EV buffer will check if the condition gets fulfilled before applying the update
47
+ * Right now, used to determine when to release an app state sync event
48
+ *
49
+ * @returns true, if the update should be applied
50
+ * false if it can be discarded
51
+ * undefined if the condition is not yet fulfilled
52
+ * */
53
+ conditional: (bufferedData: BufferedEventData) => boolean | undefined
54
+ }>
55
+ /**
56
+ * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
57
+ * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
58
+ * */
59
+ export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange
60
+ export type ChatModification = {
61
+ archive: boolean
62
+ lastMessages: LastMessageList
63
+ } | {
64
+ contact: ContactAction | null
65
+ } | {
66
+ pushNameSetting: string
67
+ } | {
68
+ pin: boolean
69
+ } | {
70
+ /** mute for duration, or provide timestamp of mute to remove*/
71
+ mute: number | null
72
+ } | {
73
+ clear: boolean
74
+ } | {
75
+ deleteForMe: {
76
+ deleteMedia: boolean
77
+ key: WAMessageKey
78
+ timestamp: number
79
+ }
80
+ } | {
81
+ star: {
82
+ messages: {
83
+ id: string
84
+ fromMe?: boolean
85
+ }[]
86
+ star: boolean
87
+ }
88
+ } | {
89
+ markRead: boolean
90
+ lastMessages: LastMessageList
91
+ } | {
92
+ delete: true
93
+ lastMessages: LastMessageList
94
+ } | {
95
+ addLabel: LabelActionBody
96
+ } | {
97
+ addChatLabel: ChatLabelAssociationActionBody
98
+ } | {
99
+ removeChatLabel: ChatLabelAssociationActionBody
100
+ } | {
101
+ addMessageLabel: MessageLabelAssociationActionBody
102
+ } | {
103
+ removeMessageLabel: MessageLabelAssociationActionBody
104
+ }
105
+ export type InitialReceivedChatsState = {
106
+ [jid: string]: {
107
+ /** the last message received from the other party */
108
+ lastMsgRecvTimestamp?: number
109
+ /** the absolute last message in the chat */
110
+ lastMsgTimestamp: number
111
+ }
112
+ }
113
+ export type InitialAppStateSyncOptions = {
114
+ accountSettings: AccountSettings
115
+ }
@@ -0,0 +1,6 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ const ALL_WA_PATCH_NAMES = ['critical_block', 'critical_unblock_low', 'regular_high', 'regular_low', 'regular']
4
+ module.exports = {
5
+ ALL_WA_PATCH_NAMES
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContactAction = exports.Contact = void 0;
4
+
5
+ const Contact = {
6
+ /** ID either in lid or jid format */
7
+ id: '',
8
+ /** ID in Lid (anonymous) format (@lid) */
9
+ lid: undefined,
10
+ /** ID in Phone Number format (@s.whatsapp.net) */
11
+ jid: undefined,
12
+ /** name of the contact, you have saved on your WA */
13
+ name: undefined,
14
+ /** name of the contact, the contact has set on their own on WA */
15
+ notify: undefined,
16
+ /** I have no idea */
17
+ verifiedName: undefined,
18
+ /**
19
+ * Url of the profile picture of the contact
20
+ *
21
+ * 'changed' => if the profile picture has changed
22
+ * null => if the profile picture has not been set (default profile picture)
23
+ * any other string => url of the profile picture
24
+ */
25
+ imgUrl: undefined,
26
+ status: undefined
27
+ };
28
+ exports.Contact = Contact;
29
+
30
+ const ContactAction = {
31
+ firstName: '',
32
+ fullName: '',
33
+ saveOnPrimaryAddressbook: false
34
+ };
35
+ exports.ContactAction = ContactAction;
@@ -0,0 +1,2 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -0,0 +1,208 @@
1
+ import type { Boom } from '@hapi/boom'
2
+ import { proto } from '../../WAProto'
3
+ import { AuthenticationCreds } from './Auth'
4
+ import { WACallEvent } from './Call'
5
+ import { Chat, ChatUpdate, PresenceData } from './Chat'
6
+ import { Contact } from './Contact'
7
+ import { GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata'
8
+ import { Label } from './Label'
9
+ import { LabelAssociation } from './LabelAssociation'
10
+ import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message'
11
+ import { NewsletterViewRole, SubscriberAction, NewsletterSettingsUpdate } from './Newsletter'
12
+ import { ConnectionState } from './State'
13
+ export type BaileysEventMap = {
14
+ /** connection state has been updated -- WS closed, opened, connecting etc. */
15
+ 'connection.update': Partial<ConnectionState>
16
+ /** credentials updated -- some metadata, keys or something */
17
+ 'creds.update': Partial<AuthenticationCreds>
18
+ /** set chats (history sync), everything is reverse chronologically sorted */
19
+ 'messaging-history.set': {
20
+ chats: Chat[]
21
+ contacts: Contact[]
22
+ messages: WAMessage[]
23
+ isLatest?: boolean
24
+ progress?: number | null
25
+ syncType?: proto.HistorySync.HistorySyncType
26
+ peerDataRequestSessionId?: string | null
27
+ }
28
+ /** upsert chats */
29
+ 'chats.upsert': Chat[]
30
+ /** update the given chats */
31
+ 'chats.update': ChatUpdate[]
32
+ 'chats.phoneNumberShare': {
33
+ lid: string
34
+ jid: string
35
+ }
36
+ /** delete chats with given ID */
37
+ 'chats.delete': string[]
38
+ /** presence of contact in a chat updated */
39
+ 'presence.update': {
40
+ id: string
41
+ presences: {
42
+ [participant: string]: PresenceData
43
+ }
44
+ }
45
+ 'contacts.upsert': Contact[]
46
+ 'contacts.update': Partial<Contact>[]
47
+ 'messages.delete': {
48
+ keys: WAMessageKey[]
49
+ } | {
50
+ jid: string
51
+ all: true
52
+ }
53
+ 'messages.update': WAMessageUpdate[]
54
+ 'messages.media-update': {
55
+ key: WAMessageKey
56
+ media?: {
57
+ ciphertext: Uint8Array
58
+ iv: Uint8Array
59
+ }
60
+ error?: Boom
61
+ }[]
62
+ /**
63
+ * add/update the given messages. If they were received while the connection was online,
64
+ * the update will have type: "notify"
65
+ * if requestId is provided, then the messages was received from the phone due to it being unavailable
66
+ * */
67
+ 'messages.upsert': {
68
+ messages: WAMessage[]
69
+ type: MessageUpsertType
70
+ requestId?: string
71
+ }
72
+ // 'messages.poll': {
73
+ // key: WAMessageKey
74
+ // pollUpdates: proto.IPollUpdateMessage
75
+ // }[]
76
+ /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
77
+ 'messages.reaction': {
78
+ key: WAMessageKey
79
+ reaction: proto.IReaction
80
+ }[]
81
+ 'message-receipt.update': MessageUserReceiptUpdate[]
82
+ 'groups.upsert': GroupMetadata[]
83
+ 'groups.update': Partial<GroupMetadata>[]
84
+ /** apply an action to participants in a group */
85
+ 'group-participants.update': {
86
+ id: string
87
+ author: string
88
+ participants: string[]
89
+ action: ParticipantAction
90
+ }
91
+ 'group.join-request': {
92
+ id: string
93
+ author: string
94
+ participant: string
95
+ action: RequestJoinAction
96
+ method: RequestJoinMethod
97
+ }
98
+ 'newsletter.reaction': {
99
+ id: string
100
+ newsletter_server_id: string
101
+ reaction: {
102
+ code?: string
103
+ count?: number
104
+ removed?: boolean
105
+ }
106
+ }
107
+ 'newsletter.view': {
108
+ id: string
109
+ newsletter_server_id: string
110
+ count: number
111
+ }
112
+ 'newsletter-participants.update': {
113
+ id: string
114
+ author: string
115
+ user: string
116
+ new_role: NewsletterViewRole
117
+ action: SubscriberAction
118
+ }
119
+ 'newsletter-settings.update': {
120
+ id: string
121
+ update: NewsletterSettingsUpdate
122
+ }
123
+ 'blocklist.set': {
124
+ blocklist: string[]
125
+ }
126
+ 'blocklist.update': {
127
+ blocklist: string[]
128
+ type: 'add' | 'remove'
129
+ }
130
+ /** Receive an update on a call, including when the call was received, rejected, accepted */
131
+ 'call': WACallEvent[]
132
+ 'labels.edit': Label
133
+ 'labels.association': {
134
+ association: LabelAssociation
135
+ type: 'add' | 'remove'
136
+ }
137
+ }
138
+ export type BufferedEventData = {
139
+ historySets: {
140
+ chats: {
141
+ [jid: string]: Chat
142
+ }
143
+ contacts: {
144
+ [jid: string]: Contact
145
+ }
146
+ messages: {
147
+ [uqId: string]: WAMessage
148
+ }
149
+ empty: boolean
150
+ isLatest: boolean
151
+ progress?: number | null
152
+ syncType?: proto.HistorySync.HistorySyncType
153
+ peerDataRequestSessionId?: string
154
+ }
155
+ chatUpserts: {
156
+ [jid: string]: Chat
157
+ }
158
+ chatUpdates: {
159
+ [jid: string]: ChatUpdate
160
+ }
161
+ chatDeletes: Set<string>
162
+ contactUpserts: {
163
+ [jid: string]: Contact
164
+ }
165
+ contactUpdates: {
166
+ [jid: string]: Partial<Contact>
167
+ }
168
+ messageUpserts: {
169
+ [key: string]: {
170
+ type: MessageUpsertType
171
+ message: WAMessage
172
+ }
173
+ }
174
+ messageUpdates: {
175
+ [key: string]: WAMessageUpdate
176
+ }
177
+ messageDeletes: {
178
+ [key: string]: WAMessageKey
179
+ }
180
+ // messagePollings: {
181
+ // [key: string]: {
182
+ // key: WAMessageKey
183
+ // pollUpdates: proto.IPollUpdateMessage[]
184
+ // }
185
+ // }
186
+ messageReactions: {
187
+ [key: string]: {
188
+ key: WAMessageKey
189
+ reactions: proto.IReaction[]
190
+ }
191
+ }
192
+ messageReceipts: {
193
+ [key: string]: {
194
+ key: WAMessageKey
195
+ userReceipt: proto.IUserReceipt[]
196
+ }
197
+ }
198
+ groupUpdates: {
199
+ [jid: string]: Partial<GroupMetadata>
200
+ }
201
+ }
202
+ export type BaileysEvent = keyof BaileysEventMap
203
+ export interface BaileysEventEmitter {
204
+ on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void
205
+ off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void
206
+ removeAllListeners<T extends keyof BaileysEventMap>(event: T): void
207
+ emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean
208
+ }
@@ -0,0 +1,2 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -0,0 +1,81 @@
1
+ import { Contact } from './Contact'
2
+
3
+ export type GroupParticipant = Contact & {
4
+ isAdmin?: boolean
5
+ isSuperAdmin?: boolean
6
+ admin?: 'admin' | 'superadmin' | 'member' | null
7
+ lid?: string // Added for lid support
8
+ }
9
+
10
+ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify'
11
+
12
+ export type RequestJoinAction = 'created' | 'revoked' | 'rejected'
13
+
14
+ export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined
15
+
16
+ export interface GroupMetadata {
17
+ id: string
18
+ /** group uses 'lid' or 'pn' to send messages */
19
+ addressingMode: 'pn' | 'lid'
20
+ owner: string | undefined
21
+ ownerJid?: string | undefined
22
+ subject: string
23
+ /** group subject owner */
24
+ subjectOwner?: string
25
+ subjectOwnerJid?: string
26
+ /** group subject modification date */
27
+ subjectTime?: number
28
+ creation?: number
29
+ desc?: string
30
+ descOwner?: string
31
+ descOwnerJid?: string
32
+ descId?: string
33
+ descTime?: number
34
+ /** if this group is part of a community, it returns the jid of the community to which it belongs */
35
+ linkedParent?: string
36
+ /** is set when the group only allows admins to change group settings */
37
+ restrict?: boolean
38
+ /** is set when the group only allows admins to write messages */
39
+ announce?: boolean
40
+ /** is set when the group also allows members to add participants */
41
+ memberAddMode?: boolean
42
+ /** Request approval to join the group */
43
+ joinApprovalMode?: boolean
44
+ /** is this a community */
45
+ isCommunity?: boolean
46
+ /** is this the announce of a community */
47
+ isCommunityAnnounce?: boolean
48
+ /** number of group participants */
49
+ size?: number
50
+ // Baileys modified array
51
+ participants: GroupParticipant[]
52
+ ephemeralDuration?: number
53
+ inviteCode?: string
54
+ /** the person who added you to group or changed some setting in group */
55
+ author?: string
56
+ // New properties added for lid support
57
+ ownerCountry?: string
58
+ picture?: string
59
+ }
60
+
61
+ export interface WAGroupCreateResponse {
62
+ status: number
63
+ gid?: string
64
+ participants?: [{ [key: string]: {} }]
65
+ }
66
+
67
+ export interface GroupModificationResponse {
68
+ status: number
69
+ participants?: { [key: string]: {} }
70
+ }
71
+
72
+ // Additional types for better lid support
73
+ export interface GroupMetadataLid extends GroupMetadata {
74
+ addressingMode: 'lid'
75
+ ownerJid: string
76
+ participants: (GroupParticipant & { lid: string })[]
77
+ }
78
+
79
+ export interface GroupMetadataPn extends GroupMetadata {
80
+ addressingMode: 'pn'
81
+ }
@@ -0,0 +1,2 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -0,0 +1,46 @@
1
+ export interface Label {
2
+ /** Label uniq ID */
3
+ id: string
4
+ /** Label name */
5
+ name: string
6
+ /** Label color ID */
7
+ color: number
8
+ /** Is label has been deleted */
9
+ deleted: boolean
10
+ /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
11
+ predefinedId?: string
12
+ }
13
+ export interface LabelActionBody {
14
+ id: string
15
+ /** Label name */
16
+ name?: string
17
+ /** Label color ID */
18
+ color?: number
19
+ /** Is label has been deleted */
20
+ deleted?: boolean
21
+ /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
22
+ predefinedId?: number
23
+ }
24
+ /** WhatsApp has 20 predefined colors */
25
+ export declare const enum LabelColor {
26
+ Color1 = 0,
27
+ Color2 = 1,
28
+ Color3 = 2,
29
+ Color4 = 3,
30
+ Color5 = 4,
31
+ Color6 = 5,
32
+ Color7 = 6,
33
+ Color8 = 7,
34
+ Color9 = 8,
35
+ Color10 = 9,
36
+ Color11 = 10,
37
+ Color12 = 11,
38
+ Color13 = 12,
39
+ Color14 = 13,
40
+ Color15 = 14,
41
+ Color16 = 15,
42
+ Color17 = 16,
43
+ Color18 = 17,
44
+ Color19 = 18,
45
+ Color20 = 19
46
+ }
@@ -0,0 +1,28 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ /** WhatsApp has 20 predefined colors */
4
+ const LabelColor = {
5
+ Color1: 0,
6
+ Color2: 1,
7
+ Color3: 2,
8
+ Color4: 3,
9
+ Color5: 4,
10
+ Color6: 5,
11
+ Color7: 6,
12
+ Color8: 7,
13
+ Color9: 8,
14
+ Color10: 9,
15
+ Color11: 10,
16
+ Color12: 11,
17
+ Color13: 12,
18
+ Color14: 13,
19
+ Color15: 14,
20
+ Color16: 15,
21
+ Color17: 16,
22
+ Color18: 17,
23
+ Color19: 18,
24
+ Color20: 19
25
+ }
26
+ module.exports = {
27
+ LabelColor
28
+ }
@@ -0,0 +1,29 @@
1
+ /** Association type */
2
+ export declare const enum LabelAssociationType {
3
+ Chat = "label_jid",
4
+ Message = "label_message"
5
+ }
6
+ export type LabelAssociationTypes = LabelAssociationType
7
+ /** Association for chat */
8
+ export interface ChatLabelAssociation {
9
+ type: LabelAssociationType.Chat
10
+ chatId: string
11
+ labelId: string
12
+ }
13
+ /** Association for message */
14
+ export interface MessageLabelAssociation {
15
+ type: LabelAssociationType.Message
16
+ chatId: string
17
+ messageId: string
18
+ labelId: string
19
+ }
20
+ export type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation
21
+ /** Body for add/remove chat label association action */
22
+ export interface ChatLabelAssociationActionBody {
23
+ labelId: string
24
+ }
25
+ /** body for add/remove message label association action */
26
+ export interface MessageLabelAssociationActionBody {
27
+ labelId: string
28
+ messageId: string
29
+ }
@@ -0,0 +1,10 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ /** Association type */
4
+ const LabelAssociationType = {
5
+ Chat: "label_jid",
6
+ Message: "label_message"
7
+ }
8
+ module.exports = {
9
+ LabelAssociationType
10
+ }