@xbibzlibrary/whatsbibz 1.3.0

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 (260) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +22 -0
  3. package/LICENSE.upstream +21 -0
  4. package/README.md +280 -0
  5. package/VERIFIKASI-IDENTITAS-2026-09-03.md +138 -0
  6. package/WAProto/GenerateStatics.sh +3 -0
  7. package/WAProto/WAProto.proto +6035 -0
  8. package/WAProto/fix-imports.js +81 -0
  9. package/WAProto/index.d.ts +15314 -0
  10. package/WAProto/index.js +132326 -0
  11. package/assets/logo/README.md +21 -0
  12. package/assets/logo/png/banner-1200x360.png +0 -0
  13. package/assets/logo/png/icon-1024.png +0 -0
  14. package/assets/logo/png/icon-128.png +0 -0
  15. package/assets/logo/png/icon-16.png +0 -0
  16. package/assets/logo/png/icon-24.png +0 -0
  17. package/assets/logo/png/icon-256.png +0 -0
  18. package/assets/logo/png/icon-32.png +0 -0
  19. package/assets/logo/png/icon-48.png +0 -0
  20. package/assets/logo/png/icon-512.png +0 -0
  21. package/assets/logo/png/icon-64.png +0 -0
  22. package/assets/logo/png/mark-512.png +0 -0
  23. package/assets/logo/preview.png +0 -0
  24. package/assets/logo/whatsbibz.ico +0 -0
  25. package/lib/BibzWhats/client.d.ts +95 -0
  26. package/lib/BibzWhats/client.js +501 -0
  27. package/lib/BibzWhats/device-identity.d.ts +60 -0
  28. package/lib/BibzWhats/device-identity.js +234 -0
  29. package/lib/BibzWhats/extract.d.ts +29 -0
  30. package/lib/BibzWhats/extract.js +115 -0
  31. package/lib/BibzWhats/index.d.ts +7 -0
  32. package/lib/BibzWhats/index.js +8 -0
  33. package/lib/BibzWhats/jid.d.ts +22 -0
  34. package/lib/BibzWhats/jid.js +98 -0
  35. package/lib/BibzWhats/pairing.d.ts +35 -0
  36. package/lib/BibzWhats/pairing.js +186 -0
  37. package/lib/BibzWhats/send.d.ts +9 -0
  38. package/lib/BibzWhats/send.js +107 -0
  39. package/lib/BibzWhats/version.d.ts +6 -0
  40. package/lib/BibzWhats/version.js +7 -0
  41. package/lib/Defaults/index.d.ts +73 -0
  42. package/lib/Defaults/index.js +141 -0
  43. package/lib/Modded/message_builder.d.ts +15 -0
  44. package/lib/Modded/message_builder.js +2330 -0
  45. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  46. package/lib/Signal/Group/ciphertext-message.js +11 -0
  47. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  48. package/lib/Signal/Group/group-session-builder.js +29 -0
  49. package/lib/Signal/Group/group_cipher.d.ts +16 -0
  50. package/lib/Signal/Group/group_cipher.js +81 -0
  51. package/lib/Signal/Group/index.d.ts +11 -0
  52. package/lib/Signal/Group/index.js +11 -0
  53. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  54. package/lib/Signal/Group/keyhelper.js +17 -0
  55. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  56. package/lib/Signal/Group/sender-chain-key.js +25 -0
  57. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  58. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  59. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  60. package/lib/Signal/Group/sender-key-message.js +65 -0
  61. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  62. package/lib/Signal/Group/sender-key-name.js +47 -0
  63. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  64. package/lib/Signal/Group/sender-key-record.js +40 -0
  65. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  66. package/lib/Signal/Group/sender-key-state.js +83 -0
  67. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  68. package/lib/Signal/Group/sender-message-key.js +25 -0
  69. package/lib/Signal/libsignal.d.ts +4 -0
  70. package/lib/Signal/libsignal.js +406 -0
  71. package/lib/Signal/lid-mapping.d.ts +18 -0
  72. package/lib/Signal/lid-mapping.js +276 -0
  73. package/lib/Socket/Client/index.d.ts +2 -0
  74. package/lib/Socket/Client/index.js +2 -0
  75. package/lib/Socket/Client/types.d.ts +15 -0
  76. package/lib/Socket/Client/types.js +10 -0
  77. package/lib/Socket/Client/websocket.d.ts +12 -0
  78. package/lib/Socket/Client/websocket.js +53 -0
  79. package/lib/Socket/business.d.ts +537 -0
  80. package/lib/Socket/business.js +421 -0
  81. package/lib/Socket/chats.d.ts +110 -0
  82. package/lib/Socket/chats.js +1006 -0
  83. package/lib/Socket/communities.d.ts +646 -0
  84. package/lib/Socket/communities.js +430 -0
  85. package/lib/Socket/engine.d.ts +129 -0
  86. package/lib/Socket/engine.js +767 -0
  87. package/lib/Socket/groups.d.ts +149 -0
  88. package/lib/Socket/groups.js +326 -0
  89. package/lib/Socket/index.d.ts +637 -0
  90. package/lib/Socket/index.js +14 -0
  91. package/lib/Socket/messages-recv.d.ts +239 -0
  92. package/lib/Socket/messages-recv.js +1307 -0
  93. package/lib/Socket/messages-send.d.ts +580 -0
  94. package/lib/Socket/messages-send.js +1639 -0
  95. package/lib/Socket/mex.d.ts +2 -0
  96. package/lib/Socket/mex.js +47 -0
  97. package/lib/Socket/newsletter.d.ts +176 -0
  98. package/lib/Socket/newsletter.js +456 -0
  99. package/lib/Socket/socket.d.ts +56 -0
  100. package/lib/Socket/socket.js +998 -0
  101. package/lib/Types/Auth.d.ts +115 -0
  102. package/lib/Types/Auth.js +1 -0
  103. package/lib/Types/Bussines.d.ts +36 -0
  104. package/lib/Types/Bussines.js +1 -0
  105. package/lib/Types/Call.d.ts +14 -0
  106. package/lib/Types/Call.js +1 -0
  107. package/lib/Types/Chat.d.ts +124 -0
  108. package/lib/Types/Chat.js +7 -0
  109. package/lib/Types/Contact.d.ts +23 -0
  110. package/lib/Types/Contact.js +1 -0
  111. package/lib/Types/Events.d.ts +241 -0
  112. package/lib/Types/Events.js +1 -0
  113. package/lib/Types/GroupMetadata.d.ts +67 -0
  114. package/lib/Types/GroupMetadata.js +1 -0
  115. package/lib/Types/Label.d.ts +46 -0
  116. package/lib/Types/Label.js +24 -0
  117. package/lib/Types/LabelAssociation.d.ts +29 -0
  118. package/lib/Types/LabelAssociation.js +6 -0
  119. package/lib/Types/Message.d.ts +427 -0
  120. package/lib/Types/Message.js +10 -0
  121. package/lib/Types/Newsletter.d.ts +134 -0
  122. package/lib/Types/Newsletter.js +30 -0
  123. package/lib/Types/Product.d.ts +78 -0
  124. package/lib/Types/Product.js +1 -0
  125. package/lib/Types/Signal.d.ts +77 -0
  126. package/lib/Types/Signal.js +1 -0
  127. package/lib/Types/Socket.d.ts +173 -0
  128. package/lib/Types/Socket.js +2 -0
  129. package/lib/Types/State.d.ts +38 -0
  130. package/lib/Types/State.js +12 -0
  131. package/lib/Types/USync.d.ts +25 -0
  132. package/lib/Types/USync.js +1 -0
  133. package/lib/Types/index.d.ts +75 -0
  134. package/lib/Types/index.js +32 -0
  135. package/lib/Utils/auth-utils.d.ts +18 -0
  136. package/lib/Utils/auth-utils.js +289 -0
  137. package/lib/Utils/browser-utils.d.ts +3 -0
  138. package/lib/Utils/browser-utils.js +47 -0
  139. package/lib/Utils/business.d.ts +22 -0
  140. package/lib/Utils/business.js +230 -0
  141. package/lib/Utils/chat-utils.d.ts +69 -0
  142. package/lib/Utils/chat-utils.js +811 -0
  143. package/lib/Utils/companion-reg-client-utils.d.ts +20 -0
  144. package/lib/Utils/companion-reg-client-utils.js +66 -0
  145. package/lib/Utils/crypto.d.ts +41 -0
  146. package/lib/Utils/crypto.js +117 -0
  147. package/lib/Utils/decode-wa-message.d.ts +47 -0
  148. package/lib/Utils/decode-wa-message.js +282 -0
  149. package/lib/Utils/event-buffer.d.ts +35 -0
  150. package/lib/Utils/event-buffer.js +590 -0
  151. package/lib/Utils/generics.d.ts +90 -0
  152. package/lib/Utils/generics.js +384 -0
  153. package/lib/Utils/history.d.ts +21 -0
  154. package/lib/Utils/history.js +130 -0
  155. package/lib/Utils/identity-change-handler.d.ts +36 -0
  156. package/lib/Utils/identity-change-handler.js +48 -0
  157. package/lib/Utils/index.d.ts +25 -0
  158. package/lib/Utils/index.js +24 -0
  159. package/lib/Utils/link-preview.d.ts +20 -0
  160. package/lib/Utils/link-preview.js +84 -0
  161. package/lib/Utils/logger.d.ts +12 -0
  162. package/lib/Utils/logger.js +2 -0
  163. package/lib/Utils/lt-hash.d.ts +10 -0
  164. package/lib/Utils/lt-hash.js +7 -0
  165. package/lib/Utils/make-mutex.d.ts +8 -0
  166. package/lib/Utils/make-mutex.js +32 -0
  167. package/lib/Utils/message-retry-manager.d.ts +109 -0
  168. package/lib/Utils/message-retry-manager.js +224 -0
  169. package/lib/Utils/messages-media.d.ts +129 -0
  170. package/lib/Utils/messages-media.js +784 -0
  171. package/lib/Utils/messages.d.ts +90 -0
  172. package/lib/Utils/messages.js +1240 -0
  173. package/lib/Utils/noise-handler.d.ts +19 -0
  174. package/lib/Utils/noise-handler.js +200 -0
  175. package/lib/Utils/offline-node-processor.d.ts +16 -0
  176. package/lib/Utils/offline-node-processor.js +39 -0
  177. package/lib/Utils/platform-identity.d.ts +14 -0
  178. package/lib/Utils/platform-identity.js +148 -0
  179. package/lib/Utils/pre-key-manager.d.ts +27 -0
  180. package/lib/Utils/pre-key-manager.js +105 -0
  181. package/lib/Utils/process-message.d.ts +59 -0
  182. package/lib/Utils/process-message.js +544 -0
  183. package/lib/Utils/reporting-utils.d.ts +10 -0
  184. package/lib/Utils/reporting-utils.js +257 -0
  185. package/lib/Utils/rich-messages.d.ts +276 -0
  186. package/lib/Utils/rich-messages.js +1143 -0
  187. package/lib/Utils/signal.d.ts +33 -0
  188. package/lib/Utils/signal.js +158 -0
  189. package/lib/Utils/stanza-ack.d.ts +10 -0
  190. package/lib/Utils/stanza-ack.js +37 -0
  191. package/lib/Utils/sticker-pack.d.ts +10 -0
  192. package/lib/Utils/sticker-pack.js +111 -0
  193. package/lib/Utils/sync-action-utils.d.ts +18 -0
  194. package/lib/Utils/sync-action-utils.js +47 -0
  195. package/lib/Utils/tc-token-utils.d.ts +8 -0
  196. package/lib/Utils/tc-token-utils.js +45 -0
  197. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  198. package/lib/Utils/use-multi-file-auth-state.js +120 -0
  199. package/lib/Utils/validate-connection.d.ts +10 -0
  200. package/lib/Utils/validate-connection.js +222 -0
  201. package/lib/VoIP/audio-feeder.d.ts +15 -0
  202. package/lib/VoIP/audio-feeder.js +136 -0
  203. package/lib/VoIP/index.d.ts +12 -0
  204. package/lib/VoIP/index.js +282 -0
  205. package/lib/VoIP/relay-transport.d.ts +43 -0
  206. package/lib/VoIP/relay-transport.js +559 -0
  207. package/lib/VoIP/signaling.js +603 -0
  208. package/lib/VoIP/types.d.ts +69 -0
  209. package/lib/VoIP/types.js +17 -0
  210. package/lib/VoIP/wasm-engine.d.ts +103 -0
  211. package/lib/VoIP/wasm-engine.js +1214 -0
  212. package/lib/VoIP/worker-bootstrap.js +1042 -0
  213. package/lib/WABinary/constants.d.ts +27 -0
  214. package/lib/WABinary/constants.js +1300 -0
  215. package/lib/WABinary/decode.d.ts +6 -0
  216. package/lib/WABinary/decode.js +261 -0
  217. package/lib/WABinary/encode.d.ts +2 -0
  218. package/lib/WABinary/encode.js +219 -0
  219. package/lib/WABinary/generic-utils.d.ts +16 -0
  220. package/lib/WABinary/generic-utils.js +190 -0
  221. package/lib/WABinary/index.d.ts +5 -0
  222. package/lib/WABinary/index.js +5 -0
  223. package/lib/WABinary/jid-utils.d.ts +47 -0
  224. package/lib/WABinary/jid-utils.js +95 -0
  225. package/lib/WABinary/types.d.ts +18 -0
  226. package/lib/WABinary/types.js +1 -0
  227. package/lib/WAM/BinaryInfo.d.ts +8 -0
  228. package/lib/WAM/BinaryInfo.js +9 -0
  229. package/lib/WAM/constants.d.ts +39 -0
  230. package/lib/WAM/constants.js +22852 -0
  231. package/lib/WAM/encode.d.ts +2 -0
  232. package/lib/WAM/encode.js +149 -0
  233. package/lib/WAM/index.d.ts +3 -0
  234. package/lib/WAM/index.js +3 -0
  235. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  236. package/lib/WAUSync/Protocols/USyncContactProtocol.js +28 -0
  237. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  238. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
  239. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  240. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  241. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  242. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  243. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  244. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
  245. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +9 -0
  246. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  247. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  248. package/lib/WAUSync/Protocols/index.js +4 -0
  249. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  250. package/lib/WAUSync/USyncQuery.js +93 -0
  251. package/lib/WAUSync/USyncUser.d.ts +12 -0
  252. package/lib/WAUSync/USyncUser.js +22 -0
  253. package/lib/WAUSync/index.d.ts +3 -0
  254. package/lib/WAUSync/index.js +3 -0
  255. package/lib/assets/wasm/loader.js +5 -0
  256. package/lib/assets/wasm/whatsapp.wasm +0 -0
  257. package/lib/assets/wasm/worker-modules.js +273 -0
  258. package/lib/index.d.ts +21 -0
  259. package/lib/index.js +22 -0
  260. package/package.json +111 -0
