violetics 7.0.0-alpha → 7.0.2-alpha
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.
- package/LICENSE +3 -2
- package/README.md +1001 -232
- package/WAProto/index.js +75379 -142631
- package/engine-requirements.js +11 -8
- package/lib/Defaults/index.js +132 -144
- package/lib/Signal/Group/ciphertext-message.js +2 -6
- package/lib/Signal/Group/group-session-builder.js +7 -42
- package/lib/Signal/Group/group_cipher.js +37 -52
- package/lib/Signal/Group/index.js +11 -57
- package/lib/Signal/Group/keyhelper.js +7 -45
- package/lib/Signal/Group/sender-chain-key.js +7 -16
- package/lib/Signal/Group/sender-key-distribution-message.js +8 -12
- package/lib/Signal/Group/sender-key-message.js +9 -13
- package/lib/Signal/Group/sender-key-name.js +2 -6
- package/lib/Signal/Group/sender-key-record.js +9 -22
- package/lib/Signal/Group/sender-key-state.js +27 -43
- package/lib/Signal/Group/sender-message-key.js +4 -8
- package/lib/Signal/libsignal.js +319 -94
- package/lib/Signal/lid-mapping.js +224 -139
- package/lib/Socket/Client/index.js +2 -19
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.js +53 -0
- package/lib/Socket/business.js +162 -44
- package/lib/Socket/chats.js +477 -442
- package/lib/Socket/communities.js +430 -0
- package/lib/Socket/groups.js +110 -99
- package/lib/Socket/index.js +10 -10
- package/lib/Socket/messages-recv.js +878 -552
- package/lib/Socket/messages-send.js +859 -428
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.js +195 -390
- package/lib/Socket/socket.js +463 -289
- package/lib/Store/index.js +3 -10
- package/lib/Store/make-in-memory-store.js +73 -79
- package/lib/Store/make-ordered-dictionary.js +4 -7
- package/lib/Store/object-repository.js +2 -6
- package/lib/Types/Auth.js +1 -2
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.js +1 -2
- package/lib/Types/Chat.js +7 -4
- package/lib/Types/Contact.js +1 -2
- package/lib/Types/Events.js +1 -2
- package/lib/Types/GroupMetadata.js +1 -2
- package/lib/Types/Label.js +2 -5
- package/lib/Types/LabelAssociation.js +2 -5
- package/lib/Types/Message.js +17 -9
- package/lib/Types/Newsletter.js +33 -38
- package/lib/Types/Product.js +1 -2
- package/lib/Types/Signal.js +1 -2
- package/lib/Types/Socket.js +2 -2
- package/lib/Types/State.js +12 -2
- package/lib/Types/USync.js +1 -2
- package/lib/Types/index.js +14 -31
- package/lib/Utils/auth-utils.js +228 -145
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.js +66 -70
- package/lib/Utils/chat-utils.js +331 -249
- package/lib/Utils/crypto.js +57 -91
- package/lib/Utils/decode-wa-message.js +168 -84
- package/lib/Utils/event-buffer.js +138 -80
- package/lib/Utils/generics.js +180 -297
- package/lib/Utils/history.js +83 -49
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.js +19 -33
- package/lib/Utils/link-preview.js +14 -23
- package/lib/Utils/logger.js +2 -7
- package/lib/Utils/lt-hash.js +2 -46
- package/lib/Utils/make-mutex.js +24 -35
- package/lib/Utils/message-retry-manager.js +224 -0
- package/lib/Utils/messages-media.js +501 -496
- package/lib/Utils/messages.js +1428 -362
- package/lib/Utils/noise-handler.js +145 -100
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.js +356 -150
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/signal.js +78 -73
- package/lib/Utils/sync-action-utils.js +47 -0
- package/lib/Utils/tc-token-utils.js +17 -0
- package/lib/Utils/use-multi-file-auth-state.js +32 -34
- package/lib/Utils/validate-connection.js +91 -107
- package/lib/WABinary/constants.js +1300 -1304
- package/lib/WABinary/decode.js +26 -48
- package/lib/WABinary/encode.js +109 -155
- package/lib/WABinary/generic-utils.js +161 -149
- package/lib/WABinary/index.js +5 -21
- package/lib/WABinary/jid-utils.js +73 -40
- package/lib/WABinary/types.js +1 -2
- package/lib/WAM/BinaryInfo.js +2 -6
- package/lib/WAM/constants.js +19070 -11568
- package/lib/WAM/encode.js +17 -23
- package/lib/WAM/index.js +3 -19
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +8 -12
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -15
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -13
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -14
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -23
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -9
- package/lib/WAUSync/Protocols/index.js +4 -20
- package/lib/WAUSync/USyncQuery.js +40 -36
- package/lib/WAUSync/USyncUser.js +2 -6
- package/lib/WAUSync/index.js +3 -19
- package/lib/index.js +11 -44
- package/package.json +75 -108
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/Group/queue-job.js +0 -57
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.js +0 -111
- package/lib/Socket/groupStatus.js +0 -637
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/usync.js +0 -70
- package/lib/Store/make-cache-manager-store.js +0 -83
- package/lib/Utils/baileys-event-stream.js +0 -63
package/lib/Store/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeCacheManagerAuthState = exports.makeInMemoryStore = void 0;
|
|
7
|
-
const make_cache_manager_store_1 = __importDefault(require("./make-cache-manager-store"));
|
|
8
|
-
exports.makeCacheManagerAuthState = make_cache_manager_store_1.default;
|
|
9
|
-
const make_in_memory_store_1 = __importDefault(require("./make-in-memory-store"));
|
|
10
|
-
exports.makeInMemoryStore = make_in_memory_store_1.default;
|
|
1
|
+
export * from './make-in-memory-store.js';
|
|
2
|
+
export * from './make-ordered-dictionary.js';
|
|
3
|
+
export * from './object-repository.js';
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Lia@Note 03-02-26
|
|
3
|
+
* --- [WIP]
|
|
4
|
+
* Manually converted to ESM and modified by me
|
|
5
|
+
* Originally based on @whiskeysockets/baileys v6.7.16
|
|
6
|
+
* Minor adjustments for compatibility with baileys v7 (つ≧▽≦)つ
|
|
7
|
+
*/
|
|
8
|
+
import keyedDB from '@adiwajshing/keyed-db';
|
|
9
|
+
import { writeFileSync, readFileSync, existsSync } from 'fs';
|
|
10
|
+
import { WAProto } from '../Types/index.js';
|
|
11
|
+
import { LabelAssociationType } from '../Types/LabelAssociation.js';
|
|
12
|
+
import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
|
|
13
|
+
import { md5, toNumber, updateMessageWithReceipt, updateMessageWithReaction } from '../Utils/index.js';
|
|
14
|
+
import { jidDecode, jidNormalizedUser } from '../WABinary/index.js';
|
|
15
|
+
import { makeOrderedDictionary } from './make-ordered-dictionary.js';
|
|
16
|
+
import { ObjectRepository } from './object-repository.js';
|
|
17
|
+
export const waChatKey = (pin) => ({
|
|
15
18
|
key: (c) => (pin ? (c.pinned ? '1' : '0') : '') + (c.archived ? '0' : '1') + (c.conversationTimestamp ? c.conversationTimestamp.toString(16).padStart(8, '0') : '') + c.id,
|
|
16
19
|
compare: (k1, k2) => k2.localeCompare(k1)
|
|
17
20
|
});
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
exports.waLabelAssociationKey = {
|
|
22
|
-
key: (la) => (la.type === LabelAssociation_1.LabelAssociationType.Chat ? la.chatId + la.labelId : la.chatId + la.messageId + la.labelId),
|
|
21
|
+
export const waMessageID = (m) => m.key.id || '';
|
|
22
|
+
export const waLabelAssociationKey = {
|
|
23
|
+
key: (la) => (la.type === LabelAssociationType.Chat ? la.chatId + la.labelId : la.chatId + la.messageId + la.labelId),
|
|
23
24
|
compare: (k1, k2) => k2.localeCompare(k1)
|
|
24
25
|
};
|
|
25
|
-
const makeMessagesDictionary = () => (
|
|
26
|
-
|
|
26
|
+
const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID);
|
|
27
|
+
export const makeInMemoryStore = (config = {}) => {
|
|
27
28
|
const socket = config.socket;
|
|
28
|
-
const chatKey = config.chatKey ||
|
|
29
|
-
const labelAssociationKey = config.labelAssociationKey ||
|
|
30
|
-
const logger = config.logger ||
|
|
31
|
-
const KeyedDB =
|
|
29
|
+
const chatKey = config.chatKey || waChatKey(true);
|
|
30
|
+
const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey;
|
|
31
|
+
const logger = config.logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
|
|
32
|
+
const KeyedDB = keyedDB?.default ?? keyedDB; // Lia@Note 03-02-26 --- Handle CJS ↔ ESM default export differences ⊂(・ω・*⊂)
|
|
32
33
|
const chats = new KeyedDB(chatKey, c => c.id);
|
|
33
34
|
const messages = {};
|
|
34
35
|
const contacts = {};
|
|
35
36
|
const groupMetadata = {};
|
|
36
37
|
const presences = {};
|
|
37
38
|
const state = { connection: 'close' };
|
|
38
|
-
const labels = new
|
|
39
|
+
const labels = new ObjectRepository();
|
|
39
40
|
const labelAssociations = new KeyedDB(labelAssociationKey, labelAssociationKey.key);
|
|
40
41
|
const assertMessageList = (jid) => {
|
|
41
42
|
if (!messages[jid]) {
|
|
@@ -56,14 +57,6 @@ exports.default = (config) => {
|
|
|
56
57
|
labels.upsertById(label.id, label);
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
|
-
const getValidContacts = () => {
|
|
60
|
-
for (const contact of Object.keys(contacts)) {
|
|
61
|
-
if (contact.indexOf('@') < 0) {
|
|
62
|
-
delete contacts[contact];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return Object.keys(contacts);
|
|
66
|
-
};
|
|
67
60
|
/**
|
|
68
61
|
* binds to a BaileysEventEmitter.
|
|
69
62
|
* It listens to all events and constructs a state that you can query accurate data from.
|
|
@@ -74,7 +67,11 @@ exports.default = (config) => {
|
|
|
74
67
|
ev.on('connection.update', update => {
|
|
75
68
|
Object.assign(state, update);
|
|
76
69
|
});
|
|
77
|
-
ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest }) => {
|
|
70
|
+
ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest, syncType }) => {
|
|
71
|
+
if (syncType === WAProto.HistorySync.HistorySyncType.ON_DEMAND) {
|
|
72
|
+
return; // FOR NOW,
|
|
73
|
+
//TODO: HANDLE
|
|
74
|
+
}
|
|
78
75
|
if (isLatest) {
|
|
79
76
|
chats.clear();
|
|
80
77
|
for (const id in messages) {
|
|
@@ -91,7 +88,7 @@ exports.default = (config) => {
|
|
|
91
88
|
}
|
|
92
89
|
logger.debug({ deletedContacts: isLatest ? oldContacts.size : 0, newContacts }, 'synced contacts');
|
|
93
90
|
for (const msg of newMessages) {
|
|
94
|
-
const jid = msg.key.remoteJid;
|
|
91
|
+
const jid = msg.key.remoteJidAlt || msg.key.remoteJid;
|
|
95
92
|
const list = assertMessageList(jid);
|
|
96
93
|
list.upsert(msg, 'prepend');
|
|
97
94
|
}
|
|
@@ -108,11 +105,10 @@ exports.default = (config) => {
|
|
|
108
105
|
contact = contacts[update.id];
|
|
109
106
|
}
|
|
110
107
|
else {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
108
|
+
const contactHashes = await Promise.all(Object.keys(contacts).map(async (contactId) => {
|
|
109
|
+
const { user } = jidDecode(contactId);
|
|
110
|
+
return [contactId, (await md5(Buffer.from(user + 'WA_ADD_NOTIF', 'utf8'))).toString('base64').slice(0, 3)];
|
|
111
|
+
}));
|
|
116
112
|
contact = contacts[((_a = contactHashes.find(([, b]) => b === update.id)) === null || _a === void 0 ? void 0 : _a[0]) || '']; // find contact by attrs.hash, when user is not saved as a contact
|
|
117
113
|
}
|
|
118
114
|
if (contact) {
|
|
@@ -122,11 +118,11 @@ exports.default = (config) => {
|
|
|
122
118
|
else if (update.imgUrl === 'removed') {
|
|
123
119
|
delete contact.imgUrl;
|
|
124
120
|
}
|
|
125
|
-
Object.assign(contacts[contact.id], contact);
|
|
126
121
|
}
|
|
127
122
|
else {
|
|
128
|
-
logger.debug({ update }, 'got update for non-existant contact');
|
|
123
|
+
return logger.debug({ update }, 'got update for non-existant contact');
|
|
129
124
|
}
|
|
125
|
+
Object.assign(contacts[contact.id], contact);
|
|
130
126
|
}
|
|
131
127
|
});
|
|
132
128
|
ev.on('chats.upsert', newChats => {
|
|
@@ -184,19 +180,17 @@ exports.default = (config) => {
|
|
|
184
180
|
case 'append':
|
|
185
181
|
case 'notify':
|
|
186
182
|
for (const msg of newMessages) {
|
|
187
|
-
const jid =
|
|
183
|
+
const jid = jidNormalizedUser(msg.key.remoteJidAlt || msg.key.remoteJid);
|
|
188
184
|
const list = assertMessageList(jid);
|
|
189
185
|
list.upsert(msg, 'append');
|
|
190
|
-
if (type === 'notify') {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
]);
|
|
199
|
-
}
|
|
186
|
+
if (type === 'notify' && !chats.get(jid)) {
|
|
187
|
+
ev.emit('chats.upsert', [
|
|
188
|
+
{
|
|
189
|
+
id: jid,
|
|
190
|
+
conversationTimestamp: toNumber(msg.messageTimestamp),
|
|
191
|
+
unreadCount: 1
|
|
192
|
+
}
|
|
193
|
+
]);
|
|
200
194
|
}
|
|
201
195
|
}
|
|
202
196
|
break;
|
|
@@ -205,7 +199,7 @@ exports.default = (config) => {
|
|
|
205
199
|
ev.on('messages.update', updates => {
|
|
206
200
|
var _a;
|
|
207
201
|
for (const { update, key } of updates) {
|
|
208
|
-
const list = assertMessageList(
|
|
202
|
+
const list = assertMessageList(jidNormalizedUser(key.remoteJid));
|
|
209
203
|
if (update === null || update === void 0 ? void 0 : update.status) {
|
|
210
204
|
const listStatus = (_a = list.get(key.id)) === null || _a === void 0 ? void 0 : _a.status;
|
|
211
205
|
if (listStatus && (update === null || update === void 0 ? void 0 : update.status) <= listStatus) {
|
|
@@ -226,7 +220,7 @@ exports.default = (config) => {
|
|
|
226
220
|
list === null || list === void 0 ? void 0 : list.clear();
|
|
227
221
|
}
|
|
228
222
|
else {
|
|
229
|
-
const jid = item.keys[0].remoteJid;
|
|
223
|
+
const jid = item.keys[0].remoteJidAlt || item.keys[0].remoteJid;
|
|
230
224
|
const list = messages[jid];
|
|
231
225
|
if (list) {
|
|
232
226
|
const idSet = new Set(item.keys.map(k => k.id));
|
|
@@ -250,37 +244,50 @@ exports.default = (config) => {
|
|
|
250
244
|
if (metadata) {
|
|
251
245
|
switch (action) {
|
|
252
246
|
case 'add':
|
|
253
|
-
metadata.participants.push(...participants.map(
|
|
247
|
+
metadata.participants.push(...participants.map(participant => ({ id: participant.id, phoneNumber: participant.phoneNumber, admin: participant.admin })));
|
|
254
248
|
break;
|
|
255
249
|
case 'demote':
|
|
256
250
|
case 'promote':
|
|
257
251
|
for (const participant of metadata.participants) {
|
|
258
|
-
|
|
259
|
-
participant.
|
|
252
|
+
for (const participantData of participants) {
|
|
253
|
+
if (participantData.id === participant.id || participantData.phoneNumber === participant.phoneNumber) {
|
|
254
|
+
participant.admin = action === 'promote' && 'admin';
|
|
255
|
+
}
|
|
260
256
|
}
|
|
261
257
|
}
|
|
262
258
|
break;
|
|
263
259
|
case 'remove':
|
|
264
|
-
|
|
260
|
+
const removeSet = new Set();
|
|
261
|
+
for (const p of participants) {
|
|
262
|
+
if (p.id)
|
|
263
|
+
removeSet.add(p.id);
|
|
264
|
+
if (p.phoneNumber)
|
|
265
|
+
removeSet.add(p.phoneNumber);
|
|
266
|
+
}
|
|
267
|
+
metadata.participants = metadata.participants.reduce((acc, p) => {
|
|
268
|
+
if (!removeSet.has(p.id) && !removeSet.has(p.phoneNumber))
|
|
269
|
+
acc.push(p);
|
|
270
|
+
return acc;
|
|
271
|
+
}, []);
|
|
265
272
|
break;
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
});
|
|
269
276
|
ev.on('message-receipt.update', updates => {
|
|
270
277
|
for (const { key, receipt } of updates) {
|
|
271
|
-
const obj = messages[key.remoteJid];
|
|
278
|
+
const obj = messages[key.remoteJidAlt || key.remoteJid];
|
|
272
279
|
const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
|
|
273
280
|
if (msg) {
|
|
274
|
-
|
|
281
|
+
updateMessageWithReceipt(msg, receipt);
|
|
275
282
|
}
|
|
276
283
|
}
|
|
277
284
|
});
|
|
278
285
|
ev.on('messages.reaction', (reactions) => {
|
|
279
286
|
for (const { key, reaction } of reactions) {
|
|
280
|
-
const obj = messages[key.remoteJid];
|
|
287
|
+
const obj = messages[key.remoteJidAlt || key.remoteJid];
|
|
281
288
|
const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
|
|
282
289
|
if (msg) {
|
|
283
|
-
|
|
290
|
+
updateMessageWithReaction(msg, reaction);
|
|
284
291
|
}
|
|
285
292
|
}
|
|
286
293
|
});
|
|
@@ -300,7 +307,7 @@ exports.default = (config) => {
|
|
|
300
307
|
for (const jid in json.messages) {
|
|
301
308
|
const list = assertMessageList(jid);
|
|
302
309
|
for (const msg of json.messages[jid]) {
|
|
303
|
-
list.upsert(
|
|
310
|
+
list.upsert(WAProto.WebMessageInfo.fromObject(msg), 'append');
|
|
304
311
|
}
|
|
305
312
|
}
|
|
306
313
|
};
|
|
@@ -392,15 +399,6 @@ exports.default = (config) => {
|
|
|
392
399
|
}
|
|
393
400
|
return groupMetadata[jid];
|
|
394
401
|
},
|
|
395
|
-
// fetchBroadcastListInfo: async(jid: string, sock: WASocket | undefined) => {
|
|
396
|
-
// if(!groupMetadata[jid]) {
|
|
397
|
-
// const metadata = await sock?.getBroadcastListInfo(jid)
|
|
398
|
-
// if(metadata) {
|
|
399
|
-
// groupMetadata[jid] = metadata
|
|
400
|
-
// }
|
|
401
|
-
// }
|
|
402
|
-
// return groupMetadata[jid]
|
|
403
|
-
// },
|
|
404
402
|
fetchMessageReceipts: async ({ remoteJid, id }) => {
|
|
405
403
|
const list = messages[remoteJid];
|
|
406
404
|
const msg = list === null || list === void 0 ? void 0 : list.get(id);
|
|
@@ -409,13 +407,9 @@ exports.default = (config) => {
|
|
|
409
407
|
toJSON,
|
|
410
408
|
fromJSON,
|
|
411
409
|
writeToFile: (path) => {
|
|
412
|
-
// require fs here so that in case "fs" is not available -- the app does not crash
|
|
413
|
-
const { writeFileSync } = require('fs');
|
|
414
410
|
writeFileSync(path, JSON.stringify(toJSON()));
|
|
415
411
|
},
|
|
416
412
|
readFromFile: (path) => {
|
|
417
|
-
// require fs here so that in case "fs" is not available -- the app does not crash
|
|
418
|
-
const { readFileSync, existsSync } = require('fs');
|
|
419
413
|
if (existsSync(path)) {
|
|
420
414
|
logger.debug({ path }, 'reading from file');
|
|
421
415
|
const jsonStr = readFileSync(path, { encoding: 'utf-8' });
|
|
@@ -424,4 +418,4 @@ exports.default = (config) => {
|
|
|
424
418
|
}
|
|
425
419
|
}
|
|
426
420
|
};
|
|
427
|
-
};
|
|
421
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function makeOrderedDictionary(idGetter) {
|
|
1
|
+
export function makeOrderedDictionary(idGetter) {
|
|
4
2
|
const array = [];
|
|
5
3
|
const dict = {};
|
|
6
4
|
const get = (id) => dict[id];
|
|
@@ -56,9 +54,9 @@ function makeOrderedDictionary(idGetter) {
|
|
|
56
54
|
},
|
|
57
55
|
clear: () => {
|
|
58
56
|
array.splice(0, array.length);
|
|
59
|
-
Object.keys(dict)
|
|
57
|
+
for (const key of Object.keys(dict)) {
|
|
60
58
|
delete dict[key];
|
|
61
|
-
}
|
|
59
|
+
}
|
|
62
60
|
},
|
|
63
61
|
filter: (contain) => {
|
|
64
62
|
let i = 0;
|
|
@@ -77,5 +75,4 @@ function makeOrderedDictionary(idGetter) {
|
|
|
77
75
|
array.splice(0, array.length, ...newItems);
|
|
78
76
|
}
|
|
79
77
|
};
|
|
80
|
-
}
|
|
81
|
-
exports.default = makeOrderedDictionary;
|
|
78
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectRepository = void 0;
|
|
4
|
-
class ObjectRepository {
|
|
1
|
+
export class ObjectRepository {
|
|
5
2
|
constructor(entities = {}) {
|
|
6
3
|
this.entityMap = new Map(Object.entries(entities));
|
|
7
4
|
}
|
|
@@ -23,5 +20,4 @@ class ObjectRepository {
|
|
|
23
20
|
toJSON() {
|
|
24
21
|
return this.findAll();
|
|
25
22
|
}
|
|
26
|
-
}
|
|
27
|
-
exports.ObjectRepository = ObjectRepository;
|
|
23
|
+
}
|
package/lib/Types/Auth.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/Types/Call.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/Types/Chat.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const ALL_WA_PATCH_NAMES = [
|
|
2
|
+
'critical_block',
|
|
3
|
+
'critical_unblock_low',
|
|
4
|
+
'regular_high',
|
|
5
|
+
'regular_low',
|
|
6
|
+
'regular'
|
|
7
|
+
];
|
package/lib/Types/Contact.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/Types/Events.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/Types/Label.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LabelColor = void 0;
|
|
4
1
|
/** WhatsApp has 20 predefined colors */
|
|
5
|
-
var LabelColor;
|
|
2
|
+
export var LabelColor;
|
|
6
3
|
(function (LabelColor) {
|
|
7
4
|
LabelColor[LabelColor["Color1"] = 0] = "Color1";
|
|
8
5
|
LabelColor[LabelColor["Color2"] = 1] = "Color2";
|
|
@@ -24,4 +21,4 @@ var LabelColor;
|
|
|
24
21
|
LabelColor[LabelColor["Color18"] = 17] = "Color18";
|
|
25
22
|
LabelColor[LabelColor["Color19"] = 18] = "Color19";
|
|
26
23
|
LabelColor[LabelColor["Color20"] = 19] = "Color20";
|
|
27
|
-
})(LabelColor
|
|
24
|
+
})(LabelColor || (LabelColor = {}));
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LabelAssociationType = void 0;
|
|
4
1
|
/** Association type */
|
|
5
|
-
var LabelAssociationType;
|
|
2
|
+
export var LabelAssociationType;
|
|
6
3
|
(function (LabelAssociationType) {
|
|
7
4
|
LabelAssociationType["Chat"] = "label_jid";
|
|
8
5
|
LabelAssociationType["Message"] = "label_message";
|
|
9
|
-
})(LabelAssociationType
|
|
6
|
+
})(LabelAssociationType || (LabelAssociationType = {}));
|
package/lib/Types/Message.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
// export the WAMessage Prototypes
|
|
3
|
+
export { proto as WAProto };
|
|
4
|
+
// vltcs@changes 03-02-26 --- Add exported message-related enum types from proto.Message
|
|
5
|
+
export const AssociationType = proto.MessageAssociation.AssociationType;
|
|
6
|
+
export const ButtonHeaderType = proto.Message.ButtonsMessage.HeaderType;
|
|
7
|
+
export const ButtonType = proto.Message.ButtonsMessage.Button.Type;
|
|
8
|
+
export const CarouselCardType = proto.Message.InteractiveMessage.CarouselMessage.CarouselCardType;
|
|
9
|
+
export const ListType = proto.Message.ListMessage.ListType;
|
|
10
|
+
export const ProtocolType = proto.Message.ProtocolMessage.Type;
|
|
11
|
+
export const WAMessageStubType = proto.WebMessageInfo.StubType;
|
|
12
|
+
export const WAMessageStatus = proto.WebMessageInfo.Status;
|
|
13
|
+
export var WAMessageAddressingMode;
|
|
14
|
+
(function (WAMessageAddressingMode) {
|
|
15
|
+
WAMessageAddressingMode["PN"] = "pn";
|
|
16
|
+
WAMessageAddressingMode["LID"] = "lid";
|
|
17
|
+
})(WAMessageAddressingMode || (WAMessageAddressingMode = {}));
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
exports.MexOperations = MexOperations
|
|
37
|
-
exports.XWAPaths = XWAPaths
|
|
38
|
-
exports.QueryIds = QueryIds
|
|
1
|
+
export var XWAPaths;
|
|
2
|
+
(function (XWAPaths) {
|
|
3
|
+
XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
|
|
4
|
+
XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
|
|
5
|
+
XWAPaths["xwa2_newsletter_subscribed"] = "xwa2_newsletter_subscribed";
|
|
6
|
+
XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
|
|
7
|
+
XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
|
|
8
|
+
XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
|
|
9
|
+
XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
|
|
10
|
+
XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
|
|
11
|
+
XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
|
|
12
|
+
XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
|
|
13
|
+
XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
|
|
14
|
+
XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
|
|
15
|
+
XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
|
|
16
|
+
})(XWAPaths || (XWAPaths = {}));
|
|
17
|
+
export var QueryIds;
|
|
18
|
+
(function (QueryIds) {
|
|
19
|
+
QueryIds["CREATE"] = "8823471724422422";
|
|
20
|
+
QueryIds["UPDATE_METADATA"] = "24250201037901610";
|
|
21
|
+
QueryIds["METADATA"] = "6563316087068696";
|
|
22
|
+
QueryIds["JOB_MUTATION"] = "7150902998257522";
|
|
23
|
+
QueryIds["SUBSCRIBERS"] = "9783111038412085";
|
|
24
|
+
QueryIds["SUBSCRIBED"] = "6388546374527196";
|
|
25
|
+
QueryIds["FOLLOW"] = "7871414976211147";
|
|
26
|
+
QueryIds["UNFOLLOW"] = "7238632346214362";
|
|
27
|
+
QueryIds["MUTE"] = "29766401636284406";
|
|
28
|
+
QueryIds["UNMUTE"] = "9864994326891137";
|
|
29
|
+
QueryIds["ADMIN_COUNT"] = "7130823597031706";
|
|
30
|
+
QueryIds["CHANGE_OWNER"] = "7341777602580933";
|
|
31
|
+
QueryIds["DEMOTE"] = "6551828931592903";
|
|
32
|
+
QueryIds["DELETE"] = "30062808666639665";
|
|
33
|
+
})(QueryIds || (QueryIds = {}));
|
package/lib/Types/Product.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/Types/Signal.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
package/lib/Types/Socket.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
import {} from './Message.js';
|
package/lib/Types/State.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
export var SyncState;
|
|
3
|
+
(function (SyncState) {
|
|
4
|
+
/** The socket is connecting, but we haven't received pending notifications yet. */
|
|
5
|
+
SyncState[SyncState["Connecting"] = 0] = "Connecting";
|
|
6
|
+
/** Pending notifications received. Buffering events until we decide whether to sync or not. */
|
|
7
|
+
SyncState[SyncState["AwaitingInitialSync"] = 1] = "AwaitingInitialSync";
|
|
8
|
+
/** The initial app state sync (history, etc.) is in progress. Buffering continues. */
|
|
9
|
+
SyncState[SyncState["Syncing"] = 2] = "Syncing";
|
|
10
|
+
/** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
|
|
11
|
+
SyncState[SyncState["Online"] = 3] = "Online";
|
|
12
|
+
})(SyncState || (SyncState = {}));
|
package/lib/Types/USync.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
import { USyncUser } from '../WAUSync/index.js';
|
package/lib/Types/index.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DisconnectReason = void 0;
|
|
18
|
-
__exportStar(require("./Auth"), exports);
|
|
19
|
-
__exportStar(require("./GroupMetadata"), exports);
|
|
20
|
-
__exportStar(require("./Chat"), exports);
|
|
21
|
-
__exportStar(require("./Contact"), exports);
|
|
22
|
-
__exportStar(require("./State"), exports);
|
|
23
|
-
__exportStar(require("./Message"), exports);
|
|
24
|
-
__exportStar(require("./Newsletter"), exports);
|
|
25
|
-
__exportStar(require("./Socket"), exports);
|
|
26
|
-
__exportStar(require("./Events"), exports);
|
|
27
|
-
__exportStar(require("./Product"), exports);
|
|
28
|
-
__exportStar(require("./Call"), exports);
|
|
29
|
-
__exportStar(require("./Signal"), exports);
|
|
30
|
-
var DisconnectReason;
|
|
1
|
+
export * from './Auth.js';
|
|
2
|
+
export * from './GroupMetadata.js';
|
|
3
|
+
export * from './Chat.js';
|
|
4
|
+
export * from './Contact.js';
|
|
5
|
+
export * from './State.js';
|
|
6
|
+
export * from './Message.js';
|
|
7
|
+
export * from './Socket.js';
|
|
8
|
+
export * from './Events.js';
|
|
9
|
+
export * from './Product.js';
|
|
10
|
+
export * from './Call.js';
|
|
11
|
+
export * from './Signal.js';
|
|
12
|
+
export * from './Newsletter.js';
|
|
13
|
+
export var DisconnectReason;
|
|
31
14
|
(function (DisconnectReason) {
|
|
32
15
|
DisconnectReason[DisconnectReason["connectionClosed"] = 428] = "connectionClosed";
|
|
33
16
|
DisconnectReason[DisconnectReason["connectionLost"] = 408] = "connectionLost";
|
|
@@ -39,4 +22,4 @@ var DisconnectReason;
|
|
|
39
22
|
DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
|
|
40
23
|
DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
|
|
41
24
|
DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
|
|
42
|
-
})(DisconnectReason
|
|
25
|
+
})(DisconnectReason || (DisconnectReason = {}));
|