UNPKG

@454creative/easy-email

Version:

A framework-agnostic email service library for Node.js with observability and monitoring

77 lines 2.31 kB
"use strict"; /** * Constants for the easy-email library */ Object.defineProperty(exports, "__esModule", { value: true }); exports.OBSERVABILITY_CONSTANTS = exports.EMAIL_CONSTANTS = void 0; exports.EMAIL_CONSTANTS = { // Validation messages VALIDATION_MESSAGES: { SENDER_REQUIRED: 'Sender email is required', RECIPIENT_REQUIRED: 'Recipient is required', SUBJECT_REQUIRED: 'Subject is required', NO_PROVIDER_CONFIGURED: 'No email provider configured', SMTP_NOT_CONFIGURED: 'SMTP transporter not configured', SES_REGION_REQUIRED: 'SES region is required', SES_CREDENTIALS_REQUIRED: 'SES credentials are required', }, // Error codes ERROR_CODES: { VALIDATION_ERROR: 'VALIDATION_ERROR', CONFIG_ERROR: 'CONFIG_ERROR', PROVIDER_ERROR: 'PROVIDER_ERROR', CONNECTION_FAILED: 'CONNECTION_FAILED', SES_ERROR: 'SES_ERROR', }, // Provider types PROVIDER_TYPES: { SMTP: 'smtp', SENDGRID: 'sendgrid', SES: 'ses', }, // Template constants TEMPLATE: { VARIABLE_REGEX: /{{\s*(\w+)\s*}}/g, DEFAULT_EXTENSION: '.html', }, // Email content types CONTENT_TYPES: { TEXT_PLAIN: 'text/plain', TEXT_HTML: 'text/html', }, // Default values DEFAULTS: { FROM_NAME: '', ATTACHMENT_DISPOSITION: 'attachment', }, // Log messages LOG_MESSAGES: { EMAIL_SENT: 'Email sent successfully', EMAIL_FAILED: 'Failed to send email', CONNECTION_VERIFIED: 'Connection verified successfully', CONNECTION_FAILED: 'Connection verification failed', }, }; exports.OBSERVABILITY_CONSTANTS = { // Event types EVENT_TYPES: { EMAIL_SENT: 'email_sent', EMAIL_FAILED: 'email_failed', CONNECTION_VERIFIED: 'connection_verified', CONNECTION_FAILED: 'connection_failed', }, // Provider names PROVIDER_NAMES: { SMTP: 'smtp', SENDGRID: 'sendgrid', SES: 'ses', }, // Metrics keys METRICS_KEYS: { TOTAL_SENT: 'totalSent', TOTAL_FAILED: 'totalFailed', SUCCESS_RATE: 'successRate', AVERAGE_SEND_TIME: 'averageSendTime', }, }; //# sourceMappingURL=constants.js.map