@cedarjs/mailer-handler-resend 2.3.0 → 2.3.1-next.79
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 +14 -6
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Prerequisites
|
|
4
4
|
|
|
5
|
-
We assume you have the basic boilerplate for
|
|
5
|
+
We assume you have the basic boilerplate for Cedar Mailer present. We also
|
|
6
|
+
assume that you have signed up with [Resend](https://resend.com/) and have
|
|
7
|
+
access to an API key.
|
|
6
8
|
|
|
7
9
|
## Setup
|
|
8
10
|
|
|
9
|
-
We should install this handler package as a production dependency of the API
|
|
11
|
+
We should install this handler package as a production dependency of the API
|
|
12
|
+
side. We can do this with the following command:
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
|
-
yarn workspace api add @
|
|
15
|
+
yarn workspace api add @cedarjs/mailer-handler-resend
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
After this you should be able to import this handler into your
|
|
18
|
+
After this you should be able to import this handler into your
|
|
19
|
+
`api/src/lib/mailer.ts` file and create an instance of this handler with your
|
|
20
|
+
API key.
|
|
16
21
|
|
|
17
22
|
```typescript
|
|
18
23
|
import { ResendMailHandler } from '@cedarjs/mailer-handler-resend'
|
|
@@ -36,7 +41,9 @@ export const mailer = new Mailer({
|
|
|
36
41
|
})
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
If you need access to the underlying resend client to perform more specific
|
|
44
|
+
If you need access to the underlying resend client to perform more specific
|
|
45
|
+
behaviour the SDK exposes you can always access this using the `internal`
|
|
46
|
+
function on this resend handler.
|
|
40
47
|
|
|
41
48
|
```typescript
|
|
42
49
|
const resendHandler = mailer.handlers.resend
|
|
@@ -45,4 +52,5 @@ const resendClient = resendHandler.internal().client
|
|
|
45
52
|
|
|
46
53
|
## Usage
|
|
47
54
|
|
|
48
|
-
You should be able to use this newly configured handler like any other previous
|
|
55
|
+
You should be able to use this newly configured handler like any other previous
|
|
56
|
+
handler and it should require no changes to your mailer code.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,22 @@ export type ResendMailHandlerOptions = {
|
|
|
7
7
|
value: string;
|
|
8
8
|
}[];
|
|
9
9
|
};
|
|
10
|
+
interface DeprecatedConstructorOptions {
|
|
11
|
+
/** @deprecated Please use apiKey instead */
|
|
12
|
+
apiToken: string;
|
|
13
|
+
}
|
|
14
|
+
interface ResendMailHandlerConstructorOptions {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
}
|
|
10
17
|
export declare class ResendMailHandler extends AbstractMailHandler {
|
|
11
18
|
private client;
|
|
12
|
-
constructor({
|
|
13
|
-
|
|
14
|
-
});
|
|
19
|
+
constructor({ apiKey }: ResendMailHandlerConstructorOptions);
|
|
20
|
+
/** @deprecated Please use `ResendMailHandler({ apiKey })` instead */
|
|
21
|
+
constructor({ apiToken }: DeprecatedConstructorOptions);
|
|
15
22
|
send(content: MailRenderedContent, sendOptions: MailSendOptionsComplete, handlerOptions?: ResendMailHandlerOptions): Promise<MailResult>;
|
|
16
23
|
internal(): {
|
|
17
24
|
client: Resend;
|
|
18
25
|
};
|
|
19
26
|
}
|
|
27
|
+
export {};
|
|
20
28
|
//# 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,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG;IAIrC,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;KACd,EAAE,CAAA;CACJ,CAAA;AAED,qBAAa,iBAAkB,SAAQ,mBAAmB;IACxD,OAAO,CAAC,MAAM,CAAQ;gBAEV,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG;IAIrC,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;KACd,EAAE,CAAA;CACJ,CAAA;AAED,UAAU,4BAA4B;IACpC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,mCAAmC;IAC3C,MAAM,EAAE,MAAM,CAAA;CACf;AAOD,qBAAa,iBAAkB,SAAQ,mBAAmB;IACxD,OAAO,CAAC,MAAM,CAAQ;gBAEV,EAAE,MAAM,EAAE,EAAE,mCAAmC;IAC3D,qEAAqE;gBACzD,EAAE,QAAQ,EAAE,EAAE,4BAA4B;IAMhD,IAAI,CACR,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,uBAAuB,EACpC,cAAc,CAAC,EAAE,wBAAwB,GACxC,OAAO,CAAC,UAAU,CAAC;IA+CtB,QAAQ;;;CAKT"}
|
package/dist/index.js
CHANGED
|
@@ -25,9 +25,9 @@ var import_resend = require("resend");
|
|
|
25
25
|
var import_mailer_core = require("@cedarjs/mailer-core");
|
|
26
26
|
class ResendMailHandler extends import_mailer_core.AbstractMailHandler {
|
|
27
27
|
client;
|
|
28
|
-
constructor({ apiToken }) {
|
|
28
|
+
constructor({ apiToken, apiKey }) {
|
|
29
29
|
super();
|
|
30
|
-
this.client = new import_resend.Resend(apiToken);
|
|
30
|
+
this.client = new import_resend.Resend(apiKey ?? apiToken);
|
|
31
31
|
}
|
|
32
32
|
async send(content, sendOptions, handlerOptions) {
|
|
33
33
|
const transformedAttachments = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/mailer-handler-resend",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1-next.79+a599dc0f9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"prepublishOnly": "NODE_ENV=production yarn build"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@cedarjs/mailer-core": "2.3.
|
|
23
|
+
"@cedarjs/mailer-core": "2.3.1-next.79+a599dc0f9",
|
|
24
24
|
"resend": "4.8.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@cedarjs/framework-tools": "2.3.
|
|
27
|
+
"@cedarjs/framework-tools": "2.3.1-next.79",
|
|
28
28
|
"tsx": "4.21.0",
|
|
29
29
|
"typescript": "5.9.3"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "a599dc0f911b124b122d1862cabf32635e53540a"
|
|
35
35
|
}
|