@beignet/provider-mail-resend 0.0.33 → 0.0.35
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 +12 -0
- package/README.md +8 -4
- package/dist/index.d.ts +12 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -9
- package/package.json +2 -2
- package/src/index.ts +20 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @beignet/provider-mail-resend
|
|
2
2
|
|
|
3
|
+
## 0.0.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7d0c795: Expose stable named provider types while keeping private config schemas out of package declarations and preserving validated config and contributed-port inference. Drizzle's Postgres and MySQL config schema constants are now internal; use the exported config interfaces for validated shapes.
|
|
8
|
+
|
|
9
|
+
## 0.0.34
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
3
15
|
## 0.0.33
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -9,6 +9,10 @@ Resend-backed mail provider for Beignet.
|
|
|
9
9
|
The provider installs the app-facing `ctx.ports.mailer` port and exposes
|
|
10
10
|
`ctx.ports.resend.client` only as an escape hatch for Resend-specific features.
|
|
11
11
|
|
|
12
|
+
`createResendMailProvider(...)` returns the stable `ResendMailProvider` type.
|
|
13
|
+
`ResendMailConfig` describes its validated config; the Zod schema remains
|
|
14
|
+
internal.
|
|
15
|
+
|
|
12
16
|
## Install
|
|
13
17
|
|
|
14
18
|
```bash
|
|
@@ -21,12 +25,12 @@ the SDK's Node.js 20+ runtime requirement.
|
|
|
21
25
|
## Setup
|
|
22
26
|
|
|
23
27
|
```typescript
|
|
24
|
-
import {
|
|
28
|
+
import { createResendMailProvider } from "@beignet/provider-mail-resend";
|
|
25
29
|
import { createServer } from "@beignet/core/server";
|
|
26
30
|
|
|
27
31
|
const server = await createServer({
|
|
28
32
|
ports: basePorts,
|
|
29
|
-
providers: [
|
|
33
|
+
providers: [createResendMailProvider()],
|
|
30
34
|
context: ({ ports }) => ({ ports }),
|
|
31
35
|
routes,
|
|
32
36
|
});
|
|
@@ -57,8 +61,8 @@ export const providers = [
|
|
|
57
61
|
];
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
`
|
|
61
|
-
|
|
64
|
+
Calling `createResendMailProvider()` with no options uses the env-backed
|
|
65
|
+
configuration.
|
|
62
66
|
|
|
63
67
|
## Use in application code
|
|
64
68
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
* Resend-backed mail provider for Beignet.
|
|
5
5
|
*/
|
|
6
6
|
import { type MailAddress, type MailerPort } from "@beignet/core/mail";
|
|
7
|
-
import { type ProviderInstrumentationTarget } from "@beignet/core/providers";
|
|
7
|
+
import { type AnyProviderConfigSchema, type ProviderInstrumentationTarget, type ServiceProvider } from "@beignet/core/providers";
|
|
8
8
|
import { Resend } from "resend";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
declare const ResendMailConfigSchema: z.ZodObject<{
|
|
11
|
-
API_KEY: z.ZodString;
|
|
12
|
-
FROM: z.ZodString;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
9
|
/**
|
|
15
10
|
* Resend provider config loaded from `RESEND_API_KEY` and `RESEND_FROM`.
|
|
16
11
|
*/
|
|
17
|
-
export
|
|
12
|
+
export interface ResendMailConfig {
|
|
13
|
+
API_KEY: string;
|
|
14
|
+
FROM: string;
|
|
15
|
+
}
|
|
18
16
|
/**
|
|
19
17
|
* Escape hatch for apps that need the raw Resend client.
|
|
20
18
|
*/
|
|
@@ -25,7 +23,7 @@ export interface ResendMailEscapeHatch {
|
|
|
25
23
|
client: Resend;
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
|
-
* Ports contributed by `
|
|
26
|
+
* Ports contributed by `createResendMailProvider`.
|
|
29
27
|
*/
|
|
30
28
|
export interface ResendMailProviderPorts {
|
|
31
29
|
/**
|
|
@@ -37,6 +35,10 @@ export interface ResendMailProviderPorts {
|
|
|
37
35
|
*/
|
|
38
36
|
resend: ResendMailEscapeHatch;
|
|
39
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Resend mail lifecycle provider with stable contributed-port typing.
|
|
40
|
+
*/
|
|
41
|
+
export type ResendMailProvider = ServiceProvider<unknown, AnyProviderConfigSchema<ResendMailConfig>, Pick<ResendMailProviderPorts, keyof ResendMailProviderPorts>>;
|
|
40
42
|
/**
|
|
41
43
|
* Options for creating a Resend-backed mailer directly.
|
|
42
44
|
*/
|
|
@@ -57,7 +59,7 @@ export interface CreateResendMailerOptions {
|
|
|
57
59
|
/**
|
|
58
60
|
* Create a Beignet mailer port backed by Resend.
|
|
59
61
|
*
|
|
60
|
-
* Use this directly for custom wiring, or install `
|
|
62
|
+
* Use this directly for custom wiring, or install `createResendMailProvider` to load
|
|
61
63
|
* config from env and contribute ports during server startup.
|
|
62
64
|
*/
|
|
63
65
|
export declare function createResendMailer({ client, from, instrumentation: instrumentationTarget, }: CreateResendMailerOptions): MailerPort;
|
|
@@ -80,29 +82,5 @@ export interface CreateResendMailProviderOptions {
|
|
|
80
82
|
*
|
|
81
83
|
* Options override the corresponding `RESEND_*` env values.
|
|
82
84
|
*/
|
|
83
|
-
export declare function createResendMailProvider(options?: CreateResendMailProviderOptions):
|
|
84
|
-
API_KEY: z.ZodString;
|
|
85
|
-
FROM: z.ZodString;
|
|
86
|
-
}, z.core.$strip>, {
|
|
87
|
-
mailer: MailerPort;
|
|
88
|
-
resend: {
|
|
89
|
-
client: Resend;
|
|
90
|
-
};
|
|
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
|
-
export {};
|
|
85
|
+
export declare function createResendMailProvider(options?: CreateResendMailProviderOptions): ResendMailProvider;
|
|
108
86
|
//# 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,
|
|
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,EACL,KAAK,uBAAuB,EAG5B,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA2B,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;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,MAAM,kBAAkB,GAAG,eAAe,CAC9C,OAAO,EACP,uBAAuB,CAAC,gBAAgB,CAAC,EACzC,IAAI,CAAC,uBAAuB,EAAE,MAAM,uBAAuB,CAAC,CAC7D,CAAC;AAEF;;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,GAC5C,kBAAkB,CA0CpB"}
|
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.35",
|
|
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
|
@@ -15,9 +15,11 @@ import {
|
|
|
15
15
|
type SendMailResult,
|
|
16
16
|
} from "@beignet/core/mail";
|
|
17
17
|
import {
|
|
18
|
+
type AnyProviderConfigSchema,
|
|
18
19
|
createProvider,
|
|
19
20
|
createProviderInstrumentation,
|
|
20
21
|
type ProviderInstrumentationTarget,
|
|
22
|
+
type ServiceProvider,
|
|
21
23
|
} from "@beignet/core/providers";
|
|
22
24
|
import { type CreateEmailOptions, Resend } from "resend";
|
|
23
25
|
import { z } from "zod";
|
|
@@ -25,12 +27,15 @@ import { z } from "zod";
|
|
|
25
27
|
const ResendMailConfigSchema = z.object({
|
|
26
28
|
API_KEY: z.string().min(1),
|
|
27
29
|
FROM: z.string().min(1),
|
|
28
|
-
})
|
|
30
|
+
}) satisfies z.ZodType<ResendMailConfig>;
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Resend provider config loaded from `RESEND_API_KEY` and `RESEND_FROM`.
|
|
32
34
|
*/
|
|
33
|
-
export
|
|
35
|
+
export interface ResendMailConfig {
|
|
36
|
+
API_KEY: string;
|
|
37
|
+
FROM: string;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
/**
|
|
36
41
|
* Escape hatch for apps that need the raw Resend client.
|
|
@@ -43,7 +48,7 @@ export interface ResendMailEscapeHatch {
|
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
/**
|
|
46
|
-
* Ports contributed by `
|
|
51
|
+
* Ports contributed by `createResendMailProvider`.
|
|
47
52
|
*/
|
|
48
53
|
export interface ResendMailProviderPorts {
|
|
49
54
|
/**
|
|
@@ -56,6 +61,15 @@ export interface ResendMailProviderPorts {
|
|
|
56
61
|
resend: ResendMailEscapeHatch;
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Resend mail lifecycle provider with stable contributed-port typing.
|
|
66
|
+
*/
|
|
67
|
+
export type ResendMailProvider = ServiceProvider<
|
|
68
|
+
unknown,
|
|
69
|
+
AnyProviderConfigSchema<ResendMailConfig>,
|
|
70
|
+
Pick<ResendMailProviderPorts, keyof ResendMailProviderPorts>
|
|
71
|
+
>;
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* Options for creating a Resend-backed mailer directly.
|
|
61
75
|
*/
|
|
@@ -134,7 +148,7 @@ function createResendPayload(
|
|
|
134
148
|
/**
|
|
135
149
|
* Create a Beignet mailer port backed by Resend.
|
|
136
150
|
*
|
|
137
|
-
* Use this directly for custom wiring, or install `
|
|
151
|
+
* Use this directly for custom wiring, or install `createResendMailProvider` to load
|
|
138
152
|
* config from env and contribute ports during server startup.
|
|
139
153
|
*/
|
|
140
154
|
export function createResendMailer({
|
|
@@ -253,7 +267,7 @@ export interface CreateResendMailProviderOptions {
|
|
|
253
267
|
*/
|
|
254
268
|
export function createResendMailProvider(
|
|
255
269
|
options: CreateResendMailProviderOptions = {},
|
|
256
|
-
) {
|
|
270
|
+
): ResendMailProvider {
|
|
257
271
|
return createProvider({
|
|
258
272
|
name: "mail-resend",
|
|
259
273
|
|
|
@@ -270,7 +284,7 @@ export function createResendMailProvider(
|
|
|
270
284
|
async setup({ config, ports }) {
|
|
271
285
|
if (!config) {
|
|
272
286
|
throw new Error(
|
|
273
|
-
"[
|
|
287
|
+
"[createResendMailProvider] Missing Resend config. " +
|
|
274
288
|
"Please set RESEND_API_KEY and RESEND_FROM environment variables.",
|
|
275
289
|
);
|
|
276
290
|
}
|
|
@@ -296,11 +310,3 @@ export function createResendMailProvider(
|
|
|
296
310
|
},
|
|
297
311
|
});
|
|
298
312
|
}
|
|
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();
|