@brilab-mailer/provider-resend 0.0.1-beta.47
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 +7 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +1 -0
- package/lib/resend-mail.provider.d.ts +12 -0
- package/lib/resend-mail.provider.d.ts.map +1 -0
- package/lib/resend-mail.provider.js +36 -0
- package/package.json +48 -0
package/README.md
ADDED
package/index.d.ts
ADDED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/resend-mail.provider.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { CreateEmailOptions, Resend } from 'resend';
|
|
3
|
+
import { type MailerMessagesResolved, MailerProvider } from '@brilab-mailer/contracts';
|
|
4
|
+
export declare class ResendMailProvider implements MailerProvider<any, Resend, CreateEmailOptions> {
|
|
5
|
+
private readonly config;
|
|
6
|
+
private _client;
|
|
7
|
+
constructor(config: ConfigService);
|
|
8
|
+
getClient(): Resend;
|
|
9
|
+
createPayload(resolved: MailerMessagesResolved): CreateEmailOptions;
|
|
10
|
+
send(payload: CreateEmailOptions): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=resend-mail.provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resend-mail.provider.d.ts","sourceRoot":"","sources":["../../src/lib/resend-mail.provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EACL,KAAK,sBAAsB,EAC3B,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,qBACa,kBAAmB,YAAW,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC;IAG5E,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,OAAO,CAAS;gBAEK,MAAM,EAAE,aAAa;IAS3C,SAAS,IAAI,MAAM;IAInB,aAAa,CAAC,QAAQ,EAAE,sBAAsB,GAAG,kBAAkB;IAepE,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import { Resend } from 'resend';
|
|
5
|
+
import { segmentedDataContentPayload, } from '@brilab-mailer/contracts';
|
|
6
|
+
let ResendMailProvider = class ResendMailProvider {
|
|
7
|
+
config;
|
|
8
|
+
_client;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
const apiKey = this.config.get('RESEND_API_KEY');
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new Error('RESEND_API_KEY is not set');
|
|
14
|
+
}
|
|
15
|
+
this._client = new Resend(apiKey);
|
|
16
|
+
}
|
|
17
|
+
getClient() {
|
|
18
|
+
return this._client;
|
|
19
|
+
}
|
|
20
|
+
createPayload(resolved) {
|
|
21
|
+
const base = {
|
|
22
|
+
from: resolved.from.email,
|
|
23
|
+
to: resolved.to.map((t) => t.email),
|
|
24
|
+
subject: resolved.subject,
|
|
25
|
+
};
|
|
26
|
+
return segmentedDataContentPayload(resolved, null, null, base);
|
|
27
|
+
}
|
|
28
|
+
async send(payload) {
|
|
29
|
+
await this._client.emails.send(payload);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
ResendMailProvider = __decorate([
|
|
33
|
+
Injectable(),
|
|
34
|
+
__metadata("design:paramtypes", [ConfigService])
|
|
35
|
+
], ResendMailProvider);
|
|
36
|
+
export { ResendMailProvider };
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brilab-mailer/provider-resend",
|
|
3
|
+
"version": "0.0.1-beta.47",
|
|
4
|
+
"author": "Bohdan Radchenko <radchenkobs@gmail.com>",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"module": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"import": "./index.js",
|
|
14
|
+
"default": "./index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"**/*",
|
|
19
|
+
"!**/*.tsbuildinfo"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"directory": "dist"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@nestjs/common": "^10.0.0",
|
|
28
|
+
"@nestjs/config": "^3.0.0",
|
|
29
|
+
"@brilab-mailer/contracts": "^0.0.1",
|
|
30
|
+
"@brilab-mailer/core": "^0.0.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependenciesMeta": {
|
|
33
|
+
"@brilab-mailer/contracts": {
|
|
34
|
+
"optional": false
|
|
35
|
+
},
|
|
36
|
+
"@brilab-mailer/core": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"resend": "^3.0.0"
|
|
42
|
+
},
|
|
43
|
+
"nx": {
|
|
44
|
+
"tags": [
|
|
45
|
+
"disabled"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|