sanka-baileyss 1.4.8

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 (252) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2520 -0
  3. package/WAProto/Adv/Adv.d.ts +518 -0
  4. package/WAProto/Adv/Adv.js +1734 -0
  5. package/WAProto/Adv/Adv.proto +36 -0
  6. package/WAProto/Cert/Cert.d.ts +497 -0
  7. package/WAProto/Cert/Cert.js +1503 -0
  8. package/WAProto/Cert/Cert.proto +28 -0
  9. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +391 -0
  10. package/WAProto/ChatLockSettings/ChatLockSettings.js +1155 -0
  11. package/WAProto/ChatLockSettings/ChatLockSettings.proto +7 -0
  12. package/WAProto/CompanionReg/CompanionReg.d.ts +1049 -0
  13. package/WAProto/CompanionReg/CompanionReg.js +3496 -0
  14. package/WAProto/CompanionReg/CompanionReg.proto +88 -0
  15. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +187 -0
  16. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +520 -0
  17. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +14 -0
  18. package/WAProto/E2E/E2E.d.ts +27989 -0
  19. package/WAProto/E2E/E2E.js +97013 -0
  20. package/WAProto/E2E/E2E.proto +2256 -0
  21. package/WAProto/Ephemeral/Ephemeral.d.ts +95 -0
  22. package/WAProto/Ephemeral/Ephemeral.js +269 -0
  23. package/WAProto/Ephemeral/Ephemeral.proto +6 -0
  24. package/WAProto/HistorySync/HistorySync.d.ts +40300 -0
  25. package/WAProto/HistorySync/HistorySync.js +141555 -0
  26. package/WAProto/HistorySync/HistorySync.proto +207 -0
  27. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +189 -0
  28. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +585 -0
  29. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +11 -0
  30. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +461 -0
  31. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +1559 -0
  32. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +37 -0
  33. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +28866 -0
  34. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +100307 -0
  35. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +76 -0
  36. package/WAProto/MmsRetry/MmsRetry.d.ts +200 -0
  37. package/WAProto/MmsRetry/MmsRetry.js +586 -0
  38. package/WAProto/MmsRetry/MmsRetry.proto +17 -0
  39. package/WAProto/Protocol/Protocol.d.ts +218 -0
  40. package/WAProto/Protocol/Protocol.js +701 -0
  41. package/WAProto/Protocol/Protocol.proto +20 -0
  42. package/WAProto/Reporting/Reporting.d.ts +301 -0
  43. package/WAProto/Reporting/Reporting.js +989 -0
  44. package/WAProto/Reporting/Reporting.proto +19 -0
  45. package/WAProto/ServerSync/ServerSync.d.ts +1050 -0
  46. package/WAProto/ServerSync/ServerSync.js +3176 -0
  47. package/WAProto/ServerSync/ServerSync.proto +59 -0
  48. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +1507 -0
  49. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +4756 -0
  50. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +88 -0
  51. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +617 -0
  52. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1940 -0
  53. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +38 -0
  54. package/WAProto/StatusAttributions/StatusAttributions.d.ts +544 -0
  55. package/WAProto/StatusAttributions/StatusAttributions.js +1769 -0
  56. package/WAProto/StatusAttributions/StatusAttributions.proto +53 -0
  57. package/WAProto/SyncAction/SyncAction.d.ts +7227 -0
  58. package/WAProto/SyncAction/SyncAction.js +22271 -0
  59. package/WAProto/SyncAction/SyncAction.proto +423 -0
  60. package/WAProto/UserPassword/UserPassword.d.ts +298 -0
  61. package/WAProto/UserPassword/UserPassword.js +898 -0
  62. package/WAProto/UserPassword/UserPassword.proto +27 -0
  63. package/WAProto/VnameCert/VnameCert.d.ts +658 -0
  64. package/WAProto/VnameCert/VnameCert.js +2225 -0
  65. package/WAProto/VnameCert/VnameCert.proto +60 -0
  66. package/WAProto/Wa6/Wa6.d.ts +1613 -0
  67. package/WAProto/Wa6/Wa6.js +6299 -0
  68. package/WAProto/Wa6/Wa6.proto +229 -0
  69. package/WAProto/Web/Web.d.ts +31290 -0
  70. package/WAProto/Web/Web.js +111977 -0
  71. package/WAProto/Web/Web.proto +545 -0
  72. package/WAProto/index.d.ts +49 -0
  73. package/WAProto/index.js +28 -0
  74. package/WASignalGroup/GroupProtocol.js +1771 -0
  75. package/WASignalGroup/ciphertext_message.js +10 -0
  76. package/WASignalGroup/group_cipher.js +103 -0
  77. package/WASignalGroup/group_session_builder.js +39 -0
  78. package/WASignalGroup/index.js +5 -0
  79. package/WASignalGroup/keyhelper.js +17 -0
  80. package/WASignalGroup/protobufs.js +2 -0
  81. package/WASignalGroup/queue_job.js +64 -0
  82. package/WASignalGroup/sender_chain_key.js +38 -0
  83. package/WASignalGroup/sender_key_distribution_message.js +68 -0
  84. package/WASignalGroup/sender_key_message.js +79 -0
  85. package/WASignalGroup/sender_key_name.js +59 -0
  86. package/WASignalGroup/sender_key_record.js +47 -0
  87. package/WASignalGroup/sender_key_state.js +110 -0
  88. package/WASignalGroup/sender_message_key.js +30 -0
  89. package/check-node-version.js +10 -0
  90. package/lib/Defaults/baileys-version.json +3 -0
  91. package/lib/Defaults/index.d.ts +51 -0
  92. package/lib/Defaults/index.js +108 -0
  93. package/lib/Defaults/phonenumber-mcc.json +223 -0
  94. package/lib/Signal/libsignal.d.ts +3 -0
  95. package/lib/Signal/libsignal.js +153 -0
  96. package/lib/Socket/Client/index.d.ts +2 -0
  97. package/lib/Socket/Client/index.js +18 -0
  98. package/lib/Socket/Client/types.d.ts +15 -0
  99. package/lib/Socket/Client/types.js +14 -0
  100. package/lib/Socket/Client/websocket.d.ts +12 -0
  101. package/lib/Socket/Client/websocket.js +57 -0
  102. package/lib/Socket/business.d.ts +181 -0
  103. package/lib/Socket/business.js +259 -0
  104. package/lib/Socket/chats.d.ts +95 -0
  105. package/lib/Socket/chats.js +906 -0
  106. package/lib/Socket/groups.d.ts +128 -0
  107. package/lib/Socket/groups.js +307 -0
  108. package/lib/Socket/index.d.ts +183 -0
  109. package/lib/Socket/index.js +10 -0
  110. package/lib/Socket/messages-recv.d.ts +170 -0
  111. package/lib/Socket/messages-recv.js +1072 -0
  112. package/lib/Socket/messages-send.d.ts +161 -0
  113. package/lib/Socket/messages-send.js +984 -0
  114. package/lib/Socket/newsletter.d.ts +140 -0
  115. package/lib/Socket/newsletter.js +242 -0
  116. package/lib/Socket/socket.d.ts +43 -0
  117. package/lib/Socket/socket.js +651 -0
  118. package/lib/Socket/usync.d.ts +36 -0
  119. package/lib/Socket/usync.js +71 -0
  120. package/lib/Store/index.d.ts +4 -0
  121. package/lib/Store/index.js +20 -0
  122. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  123. package/lib/Store/make-cache-manager-store.js +85 -0
  124. package/lib/Store/make-in-memory-store.d.ts +117 -0
  125. package/lib/Store/make-in-memory-store.js +420 -0
  126. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  127. package/lib/Store/make-ordered-dictionary.js +83 -0
  128. package/lib/Store/object-repository.d.ts +10 -0
  129. package/lib/Store/object-repository.js +28 -0
  130. package/lib/Types/Auth.d.ts +103 -0
  131. package/lib/Types/Auth.js +2 -0
  132. package/lib/Types/Call.d.ts +13 -0
  133. package/lib/Types/Call.js +2 -0
  134. package/lib/Types/Chat.d.ts +115 -0
  135. package/lib/Types/Chat.js +6 -0
  136. package/lib/Types/Contact.d.ts +24 -0
  137. package/lib/Types/Contact.js +2 -0
  138. package/lib/Types/Events.d.ts +208 -0
  139. package/lib/Types/Events.js +2 -0
  140. package/lib/Types/GroupMetadata.d.ts +58 -0
  141. package/lib/Types/GroupMetadata.js +2 -0
  142. package/lib/Types/Label.d.ts +46 -0
  143. package/lib/Types/Label.js +28 -0
  144. package/lib/Types/LabelAssociation.d.ts +29 -0
  145. package/lib/Types/LabelAssociation.js +10 -0
  146. package/lib/Types/Message.d.ts +391 -0
  147. package/lib/Types/Message.js +9 -0
  148. package/lib/Types/Newsletter.d.ts +92 -0
  149. package/lib/Types/Newsletter.js +33 -0
  150. package/lib/Types/Product.d.ts +78 -0
  151. package/lib/Types/Product.js +2 -0
  152. package/lib/Types/Signal.d.ts +57 -0
  153. package/lib/Types/Signal.js +2 -0
  154. package/lib/Types/Socket.d.ts +116 -0
  155. package/lib/Types/Socket.js +2 -0
  156. package/lib/Types/State.d.ts +27 -0
  157. package/lib/Types/State.js +2 -0
  158. package/lib/Types/USync.d.ts +25 -0
  159. package/lib/Types/USync.js +2 -0
  160. package/lib/Types/index.d.ts +70 -0
  161. package/lib/Types/index.js +42 -0
  162. package/lib/Utils/auth-utils.d.ts +18 -0
  163. package/lib/Utils/auth-utils.js +198 -0
  164. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  165. package/lib/Utils/baileys-event-stream.js +64 -0
  166. package/lib/Utils/business.d.ts +22 -0
  167. package/lib/Utils/business.js +239 -0
  168. package/lib/Utils/chat-utils.d.ts +70 -0
  169. package/lib/Utils/chat-utils.js +754 -0
  170. package/lib/Utils/crypto.d.ts +40 -0
  171. package/lib/Utils/crypto.js +150 -0
  172. package/lib/Utils/decode-wa-message.d.ts +36 -0
  173. package/lib/Utils/decode-wa-message.js +228 -0
  174. package/lib/Utils/event-buffer.d.ts +35 -0
  175. package/lib/Utils/event-buffer.js +539 -0
  176. package/lib/Utils/generics.d.ts +96 -0
  177. package/lib/Utils/generics.js +553 -0
  178. package/lib/Utils/history.d.ts +19 -0
  179. package/lib/Utils/history.js +93 -0
  180. package/lib/Utils/index.d.ts +19 -0
  181. package/lib/Utils/index.js +35 -0
  182. package/lib/Utils/link-preview.d.ts +21 -0
  183. package/lib/Utils/link-preview.js +112 -0
  184. package/lib/Utils/logger.d.ts +11 -0
  185. package/lib/Utils/logger.js +7 -0
  186. package/lib/Utils/lt-hash.d.ts +12 -0
  187. package/lib/Utils/lt-hash.js +53 -0
  188. package/lib/Utils/make-mutex.d.ts +7 -0
  189. package/lib/Utils/make-mutex.js +45 -0
  190. package/lib/Utils/messages-media.d.ts +104 -0
  191. package/lib/Utils/messages-media.js +751 -0
  192. package/lib/Utils/messages.d.ts +80 -0
  193. package/lib/Utils/messages.js +1371 -0
  194. package/lib/Utils/noise-handler.d.ts +19 -0
  195. package/lib/Utils/noise-handler.js +150 -0
  196. package/lib/Utils/process-message.d.ts +41 -0
  197. package/lib/Utils/process-message.js +378 -0
  198. package/lib/Utils/signal.d.ts +33 -0
  199. package/lib/Utils/signal.js +154 -0
  200. package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
  201. package/lib/Utils/use-mongo-file-auth-state.js +75 -0
  202. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  203. package/lib/Utils/use-multi-file-auth-state.js +123 -0
  204. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  205. package/lib/Utils/use-single-file-auth-state.js +75 -0
  206. package/lib/Utils/validate-connection.d.ts +10 -0
  207. package/lib/Utils/validate-connection.js +174 -0
  208. package/lib/WABinary/constants.d.ts +27 -0
  209. package/lib/WABinary/constants.js +45 -0
  210. package/lib/WABinary/decode.d.ts +6 -0
  211. package/lib/WABinary/decode.js +255 -0
  212. package/lib/WABinary/encode.d.ts +2 -0
  213. package/lib/WABinary/encode.js +243 -0
  214. package/lib/WABinary/generic-utils.d.ts +16 -0
  215. package/lib/WABinary/generic-utils.js +125 -0
  216. package/lib/WABinary/index.d.ts +5 -0
  217. package/lib/WABinary/index.js +21 -0
  218. package/lib/WABinary/jid-utils.d.ts +34 -0
  219. package/lib/WABinary/jid-utils.js +73 -0
  220. package/lib/WABinary/types.d.ts +18 -0
  221. package/lib/WABinary/types.js +2 -0
  222. package/lib/WAM/BinaryInfo.d.ts +16 -0
  223. package/lib/WAM/BinaryInfo.js +14 -0
  224. package/lib/WAM/constants.d.ts +39 -0
  225. package/lib/WAM/constants.js +15362 -0
  226. package/lib/WAM/encode.d.ts +2 -0
  227. package/lib/WAM/encode.js +156 -0
  228. package/lib/WAM/index.d.ts +3 -0
  229. package/lib/WAM/index.js +19 -0
  230. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
  231. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -0
  232. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  233. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  234. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  235. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +58 -0
  236. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  237. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  238. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
  239. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
  240. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  241. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  242. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  243. package/lib/WAUSync/Protocols/index.js +22 -0
  244. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  245. package/lib/WAUSync/USyncQuery.js +88 -0
  246. package/lib/WAUSync/USyncUser.d.ts +12 -0
  247. package/lib/WAUSync/USyncUser.js +27 -0
  248. package/lib/WAUSync/index.d.ts +3 -0
  249. package/lib/WAUSync/index.js +19 -0
  250. package/lib/index.d.ts +13 -0
  251. package/lib/index.js +9 -0
  252. package/package.json +66 -0
