@mrlegendbot/baileys 1.2.1 → 1.2.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 (212) hide show
  1. package/README.upstream.md +1312 -0
  2. package/WAProto/WAProto.json +1 -0
  3. package/WAProto/WAProto.proto +6275 -0
  4. package/WAProto/compiler.js +550 -0
  5. package/WAProto/index.js +2 -97691
  6. package/lib/Defaults/index.js +89 -92
  7. package/lib/Signal/Group/ciphertext-message.js +9 -10
  8. package/lib/Signal/Group/group-session-builder.js +21 -22
  9. package/lib/Signal/Group/group_cipher.js +75 -69
  10. package/lib/Signal/Group/index.js +0 -1
  11. package/lib/Signal/Group/keyhelper.js +9 -10
  12. package/lib/Signal/Group/sender-chain-key.js +21 -22
  13. package/lib/Signal/Group/sender-key-distribution-message.js +51 -60
  14. package/lib/Signal/Group/sender-key-message.js +56 -62
  15. package/lib/Signal/Group/sender-key-name.js +38 -40
  16. package/lib/Signal/Group/sender-key-record.js +33 -34
  17. package/lib/Signal/Group/sender-key-state.js +72 -76
  18. package/lib/Signal/Group/sender-message-key.js +22 -23
  19. package/lib/Signal/libsignal.js +506 -405
  20. package/lib/Signal/lid-mapping.js +276 -258
  21. package/lib/Socket/Client/index.js +0 -1
  22. package/lib/Socket/Client/types.js +6 -7
  23. package/lib/Socket/Client/websocket.js +48 -49
  24. package/lib/Socket/business.js +349 -369
  25. package/lib/Socket/chats.js +1172 -1148
  26. package/lib/Socket/communities.js +473 -413
  27. package/lib/Socket/groups.js +387 -331
  28. package/lib/Socket/index.js +6 -8
  29. package/lib/Socket/messages-recv.js +1782 -1719
  30. package/lib/Socket/messages-send.js +1503 -2450
  31. package/lib/Socket/mex.js +40 -35
  32. package/lib/Socket/newsletter.js +239 -191
  33. package/lib/Socket/socket.js +992 -923
  34. package/lib/Store/index.js +8 -0
  35. package/lib/Store/keyed-db.js +108 -0
  36. package/lib/Store/make-cache-manager-store.js +70 -0
  37. package/lib/Store/make-in-memory-store.js +417 -0
  38. package/lib/Store/make-ordered-dictionary.js +69 -0
  39. package/lib/Store/object-repository.js +27 -0
  40. package/lib/Types/Auth.js +0 -1
  41. package/lib/Types/Bussines.js +0 -1
  42. package/lib/Types/Call.js +0 -1
  43. package/lib/Types/Chat.js +1 -8
  44. package/lib/Types/Contact.js +0 -1
  45. package/lib/Types/Events.js +1 -2
  46. package/lib/Types/GroupMetadata.js +0 -1
  47. package/lib/Types/Label.js +20 -22
  48. package/lib/Types/LabelAssociation.js +2 -4
  49. package/lib/Types/Message.js +3 -5
  50. package/lib/Types/Mex.js +26 -31
  51. package/lib/Types/Product.js +0 -1
  52. package/lib/Types/Signal.js +1 -2
  53. package/lib/Types/Socket.js +2 -3
  54. package/lib/Types/State.js +4 -52
  55. package/lib/Types/USync.js +0 -1
  56. package/lib/Types/index.js +10 -11
  57. package/lib/Utils/auth-utils.js +240 -277
  58. package/lib/Utils/browser-utils.js +20 -23
  59. package/lib/Utils/business.js +200 -204
  60. package/lib/Utils/chat-utils.js +836 -810
  61. package/lib/Utils/companion-reg-client-utils.js +23 -25
  62. package/lib/Utils/crypto.js +70 -86
  63. package/lib/Utils/decode-wa-message.js +277 -284
  64. package/lib/Utils/event-buffer.js +592 -595
  65. package/lib/Utils/generics.js +312 -335
  66. package/lib/Utils/history.js +123 -115
  67. package/lib/Utils/index.js +1 -2
  68. package/lib/Utils/link-preview.js +74 -73
  69. package/lib/Utils/logger.js +3 -2
  70. package/lib/Utils/lt-hash.js +0 -6
  71. package/lib/Utils/make-mutex.js +27 -27
  72. package/lib/Utils/message-retry-manager.js +213 -254
  73. package/lib/Utils/messages-media.js +741 -715
  74. package/lib/Utils/messages.js +791 -827
  75. package/lib/Utils/noise-handler.js +215 -187
  76. package/lib/Utils/pre-key-manager.js +69 -98
  77. package/lib/Utils/process-message.js +617 -586
  78. package/lib/Utils/reporting-utils.js +553 -234
  79. package/lib/Utils/signal.js +217 -170
  80. package/lib/Utils/stanza-ack.js +27 -35
  81. package/lib/Utils/sync-action-utils.js +37 -41
  82. package/lib/Utils/tc-token-utils.js +120 -141
  83. package/lib/Utils/use-multi-file-auth-state.js +87 -105
  84. package/lib/Utils/use-sqlite-auth-state.js +162 -0
  85. package/lib/Utils/validate-connection.js +190 -188
  86. package/lib/WABinary/constants.js +28 -1294
  87. package/lib/WABinary/decode.js +245 -249
  88. package/lib/WABinary/encode.js +201 -206
  89. package/lib/WABinary/generic-utils.js +86 -89
  90. package/lib/WABinary/index.js +0 -1
  91. package/lib/WABinary/jid-utils.js +68 -77
  92. package/lib/WABinary/types.js +0 -1
  93. package/lib/WAM/BinaryInfo.js +7 -8
  94. package/lib/WAM/constants.js +19892 -22853
  95. package/lib/WAM/encode.js +121 -132
  96. package/lib/WAM/index.js +0 -1
  97. package/lib/WAUSync/Protocols/USyncContactProtocol.js +46 -43
  98. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +47 -48
  99. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +22 -23
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +30 -33
  101. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +19 -20
  102. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -44
  103. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -24
  104. package/lib/WAUSync/Protocols/index.js +0 -1
  105. package/lib/WAUSync/USyncQuery.js +79 -88
  106. package/lib/WAUSync/USyncUser.js +28 -29
  107. package/lib/WAUSync/index.js +0 -1
  108. package/lib/index.js +2 -2
  109. package/package.json +22 -86
  110. package/WAProto/GenerateStatics.sh +0 -3
  111. package/WAProto/fix-imports.js +0 -85
  112. package/WAProto/index.d.ts +0 -14017
  113. package/lib/Defaults/index.d.ts +0 -75
  114. package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
  115. package/lib/Signal/Group/group-session-builder.d.ts +0 -15
  116. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  117. package/lib/Signal/Group/index.d.ts +0 -12
  118. package/lib/Signal/Group/keyhelper.d.ts +0 -11
  119. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  120. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  121. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  122. package/lib/Signal/Group/sender-key-name.d.ts +0 -18
  123. package/lib/Signal/Group/sender-key-record.d.ts +0 -31
  124. package/lib/Signal/Group/sender-key-state.d.ts +0 -39
  125. package/lib/Signal/Group/sender-message-key.d.ts +0 -12
  126. package/lib/Signal/libsignal.d.ts +0 -5
  127. package/lib/Signal/lid-mapping.d.ts +0 -23
  128. package/lib/Socket/Client/index.d.ts +0 -3
  129. package/lib/Socket/Client/types.d.ts +0 -16
  130. package/lib/Socket/Client/websocket.d.ts +0 -13
  131. package/lib/Socket/business.d.ts +0 -217
  132. package/lib/Socket/chats.d.ts +0 -125
  133. package/lib/Socket/communities.d.ts +0 -273
  134. package/lib/Socket/groups.d.ts +0 -161
  135. package/lib/Socket/index.d.ts +0 -260
  136. package/lib/Socket/messages-recv.d.ts +0 -203
  137. package/lib/Socket/messages-send.d.ts +0 -199
  138. package/lib/Socket/mex.d.ts +0 -3
  139. package/lib/Socket/newsletter.d.ts +0 -170
  140. package/lib/Socket/socket.d.ts +0 -59
  141. package/lib/Types/Auth.d.ts +0 -117
  142. package/lib/Types/Bussines.d.ts +0 -25
  143. package/lib/Types/Call.d.ts +0 -15
  144. package/lib/Types/Chat.d.ts +0 -124
  145. package/lib/Types/Contact.d.ts +0 -26
  146. package/lib/Types/Events.d.ts +0 -256
  147. package/lib/Types/GroupMetadata.d.ts +0 -71
  148. package/lib/Types/Label.d.ts +0 -47
  149. package/lib/Types/LabelAssociation.d.ts +0 -30
  150. package/lib/Types/Message.d.ts +0 -320
  151. package/lib/Types/Mex.d.ts +0 -141
  152. package/lib/Types/Product.d.ts +0 -79
  153. package/lib/Types/Signal.d.ts +0 -87
  154. package/lib/Types/Socket.d.ts +0 -136
  155. package/lib/Types/State.d.ts +0 -97
  156. package/lib/Types/USync.d.ts +0 -26
  157. package/lib/Types/index.d.ts +0 -66
  158. package/lib/Utils/auth-utils.d.ts +0 -24
  159. package/lib/Utils/browser-utils.d.ts +0 -4
  160. package/lib/Utils/business.d.ts +0 -23
  161. package/lib/Utils/chat-utils.d.ts +0 -100
  162. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  163. package/lib/Utils/crypto.d.ts +0 -37
  164. package/lib/Utils/decode-wa-message.d.ts +0 -66
  165. package/lib/Utils/event-buffer.d.ts +0 -36
  166. package/lib/Utils/generics.d.ts +0 -92
  167. package/lib/Utils/history.d.ts +0 -24
  168. package/lib/Utils/identity-change-handler.d.ts +0 -44
  169. package/lib/Utils/identity-change-handler.js +0 -50
  170. package/lib/Utils/index.d.ts +0 -22
  171. package/lib/Utils/link-preview.d.ts +0 -21
  172. package/lib/Utils/logger.d.ts +0 -12
  173. package/lib/Utils/lt-hash.d.ts +0 -8
  174. package/lib/Utils/make-mutex.d.ts +0 -9
  175. package/lib/Utils/message-retry-manager.d.ts +0 -115
  176. package/lib/Utils/messages-media.d.ts +0 -133
  177. package/lib/Utils/messages.d.ts +0 -91
  178. package/lib/Utils/noise-handler.d.ts +0 -20
  179. package/lib/Utils/offline-node-processor.d.ts +0 -17
  180. package/lib/Utils/offline-node-processor.js +0 -40
  181. package/lib/Utils/pre-key-manager.d.ts +0 -28
  182. package/lib/Utils/process-message.d.ts +0 -60
  183. package/lib/Utils/reporting-utils.d.ts +0 -11
  184. package/lib/Utils/signal.d.ts +0 -47
  185. package/lib/Utils/stanza-ack.d.ts +0 -11
  186. package/lib/Utils/sync-action-utils.d.ts +0 -19
  187. package/lib/Utils/tc-token-utils.d.ts +0 -37
  188. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  189. package/lib/Utils/validate-connection.d.ts +0 -11
  190. package/lib/WABinary/constants.d.ts +0 -28
  191. package/lib/WABinary/decode.d.ts +0 -7
  192. package/lib/WABinary/encode.d.ts +0 -3
  193. package/lib/WABinary/generic-utils.d.ts +0 -15
  194. package/lib/WABinary/index.d.ts +0 -6
  195. package/lib/WABinary/jid-utils.d.ts +0 -48
  196. package/lib/WABinary/types.d.ts +0 -19
  197. package/lib/WAM/BinaryInfo.d.ts +0 -9
  198. package/lib/WAM/constants.d.ts +0 -40
  199. package/lib/WAM/encode.d.ts +0 -3
  200. package/lib/WAM/index.d.ts +0 -4
  201. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  202. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
  203. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
  204. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
  205. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  206. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
  207. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
  208. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  209. package/lib/WAUSync/USyncQuery.d.ts +0 -30
  210. package/lib/WAUSync/USyncUser.d.ts +0 -17
  211. package/lib/WAUSync/index.d.ts +0 -4
  212. package/lib/index.d.ts +0 -12
