@orieljs/mail 0.1.0-alpha.15 → 0.1.0-alpha.16
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/dist/index.d.ts +35 -7
- package/dist/index.js +49 -9
- package/dist/index.js.map +1 -1
- package/package.json +15 -7
package/dist/index.d.ts
CHANGED
|
@@ -82,10 +82,14 @@ interface MailTransporter {
|
|
|
82
82
|
messageId: string;
|
|
83
83
|
}>;
|
|
84
84
|
}
|
|
85
|
-
type TransporterFactory = (config: SmtpConfig) => MailTransporter
|
|
85
|
+
type TransporterFactory = (config: SmtpConfig) => MailTransporter | Promise<MailTransporter>;
|
|
86
|
+
/** Sends through SMTP. The transporter is made at the first send(), so nodemailer is only imported when mail goes out. */
|
|
86
87
|
declare class SmtpTransport implements MailTransport {
|
|
87
|
-
private
|
|
88
|
+
#private;
|
|
89
|
+
private readonly config;
|
|
90
|
+
private readonly factory;
|
|
88
91
|
constructor(config: SmtpConfig, factory?: TransporterFactory);
|
|
92
|
+
private transporter;
|
|
89
93
|
send(message: OutgoingMessage): Promise<SentMessage>;
|
|
90
94
|
}
|
|
91
95
|
|
|
@@ -128,6 +132,28 @@ declare abstract class Mailable implements Mailable$1 {
|
|
|
128
132
|
attachments(): Promise<Attachment[]>;
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
/** Laravel's MessageSending: a message is about to go; a listener that returns false stops it. */
|
|
136
|
+
declare class MessageSending {
|
|
137
|
+
readonly message: OutgoingMessage;
|
|
138
|
+
readonly data: {
|
|
139
|
+
mailable: Mailable$1;
|
|
140
|
+
};
|
|
141
|
+
constructor(message: OutgoingMessage, data: {
|
|
142
|
+
mailable: Mailable$1;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** Laravel's MessageSent: the transport took the message. */
|
|
146
|
+
declare class MessageSent {
|
|
147
|
+
readonly message: OutgoingMessage;
|
|
148
|
+
readonly sent: SentMessage;
|
|
149
|
+
readonly data: {
|
|
150
|
+
mailable: Mailable$1;
|
|
151
|
+
};
|
|
152
|
+
constructor(message: OutgoingMessage, sent: SentMessage, data: {
|
|
153
|
+
mailable: Mailable$1;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
131
157
|
/**
|
|
132
158
|
* The Queue/Bus protocol's shared marker (the "Queue/Bus protocol" section of the Queue/Bus design notes):
|
|
133
159
|
* `Symbol.for('oriel:bus.shouldQueue')` is a *global* registry key, so `Symbol.for` called here returns the
|
|
@@ -156,8 +182,9 @@ declare class MailerImpl implements Mailer {
|
|
|
156
182
|
later(delaySeconds: number, mailable: Mailable$1, overrides?: RecipientOverrides): Promise<void>;
|
|
157
183
|
private dispatch;
|
|
158
184
|
/** Renders and delivers immediately, bypassing the queueable check. Used by send() and by the queued job's
|
|
159
|
-
* handle(), once it's already running on the worker.
|
|
160
|
-
|
|
185
|
+
* handle(), once it's already running on the worker. Dispatches MessageSending, whose listener may stop the message
|
|
186
|
+
* by returning false (then this resolves undefined), and MessageSent. */
|
|
187
|
+
sendNow(mailable: Mailable$1, overrides?: RecipientOverrides): Promise<SentMessage | undefined>;
|
|
161
188
|
}
|
|
162
189
|
|
|
163
190
|
/**
|
|
@@ -167,7 +194,7 @@ declare class MailerImpl implements Mailer {
|
|
|
167
194
|
* immediately, through the mailer the job names and with the recipients PendingMail gave.
|
|
168
195
|
*/
|
|
169
196
|
interface QueuedMailSender {
|
|
170
|
-
sendNow(mailerName: string | undefined, mailable: Mailable$1, overrides?: RecipientOverrides): Promise<SentMessage>;
|
|
197
|
+
sendNow(mailerName: string | undefined, mailable: Mailable$1, overrides?: RecipientOverrides): Promise<SentMessage | undefined>;
|
|
171
198
|
}
|
|
172
199
|
declare const QueuedMailSender: _orieljs_contracts.Token<QueuedMailSender>;
|
|
173
200
|
|
|
@@ -195,6 +222,7 @@ declare class SendQueuedMailable implements Job {
|
|
|
195
222
|
timeout?: number;
|
|
196
223
|
failOnTimeout?: boolean;
|
|
197
224
|
deleteWhenMissingModels?: boolean;
|
|
225
|
+
afterCommit?: boolean;
|
|
198
226
|
constructor(mailerName: string | undefined, mailable: Mailable$1, to?: Address[] | undefined, cc?: Address[] | undefined, bcc?: Address[] | undefined);
|
|
199
227
|
handle(): Promise<void>;
|
|
200
228
|
/** Called by Queue after the final failed attempt. */
|
|
@@ -218,7 +246,7 @@ declare class MailManager implements MailManager$1 {
|
|
|
218
246
|
send(mailable: Mailable$1): Promise<SentMessage | undefined>;
|
|
219
247
|
queue(mailable: Mailable$1): Promise<void>;
|
|
220
248
|
/** Sends through the default mailer at once, even when the mailable is queueable (Laravel's Mail::sendNow()). */
|
|
221
|
-
sendNow(mailable: Mailable$1): Promise<SentMessage>;
|
|
249
|
+
sendNow(mailable: Mailable$1): Promise<SentMessage | undefined>;
|
|
222
250
|
extend(transport: string, factory: TransportFactory): void;
|
|
223
251
|
}
|
|
224
252
|
|
|
@@ -228,4 +256,4 @@ declare class MailServiceProvider extends ServiceProvider {
|
|
|
228
256
|
register(): void;
|
|
229
257
|
}
|
|
230
258
|
|
|
231
|
-
export { AllMailersFailedError, ArrayTransport, FailoverTransport, LogTransport, Mail, MailManager, MailQueueUnavailableError, MailServiceProvider, type MailTransporter, Mailable, MailerImpl, MissingRecipientError, QueuedMailSender, type QueuedMailableFactory, type RecipientOverrides, type RenderedContent, SHOULD_QUEUE, SendQueuedMailable, type SmtpConfig, SmtpTransport, type TransporterFactory, UnknownMailTransportError, UnknownMailerError, ViewFactoryUnavailableError, formatAddress, normalizeAddress, normalizeAddresses, renderContent };
|
|
259
|
+
export { AllMailersFailedError, ArrayTransport, FailoverTransport, LogTransport, Mail, MailManager, MailQueueUnavailableError, MailServiceProvider, type MailTransporter, Mailable, MailerImpl, MessageSending, MessageSent, MissingRecipientError, QueuedMailSender, type QueuedMailableFactory, type RecipientOverrides, type RenderedContent, SHOULD_QUEUE, SendQueuedMailable, type SmtpConfig, SmtpTransport, type TransporterFactory, UnknownMailTransportError, UnknownMailerError, ViewFactoryUnavailableError, formatAddress, normalizeAddress, normalizeAddresses, renderContent };
|
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ var FailoverTransport = class {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
// transports/SmtpTransport.ts
|
|
145
|
-
import
|
|
145
|
+
import { importOptional } from "@orieljs/support";
|
|
146
146
|
function smtpOptions(config) {
|
|
147
147
|
return {
|
|
148
148
|
host: config.host,
|
|
@@ -154,14 +154,23 @@ function smtpOptions(config) {
|
|
|
154
154
|
auth: config.username ? { user: config.username, pass: config.password } : void 0
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
var defaultFactory = (config) =>
|
|
157
|
+
var defaultFactory = async (config) => {
|
|
158
|
+
const { default: nodemailer } = await importOptional("nodemailer", "The smtp mailer", () => import("nodemailer"));
|
|
159
|
+
return nodemailer.createTransport(smtpOptions(config));
|
|
160
|
+
};
|
|
158
161
|
var SmtpTransport = class {
|
|
159
|
-
transporter;
|
|
160
162
|
constructor(config, factory = defaultFactory) {
|
|
161
|
-
this.
|
|
163
|
+
this.config = config;
|
|
164
|
+
this.factory = factory;
|
|
165
|
+
}
|
|
166
|
+
config;
|
|
167
|
+
factory;
|
|
168
|
+
#transporter;
|
|
169
|
+
transporter() {
|
|
170
|
+
return this.#transporter ??= Promise.resolve().then(() => this.factory(this.config));
|
|
162
171
|
}
|
|
163
172
|
async send(message) {
|
|
164
|
-
const info = await this.transporter.sendMail({
|
|
173
|
+
const info = await (await this.transporter()).sendMail({
|
|
165
174
|
from: formatAddress(message.from),
|
|
166
175
|
to: message.to.map(formatAddress),
|
|
167
176
|
cc: message.cc.length > 0 ? message.cc.map(formatAddress) : void 0,
|
|
@@ -254,6 +263,26 @@ var Mailable = class {
|
|
|
254
263
|
}
|
|
255
264
|
};
|
|
256
265
|
|
|
266
|
+
// events.ts
|
|
267
|
+
var MessageSending = class {
|
|
268
|
+
constructor(message, data) {
|
|
269
|
+
this.message = message;
|
|
270
|
+
this.data = data;
|
|
271
|
+
}
|
|
272
|
+
message;
|
|
273
|
+
data;
|
|
274
|
+
};
|
|
275
|
+
var MessageSent = class {
|
|
276
|
+
constructor(message, sent, data) {
|
|
277
|
+
this.message = message;
|
|
278
|
+
this.sent = sent;
|
|
279
|
+
this.data = data;
|
|
280
|
+
}
|
|
281
|
+
message;
|
|
282
|
+
sent;
|
|
283
|
+
data;
|
|
284
|
+
};
|
|
285
|
+
|
|
257
286
|
// symbols.ts
|
|
258
287
|
var SHOULD_QUEUE = /* @__PURE__ */ Symbol.for("oriel:bus.shouldQueue");
|
|
259
288
|
var UNIQUE = /* @__PURE__ */ Symbol.for("oriel:bus.unique");
|
|
@@ -273,7 +302,8 @@ function uniqueSpecOf(target, name) {
|
|
|
273
302
|
|
|
274
303
|
// Mailer.ts
|
|
275
304
|
import {
|
|
276
|
-
BusDispatcher as BusDispatcherToken
|
|
305
|
+
BusDispatcher as BusDispatcherToken,
|
|
306
|
+
EventDispatcher
|
|
277
307
|
} from "@orieljs/contracts";
|
|
278
308
|
import { currentContainer as currentContainer3 } from "@orieljs/container";
|
|
279
309
|
function isQueueableMailable(mailable) {
|
|
@@ -316,7 +346,8 @@ var MailerImpl = class {
|
|
|
316
346
|
await container.make(BusDispatcherToken).dispatch(job);
|
|
317
347
|
}
|
|
318
348
|
/** Renders and delivers immediately, bypassing the queueable check. Used by send() and by the queued job's
|
|
319
|
-
* handle(), once it's already running on the worker.
|
|
349
|
+
* handle(), once it's already running on the worker. Dispatches MessageSending, whose listener may stop the message
|
|
350
|
+
* by returning false (then this resolves undefined), and MessageSent. */
|
|
320
351
|
async sendNow(mailable, overrides) {
|
|
321
352
|
const envelope = await mailable.envelope();
|
|
322
353
|
const to = overrides?.to && overrides.to.length > 0 ? overrides.to : normalizeAddresses(envelope.to);
|
|
@@ -341,7 +372,13 @@ var MailerImpl = class {
|
|
|
341
372
|
attachments,
|
|
342
373
|
headers: {}
|
|
343
374
|
};
|
|
344
|
-
|
|
375
|
+
const container = currentContainer3();
|
|
376
|
+
const events = container?.bound(EventDispatcher) ? container.make(EventDispatcher) : void 0;
|
|
377
|
+
const data = { mailable };
|
|
378
|
+
if (events !== void 0 && await events.until(new MessageSending(message, data)) === false) return void 0;
|
|
379
|
+
const sent = await this.transport.send(message);
|
|
380
|
+
await events?.dispatch(new MessageSent(message, sent, data));
|
|
381
|
+
return sent;
|
|
345
382
|
}
|
|
346
383
|
};
|
|
347
384
|
var PendingMail = class {
|
|
@@ -393,7 +430,8 @@ var QUEUE_OPTIONS = [
|
|
|
393
430
|
"backoff",
|
|
394
431
|
"timeout",
|
|
395
432
|
"failOnTimeout",
|
|
396
|
-
"deleteWhenMissingModels"
|
|
433
|
+
"deleteWhenMissingModels",
|
|
434
|
+
"afterCommit"
|
|
397
435
|
];
|
|
398
436
|
function copyShouldQueueFields(target, source) {
|
|
399
437
|
const fields = source;
|
|
@@ -568,6 +606,8 @@ export {
|
|
|
568
606
|
MailServiceProvider,
|
|
569
607
|
Mailable,
|
|
570
608
|
MailerImpl,
|
|
609
|
+
MessageSending,
|
|
610
|
+
MessageSent,
|
|
571
611
|
MissingRecipientError,
|
|
572
612
|
QueuedMailSender,
|
|
573
613
|
SHOULD_QUEUE,
|
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\n/** @internal What the default factory gives nodemailer.createTransport for `config`. */\nexport function smtpOptions(config: SmtpConfig): Record<string, unknown> {\n return {\n host: config.host,\n port: config.port,\n // With no encryption set, `secure` stays out: nodemailer then speaks TLS on port 465 and STARTTLS where offered.\n // Port 465 speaks TLS from the start, also when MAIL_ENCRYPTION says 'tls' (as Laravel takes it, smtps).\n secure: config.encryption === 'ssl' || (config.encryption === 'tls' && config.port === 465) ? true : config.encryption === 'tls' ? false : undefined,\n requireTLS: config.encryption === 'tls' && config.port !== 465 ? true : undefined,\n auth: config.username ? { user: config.username, pass: config.password } : undefined,\n }\n}\n\nconst defaultFactory: TransporterFactory = (config) => nodemailer.createTransport(smtpOptions(config))\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\n/**\n * Bus's UNIQUE key, the same `Symbol.for`: the uniqueness a SendQueuedMailable carries for its mailable, read by Bus's\n * isUnique() and UniqueLock. Symbol-keyed, so the payload never carries it.\n */\nexport const UNIQUE: unique symbol = Symbol.for('oriel:bus.unique')\n\n/** Bus's UniqueSpec, declared again here (Mail can't import Bus): the lock is `oriel_unique_job:<name>:<id>`. */\nexport interface UniqueSpec {\n name: string\n id: string\n for?: number\n untilProcessing?: boolean\n via?: string\n}\n\ninterface UniqueMembers {\n uniqueId?: () => unknown\n uniqueFor?: number | (() => unknown)\n uniqueUntilProcessing?: boolean\n uniqueVia?: () => unknown\n}\n\n/**\n * Laravel's ShouldBeUnique read off a mailable, by Bus's isUnique() rule (it defines uniqueId(), uniqueFor,\n * uniqueUntilProcessing or uniqueVia()), each value resolved now, at dispatch. undefined when it declares none.\n */\nexport function uniqueSpecOf(target: object, name: string): UniqueSpec | undefined {\n const members = target as UniqueMembers\n const declared =\n typeof members.uniqueId === 'function' ||\n members.uniqueFor !== undefined ||\n members.uniqueUntilProcessing === true ||\n typeof members.uniqueVia === 'function'\n if (!declared) return undefined\n const id = typeof members.uniqueId === 'function' ? members.uniqueId.call(target) : undefined\n const spec: UniqueSpec = { name, id: id === undefined || id === null ? '' : String(id) }\n const uniqueFor = typeof members.uniqueFor === 'function' ? members.uniqueFor.call(target) : members.uniqueFor\n if (typeof uniqueFor === 'number') spec.for = uniqueFor\n if (members.uniqueUntilProcessing === true) spec.untilProcessing = true\n const via = typeof members.uniqueVia === 'function' ? members.uniqueVia.call(target) : undefined\n if (typeof via === 'string') spec.via = via\n return spec\n}\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 { createHash } from 'node:crypto'\nimport type { Address, Job, Mailable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { QueuedMailSender } from '../QueuedMailSender'\nimport { SHOULD_QUEUE, UNIQUE, uniqueSpecOf } 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 * The recipients given with Mail.to(), cc() and bcc(), for a unique mailable's id: a sha1 of the three address lists,\n * kept apart and in the order given, so the lock key stays short and holds no address. undefined when all are empty.\n */\nfunction recipientsHash(to: Address[] = [], cc: Address[] = [], bcc: Address[] = []): string | undefined {\n if (to.length + cc.length + bcc.length === 0) return undefined\n const addresses = (list: Address[]) => list.map((recipient) => recipient.address)\n const recipients = JSON.stringify({ to: addresses(to), cc: addresses(cc), bcc: addresses(bcc) })\n return createHash('sha1').update(recipients).digest('hex')\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. Unlike\n * Laravel's, it is unique when the mailable is (Laravel pushes a mailable straight to the queue, past the unique lock).\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 // A unique mailable (uniqueId(), uniqueFor, ...) makes this job unique, under the mailable's class; the id is\n // `<uniqueId()>:<sha1 of the to, cc and bcc recipients>`, so the same mail to anyone else is not a duplicate.\n const unique = uniqueSpecOf(mailable, mailable.constructor.name)\n if (unique) {\n const recipients = recipientsHash(to, cc, bcc)\n if (recipients !== undefined) unique.id += `:${recipients}`\n ;(this as unknown as Record<PropertyKey, unknown>)[UNIQUE] = unique\n }\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,cAAoC,M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BAAN,cAAkC,gBAAgB;AAAA,EAC9C,WAAiB;AACxB,SAAK;AAAA,MACH;AAAA,QACE,SAAS;AAAA,QACT,SAAS;AAAA,UACP,MAAM,EAAE,WAAW,QAAQ,MAAM,aAAa,MAAM,KAAK;AAAA,UACzD,KAAK,EAAE,WAAW,MAAM;AAAA,UACxB,OAAO,EAAE,WAAW,QAAQ;AAAA,UAC5B,UAAU,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"]}
|
|
1
|
+
{"version":3,"sources":["../errors.ts","../address.ts","../transports/ArrayTransport.ts","../transports/LogTransport.ts","../transports/FailoverTransport.ts","../transports/SmtpTransport.ts","../render.ts","../Mailable.ts","../events.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 type { MailTransport, OutgoingMessage, SentMessage } from '@orieljs/contracts'\nimport { importOptional } from '@orieljs/support'\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 | Promise<MailTransporter>\n\n/** @internal What the default factory gives nodemailer.createTransport for `config`. */\nexport function smtpOptions(config: SmtpConfig): Record<string, unknown> {\n return {\n host: config.host,\n port: config.port,\n // With no encryption set, `secure` stays out: nodemailer then speaks TLS on port 465 and STARTTLS where offered.\n // Port 465 speaks TLS from the start, also when MAIL_ENCRYPTION says 'tls' (as Laravel takes it, smtps).\n secure: config.encryption === 'ssl' || (config.encryption === 'tls' && config.port === 465) ? true : config.encryption === 'tls' ? false : undefined,\n requireTLS: config.encryption === 'tls' && config.port !== 465 ? true : undefined,\n auth: config.username ? { user: config.username, pass: config.password } : undefined,\n }\n}\n\n/** nodemailer's SMTP transporter. nodemailer is an optional package: without it, this throws MissingPackageError. */\nconst defaultFactory: TransporterFactory = async (config) => {\n const { default: nodemailer } = await importOptional('nodemailer', 'The smtp mailer', () => import('nodemailer'))\n return nodemailer.createTransport(smtpOptions(config))\n}\n\n/** Sends through SMTP. The transporter is made at the first send(), so nodemailer is only imported when mail goes out. */\nexport class SmtpTransport implements MailTransport {\n #transporter: Promise<MailTransporter> | undefined\n\n constructor(\n private readonly config: SmtpConfig,\n private readonly factory: TransporterFactory = defaultFactory,\n ) {}\n\n private transporter(): Promise<MailTransporter> {\n return (this.#transporter ??= Promise.resolve().then(() => this.factory(this.config)))\n }\n\n async send(message: OutgoingMessage): Promise<SentMessage> {\n const info = await (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","import type { Mailable, OutgoingMessage, SentMessage } from '@orieljs/contracts'\n\n/** Laravel's MessageSending: a message is about to go; a listener that returns false stops it. */\nexport class MessageSending {\n constructor(\n readonly message: OutgoingMessage,\n readonly data: { mailable: Mailable },\n ) {}\n}\n\n/** Laravel's MessageSent: the transport took the message. */\nexport class MessageSent {\n constructor(\n readonly message: OutgoingMessage,\n readonly sent: SentMessage,\n readonly data: { mailable: Mailable },\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\n/**\n * Bus's UNIQUE key, the same `Symbol.for`: the uniqueness a SendQueuedMailable carries for its mailable, read by Bus's\n * isUnique() and UniqueLock. Symbol-keyed, so the payload never carries it.\n */\nexport const UNIQUE: unique symbol = Symbol.for('oriel:bus.unique')\n\n/** Bus's UniqueSpec, declared again here (Mail can't import Bus): the lock is `oriel_unique_job:<name>:<id>`. */\nexport interface UniqueSpec {\n name: string\n id: string\n for?: number\n untilProcessing?: boolean\n via?: string\n}\n\ninterface UniqueMembers {\n uniqueId?: () => unknown\n uniqueFor?: number | (() => unknown)\n uniqueUntilProcessing?: boolean\n uniqueVia?: () => unknown\n}\n\n/**\n * Laravel's ShouldBeUnique read off a mailable, by Bus's isUnique() rule (it defines uniqueId(), uniqueFor,\n * uniqueUntilProcessing or uniqueVia()), each value resolved now, at dispatch. undefined when it declares none.\n */\nexport function uniqueSpecOf(target: object, name: string): UniqueSpec | undefined {\n const members = target as UniqueMembers\n const declared =\n typeof members.uniqueId === 'function' ||\n members.uniqueFor !== undefined ||\n members.uniqueUntilProcessing === true ||\n typeof members.uniqueVia === 'function'\n if (!declared) return undefined\n const id = typeof members.uniqueId === 'function' ? members.uniqueId.call(target) : undefined\n const spec: UniqueSpec = { name, id: id === undefined || id === null ? '' : String(id) }\n const uniqueFor = typeof members.uniqueFor === 'function' ? members.uniqueFor.call(target) : members.uniqueFor\n if (typeof uniqueFor === 'number') spec.for = uniqueFor\n if (members.uniqueUntilProcessing === true) spec.untilProcessing = true\n const via = typeof members.uniqueVia === 'function' ? members.uniqueVia.call(target) : undefined\n if (typeof via === 'string') spec.via = via\n return spec\n}\n","import {\n BusDispatcher as BusDispatcherToken,\n EventDispatcher,\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 { MessageSending, MessageSent } from './events'\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. Dispatches MessageSending, whose listener may stop the message\n * by returning false (then this resolves undefined), and MessageSent. */\n async sendNow(mailable: Mailable, overrides?: RecipientOverrides): Promise<SentMessage | undefined> {\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 const container = currentContainer()\n const events = container?.bound(EventDispatcher) ? container.make(EventDispatcher) : undefined\n const data = { mailable }\n // Laravel's shouldSendMessage(): only a listener's false stops it.\n if (events !== undefined && (await events.until(new MessageSending(message, data))) === false) return undefined\n const sent = await this.transport.send(message)\n await events?.dispatch(new MessageSent(message, sent, data))\n return sent\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 | undefined> {\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 | undefined>\n}\nexport const QueuedMailSender = token<QueuedMailSender>('Mail.QueuedMailSender')\n","import { createHash } from 'node:crypto'\nimport type { Address, Job, Mailable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { QueuedMailSender } from '../QueuedMailSender'\nimport { SHOULD_QUEUE, UNIQUE, uniqueSpecOf } 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 'afterCommit',\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 * The recipients given with Mail.to(), cc() and bcc(), for a unique mailable's id: a sha1 of the three address lists,\n * kept apart and in the order given, so the lock key stays short and holds no address. undefined when all are empty.\n */\nfunction recipientsHash(to: Address[] = [], cc: Address[] = [], bcc: Address[] = []): string | undefined {\n if (to.length + cc.length + bcc.length === 0) return undefined\n const addresses = (list: Address[]) => list.map((recipient) => recipient.address)\n const recipients = JSON.stringify({ to: addresses(to), cc: addresses(cc), bcc: addresses(bcc) })\n return createHash('sha1').update(recipients).digest('hex')\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. Unlike\n * Laravel's, it is unique when the mailable is (Laravel pushes a mailable straight to the queue, past the unique lock).\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 declare afterCommit?: 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 // A unique mailable (uniqueId(), uniqueFor, ...) makes this job unique, under the mailable's class; the id is\n // `<uniqueId()>:<sha1 of the to, cc and bcc recipients>`, so the same mail to anyone else is not a duplicate.\n const unique = uniqueSpecOf(mailable, mailable.constructor.name)\n if (unique) {\n const recipients = recipientsHash(to, cc, bcc)\n if (recipients !== undefined) unique.id += `:${recipients}`\n ;(this as unknown as Record<PropertyKey, unknown>)[UNIQUE] = unique\n }\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 | undefined> {\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,cAAoC,MAA4B;AAAA,EAIrE,YACW,SACA,QACT;AACA,UAAM,gCAAgC,QAAQ,KAAK,IAAI,CAAC,iBAAiB,OAAO,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI;AAAA,MAChG,OAAO,OAAO,GAAG,EAAE;AAAA,IACrB,CAAC;AALQ;AACA;AAAA,EAKX;AAAA,EANW;AAAA,EACA;AAAA,EALF,OAAO;AAAA,EACP,SAAS;AAAA,EACA,OAAO;AAS3B;;;ACxDO,SAAS,iBAAiB,WAAmC;A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;","names":["randomUUID","randomUUID","currentContainer","currentContainer","currentContainer","currentContainer","MailManagerToken","MailManagerToken"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/mail",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.16",
|
|
4
|
+
"description": "Mail for Oriel, as Laravel's mailer: mailables with TSX views, the Mail facade, queued mail and SMTP, log and failover.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "https://orieljs.vercel.app",
|
|
@@ -31,13 +31,21 @@
|
|
|
31
31
|
"TRADEMARKS.md"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"@orieljs/
|
|
36
|
-
"@orieljs/
|
|
37
|
-
"@orieljs/support": "0.1.0-alpha.15"
|
|
34
|
+
"@orieljs/contracts": "0.1.0-alpha.16",
|
|
35
|
+
"@orieljs/support": "0.1.0-alpha.16",
|
|
36
|
+
"@orieljs/container": "0.1.0-alpha.16"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@types/nodemailer": "8.0.2"
|
|
39
|
+
"@types/nodemailer": "8.0.2",
|
|
40
|
+
"nodemailer": "10.3.1"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"nodemailer": "^10.3.1"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"nodemailer": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
41
49
|
},
|
|
42
50
|
"scripts": {
|
|
43
51
|
"build": "tsup && node ../../../scripts/copy-license.mjs"
|