@kelvdra/baileys 1.0.3 → 1.0.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 (109) hide show
  1. package/README.md +75 -1499
  2. package/lib/Defaults/index.d.ts +62 -0
  3. package/lib/Defaults/index.js +2 -2
  4. package/lib/Defaults/phonenumber-mcc.json +223 -0
  5. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  6. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  7. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  8. package/lib/Signal/Group/index.d.ts +12 -0
  9. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  10. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  11. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  12. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  13. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  14. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  15. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  16. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  17. package/lib/Signal/libsignal.d.ts +5 -0
  18. package/lib/Signal/lid-mapping.d.ts +23 -0
  19. package/lib/Socket/Client/index.d.ts +3 -0
  20. package/lib/Socket/Client/types.d.ts +16 -0
  21. package/lib/Socket/Client/websocket.d.ts +13 -0
  22. package/lib/Socket/business.d.ts +190 -0
  23. package/lib/Socket/chats.d.ts +100 -0
  24. package/lib/Socket/chats.js +14 -13
  25. package/lib/Socket/communities.d.ts +246 -0
  26. package/lib/Socket/groups.d.ts +139 -0
  27. package/lib/Socket/groups.js +2 -3
  28. package/lib/Socket/hydra.js +1 -2
  29. package/lib/Socket/index.d.ts +233 -0
  30. package/lib/Socket/messages-recv.d.ts +175 -0
  31. package/lib/Socket/messages-recv.js +325 -515
  32. package/lib/Socket/messages-send.d.ts +171 -0
  33. package/lib/Socket/messages-send.js +104 -467
  34. package/lib/Socket/mex.d.ts +3 -0
  35. package/lib/Socket/newsletter.d.ts +149 -0
  36. package/lib/Socket/socket.d.ts +53 -0
  37. package/lib/Socket/socket.js +52 -51
  38. package/lib/Store/index.d.ts +4 -0
  39. package/lib/Store/make-cache-manager-store.d.ts +14 -0
  40. package/lib/Store/make-in-memory-store.d.ts +123 -0
  41. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  42. package/lib/Store/object-repository.d.ts +10 -0
  43. package/lib/Types/Auth.d.ts +115 -0
  44. package/lib/Types/Bussines.d.ts +25 -0
  45. package/lib/Types/Call.d.ts +14 -0
  46. package/lib/Types/Chat.d.ts +123 -0
  47. package/lib/Types/Contact.d.ts +24 -0
  48. package/lib/Types/Events.d.ts +202 -0
  49. package/lib/Types/GroupMetadata.d.ts +67 -0
  50. package/lib/Types/Label.d.ts +47 -0
  51. package/lib/Types/LabelAssociation.d.ts +30 -0
  52. package/lib/Types/Message.d.ts +382 -0
  53. package/lib/Types/Newsletter.d.ts +135 -0
  54. package/lib/Types/Product.d.ts +79 -0
  55. package/lib/Types/Signal.d.ts +76 -0
  56. package/lib/Types/Socket.d.ts +133 -0
  57. package/lib/Types/State.d.ts +39 -0
  58. package/lib/Types/USync.d.ts +26 -0
  59. package/lib/Types/index.d.ts +65 -0
  60. package/lib/Utils/auth-utils.d.ts +19 -0
  61. package/lib/Utils/browser-utils.d.ts +4 -0
  62. package/lib/Utils/business.d.ts +23 -0
  63. package/lib/Utils/chat-utils.d.ts +70 -0
  64. package/lib/Utils/crypto.d.ts +41 -0
  65. package/lib/Utils/decode-wa-message.d.ts +48 -0
  66. package/lib/Utils/decode-wa-message.js +5 -7
  67. package/lib/Utils/event-buffer.d.ts +34 -0
  68. package/lib/Utils/generics.d.ts +90 -0
  69. package/lib/Utils/history.d.ts +19 -0
  70. package/lib/Utils/index.d.ts +19 -0
  71. package/lib/Utils/link-preview.d.ts +21 -0
  72. package/lib/Utils/logger.d.ts +12 -0
  73. package/lib/Utils/lt-hash.d.ts +13 -0
  74. package/lib/Utils/make-mutex.d.ts +8 -0
  75. package/lib/Utils/message-retry-manager.d.ts +82 -0
  76. package/lib/Utils/messages-media.d.ts +114 -0
  77. package/lib/Utils/messages-media.js +69 -33
  78. package/lib/Utils/messages.d.ts +89 -0
  79. package/lib/Utils/messages.js +42 -12
  80. package/lib/Utils/noise-handler.d.ts +20 -0
  81. package/lib/Utils/pre-key-manager.d.ts +28 -0
  82. package/lib/Utils/process-message.d.ts +60 -0
  83. package/lib/Utils/signal.d.ts +34 -0
  84. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  85. package/lib/Utils/validate-connection.d.ts +11 -0
  86. package/lib/WABinary/constants.d.ts +28 -0
  87. package/lib/WABinary/decode.d.ts +7 -0
  88. package/lib/WABinary/encode.d.ts +3 -0
  89. package/lib/WABinary/generic-utils.d.ts +15 -0
  90. package/lib/WABinary/generic-utils.js +7 -0
  91. package/lib/WABinary/index.d.ts +6 -0
  92. package/lib/WABinary/jid-utils.d.ts +48 -0
  93. package/lib/WABinary/types.d.ts +19 -0
  94. package/lib/WAM/BinaryInfo.d.ts +9 -0
  95. package/lib/WAM/constants.d.ts +40 -0
  96. package/lib/WAM/encode.d.ts +3 -0
  97. package/lib/WAM/index.d.ts +4 -0
  98. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  99. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  100. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  101. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  102. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  103. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  104. package/lib/WAUSync/Protocols/index.d.ts +5 -0
  105. package/lib/WAUSync/USyncQuery.d.ts +29 -0
  106. package/lib/WAUSync/USyncUser.d.ts +13 -0
  107. package/lib/WAUSync/index.d.ts +4 -0
  108. package/lib/index.d.ts +13 -0
  109. package/package.json +3 -34
