libzapitu 1.0.0-alpha.3

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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1294 -0
  3. package/WAProto/GenerateStatics.sh +2 -0
  4. package/WAProto/WAProto.proto +4633 -0
  5. package/WAProto/index.d.ts +53473 -0
  6. package/WAProto/index.js +165029 -0
  7. package/engine-requirements.js +10 -0
  8. package/lib/Defaults/baileys-version.json +3 -0
  9. package/lib/Defaults/index.d.ts +51 -0
  10. package/lib/Defaults/index.js +105 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  12. package/lib/Signal/Group/ciphertext-message.js +15 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  14. package/lib/Signal/Group/group-session-builder.js +64 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  16. package/lib/Signal/Group/group_cipher.js +96 -0
  17. package/lib/Signal/Group/index.d.ts +11 -0
  18. package/lib/Signal/Group/index.js +57 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  20. package/lib/Signal/Group/keyhelper.js +55 -0
  21. package/lib/Signal/Group/queue-job.d.ts +1 -0
  22. package/lib/Signal/Group/queue-job.js +57 -0
  23. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  24. package/lib/Signal/Group/sender-chain-key.js +34 -0
  25. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  26. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  27. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  28. package/lib/Signal/Group/sender-key-message.js +69 -0
  29. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  30. package/lib/Signal/Group/sender-key-name.js +51 -0
  31. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  32. package/lib/Signal/Group/sender-key-record.js +53 -0
  33. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  34. package/lib/Signal/Group/sender-key-state.js +99 -0
  35. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  36. package/lib/Signal/Group/sender-message-key.js +29 -0
  37. package/lib/Signal/libsignal.d.ts +3 -0
  38. package/lib/Signal/libsignal.js +174 -0
  39. package/lib/Socket/Client/index.d.ts +2 -0
  40. package/lib/Socket/Client/index.js +18 -0
  41. package/lib/Socket/Client/types.d.ts +15 -0
  42. package/lib/Socket/Client/types.js +13 -0
  43. package/lib/Socket/Client/websocket.d.ts +12 -0
  44. package/lib/Socket/Client/websocket.js +62 -0
  45. package/lib/Socket/business.d.ts +153 -0
  46. package/lib/Socket/business.js +260 -0
  47. package/lib/Socket/chats.d.ts +90 -0
  48. package/lib/Socket/chats.js +898 -0
  49. package/lib/Socket/groups.d.ts +132 -0
  50. package/lib/Socket/groups.js +331 -0
  51. package/lib/Socket/index.d.ts +153 -0
  52. package/lib/Socket/index.js +10 -0
  53. package/lib/Socket/messages-recv.d.ts +142 -0
  54. package/lib/Socket/messages-recv.js +1089 -0
  55. package/lib/Socket/messages-send.d.ts +137 -0
  56. package/lib/Socket/messages-send.js +818 -0
  57. package/lib/Socket/mex.d.ts +2 -0
  58. package/lib/Socket/mex.js +46 -0
  59. package/lib/Socket/newsletter.d.ts +143 -0
  60. package/lib/Socket/newsletter.js +183 -0
  61. package/lib/Socket/socket.d.ts +42 -0
  62. package/lib/Socket/socket.js +616 -0
  63. package/lib/Socket/usync.d.ts +36 -0
  64. package/lib/Socket/usync.js +65 -0
  65. package/lib/Types/Auth.d.ts +103 -0
  66. package/lib/Types/Auth.js +2 -0
  67. package/lib/Types/Call.d.ts +13 -0
  68. package/lib/Types/Call.js +2 -0
  69. package/lib/Types/Chat.d.ts +115 -0
  70. package/lib/Types/Chat.js +10 -0
  71. package/lib/Types/Contact.d.ts +23 -0
  72. package/lib/Types/Contact.js +2 -0
  73. package/lib/Types/Events.d.ts +198 -0
  74. package/lib/Types/Events.js +2 -0
  75. package/lib/Types/GroupMetadata.d.ts +63 -0
  76. package/lib/Types/GroupMetadata.js +2 -0
  77. package/lib/Types/Label.d.ts +46 -0
  78. package/lib/Types/Label.js +27 -0
  79. package/lib/Types/LabelAssociation.d.ts +29 -0
  80. package/lib/Types/LabelAssociation.js +9 -0
  81. package/lib/Types/Message.d.ts +279 -0
  82. package/lib/Types/Message.js +7 -0
  83. package/lib/Types/Newsletter.d.ts +134 -0
  84. package/lib/Types/Newsletter.js +33 -0
  85. package/lib/Types/Product.d.ts +78 -0
  86. package/lib/Types/Product.js +2 -0
  87. package/lib/Types/Signal.d.ts +57 -0
  88. package/lib/Types/Signal.js +2 -0
  89. package/lib/Types/Socket.d.ts +121 -0
  90. package/lib/Types/Socket.js +2 -0
  91. package/lib/Types/State.d.ts +27 -0
  92. package/lib/Types/State.js +2 -0
  93. package/lib/Types/USync.d.ts +25 -0
  94. package/lib/Types/USync.js +2 -0
  95. package/lib/Types/index.d.ts +64 -0
  96. package/lib/Types/index.js +42 -0
  97. package/lib/Utils/auth-utils.d.ts +18 -0
  98. package/lib/Utils/auth-utils.js +199 -0
  99. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  100. package/lib/Utils/baileys-event-stream.js +63 -0
  101. package/lib/Utils/business.d.ts +22 -0
  102. package/lib/Utils/business.js +240 -0
  103. package/lib/Utils/chat-utils.d.ts +70 -0
  104. package/lib/Utils/chat-utils.js +753 -0
  105. package/lib/Utils/crypto.d.ts +40 -0
  106. package/lib/Utils/crypto.js +187 -0
  107. package/lib/Utils/decode-wa-message.d.ts +36 -0
  108. package/lib/Utils/decode-wa-message.js +236 -0
  109. package/lib/Utils/event-buffer.d.ts +35 -0
  110. package/lib/Utils/event-buffer.js +516 -0
  111. package/lib/Utils/generics.d.ts +91 -0
  112. package/lib/Utils/generics.js +397 -0
  113. package/lib/Utils/history.d.ts +19 -0
  114. package/lib/Utils/history.js +93 -0
  115. package/lib/Utils/index.d.ts +17 -0
  116. package/lib/Utils/index.js +33 -0
  117. package/lib/Utils/link-preview.d.ts +21 -0
  118. package/lib/Utils/link-preview.js +122 -0
  119. package/lib/Utils/logger.d.ts +11 -0
  120. package/lib/Utils/logger.js +7 -0
  121. package/lib/Utils/lt-hash.d.ts +12 -0
  122. package/lib/Utils/lt-hash.js +51 -0
  123. package/lib/Utils/make-mutex.d.ts +7 -0
  124. package/lib/Utils/make-mutex.js +44 -0
  125. package/lib/Utils/messages-media.d.ts +111 -0
  126. package/lib/Utils/messages-media.js +701 -0
  127. package/lib/Utils/messages.d.ts +76 -0
  128. package/lib/Utils/messages.js +816 -0
  129. package/lib/Utils/noise-handler.d.ts +19 -0
  130. package/lib/Utils/noise-handler.js +150 -0
  131. package/lib/Utils/process-message.d.ts +41 -0
  132. package/lib/Utils/process-message.js +377 -0
  133. package/lib/Utils/signal.d.ts +33 -0
  134. package/lib/Utils/signal.js +159 -0
  135. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  136. package/lib/Utils/use-multi-file-auth-state.js +124 -0
  137. package/lib/Utils/validate-connection.d.ts +10 -0
  138. package/lib/Utils/validate-connection.js +170 -0
  139. package/lib/WABinary/constants.d.ts +27 -0
  140. package/lib/WABinary/constants.js +1303 -0
  141. package/lib/WABinary/decode.d.ts +6 -0
  142. package/lib/WABinary/decode.js +266 -0
  143. package/lib/WABinary/encode.d.ts +2 -0
  144. package/lib/WABinary/encode.js +252 -0
  145. package/lib/WABinary/generic-utils.d.ts +14 -0
  146. package/lib/WABinary/generic-utils.js +110 -0
  147. package/lib/WABinary/index.d.ts +5 -0
  148. package/lib/WABinary/index.js +21 -0
  149. package/lib/WABinary/jid-utils.d.ts +36 -0
  150. package/lib/WABinary/jid-utils.js +66 -0
  151. package/lib/WABinary/types.d.ts +18 -0
  152. package/lib/WABinary/types.js +2 -0
  153. package/lib/WAM/BinaryInfo.d.ts +8 -0
  154. package/lib/WAM/BinaryInfo.js +13 -0
  155. package/lib/WAM/constants.d.ts +39 -0
  156. package/lib/WAM/constants.js +15243 -0
  157. package/lib/WAM/encode.d.ts +2 -0
  158. package/lib/WAM/encode.js +153 -0
  159. package/lib/WAM/index.d.ts +3 -0
  160. package/lib/WAM/index.js +19 -0
  161. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  162. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  163. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  164. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  165. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  166. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  167. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  168. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  169. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  170. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  171. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  172. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  173. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  174. package/lib/WAUSync/Protocols/index.js +20 -0
  175. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  176. package/lib/WAUSync/USyncQuery.js +93 -0
  177. package/lib/WAUSync/USyncUser.d.ts +12 -0
  178. package/lib/WAUSync/USyncUser.js +26 -0
  179. package/lib/WAUSync/index.d.ts +3 -0
  180. package/lib/WAUSync/index.js +19 -0
  181. package/lib/index.d.ts +11 -0
  182. package/lib/index.js +30 -0
  183. package/package.json +102 -0