@@ -1,320 +0,0 @@
1
- import type { Readable } from 'stream';
2
- import type { URL } from 'url';
3
- import { proto } from '../../WAProto/index.js';
4
- import type { MediaType } from '../Defaults/index.js';
5
- import type { BinaryNode } from '../WABinary/index.js';
6
- import type { GroupMetadata } from './GroupMetadata.js';
7
- import type { CacheStore } from './Socket.js';
8
- export { proto as WAProto };
9
- export type WAMessage = proto.IWebMessageInfo & {
10
- key: WAMessageKey;
11
- messageStubParameters?: any;
12
- category?: string;
13
- retryCount?: number;
14
- };
15
- export type WAMessageContent = proto.IMessage;
16
- export type WAContactMessage = proto.Message.IContactMessage;
17
- export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
18
- export type WAMessageKey = proto.IMessageKey & {
19
- remoteJidAlt?: string;
20
- remoteJidUsername?: string;
21
- participantAlt?: string;
22
- participantUsername?: string;
23
- server_id?: string;
24
- addressingMode?: string;
25
- isViewOnce?: boolean;
26
- };
27
- export type WATextMessage = proto.Message.IExtendedTextMessage;
28
- export type WAContextInfo = proto.IContextInfo;
29
- export type WALocationMessage = proto.Message.ILocationMessage;
30
- export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
31
- export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
32
- export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
33
- import type { ILogger } from '../Utils/logger.js';
34
- export type WAMediaPayloadURL = {
35
- url: URL | string;
36
- };
37
- export type WAMediaPayloadStream = {
38
- stream: Readable;
39
- };
40
- export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
41
- /** Set of message types that are supported by the library */
42
- export type MessageType = keyof proto.Message;
43
- export declare enum WAMessageAddressingMode {
44
- PN = "pn",
45
- LID = "lid"
46
- }
47
- export type MessageWithContextInfo = 'imageMessage' | 'contactMessage' | 'locationMessage' | 'extendedTextMessage' | 'documentMessage' | 'audioMessage' | 'videoMessage' | 'call' | 'contactsArrayMessage' | 'liveLocationMessage' | 'templateMessage' | 'stickerMessage' | 'groupInviteMessage' | 'templateButtonReplyMessage' | 'productMessage' | 'listMessage' | 'orderMessage' | 'listResponseMessage' | 'buttonsMessage' | 'buttonsResponseMessage' | 'interactiveMessage' | 'interactiveResponseMessage' | 'pollCreationMessage' | 'requestPhoneNumberMessage' | 'messageHistoryBundle' | 'eventMessage' | 'newsletterAdminInviteMessage' | 'albumMessage' | 'stickerPackMessage' | 'pollResultSnapshotMessage' | 'messageHistoryNotice';
48
- export type DownloadableMessage = {
49
- mediaKey?: Uint8Array | null;
50
- directPath?: string | null;
51
- url?: string | null;
52
- };
53
- export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
54
- export type MediaConnInfo = {
55
- auth: string;
56
- ttl: number;
57
- hosts: {
58
- hostname: string;
59
- maxContentLengthBytes: number;
60
- }[];
61
- fetchDate: Date;
62
- };
63
- export interface WAUrlInfo {
64
- 'canonical-url': string;
65
- 'matched-text': string;
66
- title: string;
67
- description?: string;
68
- jpegThumbnail?: Buffer;
69
- highQualityThumbnail?: proto.Message.IImageMessage;
70
- originalThumbnailUrl?: string;
71
- }
72
- type Mentionable = {
73
- /** list of jids that are mentioned in the accompanying text */
74
- mentions?: string[];
75
- /** mention all */
76
- mentionAll?: boolean;
77
- };
78
- type Contextable = {
79
- /** add contextInfo to the message */
80
- contextInfo?: proto.IContextInfo;
81
- };
82
- type ViewOnce = {
83
- viewOnce?: boolean;
84
- };
85
- type Editable = {
86
- edit?: WAMessageKey;
87
- };
88
- type WithDimensions = {
89
- width?: number;
90
- height?: number;
91
- };
92
- export type PollMessageOptions = {
93
- name: string;
94
- selectableCount?: number;
95
- values: string[];
96
- /** 32 byte message secret to encrypt poll selections */
97
- messageSecret?: Uint8Array;
98
- toAnnouncementGroup?: boolean;
99
- };
100
- export type EventMessageOptions = {
101
- name: string;
102
- description?: string;
103
- startDate: Date;
104
- endDate?: Date;
105
- location?: WALocationMessage;
106
- call?: 'audio' | 'video';
107
- isCancelled?: boolean;
108
- isScheduleCall?: boolean;
109
- extraGuestsAllowed?: boolean;
110
- messageSecret?: Uint8Array<ArrayBufferLike>;
111
- };
112
- export type AlbumMessageOptions = {
113
- /** Number of images expected in the album */
114
- expectedImageCount?: number;
115
- /** Number of videos expected in the album */
116
- expectedVideoCount?: number;
117
- };
118
- type SharePhoneNumber = {
119
- sharePhoneNumber: boolean;
120
- };
121
- type RequestPhoneNumber = {
122
- requestPhoneNumber: boolean;
123
- };
124
- export type AnyMediaMessageContent = (({
125
- image: WAMediaUpload;
126
- caption?: string;
127
- jpegThumbnail?: string;
128
- } & Mentionable & Contextable & WithDimensions) | ({
129
- video: WAMediaUpload;
130
- caption?: string;
131
- gifPlayback?: boolean;
132
- jpegThumbnail?: string;
133
- /** if set to true, will send as a `video note` */
134
- ptv?: boolean;
135
- } & Mentionable & Contextable & WithDimensions) | {
136
- audio: WAMediaUpload;
137
- /** if set to true, will send as a `voice note` */
138
- ptt?: boolean;
139
- /** optionally tell the duration of the audio */
140
- seconds?: number;
141
- } | ({
142
- sticker: WAMediaUpload;
143
- isAnimated?: boolean;
144
- } & WithDimensions) | ({
145
- document: WAMediaUpload;
146
- mimetype: string;
147
- fileName?: string;
148
- caption?: string;
149
- } & Contextable)) & {
150
- mimetype?: string;
151
- } & Editable & {
152
- /** key of the parent albumMessage to associate this media with */
153
- albumParentKey?: WAMessageKey;
154
- };
155
- export type ButtonReplyInfo = {
156
- displayText: string;
157
- id: string;
158
- index: number;
159
- };
160
- export type GroupInviteInfo = {
161
- inviteCode: string;
162
- inviteExpiration: number;
163
- text: string;
164
- jid: string;
165
- subject: string;
166
- };
167
- export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
168
- productImage: WAMediaUpload;
169
- };
170
- export type AnyRegularMessageContent = (({
171
- text: string;
172
- linkPreview?: WAUrlInfo | null;
173
- } & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
174
- event: EventMessageOptions;
175
- } | ({
176
- poll: PollMessageOptions;
177
- } & Mentionable & Contextable & Editable) | ({
178
- album: AlbumMessageOptions;
179
- } & Contextable & Mentionable) | {
180
- contacts: {
181
- displayName?: string;
182
- contacts: proto.Message.IContactMessage[];
183
- };
184
- } | {
185
- location: WALocationMessage;
186
- } | {
187
- react: proto.Message.IReactionMessage;
188
- } | {
189
- buttonReply: ButtonReplyInfo;
190
- type: 'template' | 'plain';
191
- } | {
192
- groupInvite: GroupInviteInfo;
193
- } | {
194
- listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
195
- } | {
196
- pin: WAMessageKey;
197
- type: proto.PinInChat.Type;
198
- /**
199
- * 24 hours, 7 days, 30 days
200
- */
201
- time?: 86400 | 604800 | 2592000;
202
- } | {
203
- product: WASendableProduct;
204
- businessOwnerJid?: string;
205
- body?: string;
206
- footer?: string;
207
- } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
208
- export type AnyMessageContent = AnyRegularMessageContent | {
209
- forward: WAMessage;
210
- force?: boolean;
211
- } | {
212
- /** Delete your message or anyone's message in a group (admin required) */
213
- delete: WAMessageKey;
214
- } | {
215
- disappearingMessagesInChat: boolean | number;
216
- } | {
217
- limitSharing: boolean;
218
- };
219
- export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
220
- type MinimalRelayOptions = {
221
- /** override the message ID with a custom provided string */
222
- messageId?: string;
223
- /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
224
- useCachedGroupMetadata?: boolean;
225
- };
226
- export type MessageRelayOptions = MinimalRelayOptions & {
227
- /** only send to a specific participant; used when a message decryption fails for a single user */
228
- participant?: {
229
- jid: string;
230
- count: number;
231
- };
232
- /** additional attributes to add to the WA binary node */
233
- additionalAttributes?: {
234
- [_: string]: string;
235
- };
236
- additionalNodes?: BinaryNode[];
237
- /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
238
- useUserDevicesCache?: boolean;
239
- /** jid list of participants for status@broadcast */
240
- statusJidList?: string[];
241
- };
242
- export type MiscMessageGenerationOptions = MinimalRelayOptions & {
243
- /** optional, if you want to manually set the timestamp of the message */
244
- timestamp?: Date;
245
- /** the message you want to quote */
246
- quoted?: WAMessage;
247
- /** disappearing messages settings */
248
- ephemeralExpiration?: number | string;
249
- /** timeout for media upload to WA server */
250
- mediaUploadTimeoutMs?: number;
251
- /** jid list of participants for status@broadcast */
252
- statusJidList?: string[];
253
- /** backgroundcolor for status */
254
- backgroundColor?: string;
255
- /** font type for status */
256
- font?: number;
257
- /** if it is broadcast */
258
- broadcast?: boolean;
259
- };
260
- export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
261
- userJid: string;
262
- };
263
- export type WAMediaUploadFunction = (encFilePath: string, opts: {
264
- fileEncSha256B64: string;
265
- mediaType: MediaType;
266
- timeoutMs?: number;
267
- }) => Promise<{
268
- mediaUrl: string;
269
- directPath: string;
270
- meta_hmac?: string;
271
- ts?: number;
272
- fbid?: number;
273
- }>;
274
- export type MediaGenerationOptions = {
275
- logger?: ILogger;
276
- mediaTypeOverride?: MediaType;
277
- upload: WAMediaUploadFunction;
278
- /** cache media so it does not have to be uploaded again */
279
- mediaCache?: CacheStore;
280
- mediaUploadTimeoutMs?: number;
281
- options?: RequestInit;
282
- backgroundColor?: string;
283
- font?: number;
284
- };
285
- export type MessageContentGenerationOptions = MediaGenerationOptions & {
286
- getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
287
- getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
288
- getCallLink?: (type: 'audio' | 'video', event?: {
289
- startTime: number;
290
- }) => Promise<string | undefined>;
291
- jid?: string;
292
- };
293
- export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
294
- /**
295
- * Type of message upsert
296
- * 1. notify => notify the user, this message was just received
297
- * 2. append => append the message to the chat history, no notification required
298
- */
299
- export type MessageUpsertType = 'append' | 'notify';
300
- export type MessageUserReceipt = proto.IUserReceipt;
301
- export type WAMessageUpdate = {
302
- update: Partial<WAMessage>;
303
- key: WAMessageKey;
304
- };
305
- export type WAMessageCursor = {
306
- before: WAMessageKey | undefined;
307
- } | {
308
- after: WAMessageKey | undefined;
309
- };
310
- export type MessageUserReceiptUpdate = {
311
- key: WAMessageKey;
312
- receipt: MessageUserReceipt;
313
- };
314
- export type MediaDecryptionKeyInfo = {
315
- iv: Uint8Array;
316
- cipherKey: Uint8Array;
317
- macKey?: Uint8Array;
318
- };
319
- export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
320
- //# sourceMappingURL=Message.d.ts.map
@@ -1,141 +0,0 @@
1
- export declare enum XWAPaths {
2
- xwa2_newsletter_create = "xwa2_newsletter_create",
3
- xwa2_newsletter_subscribers = "xwa2_newsletter_subscribers",
4
- xwa2_newsletter_view = "xwa2_newsletter_view",
5
- xwa2_newsletter_metadata = "xwa2_newsletter",
6
- xwa2_newsletter_admin_count = "xwa2_newsletter_admin",
7
- xwa2_newsletter_mute_v2 = "xwa2_newsletter_mute_v2",
8
- xwa2_newsletter_unmute_v2 = "xwa2_newsletter_unmute_v2",
9
- xwa2_newsletter_follow = "xwa2_newsletter_follow",
10
- xwa2_newsletter_unfollow = "xwa2_newsletter_unfollow",
11
- xwa2_newsletter_join_v2 = "xwa2_newsletter_join_v2",
12
- xwa2_newsletter_leave_v2 = "xwa2_newsletter_leave_v2",
13
- xwa2_newsletter_change_owner = "xwa2_newsletter_change_owner",
14
- xwa2_newsletter_demote = "xwa2_newsletter_demote",
15
- xwa2_newsletter_delete_v2 = "xwa2_newsletter_delete_v2",
16
- xwa2_fetch_account_reachout_timelock = "xwa2_fetch_account_reachout_timelock",
17
- xwa2_message_capping_info = "xwa2_message_capping_info"
18
- }
19
- export declare enum QueryIds {
20
- CREATE = "8823471724422422",
21
- UPDATE_METADATA = "24250201037901610",
22
- METADATA = "6563316087068696",
23
- SUBSCRIBERS = "9783111038412085",
24
- FOLLOW = "24404358912487870",
25
- UNFOLLOW = "9767147403369991",
26
- MUTE = "29766401636284406",
27
- UNMUTE = "9864994326891137",
28
- ADMIN_COUNT = "7130823597031706",
29
- CHANGE_OWNER = "7341777602580933",
30
- DEMOTE = "6551828931592903",
31
- DELETE = "30062808666639665",
32
- REACHOUT_TIMELOCK = "23983697327930364",
33
- MESSAGE_CAPPING_INFO = "24503548349331633"
34
- }
35
- export type NewsletterUpdate = {
36
- name?: string;
37
- description?: string;
38
- picture?: string;
39
- };
40
- export interface NewsletterCreateResponse {
41
- id: string;
42
- state: {
43
- type: string;
44
- };
45
- thread_metadata: {
46
- creation_time: string;
47
- description: {
48
- id: string;
49
- text: string;
50
- update_time: string;
51
- };
52
- handle: string | null;
53
- invite: string;
54
- name: {
55
- id: string;
56
- text: string;
57
- update_time: string;
58
- };
59
- picture: {
60
- direct_path: string;
61
- id: string;
62
- type: string;
63
- };
64
- preview: {
65
- direct_path: string;
66
- id: string;
67
- type: string;
68
- };
69
- subscribers_count: string;
70
- verification: 'VERIFIED' | 'UNVERIFIED';
71
- };
72
- viewer_metadata: {
73
- mute: 'ON' | 'OFF';
74
- role: NewsletterViewRole;
75
- };
76
- }
77
- export interface NewsletterCreateResponse {
78
- id: string;
79
- state: {
80
- type: string;
81
- };
82
- thread_metadata: {
83
- creation_time: string;
84
- description: {
85
- id: string;
86
- text: string;
87
- update_time: string;
88
- };
89
- handle: string | null;
90
- invite: string;
91
- name: {
92
- id: string;
93
- text: string;
94
- update_time: string;
95
- };
96
- picture: {
97
- direct_path: string;
98
- id: string;
99
- type: string;
100
- };
101
- preview: {
102
- direct_path: string;
103
- id: string;
104
- type: string;
105
- };
106
- subscribers_count: string;
107
- verification: 'VERIFIED' | 'UNVERIFIED';
108
- };
109
- viewer_metadata: {
110
- mute: 'ON' | 'OFF';
111
- role: NewsletterViewRole;
112
- };
113
- }
114
- export type NewsletterViewRole = 'ADMIN' | 'GUEST' | 'OWNER' | 'SUBSCRIBER';
115
- export interface NewsletterMetadata {
116
- id: string;
117
- owner?: string;
118
- name: string;
119
- description?: string;
120
- invite?: string;
121
- creation_time?: number;
122
- subscribers?: number;
123
- picture?: {
124
- url?: string;
125
- directPath?: string;
126
- mediaKey?: string;
127
- id?: string;
128
- };
129
- verification?: 'VERIFIED' | 'UNVERIFIED';
130
- reaction_codes?: {
131
- code: string;
132
- count: number;
133
- }[];
134
- mute_state?: 'ON' | 'OFF';
135
- thread_metadata?: {
136
- creation_time?: number;
137
- name?: string;
138
- description?: string;
139
- };
140
- }
141
- //# sourceMappingURL=Mex.d.ts.map
@@ -1,79 +0,0 @@
1
- import type { WAMediaUpload } from './Message.js';
2
- export type CatalogResult = {
3
- data: {
4
- paging: {
5
- cursors: {
6
- before: string;
7
- after: string;
8
- };
9
- };
10
- data: any[];
11
- };
12
- };
13
- export type ProductCreateResult = {
14
- data: {
15
- product: {};
16
- };
17
- };
18
- export type CatalogStatus = {
19
- status: string;
20
- canAppeal: boolean;
21
- };
22
- export type CatalogCollection = {
23
- id: string;
24
- name: string;
25
- products: Product[];
26
- status: CatalogStatus;
27
- };
28
- export type ProductAvailability = 'in stock';
29
- export type ProductBase = {
30
- name: string;
31
- retailerId?: string;
32
- url?: string;
33
- description: string;
34
- price: number;
35
- currency: string;
36
- isHidden?: boolean;
37
- };
38
- export type ProductCreate = ProductBase & {
39
- /** ISO country code for product origin. Set to undefined for no country */
40
- originCountryCode: string | undefined;
41
- /** images of the product */
42
- images: WAMediaUpload[];
43
- };
44
- export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>;
45
- export type Product = ProductBase & {
46
- id: string;
47
- imageUrls: {
48
- [_: string]: string;
49
- };
50
- reviewStatus: {
51
- [_: string]: string;
52
- };
53
- availability: ProductAvailability;
54
- };
55
- export type OrderPrice = {
56
- currency: string;
57
- total: number;
58
- };
59
- export type OrderProduct = {
60
- id: string;
61
- imageUrl: string;
62
- name: string;
63
- quantity: number;
64
- currency: string;
65
- price: number;
66
- };
67
- export type OrderDetails = {
68
- price: OrderPrice;
69
- products: OrderProduct[];
70
- };
71
- export type CatalogCursor = string;
72
- export type GetCatalogOptions = {
73
- /** cursor to start from */
74
- cursor?: CatalogCursor;
75
- /** number of products to fetch */
76
- limit?: number;
77
- jid?: string;
78
- };
79
- //# sourceMappingURL=Product.d.ts.map
@@ -1,87 +0,0 @@
1
- import { proto } from '../../WAProto/index.js';
2
- import type { LIDMappingStore } from '../Signal/lid-mapping.js';
3
- type DecryptGroupSignalOpts = {
4
- group: string;
5
- authorJid: string;
6
- msg: Uint8Array;
7
- };
8
- type ProcessSenderKeyDistributionMessageOpts = {
9
- item: proto.Message.ISenderKeyDistributionMessage;
10
- authorJid: string;
11
- };
12
- type DecryptSignalProtoOpts = {
13
- jid: string;
14
- type: 'pkmsg' | 'msg';
15
- ciphertext: Uint8Array;
16
- };
17
- type EncryptMessageOpts = {
18
- jid: string;
19
- data: Uint8Array;
20
- };
21
- type EncryptGroupMessageOpts = {
22
- group: string;
23
- data: Uint8Array;
24
- meId: string;
25
- };
26
- type GetSenderKeyDistributionMessageOpts = {
27
- group: string;
28
- meId: string;
29
- };
30
- type PreKey = {
31
- keyId: number;
32
- publicKey: Uint8Array;
33
- };
34
- type SignedPreKey = PreKey & {
35
- signature: Uint8Array;
36
- };
37
- type E2ESession = {
38
- registrationId: number;
39
- identityKey: Uint8Array;
40
- signedPreKey: SignedPreKey;
41
- preKey?: PreKey;
42
- };
43
- type E2ESessionOpts = {
44
- jid: string;
45
- session: E2ESession;
46
- };
47
- export type SignalRepository = {
48
- decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
49
- processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
50
- decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;
51
- encryptMessage(opts: EncryptMessageOpts): Promise<{
52
- type: 'pkmsg' | 'msg';
53
- ciphertext: Uint8Array;
54
- }>;
55
- encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
56
- senderKeyDistributionMessage: Uint8Array;
57
- ciphertext: Uint8Array;
58
- }>;
59
- getSenderKeyDistributionMessage(opts: GetSenderKeyDistributionMessageOpts): Promise<Uint8Array>;
60
- hasSenderKey(opts: GetSenderKeyDistributionMessageOpts): Promise<boolean>;
61
- getSessionInfo(jid: string): Promise<{
62
- baseKey: Uint8Array;
63
- registrationId: number;
64
- } | null>;
65
- injectE2ESession(opts: E2ESessionOpts): Promise<void>;
66
- validateSession(jid: string): Promise<{
67
- exists: boolean;
68
- reason?: string;
69
- }>;
70
- jidToSignalProtocolAddress(jid: string): string;
71
- migrateSession(fromJid: string, toJid: string): Promise<{
72
- migrated: number;
73
- skipped: number;
74
- total: number;
75
- }>;
76
- validateSession(jid: string): Promise<{
77
- exists: boolean;
78
- reason?: string;
79
- }>;
80
- deleteSession(jids: string[]): Promise<void>;
81
- };
82
- export interface SignalRepositoryWithLIDStore extends SignalRepository {
83
- lidMapping: LIDMappingStore;
84
- close?: () => void;
85
- }
86
- export {};
87
- //# sourceMappingURL=Signal.d.ts.map