@orieljs/mail 0.1.0-alpha.4 → 0.1.0-alpha.6

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/NOTICE CHANGED
@@ -7,3 +7,6 @@ This product includes software developed by the Oriel project
7
7
  Oriel is licensed under the Apache License, Version 2.0 (see LICENSE).
8
8
  The Oriel name and logo are not covered by that license; see TRADEMARKS.md
9
9
  (https://github.com/orieljs/framework/blob/main/TRADEMARKS.md).
10
+
11
+ @orieljs/support (and @orieljs/framework, which bundles it) includes transliteration data from
12
+ voku/portable-ascii (https://github.com/voku/portable-ascii), Copyright (C) 2019 Lars Moelleken, MIT License.
package/dist/index.d.ts CHANGED
@@ -163,8 +163,8 @@ declare class MailerImpl implements Mailer {
163
163
  /**
164
164
  * Internal-only token. `SendQueuedMailable.handle()` runs on the worker, where the mailable's ShouldQueue fields
165
165
  * are still set — calling the public `Mailer.send()` there would re-detect it as queueable and dispatch it again,
166
- * forever. `MailServiceProvider` binds this to the *same* MailManager instance as the public `MailManager` token,
167
- * so `sendNow()` here always delivers immediately.
166
+ * forever. `MailServiceProvider` binds this to the MailManager's mailers, so `sendNow()` here always delivers
167
+ * immediately, through the mailer the job names and with the recipients PendingMail gave.
168
168
  */
169
169
  interface QueuedMailSender {
170
170
  sendNow(mailerName: string | undefined, mailable: Mailable$1, overrides?: RecipientOverrides): Promise<SentMessage>;
@@ -205,7 +205,7 @@ declare class SendQueuedMailable implements Job {
205
205
  }
206
206
 
207
207
  type TransportFactory = (config: Record<string, unknown>) => MailTransport;
208
- declare class MailManager implements MailManager$1, QueuedMailSender {
208
+ declare class MailManager implements MailManager$1 {
209
209
  private readonly container;
210
210
  private readonly mailers;
211
211
  private readonly drivers;
@@ -216,8 +216,8 @@ declare class MailManager implements MailManager$1, QueuedMailSender {
216
216
  to(recipients: MailRecipient | MailRecipient[]): PendingMail;
217
217
  send(mailable: Mailable$1): Promise<SentMessage | undefined>;
218
218
  queue(mailable: Mailable$1): Promise<void>;
219
- /** QueuedMailSender: always delivers immediately (see QueuedMailSender.ts for why this must bypass send()). */
220
- sendNow(mailerName: string | undefined, mailable: Mailable$1, overrides?: RecipientOverrides): Promise<SentMessage>;
219
+ /** Sends through the default mailer at once, even when the mailable is queueable (Laravel's Mail::sendNow()). */
220
+ sendNow(mailable: Mailable$1): Promise<SentMessage>;
221
221
  extend(transport: string, factory: TransportFactory): void;
222
222
  }
223
223
 
package/dist/index.js CHANGED
@@ -259,7 +259,7 @@ import {
259
259
  import { currentContainer as currentContainer3 } from "@orieljs/container";
260
260
  function isQueueableMailable(mailable) {
261
261
  const record = mailable;
262
- if (record[SHOULD_QUEUE] === true) return true;
262
+ if (record.shouldQueue === true || record[SHOULD_QUEUE] === true) return true;
263
263
  return record.connection !== void 0 || record.queue !== void 0 || record.delay !== void 0 || record.tries !== void 0 || record.backoff !== void 0 || record.timeout !== void 0 || typeof record.uniqueId === "function" || typeof record.retryUntil === "function";
264
264
  }
265
265
  var MailerImpl = class {
@@ -348,6 +348,9 @@ var PendingMail = class {
348
348
  async send(mailable) {
349
349
  return this.mailer.send(mailable, this.overrides());
350
350
  }
351
+ async sendNow(mailable) {
352
+ return this.mailer.sendNow(mailable, this.overrides());
353
+ }
351
354
  async queue(mailable) {
352
355
  await this.mailer.queue(mailable, this.overrides());
353
356
  }
@@ -482,9 +485,9 @@ var MailManager = class {
482
485
  async queue(mailable) {
483
486
  await this.mailer().queue(mailable);
484
487
  }
485
- /** QueuedMailSender: always delivers immediately (see QueuedMailSender.ts for why this must bypass send()). */
486
- async sendNow(mailerName, mailable, overrides) {
487
- return this.mailer(mailerName).sendNow(mailable, overrides);
488
+ /** Sends through the default mailer at once, even when the mailable is queueable (Laravel's Mail::sendNow()). */
489
+ async sendNow(mailable) {
490
+ return this.mailer().sendNow(mailable);
488
491
  }
489
492
  extend(transport, factory) {
490
493
  this.drivers.set(transport, factory);
@@ -515,7 +518,10 @@ var MailServiceProvider = class extends ServiceProvider {
515
518
  "mail"
516
519
  );
517
520
  this.app.singleton(MailManagerToken2, (container) => new MailManager(container));
518
- this.app.singleton(QueuedMailSender, (container) => container.make(MailManagerToken2));
521
+ this.app.singleton(QueuedMailSender, (container) => {
522
+ const manager = container.make(MailManagerToken2);
523
+ return { sendNow: (mailerName, mailable, overrides) => manager.mailer(mailerName).sendNow(mailable, overrides) };
524
+ });
519
525
  this.app.make(ClassRegistryToken).register(SendQueuedMailable, "Mail.SendQueuedMailable");
520
526
  }
521
527
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../errors.ts","../address.ts","../transports/ArrayTransport.ts","../transports/LogTransport.ts","../transports/FailoverTransport.ts","../transports/SmtpTransport.ts","../render.ts","../Mailable.ts","../symbols.ts","../Mailer.ts","../QueuedMailSender.ts","../Jobs/SendQueuedMailable.ts","../MailManager.ts","../facade.ts","../MailServiceProvider.ts"],"sourcesContent":["import type { OrielError } from '@orieljs/contracts'\n\nexport class UnknownMailerError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'UnknownMailerError'\n constructor(name: string) {\n super(`Mailer [${name}] is not configured. Add it to config('mail.mailers').`)\n }\n}\n\nexport class UnknownMailTransportError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'UnknownMailTransportError'\n constructor(transport: string) {\n super(`Mail transport [${transport}] is not supported. Register it first with MailManager.extend().`)\n }\n}\n\nexport class MissingRecipientError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'MissingRecipientError'\n constructor() {\n super('Cannot send mail: no recipients. Set envelope().to, or call Mail.to(...).send(mailable).')\n }\n}\n\nexport class MailQueueUnavailableError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'MailQueueUnavailableError'\n constructor() {\n super('Queueing mail requires the Bus component. Register BusDispatcher, or call send() instead of queue()/later().')\n }\n}\n\nexport class ViewFactoryUnavailableError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'ViewFactoryUnavailableError'\n constructor(view: string) {\n super(`Cannot render the [${view}] mail view: the View component isn't registered (ViewFactory is unbound).`)\n }\n}\n\nexport class AllMailersFailedError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'AllMailersFailedError'\n constructor(\n readonly mailers: string[],\n readonly causes: unknown[],\n ) {\n super(`All failover mailers failed: ${mailers.join(', ')}. Last error: ${String(causes.at(-1))}`, {\n cause: causes.at(-1),\n })\n }\n}\n","import type { Address, MailRecipient } from '@orieljs/contracts'\n\n/** A MailRecipient is a bare string, an Address, or anything with `email` (+ optional `name`), such as a User model. */\nexport function normalizeAddress(recipient: MailRecipient): Address {\n if (typeof recipient === 'string') return { address: recipient }\n if ('address' in recipient) return { address: recipient.address, name: recipient.name }\n return { address: recipient.email, name: recipient.name }\n}\n\nexport function normalizeAddresses(recipients: MailRecipient | MailRecipient[] | undefined): Address[] {\n if (recipients === undefined) return []\n const list = Array.isArray(recipients) ? recipients : [recipients]\n return list.map(normalizeAddress)\n}\n\nexport function formatAddress(address: Address): string {\n return address.name ? `${address.name} <${address.address}>` : address.address\n}\n","import { randomUUID } from 'node:crypto'\nimport type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\n\n/** In-memory transport backing the `array` mailer: never leaves the process, so tests can inspect `sent`. */\nexport class ArrayTransport implements MailTransport {\n readonly sent: OutgoingMessage[] = []\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n this.sent.push(message)\n return { messageId: randomUUID(), message }\n }\n\n flush(): void {\n this.sent.length = 0\n }\n}\n","import { randomUUID } from 'node:crypto'\nimport { LogManager as LogManagerToken, type MailTransport, type OutgoingMessage, type SentMessage } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { formatAddress } from '../address'\n\n/** Writes the message through LogManager (a channel from config, or the default channel) when bound, else console.log. */\nexport class LogTransport implements MailTransport {\n constructor(private readonly channel?: string) {}\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const dump = formatMessage(message)\n const container = currentContainer()\n if (container?.bound(LogManagerToken)) {\n const manager = container.make(LogManagerToken)\n const logger = this.channel ? manager.channel(this.channel) : manager\n logger.info(dump)\n } else {\n console.log(dump)\n }\n return { messageId: randomUUID(), message }\n }\n}\n\nfunction formatMessage(message: OutgoingMessage): string {\n const lines = [\n `To: ${message.to.map(formatAddress).join(', ')}`,\n message.cc.length > 0 ? `Cc: ${message.cc.map(formatAddress).join(', ')}` : undefined,\n message.bcc.length > 0 ? `Bcc: ${message.bcc.map(formatAddress).join(', ')}` : undefined,\n `From: ${formatAddress(message.from)}`,\n `Subject: ${message.subject}`,\n '',\n message.text ?? stripHtml(message.html ?? ''),\n ]\n return lines.filter((line): line is string => line !== undefined).join('\\n')\n}\n\nfunction stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, '')\n}\n","import type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\nimport { AllMailersFailedError } from '../errors'\n\n/** Tries each transport in order, returning the first success (Laravel's `failover` mailer). */\nexport class FailoverTransport implements MailTransport {\n constructor(\n private readonly transports: MailTransport[],\n private readonly names: string[],\n ) {}\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const causes: unknown[] = []\n for (const transport of this.transports) {\n try {\n return await transport.send(message)\n } catch (error) {\n causes.push(error)\n }\n }\n throw new AllMailersFailedError(this.names, causes)\n }\n}\n","import nodemailer from 'nodemailer'\nimport type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\nimport { formatAddress } from '../address'\n\nexport interface SmtpConfig {\n host: string\n port: number\n encryption?: 'tls' | 'ssl' | null\n username?: string\n password?: string\n}\n\n/** The minimal nodemailer surface this transport needs — lets tests inject a fake without a real Transporter. */\nexport interface MailTransporter {\n sendMail(options: Record<string, unknown>): Promise<{ messageId: string }>\n}\n\nexport type TransporterFactory = (config: SmtpConfig) => MailTransporter\n\nconst defaultFactory: TransporterFactory = (config) =>\n nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.encryption === 'ssl',\n requireTLS: config.encryption === 'tls',\n auth: config.username ? { user: config.username, pass: config.password } : undefined,\n })\n\nexport class SmtpTransport implements MailTransport {\n private readonly transporter: MailTransporter\n\n constructor(config: SmtpConfig, factory: TransporterFactory = defaultFactory) {\n this.transporter = factory(config)\n }\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const info = await this.transporter.sendMail({\n from: formatAddress(message.from),\n to: message.to.map(formatAddress),\n cc: message.cc.length > 0 ? message.cc.map(formatAddress) : undefined,\n bcc: message.bcc.length > 0 ? message.bcc.map(formatAddress) : undefined,\n replyTo: message.replyTo.length > 0 ? message.replyTo.map(formatAddress) : undefined,\n subject: message.subject,\n html: message.html,\n text: message.text,\n headers: message.headers,\n attachments: message.attachments.map((attachment) => ({\n filename: attachment.name,\n path: attachment.path,\n content: attachment.data,\n contentType: attachment.mime,\n })),\n })\n return { messageId: info.messageId, message }\n }\n}\n","import { ViewFactory as ViewFactoryToken, type Content } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { ViewFactoryUnavailableError } from './errors'\n\nexport interface RenderedContent {\n html?: string\n text?: string\n}\n\n/**\n * Renders a Mailable's content() into transport-ready HTML/text. A `view`/`text` name is resolved through\n * ViewFactory (TSX); `htmlString`/`textString` are used as-is, with no View involved at all.\n */\nexport async function renderContent(content: Content): Promise<RenderedContent> {\n const html = content.view !== undefined ? await renderView(content.view, content.with) : content.htmlString\n const text = content.text !== undefined ? await renderView(content.text, content.with) : content.textString\n return { html, text }\n}\n\nasync function renderView(view: string, data: Record<string, unknown> | undefined): Promise<string> {\n const container = currentContainer()\n if (!container?.bound(ViewFactoryToken)) throw new ViewFactoryUnavailableError(view)\n return container.make(ViewFactoryToken).make(view, data).render()\n}\n","import type { Attachment, Content, Envelope, MailRecipient, Mailable as MailableContract } from '@orieljs/contracts'\n\n/**\n * Laravel-style Mailable. New code overrides envelope()/content()/attachments() directly. Legacy (pre-Laravel-9)\n * code overrides build() instead, and calls the fluent subject()/view()/text()/html()/from()/with()/attach()\n * methods, which feed the default envelope()/content()/attachments() below. build() runs at most once.\n */\nexport abstract class Mailable implements MailableContract {\n protected mailSubject?: string\n protected mailView?: string\n protected mailTextView?: string\n protected mailHtml?: string\n protected mailFrom?: MailRecipient\n protected mailData: Record<string, unknown> = {}\n protected mailAttachments: Attachment[] = []\n private built = false\n\n /** Legacy hook: override this and call the fluent methods below instead of envelope()/content()/attachments(). */\n build?(): void | Promise<void>\n\n subject(subject: string): this {\n this.mailSubject = subject\n return this\n }\n\n view(view: string): this {\n this.mailView = view\n return this\n }\n\n text(view: string): this {\n this.mailTextView = view\n return this\n }\n\n html(html: string): this {\n this.mailHtml = html\n return this\n }\n\n from(address: MailRecipient): this {\n this.mailFrom = address\n return this\n }\n\n with(key: string | Record<string, unknown>, value?: unknown): this {\n if (typeof key === 'string') this.mailData[key] = value\n else Object.assign(this.mailData, key)\n return this\n }\n\n attach(attachment: Attachment): this {\n this.mailAttachments.push(attachment)\n return this\n }\n\n private async ensureBuilt(): Promise<void> {\n if (this.built) return\n this.built = true\n await this.build?.()\n }\n\n async envelope(): Promise<Envelope> {\n await this.ensureBuilt()\n return { subject: this.mailSubject, from: this.mailFrom }\n }\n\n async content(): Promise<Content> {\n await this.ensureBuilt()\n return { view: this.mailView, text: this.mailTextView, htmlString: this.mailHtml, with: this.mailData }\n }\n\n async attachments(): Promise<Attachment[]> {\n await this.ensureBuilt()\n return this.mailAttachments\n }\n}\n","/**\n * The Queue/Bus protocol's shared marker (the \"Queue/Bus protocol\" section of the Queue/Bus design notes):\n * `Symbol.for('oriel:bus.shouldQueue')` is a *global* registry key, so `Symbol.for` called here returns the\n * literal same runtime symbol Bus's `Queueable` base class and `isQueueable()` use — genuinely shared state, with\n * no import needed (and none allowed: Mail can't import `@orieljs/bus`).\n */\nexport const SHOULD_QUEUE: unique symbol = Symbol.for('oriel:bus.shouldQueue')\n","import {\n BusDispatcher as BusDispatcherToken,\n type Address,\n type Job,\n type Mailable,\n type MailRecipient,\n type Mailer as MailerContract,\n type MailTransport,\n type OutgoingMessage,\n type PendingMail as PendingMailContract,\n type SentMessage,\n} from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { normalizeAddress, normalizeAddresses } from './address'\nimport { MailQueueUnavailableError, MissingRecipientError } from './errors'\nimport { renderContent } from './render'\nimport { SHOULD_QUEUE } from './symbols'\n\nexport interface RecipientOverrides {\n to?: Address[]\n cc?: Address[]\n bcc?: Address[]\n}\n\n/** Builds the queue job for a mailable. Decoupled from the concrete SendQueuedMailable class so this\n * file has no forward reference to it, and so tests can inject a fake job. */\nexport type QueuedMailableFactory = (\n mailerName: string | undefined,\n mailable: Mailable,\n overrides?: RecipientOverrides,\n) => Job\n\n/**\n * Matches the Queue/Bus protocol's `isQueueable()` exactly: true when the mailable carries\n * `SHOULD_QUEUE === true`, or has a defined value for any of ShouldQueue's fields, or declares a\n * `uniqueId()`/`retryUntil()` method. `implements ShouldQueue` itself leaves no trace at runtime. Call\n * queue()/later() explicitly to queue a mailable that declares none of these.\n */\nfunction isQueueableMailable(mailable: Mailable): boolean {\n const record = mailable as unknown as Record<PropertyKey, unknown>\n if (record[SHOULD_QUEUE] === true) return true\n return (\n record.connection !== undefined ||\n record.queue !== undefined ||\n record.delay !== undefined ||\n record.tries !== undefined ||\n record.backoff !== undefined ||\n record.timeout !== undefined ||\n typeof record.uniqueId === 'function' ||\n typeof record.retryUntil === 'function'\n )\n}\n\nexport class MailerImpl implements MailerContract {\n constructor(\n private readonly name: string,\n private readonly transport: MailTransport,\n private readonly defaultFrom: Address | undefined,\n private readonly makeQueuedJob: QueuedMailableFactory,\n ) {}\n\n to(recipients: MailRecipient | MailRecipient[]): PendingMailContract {\n return new PendingMail(this, normalizeAddresses(recipients))\n }\n\n async send(mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage | undefined> {\n if (isQueueableMailable(mailable)) {\n await this.queue(mailable, overrides)\n return undefined\n }\n return this.sendNow(mailable, overrides)\n }\n\n async queue(mailable: Mailable, overrides?: RecipientOverrides): Promise<void> {\n await this.dispatch(this.makeQueuedJob(this.name, mailable, overrides))\n }\n\n async later(delaySeconds: number, mailable: Mailable, overrides?: RecipientOverrides): Promise<void> {\n const job = this.makeQueuedJob(this.name, mailable, overrides)\n job.delay = delaySeconds\n await this.dispatch(job)\n }\n\n private async dispatch(job: Job): Promise<void> {\n const container = currentContainer()\n if (!container?.bound(BusDispatcherToken)) throw new MailQueueUnavailableError()\n await container.make(BusDispatcherToken).dispatch(job)\n }\n\n /** Renders and delivers immediately, bypassing the queueable check. Used by send() and by the queued job's\n * handle(), once it's already running on the worker. */\n async sendNow(mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage> {\n const envelope = await mailable.envelope()\n const to = overrides?.to && overrides.to.length > 0 ? overrides.to : normalizeAddresses(envelope.to)\n if (to.length === 0) throw new MissingRecipientError()\n const cc = [...normalizeAddresses(envelope.cc), ...(overrides?.cc ?? [])]\n const bcc = [...normalizeAddresses(envelope.bcc), ...(overrides?.bcc ?? [])]\n const replyTo = normalizeAddresses(envelope.replyTo)\n const from = envelope.from ? normalizeAddress(envelope.from) : this.defaultFrom\n if (!from) throw new MissingRecipientError()\n const content = await mailable.content()\n const rendered = await renderContent(content)\n const attachments = (await mailable.attachments?.()) ?? []\n const message: OutgoingMessage = {\n from,\n to,\n cc,\n bcc,\n replyTo,\n subject: envelope.subject ?? '',\n html: rendered.html,\n text: rendered.text,\n attachments,\n headers: {},\n }\n return this.transport.send(message)\n }\n}\n\nclass PendingMail implements PendingMailContract {\n private readonly ccList: Address[] = []\n private readonly bccList: Address[] = []\n\n constructor(\n private readonly mailer: MailerImpl,\n private readonly toList: Address[],\n ) {}\n\n cc(recipients: MailRecipient | MailRecipient[]): this {\n this.ccList.push(...normalizeAddresses(recipients))\n return this\n }\n\n bcc(recipients: MailRecipient | MailRecipient[]): this {\n this.bccList.push(...normalizeAddresses(recipients))\n return this\n }\n\n private overrides(): RecipientOverrides {\n return { to: this.toList, cc: this.ccList, bcc: this.bccList }\n }\n\n async send(mailable: Mailable): Promise<SentMessage | undefined> {\n return this.mailer.send(mailable, this.overrides())\n }\n\n async queue(mailable: Mailable): Promise<void> {\n await this.mailer.queue(mailable, this.overrides())\n }\n\n async later(delaySeconds: number, mailable: Mailable): Promise<void> {\n await this.mailer.later(delaySeconds, mailable, this.overrides())\n }\n}\n","import { token, type Mailable, type SentMessage } from '@orieljs/contracts'\nimport type { RecipientOverrides } from './Mailer'\n\n/**\n * Internal-only token. `SendQueuedMailable.handle()` runs on the worker, where the mailable's ShouldQueue fields\n * are still set — calling the public `Mailer.send()` there would re-detect it as queueable and dispatch it again,\n * forever. `MailServiceProvider` binds this to the *same* MailManager instance as the public `MailManager` token,\n * so `sendNow()` here always delivers immediately.\n */\nexport interface QueuedMailSender {\n sendNow(mailerName: string | undefined, mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage>\n}\nexport const QueuedMailSender = token<QueuedMailSender>('Mail.QueuedMailSender')\n","import type { Address, Job, Mailable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { QueuedMailSender } from '../QueuedMailSender'\nimport { SHOULD_QUEUE } from '../symbols'\n\n/** The ShouldQueue options copied from the mailable onto the wrapper job. */\nconst QUEUE_OPTIONS = [\n 'connection',\n 'queue',\n 'delay',\n 'tries',\n 'backoff',\n 'timeout',\n 'failOnTimeout',\n 'deleteWhenMissingModels',\n] as const\n\n/** The job hooks Queue reads off a job instance, when the wrapped mailable defines them. */\ninterface JobHooks {\n failed?: (error: unknown) => unknown\n retryUntil?: () => unknown\n middleware?: unknown[] | (() => unknown[])\n}\n\n/** Copies the mailable's own ShouldQueue fields onto the wrapper job (when set), so once Queue actually runs the\n * job, its delay/retry/backoff/connection routing reflects what the app developer put on the Mailable. Uses\n * `declare` fields on the class (no runtime auto-initialization to `undefined`), so a field is a genuinely own\n * property only when the mailable actually set it. */\nfunction copyShouldQueueFields(target: Record<PropertyKey, unknown>, source: object): void {\n const fields = source as Record<string, unknown>\n for (const option of QUEUE_OPTIONS) {\n if (fields[option] !== undefined) target[option] = fields[option]\n }\n}\n\n/**\n * Dispatched by MailerImpl.queue()/later()/send() (when queueable). Runs on the worker: renders and delivers the\n * mailable through QueuedMailSender, bypassing the queueable check (it's already on the worker, not the request).\n *\n * Carries `SHOULD_QUEUE` on its own prototype, per the Queue/Bus protocol, so `BusDispatcher.dispatch()` — which\n * re-decides queued-or-now on whatever job it's handed — actually enqueues it instead of running it inline; the\n * mailable's own queueability (checked by MailerImpl) only decides whether to wrap it at all. Like Laravel's\n * SendQueuedMailable, it forwards failed(), retryUntil(), middleware() and displayName() to the mailable.\n */\nexport class SendQueuedMailable implements Job {\n declare connection?: string\n declare queue?: string\n declare delay?: number\n declare tries?: number\n declare backoff?: number | number[]\n declare timeout?: number\n declare failOnTimeout?: boolean\n declare deleteWhenMissingModels?: boolean\n\n constructor(\n readonly mailerName: string | undefined,\n readonly mailable: Mailable,\n readonly to?: Address[],\n readonly cc?: Address[],\n readonly bcc?: Address[],\n ) {\n copyShouldQueueFields(this as unknown as Record<PropertyKey, unknown>, mailable)\n }\n\n async handle(): Promise<void> {\n await inject(QueuedMailSender).sendNow(this.mailerName, this.mailable, { to: this.to, cc: this.cc, bcc: this.bcc })\n }\n\n /** Called by Queue after the final failed attempt. */\n async failed(error: unknown): Promise<void> {\n const hooks = this.mailable as unknown as JobHooks\n if (typeof hooks.failed === 'function') await hooks.failed.call(this.mailable, error)\n }\n\n /** `failed_jobs` and `queue:failed` show the mailable's class, not the wrapper's. */\n displayName(): string {\n return this.mailable.constructor.name\n }\n\n retryUntil(): unknown {\n const hooks = this.mailable as unknown as JobHooks\n return typeof hooks.retryUntil === 'function' ? hooks.retryUntil.call(this.mailable) : undefined\n }\n\n middleware(): unknown[] {\n const declared = (this.mailable as unknown as JobHooks).middleware\n return (typeof declared === 'function' ? declared.call(this.mailable) : declared) ?? []\n }\n}\n;(SendQueuedMailable.prototype as unknown as Record<PropertyKey, unknown>)[SHOULD_QUEUE] = true\n","import {\n ConfigRepository,\n type Address,\n type Container,\n type Mailable,\n type MailManager as MailManagerContract,\n type MailRecipient,\n type MailTransport,\n type PendingMail,\n type SentMessage,\n} from '@orieljs/contracts'\nimport { ArrayTransport } from './transports/ArrayTransport'\nimport { FailoverTransport } from './transports/FailoverTransport'\nimport { LogTransport } from './transports/LogTransport'\nimport { SmtpTransport, type SmtpConfig } from './transports/SmtpTransport'\nimport { UnknownMailerError, UnknownMailTransportError } from './errors'\nimport { MailerImpl, type RecipientOverrides } from './Mailer'\nimport { SendQueuedMailable } from './Jobs/SendQueuedMailable'\nimport type { QueuedMailSender } from './QueuedMailSender'\n\ntype TransportFactory = (config: Record<string, unknown>) => MailTransport\n\nexport class MailManager implements MailManagerContract, QueuedMailSender {\n private readonly mailers = new Map<string, MailerImpl>()\n private readonly drivers = new Map<string, TransportFactory>([\n ['array', () => new ArrayTransport()],\n ['log', (config) => new LogTransport(config.channel as string | undefined)],\n [\n 'smtp',\n (config) =>\n new SmtpTransport({\n host: String(config.host ?? '127.0.0.1'),\n port: Number(config.port ?? 2525),\n encryption: (config.encryption as SmtpConfig['encryption']) ?? null,\n username: config.username as string | undefined,\n password: config.password as string | undefined,\n }),\n ],\n ])\n\n constructor(private readonly container: Container) {}\n\n private config(): ConfigRepository {\n return this.container.make(ConfigRepository)\n }\n\n mailer(name?: string): MailerImpl {\n const mailerName = name ?? this.config().get<string>('mail.default', 'log')\n const cached = this.mailers.get(mailerName)\n if (cached) return cached\n const config = this.config().get<Record<string, unknown> | undefined>(`mail.mailers.${mailerName}`)\n if (!config) throw new UnknownMailerError(mailerName)\n const transport = this.buildTransport(String(config.transport ?? ''), config)\n const from = this.config().get<Address | undefined>('mail.from')\n const impl = new MailerImpl(mailerName, transport, from, (mailerNameArg, mailable, overrides) =>\n new SendQueuedMailable(mailerNameArg, mailable, overrides?.to, overrides?.cc, overrides?.bcc),\n )\n this.mailers.set(mailerName, impl)\n return impl\n }\n\n private buildTransport(transportName: string, config: Record<string, unknown>): MailTransport {\n if (transportName === 'failover') {\n const names = (config.mailers as string[] | undefined) ?? []\n const transports = names.map((mailerName) => {\n const mailerConfig = this.config().get<Record<string, unknown> | undefined>(`mail.mailers.${mailerName}`)\n if (!mailerConfig) throw new UnknownMailerError(mailerName)\n return this.buildTransport(String(mailerConfig.transport ?? ''), mailerConfig)\n })\n return new FailoverTransport(transports, names)\n }\n const factory = this.drivers.get(transportName)\n if (!factory) throw new UnknownMailTransportError(transportName)\n return factory(config)\n }\n\n to(recipients: MailRecipient | MailRecipient[]): PendingMail {\n return this.mailer().to(recipients)\n }\n\n async send(mailable: Mailable): Promise<SentMessage | undefined> {\n return this.mailer().send(mailable)\n }\n\n async queue(mailable: Mailable): Promise<void> {\n await this.mailer().queue(mailable)\n }\n\n /** QueuedMailSender: always delivers immediately (see QueuedMailSender.ts for why this must bypass send()). */\n async sendNow(mailerName: string | undefined, mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage> {\n return this.mailer(mailerName).sendNow(mailable, overrides)\n }\n\n extend(transport: string, factory: TransportFactory): void {\n this.drivers.set(transport, factory)\n }\n}\n","import type { MailManager as MailManagerContract } from '@orieljs/contracts'\nimport { MailManager as MailManagerToken } from '@orieljs/contracts'\nimport { facade } from '@orieljs/support'\n\nexport const Mail = facade<MailManagerContract>(MailManagerToken)\n","import { ClassRegistry as ClassRegistryToken, MailManager as MailManagerToken } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { SendQueuedMailable } from './Jobs/SendQueuedMailable'\nimport { MailManager } from './MailManager'\nimport { QueuedMailSender } from './QueuedMailSender'\n\nexport class MailServiceProvider extends ServiceProvider {\n override register(): void {\n this.mergeConfigFrom(\n {\n default: 'log',\n mailers: {\n smtp: { transport: 'smtp', host: '127.0.0.1', port: 2525 },\n log: { transport: 'log' },\n array: { transport: 'array' },\n failover: { transport: 'failover', mailers: ['smtp', 'log'] },\n },\n from: { address: 'hello@example.com', name: 'Example' },\n },\n 'mail',\n )\n this.app.singleton(MailManagerToken, (container) => new MailManager(container))\n // Same instance under a second, internal token — see QueuedMailSender.ts for why. The token is typed with the\n // MailManager contract, which has no sendNow(), so narrow it to the concrete class bound just above.\n this.app.singleton(QueuedMailSender, (container) => container.make(MailManagerToken) as MailManager)\n // Namespaced name, registered in register() (not boot()) — the Queue/Bus protocol rule for wrapper classes.\n // ClassRegistry is safe to use here: Application's own constructor binds it before any provider registers.\n this.app.make(ClassRegistryToken).register(SendQueuedMailable, 'Mail.SendQueuedMailable')\n }\n}\n"],"mappings":";AAEO,IAAM,qBAAN,cAAiC,MAA4B;AAAA,EACzD,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,MAAc;AACxB,UAAM,WAAW,IAAI,wDAAwD;AAAA,EAC/E;AACF;AAEO,IAAM,4BAAN,cAAwC,MAA4B;AAAA,EAChE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,WAAmB;AAC7B,UAAM,mBAAmB,SAAS,kEAAkE;AAAA,EACtG;AACF;AAEO,IAAM,wBAAN,cAAoC,MAA4B;AAAA,EAC5D,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,cAAc;AACZ,UAAM,0FAA0F;AAAA,EAClG;AACF;AAEO,IAAM,4BAAN,cAAwC,MAA4B;AAAA,EAChE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,cAAc;AACZ,UAAM,8GAA8G;AAAA,EACtH;AACF;AAEO,IAAM,8BAAN,cAA0C,MAA4B;AAAA,EAClE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,MAAc;AACxB,UAAM,sBAAsB,IAAI,4EAA4E;AAAA,EAC9G;AACF;AAEO,IAAM,wBAAN,cAAoC,MAA4B;AAAA,EAIrE,YACW,SACA,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A,MACA;AAAA,IACF;AACA,SAAK,IAAI,UAAUC,mBAAkB,CAAC,cAAc,IAAI,YAAY,SAAS,CAAC;AAG9E,SAAK,IAAI,UAAU,kBAAkB,CAAC,cAAc,UAAU,KAAKA,iBAAgB,CAAgB;AAGnG,SAAK,IAAI,KAAK,kBAAkB,EAAE,SAAS,oBAAoB,yBAAyB;AAAA,EAC1F;AACF;","names":["randomUUID","randomUUID","currentContainer","currentContainer","currentContainer","currentContainer","MailManagerToken","MailManagerToken"]}
1
+ {"version":3,"sources":["../errors.ts","../address.ts","../transports/ArrayTransport.ts","../transports/LogTransport.ts","../transports/FailoverTransport.ts","../transports/SmtpTransport.ts","../render.ts","../Mailable.ts","../symbols.ts","../Mailer.ts","../QueuedMailSender.ts","../Jobs/SendQueuedMailable.ts","../MailManager.ts","../facade.ts","../MailServiceProvider.ts"],"sourcesContent":["import type { OrielError } from '@orieljs/contracts'\n\nexport class UnknownMailerError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'UnknownMailerError'\n constructor(name: string) {\n super(`Mailer [${name}] is not configured. Add it to config('mail.mailers').`)\n }\n}\n\nexport class UnknownMailTransportError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'UnknownMailTransportError'\n constructor(transport: string) {\n super(`Mail transport [${transport}] is not supported. Register it first with MailManager.extend().`)\n }\n}\n\nexport class MissingRecipientError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'MissingRecipientError'\n constructor() {\n super('Cannot send mail: no recipients. Set envelope().to, or call Mail.to(...).send(mailable).')\n }\n}\n\nexport class MailQueueUnavailableError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'MailQueueUnavailableError'\n constructor() {\n super('Queueing mail requires the Bus component. Register BusDispatcher, or call send() instead of queue()/later().')\n }\n}\n\nexport class ViewFactoryUnavailableError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'ViewFactoryUnavailableError'\n constructor(view: string) {\n super(`Cannot render the [${view}] mail view: the View component isn't registered (ViewFactory is unbound).`)\n }\n}\n\nexport class AllMailersFailedError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n override readonly name = 'AllMailersFailedError'\n constructor(\n readonly mailers: string[],\n readonly causes: unknown[],\n ) {\n super(`All failover mailers failed: ${mailers.join(', ')}. Last error: ${String(causes.at(-1))}`, {\n cause: causes.at(-1),\n })\n }\n}\n","import type { Address, MailRecipient } from '@orieljs/contracts'\n\n/** A MailRecipient is a bare string, an Address, or anything with `email` (+ optional `name`), such as a User model. */\nexport function normalizeAddress(recipient: MailRecipient): Address {\n if (typeof recipient === 'string') return { address: recipient }\n if ('address' in recipient) return { address: recipient.address, name: recipient.name }\n return { address: recipient.email, name: recipient.name }\n}\n\nexport function normalizeAddresses(recipients: MailRecipient | MailRecipient[] | undefined): Address[] {\n if (recipients === undefined) return []\n const list = Array.isArray(recipients) ? recipients : [recipients]\n return list.map(normalizeAddress)\n}\n\nexport function formatAddress(address: Address): string {\n return address.name ? `${address.name} <${address.address}>` : address.address\n}\n","import { randomUUID } from 'node:crypto'\nimport type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\n\n/** In-memory transport backing the `array` mailer: never leaves the process, so tests can inspect `sent`. */\nexport class ArrayTransport implements MailTransport {\n readonly sent: OutgoingMessage[] = []\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n this.sent.push(message)\n return { messageId: randomUUID(), message }\n }\n\n flush(): void {\n this.sent.length = 0\n }\n}\n","import { randomUUID } from 'node:crypto'\nimport { LogManager as LogManagerToken, type MailTransport, type OutgoingMessage, type SentMessage } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { formatAddress } from '../address'\n\n/** Writes the message through LogManager (a channel from config, or the default channel) when bound, else console.log. */\nexport class LogTransport implements MailTransport {\n constructor(private readonly channel?: string) {}\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const dump = formatMessage(message)\n const container = currentContainer()\n if (container?.bound(LogManagerToken)) {\n const manager = container.make(LogManagerToken)\n const logger = this.channel ? manager.channel(this.channel) : manager\n logger.info(dump)\n } else {\n console.log(dump)\n }\n return { messageId: randomUUID(), message }\n }\n}\n\nfunction formatMessage(message: OutgoingMessage): string {\n const lines = [\n `To: ${message.to.map(formatAddress).join(', ')}`,\n message.cc.length > 0 ? `Cc: ${message.cc.map(formatAddress).join(', ')}` : undefined,\n message.bcc.length > 0 ? `Bcc: ${message.bcc.map(formatAddress).join(', ')}` : undefined,\n `From: ${formatAddress(message.from)}`,\n `Subject: ${message.subject}`,\n '',\n message.text ?? stripHtml(message.html ?? ''),\n ]\n return lines.filter((line): line is string => line !== undefined).join('\\n')\n}\n\nfunction stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, '')\n}\n","import type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\nimport { AllMailersFailedError } from '../errors'\n\n/** Tries each transport in order, returning the first success (Laravel's `failover` mailer). */\nexport class FailoverTransport implements MailTransport {\n constructor(\n private readonly transports: MailTransport[],\n private readonly names: string[],\n ) {}\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const causes: unknown[] = []\n for (const transport of this.transports) {\n try {\n return await transport.send(message)\n } catch (error) {\n causes.push(error)\n }\n }\n throw new AllMailersFailedError(this.names, causes)\n }\n}\n","import nodemailer from 'nodemailer'\nimport type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\nimport { formatAddress } from '../address'\n\nexport interface SmtpConfig {\n host: string\n port: number\n encryption?: 'tls' | 'ssl' | null\n username?: string\n password?: string\n}\n\n/** The minimal nodemailer surface this transport needs — lets tests inject a fake without a real Transporter. */\nexport interface MailTransporter {\n sendMail(options: Record<string, unknown>): Promise<{ messageId: string }>\n}\n\nexport type TransporterFactory = (config: SmtpConfig) => MailTransporter\n\nconst defaultFactory: TransporterFactory = (config) =>\n nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.encryption === 'ssl',\n requireTLS: config.encryption === 'tls',\n auth: config.username ? { user: config.username, pass: config.password } : undefined,\n })\n\nexport class SmtpTransport implements MailTransport {\n private readonly transporter: MailTransporter\n\n constructor(config: SmtpConfig, factory: TransporterFactory = defaultFactory) {\n this.transporter = factory(config)\n }\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const info = await this.transporter.sendMail({\n from: formatAddress(message.from),\n to: message.to.map(formatAddress),\n cc: message.cc.length > 0 ? message.cc.map(formatAddress) : undefined,\n bcc: message.bcc.length > 0 ? message.bcc.map(formatAddress) : undefined,\n replyTo: message.replyTo.length > 0 ? message.replyTo.map(formatAddress) : undefined,\n subject: message.subject,\n html: message.html,\n text: message.text,\n headers: message.headers,\n attachments: message.attachments.map((attachment) => ({\n filename: attachment.name,\n path: attachment.path,\n content: attachment.data,\n contentType: attachment.mime,\n })),\n })\n return { messageId: info.messageId, message }\n }\n}\n","import { ViewFactory as ViewFactoryToken, type Content } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { ViewFactoryUnavailableError } from './errors'\n\nexport interface RenderedContent {\n html?: string\n text?: string\n}\n\n/**\n * Renders a Mailable's content() into transport-ready HTML/text. A `view`/`text` name is resolved through\n * ViewFactory (TSX); `htmlString`/`textString` are used as-is, with no View involved at all.\n */\nexport async function renderContent(content: Content): Promise<RenderedContent> {\n const html = content.view !== undefined ? await renderView(content.view, content.with) : content.htmlString\n const text = content.text !== undefined ? await renderView(content.text, content.with) : content.textString\n return { html, text }\n}\n\nasync function renderView(view: string, data: Record<string, unknown> | undefined): Promise<string> {\n const container = currentContainer()\n if (!container?.bound(ViewFactoryToken)) throw new ViewFactoryUnavailableError(view)\n return container.make(ViewFactoryToken).make(view, data).render()\n}\n","import type { Attachment, Content, Envelope, MailRecipient, Mailable as MailableContract } from '@orieljs/contracts'\n\n/**\n * Laravel-style Mailable. New code overrides envelope()/content()/attachments() directly. Legacy (pre-Laravel-9)\n * code overrides build() instead, and calls the fluent subject()/view()/text()/html()/from()/with()/attach()\n * methods, which feed the default envelope()/content()/attachments() below. build() runs at most once.\n */\nexport abstract class Mailable implements MailableContract {\n protected mailSubject?: string\n protected mailView?: string\n protected mailTextView?: string\n protected mailHtml?: string\n protected mailFrom?: MailRecipient\n protected mailData: Record<string, unknown> = {}\n protected mailAttachments: Attachment[] = []\n private built = false\n\n /** Legacy hook: override this and call the fluent methods below instead of envelope()/content()/attachments(). */\n build?(): void | Promise<void>\n\n subject(subject: string): this {\n this.mailSubject = subject\n return this\n }\n\n view(view: string): this {\n this.mailView = view\n return this\n }\n\n text(view: string): this {\n this.mailTextView = view\n return this\n }\n\n html(html: string): this {\n this.mailHtml = html\n return this\n }\n\n from(address: MailRecipient): this {\n this.mailFrom = address\n return this\n }\n\n with(key: string | Record<string, unknown>, value?: unknown): this {\n if (typeof key === 'string') this.mailData[key] = value\n else Object.assign(this.mailData, key)\n return this\n }\n\n attach(attachment: Attachment): this {\n this.mailAttachments.push(attachment)\n return this\n }\n\n private async ensureBuilt(): Promise<void> {\n if (this.built) return\n this.built = true\n await this.build?.()\n }\n\n async envelope(): Promise<Envelope> {\n await this.ensureBuilt()\n return { subject: this.mailSubject, from: this.mailFrom }\n }\n\n async content(): Promise<Content> {\n await this.ensureBuilt()\n return { view: this.mailView, text: this.mailTextView, htmlString: this.mailHtml, with: this.mailData }\n }\n\n async attachments(): Promise<Attachment[]> {\n await this.ensureBuilt()\n return this.mailAttachments\n }\n}\n","/**\n * The Queue/Bus protocol's shared marker (the \"Queue/Bus protocol\" section of the Queue/Bus design notes):\n * `Symbol.for('oriel:bus.shouldQueue')` is a *global* registry key, so `Symbol.for` called here returns the\n * literal same runtime symbol Bus's `Queueable` base class and `isQueueable()` use — genuinely shared state, with\n * no import needed (and none allowed: Mail can't import `@orieljs/bus`).\n */\nexport const SHOULD_QUEUE: unique symbol = Symbol.for('oriel:bus.shouldQueue')\n","import {\n BusDispatcher as BusDispatcherToken,\n type Address,\n type Job,\n type Mailable,\n type MailRecipient,\n type Mailer as MailerContract,\n type MailTransport,\n type OutgoingMessage,\n type PendingMail as PendingMailContract,\n type SentMessage,\n} from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { normalizeAddress, normalizeAddresses } from './address'\nimport { MailQueueUnavailableError, MissingRecipientError } from './errors'\nimport { renderContent } from './render'\nimport { SHOULD_QUEUE } from './symbols'\n\nexport interface RecipientOverrides {\n to?: Address[]\n cc?: Address[]\n bcc?: Address[]\n}\n\n/** Builds the queue job for a mailable. Decoupled from the concrete SendQueuedMailable class so this\n * file has no forward reference to it, and so tests can inject a fake job. */\nexport type QueuedMailableFactory = (\n mailerName: string | undefined,\n mailable: Mailable,\n overrides?: RecipientOverrides,\n) => Job\n\n/**\n * Matches the Queue/Bus protocol's `isQueueable()` exactly: true when the mailable carries ShouldQueue's\n * `shouldQueue: true` or `SHOULD_QUEUE === true`, or has a defined value for any of ShouldQueue's fields, or\n * declares a `uniqueId()`/`retryUntil()` method. Call queue()/later() explicitly to queue a mailable that declares\n * none of these.\n */\nfunction isQueueableMailable(mailable: Mailable): boolean {\n const record = mailable as unknown as Record<PropertyKey, unknown>\n if (record.shouldQueue === true || record[SHOULD_QUEUE] === true) return true\n return (\n record.connection !== undefined ||\n record.queue !== undefined ||\n record.delay !== undefined ||\n record.tries !== undefined ||\n record.backoff !== undefined ||\n record.timeout !== undefined ||\n typeof record.uniqueId === 'function' ||\n typeof record.retryUntil === 'function'\n )\n}\n\nexport class MailerImpl implements MailerContract {\n constructor(\n private readonly name: string,\n private readonly transport: MailTransport,\n private readonly defaultFrom: Address | undefined,\n private readonly makeQueuedJob: QueuedMailableFactory,\n ) {}\n\n to(recipients: MailRecipient | MailRecipient[]): PendingMailContract {\n return new PendingMail(this, normalizeAddresses(recipients))\n }\n\n async send(mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage | undefined> {\n if (isQueueableMailable(mailable)) {\n await this.queue(mailable, overrides)\n return undefined\n }\n return this.sendNow(mailable, overrides)\n }\n\n async queue(mailable: Mailable, overrides?: RecipientOverrides): Promise<void> {\n await this.dispatch(this.makeQueuedJob(this.name, mailable, overrides))\n }\n\n async later(delaySeconds: number, mailable: Mailable, overrides?: RecipientOverrides): Promise<void> {\n const job = this.makeQueuedJob(this.name, mailable, overrides)\n job.delay = delaySeconds\n await this.dispatch(job)\n }\n\n private async dispatch(job: Job): Promise<void> {\n const container = currentContainer()\n if (!container?.bound(BusDispatcherToken)) throw new MailQueueUnavailableError()\n await container.make(BusDispatcherToken).dispatch(job)\n }\n\n /** Renders and delivers immediately, bypassing the queueable check. Used by send() and by the queued job's\n * handle(), once it's already running on the worker. */\n async sendNow(mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage> {\n const envelope = await mailable.envelope()\n const to = overrides?.to && overrides.to.length > 0 ? overrides.to : normalizeAddresses(envelope.to)\n if (to.length === 0) throw new MissingRecipientError()\n const cc = [...normalizeAddresses(envelope.cc), ...(overrides?.cc ?? [])]\n const bcc = [...normalizeAddresses(envelope.bcc), ...(overrides?.bcc ?? [])]\n const replyTo = normalizeAddresses(envelope.replyTo)\n const from = envelope.from ? normalizeAddress(envelope.from) : this.defaultFrom\n if (!from) throw new MissingRecipientError()\n const content = await mailable.content()\n const rendered = await renderContent(content)\n const attachments = (await mailable.attachments?.()) ?? []\n const message: OutgoingMessage = {\n from,\n to,\n cc,\n bcc,\n replyTo,\n subject: envelope.subject ?? '',\n html: rendered.html,\n text: rendered.text,\n attachments,\n headers: {},\n }\n return this.transport.send(message)\n }\n}\n\nclass PendingMail implements PendingMailContract {\n private readonly ccList: Address[] = []\n private readonly bccList: Address[] = []\n\n constructor(\n private readonly mailer: MailerImpl,\n private readonly toList: Address[],\n ) {}\n\n cc(recipients: MailRecipient | MailRecipient[]): this {\n this.ccList.push(...normalizeAddresses(recipients))\n return this\n }\n\n bcc(recipients: MailRecipient | MailRecipient[]): this {\n this.bccList.push(...normalizeAddresses(recipients))\n return this\n }\n\n private overrides(): RecipientOverrides {\n return { to: this.toList, cc: this.ccList, bcc: this.bccList }\n }\n\n async send(mailable: Mailable): Promise<SentMessage | undefined> {\n return this.mailer.send(mailable, this.overrides())\n }\n\n async sendNow(mailable: Mailable): Promise<SentMessage> {\n return this.mailer.sendNow(mailable, this.overrides())\n }\n\n async queue(mailable: Mailable): Promise<void> {\n await this.mailer.queue(mailable, this.overrides())\n }\n\n async later(delaySeconds: number, mailable: Mailable): Promise<void> {\n await this.mailer.later(delaySeconds, mailable, this.overrides())\n }\n}\n","import { token, type Mailable, type SentMessage } from '@orieljs/contracts'\nimport type { RecipientOverrides } from './Mailer'\n\n/**\n * Internal-only token. `SendQueuedMailable.handle()` runs on the worker, where the mailable's ShouldQueue fields\n * are still set — calling the public `Mailer.send()` there would re-detect it as queueable and dispatch it again,\n * forever. `MailServiceProvider` binds this to the MailManager's mailers, so `sendNow()` here always delivers\n * immediately, through the mailer the job names and with the recipients PendingMail gave.\n */\nexport interface QueuedMailSender {\n sendNow(mailerName: string | undefined, mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage>\n}\nexport const QueuedMailSender = token<QueuedMailSender>('Mail.QueuedMailSender')\n","import type { Address, Job, Mailable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { QueuedMailSender } from '../QueuedMailSender'\nimport { SHOULD_QUEUE } from '../symbols'\n\n/** The ShouldQueue options copied from the mailable onto the wrapper job. */\nconst QUEUE_OPTIONS = [\n 'connection',\n 'queue',\n 'delay',\n 'tries',\n 'backoff',\n 'timeout',\n 'failOnTimeout',\n 'deleteWhenMissingModels',\n] as const\n\n/** The job hooks Queue reads off a job instance, when the wrapped mailable defines them. */\ninterface JobHooks {\n failed?: (error: unknown) => unknown\n retryUntil?: () => unknown\n middleware?: unknown[] | (() => unknown[])\n}\n\n/** Copies the mailable's own ShouldQueue fields onto the wrapper job (when set), so once Queue actually runs the\n * job, its delay/retry/backoff/connection routing reflects what the app developer put on the Mailable. Uses\n * `declare` fields on the class (no runtime auto-initialization to `undefined`), so a field is a genuinely own\n * property only when the mailable actually set it. */\nfunction copyShouldQueueFields(target: Record<PropertyKey, unknown>, source: object): void {\n const fields = source as Record<string, unknown>\n for (const option of QUEUE_OPTIONS) {\n if (fields[option] !== undefined) target[option] = fields[option]\n }\n}\n\n/**\n * Dispatched by MailerImpl.queue()/later()/send() (when queueable). Runs on the worker: renders and delivers the\n * mailable through QueuedMailSender, bypassing the queueable check (it's already on the worker, not the request).\n *\n * Carries `SHOULD_QUEUE` on its own prototype, per the Queue/Bus protocol, so `BusDispatcher.dispatch()` — which\n * re-decides queued-or-now on whatever job it's handed — actually enqueues it instead of running it inline; the\n * mailable's own queueability (checked by MailerImpl) only decides whether to wrap it at all. Like Laravel's\n * SendQueuedMailable, it forwards failed(), retryUntil(), middleware() and displayName() to the mailable.\n */\nexport class SendQueuedMailable implements Job {\n declare connection?: string\n declare queue?: string\n declare delay?: number\n declare tries?: number\n declare backoff?: number | number[]\n declare timeout?: number\n declare failOnTimeout?: boolean\n declare deleteWhenMissingModels?: boolean\n\n constructor(\n readonly mailerName: string | undefined,\n readonly mailable: Mailable,\n readonly to?: Address[],\n readonly cc?: Address[],\n readonly bcc?: Address[],\n ) {\n copyShouldQueueFields(this as unknown as Record<PropertyKey, unknown>, mailable)\n }\n\n async handle(): Promise<void> {\n await inject(QueuedMailSender).sendNow(this.mailerName, this.mailable, { to: this.to, cc: this.cc, bcc: this.bcc })\n }\n\n /** Called by Queue after the final failed attempt. */\n async failed(error: unknown): Promise<void> {\n const hooks = this.mailable as unknown as JobHooks\n if (typeof hooks.failed === 'function') await hooks.failed.call(this.mailable, error)\n }\n\n /** `failed_jobs` and `queue:failed` show the mailable's class, not the wrapper's. */\n displayName(): string {\n return this.mailable.constructor.name\n }\n\n retryUntil(): unknown {\n const hooks = this.mailable as unknown as JobHooks\n return typeof hooks.retryUntil === 'function' ? hooks.retryUntil.call(this.mailable) : undefined\n }\n\n middleware(): unknown[] {\n const declared = (this.mailable as unknown as JobHooks).middleware\n return (typeof declared === 'function' ? declared.call(this.mailable) : declared) ?? []\n }\n}\n;(SendQueuedMailable.prototype as unknown as Record<PropertyKey, unknown>)[SHOULD_QUEUE] = true\n","import {\n ConfigRepository,\n type Address,\n type Container,\n type Mailable,\n type MailManager as MailManagerContract,\n type MailRecipient,\n type MailTransport,\n type PendingMail,\n type SentMessage,\n} from '@orieljs/contracts'\nimport { ArrayTransport } from './transports/ArrayTransport'\nimport { FailoverTransport } from './transports/FailoverTransport'\nimport { LogTransport } from './transports/LogTransport'\nimport { SmtpTransport, type SmtpConfig } from './transports/SmtpTransport'\nimport { UnknownMailerError, UnknownMailTransportError } from './errors'\nimport { MailerImpl } from './Mailer'\nimport { SendQueuedMailable } from './Jobs/SendQueuedMailable'\n\ntype TransportFactory = (config: Record<string, unknown>) => MailTransport\n\nexport class MailManager implements MailManagerContract {\n private readonly mailers = new Map<string, MailerImpl>()\n private readonly drivers = new Map<string, TransportFactory>([\n ['array', () => new ArrayTransport()],\n ['log', (config) => new LogTransport(config.channel as string | undefined)],\n [\n 'smtp',\n (config) =>\n new SmtpTransport({\n host: String(config.host ?? '127.0.0.1'),\n port: Number(config.port ?? 2525),\n encryption: (config.encryption as SmtpConfig['encryption']) ?? null,\n username: config.username as string | undefined,\n password: config.password as string | undefined,\n }),\n ],\n ])\n\n constructor(private readonly container: Container) {}\n\n private config(): ConfigRepository {\n return this.container.make(ConfigRepository)\n }\n\n mailer(name?: string): MailerImpl {\n const mailerName = name ?? this.config().get<string>('mail.default', 'log')\n const cached = this.mailers.get(mailerName)\n if (cached) return cached\n const config = this.config().get<Record<string, unknown> | undefined>(`mail.mailers.${mailerName}`)\n if (!config) throw new UnknownMailerError(mailerName)\n const transport = this.buildTransport(String(config.transport ?? ''), config)\n const from = this.config().get<Address | undefined>('mail.from')\n const impl = new MailerImpl(mailerName, transport, from, (mailerNameArg, mailable, overrides) =>\n new SendQueuedMailable(mailerNameArg, mailable, overrides?.to, overrides?.cc, overrides?.bcc),\n )\n this.mailers.set(mailerName, impl)\n return impl\n }\n\n private buildTransport(transportName: string, config: Record<string, unknown>): MailTransport {\n if (transportName === 'failover') {\n const names = (config.mailers as string[] | undefined) ?? []\n const transports = names.map((mailerName) => {\n const mailerConfig = this.config().get<Record<string, unknown> | undefined>(`mail.mailers.${mailerName}`)\n if (!mailerConfig) throw new UnknownMailerError(mailerName)\n return this.buildTransport(String(mailerConfig.transport ?? ''), mailerConfig)\n })\n return new FailoverTransport(transports, names)\n }\n const factory = this.drivers.get(transportName)\n if (!factory) throw new UnknownMailTransportError(transportName)\n return factory(config)\n }\n\n to(recipients: MailRecipient | MailRecipient[]): PendingMail {\n return this.mailer().to(recipients)\n }\n\n async send(mailable: Mailable): Promise<SentMessage | undefined> {\n return this.mailer().send(mailable)\n }\n\n async queue(mailable: Mailable): Promise<void> {\n await this.mailer().queue(mailable)\n }\n\n /** Sends through the default mailer at once, even when the mailable is queueable (Laravel's Mail::sendNow()). */\n async sendNow(mailable: Mailable): Promise<SentMessage> {\n return this.mailer().sendNow(mailable)\n }\n\n extend(transport: string, factory: TransportFactory): void {\n this.drivers.set(transport, factory)\n }\n}\n","import type { MailManager as MailManagerContract } from '@orieljs/contracts'\nimport { MailManager as MailManagerToken } from '@orieljs/contracts'\nimport { facade } from '@orieljs/support'\n\nexport const Mail = facade<MailManagerContract>(MailManagerToken)\n","import { ClassRegistry as ClassRegistryToken, MailManager as MailManagerToken } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { SendQueuedMailable } from './Jobs/SendQueuedMailable'\nimport { MailManager } from './MailManager'\nimport { QueuedMailSender } from './QueuedMailSender'\n\nexport class MailServiceProvider extends ServiceProvider {\n override register(): void {\n this.mergeConfigFrom(\n {\n default: 'log',\n mailers: {\n smtp: { transport: 'smtp', host: '127.0.0.1', port: 2525 },\n log: { transport: 'log' },\n array: { transport: 'array' },\n failover: { transport: 'failover', mailers: ['smtp', 'log'] },\n },\n from: { address: 'hello@example.com', name: 'Example' },\n },\n 'mail',\n )\n this.app.singleton(MailManagerToken, (container) => new MailManager(container))\n // The internal token the queued job delivers through (see QueuedMailSender.ts): the named mailer's sendNow(),\n // with the job's recipients. The MailManager bound just above is this package's, so its mailers take them.\n this.app.singleton(QueuedMailSender, (container) => {\n const manager = container.make(MailManagerToken) as MailManager\n return { sendNow: (mailerName, mailable, overrides) => manager.mailer(mailerName).sendNow(mailable, overrides) }\n })\n // Namespaced name, registered in register() (not boot()) — the Queue/Bus protocol rule for wrapper classes.\n // ClassRegistry is safe to use here: Application's own constructor binds it before any provider registers.\n this.app.make(ClassRegistryToken).register(SendQueuedMailable, 'Mail.SendQueuedMailable')\n }\n}\n"],"mappings":";AAEO,IAAM,qBAAN,cAAiC,MAA4B;AAAA,EACzD,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,MAAc;AACxB,UAAM,WAAW,IAAI,wDAAwD;AAAA,EAC/E;AACF;AAEO,IAAM,4BAAN,cAAwC,MAA4B;AAAA,EAChE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,WAAmB;AAC7B,UAAM,mBAAmB,SAAS,kEAAkE;AAAA,EACtG;AACF;AAEO,IAAM,wBAAN,cAAoC,MAA4B;AAAA,EAC5D,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,cAAc;AACZ,UAAM,0FAA0F;AAAA,EAClG;AACF;AAEO,IAAM,4BAAN,cAAwC,MAA4B;AAAA,EAChE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,cAAc;AACZ,UAAM,8GAA8G;AAAA,EACtH;AACF;AAEO,IAAM,8BAAN,cAA0C,MAA4B;AAAA,EAClE,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAAA,EACzB,YAAY,MAAc;AACxB,UAAM,sBAAsB,IAAI,4EAA4E;AAAA,EAC9G;AACF;AAEO,IAAM,wBAAN,cA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,EAAE,WAAW,YAAY,SAAS,CAAC,QAAQ,KAAK,EAAE;AAAA,QAC9D;AAAA,QACA,MAAM,EAAE,SAAS,qBAAqB,MAAM,UAAU;AAAA,MACxD;AAAA,MACA;AAAA,IACF;AACA,SAAK,IAAI,UAAUC,mBAAkB,CAAC,cAAc,IAAI,YAAY,SAAS,CAAC;AAG9E,SAAK,IAAI,UAAU,kBAAkB,CAAC,cAAc;AAClD,YAAM,UAAU,UAAU,KAAKA,iBAAgB;AAC/C,aAAO,EAAE,SAAS,CAAC,YAAY,UAAU,cAAc,QAAQ,OAAO,UAAU,EAAE,QAAQ,UAAU,SAAS,EAAE;AAAA,IACjH,CAAC;AAGD,SAAK,IAAI,KAAK,kBAAkB,EAAE,SAAS,oBAAoB,yBAAyB;AAAA,EAC1F;AACF;","names":["randomUUID","randomUUID","currentContainer","currentContainer","currentContainer","currentContainer","MailManagerToken","MailManagerToken"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orieljs/mail",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "The Oriel Mail component.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "nodemailer": "10.0.10",
34
- "@orieljs/contracts": "0.1.0-alpha.4",
35
- "@orieljs/support": "0.1.0-alpha.4",
36
- "@orieljs/container": "0.1.0-alpha.4"
34
+ "@orieljs/contracts": "0.1.0-alpha.6",
35
+ "@orieljs/support": "0.1.0-alpha.6",
36
+ "@orieljs/container": "0.1.0-alpha.6"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/nodemailer": "8.0.2"