@@ -0,0 +1,29 @@
1
+ /** Association type */
2
+ export declare enum LabelAssociationType {
3
+ Chat = "label_jid",
4
+ Message = "label_message"
5
+ }
6
+ export type LabelAssociationTypes = `${LabelAssociationType}`;
7
+ /** Association for chat */
8
+ export interface ChatLabelAssociation {
9
+ type: LabelAssociationType.Chat;
10
+ chatId: string;
11
+ labelId: string;
12
+ }
13
+ /** Association for message */
14
+ export interface MessageLabelAssociation {
15
+ type: LabelAssociationType.Message;
16
+ chatId: string;
17
+ messageId: string;
18
+ labelId: string;
19
+ }
20
+ export type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation;
21
+ /** Body for add/remove chat label association action */
22
+ export interface ChatLabelAssociationActionBody {
23
+ labelId: string;
24
+ }
25
+ /** body for add/remove message label association action */
26
+ export interface MessageLabelAssociationActionBody {
27
+ labelId: string;
28
+ messageId: string;
29
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LabelAssociationType = void 0;
4
+ /** Association type */
5
+ var LabelAssociationType;
6
+ (function (LabelAssociationType) {
7
+ LabelAssociationType["Chat"] = "label_jid";
8
+ LabelAssociationType["Message"] = "label_message";
9
+ })(LabelAssociationType || (exports.LabelAssociationType = LabelAssociationType = {}));
@@ -0,0 +1,279 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import type { Readable } from 'stream';
3
+ import type { URL } from 'url';
4
+ import { proto } from '../../WAProto';
5
+ import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
6
+ import { BinaryNode } from '../WABinary';
7
+ import type { GroupMetadata } from './GroupMetadata';
8
+ import { CacheStore } from './Socket';
9
+ export { proto as WAProto };
10
+ export type WAMessage = proto.IWebMessageInfo & {
11
+ key: WAMessageKey;
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
+ sender_lid?: string;
18
+ server_id?: string;
19
+ sender_pn?: string;
20
+ peer_recipient_pn?: string;
21
+ participant_lid?: string;
22
+ participant_pn?: string;
23
+ isViewOnce?: boolean;
24
+ };
25
+ export type WATextMessage = proto.Message.IExtendedTextMessage;
26
+ export type WAContextInfo = proto.IContextInfo;
27
+ export type WALocationMessage = proto.Message.ILocationMessage;
28
+ export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
29
+ export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
30
+ export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
31
+ import { ILogger } from '../Utils/logger';
32
+ export type WAMediaPayloadURL = {
33
+ url: URL | string;
34
+ };
35
+ export type WAMediaPayloadStream = {
36
+ stream: Readable;
37
+ };
38
+ export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
39
+ /** Set of message types that are supported by the library */
40
+ export type MessageType = keyof proto.Message;
41
+ export type DownloadableMessage = {
42
+ mediaKey?: Uint8Array | null;
43
+ directPath?: string | null;
44
+ url?: string | null;
45
+ };
46
+ export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
47
+ export type MediaConnInfo = {
48
+ auth: string;
49
+ ttl: number;
50
+ hosts: {
51
+ hostname: string;
52
+ maxContentLengthBytes: number;
53
+ }[];
54
+ fetchDate: Date;
55
+ };
56
+ export interface WAUrlInfo {
57
+ 'canonical-url': string;
58
+ 'matched-text': string;
59
+ title: string;
60
+ description?: string;
61
+ jpegThumbnail?: Buffer;
62
+ highQualityThumbnail?: proto.Message.IImageMessage;
63
+ originalThumbnailUrl?: string;
64
+ }
65
+ type Mentionable = {
66
+ /** list of jids that are mentioned in the accompanying text */
67
+ mentions?: string[];
68
+ };
69
+ type Contextable = {
70
+ /** add contextInfo to the message */
71
+ contextInfo?: proto.IContextInfo;
72
+ };
73
+ type ViewOnce = {
74
+ viewOnce?: boolean;
75
+ };
76
+ type Editable = {
77
+ edit?: WAMessageKey;
78
+ };
79
+ type WithDimensions = {
80
+ width?: number;
81
+ height?: number;
82
+ };
83
+ export type PollMessageOptions = {
84
+ name: string;
85
+ selectableCount?: number;
86
+ values: string[];
87
+ /** 32 byte message secret to encrypt poll selections */
88
+ messageSecret?: Uint8Array;
89
+ toAnnouncementGroup?: boolean;
90
+ };
91
+ type SharePhoneNumber = {
92
+ sharePhoneNumber: boolean;
93
+ };
94
+ type RequestPhoneNumber = {
95
+ requestPhoneNumber: boolean;
96
+ };
97
+ export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
98
+ export type AnyMediaMessageContent = (({
99
+ image: WAMediaUpload;
100
+ caption?: string;
101
+ jpegThumbnail?: string;
102
+ } & Mentionable & Contextable & WithDimensions) | ({
103
+ video: WAMediaUpload;
104
+ caption?: string;
105
+ gifPlayback?: boolean;
106
+ jpegThumbnail?: string;
107
+ /** if set to true, will send as a `video note` */
108
+ ptv?: boolean;
109
+ } & Mentionable & Contextable & WithDimensions) | {
110
+ audio: WAMediaUpload;
111
+ /** if set to true, will send as a `voice note` */
112
+ ptt?: boolean;
113
+ /** optionally tell the duration of the audio */
114
+ seconds?: number;
115
+ } | ({
116
+ sticker: WAMediaUpload;
117
+ isAnimated?: boolean;
118
+ } & WithDimensions) | ({
119
+ document: WAMediaUpload;
120
+ mimetype: string;
121
+ fileName?: string;
122
+ caption?: string;
123
+ } & Contextable)) & {
124
+ mimetype?: string;
125
+ } & Editable;
126
+ export type ButtonReplyInfo = {
127
+ displayText: string;
128
+ id: string;
129
+ index: number;
130
+ };
131
+ export type GroupInviteInfo = {
132
+ inviteCode: string;
133
+ inviteExpiration: number;
134
+ text: string;
135
+ jid: string;
136
+ subject: string;
137
+ };
138
+ export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
139
+ productImage: WAMediaUpload;
140
+ };
141
+ export type AnyRegularMessageContent = (({
142
+ text: string;
143
+ linkPreview?: WAUrlInfo | null;
144
+ } & Mentionable & Contextable & Editable) | AnyMediaMessageContent | ({
145
+ poll: PollMessageOptions;
146
+ } & Mentionable & Contextable & Editable) | {
147
+ contacts: {
148
+ displayName?: string;
149
+ contacts: proto.Message.IContactMessage[];
150
+ };
151
+ } | {
152
+ location: WALocationMessage;
153
+ } | {
154
+ react: proto.Message.IReactionMessage;
155
+ } | {
156
+ buttonReply: ButtonReplyInfo;
157
+ type: 'template' | 'plain';
158
+ } | {
159
+ groupInvite: GroupInviteInfo;
160
+ } | {
161
+ listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
162
+ } | {
163
+ pin: WAMessageKey;
164
+ type: proto.PinInChat.Type;
165
+ /**
166
+ * 24 hours, 7 days, 30 days
167
+ */
168
+ time?: 86400 | 604800 | 2592000;
169
+ } | {
170
+ product: WASendableProduct;
171
+ businessOwnerJid?: string;
172
+ body?: string;
173
+ footer?: string;
174
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
175
+ export type AnyMessageContent = AnyRegularMessageContent | {
176
+ forward: WAMessage;
177
+ force?: boolean;
178
+ } | {
179
+ /** Delete your message or anyone's message in a group (admin required) */
180
+ delete: WAMessageKey;
181
+ } | {
182
+ disappearingMessagesInChat: boolean | number;
183
+ };
184
+ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
185
+ type MinimalRelayOptions = {
186
+ /** override the message ID with a custom provided string */
187
+ messageId?: string;
188
+ /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
189
+ useCachedGroupMetadata?: boolean;
190
+ };
191
+ export type MessageRelayOptions = MinimalRelayOptions & {
192
+ /** only send to a specific participant; used when a message decryption fails for a single user */
193
+ participant?: {
194
+ jid: string;
195
+ count: number;
196
+ };
197
+ /** additional attributes to add to the WA binary node */
198
+ additionalAttributes?: {
199
+ [_: string]: string;
200
+ };
201
+ additionalNodes?: BinaryNode[];
202
+ /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
203
+ useUserDevicesCache?: boolean;
204
+ /** jid list of participants for status@broadcast */
205
+ statusJidList?: string[];
206
+ isretry?: boolean;
207
+ };
208
+ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
209
+ /** optional, if you want to manually set the timestamp of the message */
210
+ timestamp?: Date;
211
+ /** the message you want to quote */
212
+ quoted?: WAMessage;
213
+ /** disappearing messages settings */
214
+ ephemeralExpiration?: number | string;
215
+ /** timeout for media upload to WA server */
216
+ mediaUploadTimeoutMs?: number;
217
+ /** jid list of participants for status@broadcast */
218
+ statusJidList?: string[];
219
+ /** backgroundcolor for status */
220
+ backgroundColor?: string;
221
+ /** font type for status */
222
+ font?: number;
223
+ /** if it is broadcast */
224
+ broadcast?: boolean;
225
+ };
226
+ export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
227
+ userJid: string;
228
+ };
229
+ export type WAMediaUploadFunction = (encFilePath: string, opts: {
230
+ fileEncSha256B64: string;
231
+ mediaType: MediaType;
232
+ timeoutMs?: number;
233
+ }) => Promise<{
234
+ mediaUrl: string;
235
+ directPath: string;
236
+ }>;
237
+ export type MediaGenerationOptions = {
238
+ logger?: ILogger;
239
+ mediaTypeOverride?: MediaType;
240
+ upload: WAMediaUploadFunction;
241
+ /** cache media so it does not have to be uploaded again */
242
+ mediaCache?: CacheStore;
243
+ mediaUploadTimeoutMs?: number;
244
+ options?: AxiosRequestConfig;
245
+ backgroundColor?: string;
246
+ font?: number;
247
+ };
248
+ export type MessageContentGenerationOptions = MediaGenerationOptions & {
249
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
250
+ getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
251
+ jid?: string;
252
+ };
253
+ export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
254
+ /**
255
+ * Type of message upsert
256
+ * 1. notify => notify the user, this message was just received
257
+ * 2. append => append the message to the chat history, no notification required
258
+ */
259
+ export type MessageUpsertType = 'append' | 'notify';
260
+ export type MessageUserReceipt = proto.IUserReceipt;
261
+ export type WAMessageUpdate = {
262
+ update: Partial<WAMessage>;
263
+ key: proto.IMessageKey;
264
+ };
265
+ export type WAMessageCursor = {
266
+ before: WAMessageKey | undefined;
267
+ } | {
268
+ after: WAMessageKey | undefined;
269
+ };
270
+ export type MessageUserReceiptUpdate = {
271
+ key: proto.IMessageKey;
272
+ receipt: MessageUserReceipt;
273
+ };
274
+ export type MediaDecryptionKeyInfo = {
275
+ iv: Buffer;
276
+ cipherKey: Buffer;
277
+ macKey?: Buffer;
278
+ };
279
+ export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
4
+ const WAProto_1 = require("../../WAProto");
5
+ Object.defineProperty(exports, "WAProto", { enumerable: true, get: function () { return WAProto_1.proto; } });
6
+ exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
7
+ exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
@@ -0,0 +1,134 @@
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
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryIds = exports.XWAPaths = void 0;
4
+ var XWAPaths;
5
+ (function (XWAPaths) {
6
+ XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
7
+ XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
8
+ XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
9
+ XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
10
+ XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
11
+ XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
12
+ XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
13
+ XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
14
+ XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
15
+ XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
16
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
17
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
18
+ })(XWAPaths || (exports.XWAPaths = XWAPaths = {}));
19
+ var QueryIds;
20
+ (function (QueryIds) {
21
+ QueryIds["CREATE"] = "8823471724422422";
22
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
23
+ QueryIds["METADATA"] = "6563316087068696";
24
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
25
+ QueryIds["FOLLOW"] = "7871414976211147";
26
+ QueryIds["UNFOLLOW"] = "7238632346214362";
27
+ QueryIds["MUTE"] = "29766401636284406";
28
+ QueryIds["UNMUTE"] = "9864994326891137";
29
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
30
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
31
+ QueryIds["DEMOTE"] = "6551828931592903";
32
+ QueryIds["DELETE"] = "30062808666639665";
33
+ })(QueryIds || (exports.QueryIds = QueryIds = {}));
@@ -0,0 +1,78 @@
1
+ import { WAMediaUpload } from './Message';
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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,57 @@
1
+ import { proto } from '../../WAProto';
2
+ type DecryptGroupSignalOpts = {
3
+ group: string;
4
+ authorJid: string;
5
+ msg: Uint8Array;
6
+ };
7
+ type ProcessSenderKeyDistributionMessageOpts = {
8
+ item: proto.Message.ISenderKeyDistributionMessage;
9
+ authorJid: string;
10
+ };
11
+ type DecryptSignalProtoOpts = {
12
+ jid: string;
13
+ type: 'pkmsg' | 'msg';
14
+ ciphertext: Uint8Array;
15
+ };
16
+ type EncryptMessageOpts = {
17
+ jid: string;
18
+ data: Uint8Array;
19
+ };
20
+ type EncryptGroupMessageOpts = {
21
+ group: string;
22
+ data: Uint8Array;
23
+ meId: string;
24
+ };
25
+ type PreKey = {
26
+ keyId: number;
27
+ publicKey: Uint8Array;
28
+ };
29
+ type SignedPreKey = PreKey & {
30
+ signature: Uint8Array;
31
+ };
32
+ type E2ESession = {
33
+ registrationId: number;
34
+ identityKey: Uint8Array;
35
+ signedPreKey: SignedPreKey;
36
+ preKey: PreKey;
37
+ };
38
+ type E2ESessionOpts = {
39
+ jid: string;
40
+ session: E2ESession;
41
+ };
42
+ export type SignalRepository = {
43
+ decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
44
+ processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
45
+ decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;
46
+ encryptMessage(opts: EncryptMessageOpts): Promise<{
47
+ type: 'pkmsg' | 'msg';
48
+ ciphertext: Uint8Array;
49
+ }>;
50
+ encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
51
+ senderKeyDistributionMessage: Uint8Array;
52
+ ciphertext: Uint8Array;
53
+ }>;
54
+ injectE2ESession(opts: E2ESessionOpts): Promise<void>;
55
+ jidToSignalProtocolAddress(jid: string): string;
56
+ };
57
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });