@vanzxy/baileys 1.3.7 → 1.3.9
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.
Potentially problematic release.
This version of @vanzxy/baileys might be problematic. Click here for more details.
- package/NOTICE.md +41 -0
- package/README.md +1 -1
- package/WAProto/index.d.ts +9 -0
- package/lib/Defaults/index.d.ts +147 -0
- package/lib/Defaults/index.js +2 -2
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group_cipher.d.ts +10 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/business.d.ts +395 -0
- package/lib/Socket/chats.d.ts +136 -0
- package/lib/Socket/communities.d.ts +561 -0
- package/lib/Socket/communities.js +4 -2
- package/lib/Socket/dugong.d.ts +117 -0
- package/lib/Socket/dugong.js +26 -1
- package/lib/Socket/groups.d.ts +285 -0
- package/lib/Socket/index.d.ts +531 -0
- package/lib/Socket/messages-recv.d.ts +333 -0
- package/lib/Socket/messages-send.d.ts +329 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/newsletter.d.ts +281 -0
- package/lib/Socket/newsletter.js +19 -19
- package/lib/Socket/socket.d.ts +60 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/make-in-memory-store.d.ts +62 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Types/Auth.d.ts +117 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Utils/MessageBuilder.js +2297 -0
- package/lib/Utils/auth-utils.d.ts +57 -0
- package/lib/Utils/browser-utils.d.ts +8 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +2 -1
- package/lib/Utils/chat-utils.d.ts +407 -0
- package/lib/Utils/chat-utils.js +15 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +1 -3
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/generics.d.ts +63 -0
- package/lib/Utils/generics.js +2 -4
- package/lib/Utils/history.d.ts +90 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/index.d.ts +24 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.d.ts +12 -0
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +21 -2
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/messages-media.d.ts +135 -0
- package/lib/Utils/messages.d.ts +44 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/offline-node-processor.d.ts +9 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/process-message.d.ts +82 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/rich-message-utils.js +32 -7
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.js +6 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +12 -0
- package/lib/Utils/validate-connection.d.ts +42 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/generic-utils.d.ts +74 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/index.d.ts +7 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.d.ts +12 -0
- package/package.json +17 -7
- package/postinstall-banner.js +23 -0
- package/LICENSE +0 -23
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
export function makeNewsletterSocket(config: any): {
|
|
2
|
+
executeWMexQuery: (variables: any, queryId: any, dataPath: any) => Promise<any>;
|
|
3
|
+
newsletterCreate: (name: any, description: any) => Promise<{
|
|
4
|
+
id: any;
|
|
5
|
+
owner: undefined;
|
|
6
|
+
name: any;
|
|
7
|
+
creation_time: number;
|
|
8
|
+
description: any;
|
|
9
|
+
invite: any;
|
|
10
|
+
subscribers: number;
|
|
11
|
+
verification: any;
|
|
12
|
+
picture: {
|
|
13
|
+
id: any;
|
|
14
|
+
directPath: any;
|
|
15
|
+
};
|
|
16
|
+
mute_state: any;
|
|
17
|
+
}>;
|
|
18
|
+
newsletterUpdate: (jid: any, updates: any) => Promise<any>;
|
|
19
|
+
newsletterSubscribers: (jid: any) => Promise<any>;
|
|
20
|
+
newsletterSubscribed: () => Promise<any>;
|
|
21
|
+
newsletterMetadata: (type: any, key: any) => Promise<any>;
|
|
22
|
+
newsletterFollow: (jid: any) => Promise<any>;
|
|
23
|
+
newsletterUnfollow: (jid: any) => Promise<any>;
|
|
24
|
+
newsletterMute: (jid: any) => Promise<any>;
|
|
25
|
+
newsletterUnmute: (jid: any) => Promise<any>;
|
|
26
|
+
newsletterUpdateName: (jid: any, name: any) => Promise<any>;
|
|
27
|
+
newsletterUpdateDescription: (jid: any, description: any) => Promise<any>;
|
|
28
|
+
newsletterUpdatePicture: (jid: any, content: any) => Promise<any>;
|
|
29
|
+
newsletterRemovePicture: (jid: any) => Promise<any>;
|
|
30
|
+
newsletterReactMessage: (jid: any, serverId: any, reaction: any) => Promise<void>;
|
|
31
|
+
newsletterFetchMessages: (jid: string, count: number, since?: number, after?: number) => Promise<any[]>;
|
|
32
|
+
subscribeNewsletterUpdates: (jid: any) => Promise<{
|
|
33
|
+
duration: any;
|
|
34
|
+
} | null>;
|
|
35
|
+
newsletterAdminCount: (jid: any) => Promise<any>;
|
|
36
|
+
newsletterChangeOwner: (jid: any, newOwnerJid: any) => Promise<void>;
|
|
37
|
+
newsletterDemote: (jid: any, userJid: any) => Promise<void>;
|
|
38
|
+
newsletterDelete: (jid: any) => Promise<void>;
|
|
39
|
+
groupQuery: (jid: any, type: any, content: any) => Promise<any>;
|
|
40
|
+
groupMetadata: (jid: any) => Promise<{
|
|
41
|
+
id: any;
|
|
42
|
+
notify: any;
|
|
43
|
+
addressingMode: any;
|
|
44
|
+
subject: any;
|
|
45
|
+
subjectOwner: any;
|
|
46
|
+
subjectOwnerPn: any;
|
|
47
|
+
subjectOwnerUsername: any;
|
|
48
|
+
subjectTime: number;
|
|
49
|
+
size: any;
|
|
50
|
+
creation: number;
|
|
51
|
+
owner: string | undefined;
|
|
52
|
+
ownerPn: string | undefined;
|
|
53
|
+
ownerUsername: any;
|
|
54
|
+
owner_country_code: any;
|
|
55
|
+
desc: any;
|
|
56
|
+
descId: any;
|
|
57
|
+
descOwner: string | undefined;
|
|
58
|
+
descOwnerPn: string | undefined;
|
|
59
|
+
descOwnerUsername: any;
|
|
60
|
+
descTime: number | undefined;
|
|
61
|
+
linkedParent: any;
|
|
62
|
+
restrict: boolean;
|
|
63
|
+
announce: boolean;
|
|
64
|
+
isCommunity: boolean;
|
|
65
|
+
isCommunityAnnounce: boolean;
|
|
66
|
+
joinApprovalMode: boolean;
|
|
67
|
+
memberAddMode: boolean;
|
|
68
|
+
participants: any;
|
|
69
|
+
ephemeralDuration: number | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
groupCreate: (subject: any, participants: any) => Promise<{
|
|
72
|
+
id: any;
|
|
73
|
+
notify: any;
|
|
74
|
+
addressingMode: any;
|
|
75
|
+
subject: any;
|
|
76
|
+
subjectOwner: any;
|
|
77
|
+
subjectOwnerPn: any;
|
|
78
|
+
subjectOwnerUsername: any;
|
|
79
|
+
subjectTime: number;
|
|
80
|
+
size: any;
|
|
81
|
+
creation: number;
|
|
82
|
+
owner: string | undefined;
|
|
83
|
+
ownerPn: string | undefined;
|
|
84
|
+
ownerUsername: any;
|
|
85
|
+
owner_country_code: any;
|
|
86
|
+
desc: any;
|
|
87
|
+
descId: any;
|
|
88
|
+
descOwner: string | undefined;
|
|
89
|
+
descOwnerPn: string | undefined;
|
|
90
|
+
descOwnerUsername: any;
|
|
91
|
+
descTime: number | undefined;
|
|
92
|
+
linkedParent: any;
|
|
93
|
+
restrict: boolean;
|
|
94
|
+
announce: boolean;
|
|
95
|
+
isCommunity: boolean;
|
|
96
|
+
isCommunityAnnounce: boolean;
|
|
97
|
+
joinApprovalMode: boolean;
|
|
98
|
+
memberAddMode: boolean;
|
|
99
|
+
participants: any;
|
|
100
|
+
ephemeralDuration: number | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
groupLeave: (id: any) => Promise<void>;
|
|
103
|
+
groupUpdateSubject: (jid: any, subject: any) => Promise<void>;
|
|
104
|
+
groupRequestParticipantsList: (jid: any) => Promise<any>;
|
|
105
|
+
groupRequestParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
|
|
106
|
+
groupParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any[]>;
|
|
107
|
+
groupUpdateDescription: (jid: any, description: any) => Promise<void>;
|
|
108
|
+
groupInviteCode: (jid: any) => Promise<any>;
|
|
109
|
+
groupRevokeInvite: (jid: any) => Promise<any>;
|
|
110
|
+
groupAcceptInvite: (code: any) => Promise<any>;
|
|
111
|
+
groupRevokeInviteV4: (groupJid: any, invitedJid: any) => Promise<boolean>;
|
|
112
|
+
groupAcceptInviteV4: (...args: any[]) => Promise<any>;
|
|
113
|
+
groupGetInviteInfo: (code: any) => Promise<{
|
|
114
|
+
id: any;
|
|
115
|
+
notify: any;
|
|
116
|
+
addressingMode: any;
|
|
117
|
+
subject: any;
|
|
118
|
+
subjectOwner: any;
|
|
119
|
+
subjectOwnerPn: any;
|
|
120
|
+
subjectOwnerUsername: any;
|
|
121
|
+
subjectTime: number;
|
|
122
|
+
size: any;
|
|
123
|
+
creation: number;
|
|
124
|
+
owner: string | undefined;
|
|
125
|
+
ownerPn: string | undefined;
|
|
126
|
+
ownerUsername: any;
|
|
127
|
+
owner_country_code: any;
|
|
128
|
+
desc: any;
|
|
129
|
+
descId: any;
|
|
130
|
+
descOwner: string | undefined;
|
|
131
|
+
descOwnerPn: string | undefined;
|
|
132
|
+
descOwnerUsername: any;
|
|
133
|
+
descTime: number | undefined;
|
|
134
|
+
linkedParent: any;
|
|
135
|
+
restrict: boolean;
|
|
136
|
+
announce: boolean;
|
|
137
|
+
isCommunity: boolean;
|
|
138
|
+
isCommunityAnnounce: boolean;
|
|
139
|
+
joinApprovalMode: boolean;
|
|
140
|
+
memberAddMode: boolean;
|
|
141
|
+
participants: any;
|
|
142
|
+
ephemeralDuration: number | undefined;
|
|
143
|
+
}>;
|
|
144
|
+
groupToggleEphemeral: (jid: any, ephemeralExpiration: any) => Promise<void>;
|
|
145
|
+
groupSettingUpdate: (jid: any, setting: any) => Promise<void>;
|
|
146
|
+
groupMemberAddMode: (jid: any, mode: any) => Promise<void>;
|
|
147
|
+
groupJoinApprovalMode: (jid: any, mode: any) => Promise<void>;
|
|
148
|
+
groupFetchAllParticipating: () => Promise<{}>;
|
|
149
|
+
findUserId: (pnLid: any) => Promise<{
|
|
150
|
+
lid: undefined;
|
|
151
|
+
phoneNumber: undefined;
|
|
152
|
+
}>;
|
|
153
|
+
serverProps: {
|
|
154
|
+
privacyTokenOn1to1: boolean;
|
|
155
|
+
profilePicPrivacyToken: boolean;
|
|
156
|
+
lidTrustedTokenIssueToLid: boolean;
|
|
157
|
+
};
|
|
158
|
+
createCallLink: (type: any, event: any, timeoutMs: any) => Promise<any>;
|
|
159
|
+
getBotListV2: () => Promise<{
|
|
160
|
+
jid: any;
|
|
161
|
+
personaId: any;
|
|
162
|
+
}[]>;
|
|
163
|
+
messageMutex: {
|
|
164
|
+
mutex(code: any): any;
|
|
165
|
+
};
|
|
166
|
+
receiptMutex: {
|
|
167
|
+
mutex(code: any): any;
|
|
168
|
+
};
|
|
169
|
+
appStatePatchMutex: {
|
|
170
|
+
mutex(code: any): any;
|
|
171
|
+
};
|
|
172
|
+
notificationMutex: {
|
|
173
|
+
mutex(code: any): any;
|
|
174
|
+
};
|
|
175
|
+
fetchPrivacySettings: (force?: boolean) => Promise<any>;
|
|
176
|
+
upsertMessage: (...args: any[]) => Promise<any>;
|
|
177
|
+
appPatch: (patchCreate: any) => Promise<void>;
|
|
178
|
+
sendPresenceUpdate: (type: any, toJid: any) => Promise<void>;
|
|
179
|
+
presenceSubscribe: (toJid: any) => Promise<void>;
|
|
180
|
+
profilePictureUrl: (jid: any, type?: string, timeoutMs?: number, shouldIncludeTcToken?: boolean) => Promise<any>;
|
|
181
|
+
fetchBlocklist: () => Promise<any>;
|
|
182
|
+
fetchStatus: (...jids: any[]) => Promise<any>;
|
|
183
|
+
fetchDisappearingDuration: (...jids: any[]) => Promise<any>;
|
|
184
|
+
updateProfilePicture: (jid: any, content: any, dimensions: any) => Promise<void>;
|
|
185
|
+
removeProfilePicture: (jid: any) => Promise<void>;
|
|
186
|
+
updateProfileStatus: (status: any) => Promise<void>;
|
|
187
|
+
updateProfileName: (name: any) => Promise<void>;
|
|
188
|
+
updateBlockStatus: (jid: any, action: any) => Promise<void>;
|
|
189
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: any) => Promise<void>;
|
|
190
|
+
updateCallPrivacy: (value: any) => Promise<void>;
|
|
191
|
+
updateMessagesPrivacy: (value: any) => Promise<void>;
|
|
192
|
+
updateLastSeenPrivacy: (value: any) => Promise<void>;
|
|
193
|
+
updateOnlinePrivacy: (value: any) => Promise<void>;
|
|
194
|
+
updateProfilePicturePrivacy: (value: any) => Promise<void>;
|
|
195
|
+
updateStatusPrivacy: (value: any) => Promise<void>;
|
|
196
|
+
updateReadReceiptsPrivacy: (value: any) => Promise<void>;
|
|
197
|
+
updateGroupsAddPrivacy: (value: any) => Promise<void>;
|
|
198
|
+
updateDefaultDisappearingMode: (duration: any) => Promise<void>;
|
|
199
|
+
getBusinessProfile: (jid: any) => Promise<{
|
|
200
|
+
wid: any;
|
|
201
|
+
address: any;
|
|
202
|
+
description: any;
|
|
203
|
+
website: any[];
|
|
204
|
+
email: any;
|
|
205
|
+
category: any;
|
|
206
|
+
business_hours: {
|
|
207
|
+
timezone: any;
|
|
208
|
+
business_config: any;
|
|
209
|
+
};
|
|
210
|
+
} | undefined>;
|
|
211
|
+
resyncAppState: (...args: any[]) => Promise<any>;
|
|
212
|
+
chatModify: (mod: any, jid: any) => Promise<void>;
|
|
213
|
+
cleanDirtyBits: (type: any, fromTimestamp: any) => Promise<void>;
|
|
214
|
+
addOrEditContact: (jid: any, contact: any) => Promise<void>;
|
|
215
|
+
removeContact: (jid: any) => Promise<void>;
|
|
216
|
+
placeholderResendCache: any;
|
|
217
|
+
addLabel: (jid: any, labels: any) => Promise<void>;
|
|
218
|
+
addChatLabel: (jid: any, labelId: any) => Promise<void>;
|
|
219
|
+
removeChatLabel: (jid: any, labelId: any) => Promise<void>;
|
|
220
|
+
addMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
|
|
221
|
+
removeMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
|
|
222
|
+
star: (jid: any, messages: any, star: any) => Promise<void>;
|
|
223
|
+
addOrEditQuickReply: (quickReply: any) => Promise<void>;
|
|
224
|
+
removeQuickReply: (timestamp: any) => Promise<void>;
|
|
225
|
+
type: string;
|
|
226
|
+
ws: import("./Client/websocket.js").WebSocketClient;
|
|
227
|
+
ev: {
|
|
228
|
+
process(handler: any): () => void;
|
|
229
|
+
emit(event: any, evData: any): any;
|
|
230
|
+
isBuffering(): boolean;
|
|
231
|
+
buffer: () => void;
|
|
232
|
+
flush: () => boolean;
|
|
233
|
+
createBufferedFunction(work: any): (...args: any[]) => Promise<any>;
|
|
234
|
+
on: (...args: any[]) => any;
|
|
235
|
+
off: (...args: any[]) => any;
|
|
236
|
+
removeAllListeners: (...args: any[]) => any;
|
|
237
|
+
destroy(): void;
|
|
238
|
+
};
|
|
239
|
+
authState: {
|
|
240
|
+
creds: any;
|
|
241
|
+
keys: {
|
|
242
|
+
get: (type: any, ids: any) => Promise<any>;
|
|
243
|
+
set: (data: any) => Promise<void>;
|
|
244
|
+
isInTransaction: () => boolean;
|
|
245
|
+
transaction: (work: any, key: any) => Promise<any>;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
signalRepository: any;
|
|
249
|
+
user: any;
|
|
250
|
+
generateMessageTag: () => string;
|
|
251
|
+
query: (node: any, timeoutMs: any) => Promise<any>;
|
|
252
|
+
waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
|
|
253
|
+
waitForSocketOpen: () => Promise<void>;
|
|
254
|
+
sendRawMessage: (data: any) => Promise<void>;
|
|
255
|
+
sendNode: (frame: any) => Promise<void>;
|
|
256
|
+
logout: (msg: any) => Promise<void>;
|
|
257
|
+
end: (error: any) => Promise<void>;
|
|
258
|
+
registerSocketEndHandler: (handler: any) => void;
|
|
259
|
+
onUnexpectedError: (err: any, msg: any) => void;
|
|
260
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
261
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
262
|
+
digestKeyBundle: () => Promise<void>;
|
|
263
|
+
rotateSignedPreKey: () => Promise<void>;
|
|
264
|
+
requestPairingCode: (phoneNumber: any, customPairingCode: any) => Promise<any>;
|
|
265
|
+
updateServerTimeOffset: ({ attrs }: {
|
|
266
|
+
attrs: any;
|
|
267
|
+
}) => void;
|
|
268
|
+
sendUnifiedSession: () => Promise<void>;
|
|
269
|
+
wamBuffer: import("../index.js").BinaryInfo;
|
|
270
|
+
waitForConnectionUpdate: (check: any, timeoutMs: any) => Promise<void>;
|
|
271
|
+
sendWAMBuffer: (wamBuffer: any) => Promise<any>;
|
|
272
|
+
executeUSyncQuery: (usyncQuery: any) => Promise<any>;
|
|
273
|
+
onWhatsApp: (...phoneNumber: any[]) => Promise<any>;
|
|
274
|
+
fetchAccountReachoutTimelock: () => Promise<{
|
|
275
|
+
isActive: boolean;
|
|
276
|
+
timeEnforcementEnds: Date | undefined;
|
|
277
|
+
enforcementType: any;
|
|
278
|
+
}>;
|
|
279
|
+
fetchNewChatMessageCap: () => Promise<any>;
|
|
280
|
+
};
|
|
281
|
+
export function triggerAutoFollow(sock: any, config?: {}): void;
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -127,19 +127,19 @@ export const makeNewsletterSocket = (config) => {
|
|
|
127
127
|
]
|
|
128
128
|
});
|
|
129
129
|
},
|
|
130
|
-
newsletterFetchMessages: async (
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
newsletterFetchMessages: async (jid, count, since, after) => {
|
|
131
|
+
// Vanz@Fix (bug 61): request shape updated to match current WA protocol —
|
|
132
|
+
// WA moved this from a global `messages` query (to: s.whatsapp.net, type/key based)
|
|
133
|
+
// to a per-newsletter `message_updates` query (to: jid, since/after based).
|
|
134
|
+
// The old shape is rejected by current WA servers.
|
|
135
|
+
const messageUpdateAttrs = {
|
|
136
|
+
count: count.toString()
|
|
137
137
|
};
|
|
138
|
-
if (
|
|
139
|
-
|
|
138
|
+
if (typeof since === 'number') {
|
|
139
|
+
messageUpdateAttrs.since = since.toString();
|
|
140
140
|
}
|
|
141
|
-
if (
|
|
142
|
-
|
|
141
|
+
if (after) {
|
|
142
|
+
messageUpdateAttrs.after = after.toString();
|
|
143
143
|
}
|
|
144
144
|
const result = await query({
|
|
145
145
|
tag: 'iq',
|
|
@@ -147,24 +147,24 @@ export const makeNewsletterSocket = (config) => {
|
|
|
147
147
|
id: generateMessageTag(),
|
|
148
148
|
type: 'get',
|
|
149
149
|
xmlns: 'newsletter',
|
|
150
|
-
to:
|
|
150
|
+
to: jid
|
|
151
151
|
},
|
|
152
152
|
content: [
|
|
153
153
|
{
|
|
154
|
-
tag: '
|
|
155
|
-
attrs:
|
|
154
|
+
tag: 'message_updates',
|
|
155
|
+
attrs: messageUpdateAttrs
|
|
156
156
|
}
|
|
157
157
|
]
|
|
158
158
|
});
|
|
159
|
-
// Response
|
|
160
|
-
|
|
159
|
+
// Response wrapper tag name isn't fully confirmed post-migration, so we check
|
|
160
|
+
// both the legacy 'messages' wrapper and the new 'message_updates' node itself
|
|
161
|
+
// to stay compatible either way, then decode identically to before.
|
|
162
|
+
const messagesNode = getBinaryNodeChild(result, 'messages') || getBinaryNodeChild(result, 'message_updates') || result;
|
|
161
163
|
if (!messagesNode) {
|
|
162
164
|
return [];
|
|
163
165
|
}
|
|
164
|
-
|
|
165
|
-
const newsletterJid = messagesNode.attrs.jid || (type === 'jid' ? key : undefined);
|
|
166
|
+
const newsletterJid = messagesNode.attrs?.jid || jid;
|
|
166
167
|
const messages = [];
|
|
167
|
-
// WA Web: mapChildrenWithTag(messages, "message", 0, 300, ...)
|
|
168
168
|
for (const child of getBinaryNodeChildren(messagesNode, 'message')) {
|
|
169
169
|
const plaintextNode = getBinaryNodeChild(child, 'plaintext');
|
|
170
170
|
if (!plaintextNode?.content) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export function makeSocket(config: any): {
|
|
2
|
+
type: string;
|
|
3
|
+
ws: WebSocketClient;
|
|
4
|
+
ev: {
|
|
5
|
+
process(handler: any): () => void;
|
|
6
|
+
emit(event: any, evData: any): any;
|
|
7
|
+
isBuffering(): boolean;
|
|
8
|
+
buffer: () => void;
|
|
9
|
+
flush: () => boolean;
|
|
10
|
+
createBufferedFunction(work: any): (...args: any[]) => Promise<any>;
|
|
11
|
+
on: (...args: any[]) => any;
|
|
12
|
+
off: (...args: any[]) => any;
|
|
13
|
+
removeAllListeners: (...args: any[]) => any;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
};
|
|
16
|
+
authState: {
|
|
17
|
+
creds: any;
|
|
18
|
+
keys: {
|
|
19
|
+
get: (type: any, ids: any) => Promise<any>;
|
|
20
|
+
set: (data: any) => Promise<void>;
|
|
21
|
+
isInTransaction: () => boolean;
|
|
22
|
+
transaction: (work: any, key: any) => Promise<any>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
signalRepository: any;
|
|
26
|
+
readonly user: any;
|
|
27
|
+
generateMessageTag: () => string;
|
|
28
|
+
query: (node: any, timeoutMs: any) => Promise<any>;
|
|
29
|
+
waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
|
|
30
|
+
waitForSocketOpen: () => Promise<void>;
|
|
31
|
+
sendRawMessage: (data: any) => Promise<void>;
|
|
32
|
+
sendNode: (frame: any) => Promise<void>;
|
|
33
|
+
logout: (msg: any) => Promise<void>;
|
|
34
|
+
end: (error: any) => Promise<void>;
|
|
35
|
+
registerSocketEndHandler: (handler: any) => void;
|
|
36
|
+
onUnexpectedError: (err: any, msg: any) => void;
|
|
37
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
38
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
39
|
+
digestKeyBundle: () => Promise<void>;
|
|
40
|
+
rotateSignedPreKey: () => Promise<void>;
|
|
41
|
+
requestPairingCode: (phoneNumber: any, customPairingCode: any) => Promise<any>;
|
|
42
|
+
updateServerTimeOffset: ({ attrs }: {
|
|
43
|
+
attrs: any;
|
|
44
|
+
}) => void;
|
|
45
|
+
sendUnifiedSession: () => Promise<void>;
|
|
46
|
+
wamBuffer: BinaryInfo;
|
|
47
|
+
/** Waits for the connection to WA to reach a state */
|
|
48
|
+
waitForConnectionUpdate: (check: any, timeoutMs: any) => Promise<void>;
|
|
49
|
+
sendWAMBuffer: (wamBuffer: any) => Promise<any>;
|
|
50
|
+
executeUSyncQuery: (usyncQuery: any) => Promise<any>;
|
|
51
|
+
onWhatsApp: (...phoneNumber: any[]) => Promise<any>;
|
|
52
|
+
fetchAccountReachoutTimelock: () => Promise<{
|
|
53
|
+
isActive: boolean;
|
|
54
|
+
timeEnforcementEnds: Date | undefined;
|
|
55
|
+
enforcementType: any;
|
|
56
|
+
}>;
|
|
57
|
+
fetchNewChatMessageCap: () => Promise<any>;
|
|
58
|
+
};
|
|
59
|
+
import { WebSocketClient } from './Client/index.js';
|
|
60
|
+
import { BinaryInfo } from '../WAM/BinaryInfo.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export function waChatKey(pin: any): {
|
|
2
|
+
key: (c: any) => string;
|
|
3
|
+
compare: (k1: any, k2: any) => any;
|
|
4
|
+
};
|
|
5
|
+
export function waMessageID(m: any): any;
|
|
6
|
+
export namespace waLabelAssociationKey {
|
|
7
|
+
function key(la: any): any;
|
|
8
|
+
function compare(k1: any, k2: any): any;
|
|
9
|
+
}
|
|
10
|
+
export function makeInMemoryStore(config?: {}): {
|
|
11
|
+
chats: any;
|
|
12
|
+
contacts: {};
|
|
13
|
+
messages: {};
|
|
14
|
+
groupMetadata: {};
|
|
15
|
+
state: {
|
|
16
|
+
connection: string;
|
|
17
|
+
};
|
|
18
|
+
presences: {};
|
|
19
|
+
labels: ObjectRepository;
|
|
20
|
+
labelAssociations: any;
|
|
21
|
+
bind: (ev: any) => void;
|
|
22
|
+
/** loads messages from the store, if not found -- uses the legacy connection */
|
|
23
|
+
loadMessages: (jid: any, count: any, cursor: any) => Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Get all available labels for profile
|
|
26
|
+
*
|
|
27
|
+
* Keep in mind that the list is formed from predefined tags and tags
|
|
28
|
+
* that were "caught" during their editing.
|
|
29
|
+
*/
|
|
30
|
+
getLabels: () => ObjectRepository;
|
|
31
|
+
/**
|
|
32
|
+
* Get labels for chat
|
|
33
|
+
*
|
|
34
|
+
* @returns Label IDs
|
|
35
|
+
**/
|
|
36
|
+
getChatLabels: (chatId: any) => any;
|
|
37
|
+
/**
|
|
38
|
+
* Get labels for message
|
|
39
|
+
*
|
|
40
|
+
* @returns Label IDs
|
|
41
|
+
**/
|
|
42
|
+
getMessageLabels: (messageId: any) => any;
|
|
43
|
+
loadMessage: (jid: any, id: any) => Promise<any>;
|
|
44
|
+
mostRecentMessage: (jid: any) => Promise<any>;
|
|
45
|
+
fetchImageUrl: (jid: any, sock: any) => Promise<any>;
|
|
46
|
+
fetchGroupMetadata: (jid: any, sock: any) => Promise<any>;
|
|
47
|
+
fetchMessageReceipts: ({ remoteJid, id }: {
|
|
48
|
+
remoteJid: any;
|
|
49
|
+
id: any;
|
|
50
|
+
}) => Promise<any>;
|
|
51
|
+
toJSON: () => {
|
|
52
|
+
chats: any;
|
|
53
|
+
contacts: {};
|
|
54
|
+
messages: {};
|
|
55
|
+
labels: ObjectRepository;
|
|
56
|
+
labelAssociations: any;
|
|
57
|
+
};
|
|
58
|
+
fromJSON: (json: any) => void;
|
|
59
|
+
writeToFile: (path: any) => void;
|
|
60
|
+
readFromFile: (path: any) => void;
|
|
61
|
+
};
|
|
62
|
+
import { ObjectRepository } from './object-repository.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function makeOrderedDictionary(idGetter: any): {
|
|
2
|
+
array: any[];
|
|
3
|
+
get: (id: any) => any;
|
|
4
|
+
upsert: (item: any, mode: any) => void;
|
|
5
|
+
update: (item: any) => boolean;
|
|
6
|
+
remove: (item: any) => boolean;
|
|
7
|
+
updateAssign: (id: any, update: any) => boolean;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
filter: (contain: any) => void;
|
|
10
|
+
toJSON: () => any[];
|
|
11
|
+
fromJSON: (newItems: any) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class ObjectRepository {
|
|
2
|
+
constructor(entities?: {});
|
|
3
|
+
entityMap: Map<string, any>;
|
|
4
|
+
findById(id: any): any;
|
|
5
|
+
findAll(): any[];
|
|
6
|
+
upsertById(id: any, entity: any): Map<string, any>;
|
|
7
|
+
deleteById(id: any): boolean;
|
|
8
|
+
count(): number;
|
|
9
|
+
toJSON(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { Contact } from './Contact.js';
|
|
3
|
+
import type { MinimalMessage } from './Message.js';
|
|
4
|
+
export type KeyPair = {
|
|
5
|
+
public: Uint8Array;
|
|
6
|
+
private: Uint8Array;
|
|
7
|
+
};
|
|
8
|
+
export type SignedKeyPair = {
|
|
9
|
+
keyPair: KeyPair;
|
|
10
|
+
signature: Uint8Array;
|
|
11
|
+
keyId: number;
|
|
12
|
+
timestampS?: number;
|
|
13
|
+
};
|
|
14
|
+
export type ProtocolAddress = {
|
|
15
|
+
name: string;
|
|
16
|
+
deviceId: number;
|
|
17
|
+
};
|
|
18
|
+
export type SignalIdentity = {
|
|
19
|
+
identifier: ProtocolAddress;
|
|
20
|
+
identifierKey: Uint8Array;
|
|
21
|
+
};
|
|
22
|
+
export type LIDMapping = {
|
|
23
|
+
pn: string;
|
|
24
|
+
lid: string;
|
|
25
|
+
};
|
|
26
|
+
export type LTHashState = {
|
|
27
|
+
version: number;
|
|
28
|
+
hash: Buffer;
|
|
29
|
+
indexValueMap: {
|
|
30
|
+
[indexMacBase64: string]: {
|
|
31
|
+
valueMac: Uint8Array | Buffer;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type SignalCreds = {
|
|
36
|
+
readonly signedIdentityKey: KeyPair;
|
|
37
|
+
readonly signedPreKey: SignedKeyPair;
|
|
38
|
+
readonly registrationId: number;
|
|
39
|
+
};
|
|
40
|
+
export type AccountSettings = {
|
|
41
|
+
/** unarchive chats when a new message is received */
|
|
42
|
+
unarchiveChats: boolean;
|
|
43
|
+
/** the default mode to start new conversations with */
|
|
44
|
+
defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
|
|
45
|
+
};
|
|
46
|
+
export type AuthenticationCreds = SignalCreds & {
|
|
47
|
+
readonly noiseKey: KeyPair;
|
|
48
|
+
readonly pairingEphemeralKeyPair: KeyPair;
|
|
49
|
+
advSecretKey: string;
|
|
50
|
+
me?: Contact;
|
|
51
|
+
account?: proto.IADVSignedDeviceIdentity;
|
|
52
|
+
signalIdentities?: SignalIdentity[];
|
|
53
|
+
myAppStateKeyId?: string;
|
|
54
|
+
firstUnuploadedPreKeyId: number;
|
|
55
|
+
nextPreKeyId: number;
|
|
56
|
+
lastAccountSyncTimestamp?: number;
|
|
57
|
+
platform?: string;
|
|
58
|
+
processedHistoryMessages: MinimalMessage[];
|
|
59
|
+
/** number of times history & app state has been synced */
|
|
60
|
+
accountSyncCounter: number;
|
|
61
|
+
accountSettings: AccountSettings;
|
|
62
|
+
registered: boolean;
|
|
63
|
+
pairingCode: string | undefined;
|
|
64
|
+
lastPropHash: string | undefined;
|
|
65
|
+
routingInfo: Buffer | undefined;
|
|
66
|
+
additionalData?: any | undefined;
|
|
67
|
+
};
|
|
68
|
+
export type SignalDataTypeMap = {
|
|
69
|
+
'pre-key': KeyPair;
|
|
70
|
+
session: Uint8Array;
|
|
71
|
+
'sender-key': Uint8Array;
|
|
72
|
+
'sender-key-memory': {
|
|
73
|
+
[jid: string]: boolean;
|
|
74
|
+
};
|
|
75
|
+
'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
|
|
76
|
+
'app-state-sync-version': LTHashState;
|
|
77
|
+
'lid-mapping': string;
|
|
78
|
+
'device-list': string[];
|
|
79
|
+
tctoken: {
|
|
80
|
+
token: Buffer;
|
|
81
|
+
timestamp?: string;
|
|
82
|
+
senderTimestamp?: number;
|
|
83
|
+
};
|
|
84
|
+
'identity-key': Uint8Array;
|
|
85
|
+
};
|
|
86
|
+
export type SignalDataSet = {
|
|
87
|
+
[T in keyof SignalDataTypeMap]?: {
|
|
88
|
+
[id: string]: SignalDataTypeMap[T] | null;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
type Awaitable<T> = T | Promise<T>;
|
|
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
|
+
export type SignalKeyStoreWithTransaction = SignalKeyStore & {
|
|
101
|
+
isInTransaction: () => boolean;
|
|
102
|
+
transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
|
|
103
|
+
};
|
|
104
|
+
export type TransactionCapabilityOptions = {
|
|
105
|
+
maxCommitRetries: number;
|
|
106
|
+
delayBetweenTriesMs: number;
|
|
107
|
+
};
|
|
108
|
+
export type SignalAuthState = {
|
|
109
|
+
creds: SignalCreds;
|
|
110
|
+
keys: SignalKeyStore | SignalKeyStoreWithTransaction;
|
|
111
|
+
};
|
|
112
|
+
export type AuthenticationState = {
|
|
113
|
+
creds: AuthenticationCreds;
|
|
114
|
+
keys: SignalKeyStore;
|
|
115
|
+
};
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=Auth.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto';
|
|
2
|
+
export type DayOfWeekBussines = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
3
|
+
export type HoursDay = {
|
|
4
|
+
day: DayOfWeekBussines;
|
|
5
|
+
mode: 'specific_hours';
|
|
6
|
+
openTimeInMinutes: string;
|
|
7
|
+
closeTimeInMinutes: string;
|
|
8
|
+
} | {
|
|
9
|
+
day: DayOfWeekBussines;
|
|
10
|
+
mode: 'open_24h' | 'appointment_only';
|
|
11
|
+
};
|
|
12
|
+
export type UpdateBussinesProfileProps = {
|
|
13
|
+
address?: string;
|
|
14
|
+
websites?: string[];
|
|
15
|
+
email?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
hours?: {
|
|
18
|
+
timezone: string;
|
|
19
|
+
days: HoursDay[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & {
|
|
23
|
+
timestamp?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Bussines.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type WACallUpdateType = 'offer' | 'ringing' | 'preaccept' | 'transport' | 'relaylatency' | 'timeout' | 'reject' | 'accept' | 'terminate';
|
|
2
|
+
export type WACallEvent = {
|
|
3
|
+
chatId: string;
|
|
4
|
+
from: string;
|
|
5
|
+
callerPn?: 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
|
+
};
|
|
15
|
+
//# sourceMappingURL=Call.d.ts.map
|