// ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗ ╔═╗ ╔═╗╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ ╔═══════╗╔═══════╗ // ║ ╔═══╗ ║║ ╔═════╝║ ╔═════╝╚══╗ ╔══╝║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝║ ╔╗ ║║ ║╚══╗ ╔══╝ ║ ║ ║ ║║ ╔═══╗ ║║ ║ ╚══╗ ╔══╝╚╗ ╔══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═══╗ ║║ ╔═══╗ ║ ╚══╗ ╔══╝║ ╔═════╝ // ║ ╚═══╝ ║║ ╚═════╗║ ║ ║ ║ ║ ╚═══╝ ║ ║ ║ ║ ╚═════╗║ ║║ ║║ ║ ║ ║ ╔═══════╗║ ╚╗ ╔╝ ║║ ╚═══╝ ║║ ║ ║ ║ ║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ╔═╗ ╔═╝║ ╔═════╝║ ║ ║ ║ ║ ╔═════╝ ║ ║ ║ ╔═════╝║ ║║ ║║ ║ ║ ║ ╚═══════╝╚╗ ║ ║ ╔╝║ ╔═══╗ ║║ ║ ║ ║ ║ ║ ║ ║║ ╔═══╗ ║ ║ ║ ║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ║ ║ ║ ╚═╗║ ╚═════╗║ ╚═════╗╔══╝ ╚══╗║ ║ ╔══╝ ╚══╗║ ╚═════╗║ ║║ ╚╝ ║ ║ ║ ║ ╚═╝ ║ ║ ║ ║ ║║ ╚═════╗╔══╝ ╚══╗╔╝ ╚══╝ ║║ ║ ║ ║ ║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗╔═╗ ║ ║ ╔═════╝ ║ // ╚═╝ ╚═══╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═══════╝╚═══════╝╚═╝╚════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═╝ ╚═╝ ╚═══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═══════╝ // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as messageErrors from '../../errors/message-errors.js'; import * as emailEngine from '../../../email-engine/email-engine.js'; // ╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔═══╗ ║ // ║ ║ ║ ║ ║ ║ // ║ ║ ║ ║ ║ ║ // ║ ║ ║ ╚═══╝ ║ // ╚═╝ ╚═══════╝ export function validateToRecipients(values: any) { if (!areValidToRecipients(values)) { messageErrors.throwInvalidMessageToRecipientError(); } } export function validateToRecipient(value: any) { if (!isValidToRecipient(value)) { messageErrors.throwInvalidMessageToRecipientError(); } } export function areValidToRecipients(values: any): values is string[] { return emailEngine.areValidEmailAddresses(values); } export function isValidToRecipient(value: any): value is string { return emailEngine.isValidEmailAddress(value); } // ╔═══════╗╔═══════╗ // ║ ╔═════╝║ ╔═════╝ // ║ ║ ║ ║ // ║ ║ ║ ║ // ║ ╚═════╗║ ╚═════╗ // ╚═══════╝╚═══════╝ export function validateCcRecipients(values: any) { if (!areValidCcRecipients(values)) { messageErrors.throwInvalidMessageCcRecipientError(); } } export function validateCcRecipient(value: any) { if (!isValidCcRecipient(value)) { messageErrors.throwInvalidMessageCcRecipientError(); } } export function areValidCcRecipients(values: any): values is string[] { return emailEngine.areValidEmailAddresses(values, 0); } export function isValidCcRecipient(value: any): value is string { return emailEngine.isValidEmailAddress(value); } // ╔══════╗ ╔═══════╗╔═══════╗ // ║ ╔══╗ ║ ║ ╔═════╝║ ╔═════╝ // ║ ╚══╝ ╚╗║ ║ ║ ║ // ║ ╔═══╗ ║║ ║ ║ ║ // ║ ╚═══╝ ║║ ╚═════╗║ ╚═════╗ // ╚═══════╝╚═══════╝╚═══════╝ export function validateBccRecipients(values: any) { if (!areValidBccRecipients(values)) { messageErrors.throwInvalidMessageBccRecipientError(); } } export function validateBccRecipient(value: any) { if (!isValidBccRecipient(value)) { messageErrors.throwInvalidMessageBccRecipientError(); } } export function areValidBccRecipients(values: any): values is string[] { return emailEngine.areValidEmailAddresses(values, 0); } export function isValidBccRecipient(value: any): value is string { return emailEngine.isValidEmailAddress(value); }