@hansaka02/baileys 7.3.2 → 7.3.4

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 (202) hide show
  1. package/README.md +247 -203
  2. package/lib/Defaults/connection.js +51 -0
  3. package/lib/Defaults/constants.js +62 -0
  4. package/lib/Defaults/history.js +17 -0
  5. package/lib/Defaults/index.js +36 -142
  6. package/lib/Defaults/media.js +48 -0
  7. package/lib/Defaults/prefix.js +18 -0
  8. package/lib/Signal/Group/group-session-builder.js +10 -42
  9. package/lib/Signal/Group/group_cipher.js +9 -6
  10. package/lib/Signal/Group/index.js +39 -53
  11. package/lib/Signal/Group/keyhelper.js +8 -41
  12. package/lib/Signal/Group/sender-chain-key.js +4 -4
  13. package/lib/Signal/Group/sender-key-distribution-message.js +5 -5
  14. package/lib/Signal/Group/sender-key-message.js +12 -8
  15. package/lib/Signal/Group/sender-key-record.js +7 -7
  16. package/lib/Signal/Group/sender-key-state.js +4 -4
  17. package/lib/Signal/Group/sender-message-key.js +2 -2
  18. package/lib/Signal/libsignal.js +45 -69
  19. package/lib/Signal/lid-mapping.js +15 -11
  20. package/lib/Socket/Client/types.js +2 -2
  21. package/lib/Socket/Client/websocket.js +16 -14
  22. package/lib/Socket/business.js +41 -32
  23. package/lib/Socket/chats.js +123 -98
  24. package/lib/Socket/community.js +50 -40
  25. package/lib/Socket/groups.js +59 -47
  26. package/lib/Socket/index.js +4 -4
  27. package/lib/Socket/messages-recv.js +219 -172
  28. package/lib/Socket/messages-send.js +187 -143
  29. package/lib/Socket/newsletter.js +61 -47
  30. package/lib/Socket/socket.js +133 -90
  31. package/lib/Socket/usync.js +6 -6
  32. package/lib/Store/index.js +27 -11
  33. package/lib/Store/make-cache-manager-store.js +14 -15
  34. package/lib/Store/make-in-memory-store.js +28 -24
  35. package/lib/Types/LabelAssociation.js +2 -2
  36. package/lib/Types/Message.js +6 -6
  37. package/lib/Types/MexUpdates.js +5 -5
  38. package/lib/Types/State.js +4 -4
  39. package/lib/Types/index.js +28 -12
  40. package/lib/Utils/auth-utils.js +28 -26
  41. package/lib/Utils/baileys-event-stream.js +68 -69
  42. package/lib/Utils/business.js +63 -53
  43. package/lib/Utils/chat-utils.js +81 -71
  44. package/lib/Utils/crypto.js +25 -45
  45. package/lib/Utils/decode-wa-message.js +319 -311
  46. package/lib/Utils/event-buffer.js +21 -22
  47. package/lib/Utils/generics.js +65 -82
  48. package/lib/Utils/history.js +21 -21
  49. package/lib/Utils/index.js +27 -13
  50. package/lib/Utils/link-preview.js +7 -30
  51. package/lib/Utils/logger.js +5 -5
  52. package/lib/Utils/lt-hash.js +3 -3
  53. package/lib/Utils/message-retry-manager.js +4 -4
  54. package/lib/Utils/messages-media.js +104 -109
  55. package/lib/Utils/messages.js +203 -171
  56. package/lib/Utils/noise-handler.js +28 -19
  57. package/lib/Utils/process-message.js +111 -96
  58. package/lib/Utils/signal.js +36 -25
  59. package/lib/Utils/use-multi-file-auth-state.js +18 -22
  60. package/lib/Utils/validate-connection.js +52 -45
  61. package/lib/WABinary/decode.js +6 -32
  62. package/lib/WABinary/encode.js +3 -29
  63. package/lib/WABinary/generic-utils.js +4 -4
  64. package/lib/WABinary/index.js +27 -11
  65. package/lib/WAM/encode.js +16 -8
  66. package/lib/WAM/index.js +27 -11
  67. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
  68. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  69. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
  70. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  71. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
  72. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  73. package/lib/WAUSync/Protocols/index.js +27 -11
  74. package/lib/WAUSync/USyncQuery.js +17 -10
  75. package/lib/WAUSync/index.js +27 -11
  76. package/lib/index.js +60 -31
  77. package/package.json +8 -14
  78. package/WAProto/AICommon/AICommon.d.ts +0 -11702
  79. package/WAProto/Adv/Adv.d.ts +0 -643
  80. package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
  81. package/WAProto/Cert/Cert.d.ts +0 -613
  82. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
  83. package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
  84. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
  85. package/WAProto/E2E/E2E.d.ts +0 -41724
  86. package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
  87. package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
  88. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
  89. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
  90. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
  91. package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
  92. package/WAProto/Protocol/Protocol.d.ts +0 -270
  93. package/WAProto/Reporting/Reporting.d.ts +0 -371
  94. package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
  95. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
  96. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
  97. package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
  98. package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
  99. package/WAProto/UserPassword/UserPassword.d.ts +0 -363
  100. package/WAProto/VnameCert/VnameCert.d.ts +0 -821
  101. package/WAProto/Wa6/Wa6.d.ts +0 -2128
  102. package/WAProto/Web/Web.d.ts +0 -46383
  103. package/WAProto/index.d.ts +0 -55
  104. package/lib/Defaults/index.d.ts +0 -77
  105. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  106. package/lib/Signal/Group/group-session-builder.d.ts +0 -17
  107. package/lib/Signal/Group/group_cipher.d.ts +0 -19
  108. package/lib/Signal/Group/index.d.ts +0 -11
  109. package/lib/Signal/Group/keyhelper.d.ts +0 -16
  110. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  112. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  113. package/lib/Signal/Group/sender-key-name.d.ts +0 -19
  114. package/lib/Signal/Group/sender-key-record.d.ts +0 -32
  115. package/lib/Signal/Group/sender-key-state.d.ts +0 -44
  116. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  117. package/lib/Signal/libsignal.d.ts +0 -8
  118. package/lib/Signal/lid-mapping.d.ts +0 -28
  119. package/lib/Socket/Client/index.d.ts +0 -2
  120. package/lib/Socket/Client/types.d.ts +0 -16
  121. package/lib/Socket/Client/websocket.d.ts +0 -13
  122. package/lib/Socket/business.d.ts +0 -187
  123. package/lib/Socket/chats.d.ts +0 -97
  124. package/lib/Socket/community.d.ts +0 -129
  125. package/lib/Socket/groups.d.ts +0 -129
  126. package/lib/Socket/index.d.ts +0 -191
  127. package/lib/Socket/messages-recv.d.ts +0 -174
  128. package/lib/Socket/messages-send.d.ts +0 -165
  129. package/lib/Socket/newsletter.d.ts +0 -145
  130. package/lib/Socket/socket.d.ts +0 -45
  131. package/lib/Socket/usync.d.ts +0 -37
  132. package/lib/Store/index.d.ts +0 -4
  133. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  134. package/lib/Store/make-in-memory-store.d.ts +0 -123
  135. package/lib/Store/make-ordered-dictionary.d.ts +0 -12
  136. package/lib/Store/object-repository.d.ts +0 -10
  137. package/lib/Types/Auth.d.ts +0 -121
  138. package/lib/Types/Bussiness.d.ts +0 -28
  139. package/lib/Types/Call.d.ts +0 -14
  140. package/lib/Types/Chat.d.ts +0 -143
  141. package/lib/Types/Contact.d.ts +0 -23
  142. package/lib/Types/Events.d.ts +0 -226
  143. package/lib/Types/GroupMetadata.d.ts +0 -66
  144. package/lib/Types/Label.d.ts +0 -48
  145. package/lib/Types/LabelAssociation.d.ts +0 -35
  146. package/lib/Types/Message.d.ts +0 -484
  147. package/lib/Types/MexUpdates.d.ts +0 -9
  148. package/lib/Types/Newsletter.d.ts +0 -109
  149. package/lib/Types/Product.d.ts +0 -92
  150. package/lib/Types/Signal.d.ts +0 -98
  151. package/lib/Types/Socket.d.ts +0 -141
  152. package/lib/Types/State.d.ts +0 -41
  153. package/lib/Types/USync.d.ts +0 -26
  154. package/lib/Types/index.d.ts +0 -80
  155. package/lib/Utils/auth-utils.d.ts +0 -21
  156. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  157. package/lib/Utils/business.d.ts +0 -29
  158. package/lib/Utils/chat-utils.d.ts +0 -82
  159. package/lib/Utils/crypto.d.ts +0 -56
  160. package/lib/Utils/decode-wa-message.d.ts +0 -53
  161. package/lib/Utils/event-buffer.d.ts +0 -39
  162. package/lib/Utils/generics.d.ts +0 -117
  163. package/lib/Utils/history.d.ts +0 -23
  164. package/lib/Utils/index.d.ts +0 -20
  165. package/lib/Utils/link-preview.d.ts +0 -23
  166. package/lib/Utils/logger.d.ts +0 -13
  167. package/lib/Utils/lt-hash.d.ts +0 -14
  168. package/lib/Utils/make-mutex.d.ts +0 -9
  169. package/lib/Utils/message-retry-manager.d.ts +0 -88
  170. package/lib/Utils/messages-media.d.ts +0 -135
  171. package/lib/Utils/messages.d.ts +0 -105
  172. package/lib/Utils/noise-handler.d.ts +0 -20
  173. package/lib/Utils/process-message.d.ts +0 -49
  174. package/lib/Utils/signal.d.ts +0 -42
  175. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  176. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  177. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  178. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  179. package/lib/Utils/use-single-file-auth-state.js +0 -80
  180. package/lib/Utils/validate-connection.d.ts +0 -13
  181. package/lib/WABinary/constants.d.ts +0 -30
  182. package/lib/WABinary/decode.d.ts +0 -9
  183. package/lib/WABinary/encode.d.ts +0 -3
  184. package/lib/WABinary/generic-utils.d.ts +0 -28
  185. package/lib/WABinary/index.d.ts +0 -5
  186. package/lib/WABinary/jid-utils.d.ts +0 -58
  187. package/lib/WABinary/types.d.ts +0 -22
  188. package/lib/WAM/BinaryInfo.d.ts +0 -16
  189. package/lib/WAM/constants.d.ts +0 -47
  190. package/lib/WAM/encode.d.ts +0 -3
  191. package/lib/WAM/index.d.ts +0 -3
  192. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
  193. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  194. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
  195. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
  196. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
  197. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
  198. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  199. package/lib/WAUSync/USyncQuery.d.ts +0 -31
  200. package/lib/WAUSync/USyncUser.d.ts +0 -12
  201. package/lib/WAUSync/index.d.ts +0 -3
  202. package/lib/index.d.ts +0 -13
