queenruva-sockets 5.6.23

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 (205) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +1082 -0
  3. package/WAProto/GenerateStatics.sh +3 -0
  4. package/WAProto/WAProto.proto +5479 -0
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.d.ts +14017 -0
  7. package/WAProto/index.js +97691 -0
  8. package/engine-requirements.js +11 -0
  9. package/lib/Defaults/index.d.ts +75 -0
  10. package/lib/Defaults/index.js +129 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.js +12 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  14. package/lib/Signal/Group/group-session-builder.js +30 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  16. package/lib/Signal/Group/group_cipher.js +82 -0
  17. package/lib/Signal/Group/index.d.ts +12 -0
  18. package/lib/Signal/Group/index.js +12 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  20. package/lib/Signal/Group/keyhelper.js +18 -0
  21. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  22. package/lib/Signal/Group/sender-chain-key.js +26 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  24. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  25. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  26. package/lib/Signal/Group/sender-key-message.js +66 -0
  27. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  28. package/lib/Signal/Group/sender-key-name.js +48 -0
  29. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  30. package/lib/Signal/Group/sender-key-record.js +41 -0
  31. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  32. package/lib/Signal/Group/sender-key-state.js +84 -0
  33. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  34. package/lib/Signal/Group/sender-message-key.js +26 -0
  35. package/lib/Signal/libsignal.d.ts +5 -0
  36. package/lib/Signal/libsignal.js +431 -0
  37. package/lib/Signal/lid-mapping.d.ts +23 -0
  38. package/lib/Signal/lid-mapping.js +277 -0
  39. package/lib/Socket/Client/index.d.ts +3 -0
  40. package/lib/Socket/Client/index.js +3 -0
  41. package/lib/Socket/Client/types.d.ts +16 -0
  42. package/lib/Socket/Client/types.js +11 -0
  43. package/lib/Socket/Client/websocket.d.ts +13 -0
  44. package/lib/Socket/Client/websocket.js +54 -0
  45. package/lib/Socket/business.d.ts +217 -0
  46. package/lib/Socket/business.js +379 -0
  47. package/lib/Socket/chats.d.ts +124 -0
  48. package/lib/Socket/chats.js +1193 -0
  49. package/lib/Socket/communities.d.ts +273 -0
  50. package/lib/Socket/communities.js +431 -0
  51. package/lib/Socket/groups.d.ts +161 -0
  52. package/lib/Socket/groups.js +347 -0
  53. package/lib/Socket/index.d.ts +260 -0
  54. package/lib/Socket/index.js +12 -0
  55. package/lib/Socket/messages-recv.d.ts +203 -0
  56. package/lib/Socket/messages-recv.js +1772 -0
  57. package/lib/Socket/messages-send.d.ts +199 -0
  58. package/lib/Socket/messages-send.js +1160 -0
  59. package/lib/Socket/mex.d.ts +3 -0
  60. package/lib/Socket/mex.js +42 -0
  61. package/lib/Socket/newsletter.d.ts +170 -0
  62. package/lib/Socket/newsletter.js +181 -0
  63. package/lib/Socket/socket.d.ts +59 -0
  64. package/lib/Socket/socket.js +1029 -0
  65. package/lib/Types/Auth.d.ts +117 -0
  66. package/lib/Types/Auth.js +2 -0
  67. package/lib/Types/Bussines.d.ts +25 -0
  68. package/lib/Types/Bussines.js +2 -0
  69. package/lib/Types/Call.d.ts +15 -0
  70. package/lib/Types/Call.js +2 -0
  71. package/lib/Types/Chat.d.ts +124 -0
  72. package/lib/Types/Chat.js +8 -0
  73. package/lib/Types/Contact.d.ts +26 -0
  74. package/lib/Types/Contact.js +2 -0
  75. package/lib/Types/Events.d.ts +256 -0
  76. package/lib/Types/Events.js +2 -0
  77. package/lib/Types/GroupMetadata.d.ts +71 -0
  78. package/lib/Types/GroupMetadata.js +2 -0
  79. package/lib/Types/Label.d.ts +47 -0
  80. package/lib/Types/Label.js +25 -0
  81. package/lib/Types/LabelAssociation.d.ts +30 -0
  82. package/lib/Types/LabelAssociation.js +7 -0
  83. package/lib/Types/Message.d.ts +320 -0
  84. package/lib/Types/Message.js +11 -0
  85. package/lib/Types/Mex.d.ts +141 -0
  86. package/lib/Types/Mex.js +37 -0
  87. package/lib/Types/Product.d.ts +79 -0
  88. package/lib/Types/Product.js +2 -0
  89. package/lib/Types/Signal.d.ts +87 -0
  90. package/lib/Types/Signal.js +2 -0
  91. package/lib/Types/Socket.d.ts +136 -0
  92. package/lib/Types/Socket.js +3 -0
  93. package/lib/Types/State.d.ts +97 -0
  94. package/lib/Types/State.js +56 -0
  95. package/lib/Types/USync.d.ts +26 -0
  96. package/lib/Types/USync.js +2 -0
  97. package/lib/Types/index.d.ts +65 -0
  98. package/lib/Types/index.js +26 -0
  99. package/lib/Utils/auth-utils.d.ts +24 -0
  100. package/lib/Utils/auth-utils.js +302 -0
  101. package/lib/Utils/browser-utils.d.ts +4 -0
  102. package/lib/Utils/browser-utils.js +28 -0
  103. package/lib/Utils/business.d.ts +23 -0
  104. package/lib/Utils/business.js +231 -0
  105. package/lib/Utils/chat-utils.d.ts +100 -0
  106. package/lib/Utils/chat-utils.js +872 -0
  107. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  108. package/lib/Utils/companion-reg-client-utils.js +35 -0
  109. package/lib/Utils/crypto.d.ts +37 -0
  110. package/lib/Utils/crypto.js +118 -0
  111. package/lib/Utils/decode-wa-message.d.ts +66 -0
  112. package/lib/Utils/decode-wa-message.js +311 -0
  113. package/lib/Utils/event-buffer.d.ts +36 -0
  114. package/lib/Utils/event-buffer.js +622 -0
  115. package/lib/Utils/generics.d.ts +91 -0
  116. package/lib/Utils/generics.js +378 -0
  117. package/lib/Utils/history.d.ts +24 -0
  118. package/lib/Utils/history.js +134 -0
  119. package/lib/Utils/identity-change-handler.d.ts +44 -0
  120. package/lib/Utils/identity-change-handler.js +50 -0
  121. package/lib/Utils/index.d.ts +22 -0
  122. package/lib/Utils/index.js +22 -0
  123. package/lib/Utils/link-preview.d.ts +21 -0
  124. package/lib/Utils/link-preview.js +85 -0
  125. package/lib/Utils/logger.d.ts +12 -0
  126. package/lib/Utils/logger.js +3 -0
  127. package/lib/Utils/lt-hash.d.ts +8 -0
  128. package/lib/Utils/lt-hash.js +8 -0
  129. package/lib/Utils/make-mutex.d.ts +9 -0
  130. package/lib/Utils/make-mutex.js +33 -0
  131. package/lib/Utils/message-retry-manager.d.ts +115 -0
  132. package/lib/Utils/message-retry-manager.js +265 -0
  133. package/lib/Utils/messages-media.d.ts +133 -0
  134. package/lib/Utils/messages-media.js +786 -0
  135. package/lib/Utils/messages.d.ts +91 -0
  136. package/lib/Utils/messages.js +893 -0
  137. package/lib/Utils/noise-handler.d.ts +20 -0
  138. package/lib/Utils/noise-handler.js +201 -0
  139. package/lib/Utils/offline-node-processor.d.ts +17 -0
  140. package/lib/Utils/offline-node-processor.js +40 -0
  141. package/lib/Utils/pre-key-manager.d.ts +28 -0
  142. package/lib/Utils/pre-key-manager.js +106 -0
  143. package/lib/Utils/process-message.d.ts +60 -0
  144. package/lib/Utils/process-message.js +597 -0
  145. package/lib/Utils/reporting-utils.d.ts +11 -0
  146. package/lib/Utils/reporting-utils.js +258 -0
  147. package/lib/Utils/signal.d.ts +47 -0
  148. package/lib/Utils/signal.js +201 -0
  149. package/lib/Utils/stanza-ack.d.ts +11 -0
  150. package/lib/Utils/stanza-ack.js +38 -0
  151. package/lib/Utils/sync-action-utils.d.ts +19 -0
  152. package/lib/Utils/sync-action-utils.js +49 -0
  153. package/lib/Utils/tc-token-utils.d.ts +37 -0
  154. package/lib/Utils/tc-token-utils.js +163 -0
  155. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  156. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  157. package/lib/Utils/validate-connection.d.ts +11 -0
  158. package/lib/Utils/validate-connection.js +203 -0
  159. package/lib/WABinary/constants.d.ts +28 -0
  160. package/lib/WABinary/constants.js +1301 -0
  161. package/lib/WABinary/decode.d.ts +7 -0
  162. package/lib/WABinary/decode.js +262 -0
  163. package/lib/WABinary/encode.d.ts +3 -0
  164. package/lib/WABinary/encode.js +220 -0
  165. package/lib/WABinary/generic-utils.d.ts +15 -0
  166. package/lib/WABinary/generic-utils.js +113 -0
  167. package/lib/WABinary/index.d.ts +6 -0
  168. package/lib/WABinary/index.js +6 -0
  169. package/lib/WABinary/jid-utils.d.ts +48 -0
  170. package/lib/WABinary/jid-utils.js +96 -0
  171. package/lib/WABinary/types.d.ts +19 -0
  172. package/lib/WABinary/types.js +2 -0
  173. package/lib/WAM/BinaryInfo.d.ts +9 -0
  174. package/lib/WAM/BinaryInfo.js +10 -0
  175. package/lib/WAM/constants.d.ts +40 -0
  176. package/lib/WAM/constants.js +22853 -0
  177. package/lib/WAM/encode.d.ts +3 -0
  178. package/lib/WAM/encode.js +150 -0
  179. package/lib/WAM/index.d.ts +4 -0
  180. package/lib/WAM/index.js +4 -0
  181. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  182. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  183. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  184. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  185. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  186. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  187. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  188. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  189. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  190. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  191. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  192. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  193. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  194. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  195. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  196. package/lib/WAUSync/Protocols/index.js +6 -0
  197. package/lib/WAUSync/USyncQuery.d.ts +30 -0
  198. package/lib/WAUSync/USyncQuery.js +98 -0
  199. package/lib/WAUSync/USyncUser.d.ts +17 -0
  200. package/lib/WAUSync/USyncUser.js +31 -0
  201. package/lib/WAUSync/index.d.ts +4 -0
  202. package/lib/WAUSync/index.js +4 -0
  203. package/lib/index.d.ts +12 -0
  204. package/lib/index.js +11 -0
  205. package/package.json +160 -0
