@wild-framework/mail 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 Wild Framework contributors
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 ADDED
@@ -0,0 +1,27 @@
1
+ # @wild-framework/mail
2
+
3
+ Mail abstraction for [Wild Framework](https://github.com/your-org/wild-framework).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @wild-framework/mail
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Mail } from "@wild-framework/mail";
15
+
16
+ await mail.send({
17
+ to: "user@example.com",
18
+ subject: "Welcome!",
19
+ html: "<h1>Hi</h1>",
20
+ });
21
+ ```
22
+
23
+ Ships with an in-memory driver for development/testing. Implement `MailDriver` for Resend/SendGrid/SES/SMTP.
24
+
25
+ ## License
26
+
27
+ MIT
@@ -0,0 +1,22 @@
1
+ /**
2
+ * An email message.
3
+ */
4
+ export interface MailMessage {
5
+ to: string | string[];
6
+ subject: string;
7
+ html?: string;
8
+ text?: string;
9
+ from?: string;
10
+ cc?: string | string[];
11
+ bcc?: string | string[];
12
+ }
13
+ /**
14
+ * Mail driver contract.
15
+ *
16
+ * Implement this to add providers (Resend, SendGrid, SES, SMTP, etc.).
17
+ * App code depends on `Mail`, never on a driver directly.
18
+ */
19
+ export interface MailDriver {
20
+ send(message: MailMessage): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACvB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C"}
package/dist/driver.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { MailDriver, MailMessage } from "./driver.js";
2
+ /**
3
+ * In-memory mail driver.
4
+ *
5
+ * Captures sent messages in an array. Intended for local development
6
+ * and testing — no actual emails are sent.
7
+ */
8
+ export declare class InMemoryMailDriver implements MailDriver {
9
+ sent: MailMessage[];
10
+ send(message: MailMessage): Promise<void>;
11
+ /** Clear all captured messages. */
12
+ clear(): void;
13
+ }
14
+ //# sourceMappingURL=in-memory-driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-driver.d.ts","sourceRoot":"","sources":["../src/in-memory-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,UAAU;IAC1C,IAAI,EAAE,WAAW,EAAE,CAAM;IAE1B,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,mCAAmC;IACnC,KAAK,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * In-memory mail driver.
3
+ *
4
+ * Captures sent messages in an array. Intended for local development
5
+ * and testing — no actual emails are sent.
6
+ */
7
+ export class InMemoryMailDriver {
8
+ sent = [];
9
+ async send(message) {
10
+ this.sent.push(message);
11
+ }
12
+ /** Clear all captured messages. */
13
+ clear() {
14
+ this.sent = [];
15
+ }
16
+ }
17
+ //# sourceMappingURL=in-memory-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-driver.js","sourceRoot":"","sources":["../src/in-memory-driver.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IACpB,IAAI,GAAkB,EAAE,CAAC;IAEhC,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,mCAAmC;IACnC,KAAK;QACD,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;CACJ"}
@@ -0,0 +1,5 @@
1
+ export { Mail } from "./mail.js";
2
+ export { MailProvider } from "./provider.js";
3
+ export { InMemoryMailDriver } from "./in-memory-driver.js";
4
+ export type { MailDriver, MailMessage } from "./driver.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { Mail } from "./mail.js";
2
+ export { MailProvider } from "./provider.js";
3
+ export { InMemoryMailDriver } from "./in-memory-driver.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/mail.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { MailDriver } from "./driver.js";
2
+ /**
3
+ * Email facade.
4
+ *
5
+ * Wraps a `MailDriver` and exposes a consistent API.
6
+ * Resolved from the container: `app.resolve(Mail)`.
7
+ */
8
+ export declare class Mail {
9
+ private driver;
10
+ constructor(driver: MailDriver);
11
+ /**
12
+ * Send an email message.
13
+ */
14
+ send(message: Parameters<MailDriver["send"]>[0]): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=mail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,qBAAa,IAAI;IACD,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE"}
package/dist/mail.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Email facade.
3
+ *
4
+ * Wraps a `MailDriver` and exposes a consistent API.
5
+ * Resolved from the container: `app.resolve(Mail)`.
6
+ */
7
+ export class Mail {
8
+ driver;
9
+ constructor(driver) {
10
+ this.driver = driver;
11
+ }
12
+ /**
13
+ * Send an email message.
14
+ */
15
+ send(message) {
16
+ return this.driver.send(message);
17
+ }
18
+ }
19
+ //# sourceMappingURL=mail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.js","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,IAAI;IACO;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;OAEG;IACH,IAAI,CAAC,OAA0C;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ import type { Provider, Application } from "@wild-framework/core";
2
+ /**
3
+ * Registers the mail system with the application.
4
+ *
5
+ * Binds a `Mail` backed by the in-memory driver. Swap drivers by
6
+ * implementing `MailDriver` and binding a new `Mail` — app code
7
+ * never changes.
8
+ */
9
+ export declare class MailProvider implements Provider {
10
+ register(app: Application): void;
11
+ }
12
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKlE;;;;;;GAMG;AACH,qBAAa,YAAa,YAAW,QAAQ;IACzC,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;CAKnC"}
@@ -0,0 +1,18 @@
1
+ import { Container } from "@wild-framework/container";
2
+ import { Mail } from "./mail.js";
3
+ import { InMemoryMailDriver } from "./in-memory-driver.js";
4
+ /**
5
+ * Registers the mail system with the application.
6
+ *
7
+ * Binds a `Mail` backed by the in-memory driver. Swap drivers by
8
+ * implementing `MailDriver` and binding a new `Mail` — app code
9
+ * never changes.
10
+ */
11
+ export class MailProvider {
12
+ register(app) {
13
+ const container = app.resolve(Container);
14
+ const mail = new Mail(new InMemoryMailDriver());
15
+ container.singleton(Mail, () => mail);
16
+ }
17
+ }
18
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IACrB,QAAQ,CAAC,GAAgB;QACrB,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;QAChD,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@wild-framework/mail",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Sphah",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/KhandaSoftware/wild-framework.git"
24
+ },
25
+ "description": "Mail abstraction for Wild Framework.",
26
+ "keywords": [
27
+ "wild",
28
+ "framework",
29
+ "mail",
30
+ "email",
31
+ "resend"
32
+ ],
33
+ "dependencies": {
34
+ "@wild-framework/core": "0.1.0",
35
+ "@wild-framework/container": "0.1.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "clean": "rm -rf dist",
40
+ "test": "vitest run"
41
+ }
42
+ }