@@ -1,484 +0,0 @@
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
- remoteJidAlt?: string
23
- participantAlt?: string
24
- newsletter_server_id?: string
25
- isViewOnce?: boolean
26
- };
27
-
28
- export type WATextMessage = proto.Message.IExtendedTextMessage
29
-
30
- export type WAContextInfo = proto.IContextInfo
31
-
32
- export type WALocationMessage = proto.Message.ILocationMessage
33
-
34
- export type WAOrderMessage = proto.Message.IOrderMessage
35
-
36
- export type WAEventMessage = proto.Message.IEventMessage
37
-
38
- export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage
39
-
40
- export declare const WAMessageStubType = proto.WebMessageInfo.StubType
41
-
42
- export declare const WAMessageStatus = proto.WebMessageInfo.Status
43
-
44
- export type WAMediaUpload = Buffer | {
45
- url: URL | string
46
- } | {
47
- stream: Readable
48
- }
49
-
50
- /** Set of message types that are supported by the library */
51
- export type MessageType = keyof proto.Message
52
-
53
- export declare enum WAMessageAddressingMode {
54
- PN = 'pn',
55
- LID = 'lid'
56
- }
57
-
58
- export type DownloadableMessage = {
59
- mediaKey?: Uint8Array | null
60
- directPath?: string | null
61
- url?: string | null
62
- }
63
-
64
- export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined
65
-
66
- export type MediaConnInfo = {
67
- auth: string
68
- ttl: number
69
- hosts: {
70
- hostname: string
71
- maxContentLengthBytes: number
72
- }[]
73
- fetchDate: Date
74
- }
75
-
76
- export interface StickerPack {
77
- stickers: Sticker[]
78
- cover: WAMediaUpload
79
- name: string
80
- publisher: string
81
- description?: string
82
- packId?: string
83
- }
84
-
85
- export interface Carousel {
86
- image?: WAMediaUpload
87
- video?: WAMediaUpload
88
- product?: WASendableProduct
89
- title?: string
90
- body?: string
91
- footer?: string
92
- buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[]
93
- }
94
-
95
- export interface WAUrlInfo {
96
- 'canonical-url': string
97
- 'matched-text': string
98
- title: string
99
- description?: string
100
- jpegThumbnail?: Buffer
101
- highQualityThumbnail?: proto.Message.IImageMessage
102
- originalThumbnailUrl?: string
103
- }
104
-
105
- type Mentionable = {
106
- /** list of jids that are mentioned in the accompanying text */
107
- mentions?: string[]
108
- }
109
-
110
- type Contextable = {
111
- /** add contextInfo to the message */
112
- contextInfo?: proto.IContextInfo
113
- }
114
-
115
- type Ephemeral = {
116
- ephemeral?: boolean
117
- }
118
-
119
- type ViewOnce = {
120
- viewOnce?: boolean
121
- }
122
-
123
- type ViewOnceExt = {
124
- viewOnceExt?: boolean
125
- }
126
-
127
- type Buttonable = {
128
- /** add buttons to the message */
129
- buttons?: proto.Message.ButtonsMessage.IButton[]
130
- }
131
-
132
- type Templatable = {
133
- /** add buttons to the message (conflicts with normal buttons)*/
134
- templateButtons?: proto.IHydratedTemplateButton[]
135
- footer?: string
136
- }
137
-
138
- type Interactiveable = {
139
- /** add buttons to the message (conflicts with normal buttons)*/
140
- interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]
141
- title?: string
142
- subtitle?: string
143
- footer?: string
144
- hasMediaAttachment?: boolean
145
- }
146
-
147
- type Shopable = {
148
- shop?: proto.Message.InteractiveMessage.ShopMessage
149
- title?: string
150
- subtitle?: string
151
- footer?: string
152
- hasMediaAttachment?: boolean
153
- }
154
-
155
- type Collectionable = {
156
- collection?: proto.Message.InteractiveMessage.CollectionMessage
157
- title?: string
158
- subtitle?: string
159
- footer?: string
160
- hasMediaAttachment?: boolean
161
- }
162
-
163
- type Listable = {
164
- /** Sections of the List */
165
- sections?: proto.Message.ListMessage.ISection[]
166
- /** Title of a List Message only */
167
- title?: string
168
- /** Text of the button on the list (required) */
169
- buttonText?: string
170
- /** ListType of a List Message only */
171
- listType?: proto.Message.ListMessage.ListType
172
- }
173
-
174
- type Cardsable = {
175
- cards?: Carousel[]
176
- title?: string
177
- subtitle?: string
178
- footer?: string
179
- }
180
-
181
- type Editable = {
182
- edit?: WAMessageKey
183
- }
184
-
185
- type WithDimensions = {
186
- width?: number
187
- height?: number
188
- }
189
-
190
- export type Sticker = {
191
- data: WAMediaUpload
192
- emojis?: string[]
193
- accessibilityLabel?: string
194
- }
195
-
196
- export type PollMessageOptions = {
197
- name: string
198
- selectableCount?: number
199
- values: string[]
200
- /** 32 byte message secret to encrypt poll selections */
201
- messageSecret?: Uint8Array
202
- toAnnouncementGroup?: boolean
203
- }
204
-
205
- export type PollResultOptions = {
206
- name: string
207
- values: string[]
208
- }
209
-
210
- type SharePhoneNumber = {
211
- sharePhoneNumber: boolean
212
- }
213
-
214
- type RequestPhoneNumber = {
215
- requestPhoneNumber: boolean
216
- }
217
-
218
- export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING
219
-
220
- export type AnyMediaMessageContent = (({
221
- image: WAMediaUpload
222
- caption?: string
223
- jpegThumbnail?: string
224
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | ({
225
- video: WAMediaUpload
226
- caption?: string
227
- gifPlayback?: boolean
228
- jpegThumbnail?: string
229
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | {
230
- audio: WAMediaUpload
231
- /** if set to true, will send as a `voice note` */
232
- ptt?: boolean
233
- /** optionally tell the duration of the audio */
234
- seconds?: number
235
- } | ({
236
- sticker: WAMediaUpload
237
- isAnimated?: boolean
238
- } & WithDimensions) | ({
239
- document: WAMediaUpload
240
- mimetype: string
241
- fileName?: string
242
- caption?: string
243
- } & Contextable & Buttonable & Templatable & Interactiveable )) & {
244
- mimetype?: string
245
- } & Editable
246
-
247
- export type ButtonReplyInfo = {
248
- displayText: string
249
- id: string
250
- index: number
251
- }
252
-
253
- export type GroupInviteInfo = {
254
- code: string
255
- expiration: number
256
- caption: string
257
- jid: string
258
- name: string
259
- jpegThumbnail?: string
260
- }
261
-
262
- export type CallCreationInfo = {
263
- time?: number
264
- type?: number
265
- name: string
266
- }
267
-
268
- export type AdminInviteInfo = {
269
- jid: string
270
- name: string
271
- caption: string
272
- expiration: number
273
- jpegThumbnail: string
274
- }
275
-
276
- export type PinInfo = {
277
- key: WAMessageKey
278
- type?: number
279
- time?: number
280
- }
281
-
282
- export type KeepInfo = {
283
- key: WAMessageKey
284
- type: number
285
- }
286
-
287
- export type PaymentInfo = {
288
- note: string
289
- currency?: string
290
- offset?: number
291
- amount?: number
292
- expiry?: number
293
- from?: string
294
- image?: {
295
- placeholderArgb: number
296
- textArgb: number
297
- subtextArgb: number
298
- }
299
- }
300
-
301
- export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
302
- productImage: WAMediaUpload
303
- }
304
-
305
- export type AnyRegularMessageContent = (({
306
- text: string
307
- linkPreview?: WAUrlInfo | null
308
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | AnyMediaMessageContent | ({
309
- poll: PollMessageOptions
310
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | {
311
- contacts: {
312
- displayName?: string
313
- contacts: proto.Message.IContactMessage[]
314
- }
315
- } | {
316
- location: WALocationMessage
317
- } | {
318
- react: proto.Message.IReactionMessage
319
- } | {
320
- buttonReply: ButtonReplyInfo
321
- type: 'template' | 'plain' | 'list' | 'interactive'
322
- } | {
323
- groupInvite: GroupInviteInfo
324
- } | {
325
- pin: PinInfo
326
- } | {
327
- keep: KeepInfo
328
- } | {
329
- call: CallCreationInfo
330
- } | {
331
- event: WAEventMessage
332
- } | {
333
- adminInvite: AdminInviteInfo
334
- } | {
335
- payment: PaymentInfo
336
- } | {
337
- paymentInvite: {
338
- type: number
339
- expiry: number
340
- }
341
- } | {
342
- pollResult: PollResultOptions
343
- } | {
344
- order: WAOrderMessage
345
- } | {
346
- product: WASendableProduct
347
- businessOwnerJid?: string
348
- body?: string
349
- footer?: string
350
- } | {
351
- stickerPack: StickerPack
352
- } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce & ViewOnceExt
353
-
354
- export type AnyMessageContent = AnyRegularMessageContent | {
355
- forward: WAMessage
356
- force?: boolean
357
- } | {
358
- /** Delete your message or anyone's message in a group (admin required) */
359
- delete: WAMessageKey
360
- } | {
361
- disappearingMessagesInChat: boolean | number
362
- }
363
-
364
- export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>
365
-
366
- type MinimalRelayOptions = {
367
- /** override the message ID with a custom provided string */
368
- messageId?: string
369
- /** should we use group metadata cache, or fetch afresh from the server default assumed to be "true" */
370
- useCachedGroupMetadata?: boolean
371
- }
372
-
373
- export type MessageRelayOptions = MinimalRelayOptions & {
374
- /** only send to a specific participant used when a message decryption fails for a single user */
375
- participant?: {
376
- jid: string
377
- count: number
378
- }
379
- /** additional attributes to add to the WA binary node */
380
- additionalAttributes?: {
381
- [_: string]: string
382
- }
383
- additionalNodes?: BinaryNode[]
384
- /** should we use the devices cache, or fetch afresh from the server default assumed to be "true" */
385
- useUserDevicesCache?: boolean
386
- /** jid list of participants for status@broadcast */
387
- statusJidList?: string[]
388
- newsletter?: boolean
389
- }
390
-
391
- export type MiscMessageGenerationOptions = MinimalRelayOptions & {
392
- /** optional, if you want to manually set the timestamp of the message */
393
- timestamp?: Date
394
- /** the message you want to quote */
395
- quoted?: WAMessage
396
- /** disappearing messages settings */
397
- ephemeralExpiration?: number | string
398
- /** timeout for media upload to WA server */
399
- mediaUploadTimeoutMs?: number
400
- /** jid list of participants for status@broadcast */
401
- statusJidList?: string[]
402
- /** backgroundcolor for status */
403
- backgroundColor?: string
404
- /** font type for status */
405
- font?: number
406
- /** if it is broadcast */
407
- broadcast?: boolean
408
- newsletter?: boolean
409
- additionalNodes?: BinaryNode[]
410
- }
411
-
412
- export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
413
- userJid: string
414
- }
415
-
416
- export type WAMediaUploadFunctionOpts = {
417
- fileEncSha256B64: string
418
- mediaType: MediaType
419
- newsletter?: boolean
420
- timeoutMs?: number
421
- }
422
-
423
- export type WAMediaUploadFunction = (encFilePath: string | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
424
- mediaUrl: string
425
- directPath: string
426
- handle?: string
427
- meta_hmac?: string
428
- ts?: number
429
- fbid?: number
430
- }>
431
-
432
- export type MediaGenerationOptions = {
433
- logger?: ILogger
434
- mediaTypeOverride?: MediaType
435
- upload: WAMediaUploadFunction
436
- /** cache media so it does not have to be uploaded again */
437
- mediaCache?: CacheStore
438
- mediaUploadTimeoutMs?: number
439
- options?: AxiosRequestConfig
440
- backgroundColor?: string
441
- font?: number
442
- /** The message is for newsletter? */
443
- newsletter?: boolean
444
- }
445
-
446
- export type MessageContentGenerationOptions = MediaGenerationOptions & {
447
- getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>
448
- getProfilePicUrl?: (jid: string) => Promise<string | undefined>
449
- getCallLink?: (type: 'audio' | 'video', event?: number) => Promise<string | undefined>
450
- }
451
-
452
- export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent
453
- /**
454
- * Type of message upsert
455
- * 1. notify => notify the user, this message was just received
456
- * 2. append => append the message to the chat history, no notification required
457
- */
458
- export type MessageUpsertType = 'append' | 'notify'
459
-
460
- export type MessageUserReceipt = proto.IUserReceipt
461
-
462
- export type WAMessageUpdate = {
463
- update: Partial<WAMessage>
464
- key: proto.IMessageKey
465
- }
466
-
467
- export type WAMessageCursor = {
468
- before: WAMessageKey | undefined
469
- } | {
470
- after: WAMessageKey | undefined
471
- }
472
-
473
- export type MessageUserReceiptUpdate = {
474
- key: proto.IMessageKey
475
- receipt: MessageUserReceipt
476
- }
477
-
478
- export type MediaDecryptionKeyInfo = {
479
- iv: Buffer
480
- cipherKey: Buffer
481
- macKey?: Buffer
482
- }
483
-
484
- export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>
@@ -1,9 +0,0 @@
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
- }
@@ -1,109 +0,0 @@
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
- }
@@ -1,92 +0,0 @@
1
- import { WAMediaUpload } from './Message'
2
-
3
- export type CatalogResult = {
4
- data: {
5
- paging: {
6
- cursors: {
7
- before: string
8
- after: string
9
- }
10
- }
11
- data: any[]
12
- }
13
- }
14
-
15
- export type ProductCreateResult = {
16
- data: {
17
- product: {}
18
- }
19
- }
20
-
21
- export type CatalogStatus = {
22
- status: string
23
- canAppeal: boolean
24
- }
25
-
26
- export type CatalogCollection = {
27
- id: string
28
- name: string
29
- products: Product[]
30
- status: CatalogStatus
31
- }
32
-
33
- export type ProductAvailability = 'in stock'
34
-
35
- export type ProductBase = {
36
- name: string
37
- retailerId?: string
38
- url?: string
39
- description: string
40
- price: number
41
- currency: string
42
- isHidden?: boolean
43
- }
44
-
45
- export type ProductCreate = ProductBase & {
46
- /** ISO country code for product origin. Set to undefined for no country */
47
- originCountryCode: string | undefined
48
- /** images of the product */
49
- images: WAMediaUpload[]
50
- }
51
-
52
- export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>
53
-
54
- export type Product = ProductBase & {
55
- id: string
56
- imageUrls: {
57
- [_: string]: string
58
- }
59
- reviewStatus: {
60
- [_: string]: string
61
- }
62
- availability: ProductAvailability
63
- }
64
-
65
- export type OrderPrice = {
66
- currency: string
67
- total: number
68
- }
69
-
70
- export type OrderProduct = {
71
- id: string
72
- imageUrl: string
73
- name: string
74
- quantity: number
75
- currency: string
76
- price: number
77
- }
78
-
79
- export type OrderDetails = {
80
- price: OrderPrice
81
- products: OrderProduct[]
82
- }
83
-
84
- export type CatalogCursor = string
85
-
86
- export type GetCatalogOptions = {
87
- /** cursor to start from */
88
- cursor?: CatalogCursor
89
- /** number of products to fetch */
90
- limit?: number
91
- jid?: string
92
- }