@travetto/email 5.0.0-rc.7 → 5.0.0-rc.9
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/package.json +4 -4
- package/src/service.ts +2 -3
- package/src/transport.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.9",
|
|
4
4
|
"description": "Email transmission module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"directory": "module/email"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@travetto/runtime": "^5.0.0-rc.
|
|
27
|
-
"@travetto/config": "^5.0.0-rc.
|
|
28
|
-
"@travetto/di": "^5.0.0-rc.
|
|
26
|
+
"@travetto/runtime": "^5.0.0-rc.9",
|
|
27
|
+
"@travetto/config": "^5.0.0-rc.9",
|
|
28
|
+
"@travetto/di": "^5.0.0-rc.9",
|
|
29
29
|
"@types/mustache": "^4.2.5",
|
|
30
30
|
"mustache": "^4.2.0"
|
|
31
31
|
},
|
package/src/service.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class MailService {
|
|
|
48
48
|
* @param ctx
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
async renderMessage(keyOrMessage: string | EmailCompiled, ctx: Record<string, unknown>): Promise<EmailCompiled> {
|
|
51
|
+
async renderMessage(keyOrMessage: string | EmailCompiled | EmailOptions, ctx: Record<string, unknown>): Promise<EmailCompiled> {
|
|
52
52
|
const tpl = (typeof keyOrMessage === 'string' ? await this.getCompiled(keyOrMessage) : keyOrMessage);
|
|
53
53
|
|
|
54
54
|
const [html, text, subject] = await Promise.all([
|
|
@@ -78,8 +78,7 @@ export class MailService {
|
|
|
78
78
|
): Promise<S> {
|
|
79
79
|
const keyOrMessage = key ?? ('html' in message ? message : '') ?? '';
|
|
80
80
|
const context = ctx ?? (('context' in message) ? message.context : {}) ?? {};
|
|
81
|
-
|
|
82
|
-
const compiled = await this.renderMessage(keyOrMessage as EmailCompiled, context);
|
|
81
|
+
const compiled = await this.renderMessage(keyOrMessage, context);
|
|
83
82
|
|
|
84
83
|
const final = { ...base, ...message, ...compiled, context };
|
|
85
84
|
|
package/src/transport.ts
CHANGED
|
@@ -14,7 +14,6 @@ export interface MailTransport {
|
|
|
14
14
|
*/
|
|
15
15
|
export class NullTransport implements MailTransport {
|
|
16
16
|
async send<S extends SentEmail = SentEmail>(mail: EmailOptions): Promise<S> {
|
|
17
|
-
|
|
18
|
-
return {} as S;
|
|
17
|
+
return undefined! ?? {};
|
|
19
18
|
}
|
|
20
19
|
}
|