@contact-api/resend 0.0.1

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 contact-api
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,16 @@
1
+ # Contact API Resend
2
+ Resend email provider for `@contact-api/core`.
3
+
4
+ ## Usage
5
+ ```ts
6
+ import { createResendProvider } from "@contact-api/resend";
7
+ const provider = createResendProvider(); // reads RESEND_API_KEY
8
+ ```
9
+
10
+ ## Environment Variables
11
+ | Variable | Description |
12
+ | --- | --- |
13
+ | `RESEND_API_KEY` | Resend API key |
14
+
15
+ ## License
16
+ MIT License - see [LICENSE](./LICENSE) for details.
@@ -0,0 +1,13 @@
1
+ import { EmailPayload, EmailProvider } from "@contact-api/core/types";
2
+
3
+ //#region src/index.d.ts
4
+ declare class ResendProvider implements EmailProvider {
5
+ readonly id = "resend";
6
+ private client;
7
+ constructor(apiKey: string);
8
+ send(payload: EmailPayload): Promise<void>;
9
+ }
10
+ declare function createResendProvider(): EmailProvider | null;
11
+ //#endregion
12
+ export { ResendProvider, createResendProvider };
13
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,33 @@
1
+ import { Resend } from "resend";
2
+ //#region src/index.ts
3
+ var ResendProvider = class {
4
+ id = "resend";
5
+ client;
6
+ constructor(apiKey) {
7
+ this.client = new Resend(apiKey);
8
+ }
9
+ async send(payload) {
10
+ const result = await this.client.emails.send(payload);
11
+ if (result.error) {
12
+ console.error("Resend API error:", result.error);
13
+ throw new Error(`Email send failed: ${result.error.message}`);
14
+ }
15
+ }
16
+ };
17
+ function createResendProvider() {
18
+ const apiKey = process.env["RESEND_API_KEY"];
19
+ if (!apiKey) {
20
+ console.warn("RESEND_API_KEY missing for resend");
21
+ return null;
22
+ }
23
+ try {
24
+ return new ResendProvider(apiKey);
25
+ } catch (e) {
26
+ console.error("Failed to initialize Resend provider:", e);
27
+ return null;
28
+ }
29
+ }
30
+ //#endregion
31
+ export { ResendProvider, createResendProvider };
32
+
33
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { Resend } from \"resend\";\nimport type { EmailProvider, EmailPayload } from \"@contact-api/core/types\";\n\nexport class ResendProvider implements EmailProvider {\n readonly id = \"resend\";\n private client: Resend;\n\n constructor(apiKey: string) {\n this.client = new Resend(apiKey);\n }\n\n async send(payload: EmailPayload): Promise<void> {\n const result = await this.client.emails.send(payload);\n if (result.error) {\n console.error(\"Resend API error:\", result.error);\n throw new Error(`Email send failed: ${result.error.message}`);\n }\n }\n}\n\nexport function createResendProvider(): EmailProvider | null {\n const apiKey = process.env[\"RESEND_API_KEY\"];\n if (!apiKey) {\n console.warn(\"RESEND_API_KEY missing for resend\");\n return null;\n }\n try { return new ResendProvider(apiKey); }\n catch (e) {\n console.error(\"Failed to initialize Resend provider:\", e);\n return null;\n }\n}\n"],"mappings":";;AAGA,IAAa,iBAAb,MAAqD;CACnD,KAAc;CACd;CAEA,YAAY,QAAgB;EAC1B,KAAK,SAAS,IAAI,OAAO,MAAM;CACjC;CAEA,MAAM,KAAK,SAAsC;EAC/C,MAAM,SAAS,MAAM,KAAK,OAAO,OAAO,KAAK,OAAO;EACpD,IAAI,OAAO,OAAO;GAChB,QAAQ,MAAM,qBAAqB,OAAO,KAAK;GAC/C,MAAM,IAAI,MAAM,sBAAsB,OAAO,MAAM,SAAS;EAC9D;CACF;AACF;AAEA,SAAgB,uBAA6C;CAC3D,MAAM,SAAS,QAAQ,IAAI;CAC3B,IAAI,CAAC,QAAQ;EACX,QAAQ,KAAK,mCAAmC;EAChD,OAAO;CACT;CACA,IAAI;EAAE,OAAO,IAAI,eAAe,MAAM;CAAG,SAClC,GAAG;EACR,QAAQ,MAAM,yCAAyC,CAAC;EACxD,OAAO;CACT;AACF"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@contact-api/resend",
3
+ "description": "Resend email provider for @contact-api/core",
4
+ "author": "Mason L'Etoile",
5
+ "version": "0.0.1",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/contact-api/resend.git"
10
+ },
11
+ "homepage": "https://github.com/contact-api/resend#readme",
12
+ "bugs": { "url": "https://github.com/contact-api/resend/issues" },
13
+ "keywords": ["resend", "email", "contact-form", "typescript", "contact-api"],
14
+ "type": "module",
15
+ "scripts": {
16
+ "typecheck": "tsc --noEmit",
17
+ "test": "vitest",
18
+ "test:watch": "vitest --watch",
19
+ "test:coverage": "vitest --coverage",
20
+ "build": "tsdown",
21
+ "prepare": "npm run build"
22
+ },
23
+ "files": ["dist"],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.mts",
27
+ "import": "./dist/index.mjs"
28
+ }
29
+ },
30
+ "dependencies": {
31
+ "@contact-api/core": "0.0.1",
32
+ "resend": "^6.9.3"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^25.5.0",
36
+ "@vitest/coverage-v8": "^4.1.9",
37
+ "tsdown": "^0.22.0",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^4.1.9"
40
+ }
41
+ }