@fhynella/baileys 2.0.5 → 2.1.7

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 (204) hide show
  1. package/lib/Defaults/connection.js +51 -0
  2. package/lib/Defaults/constants.js +62 -0
  3. package/lib/Defaults/history.js +17 -0
  4. package/lib/Defaults/index.js +36 -142
  5. package/lib/Defaults/media.js +48 -0
  6. package/lib/Defaults/prefix.js +18 -0
  7. package/lib/Signal/Group/group-session-builder.js +10 -42
  8. package/lib/Signal/Group/group_cipher.js +9 -6
  9. package/lib/Signal/Group/index.js +39 -53
  10. package/lib/Signal/Group/keyhelper.js +8 -41
  11. package/lib/Signal/Group/sender-chain-key.js +4 -4
  12. package/lib/Signal/Group/sender-key-distribution-message.js +5 -5
  13. package/lib/Signal/Group/sender-key-message.js +12 -8
  14. package/lib/Signal/Group/sender-key-record.js +7 -7
  15. package/lib/Signal/Group/sender-key-state.js +4 -4
  16. package/lib/Signal/Group/sender-message-key.js +2 -2
  17. package/lib/Signal/libsignal.js +45 -69
  18. package/lib/Signal/lid-mapping.js +15 -11
  19. package/lib/Socket/Client/types.js +2 -2
  20. package/lib/Socket/Client/websocket.js +16 -14
  21. package/lib/Socket/business.js +41 -32
  22. package/lib/Socket/chats.js +123 -98
  23. package/lib/Socket/community.js +50 -40
  24. package/lib/Socket/groups.js +59 -47
  25. package/lib/Socket/index.js +4 -4
  26. package/lib/Socket/messages-recv.js +219 -172
  27. package/lib/Socket/messages-send.js +187 -211
  28. package/lib/Socket/newsletter.js +61 -47
  29. package/lib/Socket/socket.js +133 -90
  30. package/lib/Socket/usync.js +6 -6
  31. package/lib/Store/index.js +27 -11
  32. package/lib/Store/make-cache-manager-store.js +14 -15
  33. package/lib/Store/make-in-memory-store.js +28 -24
  34. package/lib/Types/LabelAssociation.js +2 -2
  35. package/lib/Types/Message.js +6 -6
  36. package/lib/Types/MexUpdates.js +5 -5
  37. package/lib/Types/State.js +4 -4
  38. package/lib/Types/index.js +28 -12
  39. package/lib/Utils/auth-utils.js +28 -26
  40. package/lib/Utils/baileys-event-stream.js +68 -69
  41. package/lib/Utils/business.js +63 -53
  42. package/lib/Utils/chat-utils.js +81 -71
  43. package/lib/Utils/crypto.js +25 -45
  44. package/lib/Utils/decode-wa-message.js +319 -311
  45. package/lib/Utils/event-buffer.js +21 -22
  46. package/lib/Utils/generics.js +52 -75
  47. package/lib/Utils/history.js +21 -21
  48. package/lib/Utils/index.js +27 -13
  49. package/lib/Utils/link-preview.js +7 -30
  50. package/lib/Utils/logger.js +5 -5
  51. package/lib/Utils/lt-hash.js +3 -3
  52. package/lib/Utils/message-retry-manager.js +4 -4
  53. package/lib/Utils/messages-media.js +104 -109
  54. package/lib/Utils/messages.js +203 -171
  55. package/lib/Utils/noise-handler.js +28 -19
  56. package/lib/Utils/process-message.js +111 -96
  57. package/lib/Utils/signal.js +36 -25
  58. package/lib/Utils/use-multi-file-auth-state.js +18 -22
  59. package/lib/Utils/validate-connection.js +52 -45
  60. package/lib/WABinary/decode.js +6 -32
  61. package/lib/WABinary/encode.js +3 -29
  62. package/lib/WABinary/generic-utils.js +4 -4
  63. package/lib/WABinary/index.js +27 -11
  64. package/lib/WAM/encode.js +16 -8
  65. package/lib/WAM/index.js +27 -11
  66. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
  67. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  68. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
  69. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  70. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
  71. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  72. package/lib/WAUSync/Protocols/index.js +27 -11
  73. package/lib/WAUSync/USyncQuery.js +17 -10
  74. package/lib/WAUSync/index.js +27 -11
  75. package/lib/index.js +60 -31
  76. package/package.json +15 -6
  77. package/WAProto/AICommon/AICommon.d.ts +0 -11702
  78. package/WAProto/Adv/Adv.d.ts +0 -643
  79. package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
  80. package/WAProto/Cert/Cert.d.ts +0 -613
  81. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
  82. package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
  83. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
  84. package/WAProto/E2E/E2E.d.ts +0 -41724
  85. package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
  86. package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
  87. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
  88. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
  89. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
  90. package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
  91. package/WAProto/Protocol/Protocol.d.ts +0 -270
  92. package/WAProto/Reporting/Reporting.d.ts +0 -371
  93. package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
  94. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
  95. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
  96. package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
  97. package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
  98. package/WAProto/UserPassword/UserPassword.d.ts +0 -363
  99. package/WAProto/VnameCert/VnameCert.d.ts +0 -821
  100. package/WAProto/Wa6/Wa6.d.ts +0 -2128
  101. package/WAProto/Web/Web.d.ts +0 -46383
  102. package/WAProto/index.d.ts +0 -55
  103. package/lib/Defaults/index.d.ts +0 -77
  104. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  105. package/lib/Signal/Group/group-session-builder.d.ts +0 -17
  106. package/lib/Signal/Group/group_cipher.d.ts +0 -19
  107. package/lib/Signal/Group/index.d.ts +0 -11
  108. package/lib/Signal/Group/keyhelper.d.ts +0 -16
  109. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  110. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  111. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  112. package/lib/Signal/Group/sender-key-name.d.ts +0 -19
  113. package/lib/Signal/Group/sender-key-record.d.ts +0 -32
  114. package/lib/Signal/Group/sender-key-state.d.ts +0 -44
  115. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  116. package/lib/Signal/libsignal.d.ts +0 -8
  117. package/lib/Signal/lid-mapping.d.ts +0 -28
  118. package/lib/Socket/.nomedia +0 -0
  119. package/lib/Socket/Client/index.d.ts +0 -2
  120. package/lib/Socket/Client/types.d.ts +0 -16
  121. package/lib/Socket/Client/websocket.d.ts +0 -13
  122. package/lib/Socket/business.d.ts +0 -187
  123. package/lib/Socket/chats.d.ts +0 -97
  124. package/lib/Socket/community.d.ts +0 -129
  125. package/lib/Socket/groups.d.ts +0 -129
  126. package/lib/Socket/index.d.ts +0 -197
  127. package/lib/Socket/messages-recv.d.ts +0 -180
  128. package/lib/Socket/messages-send.d.ts +0 -169
  129. package/lib/Socket/messages-send.d.ts.bak +0 -165
  130. package/lib/Socket/messages-send.js.bak +0 -1812
  131. package/lib/Socket/newsletter.d.ts +0 -145
  132. package/lib/Socket/socket.d.ts +0 -45
  133. package/lib/Socket/usync.d.ts +0 -37
  134. package/lib/Store/index.d.ts +0 -4
  135. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  136. package/lib/Store/make-in-memory-store.d.ts +0 -123
  137. package/lib/Store/make-ordered-dictionary.d.ts +0 -12
  138. package/lib/Store/object-repository.d.ts +0 -10
  139. package/lib/Types/Auth.d.ts +0 -121
  140. package/lib/Types/Bussiness.d.ts +0 -28
  141. package/lib/Types/Call.d.ts +0 -14
  142. package/lib/Types/Chat.d.ts +0 -143
  143. package/lib/Types/Contact.d.ts +0 -23
  144. package/lib/Types/Events.d.ts +0 -226
  145. package/lib/Types/GroupMetadata.d.ts +0 -66
  146. package/lib/Types/Label.d.ts +0 -48
  147. package/lib/Types/LabelAssociation.d.ts +0 -35
  148. package/lib/Types/Message.d.ts +0 -484
  149. package/lib/Types/MexUpdates.d.ts +0 -9
  150. package/lib/Types/Newsletter.d.ts +0 -109
  151. package/lib/Types/Product.d.ts +0 -92
  152. package/lib/Types/Signal.d.ts +0 -98
  153. package/lib/Types/Socket.d.ts +0 -141
  154. package/lib/Types/State.d.ts +0 -41
  155. package/lib/Types/USync.d.ts +0 -26
  156. package/lib/Types/index.d.ts +0 -80
  157. package/lib/Utils/auth-utils.d.ts +0 -21
  158. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  159. package/lib/Utils/business.d.ts +0 -29
  160. package/lib/Utils/chat-utils.d.ts +0 -82
  161. package/lib/Utils/crypto.d.ts +0 -56
  162. package/lib/Utils/decode-wa-message.d.ts +0 -53
  163. package/lib/Utils/event-buffer.d.ts +0 -39
  164. package/lib/Utils/generics.d.ts +0 -117
  165. package/lib/Utils/history.d.ts +0 -23
  166. package/lib/Utils/index.d.ts +0 -20
  167. package/lib/Utils/link-preview.d.ts +0 -23
  168. package/lib/Utils/logger.d.ts +0 -13
  169. package/lib/Utils/lt-hash.d.ts +0 -14
  170. package/lib/Utils/make-mutex.d.ts +0 -9
  171. package/lib/Utils/message-retry-manager.d.ts +0 -88
  172. package/lib/Utils/messages-media.d.ts +0 -135
  173. package/lib/Utils/messages.d.ts +0 -105
  174. package/lib/Utils/noise-handler.d.ts +0 -20
  175. package/lib/Utils/process-message.d.ts +0 -49
  176. package/lib/Utils/signal.d.ts +0 -42
  177. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  178. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  179. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  180. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  181. package/lib/Utils/use-single-file-auth-state.js +0 -80
  182. package/lib/Utils/validate-connection.d.ts +0 -13
  183. package/lib/WABinary/constants.d.ts +0 -30
  184. package/lib/WABinary/decode.d.ts +0 -9
  185. package/lib/WABinary/encode.d.ts +0 -3
  186. package/lib/WABinary/generic-utils.d.ts +0 -28
  187. package/lib/WABinary/index.d.ts +0 -5
  188. package/lib/WABinary/jid-utils.d.ts +0 -58
  189. package/lib/WABinary/types.d.ts +0 -22
  190. package/lib/WAM/BinaryInfo.d.ts +0 -16
  191. package/lib/WAM/constants.d.ts +0 -47
  192. package/lib/WAM/encode.d.ts +0 -3
  193. package/lib/WAM/index.d.ts +0 -3
  194. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
  195. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  196. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
  197. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
  198. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
  199. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
  200. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  201. package/lib/WAUSync/USyncQuery.d.ts +0 -31
  202. package/lib/WAUSync/USyncUser.d.ts +0 -12
  203. package/lib/WAUSync/index.d.ts +0 -3
  204. package/lib/index.d.ts +0 -13
