// ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗ ╔═╗ ╔═╗╔═══════╗╔═╗ ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ ╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔═════╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ║ ║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ ║ ║ ║ ║║ ╔═══╗ ║║ ║ ╚══╗ ╔══╝╚╗ ╔══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═════╝ ╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ╚═════╗║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ╚═══╝ ║ ║ ║ ║ ╚═════╗╔═══════╗║ ╚╗ ╔╝ ║║ ╚═══╝ ║║ ║ ║ ║ ║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ║ ║ ║║ ╚═══╝ ║║ ╚═════╗ ║ ║ ║ ╚═════╗ // ║ ║ ║ ╔═════╝║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ╔═══╗ ║ ║ ║ ║ ╔═════╝╚═══════╝╚╗ ║ ║ ╔╝║ ╔═══╗ ║║ ║ ║ ║ ║ ║ ║ ║║ ╔═══╗ ║ ║ ║ ║ ║ ║ ║║ ╔═╗ ╔═╝╚═════╗ ║ ║ ║ ╚═════╗ ║ // ║ ║ ║ ╚═════╗║ ║║ ║║ ║║ ║ ║ ╚═════╗║ ║ ║ ║ ║ ║ ║ ╚═════╗ ║ ╚═╝ ║ ║ ║ ║ ║║ ╚═════╗╔══╝ ╚══╗╔╝ ╚══╝ ║║ ║ ║ ║ ║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗╔═════╝ ║╔═╗ ║ ║ ╔═════╝ ║ // ╚═╝ ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═════╝ ╚═╝ ╚═╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═╝ ╚═╝ ╚═══════╝╚═╝ ╚═══╝╚═══════╝╚═╝ ╚═╝ ╚═══════╝ // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as messageErrors from '../errors/template-errors.js'; import * as utilityEngine from '@xyz.warpmatter.com/utility-engine'; // ╔════╗╔═╗╔═══════╗╔═══════╗╔═══════╗ // ║ ╔╗ ║║ ║║ ╔═══╗ ║║ ╔╗ ╔╗ ║║ ╔═════╝ // ║ ║║ ║║ ║║ ╚═══╝ ║║ ║║ ║║ ║║ ╚═════╗ // ║ ║║ ║║ ║║ ╔═══╗ ║║ ║║ ║║ ║║ ╔═════╝ // ║ ║║ ╚╝ ║║ ║ ║ ║║ ║║ ║║ ║║ ╚═════╗ // ╚═╝╚════╝╚═╝ ╚═╝╚═╝╚═╝╚═╝╚═══════╝ export function validateTemplateName(value: any): void { if (!isValidTemplateName(value)) { messageErrors.throwInvalidMailgunTemplateNameError(); } } export function isValidTemplateName(value: any): value is string { return utilityEngine.isFilledString(value); } // ╔═╗ ╔═╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔══════╗ ╔═╗ ╔═══════╗╔═══════╗ // ║ ║ ║ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═══╗ ║║ ╔══╗ ║ ║ ║ ║ ╔═════╝║ ╔═════╝ // ║ ╚╗ ╔╝ ║║ ╚═══╝ ║║ ╚═══╝ ║ ║ ║ ║ ╚═══╝ ║║ ╚══╝ ╚╗║ ║ ║ ╚═════╗║ ╚═════╗ // ╚╗ ║ ║ ╔╝║ ╔═══╗ ║║ ╔═╗ ╔═╝ ║ ║ ║ ╔═══╗ ║║ ╔═══╗ ║║ ║ ║ ╔═════╝╚═════╗ ║ // ║ ╚═╝ ║ ║ ║ ║ ║║ ║ ║ ╚═╗╔══╝ ╚══╗║ ║ ║ ║║ ╚═══╝ ║║ ╚═════╗║ ╚═════╗╔═════╝ ║ // ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═══════╝╚═╝ ╚═╝╚═══════╝╚═══════╝╚═══════╝╚═══════╝ export function validateTemplateVariables(value: any): void { if (!areValidTemplateVariables(value)) { messageErrors.throwInvalidMailgunTemplateVariableError(); } } export function areValidTemplateVariables(value: any): value is object { return utilityEngine.isObjectLiteral(value); }