@owlmeans/server-mailer-mailgun 0.1.6 → 0.1.8
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/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @owlmeans/server-mailer-mailgun
|
|
2
|
+
|
|
3
|
+
Mailgun production email transport for OwlMeans — implements `MailerService` via the Mailgun HTTP API.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
- `makeMailgunMailer()` — creates a `MailerService` that sends via the Mailgun v3 REST API
|
|
8
|
+
- `MAILGUN_MAILER` constant — context alias for registration and lookup
|
|
9
|
+
- `MailgunConfig` — extends `ServerConfig` with `{ apiKey, domain, from, baseUrl? }`
|
|
10
|
+
- Zero extra runtime dependencies — uses the global `fetch()` (Node 18+)
|
|
11
|
+
- Swap in for the default console transport by registering this service in your server context
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @owlmeans/server-mailer-mailgun
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { makeMailgunMailer, MAILGUN_MAILER } from '@owlmeans/server-mailer-mailgun'
|
|
23
|
+
|
|
24
|
+
// Register in your server context
|
|
25
|
+
context.registerService(makeMailgunMailer())
|
|
26
|
+
|
|
27
|
+
// Config section (in your server config object)
|
|
28
|
+
const config = {
|
|
29
|
+
mailgun: {
|
|
30
|
+
apiKey: process.env.MAILGUN_API_KEY!,
|
|
31
|
+
domain: 'mg.example.com',
|
|
32
|
+
from: 'OwlMeans Platform <noreply@mg.example.com>',
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The service is resolved at runtime via `context.service<MailerService>(MAILGUN_MAILER)` — or automatically by code that resolves `MAILER_SERVICE` from `@owlmeans/mailer` when this service is registered under that alias.
|
|
38
|
+
|
|
39
|
+
<!-- owlmeans:agent-guidance:start -->
|
|
40
|
+
## Agent guidance
|
|
41
|
+
|
|
42
|
+
This package ships embedded Claude Code skills and GitHub Copilot instructions under
|
|
43
|
+
`agent-meta/`. After installing your `@owlmeans/*` packages, run the OwlMeans
|
|
44
|
+
agent-skills installer to place them into your project's native locations
|
|
45
|
+
(`.claude/skills/` and `.github/instructions/`):
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npx @owlmeans/agent-skills
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The embedded files are version-matched to this package release. Do not edit them
|
|
52
|
+
directly — they are regenerated on each publish. To contribute guidance edits,
|
|
53
|
+
open a PR against the source monorepo.
|
|
54
|
+
<!-- owlmeans:agent-guidance:end -->
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How to use @owlmeans/server-mailer-mailgun — Mailgun production email transport. Use when configuring the production MailerService."
|
|
3
|
+
applyTo: "**/context.ts, **/config.ts"
|
|
4
|
+
---
|
|
5
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
+
|
|
7
|
+
# Using `@owlmeans/server-mailer-mailgun`
|
|
8
|
+
|
|
9
|
+
Production Mailgun transport implementing `@owlmeans/mailer`'s `MailerService` interface. Reads config from `ctx.cfg.mailgun`.
|
|
10
|
+
|
|
11
|
+
## Public API surface
|
|
12
|
+
|
|
13
|
+
| Symbol | Kind | Purpose |
|
|
14
|
+
|--------|------|---------|
|
|
15
|
+
| `makeMailgunMailerService(alias?)` | fn | Service factory |
|
|
16
|
+
| `MailgunConfig` | interface | Extends `ServerConfig` with `mailgun: { apiKey, domain, from, baseUrl? }` |
|
|
17
|
+
| `MAILGUN_MAILER` | const | Default alias `'mailgun-mailer'` |
|
|
18
|
+
|
|
19
|
+
## Config shape
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import type { MailgunConfig } from '@owlmeans/server-mailer-mailgun'
|
|
23
|
+
|
|
24
|
+
cfg.mailgun = {
|
|
25
|
+
apiKey: process.env.MAILGUN_API_KEY!,
|
|
26
|
+
domain: process.env.MAILGUN_DOMAIN!, // e.g. 'mg.example.com'
|
|
27
|
+
from: process.env.MAILGUN_FROM!, // e.g. 'OwlMeans <no-reply@mg.example.com>'
|
|
28
|
+
baseUrl: 'https://api.eu.mailgun.net/v3', // optional, default 'https://api.mailgun.net/v3'
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Registration
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { makeMailgunMailerService } from '@owlmeans/server-mailer-mailgun'
|
|
36
|
+
import { MAILER_SERVICE } from '@owlmeans/mailer'
|
|
37
|
+
|
|
38
|
+
context.registerService(makeMailgunMailerService(MAILER_SERVICE))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Register under `MAILER_SERVICE` so platform code (OTP service, etc.) can resolve it without knowing the concrete transport.
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- For EU region, set `baseUrl: 'https://api.eu.mailgun.net/v3'`.
|
|
46
|
+
- The service reads `ctx.cfg.mailgun` at call time — the config must be on the context's `cfg` object.
|
|
47
|
+
- Throws a plain `Error` with the Mailgun status code and body if the API call fails; callers should wrap in a domain error if needed.
|
|
48
|
+
- Never use this in tests — use `makeConsoleMailerService` instead.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"package": "@owlmeans/server-mailer-mailgun",
|
|
4
|
+
"version": "0.1.8",
|
|
5
|
+
"generatedAt": "2026-06-11T16:30:27.190Z",
|
|
6
|
+
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
|
+
"entries": [
|
|
8
|
+
{
|
|
9
|
+
"kind": "instruction",
|
|
10
|
+
"name": "server-mailer-mailgun",
|
|
11
|
+
"category": "package-specific",
|
|
12
|
+
"file": "instructions/server-mailer-mailgun.instructions.md",
|
|
13
|
+
"canonicalPath": ".github/instructions/server-mailer-mailgun.instructions.md"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-mailer-mailgun",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/context": "^0.1.
|
|
26
|
-
"@owlmeans/error": "^0.1.
|
|
27
|
-
"@owlmeans/mailer": "^0.1.
|
|
25
|
+
"@owlmeans/context": "^0.1.8",
|
|
26
|
+
"@owlmeans/error": "^0.1.8",
|
|
27
|
+
"@owlmeans/mailer": "^0.1.8"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@owlmeans/dep-config": "workspace:*",
|