@@ -1,145 +0,0 @@
1
- import { SocketConfig, WAMediaUpload, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, NewsletterFetchedUpdate, ContactAction } from '../Types'
2
- import { BinaryNode } from '../WABinary'
3
-
4
- export declare const makeNewsletterSocket: (config: SocketConfig) => {
5
- subscribeNewsletterUpdates: (jid: string) => Promise<{
6
- duration: string
7
- }>
8
- newsletterReactionMode: (jid: string, mode: NewsletterReactionMode) => Promise<void>
9
- newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>
10
- newsletterUpdateName: (jid: string, name: string) => Promise<void>
11
- newsletterUpdatePicture: (jid: string, content: WAMediaUpload) => Promise<void>
12
- newsletterRemovePicture: (jid: string) => Promise<void>
13
- newsletterUnfollow: (jid: string) => Promise<void>
14
- newsletterFollow: (jid: string) => Promise<void>
15
- newsletterUnmute: (jid: string) => Promise<void>
16
- newsletterMute: (jid: string) => Promise<void>
17
- newsletterCreate: (name: string, description?: string, picture?: WAMediaUpload) => Promise<NewsletterMetadata>
18
- newsletterQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
19
- newsletterWMexQuery: (jid?: string | undefined, query_id: number, content: BinaryNode) => Promise<BinaryNode>
20
- newsletterMetadata: (type: 'invite' | 'jid', key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>
21
- newsletterFetchAllParticipating: () => Promise<{
22
- [_: string]: NewsletterMetadata
23
- }>
24
- newsletterAdminCount: (jid: string) => Promise<number>
25
- newsletterChangeOwner: (jid: string, userLid: string) => Promise<void>
26
- newsletterDemote: (jid: string, userLid: string) => Promise<void>
27
- newsletterDelete: (jid: string) => Promise<void>
28
- /**if code wasn't passed, the reaction will be removed (if is reacted) */
29
- newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>
30
- newsletterFetchMessages: (type: 'invite' | 'jid', key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>
31
- newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<NewsletterFetchedUpdate[]>
32
- groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
33
- groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>
34
- groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>
35
- groupLeave: (id: string) => Promise<void>
36
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>
37
- groupRequestParticipantsList: (jid: string) => Promise<{
38
- [key: string]: string
39
- }[]>
40
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
41
- status: string
42
- jid: string
43
- }[]>
44
- groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
45
- status: string
46
- jid: string
47
- content: BinaryNode
48
- }[]>
49
- groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
50
- groupInviteCode: (jid: string) => Promise<string | undefined>
51
- groupRevokeInvite: (jid: string) => Promise<string | undefined>
52
- groupAcceptInvite: (code: string) => Promise<string | undefined>
53
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
54
- groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>
55
- groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>
56
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
57
- groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>
58
- groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>
59
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>
60
- groupFetchAllParticipating: () => Promise<{
61
- [_: string]: import("../Types").GroupMetadata
62
- }>
63
- processingMutex: {
64
- mutex<T>(code: () => T | Promise<T>): Promise<T>
65
- }
66
- fetchPrivacySettings: (force?: boolean) => Promise<{
67
- [_: string]: string
68
- }>
69
- upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
70
- appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
71
- createCallLink: (type: 'audio' | 'video', event?: number, timeoutMs?: number) => Promise<void>
72
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
73
- presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
74
- getBotListV2: () => Promise<BotListInfo[]>
75
- getLidUser: (jid: string) => Promise<{
76
- lid: string
77
- id: string
78
- }[] | undefined>
79
- fetchBlocklist: () => Promise<string[]>
80
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>
81
- fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>
82
- updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>
83
- removeProfilePicture: (jid: string) => Promise<void>
84
- updateProfileStatus: (status: string) => Promise<void>
85
- updateProfileName: (name: string) => Promise<void>
86
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
87
- updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
88
- updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
89
- updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
90
- updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
91
- updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
92
- updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
93
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
94
- updateDefaultDisappearingMode: (duration: number) => Promise<void>
95
- updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>
96
- getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
97
- resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
98
- chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
99
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
100
- addChatLabel: (jid: string, labelId: string) => Promise<void>
101
- removeChatLabel: (jid: string, labelId: string) => Promise<void>
102
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
103
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
104
- clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
105
- star: (jid: string, messages: {
106
- id: string
107
- fromMe?: boolean | undefined
108
- }[], star: boolean) => Promise<void>
109
- addOrEditQuickReply: (quickReply: import("../Types/Bussines").QuickReplyAction) => Promise<void>
110
- removeQuickReply: (timestamp: string) => Promise<void>
111
- addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
112
- removeContact: (jid: string) => Promise<void>
113
- executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>
114
- type: "md"
115
- ws: any
116
- ev: import("../Types").BaileysEventEmitter & {
117
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
118
- buffer(): void
119
- createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
120
- flush(force?: boolean | undefined): boolean
121
- isBuffering(): boolean
122
- }
123
- authState: {
124
- creds: import("../Types").AuthenticationCreds
125
- keys: import("../Types").SignalKeyStoreWithTransaction
126
- }
127
- signalRepository: import("../Types").SignalRepository
128
- user: import("../Types").Contact | undefined
129
- generateMessageTag: () => string
130
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
131
- waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
132
- waitForSocketOpen: () => Promise<void>
133
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
134
- sendNode: (frame: BinaryNode) => Promise<void>
135
- logout: (msg?: string | undefined) => Promise<void>
136
- end: (error: Error | undefined) => void
137
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
138
- uploadPreKeys: (count?: number) => Promise<void>
139
- uploadPreKeysToServerIfRequired: () => Promise<void>
140
- requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
141
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
142
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
143
- }
144
-
145
- export declare const extractNewsletterMetadata: (node: BinaryNode, isCreate?: boolean) => NewsletterMetadata
@@ -1,45 +0,0 @@
1
- import { Boom } from '@hapi/boom'
2
- import { SocketConfig } from '../Types'
3
- import { BinaryNode } from '../WABinary'
4
- import { WebSocketClient } from './Client'
5
-
6
- /**
7
- * Connects to WA servers and performs:
8
- * - simple queries (no retry mechanism, wait for connection establishment)
9
- * - listen to messages and emit events
10
- * - query phone connection
11
- */
12
- export declare const makeSocket: (config: SocketConfig) => {
13
- type: "md"
14
- ws: WebSocketClient
15
- ev: import("../Types").BaileysEventEmitter & {
16
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
17
- buffer(): void
18
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
19
- flush(force?: boolean | undefined): boolean
20
- isBuffering(): boolean
21
- }
22
- authState: {
23
- creds: import("../Types").AuthenticationCreds
24
- keys: import("../Types").SignalKeyStoreWithTransaction
25
- }
26
- signalRepository: import("../Types").SignalRepository
27
- readonly user: import("../Types").Contact | undefined
28
- generateMessageTag: () => string
29
- query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>
30
- waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>
31
- waitForSocketOpen: () => Promise<void>
32
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
33
- sendNode: (frame: BinaryNode) => Promise<void>
34
- logout: (msg?: string) => Promise<void>
35
- end: (error: Error | undefined) => void
36
- onUnexpectedError: (err: Error | Boom, msg: string) => void
37
- uploadPreKeys: (count?: number) => Promise<void>
38
- uploadPreKeysToServerIfRequired: () => Promise<void>
39
- requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
40
- /** Waits for the connection to WA to reach a state */
41
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
42
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
43
- }
44
-
45
- export type Socket = ReturnType<typeof makeSocket>
@@ -1,37 +0,0 @@
1
- import { Boom } from '@hapi/boom'
2
- import { SocketConfig } from '../Types'
3
- import { BinaryNode } from '../WABinary'
4
- import { USyncQuery } from '../WAUSync'
5
-
6
- export declare const makeUSyncSocket: (config: SocketConfig) => {
7
- executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>
8
- type: "md"
9
- ws: import("./Client").WebSocketClient
10
- ev: import("../Types").BaileysEventEmitter & {
11
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
12
- buffer(): void
13
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
14
- flush(force?: boolean | undefined): boolean
15
- isBuffering(): boolean
16
- }
17
- authState: {
18
- creds: import("../Types").AuthenticationCreds
19
- keys: import("../Types").SignalKeyStoreWithTransaction
20
- }
21
- signalRepository: import("../Types").SignalRepository
22
- user: import("../Types").Contact | undefined
23
- generateMessageTag: () => string
24
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
25
- waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>
26
- waitForSocketOpen: () => Promise<void>
27
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
28
- sendNode: (frame: BinaryNode) => Promise<void>
29
- logout: (msg?: string | undefined) => Promise<void>
30
- end: (error: Error | undefined) => void
31
- onUnexpectedError: (err: Error | Boom<any>, msg: string) => void
32
- uploadPreKeys: (count?: number) => Promise<void>
33
- uploadPreKeysToServerIfRequired: () => Promise<void>
34
- requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
35
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
36
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
37
- }
@@ -1,4 +0,0 @@
1
- export * from './make-cache-manager-store'
2
- export * from './make-in-memory-store'
3
- export * from './make-ordered-dictionary'
4
- export * from './object-repository'
@@ -1,14 +0,0 @@
1
- import { Store } from 'cache-manager'
2
- import { AuthenticationCreds } from '../Types'
3
-
4
- export declare const makeCacheManagerAuthState: (store: Store, sessionKey: string) => Promise<{
5
- clearState: () => Promise<void>
6
- saveCreds: () => Promise<void>
7
- state: {
8
- creds: AuthenticationCreds
9
- keys: {
10
- get: (type: string, ids: string[]) => Promise<{}>
11
- set: (data: any) => Promise<void>
12
- }
13
- }
14
- }>
@@ -1,123 +0,0 @@
1
- import type KeyedDB from '@adiwajshing/keyed-db'
2
- import type { Comparable } from '@adiwajshing/keyed-db/lib/Types'
3
- import type { Logger } from 'pino'
4
- import { proto } from '../../WAProto'
5
- import type makeMDSocket from '../Socket'
6
- import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types'
7
- import { Label } from '../Types/Label'
8
- import { LabelAssociation } from '../Types/LabelAssociation'
9
- import { ObjectRepository } from './object-repository'
10
-
11
- type WASocket = ReturnType<typeof makeMDSocket>
12
-
13
- export declare const waChatKey: (pin: boolean) => {
14
- key: (c: Chat) => string
15
- compare: (k1: string, k2: string) => number
16
- }
17
-
18
- export declare const waMessageID: (m: WAMessage) => string
19
-
20
- export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>
21
-
22
- export type BaileysInMemoryStoreConfig = {
23
- chatKey?: Comparable<Chat, string>
24
- labelAssociationKey?: Comparable<LabelAssociation, string>
25
- logger?: Logger
26
- socket?: WASocket
27
- }
28
-
29
- export declare const makeInMemoryStore: (config: BaileysInMemoryStoreConfig) => {
30
- chats: KeyedDB<Chat, string>
31
- contacts: {
32
- [_: string]: Contact
33
- }
34
- messages: {
35
- [_: string]: {
36
- array: proto.IWebMessageInfo[]
37
- get: (id: string) => proto.IWebMessageInfo | undefined
38
- upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void
39
- update: (item: proto.IWebMessageInfo) => boolean
40
- remove: (item: proto.IWebMessageInfo) => boolean
41
- updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean
42
- clear: () => void
43
- filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void
44
- toJSON: () => proto.IWebMessageInfo[]
45
- fromJSON: (newItems: proto.IWebMessageInfo[]) => void
46
- }
47
- }
48
- groupMetadata: {
49
- [_: string]: GroupMetadata
50
- }
51
- state: ConnectionState
52
- presences: {
53
- [id: string]: {
54
- [participant: string]: PresenceData
55
- }
56
- }
57
- labels: ObjectRepository<Label>
58
- labelAssociations: KeyedDB<LabelAssociation, string>
59
- bind: (ev: BaileysEventEmitter) => void
60
- /** loads messages from the store, if not found -- uses the legacy connection */
61
- loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<proto.IWebMessageInfo[]>
62
- /**
63
- * Get all available labels for profile
64
- *
65
- * Keep in mind that the list is formed from predefined tags and tags
66
- * that were "caught" during their editing.
67
- */
68
- getLabels: () => ObjectRepository<Label>
69
- /**
70
- * Get labels for chat
71
- *
72
- * @returns Label IDs
73
- **/
74
- getChatLabels: (chatId: string) => LabelAssociation[]
75
- /**
76
- * Get labels for message
77
- *
78
- * @returns Label IDs
79
- **/
80
- getMessageLabels: (messageId: string) => string[]
81
- loadMessage: (jid: string, id: string) => Promise<proto.IWebMessageInfo | undefined>
82
- mostRecentMessage: (jid: string) => Promise<proto.IWebMessageInfo>
83
- fetchImageUrl: (jid: string, suki: WASocket | undefined) => Promise<string | null | undefined>
84
- fetchGroupMetadata: (jid: string, suki: WASocket | undefined) => Promise<GroupMetadata>
85
- fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[] | null | undefined>
86
- toJSON: () => {
87
- chats: KeyedDB<Chat, string>
88
- contacts: {
89
- [_: string]: Contact
90
- }
91
- messages: {
92
- [_: string]: {
93
- array: proto.IWebMessageInfo[]
94
- get: (id: string) => proto.IWebMessageInfo | undefined
95
- upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void
96
- update: (item: proto.IWebMessageInfo) => boolean
97
- remove: (item: proto.IWebMessageInfo) => boolean
98
- updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean
99
- clear: () => void
100
- filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void
101
- toJSON: () => proto.IWebMessageInfo[]
102
- fromJSON: (newItems: proto.IWebMessageInfo[]) => void
103
- }
104
- }
105
- labels: ObjectRepository<Label>
106
- labelAssociations: KeyedDB<LabelAssociation, string>
107
- }
108
- fromJSON: (json: {
109
- chats: Chat[]
110
- contacts: {
111
- [id: string]: Contact
112
- }
113
- messages: {
114
- [id: string]: proto.IWebMessageInfo[]
115
- }
116
- labels: {
117
- [labelId: string]: Label
118
- }
119
- labelAssociations: LabelAssociation[]
120
- }) => void
121
- writeToFile: (path: string) => void
122
- readFromFile: (path: string) => void
123
- }
@@ -1,12 +0,0 @@
1
- export declare function makeOrderedDictionary<T>(idGetter: (item: T) => string): {
2
- array: T[]
3
- get: (id: string) => T | undefined
4
- upsert: (item: T, mode: 'append' | 'prepend') => void
5
- update: (item: T) => boolean
6
- remove: (item: T) => boolean
7
- updateAssign: (id: string, update: Partial<T>) => boolean
8
- clear: () => void
9
- filter: (contain: (item: T) => boolean) => void
10
- toJSON: () => T[]
11
- fromJSON: (newItems: T[]) => void
12
- }
@@ -1,10 +0,0 @@
1
- export declare class ObjectRepository<T extends object> {
2
- readonly entityMap: Map<string, T>
3
- constructor(entities?: Record<string, T>)
4
- findById(id: string): T | undefined
5
- findAll(): T[]
6
- upsertById(id: string, entity: T): Map<string, T>
7
- deleteById(id: string): boolean
8
- count(): number
9
- toJSON(): T[]
10
- }
@@ -1,121 +0,0 @@
1
- import type { proto } from '../../WAProto'
2
- import type { Contact } from './Contact'
3
- import type { MinimalMessage } from './Message'
4
-
5
- export type KeyPair = {
6
- public: Uint8Array
7
- private: Uint8Array
8
- }
9
-
10
- export type SignedKeyPair = {
11
- keyPair: KeyPair
12
- signature: Uint8Array
13
- keyId: number
14
- timestampS?: number
15
- }
16
-
17
- export type ProtocolAddress = {
18
- name: string
19
- deviceId: number
20
- }
21
-
22
- export type SignalIdentity = {
23
- identifier: ProtocolAddress
24
- identifierKey: Uint8Array
25
- }
26
-
27
- export type LTHashState = {
28
- version: number
29
- hash: Buffer
30
- indexValueMap: {
31
- [indexMacBase64: string]: {
32
- valueMac: Uint8Array | Buffer
33
- }
34
- }
35
- }
36
-
37
- export type SignalCreds = {
38
- readonly signedIdentityKey: KeyPair
39
- readonly signedPreKey: SignedKeyPair
40
- readonly registrationId: number
41
- }
42
-
43
- export type AccountSettings = {
44
- /** unarchive chats when a new message is received */
45
- unarchiveChats: boolean
46
- /** the default mode to start new conversations with */
47
- defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>
48
- }
49
-
50
- export type AuthenticationCreds = SignalCreds & {
51
- readonly noiseKey: KeyPair
52
- readonly pairingEphemeralKeyPair: KeyPair
53
- advSecretKey: string
54
- me?: Contact
55
- account?: proto.IADVSignedDeviceIdentity
56
- signalIdentities?: SignalIdentity[]
57
- myAppStateKeyId?: string
58
- firstUnuploadedPreKeyId: number
59
- nextPreKeyId: number
60
- lastAccountSyncTimestamp?: number
61
- platform?: string
62
- processedHistoryMessages: MinimalMessage[]
63
- /** number of times history & app state has been synced */
64
- accountSyncCounter: number
65
- accountSettings: AccountSettings
66
- registered: boolean
67
- pairingCode: string | undefined
68
- lastPropHash: string | undefined
69
- routingInfo: Buffer | undefined
70
- }
71
-
72
- export type SignalDataTypeMap = {
73
- 'pre-key': KeyPair
74
- 'session': Uint8Array
75
- 'sender-key': Uint8Array
76
- 'sender-key-memory': {
77
- [jid: string]: boolean
78
- }
79
- 'app-state-sync-key': proto.Message.IAppStateSyncKeyData
80
- 'app-state-sync-version': LTHashState
81
- 'lid-mapping': string
82
- }
83
-
84
- export type SignalDataSet = {
85
- [T in keyof SignalDataTypeMap]?: {
86
- [id: string]: SignalDataTypeMap[T] | null
87
- }
88
- }
89
-
90
- type Awaitable<T> = T | Promise<T>
91
-
92
- export type SignalKeyStore = {
93
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
94
- [id: string]: SignalDataTypeMap[T]
95
- }>
96
- set(data: SignalDataSet): Awaitable<void>
97
- /** clear all the data in the store */
98
- clear?(): Awaitable<void>
99
- }
100
-
101
- export type SignalKeyStoreWithTransaction = SignalKeyStore & {
102
- isInTransaction: () => boolean
103
- transaction<T>(exec: () => Promise<T>, key: string): Promise<T>
104
- }
105
-
106
- export type TransactionCapabilityOptions = {
107
- maxCommitRetries: number
108
- delayBetweenTriesMs: number
109
- }
110
-
111
- export type SignalAuthState = {
112
- creds: SignalCreds
113
- keys: SignalKeyStore | SignalKeyStoreWithTransaction
114
- }
115
-
116
- export type AuthenticationState = {
117
- creds: AuthenticationCreds
118
- keys: SignalKeyStore
119
- }
120
-
121
- export {}
@@ -1,28 +0,0 @@
1
- import type { proto } from '../../WAProto'
2
-
3
- export type DayOfWeekBussines = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
4
-
5
- export type HoursDay = {
6
- day: DayOfWeekBussines
7
- mode: 'specific_hours'
8
- openTimeInMinutes: string
9
- closeTimeInMinutes: string
10
- } | {
11
- day: DayOfWeekBussines;
12
- mode: 'open_24h' | 'appointment_only'
13
- }
14
-
15
- export type UpdateBussinesProfileProps = {
16
- address?: string;
17
- websites?: string[]
18
- email?: string;
19
- description?: string
20
- hours?: {
21
- timezone: string
22
- days: HoursDay[]
23
- }
24
- }
25
-
26
- export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & {
27
- timestamp?: string
28
- }
@@ -1,14 +0,0 @@
1
- export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate'
2
-
3
- export type WACallEvent = {
4
- chatId: string
5
- from: string
6
- isGroup?: boolean
7
- groupJid?: string
8
- id: string
9
- date: Date
10
- isVideo?: boolean
11
- status: WACallUpdateType
12
- offline: boolean
13
- latencyMs?: number
14
- }