ts-mailkit 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -7
- package/dist/core/client.d.ts +32 -19
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/types.d.ts +8 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.cjs +101 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +97 -55
- package/dist/index.js.map +1 -1
- package/dist/renderers/default/default-renderer.d.ts +13 -4
- package/dist/renderers/default/default-renderer.d.ts.map +1 -1
- package/dist/renderers/renderer.interface.d.ts +2 -2
- package/dist/renderers/renderer.interface.d.ts.map +1 -1
- package/dist/templates/dto/index.d.ts +12 -5
- package/dist/templates/dto/index.d.ts.map +1 -1
- package/dist/templates/factory.d.ts +7 -2
- package/dist/templates/factory.d.ts.map +1 -1
- package/dist/transports/zeptomail/types.d.ts +6 -1
- package/dist/transports/zeptomail/types.d.ts.map +1 -1
- package/dist/transports/zeptomail/zeptomail-sender.d.ts +11 -4
- package/dist/transports/zeptomail/zeptomail-sender.d.ts.map +1 -1
- package/package.json +10 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/types.ts","../src/core/errors.ts","../src/renderers/utils/html-to-plaintext.ts","../src/renderers/default/default-renderer.ts","../src/core/client.ts","../src/transports/zeptomail/zeptomail-sender.ts","../src/transports/memory/memory-sender.ts","../src/transports/console/console-sender.ts","../src/templates/factory.ts"],"sourcesContent":["/**\n * Standard email address representation with optional display name.\n */\nexport interface EmailAddress {\n address: string;\n name?: string;\n}\n\n/**\n * Flexible recipient representation allowing string ('user@example.com'),\n * EmailAddress ({ address: 'user@example.com', name: 'User' }),\n * or legacy/standard object ({ email: 'user@example.com', name: 'User' }).\n */\nexport type Recipient =\n | string\n | EmailAddress\n | { email: string; name?: string };\n\n/**\n * Normalizes a Recipient value into a standardized EmailAddress.\n */\nexport function normalizeRecipient(recipient: Recipient): EmailAddress {\n if (typeof recipient === 'string') {\n return { address: recipient.trim() };\n }\n if ('email' in recipient) {\n return {\n address: (recipient.email ?? '').trim(),\n name: recipient.name?.trim(),\n };\n }\n return {\n address: (recipient.address ?? '').trim(),\n name: recipient.name?.trim(),\n };\n}\n\n/**\n * Normalizes a single or array of Recipients into an array of EmailAddress.\n */\nexport function normalizeRecipients(\n recipients?: Recipient | Recipient[]\n): EmailAddress[] {\n if (!recipients) return [];\n const list = Array.isArray(recipients) ? recipients : [recipients];\n return list.map(normalizeRecipient).filter((r) => r.address.length > 0);\n}\n\n/**\n * Email attachment representation.\n */\nexport interface EmailAttachment {\n filename: string;\n /**\n * Content can be base64-encoded string, plain text, or binary Buffer/Uint8Array.\n */\n content: string | Uint8Array;\n mimeType?: string;\n contentType?: string;\n cid?: string;\n}\n\n/**\n * Options for sending an email through a transport adapter.\n */\nexport interface SendMailOptions {\n to: Recipient | Recipient[];\n from?: Recipient;\n subject: string;\n html: string;\n text?: string;\n cc?: Recipient | Recipient[];\n bcc?: Recipient | Recipient[];\n replyTo?: Recipient | Recipient[];\n attachments?: EmailAttachment[];\n headers?: Record<string, string>;\n tags?: string[];\n metadata?: Record<string, string>;\n}\n\n/**\n * Result returned by an IEmailSender upon dispatch.\n */\nexport interface SendResult {\n success: boolean;\n messageId?: string;\n response?: unknown;\n}\n","/**\n * Base error class for all ts-mailkit errors.\n */\nexport class MailKitError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'MailKitError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when transport configuration is missing or invalid.\n */\nexport class ConfigurationError extends MailKitError {\n constructor(message: string) {\n super(message);\n this.name = 'ConfigurationError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when an email transport fails to dispatch an email.\n */\nexport class TransportError extends MailKitError {\n readonly transportName: string;\n readonly statusCode?: number;\n readonly responseBody?: string;\n readonly cause?: unknown;\n\n constructor(\n message: string,\n options: {\n transportName: string;\n statusCode?: number;\n responseBody?: string;\n cause?: unknown;\n }\n ) {\n super(message);\n this.name = 'TransportError';\n this.transportName = options.transportName;\n this.statusCode = options.statusCode;\n this.responseBody = options.responseBody;\n this.cause = options.cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when template rendering or DTO validation fails.\n */\nexport class TemplateError extends MailKitError {\n constructor(message: string) {\n super(message);\n this.name = 'TemplateError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","/**\n * Decodes common HTML entities into their plain text equivalents.\n */\nexport function decodeHtmlEntities(text: string): string {\n return text\n .replace(/ /gi, ' ')\n .replace(/&/gi, '&')\n .replace(/</gi, '<')\n .replace(/>/gi, '>')\n .replace(/"/gi, '\"')\n .replace(/'/gi, \"'\")\n .replace(/©/gi, '©')\n .replace(/®/gi, '®')\n .replace(/™/gi, '™');\n}\n\n/**\n * Strips HTML tags and normalizes whitespace into readable plain text.\n * Converts <br>, <p>, and <div> into appropriate line breaks.\n */\nexport function htmlToPlainText(html: string): string {\n if (!html) return '';\n\n return decodeHtmlEntities(\n html\n .replace(/<br\\s*\\/?>/gi, '\\n')\n .replace(/<\\/p>/gi, '\\n\\n')\n .replace(/<\\/div>/gi, '\\n')\n .replace(/<\\/h[1-6]>/gi, '\\n\\n')\n .replace(/<[^>]*>/g, '')\n )\n .replace(/[ \\t]+/g, ' ')\n .replace(/\\n\\s*\\n\\s*\\n+/g, '\\n\\n')\n .trim();\n}\n","import type { BaseEmailDto } from '../../templates/dto/index.js';\nimport type { IEmailRenderer, RenderedEmail } from '../renderer.interface.js';\nimport { htmlToPlainText } from '../utils/html-to-plaintext.js';\n\nexport interface DefaultRendererOptions {\n /**\n * Primary brand color for buttons and accents.\n * @default '#4f46e5'\n */\n primaryColor?: string;\n\n /**\n * Font stack used in the HTML wrapper.\n * @default \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\"\n */\n fontFamily?: string;\n\n /**\n * Container maximum width.\n * @default '600px'\n */\n maxWidth?: string;\n}\n\n/**\n * Builds a plain-text fallback string from an email DTO.\n */\nexport function buildPlainText(dto: BaseEmailDto): string {\n if (dto.noHtmlMessage) {\n return dto.noHtmlMessage;\n }\n\n const divider = '──────────────────────────────';\n const parts: string[] = [];\n\n if (dto.header) {\n parts.push(dto.header, divider);\n }\n\n if (dto.body) {\n parts.push(htmlToPlainText(dto.body));\n }\n\n if (dto.otpCode) {\n parts.push(`Verification Code: ${dto.otpCode}`);\n }\n\n if (dto.actionText && dto.actionUrl) {\n parts.push(`${dto.actionText}: ${dto.actionUrl}`);\n }\n\n if (dto.extraMessage) {\n parts.push(htmlToPlainText(dto.extraMessage));\n }\n\n if (dto.footer) {\n parts.push(`${divider}\\n${htmlToPlainText(dto.footer)}`);\n }\n\n return parts.join('\\n\\n');\n}\n\n/**\n * Builds a responsive, styled HTML email document from an email DTO.\n */\nexport function buildHtml(dto: BaseEmailDto, options: DefaultRendererOptions = {}): string {\n const primaryColor = options.primaryColor || '#4f46e5';\n const fontFamily =\n options.fontFamily ||\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\";\n const maxWidth = options.maxWidth || '600px';\n\n const parts: string[] = [\n `<!DOCTYPE html>`,\n `<html lang=\"en\">`,\n `<head>`,\n `<meta charset=\"UTF-8\">`,\n `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">`,\n `<title>${dto.subject}</title>`,\n `</head>`,\n `<body style=\"margin:0;padding:24px 16px;background-color:#f9fafb;font-family:${fontFamily};color:#1f2937;line-height:1.6;\">`,\n `<div style=\"max-width:${maxWidth};margin:0 auto;background-color:#ffffff;padding:32px 28px;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,0.1);border:1px solid #f3f4f6;\">`,\n ];\n\n if (dto.imageUrl) {\n parts.push(\n `<div style=\"margin-bottom:24px;text-align:center;\">`,\n ` <img src=\"${dto.imageUrl}\" alt=\"Header\" style=\"max-width:100%;height:auto;border-radius:6px;\" />`,\n `</div>`\n );\n }\n\n if (dto.header) {\n parts.push(\n `<h2 style=\"margin:0 0 16px;font-size:1.5rem;font-weight:700;color:#111827;letter-spacing:-0.025em;\">${dto.header}</h2>`\n );\n }\n\n if (dto.body) {\n parts.push(`<div style=\"margin:0 0 20px;font-size:1rem;color:#374151;\">${dto.body}</div>`);\n }\n\n if (dto.otpCode) {\n parts.push(\n `<div style=\"margin:24px 0;padding:20px;background-color:#f3f4f6;border-radius:8px;text-align:center;\">`,\n ` <span style=\"font-size:2rem;letter-spacing:0.5rem;font-weight:700;color:#111827;font-family:monospace;\">${dto.otpCode}</span>`,\n `</div>`\n );\n }\n\n if (dto.actionUrl && dto.actionText) {\n parts.push(\n `<div style=\"margin:24px 0;text-align:center;\">`,\n ` <a href=\"${dto.actionUrl}\" style=\"display:inline-block;padding:12px 28px;background-color:${primaryColor};color:#ffffff;border-radius:6px;text-decoration:none;font-weight:600;font-size:1rem;text-align:center;box-sizing:border-box;\">${dto.actionText}</a>`,\n `</div>`\n );\n }\n\n if (dto.extraMessage) {\n parts.push(\n `<div style=\"margin:20px 0 0;font-size:0.875rem;color:#6b7280;line-height:1.5;\">${dto.extraMessage}</div>`\n );\n }\n\n if (dto.footer) {\n parts.push(\n `<div style=\"margin-top:32px;padding-top:20px;border-top:1px solid #e5e7eb;font-size:0.75rem;color:#9ca3af;text-align:center;\">${dto.footer}</div>`\n );\n }\n\n parts.push(`</div>`, `</body>`, `</html>`);\n return parts.join('\\n');\n}\n\n/**\n * Default HTML and plain-text email renderer for ts-mailkit.\n */\nexport class DefaultEmailRenderer implements IEmailRenderer {\n private readonly options: DefaultRendererOptions;\n\n constructor(options: DefaultRendererOptions = {}) {\n this.options = options;\n }\n\n render(dto: BaseEmailDto): RenderedEmail {\n return {\n html: buildHtml(dto, this.options),\n text: buildPlainText(dto),\n };\n }\n}\n","import type { IEmailSender } from '../transports/sender.interface.js';\nimport type { IEmailRenderer, RenderedEmail } from '../renderers/renderer.interface.js';\nimport { DefaultEmailRenderer, buildPlainText } from '../renderers/default/default-renderer.js';\nimport type { BaseEmailDto } from '../templates/dto/index.js';\nimport {\n normalizeRecipient,\n normalizeRecipients,\n type Recipient,\n type SendMailOptions,\n type SendResult,\n} from './types.js';\nimport { ConfigurationError } from './errors.js';\n\nexport interface SendTemplateOptions {\n /**\n * One or more recipient email addresses.\n */\n to: Recipient | Recipient[];\n /**\n * Templated email DTO to render and send.\n */\n template: BaseEmailDto;\n /**\n * Optional recipient display name (used when `to` is a plain string).\n */\n toName?: string;\n /**\n * Optional sender display name override for this specific email.\n */\n fromName?: string;\n /**\n * Optional sender email address override.\n */\n from?: Recipient;\n /**\n * Optional CC recipients.\n */\n cc?: Recipient | Recipient[];\n /**\n * Optional BCC recipients.\n */\n bcc?: Recipient | Recipient[];\n /**\n * Optional Reply-To recipients.\n */\n replyTo?: Recipient | Recipient[];\n /**\n * Optional file attachments.\n */\n attachments?: SendMailOptions['attachments'];\n /**\n * Optional custom headers.\n */\n headers?: Record<string, string>;\n /**\n * Optional tags for tracking.\n */\n tags?: string[];\n /**\n * Optional metadata.\n */\n metadata?: Record<string, string>;\n}\n\nexport interface MailKitOptions {\n /**\n * The transport adapter used to dispatch emails (e.g. ZeptoMailSender, MemoryEmailSender).\n */\n transport: IEmailSender;\n /**\n * Custom renderer implementation. Defaults to DefaultEmailRenderer.\n */\n renderer?: IEmailRenderer;\n /**\n * Default sender address or Recipient.\n */\n defaultFrom?: Recipient;\n /**\n * Default brand or application name.\n */\n defaultBrandName?: string;\n /**\n * Optional asynchronous or synchronous resolver to dynamically resolve brand/tenant name.\n * Useful for multitenant applications.\n */\n brandNameResolver?: () => Promise<string> | string;\n}\n\n/**\n * Main email client and orchestration service for ts-mailkit.\n */\nexport class MailKit {\n private readonly transport: IEmailSender;\n private readonly renderer: IEmailRenderer;\n private readonly defaultFrom?: Recipient;\n private readonly defaultBrandName?: string;\n private readonly brandNameResolver?: () => Promise<string> | string;\n\n constructor(options: MailKitOptions) {\n if (!options.transport) {\n throw new ConfigurationError('MailKit: A transport adapter (IEmailSender) is required.');\n }\n this.transport = options.transport;\n this.renderer = options.renderer ?? new DefaultEmailRenderer();\n this.defaultFrom = options.defaultFrom;\n this.defaultBrandName = options.defaultBrandName;\n this.brandNameResolver = options.brandNameResolver;\n }\n\n /**\n * Returns the underlying transport instance.\n */\n getTransport(): IEmailSender {\n return this.transport;\n }\n\n /**\n * Renders an email DTO to HTML and plain text without dispatching.\n */\n async render(template: BaseEmailDto): Promise<RenderedEmail> {\n return await this.renderer.render(template);\n }\n\n /**\n * Returns the plain-text fallback for an email DTO without sending.\n */\n buildPlainTextMessage(template: BaseEmailDto): string {\n return template.noHtmlMessage ?? buildPlainText(template);\n }\n\n /**\n * Sends an email using a strongly-typed template DTO.\n * Supports both modern options object:\n * `mailer.send({ to: 'user@example.com', template: myDto })`\n * and legacy positional arguments for seamless migration:\n * `mailer.send('user@example.com', myDto, 'User Name')`\n */\n async send(options: SendTemplateOptions): Promise<SendResult>;\n async send(to: string, template: BaseEmailDto, toName?: string): Promise<SendResult>;\n async send(\n optionsOrTo: SendTemplateOptions | string,\n maybeTemplate?: BaseEmailDto,\n maybeToName?: string\n ): Promise<SendResult> {\n let opts: SendTemplateOptions;\n\n if (typeof optionsOrTo === 'string') {\n if (!maybeTemplate) {\n throw new ConfigurationError('MailKit.send: Missing required template DTO argument.');\n }\n opts = {\n to: optionsOrTo,\n template: maybeTemplate,\n toName: maybeToName,\n };\n } else {\n opts = optionsOrTo;\n }\n\n const template = opts.template;\n const recipientName = opts.toName ?? template.userName;\n\n // Resolve fromName: explicit option > template.fromName > brand resolver > defaultBrandName\n let resolvedFromName = opts.fromName ?? template.fromName;\n if (!resolvedFromName && this.brandNameResolver) {\n resolvedFromName = await this.brandNameResolver();\n }\n if (!resolvedFromName) {\n resolvedFromName = this.defaultBrandName;\n }\n\n // Render template DTO\n const rendered = await this.renderer.render(template);\n const plaintextBody = template.noHtmlMessage ?? rendered.text;\n\n // Format recipients\n let toRecipients: Recipient | Recipient[];\n if (typeof opts.to === 'string' && recipientName) {\n toRecipients = { address: opts.to, name: recipientName };\n } else {\n toRecipients = opts.to;\n }\n\n // Resolve From address\n let from = opts.from ?? this.defaultFrom;\n if (resolvedFromName && from) {\n const normalizedFrom = normalizeRecipient(from);\n from = { address: normalizedFrom.address, name: resolvedFromName };\n }\n\n return await this.sendRaw({\n to: toRecipients,\n from,\n subject: template.subject,\n html: rendered.html,\n text: plaintextBody,\n cc: opts.cc,\n bcc: opts.bcc,\n replyTo: opts.replyTo,\n attachments: opts.attachments,\n headers: opts.headers,\n tags: opts.tags,\n metadata: opts.metadata,\n });\n }\n\n /**\n * Dispatches a raw, pre-rendered email directly through the transport.\n */\n async sendRaw(options: SendMailOptions): Promise<SendResult> {\n const from = options.from ?? this.defaultFrom;\n return await this.transport.send({\n ...options,\n from,\n });\n }\n\n /**\n * Sends a raw plain-text email with basic HTML pre-formatting.\n * Useful for plain notifications, alerts, or simple text messages.\n */\n async sendSimpleMessage(\n to: string,\n subject: string,\n text: string,\n toName: string = ''\n ): Promise<SendResult> {\n const html = `<pre style=\"font-family:monospace;white-space:pre-wrap;\">${text}</pre>`;\n return await this.sendRaw({\n to: { address: to, name: toName },\n subject,\n html,\n text,\n });\n }\n}\n\n/**\n * Drop-in alias for MailKit to maintain compatibility with existing EmailService code.\n */\nexport const EmailService = MailKit;\nexport type EmailService = MailKit;\n\n/**\n * Convenience factory to create a MailKit client instance.\n */\nexport function createMailKit(options: MailKitOptions): MailKit {\n return new MailKit(options);\n}\n","import { ConfigurationError, TransportError } from '../../core/errors.js';\nimport {\n normalizeRecipient,\n normalizeRecipients,\n type SendMailOptions,\n type SendResult,\n} from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\nimport type {\n ZeptoMailConfig,\n ZeptoMailSendPayload,\n ZeptoMailAttachmentPayload,\n} from './types.js';\n\n/**\n * ZeptoMail (Zoho Mail transactional email API) transport adapter.\n *\n * Designed for zero dependencies and universal edge compatibility (Node.js, Bun, Deno, Cloudflare Workers)\n * by utilizing the standard global `fetch` API.\n */\nexport class ZeptoMailSender implements IEmailSender {\n readonly name = 'zeptomail';\n\n private readonly apiUrl: string;\n private readonly authHeader: string;\n private readonly defaultFrom: { address: string; name?: string };\n private readonly fetchImpl: typeof fetch;\n\n constructor(config: ZeptoMailConfig) {\n if (!config.apiToken || typeof config.apiToken !== 'string') {\n throw new ConfigurationError('ZeptoMailSender: Missing or invalid apiToken.');\n }\n if (!config.from) {\n throw new ConfigurationError('ZeptoMailSender: Missing required default from address.');\n }\n\n const host = (config.apiHost || 'api.zeptomail.com').replace(/^https?:\\/\\//, '').replace(/\\/+$/, '');\n this.apiUrl = `https://${host}/v1.1/email`;\n\n // Normalize auth token header. In ZeptoMail, if the user already included \"Zoho-enczapikey \", use as is; otherwise format standard header.\n const token = config.apiToken.trim();\n this.authHeader = token.startsWith('Zoho-') ? token : `Zoho-enczapikey ${token}`;\n\n this.defaultFrom = normalizeRecipient(config.from);\n if (!this.defaultFrom.address) {\n throw new ConfigurationError('ZeptoMailSender: Configured from address must not be empty.');\n }\n\n this.fetchImpl = config.fetch ?? globalThis.fetch;\n if (typeof this.fetchImpl !== 'function') {\n throw new ConfigurationError(\n 'ZeptoMailSender: No global fetch implementation found. Pass a custom fetch to ZeptoMailConfig if running on Node < 18.'\n );\n }\n }\n\n /**\n * Dispatches an email using Zoho ZeptoMail API v1.1.\n */\n async send(options: SendMailOptions): Promise<SendResult> {\n const toRecipients = normalizeRecipients(options.to);\n if (toRecipients.length === 0) {\n throw new TransportError('ZeptoMailSender: At least one recipient (to) must be specified.', {\n transportName: this.name,\n });\n }\n\n const resolvedFrom = options.from ? normalizeRecipient(options.from) : this.defaultFrom;\n\n const payload: ZeptoMailSendPayload = {\n from: {\n address: resolvedFrom.address,\n name: resolvedFrom.name,\n },\n to: toRecipients.map((r) => ({\n email_address: {\n address: r.address,\n name: r.name || '',\n },\n })),\n subject: options.subject,\n htmlbody: options.html,\n textbody: options.text,\n };\n\n if (options.cc) {\n const ccList = normalizeRecipients(options.cc);\n if (ccList.length > 0) {\n payload.cc = ccList.map((r) => ({\n email_address: { address: r.address, name: r.name || '' },\n }));\n }\n }\n\n if (options.bcc) {\n const bccList = normalizeRecipients(options.bcc);\n if (bccList.length > 0) {\n payload.bcc = bccList.map((r) => ({\n email_address: { address: r.address, name: r.name || '' },\n }));\n }\n }\n\n if (options.replyTo) {\n const replyToList = normalizeRecipients(options.replyTo);\n if (replyToList.length > 0) {\n payload.reply_to = replyToList.map((r) => ({\n address: r.address,\n name: r.name,\n }));\n }\n }\n\n if (options.attachments && options.attachments.length > 0) {\n payload.attachments = options.attachments.map((att): ZeptoMailAttachmentPayload => {\n let contentBase64: string;\n if (typeof att.content === 'string') {\n contentBase64 = att.content;\n } else {\n // Buffer or Uint8Array\n if (typeof Buffer !== 'undefined') {\n contentBase64 = Buffer.from(att.content).toString('base64');\n } else {\n // Browser / Edge fallback for Uint8Array\n let binary = '';\n const bytes = new Uint8Array(att.content);\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n contentBase64 = btoa(binary);\n }\n }\n\n return {\n name: att.filename,\n content: contentBase64,\n mime_type: att.mimeType || att.contentType || 'application/octet-stream',\n cid: att.cid,\n };\n });\n }\n\n let response: Response;\n try {\n response = await this.fetchImpl(this.apiUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: this.authHeader,\n },\n body: JSON.stringify(payload),\n });\n } catch (err) {\n throw new TransportError(`ZeptoMailSender: Network request failed: ${err instanceof Error ? err.message : String(err)}`, {\n transportName: this.name,\n cause: err,\n });\n }\n\n const responseText = await response.text();\n let responseData: any;\n try {\n responseData = responseText ? JSON.parse(responseText) : {};\n } catch {\n responseData = { raw: responseText };\n }\n\n if (!response.ok) {\n const errorMessage =\n responseData?.error?.message ||\n responseData?.message ||\n `HTTP ${response.status}: ${responseText || response.statusText}`;\n\n throw new TransportError(`ZeptoMailSender: Failed to send email - ${errorMessage}`, {\n transportName: this.name,\n statusCode: response.status,\n responseBody: responseText,\n });\n }\n\n // Extract message ID from standard ZeptoMail v1.1 response structure:\n // { data: [ { message_id: \"...\" } ] }\n const messageId = responseData?.data?.[0]?.message_id;\n\n return {\n success: true,\n messageId,\n response: responseData,\n };\n }\n\n /**\n * Backward-compatible helper method matching legacy signature:\n * `sendEmail(to, htmlBody, subject, toName?, plaintextBody?, fromName?)`\n */\n async sendEmail(\n to: string,\n htmlBody: string,\n subject: string,\n toName: string = '',\n plaintextBody?: string,\n fromName?: string\n ): Promise<void> {\n await this.send({\n to: { address: to, name: toName },\n from: fromName ? { address: this.defaultFrom.address, name: fromName } : this.defaultFrom,\n subject,\n html: htmlBody,\n text: plaintextBody,\n });\n }\n}\n","import type { SendMailOptions, SendResult } from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\n\n/**\n * In-memory email sender for automated testing, local development, and CI environments.\n * Captures all dispatched emails and provides inspection methods.\n */\nexport class MemoryEmailSender implements IEmailSender {\n readonly name = 'memory';\n\n private sentMails: SendMailOptions[] = [];\n private nextId = 1;\n\n async send(options: SendMailOptions): Promise<SendResult> {\n this.sentMails.push({ ...options });\n const messageId = `mem-${this.nextId++}-${Date.now()}`;\n return {\n success: true,\n messageId,\n response: { id: messageId },\n };\n }\n\n /**\n * Returns a copy of all emails sent through this transport instance.\n */\n getSentMails(): SendMailOptions[] {\n return [...this.sentMails];\n }\n\n /**\n * Returns the most recent email sent, or undefined if no emails have been sent.\n */\n getLastMail(): SendMailOptions | undefined {\n return this.sentMails.length > 0\n ? { ...this.sentMails[this.sentMails.length - 1] }\n : undefined;\n }\n\n /**\n * Clears all recorded sent emails.\n */\n clear(): void {\n this.sentMails = [];\n }\n\n /**\n * Returns the total count of sent emails.\n */\n count(): number {\n return this.sentMails.length;\n }\n}\n","import { normalizeRecipients, type SendMailOptions, type SendResult } from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\n\nexport interface ConsoleEmailSenderOptions {\n /**\n * Log level or custom log printer. Defaults to `console.log`.\n */\n logger?: (message: string) => void;\n /**\n * Whether to include the full HTML body in console output.\n * Defaults to false (prints plain text or a summary).\n */\n includeHtml?: boolean;\n}\n\n/**\n * Console logger transport that prints dispatched emails to stdout/stderr.\n * Ideal for development and debugging.\n */\nexport class ConsoleEmailSender implements IEmailSender {\n readonly name = 'console';\n\n private readonly log: (message: string) => void;\n private readonly includeHtml: boolean;\n private nextId = 1;\n\n constructor(options: ConsoleEmailSenderOptions = {}) {\n this.log = options.logger ?? console.log;\n this.includeHtml = options.includeHtml ?? false;\n }\n\n async send(options: SendMailOptions): Promise<SendResult> {\n const to = normalizeRecipients(options.to).map((r) => r.name ? `${r.name} <${r.address}>` : r.address).join(', ');\n const from = options.from ? JSON.stringify(options.from) : '(default)';\n const messageId = `console-${this.nextId++}-${Date.now()}`;\n\n const separator = '─'.repeat(60);\n const lines = [\n `\\n┌${separator}┐`,\n `│ [ts-mailkit:console] DISPATCHED EMAIL (${messageId})`,\n `├${separator}┤`,\n `│ From: ${from}`,\n `│ To: ${to}`,\n `│ Subject: ${options.subject}`,\n `├${separator}┤`,\n ];\n\n if (options.text) {\n lines.push('│ Text Body:');\n for (const line of options.text.split('\\n')) {\n lines.push(`│ ${line}`);\n }\n }\n\n if (this.includeHtml && options.html) {\n lines.push('│ HTML Body:');\n for (const line of options.html.split('\\n')) {\n lines.push(`│ ${line}`);\n }\n }\n\n lines.push(`└${separator}┘\\n`);\n\n this.log(lines.join('\\n'));\n\n return {\n success: true,\n messageId,\n response: { logged: true },\n };\n }\n}\n","import type { BaseEmailDto, EmailTemplateDto } from './dto/index.js';\nimport { htmlToPlainText } from '../renderers/utils/html-to-plaintext.js';\n\nexport interface BrandingConfig {\n /**\n * Default brand, application, or company name.\n * @default 'Application'\n */\n brandName?: string;\n\n /**\n * Optional custom security / disclaimer advisory message.\n */\n securityMessage?: string;\n\n /**\n * Optional custom footer generator or string.\n */\n footer?: string | ((brandName: string) => string);\n}\n\nconst DEFAULT_SECURITY_MESSAGE =\n 'If you did not request this, please ignore this email or contact support if you have concerns.';\n\nfunction defaultFooter(brandName: string): string {\n return `© ${new Date().getFullYear()} ${brandName}. All rights reserved.`;\n}\n\n/**\n * Factory for creating pre-populated, type-safe email template DTOs.\n */\nexport class EmailTemplateFactory {\n private readonly defaultBrandName: string;\n private readonly defaultSecurityMessage: string;\n private readonly footerResolver: (brandName: string) => string;\n\n constructor(config: BrandingConfig = {}) {\n this.defaultBrandName = config.brandName || 'Application';\n this.defaultSecurityMessage = config.securityMessage || DEFAULT_SECURITY_MESSAGE;\n if (typeof config.footer === 'function') {\n this.footerResolver = config.footer;\n } else if (typeof config.footer === 'string') {\n const fixedFooter = config.footer;\n this.footerResolver = () => fixedFooter;\n } else {\n this.footerResolver = defaultFooter;\n }\n }\n\n private resolveBrand(override?: string): string {\n return override || this.defaultBrandName;\n }\n\n private buildFooter(brandName: string): string {\n return this.footerResolver(brandName);\n }\n\n /**\n * Welcome / email-verification email sent after registration.\n */\n createEmailVerification(\n username: string,\n verificationUrl: string,\n otp: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Thank you for signing up. Use the code below or click the button to verify your email address.`;\n return {\n subject: 'Verify Your Email Address',\n header: `Welcome to ${brand}!`,\n body,\n otpCode: otp,\n actionUrl: verificationUrl,\n actionText: 'Verify Email',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage:\n htmlToPlainText(body) +\n `\\n\\nYour verification code is: ${otp}\\n\\nAlternatively, verify here:\\n${verificationUrl}`,\n };\n }\n\n /**\n * Password-reset email with an optional OTP code and action link.\n */\n createPasswordReset(\n username: string,\n resetUrl: string,\n otp: string = '',\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>We received a request to reset your password. Use the OTP code below or click the button to proceed.`;\n const plainTextOtp = otp ? `\\n\\nYour OTP code is: ${otp}` : '';\n return {\n subject: 'Password Reset Request',\n header: 'Reset Your Password',\n body,\n otpCode: otp || undefined,\n actionUrl: resetUrl,\n actionText: 'Reset Password',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage:\n htmlToPlainText(body) +\n plainTextOtp +\n `\\n\\nAlternatively, you can use the following link to reset your password:\\n${resetUrl}`,\n };\n }\n\n /**\n * Generic plain message email (no action button, no OTP).\n */\n createSimpleMessage(\n subject: string,\n header: string,\n body: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n return {\n subject,\n header,\n body,\n footer: this.buildFooter(brand),\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body),\n };\n }\n\n /**\n * Newsletter / announcement email with an optional hero image and CTA button.\n */\n createNewsLetter(\n subject: string,\n header: string,\n body: string,\n imageUrl?: string,\n actionUrl?: string,\n actionText?: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n let noHtmlMessage = htmlToPlainText(body);\n if (actionUrl) {\n noHtmlMessage += `\\n\\n${actionText || 'Learn more'}: ${actionUrl}`;\n }\n return {\n subject,\n header,\n body,\n imageUrl,\n actionUrl,\n actionText,\n footer: this.buildFooter(brand),\n fromName: brand,\n noHtmlMessage,\n };\n }\n\n /**\n * Two-factor authentication email with OTP code and optional magic link.\n */\n create2FAEmail(\n username: string,\n otp: string,\n magicLink: string = '',\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Use the code below or click the button to complete your login.`;\n const plainLink = magicLink ? `\\n\\nAlternatively, verify here:\\n${magicLink}` : '';\n return {\n subject: 'Your Login Verification Code',\n header: 'Two-Factor Authentication',\n body,\n otpCode: otp,\n actionUrl: magicLink || undefined,\n actionText: magicLink ? 'Verify Login' : undefined,\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body) + `\\n\\nYour verification code is: ${otp}` + plainLink,\n };\n }\n\n /**\n * Magic link sign-in email (no OTP, button only).\n */\n createMagicLinkEmail(\n username: string,\n magicLink: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Click the button below to sign in. No password needed.`;\n return {\n subject: 'Your Magic Link',\n header: `Sign In to ${brand}`,\n body,\n actionUrl: magicLink,\n actionText: 'Sign In',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body) + `\\n\\nSign in here:\\n${magicLink}`,\n };\n }\n\n // ─── Default Static Instance ──────────────────────────────────────────────\n private static _defaultInstance?: EmailTemplateFactory;\n\n private static get defaultInstance(): EmailTemplateFactory {\n if (!this._defaultInstance) {\n this._defaultInstance = new EmailTemplateFactory();\n }\n return this._defaultInstance;\n }\n\n static createEmailVerification(\n username: string,\n verificationUrl: string,\n otp: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createEmailVerification(username, verificationUrl, otp, brandName);\n }\n\n static createPasswordReset(\n username: string,\n resetUrl: string,\n otp?: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createPasswordReset(username, resetUrl, otp, brandName);\n }\n\n static createSimpleMessage(\n subject: string,\n header: string,\n body: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createSimpleMessage(subject, header, body, brandName);\n }\n\n static createNewsLetter(\n subject: string,\n header: string,\n body: string,\n imageUrl?: string,\n actionUrl?: string,\n actionText?: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createNewsLetter(\n subject,\n header,\n body,\n imageUrl,\n actionUrl,\n actionText,\n brandName\n );\n }\n\n static create2FAEmail(\n username: string,\n otp: string,\n magicLink?: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.create2FAEmail(username, otp, magicLink, brandName);\n }\n\n static createMagicLinkEmail(\n username: string,\n magicLink: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createMagicLinkEmail(username, magicLink, brandName);\n }\n}\n"],"mappings":";AAqBO,SAAS,mBAAmB,WAAoC;AACrE,MAAI,OAAO,cAAc,UAAU;AACjC,WAAO,EAAE,SAAS,UAAU,KAAK,EAAE;AAAA,EACrC;AACA,MAAI,WAAW,WAAW;AACxB,WAAO;AAAA,MACL,UAAU,UAAU,SAAS,IAAI,KAAK;AAAA,MACtC,MAAM,UAAU,MAAM,KAAK;AAAA,IAC7B;AAAA,EACF;AACA,SAAO;AAAA,IACL,UAAU,UAAU,WAAW,IAAI,KAAK;AAAA,IACxC,MAAM,UAAU,MAAM,KAAK;AAAA,EAC7B;AACF;AAKO,SAAS,oBACd,YACgB;AAChB,MAAI,CAAC,WAAY,QAAO,CAAC;AACzB,QAAM,OAAO,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU;AACjE,SAAO,KAAK,IAAI,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,SAAS,CAAC;AACxE;;;AC3CO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAKO,IAAM,qBAAN,cAAiC,aAAa;AAAA,EACnD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAKO,IAAM,iBAAN,cAA6B,aAAa;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,SACA,SAMA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,gBA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kB;AAClB,WAAO,KAAK,gBAAgB,wBAAwB,UAAU,iBAAiB,KAAK,SAAS;AAAA,EAC/F;AAAA,EAEA,OAAO,oBACL,UACA,UACA,KACA,WACkB;AAClB,WAAO,KAAK,gBAAgB,oBAAoB,UAAU,UAAU,KAAK,SAAS;AAAA,EACpF;AAAA,EAEA,OAAO,oBACL,SACA,QACA,MACA,WACkB;AAClB,WAAO,KAAK,gBAAgB,oBAAoB,SAAS,QAAQ,MAAM,SAAS;AAAA,EAClF;AAAA,EAEA,OAAO,iBACL,SACA,QACA,MACA,UACA,WACA,YACA,WACkB;AAClB,WAAO,KAAK,gBAAgB;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO,eACL,UACA,KACA,WACA,WACkB;AAClB,WAAO,KAAK,gBAAgB,eAAe,UAAU,KAAK,WAAW,SAAS;AAAA,EAChF;AAAA,EAEA,OAAO,qBACL,UACA,WACA,WACkB;AAClB,WAAO,KAAK,gBAAgB,qBAAqB,UAAU,WAAW,SAAS;AAAA,EACjF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts","../src/core/errors.ts","../src/renderers/utils/html-to-plaintext.ts","../src/renderers/default/default-renderer.ts","../src/core/client.ts","../src/transports/zeptomail/zeptomail-sender.ts","../src/transports/memory/memory-sender.ts","../src/transports/console/console-sender.ts","../src/templates/factory.ts"],"sourcesContent":["/**\n * Standard email address representation with optional display name.\n */\nexport interface EmailAddress {\n address: string;\n name?: string;\n}\n\n/**\n * Flexible recipient representation allowing string ('user@example.com'),\n * EmailAddress ({ address: 'user@example.com', name: 'User' }),\n * or legacy/standard object ({ email: 'user@example.com', name: 'User' }).\n */\nexport type Recipient =\n | string\n | EmailAddress\n | { email: string; name?: string };\n\n/**\n * Parses an RFC 5322 formatted address string into an EmailAddress.\n * Supports formats such as:\n * - \"user@example.com\" -> { address: \"user@example.com\" }\n * - \"Sender Name <sender@example.com>\" -> { name: \"Sender Name\", address: \"sender@example.com\" }\n * - \"\\\"Sender Name\\\" <sender@example.com>\" -> { name: \"Sender Name\", address: \"sender@example.com\" }\n */\nexport function parseEmailAddress(input: string): EmailAddress {\n if (!input || typeof input !== 'string') {\n return { address: '' };\n }\n const trimmed = input.trim();\n const match = trimmed.match(/^(?:[\"']?([^\"']+)[\"']?\\s+)?<?([^\\s<>@]+@[^\\s<>@]+)>?$/);\n if (!match) {\n return { address: trimmed };\n }\n return {\n address: match[2].trim(),\n name: match[1]?.trim() || undefined,\n };\n}\n\n/**\n * Normalizes a Recipient value into a standardized EmailAddress.\n */\nexport function normalizeRecipient(recipient: Recipient): EmailAddress {\n if (typeof recipient === 'string') {\n return { address: recipient.trim() };\n }\n if ('email' in recipient) {\n return {\n address: (recipient.email ?? '').trim(),\n name: recipient.name?.trim(),\n };\n }\n return {\n address: (recipient.address ?? '').trim(),\n name: recipient.name?.trim(),\n };\n}\n\n/**\n * Normalizes a single or array of Recipients into an array of EmailAddress.\n */\nexport function normalizeRecipients(\n recipients?: Recipient | Recipient[]\n): EmailAddress[] {\n if (!recipients) return [];\n const list = Array.isArray(recipients) ? recipients : [recipients];\n return list.map(normalizeRecipient).filter((r) => r.address.length > 0);\n}\n\n/**\n * Email attachment representation.\n */\nexport interface EmailAttachment {\n filename: string;\n /**\n * Content can be base64-encoded string, plain text, or binary Buffer/Uint8Array.\n */\n content: string | Uint8Array;\n mimeType?: string;\n contentType?: string;\n cid?: string;\n}\n\n/**\n * Options for sending an email through a transport adapter.\n */\nexport interface SendMailOptions {\n to: Recipient | Recipient[];\n from?: Recipient;\n subject: string;\n html: string;\n text?: string;\n cc?: Recipient | Recipient[];\n bcc?: Recipient | Recipient[];\n replyTo?: Recipient | Recipient[];\n attachments?: EmailAttachment[];\n headers?: Record<string, string>;\n tags?: string[];\n metadata?: Record<string, string>;\n}\n\n/**\n * Result returned by an IEmailSender upon dispatch.\n */\nexport interface SendResult {\n success: boolean;\n messageId?: string;\n response?: unknown;\n}\n","/**\n * Base error class for all ts-mailkit errors.\n */\nexport class MailKitError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'MailKitError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when transport configuration is missing or invalid.\n */\nexport class ConfigurationError extends MailKitError {\n constructor(message: string) {\n super(message);\n this.name = 'ConfigurationError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when an email transport fails to dispatch an email.\n */\nexport class TransportError extends MailKitError {\n readonly transportName: string;\n readonly statusCode?: number;\n readonly responseBody?: string;\n readonly cause?: unknown;\n\n constructor(\n message: string,\n options: {\n transportName: string;\n statusCode?: number;\n responseBody?: string;\n cause?: unknown;\n }\n ) {\n super(message);\n this.name = 'TransportError';\n this.transportName = options.transportName;\n this.statusCode = options.statusCode;\n this.responseBody = options.responseBody;\n this.cause = options.cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when template rendering or DTO validation fails.\n */\nexport class TemplateError extends MailKitError {\n constructor(message: string) {\n super(message);\n this.name = 'TemplateError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","/**\n * Decodes common HTML entities into their plain text equivalents.\n */\nexport function decodeHtmlEntities(text: string): string {\n return text\n .replace(/ /gi, ' ')\n .replace(/&/gi, '&')\n .replace(/</gi, '<')\n .replace(/>/gi, '>')\n .replace(/"/gi, '\"')\n .replace(/'/gi, \"'\")\n .replace(/©/gi, '©')\n .replace(/®/gi, '®')\n .replace(/™/gi, '™');\n}\n\n/**\n * Strips HTML tags and normalizes whitespace into readable plain text.\n * Converts <br>, <p>, and <div> into appropriate line breaks.\n */\nexport function htmlToPlainText(html: string): string {\n if (!html) return '';\n\n return decodeHtmlEntities(\n html\n .replace(/<br\\s*\\/?>/gi, '\\n')\n .replace(/<\\/p>/gi, '\\n\\n')\n .replace(/<\\/div>/gi, '\\n')\n .replace(/<\\/h[1-6]>/gi, '\\n\\n')\n .replace(/<[^>]*>/g, '')\n )\n .replace(/[ \\t]+/g, ' ')\n .replace(/\\n\\s*\\n\\s*\\n+/g, '\\n\\n')\n .trim();\n}\n","import type { EmailTemplateDto } from '../../templates/dto/index.js';\nimport type { IEmailRenderer, RenderedEmail } from '../renderer.interface.js';\nimport { htmlToPlainText } from '../utils/html-to-plaintext.js';\n\nexport interface DefaultRendererOptions {\n /**\n * Primary brand color for buttons and accents.\n * @default '#4f46e5'\n */\n primaryColor?: string;\n\n /**\n * Font stack used in the HTML wrapper.\n * @default \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\"\n */\n fontFamily?: string;\n\n /**\n * Container maximum width.\n * @default '600px'\n */\n maxWidth?: string;\n\n /**\n * Default logo URL displayed at the top-center of the email if not provided in the DTO.\n * Must be a valid http(s) URL.\n */\n logoUrl?: string;\n}\n\n/**\n * Validates whether a string is a valid HTTP or HTTPS URL.\n */\nexport function isValidHttpUrl(urlString?: string): boolean {\n if (!urlString || typeof urlString !== 'string') return false;\n try {\n const url = new URL(urlString.trim());\n return (url.protocol === 'http:' || url.protocol === 'https:') && url.hostname.length > 0;\n } catch {\n return false;\n }\n}\n\n/**\n * Builds a plain-text fallback string from an email DTO.\n */\nexport function buildPlainText(dto: EmailTemplateDto): string {\n if (dto.noHtmlMessage) {\n return dto.noHtmlMessage;\n }\n\n const divider = '──────────────────────────────';\n const parts: string[] = [];\n\n if (dto.header) {\n parts.push(dto.header, divider);\n }\n\n if (dto.body) {\n parts.push(htmlToPlainText(dto.body));\n }\n\n if (dto.otpCode) {\n parts.push(`Verification Code: ${dto.otpCode}`);\n }\n\n if (dto.actionText && dto.actionUrl) {\n parts.push(`${dto.actionText}: ${dto.actionUrl}`);\n }\n\n if (dto.extraMessage) {\n parts.push(htmlToPlainText(dto.extraMessage));\n }\n\n if (dto.footer) {\n parts.push(`${divider}\\n${htmlToPlainText(dto.footer)}`);\n }\n\n return parts.join('\\n\\n');\n}\n\n/**\n * Builds a responsive, styled HTML email document from an email DTO.\n */\nexport function buildHtml(dto: EmailTemplateDto, options: DefaultRendererOptions = {}): string {\n const primaryColor = options.primaryColor || '#4f46e5';\n const fontFamily =\n options.fontFamily ||\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\";\n const maxWidth = options.maxWidth || '600px';\n\n const parts: string[] = [\n `<!DOCTYPE html>`,\n `<html lang=\"en\">`,\n `<head>`,\n `<meta charset=\"UTF-8\">`,\n `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">`,\n `<title>${dto.subject}</title>`,\n `</head>`,\n `<body style=\"margin:0;padding:24px 16px;background-color:#f9fafb;font-family:${fontFamily};color:#1f2937;line-height:1.6;\">`,\n `<div style=\"max-width:${maxWidth};margin:0 auto;background-color:#ffffff;padding:32px 28px;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,0.1);border:1px solid #f3f4f6;\">`,\n ];\n\n const logoCandidate = dto.logoUrl ?? options.logoUrl;\n if (logoCandidate && isValidHttpUrl(logoCandidate)) {\n const validLogo = logoCandidate.trim();\n parts.push(\n `<div style=\"margin-bottom:24px;text-align:center;\">`,\n ` <img src=\"${validLogo}\" alt=\"${dto.fromName || 'Logo'}\" style=\"max-height:48px;max-width:200px;height:auto;width:auto;display:inline-block;border:0;outline:none;text-decoration:none;\" />`,\n `</div>`\n );\n }\n\n if (dto.imageUrl) {\n parts.push(\n `<div style=\"margin-bottom:24px;text-align:center;\">`,\n ` <img src=\"${dto.imageUrl}\" alt=\"Header\" style=\"max-width:100%;height:auto;border-radius:6px;\" />`,\n `</div>`\n );\n }\n\n if (dto.header) {\n parts.push(\n `<h2 style=\"margin:0 0 16px;font-size:1.5rem;font-weight:700;color:#111827;letter-spacing:-0.025em;\">${dto.header}</h2>`\n );\n }\n\n if (dto.body) {\n parts.push(`<div style=\"margin:0 0 20px;font-size:1rem;color:#374151;\">${dto.body}</div>`);\n }\n\n if (dto.otpCode) {\n parts.push(\n `<div style=\"margin:24px 0;padding:20px;background-color:#f3f4f6;border-radius:8px;text-align:center;\">`,\n ` <span style=\"font-size:2rem;letter-spacing:0.5rem;font-weight:700;color:#111827;font-family:monospace;\">${dto.otpCode}</span>`,\n `</div>`\n );\n }\n\n if (dto.actionUrl && dto.actionText) {\n parts.push(\n `<div style=\"margin:24px 0;text-align:center;\">`,\n ` <a href=\"${dto.actionUrl}\" style=\"display:inline-block;padding:12px 28px;background-color:${primaryColor};color:#ffffff;border-radius:6px;text-decoration:none;font-weight:600;font-size:1rem;text-align:center;box-sizing:border-box;\">${dto.actionText}</a>`,\n `</div>`\n );\n }\n\n if (dto.extraMessage) {\n parts.push(\n `<div style=\"margin:20px 0 0;font-size:0.875rem;color:#6b7280;line-height:1.5;\">${dto.extraMessage}</div>`\n );\n }\n\n if (dto.footer) {\n parts.push(\n `<div style=\"margin-top:32px;padding-top:20px;border-top:1px solid #e5e7eb;font-size:0.75rem;color:#9ca3af;text-align:center;\">${dto.footer}</div>`\n );\n }\n\n parts.push(`</div>`, `</body>`, `</html>`);\n return parts.join('\\n');\n}\n\n/**\n * Default HTML and plain-text email renderer for ts-mailkit.\n */\nexport class DefaultEmailRenderer implements IEmailRenderer {\n private readonly options: DefaultRendererOptions;\n\n constructor(options: DefaultRendererOptions = {}) {\n this.options = options;\n }\n\n render(dto: EmailTemplateDto): RenderedEmail {\n return {\n html: buildHtml(dto, this.options),\n text: buildPlainText(dto),\n };\n }\n}\n","import type { IEmailSender } from '../transports/sender.interface.js';\nimport type { IEmailRenderer, RenderedEmail } from '../renderers/renderer.interface.js';\nimport { DefaultEmailRenderer, buildPlainText } from '../renderers/default/default-renderer.js';\nimport { htmlToPlainText } from '../renderers/utils/html-to-plaintext.js';\nimport type { EmailTemplateDto } from '../templates/dto/index.js';\nimport {\n normalizeRecipient,\n normalizeRecipients,\n type Recipient,\n type SendMailOptions,\n type SendResult,\n} from './types.js';\nimport { ConfigurationError } from './errors.js';\n\nexport interface SendTemplateOptions {\n /**\n * One or more recipient email addresses.\n */\n to: Recipient | Recipient[];\n /**\n * Templated email DTO to render and send.\n */\n template: EmailTemplateDto;\n /**\n * Optional recipient display name (used when `to` is a plain string).\n */\n toName?: string;\n /**\n * Optional sender display name override for this specific email.\n */\n fromName?: string;\n /**\n * Optional sender email address override.\n */\n from?: Recipient;\n /**\n * Optional CC recipients.\n */\n cc?: Recipient | Recipient[];\n /**\n * Optional BCC recipients.\n */\n bcc?: Recipient | Recipient[];\n /**\n * Optional Reply-To recipients.\n */\n replyTo?: Recipient | Recipient[];\n /**\n * Optional file attachments.\n */\n attachments?: SendMailOptions['attachments'];\n /**\n * Optional custom headers.\n */\n headers?: Record<string, string>;\n /**\n * Optional tags for tracking.\n */\n tags?: string[];\n /**\n * Optional metadata.\n */\n metadata?: Record<string, string>;\n}\n\nexport interface MailKitOptions {\n /**\n * The transport adapter used to dispatch emails (e.g. ZeptoMailHttpSender, MemoryEmailSender).\n */\n transport: IEmailSender;\n /**\n * Custom renderer implementation. Defaults to DefaultEmailRenderer.\n */\n renderer?: IEmailRenderer;\n /**\n * Default sender address or Recipient.\n */\n defaultFrom?: Recipient;\n /**\n * Default brand or application name.\n */\n defaultBrandName?: string;\n /**\n * Optional asynchronous or synchronous resolver to dynamically resolve brand/tenant name.\n * Useful for multitenant applications.\n */\n brandNameResolver?: () => Promise<string> | string;\n}\n\n/**\n * Main email client and orchestration service for ts-mailkit.\n */\nexport class MailKit {\n private readonly transport: IEmailSender;\n private readonly renderer: IEmailRenderer;\n private readonly defaultFrom?: Recipient;\n private readonly defaultBrandName?: string;\n private readonly brandNameResolver?: () => Promise<string> | string;\n\n constructor(options: MailKitOptions) {\n if (!options.transport) {\n throw new ConfigurationError('MailKit: A transport adapter (IEmailSender) is required.');\n }\n this.transport = options.transport;\n this.renderer = options.renderer ?? new DefaultEmailRenderer();\n this.defaultFrom = options.defaultFrom;\n this.defaultBrandName = options.defaultBrandName;\n this.brandNameResolver = options.brandNameResolver;\n }\n\n /**\n * Returns the underlying transport instance.\n */\n getTransport(): IEmailSender {\n return this.transport;\n }\n\n /**\n * Renders an email DTO to HTML and plain text without dispatching.\n */\n async render(template: EmailTemplateDto): Promise<RenderedEmail> {\n return await this.renderer.render(template);\n }\n\n /**\n * Legacy positional send signature for backwards compatibility with 0.1.x:\n * `send(to: string, template: EmailTemplateDto, toName?: string): Promise<SendResult>`\n *\n * @deprecated Use `send({ to, template, ... })` instead. This overload will be removed in v1.0.0.\n */\n async send(to: string, template: EmailTemplateDto, toName?: string): Promise<SendResult>;\n /**\n * Sends an email using a strongly-typed template DTO.\n *\n * Example:\n * ```ts\n * await mailer.send({\n * to: 'user@example.com',\n * template: myDto,\n * });\n * ```\n */\n async send(options: SendTemplateOptions): Promise<SendResult>;\n async send(\n toOrOptions: string | SendTemplateOptions,\n maybeTemplate?: EmailTemplateDto,\n maybeToName?: string\n ): Promise<SendResult> {\n const options: SendTemplateOptions =\n typeof toOrOptions === 'string'\n ? {\n to: toOrOptions,\n template: maybeTemplate!,\n toName: maybeToName,\n }\n : toOrOptions;\n\n const template = options.template;\n const recipientName = options.toName ?? template.userName;\n\n // Resolve fromName: explicit option > template.fromName > brand resolver > defaultBrandName\n let resolvedFromName = options.fromName ?? template.fromName;\n if (!resolvedFromName && this.brandNameResolver) {\n resolvedFromName = await this.brandNameResolver();\n }\n if (!resolvedFromName) {\n resolvedFromName = this.defaultBrandName;\n }\n\n // Render template DTO\n const rendered = await this.renderer.render(template);\n const plaintextBody = template.noHtmlMessage ?? rendered.text;\n\n // Format recipients\n let toRecipients: Recipient | Recipient[];\n if (typeof options.to === 'string' && recipientName) {\n toRecipients = { address: options.to, name: recipientName };\n } else {\n toRecipients = options.to;\n }\n\n // Resolve From address\n let from = options.from ?? this.defaultFrom;\n if (resolvedFromName && from) {\n const normalizedFrom = normalizeRecipient(from);\n from = { address: normalizedFrom.address, name: resolvedFromName };\n }\n\n return await this.sendRaw({\n to: toRecipients,\n from,\n subject: template.subject,\n html: rendered.html,\n text: plaintextBody,\n cc: options.cc,\n bcc: options.bcc,\n replyTo: options.replyTo,\n attachments: options.attachments,\n headers: options.headers,\n tags: options.tags,\n metadata: options.metadata,\n });\n }\n\n /**\n * Dispatches a raw, pre-rendered email directly through the transport.\n * If `options.text` is omitted, plain text is automatically derived from `options.html`.\n */\n async sendRaw(options: SendMailOptions): Promise<SendResult> {\n const from = options.from ?? this.defaultFrom;\n const text = options.text ?? (options.html ? htmlToPlainText(options.html) : undefined);\n return await this.transport.send({\n ...options,\n from,\n text,\n });\n }\n\n /**\n * Helper method matching legacy 0.1.x `sendSimpleMessage(to, subject, text, fromName?)`.\n * @deprecated Use `sendRaw({ to, subject, text, ... })` instead. This method will be removed in v1.0.0.\n */\n async sendSimpleMessage(\n to: string,\n subject: string,\n text: string,\n fromName?: string\n ): Promise<SendResult> {\n return await this.sendRaw({\n to,\n subject,\n text,\n html: `<pre style=\"font-family:monospace;white-space:pre-wrap;\">${text}</pre>`,\n from: fromName && this.defaultFrom\n ? { address: normalizeRecipient(this.defaultFrom).address, name: fromName }\n : this.defaultFrom,\n });\n }\n\n /**\n * Legacy helper method to construct plain text from a template.\n * @deprecated Use `render(template)` or `buildPlainText(dto)` instead. This method will be removed in v1.0.0.\n */\n buildPlainTextMessage(template: EmailTemplateDto): string {\n return template.noHtmlMessage ?? buildPlainText(template);\n }\n}\n\n/**\n * Convenience factory to create a MailKit client instance.\n */\nexport function createMailKit(options: MailKitOptions): MailKit {\n return new MailKit(options);\n}\n\n/**\n * Backward-compatibility alias for `MailKit`.\n * @deprecated Use `MailKit` instead. This alias will be removed in v1.0.0.\n */\nexport const EmailService = MailKit;\nexport type EmailService = MailKit;\n","import { ConfigurationError, TransportError } from '../../core/errors.js';\nimport {\n normalizeRecipient,\n normalizeRecipients,\n type SendMailOptions,\n type SendResult,\n} from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\nimport type {\n ZeptoMailHttpConfig,\n ZeptoMailConfig,\n ZeptoMailSendPayload,\n ZeptoMailAttachmentPayload,\n} from './types.js';\n\n/**\n * ZeptoMail (Zoho Mail transactional email HTTP API) transport adapter.\n *\n * Designed for zero dependencies and universal edge compatibility (Node.js, Bun, Deno, Cloudflare Workers)\n * by utilizing the standard global `fetch` API.\n */\nexport class ZeptoMailHttpSender implements IEmailSender {\n readonly name = 'zeptomail';\n\n private readonly apiUrl: string;\n private readonly authHeader: string;\n private readonly defaultFrom: { address: string; name?: string };\n private readonly fetchImpl: typeof fetch;\n\n constructor(config: ZeptoMailHttpConfig) {\n if (!config.apiToken || typeof config.apiToken !== 'string') {\n throw new ConfigurationError('ZeptoMailHttpSender: Missing or invalid apiToken.');\n }\n if (!config.from) {\n throw new ConfigurationError('ZeptoMailHttpSender: Missing required default from address.');\n }\n\n const host = (config.apiHost || 'api.zeptomail.com').replace(/^https?:\\/\\//, '').replace(/\\/+$/, '');\n this.apiUrl = `https://${host}/v1.1/email`;\n\n // Normalize auth token header. In ZeptoMail, if the user already included \"Zoho-enczapikey \", use as is; otherwise format standard header.\n const token = config.apiToken.trim();\n this.authHeader = token.startsWith('Zoho-') ? token : `Zoho-enczapikey ${token}`;\n\n this.defaultFrom = normalizeRecipient(config.from);\n if (!this.defaultFrom.address) {\n throw new ConfigurationError('ZeptoMailHttpSender: Configured from address must not be empty.');\n }\n\n this.fetchImpl = config.fetch ?? globalThis.fetch;\n if (typeof this.fetchImpl !== 'function') {\n throw new ConfigurationError(\n 'ZeptoMailHttpSender: No global fetch implementation found. Pass a custom fetch to ZeptoMailHttpConfig if running on Node < 18.'\n );\n }\n }\n\n /**\n * Dispatches an email using Zoho ZeptoMail API v1.1.\n */\n async send(options: SendMailOptions): Promise<SendResult> {\n const toRecipients = normalizeRecipients(options.to);\n if (toRecipients.length === 0) {\n throw new TransportError('ZeptoMailHttpSender: At least one recipient (to) must be specified.', {\n transportName: this.name,\n });\n }\n\n const resolvedFrom = options.from ? normalizeRecipient(options.from) : this.defaultFrom;\n\n const payload: ZeptoMailSendPayload = {\n from: {\n address: resolvedFrom.address,\n name: resolvedFrom.name,\n },\n to: toRecipients.map((r) => ({\n email_address: {\n address: r.address,\n name: r.name || '',\n },\n })),\n subject: options.subject,\n htmlbody: options.html,\n textbody: options.text,\n };\n\n if (options.cc) {\n const ccList = normalizeRecipients(options.cc);\n if (ccList.length > 0) {\n payload.cc = ccList.map((r) => ({\n email_address: { address: r.address, name: r.name || '' },\n }));\n }\n }\n\n if (options.bcc) {\n const bccList = normalizeRecipients(options.bcc);\n if (bccList.length > 0) {\n payload.bcc = bccList.map((r) => ({\n email_address: { address: r.address, name: r.name || '' },\n }));\n }\n }\n\n if (options.replyTo) {\n const replyToList = normalizeRecipients(options.replyTo);\n if (replyToList.length > 0) {\n payload.reply_to = replyToList.map((r) => ({\n address: r.address,\n name: r.name,\n }));\n }\n }\n\n if (options.attachments && options.attachments.length > 0) {\n payload.attachments = options.attachments.map((att): ZeptoMailAttachmentPayload => {\n let contentBase64: string;\n if (typeof att.content === 'string') {\n contentBase64 = att.content;\n } else {\n // Buffer or Uint8Array\n if (typeof Buffer !== 'undefined') {\n contentBase64 = Buffer.from(att.content).toString('base64');\n } else {\n // Browser / Edge fallback for Uint8Array\n let binary = '';\n const bytes = new Uint8Array(att.content);\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n contentBase64 = btoa(binary);\n }\n }\n\n return {\n name: att.filename,\n content: contentBase64,\n mime_type: att.mimeType || att.contentType || 'application/octet-stream',\n cid: att.cid,\n };\n });\n }\n\n let response: Response;\n try {\n response = await this.fetchImpl(this.apiUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: this.authHeader,\n },\n body: JSON.stringify(payload),\n });\n } catch (err) {\n throw new TransportError(`ZeptoMailHttpSender: Network request failed: ${err instanceof Error ? err.message : String(err)}`, {\n transportName: this.name,\n cause: err,\n });\n }\n\n const responseText = await response.text();\n let responseData: any;\n try {\n responseData = responseText ? JSON.parse(responseText) : {};\n } catch {\n responseData = { raw: responseText };\n }\n\n if (!response.ok) {\n const errorMessage =\n responseData?.error?.message ||\n responseData?.message ||\n `HTTP ${response.status}: ${responseText || response.statusText}`;\n\n throw new TransportError(`ZeptoMailHttpSender: Failed to send email - ${errorMessage}`, {\n transportName: this.name,\n statusCode: response.status,\n responseBody: responseText,\n });\n }\n\n // Extract message ID from standard ZeptoMail v1.1 response structure:\n // { data: [ { message_id: \"...\" } ] }\n const messageId = responseData?.data?.[0]?.message_id;\n\n return {\n success: true,\n messageId,\n response: responseData,\n };\n }\n\n /**\n * Backward-compatible helper method matching legacy signature:\n * `sendEmail(to, htmlBody, subject, toName?, plaintextBody?, fromName?)`\n * @deprecated Use `send({ to, subject, html, text, ... })` instead. This method will be removed in v1.0.0.\n */\n async sendEmail(\n to: string,\n htmlBody: string,\n subject: string,\n toName: string = '',\n plaintextBody?: string,\n fromName?: string\n ): Promise<void> {\n await this.send({\n to: { address: to, name: toName },\n from: fromName ? { address: this.defaultFrom.address, name: fromName } : this.defaultFrom,\n subject,\n html: htmlBody,\n text: plaintextBody,\n });\n }\n}\n\n/**\n * Backward-compatibility alias for `ZeptoMailHttpSender`.\n * @deprecated Use `ZeptoMailHttpSender` instead. This alias will be removed in v1.0.0.\n */\nexport const ZeptoMailSender = ZeptoMailHttpSender;\nexport type ZeptoMailSender = ZeptoMailHttpSender;\n","import type { SendMailOptions, SendResult } from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\n\n/**\n * In-memory email sender for automated testing, local development, and CI environments.\n * Captures all dispatched emails and provides inspection methods.\n */\nexport class MemoryEmailSender implements IEmailSender {\n readonly name = 'memory';\n\n private sentMails: SendMailOptions[] = [];\n private nextId = 1;\n\n async send(options: SendMailOptions): Promise<SendResult> {\n this.sentMails.push({ ...options });\n const messageId = `mem-${this.nextId++}-${Date.now()}`;\n return {\n success: true,\n messageId,\n response: { id: messageId },\n };\n }\n\n /**\n * Returns a copy of all emails sent through this transport instance.\n */\n getSentMails(): SendMailOptions[] {\n return [...this.sentMails];\n }\n\n /**\n * Returns the most recent email sent, or undefined if no emails have been sent.\n */\n getLastMail(): SendMailOptions | undefined {\n return this.sentMails.length > 0\n ? { ...this.sentMails[this.sentMails.length - 1] }\n : undefined;\n }\n\n /**\n * Clears all recorded sent emails.\n */\n clear(): void {\n this.sentMails = [];\n }\n\n /**\n * Returns the total count of sent emails.\n */\n count(): number {\n return this.sentMails.length;\n }\n}\n","import { normalizeRecipients, type SendMailOptions, type SendResult } from '../../core/types.js';\nimport type { IEmailSender } from '../sender.interface.js';\n\nexport interface ConsoleEmailSenderOptions {\n /**\n * Log level or custom log printer. Defaults to `console.log`.\n */\n logger?: (message: string) => void;\n /**\n * Whether to include the full HTML body in console output.\n * Defaults to false (prints plain text or a summary).\n */\n includeHtml?: boolean;\n}\n\n/**\n * Console logger transport that prints dispatched emails to stdout/stderr.\n * Ideal for development and debugging.\n */\nexport class ConsoleEmailSender implements IEmailSender {\n readonly name = 'console';\n\n private readonly log: (message: string) => void;\n private readonly includeHtml: boolean;\n private nextId = 1;\n\n constructor(options: ConsoleEmailSenderOptions = {}) {\n this.log = options.logger ?? console.log;\n this.includeHtml = options.includeHtml ?? false;\n }\n\n async send(options: SendMailOptions): Promise<SendResult> {\n const to = normalizeRecipients(options.to).map((r) => r.name ? `${r.name} <${r.address}>` : r.address).join(', ');\n const from = options.from ? JSON.stringify(options.from) : '(default)';\n const messageId = `console-${this.nextId++}-${Date.now()}`;\n\n const separator = '─'.repeat(60);\n const lines = [\n `\\n┌${separator}┐`,\n `│ [ts-mailkit:console] DISPATCHED EMAIL (${messageId})`,\n `├${separator}┤`,\n `│ From: ${from}`,\n `│ To: ${to}`,\n `│ Subject: ${options.subject}`,\n `├${separator}┤`,\n ];\n\n if (options.text) {\n lines.push('│ Text Body:');\n for (const line of options.text.split('\\n')) {\n lines.push(`│ ${line}`);\n }\n }\n\n if (this.includeHtml && options.html) {\n lines.push('│ HTML Body:');\n for (const line of options.html.split('\\n')) {\n lines.push(`│ ${line}`);\n }\n }\n\n lines.push(`└${separator}┘\\n`);\n\n this.log(lines.join('\\n'));\n\n return {\n success: true,\n messageId,\n response: { logged: true },\n };\n }\n}\n","import type { EmailTemplateDto } from './dto/index.js';\nimport { htmlToPlainText } from '../renderers/utils/html-to-plaintext.js';\n\nexport interface BrandingConfig {\n /**\n * Default brand, application, or company name.\n * @default 'Application'\n */\n brandName?: string;\n\n /**\n * Optional custom security / disclaimer advisory message.\n */\n securityMessage?: string;\n\n /**\n * Optional custom footer generator or string.\n */\n footer?: string | ((brandName: string) => string);\n\n /**\n * Optional default logo URL to display top-center in templated emails.\n */\n logoUrl?: string;\n}\n\nconst DEFAULT_SECURITY_MESSAGE =\n 'If you did not request this, please ignore this email or contact support if you have concerns.';\n\nfunction defaultFooter(brandName: string): string {\n return `© ${new Date().getFullYear()} ${brandName}. All rights reserved.`;\n}\n\n/**\n * Factory for creating pre-populated, type-safe email template DTOs.\n */\nexport class EmailTemplateFactory {\n private readonly defaultBrandName: string;\n private readonly defaultSecurityMessage: string;\n private readonly footerResolver: (brandName: string) => string;\n private readonly defaultLogoUrl?: string;\n\n constructor(config: BrandingConfig = {}) {\n this.defaultBrandName = config.brandName || 'Application';\n this.defaultSecurityMessage = config.securityMessage || DEFAULT_SECURITY_MESSAGE;\n this.defaultLogoUrl = config.logoUrl;\n if (typeof config.footer === 'function') {\n this.footerResolver = config.footer;\n } else if (typeof config.footer === 'string') {\n const fixedFooter = config.footer;\n this.footerResolver = () => fixedFooter;\n } else {\n this.footerResolver = defaultFooter;\n }\n }\n\n private resolveBrand(override?: string): string {\n return override || this.defaultBrandName;\n }\n\n private buildFooter(brandName: string): string {\n return this.footerResolver(brandName);\n }\n\n /**\n * Welcome / email-verification email sent after registration.\n */\n createEmailVerification(\n username: string,\n verificationUrl: string,\n otp: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Thank you for signing up. Use the code below or click the button to verify your email address.`;\n return {\n subject: 'Verify Your Email Address',\n header: `Welcome to ${brand}!`,\n body,\n logoUrl: this.defaultLogoUrl,\n otpCode: otp,\n actionUrl: verificationUrl,\n actionText: 'Verify Email',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage:\n htmlToPlainText(body) +\n `\\n\\nYour verification code is: ${otp}\\n\\nAlternatively, verify here:\\n${verificationUrl}`,\n };\n }\n\n /**\n * Password-reset email with an optional OTP code and action link.\n */\n createPasswordReset(\n username: string,\n resetUrl: string,\n otp: string = '',\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>We received a request to reset your password. Use the OTP code below or click the button to proceed.`;\n const plainTextOtp = otp ? `\\n\\nYour OTP code is: ${otp}` : '';\n return {\n subject: 'Password Reset Request',\n header: 'Reset Your Password',\n body,\n logoUrl: this.defaultLogoUrl,\n otpCode: otp || undefined,\n actionUrl: resetUrl,\n actionText: 'Reset Password',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage:\n htmlToPlainText(body) +\n plainTextOtp +\n `\\n\\nAlternatively, you can use the following link to reset your password:\\n${resetUrl}`,\n };\n }\n\n /**\n * Generic plain message email (no action button, no OTP).\n */\n createSimpleMessage(\n subject: string,\n header: string,\n body: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n return {\n subject,\n header,\n body,\n logoUrl: this.defaultLogoUrl,\n footer: this.buildFooter(brand),\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body),\n };\n }\n\n /**\n * Newsletter / announcement email with an optional hero image and CTA button.\n */\n createNewsLetter(\n subject: string,\n header: string,\n body: string,\n imageUrl?: string,\n actionUrl?: string,\n actionText?: string,\n brandName?: string,\n logoUrl?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n let noHtmlMessage = htmlToPlainText(body);\n if (actionUrl) {\n noHtmlMessage += `\\n\\n${actionText || 'Learn more'}: ${actionUrl}`;\n }\n return {\n subject,\n header,\n body,\n logoUrl: logoUrl || this.defaultLogoUrl,\n imageUrl,\n actionUrl,\n actionText,\n footer: this.buildFooter(brand),\n fromName: brand,\n noHtmlMessage,\n };\n }\n\n /**\n * Two-factor authentication email with OTP code and optional magic link.\n */\n create2FAEmail(\n username: string,\n otp: string,\n magicLink: string = '',\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Use the code below or click the button to complete your login.`;\n const plainLink = magicLink ? `\\n\\nAlternatively, verify here:\\n${magicLink}` : '';\n return {\n subject: 'Your Login Verification Code',\n header: 'Two-Factor Authentication',\n body,\n logoUrl: this.defaultLogoUrl,\n otpCode: otp,\n actionUrl: magicLink || undefined,\n actionText: magicLink ? 'Verify Login' : undefined,\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body) + `\\n\\nYour verification code is: ${otp}` + plainLink,\n };\n }\n\n /**\n * Magic link sign-in email (no OTP, button only).\n */\n createMagicLinkEmail(\n username: string,\n magicLink: string,\n brandName?: string\n ): EmailTemplateDto {\n const brand = this.resolveBrand(brandName);\n const body = `Hi ${username},<br/>Click the button below to sign in. No password needed.`;\n return {\n subject: 'Your Magic Link',\n header: `Sign In to ${brand}`,\n body,\n logoUrl: this.defaultLogoUrl,\n actionUrl: magicLink,\n actionText: 'Sign In',\n extraMessage: this.defaultSecurityMessage,\n footer: this.buildFooter(brand),\n userName: username,\n fromName: brand,\n noHtmlMessage: htmlToPlainText(body) + `\\n\\nSign in here:\\n${magicLink}`,\n };\n }\n\n // ─── Default Static Instance ──────────────────────────────────────────────\n private static _defaultInstance?: EmailTemplateFactory;\n\n private static get defaultInstance(): EmailTemplateFactory {\n if (!this._defaultInstance) {\n this._defaultInstance = new EmailTemplateFactory();\n }\n return this._defaultInstance;\n }\n\n static createEmailVerification(\n username: string,\n verificationUrl: string,\n otp: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createEmailVerification(username, verificationUrl, otp, brandName);\n }\n\n static createPasswordReset(\n username: string,\n resetUrl: string,\n otp?: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createPasswordReset(username, resetUrl, otp, brandName);\n }\n\n static createSimpleMessage(\n subject: string,\n header: string,\n body: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createSimpleMessage(subject, header, body, brandName);\n }\n\n static createNewsLetter(\n subject: string,\n header: string,\n body: string,\n imageUrl?: string,\n actionUrl?: string,\n actionText?: string,\n brandName?: string,\n logoUrl?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createNewsLetter(\n subject,\n header,\n body,\n imageUrl,\n actionUrl,\n actionText,\n brandName,\n logoUrl\n );\n }\n\n static create2FAEmail(\n username: string,\n otp: string,\n magicLink?: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.create2FAEmail(username, otp, magicLink, brandName);\n }\n\n static createMagicLinkEmail(\n username: string,\n magicLink: string,\n brandName?: string\n ): EmailTemplateDto {\n return this.defaultInstance.createMagicLinkEmail(username, magicLink, brandName);\n }\n}\n"],"mappings":";AAyBO,SAAS,kBAAkB,OAA6B;AAC7D,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,EAAE,SAAS,GAAG;AAAA,EACvB;AACA,QAAM,UAAU,MAAM,KAAK;AAC3B,QAAM,QAAQ,QAAQ,MAAM,uDAAuD;AACnF,MAAI,CAAC,OAAO;AACV,WAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B;AACA,SAAO;AAAA,IACL,SAAS,MAAM,CAAC,EAAE,KAAK;AAAA,IACvB,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK;AAAA,EAC5B;AACF;AAKO,SAAS,mBAAmB,WAAoC;AACrE,MA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@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EmailTemplateDto } from '../../templates/dto/index.js';
|
|
2
2
|
import type { IEmailRenderer, RenderedEmail } from '../renderer.interface.js';
|
|
3
3
|
export interface DefaultRendererOptions {
|
|
4
4
|
/**
|
|
@@ -16,21 +16,30 @@ export interface DefaultRendererOptions {
|
|
|
16
16
|
* @default '600px'
|
|
17
17
|
*/
|
|
18
18
|
maxWidth?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Default logo URL displayed at the top-center of the email if not provided in the DTO.
|
|
21
|
+
* Must be a valid http(s) URL.
|
|
22
|
+
*/
|
|
23
|
+
logoUrl?: string;
|
|
19
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Validates whether a string is a valid HTTP or HTTPS URL.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isValidHttpUrl(urlString?: string): boolean;
|
|
20
29
|
/**
|
|
21
30
|
* Builds a plain-text fallback string from an email DTO.
|
|
22
31
|
*/
|
|
23
|
-
export declare function buildPlainText(dto:
|
|
32
|
+
export declare function buildPlainText(dto: EmailTemplateDto): string;
|
|
24
33
|
/**
|
|
25
34
|
* Builds a responsive, styled HTML email document from an email DTO.
|
|
26
35
|
*/
|
|
27
|
-
export declare function buildHtml(dto:
|
|
36
|
+
export declare function buildHtml(dto: EmailTemplateDto, options?: DefaultRendererOptions): string;
|
|
28
37
|
/**
|
|
29
38
|
* Default HTML and plain-text email renderer for ts-mailkit.
|
|
30
39
|
*/
|
|
31
40
|
export declare class DefaultEmailRenderer implements IEmailRenderer {
|
|
32
41
|
private readonly options;
|
|
33
42
|
constructor(options?: DefaultRendererOptions);
|
|
34
|
-
render(dto:
|
|
43
|
+
render(dto: EmailTemplateDto): RenderedEmail;
|
|
35
44
|
}
|
|
36
45
|
//# sourceMappingURL=default-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-renderer.d.ts","sourceRoot":"","sources":["../../../src/renderers/default/default-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"default-renderer.d.ts","sourceRoot":"","sources":["../../../src/renderers/default/default-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9E,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAiC5D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA6E7F;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,OAAO,GAAE,sBAA2B;IAIhD,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa;CAM7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EmailTemplateDto } from '../templates/dto/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Output of an email rendering process.
|
|
4
4
|
*/
|
|
@@ -9,7 +9,7 @@ export interface RenderedEmail {
|
|
|
9
9
|
/**
|
|
10
10
|
* Contract for email rendering engines (default HTML template, React Email, MJML, Handlebars, etc.).
|
|
11
11
|
*/
|
|
12
|
-
export interface IEmailRenderer<TDto extends
|
|
12
|
+
export interface IEmailRenderer<TDto extends EmailTemplateDto = EmailTemplateDto> {
|
|
13
13
|
/**
|
|
14
14
|
* Renders an email DTO into an HTML string and plain-text fallback string.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.interface.d.ts","sourceRoot":"","sources":["../../src/renderers/renderer.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"renderer.interface.d.ts","sourceRoot":"","sources":["../../src/renderers/renderer.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,IAAI,SAAS,gBAAgB,GAAG,gBAAgB;IAC9E;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;CAC3D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Compatible with the legacy EmailTemplateDto while allowing typed extensions.
|
|
2
|
+
* Data Transfer Object for templated emails.
|
|
4
3
|
*/
|
|
5
|
-
export interface
|
|
4
|
+
export interface EmailTemplateDto {
|
|
6
5
|
/** Email subject line */
|
|
7
6
|
subject: string;
|
|
7
|
+
/** Optional logo URL displayed top-center in the email. Must be a valid http(s) URL. */
|
|
8
|
+
logoUrl?: string;
|
|
8
9
|
/** Primary headline/header in the email content */
|
|
9
10
|
header?: string;
|
|
10
11
|
/** Optional hero image URL displayed at the top */
|
|
@@ -31,9 +32,9 @@ export interface BaseEmailDto {
|
|
|
31
32
|
metadata?: Record<string, unknown>;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* @deprecated Use `EmailTemplateDto` instead. This alias will be removed in v1.0.0.
|
|
35
36
|
*/
|
|
36
|
-
export type
|
|
37
|
+
export type BaseEmailDto = EmailTemplateDto;
|
|
37
38
|
/**
|
|
38
39
|
* Parameters for creating an email verification message.
|
|
39
40
|
*/
|
|
@@ -43,6 +44,7 @@ export interface EmailVerificationParams {
|
|
|
43
44
|
otp: string;
|
|
44
45
|
brandName?: string;
|
|
45
46
|
extraMessage?: string;
|
|
47
|
+
logoUrl?: string;
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
50
|
* Parameters for creating a password reset message.
|
|
@@ -53,6 +55,7 @@ export interface PasswordResetParams {
|
|
|
53
55
|
otp?: string;
|
|
54
56
|
brandName?: string;
|
|
55
57
|
extraMessage?: string;
|
|
58
|
+
logoUrl?: string;
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Parameters for creating a 2FA code message.
|
|
@@ -63,6 +66,7 @@ export interface TwoFactorParams {
|
|
|
63
66
|
magicLink?: string;
|
|
64
67
|
brandName?: string;
|
|
65
68
|
extraMessage?: string;
|
|
69
|
+
logoUrl?: string;
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
68
72
|
* Parameters for creating a magic link sign-in message.
|
|
@@ -72,6 +76,7 @@ export interface MagicLinkParams {
|
|
|
72
76
|
magicLink: string;
|
|
73
77
|
brandName?: string;
|
|
74
78
|
extraMessage?: string;
|
|
79
|
+
logoUrl?: string;
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
82
|
* Parameters for creating a newsletter or announcement message.
|
|
@@ -80,6 +85,7 @@ export interface NewsletterParams {
|
|
|
80
85
|
subject: string;
|
|
81
86
|
header: string;
|
|
82
87
|
body: string;
|
|
88
|
+
logoUrl?: string;
|
|
83
89
|
imageUrl?: string;
|
|
84
90
|
actionUrl?: string;
|
|
85
91
|
actionText?: string;
|
|
@@ -95,5 +101,6 @@ export interface SimpleMessageParams {
|
|
|
95
101
|
body: string;
|
|
96
102
|
brandName?: string;
|
|
97
103
|
footer?: string;
|
|
104
|
+
logoUrl?: string;
|
|
98
105
|
}
|
|
99
106
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/dto/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/dto/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM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,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -13,6 +13,10 @@ export interface BrandingConfig {
|
|
|
13
13
|
* Optional custom footer generator or string.
|
|
14
14
|
*/
|
|
15
15
|
footer?: string | ((brandName: string) => string);
|
|
16
|
+
/**
|
|
17
|
+
* Optional default logo URL to display top-center in templated emails.
|
|
18
|
+
*/
|
|
19
|
+
logoUrl?: string;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* Factory for creating pre-populated, type-safe email template DTOs.
|
|
@@ -21,6 +25,7 @@ export declare class EmailTemplateFactory {
|
|
|
21
25
|
private readonly defaultBrandName;
|
|
22
26
|
private readonly defaultSecurityMessage;
|
|
23
27
|
private readonly footerResolver;
|
|
28
|
+
private readonly defaultLogoUrl?;
|
|
24
29
|
constructor(config?: BrandingConfig);
|
|
25
30
|
private resolveBrand;
|
|
26
31
|
private buildFooter;
|
|
@@ -39,7 +44,7 @@ export declare class EmailTemplateFactory {
|
|
|
39
44
|
/**
|
|
40
45
|
* Newsletter / announcement email with an optional hero image and CTA button.
|
|
41
46
|
*/
|
|
42
|
-
createNewsLetter(subject: string, header: string, body: string, imageUrl?: string, actionUrl?: string, actionText?: string, brandName?: string): EmailTemplateDto;
|
|
47
|
+
createNewsLetter(subject: string, header: string, body: string, imageUrl?: string, actionUrl?: string, actionText?: string, brandName?: string, logoUrl?: string): EmailTemplateDto;
|
|
43
48
|
/**
|
|
44
49
|
* Two-factor authentication email with OTP code and optional magic link.
|
|
45
50
|
*/
|
|
@@ -53,7 +58,7 @@ export declare class EmailTemplateFactory {
|
|
|
53
58
|
static createEmailVerification(username: string, verificationUrl: string, otp: string, brandName?: string): EmailTemplateDto;
|
|
54
59
|
static createPasswordReset(username: string, resetUrl: string, otp?: string, brandName?: string): EmailTemplateDto;
|
|
55
60
|
static createSimpleMessage(subject: string, header: string, body: string, brandName?: string): EmailTemplateDto;
|
|
56
|
-
static createNewsLetter(subject: string, header: string, body: string, imageUrl?: string, actionUrl?: string, actionText?: string, brandName?: string): EmailTemplateDto;
|
|
61
|
+
static createNewsLetter(subject: string, header: string, body: string, imageUrl?: string, actionUrl?: string, actionText?: string, brandName?: string, logoUrl?: string): EmailTemplateDto;
|
|
57
62
|
static create2FAEmail(username: string, otp: string, magicLink?: string, brandName?: string): EmailTemplateDto;
|
|
58
63
|
static createMagicLinkEmail(username: string, magicLink: string, brandName?: string): EmailTemplateDto;
|
|
59
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/templates/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/templates/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAElD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AASD;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAS;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgC;IAC/D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;gBAE7B,M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SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;IAInB,MAAM,CAAC,mBAAmB,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;IAInB,MAAM,CAAC,mBAAmB,CACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;IAInB,MAAM,CAAC,gBAAgB,CACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,gBAAgB;IAanB,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;IAInB,MAAM,CAAC,oBAAoB,CACzB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;CAGpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Recipient } from '../../core/types.js';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ZeptoMailHttpConfig {
|
|
3
3
|
/**
|
|
4
4
|
* Zoho ZeptoMail API host domain.
|
|
5
5
|
* Examples: 'api.zeptomail.com', 'api.zeptomail.eu', 'api.zeptomail.in'
|
|
@@ -20,6 +20,11 @@ export interface ZeptoMailConfig {
|
|
|
20
20
|
*/
|
|
21
21
|
fetch?: typeof fetch;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for ZeptoMailHttpSender.
|
|
25
|
+
* @deprecated Use `ZeptoMailHttpConfig` instead. This alias will be removed in v1.0.0.
|
|
26
|
+
*/
|
|
27
|
+
export type ZeptoMailConfig = ZeptoMailHttpConfig;
|
|
23
28
|
export interface ZeptoMailAddressObject {
|
|
24
29
|
address: string;
|
|
25
30
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transports/zeptomail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transports/zeptomail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,EAAE,EAAE,yBAAyB,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACjC,GAAG,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,0BAA0B,EAAE,CAAC;CAC5C"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type SendMailOptions, type SendResult } from '../../core/types.js';
|
|
2
2
|
import type { IEmailSender } from '../sender.interface.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZeptoMailHttpConfig } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
* ZeptoMail (Zoho Mail transactional email API) transport adapter.
|
|
5
|
+
* ZeptoMail (Zoho Mail transactional email HTTP API) transport adapter.
|
|
6
6
|
*
|
|
7
7
|
* Designed for zero dependencies and universal edge compatibility (Node.js, Bun, Deno, Cloudflare Workers)
|
|
8
8
|
* by utilizing the standard global `fetch` API.
|
|
9
9
|
*/
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class ZeptoMailHttpSender implements IEmailSender {
|
|
11
11
|
readonly name = "zeptomail";
|
|
12
12
|
private readonly apiUrl;
|
|
13
13
|
private readonly authHeader;
|
|
14
14
|
private readonly defaultFrom;
|
|
15
15
|
private readonly fetchImpl;
|
|
16
|
-
constructor(config:
|
|
16
|
+
constructor(config: ZeptoMailHttpConfig);
|
|
17
17
|
/**
|
|
18
18
|
* Dispatches an email using Zoho ZeptoMail API v1.1.
|
|
19
19
|
*/
|
|
@@ -21,7 +21,14 @@ export declare class ZeptoMailSender implements IEmailSender {
|
|
|
21
21
|
/**
|
|
22
22
|
* Backward-compatible helper method matching legacy signature:
|
|
23
23
|
* `sendEmail(to, htmlBody, subject, toName?, plaintextBody?, fromName?)`
|
|
24
|
+
* @deprecated Use `send({ to, subject, html, text, ... })` instead. This method will be removed in v1.0.0.
|
|
24
25
|
*/
|
|
25
26
|
sendEmail(to: string, htmlBody: string, subject: string, toName?: string, plaintextBody?: string, fromName?: string): Promise<void>;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Backward-compatibility alias for `ZeptoMailHttpSender`.
|
|
30
|
+
* @deprecated Use `ZeptoMailHttpSender` instead. This alias will be removed in v1.0.0.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ZeptoMailSender: typeof ZeptoMailHttpSender;
|
|
33
|
+
export type ZeptoMailSender = ZeptoMailHttpSender;
|
|
27
34
|
//# sourceMappingURL=zeptomail-sender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zeptomail-sender.d.ts","sourceRoot":"","sources":["../../../src/transports/zeptomail/zeptomail-sender.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"zeptomail-sender.d.ts","sourceRoot":"","sources":["../../../src/transports/zeptomail/zeptomail-sender.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EAIpB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IACtD,QAAQ,CAAC,IAAI,eAAe;IAE5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACjE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAE7B,MAAM,EAAE,mBAAmB;IA4BvC;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAqIzD;;;;OAIG;IACG,SAAS,CACb,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAW,EACnB,aAAa,CAAC,EAAE,MAAM,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;CASjB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,4BAAsB,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-mailkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Strictly typed, modular, and composable email composition and dispatch library for TypeScript and modern edge runtimes.",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -18,6 +18,14 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"packageManager": "pnpm@11.22.0",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/AD-RIAN-Studio/ts-mailkit.git"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/AD-RIAN-Studio/ts-mailkit/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/AD-RIAN-Studio/ts-mailkit#readme",
|
|
21
29
|
"files": [
|
|
22
30
|
"dist",
|
|
23
31
|
"README.md"
|
|
@@ -42,7 +50,7 @@
|
|
|
42
50
|
"edge",
|
|
43
51
|
"workerd"
|
|
44
52
|
],
|
|
45
|
-
"author": "",
|
|
53
|
+
"author": "AD-RIAN Studio",
|
|
46
54
|
"license": "MIT",
|
|
47
55
|
"devDependencies": {
|
|
48
56
|
"@types/node": "^26.1.1",
|