@neelegirl/baileys 1.5.5 → 1.5.7

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