@kenniy/event-contracts
Version:
Shared event schemas and stream definitions for 8Medical microservices architecture
114 lines • 4.5 kB
TypeScript
export declare const NotificationServiceEventTypes: {
readonly EMAIL_REQUESTED: "email.notification.requested";
readonly EMAIL_SENDING: "email.notification.sending";
readonly EMAIL_SENT: "email.notification.sent";
readonly EMAIL_FAILED: "email.notification.failed";
readonly EMAIL_DELIVERED: "email.notification.delivered";
readonly EMAIL_BOUNCED: "email.notification.bounced";
readonly EMAIL_OPENED: "email.notification.opened";
readonly EMAIL_CLICKED: "email.notification.clicked";
readonly SMS_REQUESTED: "sms.notification.requested";
readonly SMS_SENDING: "sms.notification.sending";
readonly SMS_SENT: "sms.notification.sent";
readonly SMS_FAILED: "sms.notification.failed";
readonly SMS_DELIVERED: "sms.notification.delivered";
readonly SMS_BOUNCED: "sms.notification.bounced";
readonly PUSH_REQUESTED: "push.notification.requested";
readonly PUSH_SENT: "push.notification.sent";
readonly PUSH_FAILED: "push.notification.failed";
readonly PUSH_DELIVERED: "push.notification.delivered";
readonly FILE_UPLOADED: "file.uploaded";
readonly FILE_PROCESSED: "file.processed";
readonly FILE_DELETED: "file.deleted";
readonly FILE_ACCESS_GRANTED: "file.access.granted";
readonly FILE_ACCESS_REVOKED: "file.access.revoked";
};
export interface EmailNotificationEvent {
eventId: string;
timestamp: string;
eventType: typeof NotificationServiceEventTypes[keyof typeof NotificationServiceEventTypes];
data: {
emailRequestId: string;
recipientEmail: string;
recipientName?: string;
templateId: string;
subject: string;
status: 'requested' | 'sending' | 'sent' | 'failed' | 'delivered' | 'bounced' | 'opened' | 'clicked';
provider: 'sendgrid' | 'mailtrap' | 'ses' | 'other';
errorCode?: string;
errorMessage?: string;
sentAt?: string;
deliveredAt?: string;
openedAt?: string;
clickedAt?: string;
templateData?: Record<string, any>;
};
metadata: {
correlationId: string;
sourceService: 'file-notification-service';
version: '1.0';
originalRequestSource?: string;
retryCount?: number;
priority: 'low' | 'normal' | 'high' | 'urgent';
};
}
export interface SmsNotificationEvent {
eventId: string;
timestamp: string;
eventType: typeof NotificationServiceEventTypes[keyof typeof NotificationServiceEventTypes];
data: {
smsRequestId: string;
recipientPhone: string;
recipientName?: string;
messageContent: string;
status: 'requested' | 'sending' | 'sent' | 'failed' | 'delivered' | 'bounced';
provider: 'twilio' | 'gupshup' | 'other';
errorCode?: string;
errorMessage?: string;
sentAt?: string;
deliveredAt?: string;
messageLength: number;
segmentCount: number;
cost?: number;
};
metadata: {
correlationId: string;
sourceService: 'file-notification-service';
version: '1.0';
originalRequestSource?: string;
retryCount?: number;
priority: 'low' | 'normal' | 'high' | 'urgent';
};
}
export interface FileEvent {
eventId: string;
timestamp: string;
eventType: typeof NotificationServiceEventTypes.FILE_UPLOADED | typeof NotificationServiceEventTypes.FILE_PROCESSED | typeof NotificationServiceEventTypes.FILE_DELETED;
data: {
fileId: string;
fileName: string;
fileSize: number;
fileType: string;
filePath: string;
uploadedBy: string;
uploadedByEmail?: string;
uploadedAt: string;
processedAt?: string;
processingStatus?: 'pending' | 'processing' | 'completed' | 'failed';
processingResults?: Record<string, any>;
storageProvider: 'digitalocean' | 'cloudinary' | 'aws' | 'local';
storageLocation: string;
isPublic: boolean;
accessPermissions?: string[];
};
metadata: {
correlationId: string;
sourceService: 'file-notification-service';
version: '1.0';
entityType?: string;
entityId?: string;
};
}
export type NotificationServiceEvent = EmailNotificationEvent | SmsNotificationEvent | FileEvent;
export type NotificationServiceEventType = typeof NotificationServiceEventTypes[keyof typeof NotificationServiceEventTypes];
//# sourceMappingURL=notification-service.d.ts.map