- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8 - Actualizaciones de configuracion Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
1.8 KiB
TypeScript
40 lines
1.8 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { NotificationQueue, NotificationLog, Notification, NotificationChannel } from '../entities';
|
|
export interface QueueItem {
|
|
id: string;
|
|
notification_id: string;
|
|
channel: NotificationChannel;
|
|
priority_value: number;
|
|
attempts: number;
|
|
notification: Notification;
|
|
}
|
|
export interface QueueStats {
|
|
queued: number;
|
|
processing: number;
|
|
sent: number;
|
|
failed: number;
|
|
retrying: number;
|
|
}
|
|
export declare class NotificationQueueService {
|
|
private readonly queueRepository;
|
|
private readonly logRepository;
|
|
private readonly notificationRepository;
|
|
private readonly logger;
|
|
constructor(queueRepository: Repository<NotificationQueue>, logRepository: Repository<NotificationLog>, notificationRepository: Repository<Notification>);
|
|
enqueue(notificationId: string, channel: NotificationChannel, priority?: 'low' | 'normal' | 'high' | 'urgent', scheduledFor?: Date): Promise<NotificationQueue>;
|
|
enqueueBatch(notificationId: string, channels: NotificationChannel[], priority?: 'low' | 'normal' | 'high' | 'urgent'): Promise<NotificationQueue[]>;
|
|
getPendingItems(limit?: number, channel?: NotificationChannel): Promise<QueueItem[]>;
|
|
markAsProcessing(queueId: string): Promise<void>;
|
|
markAsSent(queueId: string, provider?: string, providerMessageId?: string, providerResponse?: Record<string, any>): Promise<void>;
|
|
markAsFailed(queueId: string, errorMessage: string, provider?: string): Promise<void>;
|
|
getStats(): Promise<QueueStats>;
|
|
getStatsByChannel(): Promise<Array<{
|
|
channel: string;
|
|
status: string;
|
|
count: number;
|
|
}>>;
|
|
cleanupOldItems(daysToKeep?: number): Promise<number>;
|
|
cancelPending(notificationId: string): Promise<number>;
|
|
private getPriorityValue;
|
|
}
|