whatsapp-crm-common
Version:
Componentes compartidos para servicios de WhatsApp CRM - Common utilities and types for WhatsApp CRM system
72 lines • 3.09 kB
TypeScript
import { WAMessage, WAMessageUpdate, WAMessageKey, proto, MessageUserReceiptUpdate, MessageUserReceipt } from "@whiskeysockets/baileys";
import { Messages } from "../types/messages";
import BaseRepository from "./base-repository";
export declare class MessageRepository extends BaseRepository {
/**
* Guarda múltiples mensajes en la base de datos en una sola operación
* @param messages Lista de mensajes WAMessage a guardar
* @param tenantId ID del tenant
* @param agentId ID del agente
* @returns Los mensajes procesados e insertados
*/
bulkInsertMessages(messages: WAMessage[], tenantId: string, agentId: number): Promise<Messages[]>;
handleMessageUpdate(tenantId: string, agentId: number, messageUpdate: WAMessageUpdate): Promise<void>;
updateMessageInDatabase(messageId: string, chatId: string, updateFields: any, updateData: any): Promise<void>;
/**
* Procesa actualizaciones de mensajes en lote
*/
handleBulkMessageUpdates(tenantId: string, agentId: number, messageUpdates: WAMessageUpdate[]): Promise<void>;
/**
* Ejecuta una actualización masiva de mensajes
*/
performBulkMessageUpdate(client: any, updateData: any[]): Promise<void>;
/**
* Construye los campos de actualización para un mensaje
*/
private buildUpdateFields;
/**
* Determina el tipo de actualización de un mensaje
*/
private determineUpdateType;
/**
* Maneja la eliminación de mensajes
*/
handleMessageDelete(tenantId: string, agentId: number, deleteEvent: {
keys: WAMessageKey[];
} | {
jid: string;
all: true;
}): Promise<void>;
/**
* Maneja eliminaciones específicas de mensajes
*/
handleSpecificMessageDeletes(tenantId: string, agentId: number, client: any, keys: WAMessageKey[]): Promise<void>;
/**
* Maneja eliminaciones de todos los mensajes de un chat
*/
handleChatMessageDeletes(tenantId: string, agentId: number, client: any, jid: string): Promise<void>;
/**
* Inserta historial de eliminaciones
*/
insertDeleteHistory(client: any, deleteData: any[], deleteType: string, tenantId: string, agentId: number): Promise<void>;
/**
* Maneja reacciones a mensajes
*/
handleMessageReactions(tenantId: string, agentId: number, reactions: {
key: WAMessageKey;
reaction: proto.IReaction;
}[]): Promise<void>;
/**
* Maneja una reacción individual a un mensaje
*/
handleSingleReaction(tenantId: string, agentId: number, client: any, key: WAMessageKey, reaction: proto.IReaction): Promise<void>;
/**
* Maneja actualizaciones de recibo de mensajes
*/
handleMessageReceiptUpdates(updates: MessageUserReceiptUpdate[], tenantId: string, agentId: number): Promise<void>;
/**
* Maneja un recibo individual de mensaje
*/
handleSingleReceipt(tenantId: string, agentId: number, client: any, key: WAMessageKey, receipt: MessageUserReceipt): Promise<void>;
}
//# sourceMappingURL=message-repository.d.ts.map