@beignet/provider-mail-resend 0.0.32 → 0.0.34
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/CHANGELOG.md +14 -0
- package/README.md +11 -9
- package/dist/index.d.ts +2 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -9
- package/package.json +2 -2
- package/src/index.ts +3 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @beignet/provider-mail-resend
|
|
2
2
|
|
|
3
|
+
## 0.0.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9345cc9: Stabilize the pre-1.0 public surface around factory-only providers, canonical server and testing imports, consistent memory naming, and the removal of deprecated aliases.
|
|
8
|
+
|
|
9
|
+
## 0.0.33
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 92af951: Document and test the provider resilience baseline: mail providers fail fast
|
|
14
|
+
without provider-owned retries, while S3 delegates bounded retries to the AWS
|
|
15
|
+
SDK or caller-owned injected clients.
|
|
16
|
+
|
|
3
17
|
## 0.0.32
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -21,12 +21,12 @@ the SDK's Node.js 20+ runtime requirement.
|
|
|
21
21
|
## Setup
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import {
|
|
24
|
+
import { createResendMailProvider } from "@beignet/provider-mail-resend";
|
|
25
25
|
import { createServer } from "@beignet/core/server";
|
|
26
26
|
|
|
27
27
|
const server = await createServer({
|
|
28
28
|
ports: basePorts,
|
|
29
|
-
providers: [
|
|
29
|
+
providers: [createResendMailProvider()],
|
|
30
30
|
context: ({ ports }) => ({ ports }),
|
|
31
31
|
routes,
|
|
32
32
|
});
|
|
@@ -57,8 +57,8 @@ export const providers = [
|
|
|
57
57
|
];
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
`
|
|
61
|
-
|
|
60
|
+
Calling `createResendMailProvider()` with no options uses the env-backed
|
|
61
|
+
configuration.
|
|
62
62
|
|
|
63
63
|
## Use in application code
|
|
64
64
|
|
|
@@ -115,9 +115,10 @@ When `ctx.ports.devtools` is installed, this provider records `mail.send`,
|
|
|
115
115
|
|
|
116
116
|
## Failure and retry semantics
|
|
117
117
|
|
|
118
|
-
The provider fails fast and does not retry.
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
The provider fails fast and does not retry. Each `send(...)` call makes one
|
|
119
|
+
Resend SDK call, even for transient network errors or provider-side failures.
|
|
120
|
+
Mail delivery is not idempotent: a timed-out send may still have been
|
|
121
|
+
delivered, so a blind provider retry risks duplicate emails.
|
|
121
122
|
|
|
122
123
|
Delivery failures throw `MailDeliveryError` from `@beignet/core/mail` with the
|
|
123
124
|
provider name, the recipient count, and the original Resend error preserved as
|
|
@@ -125,8 +126,9 @@ provider name, the recipient count, and the original Resend error preserved as
|
|
|
125
126
|
configuration problems throw during provider setup.
|
|
126
127
|
|
|
127
128
|
When mail needs retries, dispatch it from a job or an outbox-backed listener
|
|
128
|
-
and own idempotency there
|
|
129
|
-
event before
|
|
129
|
+
and own idempotency there. The job or outbox row should choose attempts and
|
|
130
|
+
delay, and the application should record one delivery per business event before
|
|
131
|
+
sending.
|
|
130
132
|
|
|
131
133
|
## Local and tests
|
|
132
134
|
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface ResendMailEscapeHatch {
|
|
|
25
25
|
client: Resend;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Ports contributed by `
|
|
28
|
+
* Ports contributed by `createResendMailProvider`.
|
|
29
29
|
*/
|
|
30
30
|
export interface ResendMailProviderPorts {
|
|
31
31
|
/**
|
|
@@ -57,7 +57,7 @@ export interface CreateResendMailerOptions {
|
|
|
57
57
|
/**
|
|
58
58
|
* Create a Beignet mailer port backed by Resend.
|
|
59
59
|
*
|
|
60
|
-
* Use this directly for custom wiring, or install `
|
|
60
|
+
* Use this directly for custom wiring, or install `createResendMailProvider` to load
|
|
61
61
|
* config from env and contribute ports during server startup.
|
|
62
62
|
*/
|
|
63
63
|
export declare function createResendMailer({ client, from, instrumentation: instrumentationTarget, }: CreateResendMailerOptions): MailerPort;
|
|
@@ -89,20 +89,5 @@ export declare function createResendMailProvider(options?: CreateResendMailProvi
|
|
|
89
89
|
client: Resend;
|
|
90
90
|
};
|
|
91
91
|
}, unknown, void>;
|
|
92
|
-
/**
|
|
93
|
-
* Default env-backed Resend mail provider.
|
|
94
|
-
*
|
|
95
|
-
* Reads `RESEND_API_KEY` and `RESEND_FROM`, contributes `ports.mailer`, and
|
|
96
|
-
* exposes `ports.resend.client` as an escape hatch.
|
|
97
|
-
*/
|
|
98
|
-
export declare const resendMailProvider: import("@beignet/core/providers").ServiceProvider<unknown, z.ZodObject<{
|
|
99
|
-
API_KEY: z.ZodString;
|
|
100
|
-
FROM: z.ZodString;
|
|
101
|
-
}, z.core.$strip>, {
|
|
102
|
-
mailer: MailerPort;
|
|
103
|
-
resend: {
|
|
104
|
-
client: Resend;
|
|
105
|
-
};
|
|
106
|
-
}, unknown, void>;
|
|
107
92
|
export {};
|
|
108
93
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,UAAU,EAIhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA2B,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,sBAAsB;;;iBAG1B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GA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AAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,6BAA6B,CAAC;CACjD;AA2DD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,IAAI,EACJ,eAAe,EAAE,qBAAqB,GACvC,EAAE,yBAAyB,GAAG,UAAU,CAwFxC;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,+BAAoC;;;;;;;;kBA2C9C"}
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ function createResendPayload(message, defaultFrom) {
|
|
|
44
44
|
/**
|
|
45
45
|
* Create a Beignet mailer port backed by Resend.
|
|
46
46
|
*
|
|
47
|
-
* Use this directly for custom wiring, or install `
|
|
47
|
+
* Use this directly for custom wiring, or install `createResendMailProvider` to load
|
|
48
48
|
* config from env and contribute ports during server startup.
|
|
49
49
|
*/
|
|
50
50
|
export function createResendMailer({ client, from, instrumentation: instrumentationTarget, }) {
|
|
@@ -145,7 +145,7 @@ export function createResendMailProvider(options = {}) {
|
|
|
145
145
|
},
|
|
146
146
|
async setup({ config, ports }) {
|
|
147
147
|
if (!config) {
|
|
148
|
-
throw new Error("[
|
|
148
|
+
throw new Error("[createResendMailProvider] Missing Resend config. " +
|
|
149
149
|
"Please set RESEND_API_KEY and RESEND_FROM environment variables.");
|
|
150
150
|
}
|
|
151
151
|
const { API_KEY: apiKey, FROM: from } = config;
|
|
@@ -168,10 +168,3 @@ export function createResendMailProvider(options = {}) {
|
|
|
168
168
|
},
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Default env-backed Resend mail provider.
|
|
173
|
-
*
|
|
174
|
-
* Reads `RESEND_API_KEY` and `RESEND_FROM`, contributes `ports.mailer`, and
|
|
175
|
-
* exposes `ports.resend.client` as an escape hatch.
|
|
176
|
-
*/
|
|
177
|
-
export const resendMailProvider = createResendMailProvider();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beignet/provider-mail-resend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Resend mail provider for Beignet - adds mailer port using Resend",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"registration": {
|
|
95
95
|
"required": true,
|
|
96
96
|
"tokens": [
|
|
97
|
-
"
|
|
97
|
+
"createResendMailProvider"
|
|
98
98
|
]
|
|
99
99
|
}
|
|
100
100
|
}
|
package/src/index.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface ResendMailEscapeHatch {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Ports contributed by `
|
|
46
|
+
* Ports contributed by `createResendMailProvider`.
|
|
47
47
|
*/
|
|
48
48
|
export interface ResendMailProviderPorts {
|
|
49
49
|
/**
|
|
@@ -134,7 +134,7 @@ function createResendPayload(
|
|
|
134
134
|
/**
|
|
135
135
|
* Create a Beignet mailer port backed by Resend.
|
|
136
136
|
*
|
|
137
|
-
* Use this directly for custom wiring, or install `
|
|
137
|
+
* Use this directly for custom wiring, or install `createResendMailProvider` to load
|
|
138
138
|
* config from env and contribute ports during server startup.
|
|
139
139
|
*/
|
|
140
140
|
export function createResendMailer({
|
|
@@ -270,7 +270,7 @@ export function createResendMailProvider(
|
|
|
270
270
|
async setup({ config, ports }) {
|
|
271
271
|
if (!config) {
|
|
272
272
|
throw new Error(
|
|
273
|
-
"[
|
|
273
|
+
"[createResendMailProvider] Missing Resend config. " +
|
|
274
274
|
"Please set RESEND_API_KEY and RESEND_FROM environment variables.",
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -296,11 +296,3 @@ export function createResendMailProvider(
|
|
|
296
296
|
},
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Default env-backed Resend mail provider.
|
|
302
|
-
*
|
|
303
|
-
* Reads `RESEND_API_KEY` and `RESEND_FROM`, contributes `ports.mailer`, and
|
|
304
|
-
* exposes `ports.resend.client` as an escape hatch.
|
|
305
|
-
*/
|
|
306
|
-
export const resendMailProvider = createResendMailProvider();
|