@argos-js/mail 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Argos-JS Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @argos-js/mail
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ High-throughput, asynchronous transactional email service for the Argos-JS framework.
4
+
5
+ ## Features
6
+
7
+ - ✉️ **Transport Adapters**: SMTP, SendGrid, Resend, and local mock transports.
8
+ - 📬 **Template Engine Support**: Automated email templating with layout inheritance.
9
+ - ⚡ **Background Queue Integration**: Offload email delivery to background workers seamlessly.
10
+
11
+ ## License
12
+
13
+ MIT
@@ -0,0 +1,7 @@
1
+ import type { MailDriverType, SendMailOptions, SentMailResult } from '../types';
2
+ export interface MailDriver {
3
+ readonly name: MailDriverType;
4
+ send(options: SendMailOptions): Promise<SentMailResult>;
5
+ verify?(): Promise<boolean>;
6
+ }
7
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/drivers/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxD,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/drivers/driver.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { MailDriver } from './driver';
2
+ import type { SendMailOptions, SentMailResult } from '../types';
3
+ export declare class LogMailDriver implements MailDriver {
4
+ readonly name: "log";
5
+ private logger?;
6
+ private sentMails;
7
+ constructor(logger?: any);
8
+ send(options: SendMailOptions): Promise<SentMailResult>;
9
+ verify(): Promise<boolean>;
10
+ getSentMails(): SendMailOptions[];
11
+ clearSentMails(): void;
12
+ }
13
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/drivers/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE,qBAAa,aAAc,YAAW,UAAU;IAC9C,SAAgB,IAAI,EAAG,KAAK,CAAU;IACtC,OAAO,CAAC,MAAM,CAAC,CAAM;IACrB,OAAO,CAAC,SAAS,CAAyB;gBAE9B,MAAM,CAAC,EAAE,GAAG;IAIX,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAoCvD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC,YAAY,IAAI,eAAe,EAAE;IAIjC,cAAc,IAAI,IAAI;CAG9B"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogMailDriver = void 0;
4
+ class LogMailDriver {
5
+ name = 'log';
6
+ logger;
7
+ sentMails = [];
8
+ constructor(logger) {
9
+ this.logger = logger;
10
+ }
11
+ async send(options) {
12
+ const messageId = `<log-${Date.now()}-${Math.random().toString(36).slice(2, 9)}@argos-local>`;
13
+ this.sentMails.push(options);
14
+ const toStr = Array.isArray(options.to) ? options.to.join(', ') : options.to;
15
+ const fromStr = options.from || 'no-reply@argos-js.dev';
16
+ const logOutput = [
17
+ `✉️ [Mail Log Driver] Email dispatched:`,
18
+ ` ID: ${messageId}`,
19
+ ` From: ${fromStr}`,
20
+ ` To: ${toStr}`,
21
+ ` Subject: ${options.subject}`,
22
+ options.text ? ` Text: ${options.text.slice(0, 200)}${options.text.length > 200 ? '...' : ''}` : null,
23
+ options.html ? ` HTML: ${options.html.slice(0, 200)}${options.html.length > 200 ? '...' : ''}` : null,
24
+ options.attachments && options.attachments.length > 0 ? ` Attachments: ${options.attachments.length} file(s)` : null,
25
+ ]
26
+ .filter(Boolean)
27
+ .join('\n');
28
+ if (this.logger && typeof this.logger.info === 'function') {
29
+ this.logger.info(logOutput);
30
+ }
31
+ else {
32
+ console.log(logOutput);
33
+ }
34
+ return {
35
+ success: true,
36
+ messageId,
37
+ driver: 'log',
38
+ to: options.to,
39
+ subject: options.subject,
40
+ response: 'Logged to console/logger without external transport',
41
+ };
42
+ }
43
+ async verify() {
44
+ return true;
45
+ }
46
+ getSentMails() {
47
+ return [...this.sentMails];
48
+ }
49
+ clearSentMails() {
50
+ this.sentMails = [];
51
+ }
52
+ }
53
+ exports.LogMailDriver = LogMailDriver;
54
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/drivers/log.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IACR,IAAI,GAAG,KAAc,CAAC;IAC9B,MAAM,CAAO;IACb,SAAS,GAAsB,EAAE,CAAC;IAE1C,YAAY,MAAY;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAwB;QACxC,MAAM,SAAS,GAAG,QAAQ,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC;QAC9F,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE7B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7E,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,uBAAuB,CAAC;QAExD,MAAM,SAAS,GAAG;YAChB,yCAAyC;YACzC,eAAe,SAAS,EAAE;YAC1B,eAAe,OAAO,EAAE;YACxB,eAAe,KAAK,EAAE;YACtB,eAAe,OAAO,CAAC,OAAO,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAA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tB,CAAC;CACF;AAxDD,sCAwDC"}
@@ -0,0 +1,12 @@
1
+ import type { Transporter } from 'nodemailer';
2
+ import type { MailDriver } from './driver';
3
+ import type { SendMailOptions, SentMailResult, SmtpConfig } from '../types';
4
+ export declare class SmtpMailDriver implements MailDriver {
5
+ readonly name: "smtp";
6
+ readonly transporter: Transporter;
7
+ readonly config: SmtpConfig;
8
+ constructor(config?: SmtpConfig);
9
+ send(options: SendMailOptions): Promise<SentMailResult>;
10
+ verify(): Promise<boolean>;
11
+ }
12
+ //# sourceMappingURL=smtp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smtp.d.ts","sourceRoot":"","sources":["../../src/drivers/smtp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE5E,qBAAa,cAAe,YAAW,UAAU;IAC/C,SAAgB,IAAI,EAAG,MAAM,CAAU;IACvC,SAAgB,WAAW,EAAE,WAAW,CAAC;IACzC,SAAgB,MAAM,EAAE,UAAU,CAAC;gBAEvB,MAAM,GAAE,UAAe;IAkCtB,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAwBvD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAQxC"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SmtpMailDriver = void 0;
7
+ const nodemailer_1 = __importDefault(require("nodemailer"));
8
+ class SmtpMailDriver {
9
+ name = 'smtp';
10
+ transporter;
11
+ config;
12
+ constructor(config = {}) {
13
+ this.config = config;
14
+ if (config.connectionString) {
15
+ this.transporter = nodemailer_1.default.createTransport(config.connectionString);
16
+ }
17
+ else {
18
+ const port = config.port ?? (config.secure ? 465 : 587);
19
+ const host = config.host || 'localhost';
20
+ const transportOptions = {
21
+ host,
22
+ port,
23
+ secure: config.secure ?? port === 465,
24
+ };
25
+ if (config.auth) {
26
+ transportOptions.auth = {
27
+ user: config.auth.user,
28
+ pass: config.auth.pass,
29
+ };
30
+ }
31
+ if (config.pool !== undefined) {
32
+ transportOptions.pool = config.pool;
33
+ }
34
+ if (config.tls) {
35
+ transportOptions.tls = config.tls;
36
+ }
37
+ this.transporter = nodemailer_1.default.createTransport(transportOptions);
38
+ }
39
+ }
40
+ async send(options) {
41
+ const info = await this.transporter.sendMail({
42
+ from: options.from,
43
+ to: options.to,
44
+ subject: options.subject,
45
+ text: options.text,
46
+ html: options.html,
47
+ cc: options.cc,
48
+ bcc: options.bcc,
49
+ replyTo: options.replyTo,
50
+ attachments: options.attachments,
51
+ headers: options.headers,
52
+ });
53
+ return {
54
+ success: true,
55
+ messageId: info.messageId,
56
+ driver: 'smtp',
57
+ to: options.to,
58
+ subject: options.subject,
59
+ response: info.response,
60
+ };
61
+ }
62
+ async verify() {
63
+ try {
64
+ await this.transporter.verify();
65
+ return true;
66
+ }
67
+ catch {
68
+ return false;
69
+ }
70
+ }
71
+ }
72
+ exports.SmtpMailDriver = SmtpMailDriver;
73
+ //# sourceMappingURL=smtp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smtp.js","sourceRoot":"","sources":["../../src/drivers/smtp.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AAKpC,MAAa,cAAc;IACT,IAAI,GAAG,MAAe,CAAC;IACvB,WAAW,CAAc;IACzB,MAAM,CAAa;IAEnC,YAAY,SAAqB,EAAE;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,oBAAU,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O,CAAC,EAAE;YACd,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,OAAO,CAAC,WAAkB;YACvC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAvED,wCAuEC"}
@@ -0,0 +1,8 @@
1
+ export * from './types';
2
+ export * from './mail-message';
3
+ export * from './mail-manager';
4
+ export * from './drivers/driver';
5
+ export * from './drivers/smtp';
6
+ export * from './drivers/log';
7
+ export * from './plugin';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./mail-message"), exports);
19
+ __exportStar(require("./mail-manager"), exports);
20
+ __exportStar(require("./drivers/driver"), exports);
21
+ __exportStar(require("./drivers/smtp"), exports);
22
+ __exportStar(require("./drivers/log"), exports);
23
+ __exportStar(require("./plugin"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,iDAA+B;AAC/B,gDAA8B;AAC9B,2CAAyB"}
@@ -0,0 +1,54 @@
1
+ import type { MailDriver } from './drivers/driver';
2
+ import { MailMessage } from './mail-message';
3
+ import type { MailConfig, SendMailOptions, SentMailResult } from './types';
4
+ /**
5
+ * Runner returned when chaining fluent send operations directly from MailManager.
6
+ */
7
+ export declare class FluentMailSender extends MailMessage {
8
+ private manager;
9
+ constructor(manager: MailManager, initialTo?: string | string[]);
10
+ send(): Promise<SentMailResult>;
11
+ }
12
+ /**
13
+ * High-level Mail Manager for Argos-JS applications.
14
+ * Handles dispatching emails through configured drivers (SMTP, Log).
15
+ */
16
+ export declare class MailManager {
17
+ private driver;
18
+ private defaultFrom?;
19
+ constructor(config: MailConfig, logger?: any);
20
+ /**
21
+ * Sends an email using the configured mail driver.
22
+ *
23
+ * @example
24
+ * await ctx.mail.send({
25
+ * to: 'user@example.com',
26
+ * subject: 'Welcome!',
27
+ * text: 'Hello from Argos!',
28
+ * });
29
+ */
30
+ send(options: SendMailOptions | MailMessage): Promise<SentMailResult>;
31
+ /**
32
+ * Starts a fluent email builder and sender.
33
+ *
34
+ * @example
35
+ * await ctx.mail.to('user@example.com')
36
+ * .subject('Hello!')
37
+ * .html('<h1>Welcome</h1>')
38
+ * .send();
39
+ */
40
+ to(to: string | string[]): FluentMailSender;
41
+ /**
42
+ * Creates a detached MailMessage object.
43
+ */
44
+ message(options?: Partial<SendMailOptions>): MailMessage;
45
+ /**
46
+ * Retrieves the underlying active MailDriver.
47
+ */
48
+ getDriver(): MailDriver;
49
+ /**
50
+ * Verifies the transport connection configuration.
51
+ */
52
+ verify(): Promise<boolean>;
53
+ }
54
+ //# sourceMappingURL=mail-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-manager.d.ts","sourceRoot":"","sources":["../src/mail-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE3E;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,OAAO,CAAC,OAAO,CAAc;gBAEjB,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAQlD,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC;CAG7C;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAC,CAAqB;gBAE7B,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,GAAG;IAW5C;;;;;;;;;OASG;IACU,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAWlF;;;;;;;;OAQG;IACI,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,gBAAgB;IAIlD;;OAEG;IACI,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,WAAW;IAI/D;;OAEG;IACI,SAAS,IAAI,UAAU;IAI9B;;OAEG;IACU,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAMxC"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MailManager = exports.FluentMailSender = void 0;
4
+ const smtp_1 = require("./drivers/smtp");
5
+ const log_1 = require("./drivers/log");
6
+ const mail_message_1 = require("./mail-message");
7
+ /**
8
+ * Runner returned when chaining fluent send operations directly from MailManager.
9
+ */
10
+ class FluentMailSender extends mail_message_1.MailMessage {
11
+ manager;
12
+ constructor(manager, initialTo) {
13
+ super();
14
+ this.manager = manager;
15
+ if (initialTo) {
16
+ this.to(initialTo);
17
+ }
18
+ }
19
+ async send() {
20
+ return this.manager.send(this.getOptions());
21
+ }
22
+ }
23
+ exports.FluentMailSender = FluentMailSender;
24
+ /**
25
+ * High-level Mail Manager for Argos-JS applications.
26
+ * Handles dispatching emails through configured drivers (SMTP, Log).
27
+ */
28
+ class MailManager {
29
+ driver;
30
+ defaultFrom;
31
+ constructor(config, logger) {
32
+ this.defaultFrom = config.from;
33
+ if (config.driver === 'smtp') {
34
+ this.driver = new smtp_1.SmtpMailDriver(config.smtp);
35
+ }
36
+ else {
37
+ // Default to 'log' driver
38
+ this.driver = new log_1.LogMailDriver(logger);
39
+ }
40
+ }
41
+ /**
42
+ * Sends an email using the configured mail driver.
43
+ *
44
+ * @example
45
+ * await ctx.mail.send({
46
+ * to: 'user@example.com',
47
+ * subject: 'Welcome!',
48
+ * text: 'Hello from Argos!',
49
+ * });
50
+ */
51
+ async send(options) {
52
+ const rawOptions = options instanceof mail_message_1.MailMessage ? options.getOptions() : options;
53
+ const finalOptions = {
54
+ ...rawOptions,
55
+ from: rawOptions.from || this.defaultFrom || 'no-reply@argos-js.dev',
56
+ };
57
+ return this.driver.send(finalOptions);
58
+ }
59
+ /**
60
+ * Starts a fluent email builder and sender.
61
+ *
62
+ * @example
63
+ * await ctx.mail.to('user@example.com')
64
+ * .subject('Hello!')
65
+ * .html('<h1>Welcome</h1>')
66
+ * .send();
67
+ */
68
+ to(to) {
69
+ return new FluentMailSender(this, to);
70
+ }
71
+ /**
72
+ * Creates a detached MailMessage object.
73
+ */
74
+ message(options) {
75
+ return new mail_message_1.MailMessage(options);
76
+ }
77
+ /**
78
+ * Retrieves the underlying active MailDriver.
79
+ */
80
+ getDriver() {
81
+ return this.driver;
82
+ }
83
+ /**
84
+ * Verifies the transport connection configuration.
85
+ */
86
+ async verify() {
87
+ if (typeof this.driver.verify === 'function') {
88
+ return this.driver.verify();
89
+ }
90
+ return true;
91
+ }
92
+ }
93
+ exports.MailManager = MailManager;
94
+ //# sourceMappingURL=mail-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-manager.js","sourceRoot":"","sources":["../src/mail-manager.ts"],"names":[],"mappings":";;;AACA,yCAAgD;AAChD,uCAA8C;AAC9C,iDAA6C;AAG7C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,0BAAW;IACvC,OAAO,CAAc;IAE7B,YAAY,OAAoB,EAAE,SAA6B;QAC7D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF;AAdD,4CAcC;AAED;;;GAGG;AACH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QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxED,kCAwEC"}
@@ -0,0 +1,20 @@
1
+ import type { MailAttachment, SendMailOptions } from './types';
2
+ /**
3
+ * Fluent builder for constructing structured email payloads.
4
+ */
5
+ export declare class MailMessage {
6
+ private options;
7
+ constructor(options?: Partial<SendMailOptions>);
8
+ to(to: string | string[]): this;
9
+ from(from: string): this;
10
+ subject(subject: string): this;
11
+ text(text: string): this;
12
+ html(html: string): this;
13
+ cc(cc: string | string[]): this;
14
+ bcc(bcc: string | string[]): this;
15
+ replyTo(replyTo: string): this;
16
+ attach(attachment: MailAttachment): this;
17
+ header(name: string, value: string): this;
18
+ getOptions(): SendMailOptions;
19
+ }
20
+ //# sourceMappingURL=mail-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-message.d.ts","sourceRoot":"","sources":["../src/mail-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IAevC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAK/B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAK/B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAKjC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK9B,MAAM,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAQxC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAQzC,UAAU,IAAI,eAAe;CAGrC"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MailMessage = void 0;
4
+ /**
5
+ * Fluent builder for constructing structured email payloads.
6
+ */
7
+ class MailMessage {
8
+ options;
9
+ constructor(options) {
10
+ this.options = {
11
+ to: options?.to ?? '',
12
+ subject: options?.subject ?? '',
13
+ text: options?.text,
14
+ html: options?.html,
15
+ from: options?.from,
16
+ cc: options?.cc,
17
+ bcc: options?.bcc,
18
+ replyTo: options?.replyTo,
19
+ attachments: options?.attachments ? [...options.attachments] : [],
20
+ headers: options?.headers ? { ...options.headers } : undefined,
21
+ };
22
+ }
23
+ to(to) {
24
+ this.options.to = to;
25
+ return this;
26
+ }
27
+ from(from) {
28
+ this.options.from = from;
29
+ return this;
30
+ }
31
+ subject(subject) {
32
+ this.options.subject = subject;
33
+ return this;
34
+ }
35
+ text(text) {
36
+ this.options.text = text;
37
+ return this;
38
+ }
39
+ html(html) {
40
+ this.options.html = html;
41
+ return this;
42
+ }
43
+ cc(cc) {
44
+ this.options.cc = cc;
45
+ return this;
46
+ }
47
+ bcc(bcc) {
48
+ this.options.bcc = bcc;
49
+ return this;
50
+ }
51
+ replyTo(replyTo) {
52
+ this.options.replyTo = replyTo;
53
+ return this;
54
+ }
55
+ attach(attachment) {
56
+ if (!this.options.attachments) {
57
+ this.options.attachments = [];
58
+ }
59
+ this.options.attachments.push(attachment);
60
+ return this;
61
+ }
62
+ header(name, value) {
63
+ if (!this.options.headers) {
64
+ this.options.headers = {};
65
+ }
66
+ this.options.headers[name] = value;
67
+ return this;
68
+ }
69
+ getOptions() {
70
+ return this.options;
71
+ }
72
+ }
73
+ exports.MailMessage = MailMessage;
74
+ //# sourceMappingURL=mail-message.js.map
@@ -0,0 +1 @@
1
+ {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AO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,EAAE,CAAC,EAAqB;QAC7B,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,GAAG,CAAC,GAAsB;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,UAA0B;QACtC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,IAAY,EAAE,KAAa;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA7ED,kCA6EC"}
@@ -0,0 +1,30 @@
1
+ import type { ArgosPlugin } from '@argos-js/core';
2
+ import type { MailConfig } from './types';
3
+ import { MailManager } from './mail-manager';
4
+ declare module '@argos-js/core' {
5
+ interface ArgosApplication {
6
+ mail: MailManager;
7
+ }
8
+ }
9
+ declare module '@argos-js/net' {
10
+ interface ArgosContext {
11
+ mail: MailManager;
12
+ }
13
+ }
14
+ /**
15
+ * Mail plugin for native Argos-JS integration.
16
+ * Injects app.mail and ctx.mail across all application routes and middlewares.
17
+ *
18
+ * @example
19
+ * await app.register(mailPlugin, {
20
+ * driver: 'smtp',
21
+ * from: 'hello@myapp.com',
22
+ * smtp: {
23
+ * host: 'smtp.mailtrap.io',
24
+ * port: 2525,
25
+ * auth: { user: '...', pass: '...' },
26
+ * },
27
+ * });
28
+ */
29
+ export declare const mailPlugin: ArgosPlugin<MailConfig>;
30
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,gBAAgB;QACxB,IAAI,EAAE,WAAW,CAAC;KACnB;CACF;AAED,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,YAAY;QACpB,IAAI,EAAE,WAAW,CAAC;KACnB;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,UAAU,CAY9C,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mailPlugin = void 0;
4
+ const mail_manager_1 = require("./mail-manager");
5
+ /**
6
+ * Mail plugin for native Argos-JS integration.
7
+ * Injects app.mail and ctx.mail across all application routes and middlewares.
8
+ *
9
+ * @example
10
+ * await app.register(mailPlugin, {
11
+ * driver: 'smtp',
12
+ * from: 'hello@myapp.com',
13
+ * smtp: {
14
+ * host: 'smtp.mailtrap.io',
15
+ * port: 2525,
16
+ * auth: { user: '...', pass: '...' },
17
+ * },
18
+ * });
19
+ */
20
+ const mailPlugin = async (app, options) => {
21
+ const manager = new mail_manager_1.MailManager(options, app.log);
22
+ app.mail = manager;
23
+ app.use(async (ctx, next) => {
24
+ ctx.mail = manager;
25
+ return next();
26
+ });
27
+ };
28
+ exports.mailPlugin = mailPlugin;
29
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAc7C;;;;;;;;;;;;;;GAcG;AACI,MAAM,UAAU,GAA4B,KAAK,EACtD,GAAqB,EACrB,OAAmB,EACJ,EAAE;IACjB,MAAM,OAAO,GAAG,IAAI,0BAAW,CAAC,OAAO,EAAG,GAAW,CAAC,GAAG,CAAC,CAAC;IAE1D,GAAW,CAAC,IAAI,GAAG,OAAO,CAAC;IAE5B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,GAAW,CAAC,IAAI,GAAG,OAAO,CAAC;QAC5B,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB"}
@@ -0,0 +1,49 @@
1
+ export type MailDriverType = 'smtp' | 'log';
2
+ export interface SmtpAuth {
3
+ user: string;
4
+ pass: string;
5
+ }
6
+ export interface SmtpConfig {
7
+ host?: string | undefined;
8
+ port?: number | undefined;
9
+ secure?: boolean | undefined;
10
+ auth?: SmtpAuth | undefined;
11
+ connectionString?: string | undefined;
12
+ pool?: boolean | undefined;
13
+ tls?: Record<string, unknown> | undefined;
14
+ [key: string]: unknown;
15
+ }
16
+ export interface MailConfig {
17
+ driver: MailDriverType;
18
+ from?: string | undefined;
19
+ smtp?: SmtpConfig | undefined;
20
+ [key: string]: unknown;
21
+ }
22
+ export interface MailAttachment {
23
+ filename?: string | undefined;
24
+ content?: string | Buffer | undefined;
25
+ path?: string | undefined;
26
+ contentType?: string | undefined;
27
+ }
28
+ export interface SendMailOptions {
29
+ to: string | string[];
30
+ subject: string;
31
+ text?: string | undefined;
32
+ html?: string | undefined;
33
+ from?: string | undefined;
34
+ cc?: string | string[] | undefined;
35
+ bcc?: string | string[] | undefined;
36
+ replyTo?: string | undefined;
37
+ attachments?: MailAttachment[] | undefined;
38
+ headers?: Record<string, string> | undefined;
39
+ }
40
+ export interface SentMailResult {
41
+ success: boolean;
42
+ messageId?: string | undefined;
43
+ driver: MailDriverType;
44
+ to: string | string[];
45
+ subject: string;
46
+ response?: unknown | undefined;
47
+ previewUrl?: string | undefined;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1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dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@argos-js/mail",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Fluent mail sending manager and multi-driver email plugin for Argos-JS",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "nodemailer": "^6.9.16",
16
+ "@argos-js/core": "0.1.0",
17
+ "@argos-js/net": "0.1.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^20.11.0",
21
+ "@types/nodemailer": "^6.4.17",
22
+ "tsx": "^4.7.0",
23
+ "typescript": "^5.4.0"
24
+ },
25
+ "license": "MIT",
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "dev": "tsc --watch",
34
+ "test": "tsx test.ts"
35
+ }
6
36
  }