@@ -0,0 +1,128 @@
1
+ import { proto } from '../../WAProto'
2
+ import { GroupMetadata, ParticipantAction, SocketConfig, ContactAction } from '../Types'
3
+ import { BinaryNode } from '../WABinary'
4
+ export declare const makeGroupsSocket: (config: SocketConfig) => {
5
+ groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
6
+ groupMetadata: (jid: string) => Promise<GroupMetadata>
7
+ groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>
8
+ groupLeave: (id: string) => Promise<void>
9
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>
10
+ groupRequestParticipantsList: (jid: string) => Promise<{
11
+ [key: string]: string
12
+ }[]>
13
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
14
+ status: string
15
+ jid: string
16
+ }[]>
17
+ groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
18
+ status: string
19
+ jid: string
20
+ content: BinaryNode
21
+ }[]>
22
+ groupUpdateDescription: (jid: string, description?: string) => Promise<void>
23
+ groupInviteCode: (jid: string) => Promise<string | undefined>
24
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>
25
+ groupAcceptInvite: (code: string) => Promise<string | undefined>
26
+ /**
27
+ * revoke a v4 invite for someone
28
+ * @param groupJid group jid
29
+ * @param invitedJid jid of person you invited
30
+ * @returns true if successful
31
+ */
32
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
33
+ /**
34
+ * accept a GroupInviteMessage
35
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
36
+ * @param inviteMessage the message to accept
37
+ */
38
+ groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>
39
+ groupGetInviteInfo: (code: string) => Promise<GroupMetadata>
40
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
41
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>
42
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>
43
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>
44
+ groupFetchAllParticipating: () => Promise<{
45
+ [_: string]: GroupMetadata
46
+ }>
47
+ processingMutex: {
48
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
49
+ }
50
+ fetchPrivacySettings: (force?: boolean) => Promise<{
51
+ [_: string]: string
52
+ }>
53
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
54
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
55
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
56
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
57
+ getLidUser: (jid: string) => Promise<{
58
+ lid: string
59
+ id: string
60
+ }[] | undefined>
61
+ onWhatsApp: (...jids: string[]) => Promise<{
62
+ jid: string
63
+ exists: unknown
64
+ }[] | undefined>
65
+ fetchBlocklist: () => Promise<string[]>
66
+ fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
67
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
68
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
69
+ removeProfilePicture: (jid: string) => Promise<void>
70
+ updateProfileStatus: (status: string) => Promise<void>
71
+ updateProfileName: (name: string) => Promise<void>
72
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
73
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
74
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
75
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
76
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
77
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
78
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
79
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
80
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
81
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
82
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
83
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
84
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
85
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>
86
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
87
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
88
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
89
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
90
+ clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
91
+ star: (jid: string, messages: {
92
+ id: string
93
+ fromMe?: boolean | undefined
94
+ }[], star: boolean) => Promise<void>
95
+ addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
96
+ removeContact: (jid: string) => Promise<void>
97
+ executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>
98
+ type: "md"
99
+ ws: import("./Client").WebSocketClient
100
+ ev: import("../Types").BaileysEventEmitter & {
101
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
102
+ buffer(): void
103
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
104
+ flush(force?: boolean | undefined): boolean
105
+ isBuffering(): boolean
106
+ }
107
+ authState: {
108
+ creds: import("../Types").AuthenticationCreds
109
+ keys: import("../Types").SignalKeyStoreWithTransaction
110
+ }
111
+ signalRepository: import("../Types").SignalRepository
112
+ user: import("../Types").Contact | undefined
113
+ generateMessageTag: () => string
114
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
115
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
116
+ waitForSocketOpen: () => Promise<void>
117
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
118
+ sendNode: (frame: BinaryNode) => Promise<void>
119
+ logout: (msg?: string | undefined) => Promise<void>
120
+ end: (error: Error | undefined) => void
121
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
122
+ uploadPreKeys: (count?: number) => Promise<void>
123
+ uploadPreKeysToServerIfRequired: () => Promise<void>
124
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
125
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
126
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
127
+ }
128
+ export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata
@@ -0,0 +1,307 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ const WAProto_1 = require("../../WAProto")
4
+ const Types_1 = require("../Types")
5
+ const Utils_1 = require("../Utils")
6
+ const WABinary_1 = require("../WABinary")
7
+ const chats_1 = require("./chats")
8
+ const makeGroupsSocket = (config) => {
9
+ const suki = chats_1.makeChatsSocket(config)
10
+ const { authState, ev, query, upsertMessage } = suki
11
+ const groupQuery = async (jid, type, content) => (query({
12
+ tag: 'iq',
13
+ attrs: {
14
+ type,
15
+ xmlns: 'w:g2',
16
+ to: jid,
17
+ },
18
+ content
19
+ }))
20
+ const groupMetadata = async (jid) => {
21
+ const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }])
22
+ return extractGroupMetadata(result)
23
+ }
24
+ const groupFetchAllParticipating = async () => {
25
+ const result = await query({
26
+ tag: 'iq',
27
+ attrs: {
28
+ to: '@g.us',
29
+ xmlns: 'w:g2',
30
+ type: 'get',
31
+ },
32
+ content: [
33
+ {
34
+ tag: 'participating',
35
+ attrs: {},
36
+ content: [
37
+ { tag: 'participants', attrs: {} },
38
+ { tag: 'description', attrs: {} }
39
+ ]
40
+ }
41
+ ]
42
+ })
43
+ const data = {}
44
+ const groupsChild = WABinary_1.getBinaryNodeChild(result, 'groups')
45
+ if (groupsChild) {
46
+ const groups = WABinary_1.getBinaryNodeChildren(groupsChild, 'group')
47
+ for (const groupNode of groups) {
48
+ const meta = extractGroupMetadata({
49
+ tag: 'result',
50
+ attrs: {},
51
+ content: [groupNode]
52
+ })
53
+ data[meta.id] = meta
54
+ }
55
+ }
56
+ suki.ev.emit('groups.update', Object.values(data))
57
+ return data
58
+ }
59
+ return {
60
+ ...suki,
61
+ groupQuery,
62
+ groupMetadata,
63
+ groupCreate: async (subject, participants) => {
64
+ const key = Utils_1.generateMessageID()
65
+ const result = await groupQuery('@g.us', 'set', [
66
+ {
67
+ tag: 'create',
68
+ attrs: {
69
+ subject,
70
+ key
71
+ },
72
+ content: participants.map(jid => ({
73
+ tag: 'participant',
74
+ attrs: { jid }
75
+ }))
76
+ }
77
+ ])
78
+ return extractGroupMetadata(result)
79
+ },
80
+ groupLeave: async (id) => {
81
+ await groupQuery('@g.us', 'set', [
82
+ {
83
+ tag: 'leave',
84
+ attrs: {},
85
+ content: [
86
+ { tag: 'group', attrs: { id } }
87
+ ]
88
+ }
89
+ ])
90
+ },
91
+ groupUpdateSubject: async (jid, subject) => {
92
+ await groupQuery(jid, 'set', [
93
+ {
94
+ tag: 'subject',
95
+ attrs: {},
96
+ content: Buffer.from(subject, 'utf-8')
97
+ }
98
+ ])
99
+ },
100
+ groupRequestParticipantsList: async (jid) => {
101
+ const result = await groupQuery(jid, 'get', [
102
+ {
103
+ tag: 'membership_approval_requests',
104
+ attrs: {}
105
+ }
106
+ ])
107
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests')
108
+ const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request')
109
+ return participants.map(v => v.attrs)
110
+ },
111
+ groupRequestParticipantsUpdate: async (jid, participants, action) => {
112
+ const result = await groupQuery(jid, 'set', [{
113
+ tag: 'membership_requests_action',
114
+ attrs: {},
115
+ content: [
116
+ {
117
+ tag: action,
118
+ attrs: {},
119
+ content: participants.map(jid => ({
120
+ tag: 'participant',
121
+ attrs: { jid }
122
+ }))
123
+ }
124
+ ]
125
+ }])
126
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action')
127
+ const nodeAction = WABinary_1.getBinaryNodeChild(node, action)
128
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant')
129
+ return participantsAffected.map(p => {
130
+ return { status: p.attrs.error || '200', jid: p.attrs.jid }
131
+ })
132
+ },
133
+ groupParticipantsUpdate: async (jid, participants, action) => {
134
+ const result = await groupQuery(jid, 'set', [
135
+ {
136
+ tag: action,
137
+ attrs: {},
138
+ content: participants.map(jid => ({
139
+ tag: 'participant',
140
+ attrs: { jid }
141
+ }))
142
+ }
143
+ ])
144
+ const node = WABinary_1.getBinaryNodeChild(result, action)
145
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant')
146
+ return participantsAffected.map(p => {
147
+ return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p }
148
+ })
149
+ },
150
+ groupUpdateDescription: async (jid, description) => {
151
+ const metadata = await groupMetadata(jid)
152
+ const prev = metadata.descId ? metadata.descId : null
153
+ await groupQuery(jid, 'set', [
154
+ {
155
+ tag: 'description',
156
+ attrs: {
157
+ ...(description ? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
158
+ ...(prev ? { prev } : {})
159
+ },
160
+ content: description ? [
161
+ { tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }
162
+ ] : undefined
163
+ }
164
+ ])
165
+ },
166
+ groupInviteCode: async (jid) => {
167
+ const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }])
168
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite')
169
+ return inviteNode?.attrs?.code
170
+ },
171
+ groupRevokeInvite: async (jid) => {
172
+ const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }])
173
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite')
174
+ return inviteNode?.attrs?.code
175
+ },
176
+ groupAcceptInvite: async (code) => {
177
+ const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }])
178
+ const result = WABinary_1.getBinaryNodeChild(results, 'group')
179
+ return result?.attrs?.jid
180
+ },
181
+ /**
182
+ * revoke a v4 invite for someone
183
+ * @param groupJid group jid
184
+ * @param invitedJid jid of person you invited
185
+ * @returns true if successful
186
+ */
187
+ groupRevokeInviteV4: async (groupJid, invitedJid) => {
188
+ const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }])
189
+ return !!result
190
+ },
191
+ /**
192
+ * accept a GroupInviteMessage
193
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
194
+ * @param inviteMessage the message to accept
195
+ */
196
+ groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
197
+ key = typeof key === 'string' ? { remoteJid: key } : key
198
+ const results = await groupQuery(inviteMessage.groupJid, 'set', [{
199
+ tag: 'accept',
200
+ attrs: {
201
+ code: inviteMessage.inviteCode,
202
+ expiration: inviteMessage.inviteExpiration.toString(),
203
+ admin: key.remoteJid
204
+ }
205
+ }])
206
+ // if we have the full message key
207
+ // update the invite message to be expired
208
+ if (key.id) {
209
+ // create new invite message that is expired
210
+ inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage)
211
+ inviteMessage.inviteExpiration = 0
212
+ inviteMessage.inviteCode = ''
213
+ ev.emit('messages.update', [
214
+ {
215
+ key,
216
+ update: {
217
+ message: {
218
+ groupInviteMessage: inviteMessage
219
+ }
220
+ }
221
+ }
222
+ ])
223
+ }
224
+ // generate the group add message
225
+ await upsertMessage({
226
+ key: {
227
+ remoteJid: inviteMessage.groupJid,
228
+ id: Utils_1.generateMessageID(authState.creds.me?.id),
229
+ fromMe: false,
230
+ participant: key.remoteJid,
231
+ },
232
+ messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
233
+ messageStubParameters: [
234
+ authState.creds.me.id
235
+ ],
236
+ participant: key.remoteJid,
237
+ messageTimestamp: Utils_1.unixTimestampSeconds()
238
+ }, 'notify')
239
+ return results.attrs.from
240
+ }),
241
+ groupGetInviteInfo: async (code) => {
242
+ const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }])
243
+ return extractGroupMetadata(results)
244
+ },
245
+ groupToggleEphemeral: async (jid, ephemeralExpiration) => {
246
+ const content = ephemeralExpiration ?
247
+ { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
248
+ { tag: 'not_ephemeral', attrs: {} }
249
+ await groupQuery(jid, 'set', [content])
250
+ },
251
+ groupSettingUpdate: async (jid, setting) => {
252
+ await groupQuery(jid, 'set', [{ tag: setting, attrs: {} }])
253
+ },
254
+ groupMemberAddMode: async (jid, mode) => {
255
+ await groupQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }])
256
+ },
257
+ groupJoinApprovalMode: async (jid, mode) => {
258
+ await groupQuery(jid, 'set', [{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }])
259
+ },
260
+ groupFetchAllParticipating
261
+ }
262
+ }
263
+ const extractGroupMetadata = (result) => {
264
+ const group = WABinary_1.getBinaryNodeChild(result, 'group')
265
+ const descChild = WABinary_1.getBinaryNodeChild(group, 'description')
266
+ let desc
267
+ let descId
268
+ if (descChild) {
269
+ desc = WABinary_1.getBinaryNodeChildString(descChild, 'body')
270
+ descId = descChild.attrs.id
271
+ }
272
+ const groupId = group.attrs.id.includes('@') ? group.attrs.id : WABinary_1.jidEncode(group.attrs.id, 'g.us')
273
+ const eph = WABinary_1.getBinaryNodeChild(group, 'ephemeral')?.attrs.expiration
274
+ const memberAddMode = WABinary_1.getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add'
275
+ const metadata = {
276
+ id: groupId,
277
+ addressingMode: group.attrs.addressing_mode,
278
+ subject: group.attrs.subject,
279
+ subjectOwner: group.attrs.s_o,
280
+ subjectTime: +group.attrs.s_t,
281
+ size: WABinary_1.getBinaryNodeChildren(group, 'participant').length,
282
+ creation: +group.attrs.creation,
283
+ owner: group.attrs.creator ? WABinary_1.jidNormalizedUser(group.attrs.creator) : undefined,
284
+ desc,
285
+ descId,
286
+ linkedParent: WABinary_1.getBinaryNodeChild(group, 'linked_parent')?.attrs.jid || undefined,
287
+ restrict: !!WABinary_1.getBinaryNodeChild(group, 'locked'),
288
+ announce: !!WABinary_1.getBinaryNodeChild(group, 'announcement'),
289
+ isCommunity: !!WABinary_1.getBinaryNodeChild(group, 'parent'),
290
+ isCommunityAnnounce: !!WABinary_1.getBinaryNodeChild(group, 'default_sub_group'),
291
+ joinApprovalMode: !!WABinary_1.getBinaryNodeChild(group, 'membership_approval_mode'),
292
+ memberAddMode,
293
+ participants: WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
294
+ return {
295
+ id: attrs.jid,
296
+ lid: attrs.lid,
297
+ admin: (attrs.type || null),
298
+ }
299
+ }),
300
+ ephemeralDuration: eph ? +eph : undefined,
301
+ }
302
+ return metadata
303
+ }
304
+ module.exports = {
305
+ makeGroupsSocket,
306
+ extractGroupMetadata
307
+ }
@@ -0,0 +1,183 @@
1
+ import { UserFacingSocketConfig, ContactAction } from '../Types'
2
+ declare const makeWASocket: (config: UserFacingSocketConfig) => {
3
+ logger: import("../Utils/logger").ILogger
4
+ getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>
5
+ getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
6
+ products: import("../Types").Product[]
7
+ nextPageCursor: string | undefined
8
+ }>
9
+ getCollections: (jid?: string | undefined, limit?: number) => Promise<{
10
+ collections: import("../Types").CatalogCollection[]
11
+ }>
12
+ productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>
13
+ productDelete: (productIds: string[]) => Promise<{
14
+ deleted: number
15
+ }>
16
+ productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>
17
+ sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number | undefined) => Promise<void>
18
+ sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>
19
+ offerCall: (toJid: string, isVideo?: boolean) => Promise<{
20
+ id: any
21
+ to: string
22
+ }>
23
+ rejectCall: (callId: string, callFrom: string) => Promise<void>
24
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAProto.IMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>
25
+ requestPlaceholderResend: (messageKey: import("../Types").WAProto.IMessageKey) => Promise<string | undefined>
26
+ getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>
27
+ assertSessions: (jids: string[], force: boolean) => Promise<boolean>
28
+ relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>
29
+ sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>
30
+ sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>
31
+ readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>
32
+ refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>
33
+ waUploadToServer: import("../Types").WAMediaUploadFunction
34
+ fetchPrivacySettings: (force?: boolean) => Promise<{
35
+ [_: string]: string
36
+ }>
37
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>
38
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
39
+ [key: string]: string
40
+ } | undefined) => Promise<{
41
+ nodes: import("..").BinaryNode[]
42
+ shouldIncludeDeviceIdentity: boolean
43
+ }>
44
+ profilePictureUrl: (jids: string) => Promise<string>
45
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>
46
+ updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>
47
+ sendStatusMentions: (content: import("../Types").WAProto.IMessage, jid: string, Private?: boolean) => Promise<string>
48
+ sendAlbumMessage: (jid: string, medias: import("../Types").WAProto.IMessage, options?: import("../Types").MiscMessageGenerationOptions) => Promise<string>
49
+ sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>
50
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
51
+ duration: string
52
+ }>
53
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>
54
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
55
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>
56
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
57
+ newsletterRemovePicture: (jid: string) => Promise<void>
58
+ newsletterUnfollow: (jid: string) => Promise<void>
59
+ newsletterFollow: (jid: string) => Promise<void>
60
+ newsletterUnmute: (jid: string) => Promise<void>
61
+ newsletterMute: (jid: string) => Promise<void>
62
+ newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>
63
+ newsletterQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
64
+ newsletterWMexQuery: (jid?: string | undefined, query_id: number, content: BinaryNode) => Promise<BinaryNode>
65
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>
66
+ newsletterAdminCount: (jid: string) => Promise<number>
67
+ newsletterChangeOwner: (jid: string, userLid: string) => Promise<void>
68
+ newsletterDemote: (jid: string, userLid: string) => Promise<void>
69
+ newsletterDelete: (jid: string) => Promise<void>
70
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>
71
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
72
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
73
+ groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
74
+ groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>
75
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>
76
+ groupLeave: (id: string) => Promise<void>
77
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>
78
+ groupRequestParticipantsList: (jid: string) => Promise<{
79
+ [key: string]: string
80
+ }[]>
81
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
82
+ status: string
83
+ jid: string
84
+ }[]>
85
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
86
+ status: string
87
+ jid: string
88
+ content: import("..").BinaryNode
89
+ }[]>
90
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
91
+ groupInviteCode: (jid: string) => Promise<string | undefined>
92
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>
93
+ groupAcceptInvite: (code: string) => Promise<string | undefined>
94
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
95
+ groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>
96
+ groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>
97
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
98
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>
99
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>
100
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>
101
+ groupFetchAllParticipating: () => Promise<{
102
+ [_: string]: import("../Types").GroupMetadata
103
+ }>
104
+ processingMutex: {
105
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
106
+ }
107
+ upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
108
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
109
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
110
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
111
+ getBotListV2: () => Promise<BotListInfo[]>
112
+ getLidUser: (jid: string) => Promise<{
113
+ lid: string
114
+ id: string
115
+ }[] | undefined>
116
+ onWhatsApp: (...jids: string[]) => Promise<{
117
+ jid: string
118
+ exists: unknown
119
+ }[] | undefined>
120
+ fetchBlocklist: () => Promise<string[]>
121
+ fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
122
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
123
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
124
+ removeProfilePicture: (jid: string) => Promise<void>
125
+ updateProfileStatus: (status: string) => Promise<void>
126
+ updateProfileName: (name: string) => Promise<void>
127
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
128
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
129
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
130
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
131
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
132
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
133
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
134
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
135
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
136
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
137
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
138
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
139
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
140
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>
141
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
142
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
143
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
144
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
145
+ clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
146
+ star: (jid: string, messages: {
147
+ id: string
148
+ fromMe?: boolean | undefined
149
+ }[], star: boolean) => Promise<void>
150
+ addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
151
+ removeContact: (jid: string) => Promise<void>
152
+ executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>
153
+ type: "md"
154
+ ws: import("./Client").WebSocketClient
155
+ ev: import("../Types").BaileysEventEmitter & {
156
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
157
+ buffer(): void
158
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
159
+ flush(force?: boolean | undefined): boolean
160
+ isBuffering(): boolean
161
+ }
162
+ authState: {
163
+ creds: import("../Types").AuthenticationCreds
164
+ keys: import("../Types").SignalKeyStoreWithTransaction
165
+ }
166
+ signalRepository: import("../Types").SignalRepository
167
+ user: import("../Types").Contact | undefined
168
+ generateMessageTag: () => string
169
+ query: (node: import("..").BinaryNode, timeoutMs?: number | undefined) => Promise<import("..").BinaryNode>
170
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
171
+ waitForSocketOpen: () => Promise<void>
172
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
173
+ sendNode: (frame: import("..").BinaryNode) => Promise<void>
174
+ logout: (msg?: string | undefined) => Promise<void>
175
+ end: (error: Error | undefined) => void
176
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
177
+ uploadPreKeys: (count?: number) => Promise<void>
178
+ uploadPreKeysToServerIfRequired: () => Promise<void>
179
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
180
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
181
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>
182
+ }
183
+ export default makeWASocket
@@ -0,0 +1,10 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", { value: true })
3
+ const Defaults_1 = require("../Defaults")
4
+ const business_1 = require("./business")
5
+ // export the last socket layer
6
+ const makeWASocket = (config) => (business_1.makeBusinessSocket({
7
+ ...Defaults_1.DEFAULT_CONNECTION_CONFIG,
8
+ ...config
9
+ }))
10
+ exports.default = makeWASocket