@hansaka02/baileys 7.3.2 → 7.3.6

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 (210) hide show
  1. package/lib/Defaults/baileys-version.json +2 -2
  2. package/lib/Defaults/connection.js +51 -0
  3. package/lib/Defaults/constants.js +74 -0
  4. package/lib/Defaults/history.js +19 -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 +5 -18
  13. package/lib/Signal/Group/sender-key-distribution-message.js +7 -7
  14. package/lib/Signal/Group/sender-key-message.js +12 -8
  15. package/lib/Signal/Group/sender-key-record.js +7 -16
  16. package/lib/Signal/Group/sender-key-state.js +15 -61
  17. package/lib/Signal/Group/sender-message-key.js +2 -2
  18. package/lib/Signal/libsignal.js +237 -177
  19. package/lib/Signal/lid-mapping.js +128 -71
  20. package/lib/Socket/Client/types.js +2 -2
  21. package/lib/Socket/Client/websocket.js +25 -16
  22. package/lib/Socket/business.js +46 -33
  23. package/lib/Socket/chats.js +286 -170
  24. package/lib/Socket/community.js +215 -77
  25. package/lib/Socket/groups.js +77 -61
  26. package/lib/Socket/index.js +4 -4
  27. package/lib/Socket/messages-recv.js +629 -457
  28. package/lib/Socket/messages-send.js +645 -656
  29. package/lib/Socket/mex.js +61 -0
  30. package/lib/Socket/newsletter.js +166 -245
  31. package/lib/Socket/socket.js +396 -170
  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/Newsletter.js +32 -25
  39. package/lib/Types/State.js +4 -4
  40. package/lib/Types/index.js +28 -12
  41. package/lib/Utils/auth-utils.js +212 -375
  42. package/lib/Utils/baileys-event-stream.js +68 -69
  43. package/lib/Utils/browser-utils.js +43 -0
  44. package/lib/Utils/business.js +63 -53
  45. package/lib/Utils/chat-utils.js +241 -106
  46. package/lib/Utils/crypto.js +25 -45
  47. package/lib/Utils/decode-wa-message.js +361 -311
  48. package/lib/Utils/event-buffer.js +97 -42
  49. package/lib/Utils/generics.js +90 -207
  50. package/lib/Utils/history.js +29 -27
  51. package/lib/Utils/index.js +28 -14
  52. package/lib/Utils/link-preview.js +24 -62
  53. package/lib/Utils/logger.js +5 -5
  54. package/lib/Utils/lt-hash.js +29 -23
  55. package/lib/Utils/make-mutex.js +26 -28
  56. package/lib/Utils/message-retry-manager.js +55 -7
  57. package/lib/Utils/messages-media.js +434 -247
  58. package/lib/Utils/messages.js +963 -917
  59. package/lib/Utils/noise-handler.js +60 -20
  60. package/lib/Utils/pre-key-manager.js +126 -0
  61. package/lib/Utils/process-message.js +216 -141
  62. package/lib/Utils/signal.js +75 -37
  63. package/lib/Utils/use-multi-file-auth-state.js +18 -22
  64. package/lib/Utils/validate-connection.js +96 -66
  65. package/lib/WABinary/constants.js +1268 -1268
  66. package/lib/WABinary/decode.js +62 -34
  67. package/lib/WABinary/encode.js +57 -36
  68. package/lib/WABinary/generic-utils.js +4 -4
  69. package/lib/WABinary/index.js +27 -11
  70. package/lib/WABinary/jid-utils.js +58 -11
  71. package/lib/WAM/constants.js +19064 -11563
  72. package/lib/WAM/encode.js +71 -14
  73. package/lib/WAM/index.js +27 -11
  74. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
  75. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  76. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
  77. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  78. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
  79. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  80. package/lib/WAUSync/Protocols/index.js +27 -11
  81. package/lib/WAUSync/USyncQuery.js +51 -28
  82. package/lib/WAUSync/index.js +27 -11
  83. package/lib/index.js +60 -31
  84. package/package.json +12 -17
  85. package/WAProto/AICommon/AICommon.d.ts +0 -11702
  86. package/WAProto/Adv/Adv.d.ts +0 -643
  87. package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
  88. package/WAProto/Cert/Cert.d.ts +0 -613
  89. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
  90. package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
  91. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
  92. package/WAProto/E2E/E2E.d.ts +0 -41724
  93. package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
  94. package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
  95. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
  96. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
  97. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
  98. package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
  99. package/WAProto/Protocol/Protocol.d.ts +0 -270
  100. package/WAProto/Reporting/Reporting.d.ts +0 -371
  101. package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
  102. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
  103. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
  104. package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
  105. package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
  106. package/WAProto/UserPassword/UserPassword.d.ts +0 -363
  107. package/WAProto/VnameCert/VnameCert.d.ts +0 -821
  108. package/WAProto/Wa6/Wa6.d.ts +0 -2128
  109. package/WAProto/Web/Web.d.ts +0 -46383
  110. package/WAProto/index.d.ts +0 -55
  111. package/lib/Defaults/index.d.ts +0 -77
  112. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  113. package/lib/Signal/Group/group-session-builder.d.ts +0 -17
  114. package/lib/Signal/Group/group_cipher.d.ts +0 -19
  115. package/lib/Signal/Group/index.d.ts +0 -11
  116. package/lib/Signal/Group/keyhelper.d.ts +0 -16
  117. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  118. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  119. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  120. package/lib/Signal/Group/sender-key-name.d.ts +0 -19
  121. package/lib/Signal/Group/sender-key-record.d.ts +0 -32
  122. package/lib/Signal/Group/sender-key-state.d.ts +0 -44
  123. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  124. package/lib/Signal/libsignal.d.ts +0 -8
  125. package/lib/Signal/lid-mapping.d.ts +0 -28
  126. package/lib/Socket/Client/index.d.ts +0 -2
  127. package/lib/Socket/Client/types.d.ts +0 -16
  128. package/lib/Socket/Client/websocket.d.ts +0 -13
  129. package/lib/Socket/business.d.ts +0 -187
  130. package/lib/Socket/chats.d.ts +0 -97
  131. package/lib/Socket/community.d.ts +0 -129
  132. package/lib/Socket/groups.d.ts +0 -129
  133. package/lib/Socket/index.d.ts +0 -191
  134. package/lib/Socket/messages-recv.d.ts +0 -174
  135. package/lib/Socket/messages-send.d.ts +0 -165
  136. package/lib/Socket/newsletter.d.ts +0 -145
  137. package/lib/Socket/socket.d.ts +0 -45
  138. package/lib/Socket/usync.d.ts +0 -37
  139. package/lib/Socket/usync.js +0 -83
  140. package/lib/Store/index.d.ts +0 -4
  141. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  142. package/lib/Store/make-in-memory-store.d.ts +0 -123
  143. package/lib/Store/make-ordered-dictionary.d.ts +0 -12
  144. package/lib/Store/object-repository.d.ts +0 -10
  145. package/lib/Types/Auth.d.ts +0 -121
  146. package/lib/Types/Bussiness.d.ts +0 -28
  147. package/lib/Types/Call.d.ts +0 -14
  148. package/lib/Types/Chat.d.ts +0 -143
  149. package/lib/Types/Contact.d.ts +0 -23
  150. package/lib/Types/Events.d.ts +0 -226
  151. package/lib/Types/GroupMetadata.d.ts +0 -66
  152. package/lib/Types/Label.d.ts +0 -48
  153. package/lib/Types/LabelAssociation.d.ts +0 -35
  154. package/lib/Types/Message.d.ts +0 -484
  155. package/lib/Types/MexUpdates.d.ts +0 -9
  156. package/lib/Types/Newsletter.d.ts +0 -109
  157. package/lib/Types/Product.d.ts +0 -92
  158. package/lib/Types/Signal.d.ts +0 -98
  159. package/lib/Types/Socket.d.ts +0 -141
  160. package/lib/Types/State.d.ts +0 -41
  161. package/lib/Types/USync.d.ts +0 -26
  162. package/lib/Types/index.d.ts +0 -80
  163. package/lib/Utils/auth-utils.d.ts +0 -21
  164. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  165. package/lib/Utils/business.d.ts +0 -29
  166. package/lib/Utils/chat-utils.d.ts +0 -82
  167. package/lib/Utils/crypto.d.ts +0 -56
  168. package/lib/Utils/decode-wa-message.d.ts +0 -53
  169. package/lib/Utils/event-buffer.d.ts +0 -39
  170. package/lib/Utils/generics.d.ts +0 -117
  171. package/lib/Utils/history.d.ts +0 -23
  172. package/lib/Utils/index.d.ts +0 -20
  173. package/lib/Utils/link-preview.d.ts +0 -23
  174. package/lib/Utils/logger.d.ts +0 -13
  175. package/lib/Utils/lt-hash.d.ts +0 -14
  176. package/lib/Utils/make-mutex.d.ts +0 -9
  177. package/lib/Utils/message-retry-manager.d.ts +0 -88
  178. package/lib/Utils/messages-media.d.ts +0 -135
  179. package/lib/Utils/messages.d.ts +0 -105
  180. package/lib/Utils/noise-handler.d.ts +0 -20
  181. package/lib/Utils/process-message.d.ts +0 -49
  182. package/lib/Utils/signal.d.ts +0 -42
  183. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  184. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  185. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  186. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  187. package/lib/Utils/use-single-file-auth-state.js +0 -80
  188. package/lib/Utils/validate-connection.d.ts +0 -13
  189. package/lib/WABinary/constants.d.ts +0 -30
  190. package/lib/WABinary/decode.d.ts +0 -9
  191. package/lib/WABinary/encode.d.ts +0 -3
  192. package/lib/WABinary/generic-utils.d.ts +0 -28
  193. package/lib/WABinary/index.d.ts +0 -5
  194. package/lib/WABinary/jid-utils.d.ts +0 -58
  195. package/lib/WABinary/types.d.ts +0 -22
  196. package/lib/WAM/BinaryInfo.d.ts +0 -16
  197. package/lib/WAM/constants.d.ts +0 -47
  198. package/lib/WAM/encode.d.ts +0 -3
  199. package/lib/WAM/index.d.ts +0 -3
  200. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
  201. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  202. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
  203. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
  204. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
  205. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
  206. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  207. package/lib/WAUSync/USyncQuery.d.ts +0 -31
  208. package/lib/WAUSync/USyncUser.d.ts +0 -12
  209. package/lib/WAUSync/index.d.ts +0 -3
  210. 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
- }