@@ -0,0 +1,24 @@
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 = {}));
@@ -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,6 @@
1
+ /** Association type */
2
+ export var LabelAssociationType;
3
+ (function (LabelAssociationType) {
4
+ LabelAssociationType["Chat"] = "label_jid";
5
+ LabelAssociationType["Message"] = "label_message";
6
+ })(LabelAssociationType || (LabelAssociationType = {}));
@@ -0,0 +1,427 @@
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
+ participantAlt?: string;
21
+ server_id?: string;
22
+ addressingMode?: 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 =
29
+ | proto.Message.IVideoMessage
30
+ | proto.Message.IImageMessage
31
+ | proto.Message.IAudioMessage
32
+ | proto.Message.IDocumentMessage
33
+ | proto.Message.IStickerMessage;
34
+ export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
35
+ export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
36
+ import type { ILogger } from "../Utils/logger.js";
37
+ export type WAMediaPayloadURL = {
38
+ url: URL | string;
39
+ };
40
+ export type WAMediaPayloadStream = {
41
+ stream: Readable;
42
+ };
43
+ export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
44
+ /** Set of message types that are supported by the library */
45
+ export type MessageType = keyof proto.Message;
46
+ export declare enum WAMessageAddressingMode {
47
+ PN = "pn",
48
+ LID = "lid",
49
+ }
50
+ export type MessageWithContextInfo =
51
+ | "imageMessage"
52
+ | "contactMessage"
53
+ | "locationMessage"
54
+ | "extendedTextMessage"
55
+ | "documentMessage"
56
+ | "audioMessage"
57
+ | "videoMessage"
58
+ | "call"
59
+ | "contactsArrayMessage"
60
+ | "liveLocationMessage"
61
+ | "templateMessage"
62
+ | "stickerMessage"
63
+ | "groupInviteMessage"
64
+ | "templateButtonReplyMessage"
65
+ | "productMessage"
66
+ | "listMessage"
67
+ | "orderMessage"
68
+ | "listResponseMessage"
69
+ | "buttonsMessage"
70
+ | "buttonsResponseMessage"
71
+ | "interactiveMessage"
72
+ | "interactiveResponseMessage"
73
+ | "pollCreationMessage"
74
+ | "requestPhoneNumberMessage"
75
+ | "messageHistoryBundle"
76
+ | "eventMessage"
77
+ | "newsletterAdminInviteMessage"
78
+ | "albumMessage"
79
+ | "stickerPackMessage"
80
+ | "pollResultSnapshotMessage"
81
+ | "messageHistoryNotice";
82
+ export type DownloadableMessage = {
83
+ mediaKey?: Uint8Array | null;
84
+ directPath?: string | null;
85
+ url?: string | null;
86
+ };
87
+ export type MessageReceiptType =
88
+ | "read"
89
+ | "read-self"
90
+ | "hist_sync"
91
+ | "peer_msg"
92
+ | "sender"
93
+ | "inactive"
94
+ | "played"
95
+ | undefined;
96
+ export type MediaConnInfo = {
97
+ auth: string;
98
+ ttl: number;
99
+ hosts: {
100
+ hostname: string;
101
+ maxContentLengthBytes: number;
102
+ }[];
103
+ fetchDate: Date;
104
+ };
105
+ export interface WAUrlInfo {
106
+ "canonical-url": string;
107
+ "matched-text": string;
108
+ title: string;
109
+ description?: string;
110
+ jpegThumbnail?: Buffer;
111
+ highQualityThumbnail?: proto.Message.IImageMessage;
112
+ originalThumbnailUrl?: string;
113
+ }
114
+ type Mentionable = {
115
+ /** list of jids that are mentioned in the accompanying text */
116
+ mentions?: string[];
117
+ /** mention all */
118
+ mentionAll?: boolean;
119
+ };
120
+ type Contextable = {
121
+ /** add contextInfo to the message */
122
+ contextInfo?: proto.IContextInfo;
123
+ };
124
+ type ViewOnce = {
125
+ viewOnce?: boolean;
126
+ };
127
+ type Editable = {
128
+ edit?: WAMessageKey;
129
+ };
130
+ type WithDimensions = {
131
+ width?: number;
132
+ height?: number;
133
+ };
134
+ export type PollMessageOptions = {
135
+ name: string;
136
+ selectableCount?: number;
137
+ values: string[];
138
+ /** 32 byte message secret to encrypt poll selections */
139
+ messageSecret?: Uint8Array;
140
+ toAnnouncementGroup?: boolean;
141
+ };
142
+ export type EventMessageOptions = {
143
+ name: string;
144
+ description?: string;
145
+ startDate: Date;
146
+ endDate?: Date;
147
+ location?: WALocationMessage;
148
+ call?: "audio" | "video";
149
+ isCancelled?: boolean;
150
+ isScheduleCall?: boolean;
151
+ extraGuestsAllowed?: boolean;
152
+ messageSecret?: Uint8Array<ArrayBufferLike>;
153
+ };
154
+ type SharePhoneNumber = {
155
+ sharePhoneNumber: boolean;
156
+ };
157
+ type RequestPhoneNumber = {
158
+ requestPhoneNumber: boolean;
159
+ };
160
+ export type AnyMediaMessageContent = (
161
+ | ({
162
+ image: WAMediaUpload;
163
+ caption?: string;
164
+ jpegThumbnail?: string;
165
+ } & Mentionable &
166
+ Contextable &
167
+ WithDimensions)
168
+ | ({
169
+ video: WAMediaUpload;
170
+ caption?: string;
171
+ gifPlayback?: boolean;
172
+ jpegThumbnail?: string;
173
+ /** if set to true, will send as a `video note` */
174
+ ptv?: boolean;
175
+ } & Mentionable &
176
+ Contextable &
177
+ WithDimensions)
178
+ | {
179
+ audio: WAMediaUpload;
180
+ /** if set to true, will send as a `voice note` */
181
+ ptt?: boolean;
182
+ /** optionally tell the duration of the audio */
183
+ seconds?: number;
184
+ }
185
+ | ({
186
+ sticker: WAMediaUpload;
187
+ isAnimated?: boolean;
188
+ } & WithDimensions)
189
+ | ({
190
+ document: WAMediaUpload;
191
+ mimetype: string;
192
+ fileName?: string;
193
+ caption?: string;
194
+ } & Contextable)
195
+ ) & {
196
+ mimetype?: string;
197
+ } & Editable;
198
+ export type ButtonReplyInfo = {
199
+ displayText: string;
200
+ id: string;
201
+ index: number;
202
+ };
203
+ export type GroupInviteInfo = {
204
+ inviteCode: string;
205
+ inviteExpiration: number;
206
+ text: string;
207
+ jid: string;
208
+ subject: string;
209
+ };
210
+ export type WASendableProduct = Omit<
211
+ proto.Message.ProductMessage.IProductSnapshot,
212
+ "productImage"
213
+ > & {
214
+ productImage: WAMediaUpload;
215
+ };
216
+ export type StickerPackItem =
217
+ | WAMediaUpload
218
+ | {
219
+ sticker: WAMediaUpload;
220
+ emojis?: string[];
221
+ accessibilityLabel?: string;
222
+ };
223
+ export type StickerPackContent = {
224
+ name: string;
225
+ publisher?: string;
226
+ description?: string;
227
+ packId?: string;
228
+ stickers: StickerPackItem[];
229
+ cover?: WAMediaUpload;
230
+ };
231
+ export type AnyRegularMessageContent = (
232
+ | ({
233
+ text: string;
234
+ linkPreview?: WAUrlInfo | null;
235
+ } & Mentionable &
236
+ Contextable &
237
+ Editable)
238
+ | AnyMediaMessageContent
239
+ | {
240
+ event: EventMessageOptions;
241
+ }
242
+ | ({
243
+ poll: PollMessageOptions;
244
+ } & Mentionable &
245
+ Contextable &
246
+ Editable)
247
+ | {
248
+ contacts: {
249
+ displayName?: string;
250
+ contacts: proto.Message.IContactMessage[];
251
+ };
252
+ }
253
+ | {
254
+ location: WALocationMessage;
255
+ }
256
+ | {
257
+ react: proto.Message.IReactionMessage;
258
+ }
259
+ | {
260
+ buttonReply: ButtonReplyInfo;
261
+ type: "template" | "plain";
262
+ }
263
+ | {
264
+ groupInvite: GroupInviteInfo;
265
+ }
266
+ | {
267
+ listReply: Omit<proto.Message.IListResponseMessage, "contextInfo">;
268
+ }
269
+ | {
270
+ pin: WAMessageKey;
271
+ type: proto.PinInChat.Type;
272
+ /**
273
+ * 24 hours, 7 days, 30 days
274
+ */
275
+ time?: 86400 | 604800 | 2592000;
276
+ }
277
+ | {
278
+ product: WASendableProduct;
279
+ businessOwnerJid?: string;
280
+ body?: string;
281
+ footer?: string;
282
+ }
283
+ | ({
284
+ stickerPack: StickerPackContent;
285
+ } & Mentionable &
286
+ Contextable)
287
+ | SharePhoneNumber
288
+ | RequestPhoneNumber
289
+ ) &
290
+ ViewOnce;
291
+ export type AnyMessageContent =
292
+ | AnyRegularMessageContent
293
+ | {
294
+ forward: WAMessage;
295
+ force?: boolean;
296
+ }
297
+ | {
298
+ /** Delete your message or anyone's message in a group (admin required) */
299
+ delete: WAMessageKey;
300
+ }
301
+ | {
302
+ disappearingMessagesInChat: boolean | number;
303
+ }
304
+ | {
305
+ limitSharing: boolean;
306
+ };
307
+ export type GroupMetadataParticipants = Pick<GroupMetadata, "participants">;
308
+ type MinimalRelayOptions = {
309
+ /** override the message ID with a custom provided string */
310
+ messageId?: string;
311
+ /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
312
+ useCachedGroupMetadata?: boolean;
313
+ };
314
+ export type MessageRelayOptions = MinimalRelayOptions & {
315
+ /** only send to a specific participant; used when a message decryption fails for a single user */
316
+ participant?: {
317
+ jid: string;
318
+ count: number;
319
+ };
320
+ /** additional attributes to add to the WA binary node */
321
+ additionalAttributes?: {
322
+ [_: string]: string;
323
+ };
324
+ additionalNodes?: BinaryNode[];
325
+ /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
326
+ useUserDevicesCache?: boolean;
327
+ /** jid list of participants for status@broadcast */
328
+ statusJidList?: string[];
329
+ recipientOverrides?: string[];
330
+ specificRecipient?: string;
331
+ specificRecipients?: string[];
332
+ };
333
+ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
334
+ /** optional, if you want to manually set the timestamp of the message */
335
+ timestamp?: Date;
336
+ /** the message you want to quote */
337
+ quoted?: WAMessage;
338
+ /** disappearing messages settings */
339
+ ephemeralExpiration?: number | string;
340
+ /** timeout for media upload to WA server */
341
+ mediaUploadTimeoutMs?: number;
342
+ /** jid list of participants for status@broadcast */
343
+ statusJidList?: string[];
344
+ recipientOverrides?: string[];
345
+ specificRecipient?: string;
346
+ specificRecipients?: string[];
347
+ /** backgroundcolor for status */
348
+ backgroundColor?: string;
349
+ /** font type for status */
350
+ font?: number;
351
+ /** if it is broadcast */
352
+ broadcast?: boolean;
353
+ };
354
+ export type MessageGenerationOptionsFromContent =
355
+ MiscMessageGenerationOptions & {
356
+ userJid: string;
357
+ };
358
+ export type WAMediaUploadFunction = (
359
+ encFilePath: string,
360
+ opts: {
361
+ fileEncSha256B64: string;
362
+ mediaType: MediaType;
363
+ newsletter?: boolean;
364
+ timeoutMs?: number;
365
+ },
366
+ ) => Promise<{
367
+ mediaUrl: string;
368
+ directPath: string;
369
+ meta_hmac?: string;
370
+ ts?: number;
371
+ fbid?: number;
372
+ }>;
373
+ export type MediaGenerationOptions = {
374
+ logger?: ILogger;
375
+ mediaTypeOverride?: MediaType;
376
+ upload: WAMediaUploadFunction;
377
+ /** cache media so it does not have to be uploaded again */
378
+ mediaCache?: CacheStore;
379
+ mediaUploadTimeoutMs?: number;
380
+ options?: RequestInit;
381
+ backgroundColor?: string;
382
+ font?: number;
383
+ };
384
+ export type MessageContentGenerationOptions = MediaGenerationOptions & {
385
+ getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
386
+ getProfilePicUrl?: (
387
+ jid: string,
388
+ type: "image" | "preview",
389
+ ) => Promise<string | undefined>;
390
+ getCallLink?: (
391
+ type: "audio" | "video",
392
+ event?: {
393
+ startTime: number;
394
+ },
395
+ ) => Promise<string | undefined>;
396
+ jid?: string;
397
+ };
398
+ export type MessageGenerationOptions = MessageContentGenerationOptions &
399
+ MessageGenerationOptionsFromContent;
400
+ /**
401
+ * Type of message upsert
402
+ * 1. notify => notify the user, this message was just received
403
+ * 2. append => append the message to the chat history, no notification required
404
+ */
405
+ export type MessageUpsertType = "append" | "notify";
406
+ export type MessageUserReceipt = proto.IUserReceipt;
407
+ export type WAMessageUpdate = {
408
+ update: Partial<WAMessage>;
409
+ key: WAMessageKey;
410
+ };
411
+ export type WAMessageCursor =
412
+ | {
413
+ before: WAMessageKey | undefined;
414
+ }
415
+ | {
416
+ after: WAMessageKey | undefined;
417
+ };
418
+ export type MessageUserReceiptUpdate = {
419
+ key: WAMessageKey;
420
+ receipt: MessageUserReceipt;
421
+ };
422
+ export type MediaDecryptionKeyInfo = {
423
+ iv: Uint8Array;
424
+ cipherKey: Uint8Array;
425
+ macKey?: Uint8Array;
426
+ };
427
+ export type MinimalMessage = Pick<WAMessage, "key" | "messageTimestamp">;
@@ -0,0 +1,10 @@
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 = {}));
@@ -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,30 @@
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_change_owner"] = "xwa2_newsletter_change_owner";
13
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
14
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
15
+ })(XWAPaths || (XWAPaths = {}));
16
+ export var QueryIds;
17
+ (function (QueryIds) {
18
+ QueryIds["CREATE"] = "8823471724422422";
19
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
20
+ QueryIds["METADATA"] = "6563316087068696";
21
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
22
+ QueryIds["FOLLOW"] = "7871414976211147";
23
+ QueryIds["UNFOLLOW"] = "7238632346214362";
24
+ QueryIds["MUTE"] = "29766401636284406";
25
+ QueryIds["UNMUTE"] = "9864994326891137";
26
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
27
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
28
+ QueryIds["DEMOTE"] = "6551828931592903";
29
+ QueryIds["DELETE"] = "30062808666639665";
30
+ })(QueryIds || (QueryIds = {}));