@@ -0,0 +1,47 @@
1
+ export interface Label {
2
+ /** Label uniq ID */
3
+ id: string;
4
+ /** Label name */
5
+ name: string;
6
+ /** Label color ID */
7
+ color: number;
8
+ /** Is label has been deleted */
9
+ deleted: boolean;
10
+ /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
11
+ predefinedId?: string;
12
+ }
13
+ export interface LabelActionBody {
14
+ id: string;
15
+ /** Label name */
16
+ name?: string;
17
+ /** Label color ID */
18
+ color?: number;
19
+ /** Is label has been deleted */
20
+ deleted?: boolean;
21
+ /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
22
+ predefinedId?: number;
23
+ }
24
+ /** WhatsApp has 20 predefined colors */
25
+ export declare enum LabelColor {
26
+ Color1 = 0,
27
+ Color2 = 1,
28
+ Color3 = 2,
29
+ Color4 = 3,
30
+ Color5 = 4,
31
+ Color6 = 5,
32
+ Color7 = 6,
33
+ Color8 = 7,
34
+ Color9 = 8,
35
+ Color10 = 9,
36
+ Color11 = 10,
37
+ Color12 = 11,
38
+ Color13 = 12,
39
+ Color14 = 13,
40
+ Color15 = 14,
41
+ Color16 = 15,
42
+ Color17 = 16,
43
+ Color18 = 17,
44
+ Color19 = 18,
45
+ Color20 = 19
46
+ }
47
+ //# sourceMappingURL=Label.d.ts.map
@@ -0,0 +1,25 @@
1
+ /** WhatsApp has 20 predefined colors */
2
+ export var LabelColor;
3
+ (function (LabelColor) {
4
+ LabelColor[LabelColor["Color1"] = 0] = "Color1";
5
+ LabelColor[LabelColor["Color2"] = 1] = "Color2";
6
+ LabelColor[LabelColor["Color3"] = 2] = "Color3";
7
+ LabelColor[LabelColor["Color4"] = 3] = "Color4";
8
+ LabelColor[LabelColor["Color5"] = 4] = "Color5";
9
+ LabelColor[LabelColor["Color6"] = 5] = "Color6";
10
+ LabelColor[LabelColor["Color7"] = 6] = "Color7";
11
+ LabelColor[LabelColor["Color8"] = 7] = "Color8";
12
+ LabelColor[LabelColor["Color9"] = 8] = "Color9";
13
+ LabelColor[LabelColor["Color10"] = 9] = "Color10";
14
+ LabelColor[LabelColor["Color11"] = 10] = "Color11";
15
+ LabelColor[LabelColor["Color12"] = 11] = "Color12";
16
+ LabelColor[LabelColor["Color13"] = 12] = "Color13";
17
+ LabelColor[LabelColor["Color14"] = 13] = "Color14";
18
+ LabelColor[LabelColor["Color15"] = 14] = "Color15";
19
+ LabelColor[LabelColor["Color16"] = 15] = "Color16";
20
+ LabelColor[LabelColor["Color17"] = 16] = "Color17";
21
+ LabelColor[LabelColor["Color18"] = 17] = "Color18";
22
+ LabelColor[LabelColor["Color19"] = 18] = "Color19";
23
+ LabelColor[LabelColor["Color20"] = 19] = "Color20";
24
+ })(LabelColor || (LabelColor = {}));
25
+ //# sourceMappingURL=Label.js.map
@@ -0,0 +1,30 @@
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
+ }
30
+ //# sourceMappingURL=LabelAssociation.d.ts.map
@@ -0,0 +1,7 @@
1
+ /** Association type */
2
+ export var LabelAssociationType;
3
+ (function (LabelAssociationType) {
4
+ LabelAssociationType["Chat"] = "label_jid";
5
+ LabelAssociationType["Message"] = "label_message";
6
+ })(LabelAssociationType || (LabelAssociationType = {}));
7
+ //# sourceMappingURL=LabelAssociation.js.map
@@ -0,0 +1,320 @@
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
@@ -0,0 +1,11 @@
1
+ import { proto } from '../../WAProto/index.js';
2
+ // export the WAMessage Prototypes
3
+ export { proto as WAProto };
4
+ export const WAMessageStubType = proto.WebMessageInfo.StubType;
5
+ export const WAMessageStatus = proto.WebMessageInfo.Status;
6
+ export var WAMessageAddressingMode;
7
+ (function (WAMessageAddressingMode) {
8
+ WAMessageAddressingMode["PN"] = "pn";
9
+ WAMessageAddressingMode["LID"] = "lid";
10
+ })(WAMessageAddressingMode || (WAMessageAddressingMode = {}));
11
+ //# sourceMappingURL=Message.js.map
@@ -0,0 +1,141 @@
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
@@ -0,0 +1,37 @@
1
+ export var XWAPaths;
2
+ (function (XWAPaths) {
3
+ XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
4
+ XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
5
+ XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
6
+ XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
7
+ XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
8
+ XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
9
+ XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
10
+ XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
11
+ XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
12
+ XWAPaths["xwa2_newsletter_join_v2"] = "xwa2_newsletter_join_v2";
13
+ XWAPaths["xwa2_newsletter_leave_v2"] = "xwa2_newsletter_leave_v2";
14
+ XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
15
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
16
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
17
+ XWAPaths["xwa2_fetch_account_reachout_timelock"] = "xwa2_fetch_account_reachout_timelock";
18
+ XWAPaths["xwa2_message_capping_info"] = "xwa2_message_capping_info";
19
+ })(XWAPaths || (XWAPaths = {}));
20
+ export var QueryIds;
21
+ (function (QueryIds) {
22
+ QueryIds["CREATE"] = "8823471724422422";
23
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
24
+ QueryIds["METADATA"] = "6563316087068696";
25
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
26
+ QueryIds["FOLLOW"] = "24404358912487870";
27
+ QueryIds["UNFOLLOW"] = "9767147403369991";
28
+ QueryIds["MUTE"] = "29766401636284406";
29
+ QueryIds["UNMUTE"] = "9864994326891137";
30
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
31
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
32
+ QueryIds["DEMOTE"] = "6551828931592903";
33
+ QueryIds["DELETE"] = "30062808666639665";
34
+ QueryIds["REACHOUT_TIMELOCK"] = "23983697327930364";
35
+ QueryIds["MESSAGE_CAPPING_INFO"] = "24503548349331633";
36
+ })(QueryIds || (QueryIds = {}));
37
+ //# sourceMappingURL=Mex.js.map