@@ -0,0 +1,382 @@
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
+ };
13
+ export type WAMessageContent = proto.IMessage;
14
+ export type WAContactMessage = proto.Message.IContactMessage;
15
+ export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
16
+ export type WAMessageKey = proto.IMessageKey & {
17
+ remoteJidAlt?: string;
18
+ participantAlt?: string;
19
+ server_id?: string;
20
+ addressingMode?: string;
21
+ isViewOnce?: boolean;
22
+ };
23
+ export type WATextMessage = proto.Message.IExtendedTextMessage;
24
+ export type WAContextInfo = proto.IContextInfo;
25
+ export type WALocationMessage = proto.Message.ILocationMessage;
26
+ export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
27
+ export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
28
+ export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
29
+ import type { ILogger } from '../Utils/logger.js';
30
+ export type WAMediaPayloadURL = {
31
+ url: URL | string;
32
+ };
33
+ export type WAMediaPayloadStream = {
34
+ stream: Readable;
35
+ };
36
+ export type WAMediaUpload = Buffer | {
37
+ url: URL | string
38
+ } | {
39
+ stream: Readable
40
+ } | 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 Carousel {
64
+ image?: WAMediaUpload
65
+ video?: WAMediaUpload
66
+ product?: WASendableProduct
67
+ title?: string
68
+ body?: string
69
+ footer?: string
70
+ buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[]
71
+ }
72
+
73
+ export interface WAUrlInfo {
74
+ 'canonical-url': string;
75
+ 'matched-text': string;
76
+ title: string;
77
+ description?: string;
78
+ jpegThumbnail?: Buffer;
79
+ highQualityThumbnail?: proto.Message.IImageMessage;
80
+ originalThumbnailUrl?: string;
81
+ }
82
+ type Mentionable = {
83
+ /** list of jids that are mentioned in the accompanying text */
84
+ mentions?: string[];
85
+ };
86
+ type Contextable = {
87
+ /** add contextInfo to the message */
88
+ contextInfo?: proto.IContextInfo;
89
+ };
90
+ type ViewOnce = {
91
+ viewOnce?: boolean;
92
+ };
93
+ type Buttonable = {
94
+ /** add buttons to the message */
95
+ buttons?: proto.Message.ButtonsMessage.IButton[]
96
+ }
97
+
98
+ type Templatable = {
99
+ /** add buttons to the message (conflicts with normal buttons)*/
100
+ templateButtons?: proto.IHydratedTemplateButton[]
101
+ footer?: string
102
+ }
103
+
104
+ type Interactiveable = {
105
+ /** add buttons to the message (conflicts with normal buttons)*/
106
+ interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]
107
+ title?: string
108
+ subtitle?: string
109
+ footer?: string
110
+ hasMediaAttachment?: boolean
111
+ }
112
+
113
+ type Shopable = {
114
+ shop?: proto.Message.InteractiveMessage.ShopMessage
115
+ title?: string
116
+ subtitle?: string
117
+ footer?: string
118
+ hasMediaAttachment?: boolean
119
+ }
120
+
121
+ type Collectionable = {
122
+ collection?: proto.Message.InteractiveMessage.CollectionMessage
123
+ title?: string
124
+ subtitle?: string
125
+ footer?: string
126
+ hasMediaAttachment?: boolean
127
+ }
128
+
129
+ type Listable = {
130
+ /** Sections of the List */
131
+ sections?: proto.Message.ListMessage.ISection[]
132
+ /** Title of a List Message only */
133
+ title?: string
134
+ /** Text of the button on the list (required) */
135
+ buttonText?: string
136
+ /** ListType of a List Message only */
137
+ listType?: proto.Message.ListMessage.ListType
138
+ }
139
+
140
+ type Cardsable = {
141
+ cards?: Carousel[]
142
+ title?: string
143
+ subtitle?: string
144
+ footer?: string
145
+ }
146
+
147
+ type Editable = {
148
+ edit?: WAMessageKey;
149
+ };
150
+ type WithDimensions = {
151
+ width?: number;
152
+ height?: number;
153
+ };
154
+ export type PollMessageOptions = {
155
+ name: string;
156
+ selectableCount?: number;
157
+ values: string[];
158
+ /** 32 byte message secret to encrypt poll selections */
159
+ messageSecret?: Uint8Array;
160
+ toAnnouncementGroup?: boolean;
161
+ };
162
+ export type EventMessageOptions = {
163
+ name: string;
164
+ description?: string;
165
+ startDate: Date;
166
+ endDate?: Date;
167
+ location?: WALocationMessage;
168
+ call?: 'audio' | 'video';
169
+ isCancelled?: boolean;
170
+ isScheduleCall?: boolean;
171
+ extraGuestsAllowed?: boolean;
172
+ messageSecret?: Uint8Array<ArrayBufferLike>;
173
+ };
174
+ type SharePhoneNumber = {
175
+ sharePhoneNumber: boolean;
176
+ };
177
+ type RequestPhoneNumber = {
178
+ requestPhoneNumber: boolean;
179
+ };
180
+ export type AnyMediaMessageContent = (({
181
+ image: WAMediaUpload
182
+ caption?: string
183
+ jpegThumbnail?: string
184
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | ({
185
+ video: WAMediaUpload
186
+ caption?: string
187
+ gifPlayback?: boolean
188
+ jpegThumbnail?: string
189
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & WithDimensions) | {
190
+ audio: WAMediaUpload
191
+ /** if set to true, will send as a `voice note` */
192
+ ptt?: boolean
193
+ /** optionally tell the duration of the audio */
194
+ seconds?: number
195
+ } | ({
196
+ sticker: WAMediaUpload
197
+ isAnimated?: boolean
198
+ } & WithDimensions) | ({
199
+ document: WAMediaUpload
200
+ mimetype: string
201
+ fileName?: string
202
+ caption?: string
203
+ } & Contextable & Buttonable & Templatable & Interactiveable )) & {
204
+ mimetype?: string
205
+ } & Editable
206
+
207
+ export type ButtonReplyInfo = {
208
+ displayText: string
209
+ id: string
210
+ index: number
211
+ }
212
+ export type GroupInviteInfo = {
213
+ inviteCode: string;
214
+ inviteExpiration: number;
215
+ text: string;
216
+ jid: string;
217
+ subject: string;
218
+ };
219
+ export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
220
+ productImage: WAMediaUpload;
221
+ };
222
+ export type AnyRegularMessageContent = (({
223
+ text: string
224
+ linkPreview?: WAUrlInfo | null
225
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | AnyMediaMessageContent | ({
226
+ poll: PollMessageOptions
227
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable & WithDimensions) | {
228
+ contacts: {
229
+ displayName?: string
230
+ contacts: proto.Message.IContactMessage[]
231
+ }
232
+ } | {
233
+ location: WALocationMessage
234
+ } | {
235
+ react: proto.Message.IReactionMessage
236
+ } | {
237
+ buttonReply: ButtonReplyInfo
238
+ type: 'template' | 'plain' | 'list' | 'interactive'
239
+ } | {
240
+ groupInvite: GroupInviteInfo
241
+ } | {
242
+ pin: PinInfo
243
+ } | {
244
+ keep: KeepInfo
245
+ } | {
246
+ call: CallCreationInfo
247
+ } | {
248
+ event: WAEventMessage
249
+ } | {
250
+ adminInvite: AdminInviteInfo
251
+ } | {
252
+ payment: PaymentInfo
253
+ } | {
254
+ paymentInvite: {
255
+ type: number
256
+ expiry: number
257
+ }
258
+ } | {
259
+ pollResult: PollResultOptions
260
+ } | {
261
+ order: WAOrderMessage
262
+ } | {
263
+ product: WASendableProduct
264
+ businessOwnerJid?: string
265
+ body?: string
266
+ footer?: string
267
+ } | {
268
+ stickerPack: StickerPack
269
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce & ViewOnceExt
270
+ export type AnyMessageContent = AnyRegularMessageContent | {
271
+ forward: WAMessage;
272
+ force?: boolean;
273
+ } | {
274
+ /** Delete your message or anyone's message in a group (admin required) */
275
+ delete: WAMessageKey;
276
+ } | {
277
+ disappearingMessagesInChat: boolean | number;
278
+ } | {
279
+ limitSharing: boolean;
280
+ };
281
+ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
282
+ type MinimalRelayOptions = {
283
+ /** override the message ID with a custom provided string */
284
+ messageId?: string;
285
+ /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
286
+ useCachedGroupMetadata?: boolean;
287
+ };
288
+ export type MessageRelayOptions = MinimalRelayOptions & {
289
+ /** only send to a specific participant; used when a message decryption fails for a single user */
290
+ participant?: {
291
+ jid: string;
292
+ count: number;
293
+ };
294
+ /** additional attributes to add to the WA binary node */
295
+ additionalAttributes?: {
296
+ [_: string]: string;
297
+ };
298
+ additionalNodes?: BinaryNode[];
299
+ /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
300
+ useUserDevicesCache?: boolean;
301
+ /** jid list of participants for status@broadcast */
302
+ statusJidList?: string[];
303
+ };
304
+ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
305
+ /** optional, if you want to manually set the timestamp of the message */
306
+ timestamp?: Date;
307
+ /** the message you want to quote */
308
+ quoted?: WAMessage;
309
+ /** disappearing messages settings */
310
+ ephemeralExpiration?: number | string;
311
+ /** timeout for media upload to WA server */
312
+ mediaUploadTimeoutMs?: number;
313
+ /** jid list of participants for status@broadcast */
314
+ statusJidList?: string[];
315
+ /** backgroundcolor for status */
316
+ backgroundColor?: string;
317
+ /** font type for status */
318
+ font?: number;
319
+ /** if it is broadcast */
320
+ broadcast?: boolean;
321
+ };
322
+ export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
323
+ userJid: string;
324
+ };
325
+ export type WAMediaUploadFunction = (encFilePath: string, opts: {
326
+ fileEncSha256B64: string;
327
+ mediaType: MediaType;
328
+ timeoutMs?: number;
329
+ }) => Promise<{
330
+ mediaUrl: string;
331
+ directPath: string;
332
+ meta_hmac?: string;
333
+ ts?: number;
334
+ fbid?: number;
335
+ }>;
336
+ export type MediaGenerationOptions = {
337
+ logger?: ILogger;
338
+ mediaTypeOverride?: MediaType;
339
+ upload: WAMediaUploadFunction;
340
+ /** cache media so it does not have to be uploaded again */
341
+ mediaCache?: CacheStore;
342
+ mediaUploadTimeoutMs?: number;
343
+ options?: RequestInit;
344
+ backgroundColor?: string;
345
+ font?: number;
346
+ };
347
+ export type MessageContentGenerationOptions = MediaGenerationOptions & {
348
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
349
+ getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
350
+ getCallLink?: (type: 'audio' | 'video', event?: {
351
+ startTime: number;
352
+ }) => Promise<string | undefined>;
353
+ jid?: string;
354
+ };
355
+ export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
356
+ /**
357
+ * Type of message upsert
358
+ * 1. notify => notify the user, this message was just received
359
+ * 2. append => append the message to the chat history, no notification required
360
+ */
361
+ export type MessageUpsertType = 'append' | 'notify';
362
+ export type MessageUserReceipt = proto.IUserReceipt;
363
+ export type WAMessageUpdate = {
364
+ update: Partial<WAMessage>;
365
+ key: WAMessageKey;
366
+ };
367
+ export type WAMessageCursor = {
368
+ before: WAMessageKey | undefined;
369
+ } | {
370
+ after: WAMessageKey | undefined;
371
+ };
372
+ export type MessageUserReceiptUpdate = {
373
+ key: WAMessageKey;
374
+ receipt: MessageUserReceipt;
375
+ };
376
+ export type MediaDecryptionKeyInfo = {
377
+ iv: Buffer;
378
+ cipherKey: Buffer;
379
+ macKey?: Buffer;
380
+ };
381
+ export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
382
+ //# sourceMappingURL=Message.d.ts.map
@@ -0,0 +1,135 @@
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_change_owner = "xwa2_newsletter_change_owner",
12
+ xwa2_newsletter_demote = "xwa2_newsletter_demote",
13
+ xwa2_newsletter_delete_v2 = "xwa2_newsletter_delete_v2"
14
+ }
15
+ export declare enum QueryIds {
16
+ CREATE = "8823471724422422",
17
+ UPDATE_METADATA = "24250201037901610",
18
+ METADATA = "6563316087068696",
19
+ SUBSCRIBERS = "9783111038412085",
20
+ FOLLOW = "7871414976211147",
21
+ UNFOLLOW = "7238632346214362",
22
+ MUTE = "29766401636284406",
23
+ UNMUTE = "9864994326891137",
24
+ ADMIN_COUNT = "7130823597031706",
25
+ CHANGE_OWNER = "7341777602580933",
26
+ DEMOTE = "6551828931592903",
27
+ DELETE = "30062808666639665"
28
+ }
29
+ export type NewsletterUpdate = {
30
+ name?: string;
31
+ description?: string;
32
+ picture?: string;
33
+ };
34
+ export interface NewsletterCreateResponse {
35
+ id: string;
36
+ state: {
37
+ type: string;
38
+ };
39
+ thread_metadata: {
40
+ creation_time: string;
41
+ description: {
42
+ id: string;
43
+ text: string;
44
+ update_time: string;
45
+ };
46
+ handle: string | null;
47
+ invite: string;
48
+ name: {
49
+ id: string;
50
+ text: string;
51
+ update_time: string;
52
+ };
53
+ picture: {
54
+ direct_path: string;
55
+ id: string;
56
+ type: string;
57
+ };
58
+ preview: {
59
+ direct_path: string;
60
+ id: string;
61
+ type: string;
62
+ };
63
+ subscribers_count: string;
64
+ verification: 'VERIFIED' | 'UNVERIFIED';
65
+ };
66
+ viewer_metadata: {
67
+ mute: 'ON' | 'OFF';
68
+ role: NewsletterViewRole;
69
+ };
70
+ }
71
+ export interface NewsletterCreateResponse {
72
+ id: string;
73
+ state: {
74
+ type: string;
75
+ };
76
+ thread_metadata: {
77
+ creation_time: string;
78
+ description: {
79
+ id: string;
80
+ text: string;
81
+ update_time: string;
82
+ };
83
+ handle: string | null;
84
+ invite: string;
85
+ name: {
86
+ id: string;
87
+ text: string;
88
+ update_time: string;
89
+ };
90
+ picture: {
91
+ direct_path: string;
92
+ id: string;
93
+ type: string;
94
+ };
95
+ preview: {
96
+ direct_path: string;
97
+ id: string;
98
+ type: string;
99
+ };
100
+ subscribers_count: string;
101
+ verification: 'VERIFIED' | 'UNVERIFIED';
102
+ };
103
+ viewer_metadata: {
104
+ mute: 'ON' | 'OFF';
105
+ role: NewsletterViewRole;
106
+ };
107
+ }
108
+ export type NewsletterViewRole = 'ADMIN' | 'GUEST' | 'OWNER' | 'SUBSCRIBER';
109
+ export interface NewsletterMetadata {
110
+ id: string;
111
+ owner?: string;
112
+ name: string;
113
+ description?: string;
114
+ invite?: string;
115
+ creation_time?: number;
116
+ subscribers?: number;
117
+ picture?: {
118
+ url?: string;
119
+ directPath?: string;
120
+ mediaKey?: string;
121
+ id?: string;
122
+ };
123
+ verification?: 'VERIFIED' | 'UNVERIFIED';
124
+ reaction_codes?: {
125
+ code: string;
126
+ count: number;
127
+ }[];
128
+ mute_state?: 'ON' | 'OFF';
129
+ thread_metadata?: {
130
+ creation_time?: number;
131
+ name?: string;
132
+ description?: string;
133
+ };
134
+ }
135
+ //# sourceMappingURL=Newsletter.d.ts.map
@@ -0,0 +1,79 @@
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
@@ -0,0 +1,76 @@
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 PreKey = {
27
+ keyId: number;
28
+ publicKey: Uint8Array;
29
+ };
30
+ type SignedPreKey = PreKey & {
31
+ signature: Uint8Array;
32
+ };
33
+ type E2ESession = {
34
+ registrationId: number;
35
+ identityKey: Uint8Array;
36
+ signedPreKey: SignedPreKey;
37
+ preKey: PreKey;
38
+ };
39
+ type E2ESessionOpts = {
40
+ jid: string;
41
+ session: E2ESession;
42
+ };
43
+ export type SignalRepository = {
44
+ decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
45
+ processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
46
+ decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;
47
+ encryptMessage(opts: EncryptMessageOpts): Promise<{
48
+ type: 'pkmsg' | 'msg';
49
+ ciphertext: Uint8Array;
50
+ }>;
51
+ encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
52
+ senderKeyDistributionMessage: Uint8Array;
53
+ ciphertext: Uint8Array;
54
+ }>;
55
+ injectE2ESession(opts: E2ESessionOpts): Promise<void>;
56
+ validateSession(jid: string): Promise<{
57
+ exists: boolean;
58
+ reason?: string;
59
+ }>;
60
+ jidToSignalProtocolAddress(jid: string): string;
61
+ migrateSession(fromJid: string, toJid: string): Promise<{
62
+ migrated: number;
63
+ skipped: number;
64
+ total: number;
65
+ }>;
66
+ validateSession(jid: string): Promise<{
67
+ exists: boolean;
68
+ reason?: string;
69
+ }>;
70
+ deleteSession(jids: string[]): Promise<void>;
71
+ };
72
+ export interface SignalRepositoryWithLIDStore extends SignalRepository {
73
+ lidMapping: LIDMappingStore;
74
+ }
75
+ export {};
76
+ //# sourceMappingURL=Signal.d.ts.map