@arcaelas/whatsapp 1.2.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/Chat.d.ts +317 -0
- package/build/cjs/Chat.js +273 -0
- package/build/cjs/Chat.js.map +1 -0
- package/build/{Contact.d.ts → cjs/Contact.d.ts} +317 -304
- package/build/cjs/Contact.js +144 -0
- package/build/cjs/Contact.js.map +1 -0
- package/build/cjs/Message.d.ts +882 -0
- package/build/cjs/Message.js +483 -0
- package/build/cjs/Message.js.map +1 -0
- package/build/{WhatsApp.d.ts → cjs/WhatsApp.d.ts} +16 -4
- package/build/{WhatsApp.js → cjs/WhatsApp.js} +84 -81
- package/build/cjs/WhatsApp.js.map +1 -0
- package/build/{index.d.ts → cjs/index.d.ts} +2 -2
- package/build/cjs/index.js +17 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/package.json +1 -0
- package/build/cjs/store/driver/FileEngine.d.ts +34 -0
- package/build/{store → cjs/store}/driver/FileEngine.js +16 -20
- package/build/cjs/store/driver/FileEngine.js.map +1 -0
- package/build/{store → cjs/store}/driver/RedisEngine.d.ts +14 -5
- package/build/{store → cjs/store}/driver/RedisEngine.js +23 -22
- package/build/cjs/store/driver/RedisEngine.js.map +1 -0
- package/build/{store → cjs/store}/engine.d.ts +9 -10
- package/build/cjs/store/engine.js.map +1 -0
- package/build/cjs/store/index.d.ts +8 -0
- package/build/{store → cjs/store}/index.js +2 -2
- package/build/cjs/store/index.js.map +1 -0
- package/build/esm/Chat.d.ts +317 -0
- package/build/esm/Chat.js +268 -0
- package/build/esm/Chat.js.map +1 -0
- package/build/esm/Contact.d.ts +869 -0
- package/build/esm/Contact.js +139 -0
- package/build/esm/Contact.js.map +1 -0
- package/build/esm/Message.d.ts +882 -0
- package/build/esm/Message.js +478 -0
- package/build/esm/Message.js.map +1 -0
- package/build/esm/WhatsApp.d.ts +80 -0
- package/build/esm/WhatsApp.js +362 -0
- package/build/esm/WhatsApp.js.map +1 -0
- package/build/esm/index.d.ts +13 -0
- package/build/esm/index.js +10 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/package.json +1 -0
- package/build/esm/store/driver/FileEngine.d.ts +34 -0
- package/build/esm/store/driver/FileEngine.js +82 -0
- package/build/esm/store/driver/FileEngine.js.map +1 -0
- package/build/esm/store/driver/RedisEngine.d.ts +47 -0
- package/build/esm/store/driver/RedisEngine.js +66 -0
- package/build/esm/store/driver/RedisEngine.js.map +1 -0
- package/build/esm/store/engine.d.ts +53 -0
- package/build/esm/store/engine.js +6 -0
- package/build/{store → esm/store}/engine.js.map +1 -1
- package/build/esm/store/index.d.ts +8 -0
- package/build/esm/store/index.js +7 -0
- package/build/esm/store/index.js.map +1 -0
- package/package.json +70 -58
- package/API.md +0 -776
- package/CHANGELOG.md +0 -53
- package/DOC.md +0 -532
- package/build/Chat.d.ts +0 -335
- package/build/Chat.js +0 -396
- package/build/Chat.js.map +0 -1
- package/build/Contact.js +0 -188
- package/build/Contact.js.map +0 -1
- package/build/Message.d.ts +0 -580
- package/build/Message.js +0 -463
- package/build/Message.js.map +0 -1
- package/build/WhatsApp.js.map +0 -1
- package/build/index.js +0 -2
- package/build/index.js.map +0 -7
- package/build/store/driver/FileEngine.d.ts +0 -23
- package/build/store/driver/FileEngine.js.map +0 -1
- package/build/store/driver/RedisEngine.js.map +0 -1
- package/build/store/index.d.ts +0 -8
- package/build/store/index.js.map +0 -1
- package/context7.json +0 -4
- package/tsconfig.json +0 -27
- /package/build/{store → cjs/store}/engine.js +0 -0
|
@@ -52,6 +52,7 @@ const store_1 = require("./store");
|
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
54
|
* Clase principal para gestionar la conexión con WhatsApp.
|
|
55
|
+
* Main class for managing the WhatsApp connection.
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
57
58
|
* const { event, pair, Contact, Chat, Message } = new WhatsApp({ phone: '5491112345678' });
|
|
@@ -63,9 +64,9 @@ class WhatsApp {
|
|
|
63
64
|
this._socket = null;
|
|
64
65
|
/**
|
|
65
66
|
* @description Conecta a WhatsApp.
|
|
67
|
+
* Connects to WhatsApp.
|
|
66
68
|
* - Con phone: callback recibe código de 8 dígitos (una vez)
|
|
67
69
|
* - Sin phone: callback recibe QR como Buffer PNG (periódicamente)
|
|
68
|
-
* @param callback Función que recibe el código o QR.
|
|
69
70
|
*/
|
|
70
71
|
this.pair = async (callback) => {
|
|
71
72
|
const { version } = await (0, baileys_1.fetchLatestBaileysVersion)();
|
|
@@ -85,7 +86,7 @@ class WhatsApp {
|
|
|
85
86
|
if (stored) {
|
|
86
87
|
let value = JSON.parse(stored, baileys_1.BufferJSON.reviver);
|
|
87
88
|
if (type === 'app-state-sync-key')
|
|
88
|
-
value = baileys_1.proto.Message.AppStateSyncKeyData.
|
|
89
|
+
value = baileys_1.proto.Message.AppStateSyncKeyData.create(value);
|
|
89
90
|
data[id] = value;
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -150,9 +151,10 @@ class WhatsApp {
|
|
|
150
151
|
imgUrl: c.imgUrl ?? null,
|
|
151
152
|
status: c.status ?? null,
|
|
152
153
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
await this.engine.set(`contact/${c.id}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
155
|
+
if (raw.lid)
|
|
156
|
+
await this.engine.set(`lid/${raw.lid}`, raw.id);
|
|
157
|
+
this.event.emit(existing ? 'contact:updated' : 'contact:created', new this.Contact(raw));
|
|
156
158
|
}
|
|
157
159
|
});
|
|
158
160
|
socket.ev.on('contacts.update', async (contacts) => {
|
|
@@ -162,18 +164,27 @@ class WhatsApp {
|
|
|
162
164
|
const stored = await this.engine.get(`contact/${c.id}/index`);
|
|
163
165
|
if (!stored)
|
|
164
166
|
continue;
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
const raw = JSON.parse(stored, baileys_1.BufferJSON.reviver);
|
|
168
|
+
if (c.notify)
|
|
169
|
+
raw.notify = c.notify;
|
|
170
|
+
if (c.name)
|
|
171
|
+
raw.name = c.name;
|
|
172
|
+
if (c.imgUrl)
|
|
173
|
+
raw.imgUrl = c.imgUrl;
|
|
174
|
+
if (c.status)
|
|
175
|
+
raw.status = c.status;
|
|
176
|
+
if (c.lid)
|
|
177
|
+
raw.lid = c.lid;
|
|
178
|
+
await this.engine.set(`contact/${c.id}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
179
|
+
if (raw.lid)
|
|
180
|
+
await this.engine.set(`lid/${raw.lid}`, raw.id);
|
|
181
|
+
this.event.emit('contact:updated', new this.Contact(raw));
|
|
175
182
|
}
|
|
176
183
|
});
|
|
184
|
+
socket.ev.on('lid-mapping.update', async ({ lid, pn }) => {
|
|
185
|
+
await this.engine.set(`lid/${lid}`, pn);
|
|
186
|
+
await this.engine.set(`lid/${pn}`, lid);
|
|
187
|
+
});
|
|
177
188
|
// ═══════════════════════════════════════════════════════════════════
|
|
178
189
|
// CHATS
|
|
179
190
|
// ═══════════════════════════════════════════════════════════════════
|
|
@@ -181,7 +192,7 @@ class WhatsApp {
|
|
|
181
192
|
for (const ch of chats) {
|
|
182
193
|
const existing = await this.engine.get(`chat/${ch.id}/index`);
|
|
183
194
|
const raw = existing
|
|
184
|
-
? JSON.parse(existing, baileys_1.BufferJSON.reviver)
|
|
195
|
+
? JSON.parse(existing, baileys_1.BufferJSON.reviver)
|
|
185
196
|
: {
|
|
186
197
|
id: ch.id,
|
|
187
198
|
name: ch.name ?? null,
|
|
@@ -193,9 +204,8 @@ class WhatsApp {
|
|
|
193
204
|
};
|
|
194
205
|
if (ch.name)
|
|
195
206
|
raw.name = ch.name;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.event.emit(existing ? 'chat:updated' : 'chat:created', new this.Chat(data));
|
|
207
|
+
await this.engine.set(`chat/${ch.id}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
208
|
+
this.event.emit(existing ? 'chat:updated' : 'chat:created', new this.Chat(raw));
|
|
199
209
|
}
|
|
200
210
|
});
|
|
201
211
|
socket.ev.on('chats.update', async (chats) => {
|
|
@@ -203,47 +213,35 @@ class WhatsApp {
|
|
|
203
213
|
if (!ch.id)
|
|
204
214
|
continue;
|
|
205
215
|
const stored = await this.engine.get(`chat/${ch.id}/index`);
|
|
206
|
-
const
|
|
207
|
-
if (ch.name !== undefined) {
|
|
208
|
-
data.raw.name = ch.name ?? data.raw.name;
|
|
209
|
-
data.name = data.raw.name ?? data.raw.displayName ?? ch.id.split('@')[0];
|
|
210
|
-
}
|
|
216
|
+
const raw = stored ? JSON.parse(stored, baileys_1.BufferJSON.reviver) : { id: ch.id, name: ch.name ?? null };
|
|
211
217
|
let has_specific_event = false;
|
|
212
|
-
|
|
218
|
+
if (ch.name !== undefined)
|
|
219
|
+
raw.name = ch.name ?? raw.name;
|
|
213
220
|
if ('pinned' in ch) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this.event.emit('chat:pined', ch.id, data.raw.pinned);
|
|
221
|
+
raw.pinned = ch.pinned ?? null;
|
|
222
|
+
this.event.emit('chat:pined', ch.id, raw.pinned);
|
|
217
223
|
has_specific_event = true;
|
|
218
224
|
}
|
|
219
|
-
// Archive
|
|
220
225
|
if (ch.archived !== undefined) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.event.emit('chat:archived', ch.id, data.archived);
|
|
226
|
+
raw.archived = ch.archived ?? false;
|
|
227
|
+
this.event.emit('chat:archived', ch.id, raw.archived);
|
|
224
228
|
has_specific_event = true;
|
|
225
229
|
}
|
|
226
|
-
// Mute
|
|
227
230
|
if ('muteEndTime' in ch) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
this.event.emit('chat:muted', ch.id, data.raw.muteEndTime);
|
|
231
|
+
raw.muteEndTime = ch.muteEndTime ? Number(ch.muteEndTime) : null;
|
|
232
|
+
this.event.emit('chat:muted', ch.id, raw.muteEndTime);
|
|
231
233
|
has_specific_event = true;
|
|
232
234
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
await this.engine.set(`chat/${ch.id}/index`, JSON.stringify(data, baileys_1.BufferJSON.replacer));
|
|
239
|
-
if (!has_specific_event) {
|
|
240
|
-
this.event.emit(stored ? 'chat:updated' : 'chat:created', new this.Chat(data));
|
|
241
|
-
}
|
|
235
|
+
if (ch.unreadCount !== undefined)
|
|
236
|
+
raw.unreadCount = ch.unreadCount;
|
|
237
|
+
await this.engine.set(`chat/${ch.id}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
238
|
+
if (!has_specific_event)
|
|
239
|
+
this.event.emit(stored ? 'chat:updated' : 'chat:created', new this.Chat(raw));
|
|
242
240
|
}
|
|
243
241
|
});
|
|
244
242
|
socket.ev.on('chats.delete', async (ids) => {
|
|
245
243
|
for (const cid of ids) {
|
|
246
|
-
await this.
|
|
244
|
+
await this.engine.set(`chat/${cid}`, null);
|
|
247
245
|
this.event.emit('chat:deleted', cid);
|
|
248
246
|
}
|
|
249
247
|
});
|
|
@@ -252,29 +250,24 @@ class WhatsApp {
|
|
|
252
250
|
// ═══════════════════════════════════════════════════════════════════
|
|
253
251
|
socket.ev.on('messages.upsert', async ({ messages }) => {
|
|
254
252
|
for (const msg of messages) {
|
|
255
|
-
if (!msg.key
|
|
253
|
+
if (!msg.key?.remoteJid || !msg.key.id)
|
|
256
254
|
continue;
|
|
257
255
|
const cid = msg.key.remoteJid;
|
|
258
256
|
const mid = msg.key.id;
|
|
259
257
|
const content_type = (0, baileys_1.getContentType)(msg.message ?? {});
|
|
260
|
-
// Ignorar reacciones y votos de encuesta (tienen sus propios eventos)
|
|
261
258
|
if (content_type === 'reactionMessage' || content_type === 'pollUpdateMessage')
|
|
262
259
|
continue;
|
|
263
|
-
//
|
|
264
|
-
// PROTOCOL MESSAGE (ediciones y eliminaciones)
|
|
265
|
-
// ─────────────────────────────────────────────────────────────
|
|
260
|
+
// ─── PROTOCOL MESSAGE (ediciones y eliminaciones) ───
|
|
266
261
|
if (content_type === 'protocolMessage') {
|
|
267
262
|
const protocol = msg.message?.protocolMessage;
|
|
268
263
|
if (!protocol?.key?.id)
|
|
269
264
|
continue;
|
|
270
265
|
const target_mid = protocol.key.id;
|
|
271
266
|
const target_cid = protocol.key.remoteJid ?? cid;
|
|
272
|
-
// MESSAGE_EDIT: Merge selectivo - reemplazar solo message
|
|
273
267
|
if (protocol.type === baileys_1.proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
|
|
274
268
|
const edited_msg = protocol.editedMessage;
|
|
275
269
|
if (!edited_msg)
|
|
276
270
|
continue;
|
|
277
|
-
// Obtener index y raw
|
|
278
271
|
const stored_index = await this.engine.get(`chat/${target_cid}/message/${target_mid}/index`);
|
|
279
272
|
const stored_raw = await this.engine.get(`chat/${target_cid}/message/${target_mid}/raw`);
|
|
280
273
|
if (!stored_index || !stored_raw)
|
|
@@ -283,34 +276,25 @@ class WhatsApp {
|
|
|
283
276
|
const raw = JSON.parse(stored_raw, baileys_1.BufferJSON.reviver);
|
|
284
277
|
raw.message = edited_msg;
|
|
285
278
|
index.edited = true;
|
|
286
|
-
index.caption =
|
|
279
|
+
index.caption = this.Message._build_index(raw).caption;
|
|
287
280
|
await this.engine.set(`chat/${target_cid}/message/${target_mid}/index`, JSON.stringify(index, baileys_1.BufferJSON.replacer));
|
|
288
281
|
await this.engine.set(`chat/${target_cid}/message/${target_mid}/raw`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
289
282
|
const instance = new this.Message({ index, raw });
|
|
290
|
-
this.Message.
|
|
283
|
+
this.Message._notify(target_cid, target_mid);
|
|
291
284
|
this.event.emit('message:updated', instance);
|
|
292
285
|
continue;
|
|
293
286
|
}
|
|
294
|
-
// REVOKE: Eliminar del engine
|
|
295
287
|
if (protocol.type === baileys_1.proto.Message.ProtocolMessage.Type.REVOKE) {
|
|
296
|
-
|
|
297
|
-
await this.
|
|
298
|
-
// Eliminar archivos
|
|
299
|
-
await this.engine.set(`chat/${target_cid}/message/${target_mid}/index`, null);
|
|
300
|
-
await this.engine.set(`chat/${target_cid}/message/${target_mid}/content`, null);
|
|
301
|
-
await this.engine.set(`chat/${target_cid}/message/${target_mid}/raw`, null);
|
|
288
|
+
await this.Message._remove_from_index(target_cid, target_mid);
|
|
289
|
+
await this.engine.set(`chat/${target_cid}/message/${target_mid}`, null);
|
|
302
290
|
this.event.emit('message:deleted', target_cid, target_mid);
|
|
303
291
|
}
|
|
304
292
|
continue;
|
|
305
293
|
}
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
// ─────────────────────────────────────────────────────────────
|
|
309
|
-
// Construir index desde raw y guardar
|
|
310
|
-
const index = (0, Message_1.build_message_index)(msg);
|
|
294
|
+
// ─── MENSAJE NUEVO ───
|
|
295
|
+
const index = this.Message._build_index(msg);
|
|
311
296
|
await this.engine.set(`chat/${cid}/message/${mid}/index`, JSON.stringify(index, baileys_1.BufferJSON.replacer));
|
|
312
297
|
await this.engine.set(`chat/${cid}/message/${mid}/raw`, JSON.stringify(msg, baileys_1.BufferJSON.replacer));
|
|
313
|
-
// Extraer content inline según tipo
|
|
314
298
|
let content = Buffer.alloc(0);
|
|
315
299
|
if (index.type === 'text') {
|
|
316
300
|
const raw_content = msg.message?.[content_type];
|
|
@@ -330,16 +314,15 @@ class WhatsApp {
|
|
|
330
314
|
if (Buffer.isBuffer(buffer))
|
|
331
315
|
content = buffer;
|
|
332
316
|
}
|
|
333
|
-
catch { }
|
|
317
|
+
catch { /* media download may fail */ }
|
|
334
318
|
}
|
|
335
|
-
if (content.length)
|
|
319
|
+
if (content.length)
|
|
336
320
|
await this.engine.set(`chat/${cid}/message/${mid}/content`, content.toString('base64'));
|
|
337
|
-
|
|
338
|
-
// Agregar al índice del chat y emitir
|
|
339
|
-
await this.Chat.add_message(cid, mid, index.created_at);
|
|
321
|
+
await this.Message._add_to_index(cid, mid, index.created_at);
|
|
340
322
|
const instance = new this.Message({ index, raw: msg });
|
|
341
|
-
content.length
|
|
342
|
-
|
|
323
|
+
if (content.length)
|
|
324
|
+
instance.content = async () => content;
|
|
325
|
+
this.Message._notify(cid, mid);
|
|
343
326
|
this.event.emit('message:created', instance);
|
|
344
327
|
}
|
|
345
328
|
});
|
|
@@ -347,25 +330,23 @@ class WhatsApp {
|
|
|
347
330
|
for (const { key, update } of updates) {
|
|
348
331
|
if (!key.remoteJid || !key.id)
|
|
349
332
|
continue;
|
|
350
|
-
const stored_index = await this.engine.get(`chat/${key.remoteJid}/message/${key.id}/index`);
|
|
351
333
|
const stored_raw = await this.engine.get(`chat/${key.remoteJid}/message/${key.id}/raw`);
|
|
334
|
+
const stored_index = await this.engine.get(`chat/${key.remoteJid}/message/${key.id}/index`);
|
|
352
335
|
if (!stored_index)
|
|
353
336
|
continue;
|
|
354
337
|
const index = JSON.parse(stored_index, baileys_1.BufferJSON.reviver);
|
|
355
338
|
const raw = stored_raw ? JSON.parse(stored_raw, baileys_1.BufferJSON.reviver) : { key };
|
|
356
|
-
// Edición via messages.update
|
|
357
339
|
if (update.message?.editedMessage?.message) {
|
|
358
340
|
raw.message = update.message.editedMessage.message;
|
|
359
341
|
index.edited = true;
|
|
360
|
-
index.caption =
|
|
342
|
+
index.caption = this.Message._build_index(raw).caption;
|
|
361
343
|
await this.engine.set(`chat/${key.remoteJid}/message/${key.id}/index`, JSON.stringify(index, baileys_1.BufferJSON.replacer));
|
|
362
344
|
await this.engine.set(`chat/${key.remoteJid}/message/${key.id}/raw`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
363
345
|
const instance = new this.Message({ index, raw });
|
|
364
|
-
this.Message.
|
|
346
|
+
this.Message._notify(key.remoteJid, key.id);
|
|
365
347
|
this.event.emit('message:updated', instance);
|
|
366
348
|
continue;
|
|
367
349
|
}
|
|
368
|
-
// Status update
|
|
369
350
|
if (update.status !== undefined) {
|
|
370
351
|
raw.status = update.status;
|
|
371
352
|
index.status = raw.status;
|
|
@@ -390,10 +371,32 @@ class WhatsApp {
|
|
|
390
371
|
this.Chat = (0, Chat_1.chat)(this);
|
|
391
372
|
this.Message = (0, Message_1.message)(this);
|
|
392
373
|
}
|
|
393
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* @description Retorna el socket de Baileys (null si no está conectado).
|
|
376
|
+
* Returns the Baileys socket (null if disconnected).
|
|
377
|
+
*/
|
|
394
378
|
get socket() {
|
|
395
379
|
return this._socket;
|
|
396
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* @description Normaliza cualquier identificador (JID, LID, phone) a JID.
|
|
383
|
+
* Normalizes any identifier (JID, LID, phone) to JID format.
|
|
384
|
+
* @param uid Identificador: JID, LID (@lid), o numero de telefono.
|
|
385
|
+
*/
|
|
386
|
+
async resolveJID(uid) {
|
|
387
|
+
if (uid.endsWith('@g.us'))
|
|
388
|
+
return uid;
|
|
389
|
+
if (uid.endsWith('@s.whatsapp.net'))
|
|
390
|
+
return uid;
|
|
391
|
+
if (uid.endsWith('@lid')) {
|
|
392
|
+
const resolved = await this.engine.get(`lid/${uid}`);
|
|
393
|
+
if (!resolved)
|
|
394
|
+
return null;
|
|
395
|
+
return resolved.includes('@') ? resolved : `${resolved}@s.whatsapp.net`;
|
|
396
|
+
}
|
|
397
|
+
const cleaned = uid.replace(/\D/g, '');
|
|
398
|
+
return cleaned ? `${cleaned}@s.whatsapp.net` : null;
|
|
399
|
+
}
|
|
397
400
|
}
|
|
398
401
|
exports.WhatsApp = WhatsApp;
|
|
399
402
|
//# sourceMappingURL=WhatsApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../../src/WhatsApp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;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C,KAAK,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,CAAC;CAuTJ;AAjWD,4BAiWC"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
export { MESSAGE_STATUS } from './Message';
|
|
6
6
|
export type { LocationOptions, MessageType, PollOptions } from './Message';
|
|
7
7
|
export type { Engine } from './store';
|
|
8
|
-
export type {
|
|
9
|
-
export type {
|
|
8
|
+
export type { IChatRaw, IGroupParticipant } from './Chat';
|
|
9
|
+
export type { IContactRaw } from './Contact';
|
|
10
10
|
export type { IMessage, IMessageIndex } from './Message';
|
|
11
11
|
export type { IWhatsApp } from './WhatsApp';
|
|
12
12
|
export { FileEngine, RedisEngine } from './store';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @description Punto de entrada público de la librería @arcaelas/whatsapp
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WhatsApp = exports.RedisEngine = exports.FileEngine = exports.MESSAGE_STATUS = void 0;
|
|
8
|
+
// Enums
|
|
9
|
+
var Message_1 = require("./Message");
|
|
10
|
+
Object.defineProperty(exports, "MESSAGE_STATUS", { enumerable: true, get: function () { return Message_1.MESSAGE_STATUS; } });
|
|
11
|
+
// Classes
|
|
12
|
+
var store_1 = require("./store");
|
|
13
|
+
Object.defineProperty(exports, "FileEngine", { enumerable: true, get: function () { return store_1.FileEngine; } });
|
|
14
|
+
Object.defineProperty(exports, "RedisEngine", { enumerable: true, get: function () { return store_1.RedisEngine; } });
|
|
15
|
+
var WhatsApp_1 = require("./WhatsApp");
|
|
16
|
+
Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,QAAQ;AACR,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AAYvB,UAAU;AACV,iCAAkD;AAAzC,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file store/driver/FileEngine.ts
|
|
3
|
+
* @description Engine de persistencia en sistema de archivos local
|
|
4
|
+
*/
|
|
5
|
+
import type { Engine } from '../../store/engine';
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* Engine de persistencia en sistema de archivos.
|
|
9
|
+
* Almacena texto plano (JSON stringified).
|
|
10
|
+
*
|
|
11
|
+
* Filesystem persistence engine.
|
|
12
|
+
* Stores plain text (JSON stringified).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const engine = new FileEngine('.baileys/5491112345678');
|
|
16
|
+
* await engine.set('contact/123', '{"name":"John"}');
|
|
17
|
+
* const data = await engine.get('contact/123');
|
|
18
|
+
*/
|
|
19
|
+
export declare class FileEngine implements Engine {
|
|
20
|
+
private readonly _base;
|
|
21
|
+
constructor(_base?: string);
|
|
22
|
+
/** @description Obtiene un valor por su key. / Retrieves a value by its key. */
|
|
23
|
+
get(key: string): Promise<string | null>;
|
|
24
|
+
/**
|
|
25
|
+
* @description Guarda o elimina un valor. Si value es null, elimina la key como archivo y como directorio recursivamente.
|
|
26
|
+
* Saves or deletes a value. If value is null, removes the key as file and as directory recursively.
|
|
27
|
+
*/
|
|
28
|
+
set(key: string, value: string | null): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* @description Lista keys bajo un prefijo, ordenados por más reciente.
|
|
31
|
+
* Lists keys under a prefix, ordered by most recent.
|
|
32
|
+
*/
|
|
33
|
+
list(prefix: string, offset?: number, limit?: number): Promise<string[]>;
|
|
34
|
+
}
|
|
@@ -12,6 +12,9 @@ const node_path_1 = require("node:path");
|
|
|
12
12
|
* Engine de persistencia en sistema de archivos.
|
|
13
13
|
* Almacena texto plano (JSON stringified).
|
|
14
14
|
*
|
|
15
|
+
* Filesystem persistence engine.
|
|
16
|
+
* Stores plain text (JSON stringified).
|
|
17
|
+
*
|
|
15
18
|
* @example
|
|
16
19
|
* const engine = new FileEngine('.baileys/5491112345678');
|
|
17
20
|
* await engine.set('contact/123', '{"name":"John"}');
|
|
@@ -21,6 +24,7 @@ class FileEngine {
|
|
|
21
24
|
constructor(_base = '.baileys/default') {
|
|
22
25
|
this._base = _base;
|
|
23
26
|
}
|
|
27
|
+
/** @description Obtiene un valor por su key. / Retrieves a value by its key. */
|
|
24
28
|
async get(key) {
|
|
25
29
|
try {
|
|
26
30
|
return await (0, promises_1.readFile)((0, node_path_1.join)(this._base, key.replace(/@/g, '_at_')), 'utf-8');
|
|
@@ -29,6 +33,10 @@ class FileEngine {
|
|
|
29
33
|
return null;
|
|
30
34
|
}
|
|
31
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Guarda o elimina un valor. Si value es null, elimina la key como archivo y como directorio recursivamente.
|
|
38
|
+
* Saves or deletes a value. If value is null, removes the key as file and as directory recursively.
|
|
39
|
+
*/
|
|
32
40
|
async set(key, value) {
|
|
33
41
|
const path = (0, node_path_1.join)(this._base, key.replace(/@/g, '_at_'));
|
|
34
42
|
if (value) {
|
|
@@ -37,33 +45,32 @@ class FileEngine {
|
|
|
37
45
|
}
|
|
38
46
|
else {
|
|
39
47
|
try {
|
|
40
|
-
await (0, promises_1.rm)(path, { force: true });
|
|
48
|
+
await (0, promises_1.rm)(path, { recursive: true, force: true });
|
|
41
49
|
}
|
|
42
|
-
catch { }
|
|
50
|
+
catch { /* already deleted */ }
|
|
43
51
|
}
|
|
44
52
|
}
|
|
45
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @description Lista keys bajo un prefijo, ordenados por más reciente.
|
|
55
|
+
* Lists keys under a prefix, ordered by most recent.
|
|
56
|
+
*/
|
|
57
|
+
async list(prefix, offset = 0, limit = 50) {
|
|
46
58
|
const base = (0, node_path_1.join)(this._base, prefix.replace(/@/g, '_at_'));
|
|
47
|
-
const suffix_escaped = suffix?.replace(/@/g, '_at_');
|
|
48
59
|
try {
|
|
49
60
|
const items = [];
|
|
50
61
|
const entries = await (0, promises_1.readdir)(base, { withFileTypes: true, recursive: true });
|
|
51
62
|
for (const file of entries) {
|
|
52
63
|
if (!file.isFile())
|
|
53
64
|
continue;
|
|
54
|
-
// Compatibilidad Node < 20: parentPath puede no existir
|
|
55
65
|
const parent = file.parentPath || file.path || base;
|
|
56
66
|
const path = (0, node_path_1.join)(parent, file.name);
|
|
57
|
-
// Filtrar por sufijo ANTES de stat() para mejor performance
|
|
58
|
-
if (suffix_escaped && !path.endsWith(suffix_escaped))
|
|
59
|
-
continue;
|
|
60
67
|
try {
|
|
61
68
|
items.push({
|
|
62
69
|
key: path.slice(this._base.length + 1).replace(/_at_/g, '@'),
|
|
63
70
|
mtime: (await (0, promises_1.stat)(path)).mtimeMs,
|
|
64
71
|
});
|
|
65
72
|
}
|
|
66
|
-
catch { }
|
|
73
|
+
catch { /* stat may fail for transient files */ }
|
|
67
74
|
}
|
|
68
75
|
return items
|
|
69
76
|
.sort((a, b) => b.mtime - a.mtime)
|
|
@@ -74,17 +81,6 @@ class FileEngine {
|
|
|
74
81
|
return [];
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
|
-
async delete_prefix(prefix) {
|
|
78
|
-
const base = (0, node_path_1.join)(this._base, prefix.replace(/@/g, '_at_'));
|
|
79
|
-
try {
|
|
80
|
-
await (0, promises_1.rm)(base, { recursive: true, force: true });
|
|
81
|
-
// Contar archivos eliminados no es posible con rm -rf, estimamos
|
|
82
|
-
return 1;
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
84
|
}
|
|
89
85
|
exports.FileEngine = FileEngine;
|
|
90
86
|
//# sourceMappingURL=FileEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileEngine.js","sourceRoot":"","sources":["../../../../src/store/driver/FileEngine.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAiF;AACjF,yCAA0C;AAG1C;;;;;;;;;;;;GAYG;AACH,MAAa,UAAU;IACnB,YAA6B,QAAgB,kBAAkB;QAAlC,UAAK,GAAL,KAAK,CAA6B;IAAG,CAAC;IAEnE,gFAAgF;IAChF,KAAK,CAAC,GAAG,CAAC,GAAW;QACjB,IAAI,CAAC;YACD,OAAO,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAChF,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAoB;QACvC,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACzD,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,IAAA,gBAAK,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC;gBACD,MAAM,IAAA,aAAE,EAAC,IAAI,EAAE,EAAE,SAA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AC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;iBACjC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;iBAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;CACJ;AAxDD,gCAwDC"}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* @file store/driver/RedisEngine.ts
|
|
3
3
|
* @description Engine de persistencia con Redis
|
|
4
4
|
*/
|
|
5
|
-
import type { Engine } from '
|
|
5
|
+
import type { Engine } from '../../store/engine';
|
|
6
6
|
/**
|
|
7
7
|
* @description Interface mínima del cliente Redis (compatible con ioredis y redis).
|
|
8
|
+
* Minimal Redis client interface (compatible with ioredis and redis).
|
|
8
9
|
*/
|
|
9
10
|
export interface RedisClient {
|
|
10
11
|
get(key: string): Promise<string | null>;
|
|
11
12
|
set(key: string, value: string): Promise<unknown>;
|
|
12
|
-
del(key: string): Promise<unknown>;
|
|
13
|
+
del(key: string | string[]): Promise<unknown>;
|
|
13
14
|
scan(cursor: number | string, ...args: unknown[]): Promise<[string, string[]]>;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
@@ -17,6 +18,9 @@ export interface RedisClient {
|
|
|
17
18
|
* Engine de persistencia con Redis.
|
|
18
19
|
* Recibe una conexión existente de ioredis o redis.
|
|
19
20
|
*
|
|
21
|
+
* Redis persistence engine.
|
|
22
|
+
* Receives an existing ioredis or redis connection.
|
|
23
|
+
*
|
|
20
24
|
* @example
|
|
21
25
|
* import Redis from 'ioredis';
|
|
22
26
|
* const client = new Redis();
|
|
@@ -27,12 +31,17 @@ export declare class RedisEngine implements Engine {
|
|
|
27
31
|
private readonly _client;
|
|
28
32
|
private readonly _prefix;
|
|
29
33
|
constructor(_client: RedisClient, _prefix?: string);
|
|
34
|
+
/** @description Obtiene un valor por su key. / Retrieves a value by its key. */
|
|
30
35
|
get(key: string): Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* @description Guarda o elimina un valor. Si value es null, elimina la key y todas las sub-keys con ese prefijo.
|
|
38
|
+
* Saves or deletes a value. If value is null, deletes the key and all sub-keys matching the prefix.
|
|
39
|
+
*/
|
|
31
40
|
set(key: string, value: string | null): Promise<void>;
|
|
32
41
|
/**
|
|
33
42
|
* @description Lista keys bajo un prefijo.
|
|
34
|
-
*
|
|
43
|
+
* Lists keys under a prefix.
|
|
44
|
+
* @note Redis SCAN no garantiza orden. / Redis SCAN does not guarantee order.
|
|
35
45
|
*/
|
|
36
|
-
list(prefix: string, offset?: number, limit?: number
|
|
37
|
-
delete_prefix(prefix: string): Promise<number>;
|
|
46
|
+
list(prefix: string, offset?: number, limit?: number): Promise<string[]>;
|
|
38
47
|
}
|