@travetto/email 6.0.0-rc.1 → 6.0.0
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 +2 -1
- package/__index__.ts +7 -7
- package/package.json +4 -4
- package/src/service.ts +4 -4
- package/src/template.ts +1 -1
- package/src/transport.ts +5 -4
- package/src/types.ts +1 -0
- package/src/util.ts +1 -1
- package/src/internal/types.ts +0 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @travetto/email
|
|
|
13
13
|
yarn add @travetto/email
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
A standard API for sending and rendering emails. The mail transport must be defined to allow for mail to be sent properly. Out of the box, the only transport available by default is the [NullTransport](https://github.com/travetto/travetto/tree/main/module/email/src/transport.ts#
|
|
16
|
+
A standard API for sending and rendering emails. The mail transport must be defined to allow for mail to be sent properly. Out of the box, the only transport available by default is the [NullTransport](https://github.com/travetto/travetto/tree/main/module/email/src/transport.ts#L16) which will just drop emails. The structure of the API is derived from [nodemailer](https://nodemailer.com/about/), but is compatible with any library that can handle the [EmailOptions](https://github.com/travetto/travetto/tree/main/module/email/src/types.ts#L45) input.
|
|
17
17
|
|
|
18
18
|
To expose the necessary email transport, the following pattern is commonly used:
|
|
19
19
|
|
|
@@ -37,4 +37,5 @@ By design, sending an email requires the sender to specify the html, text option
|
|
|
37
37
|
* `resources/<key>.compiled.html`
|
|
38
38
|
* `resources/<key>.compiled.text`
|
|
39
39
|
* `resources/<key>.compiled.subject`
|
|
40
|
+
|
|
40
41
|
With `.html` being the only required field. The [Email Compilation Support](https://github.com/travetto/travetto/tree/main/module/email-compiler#readme "Email compiling module") module supports this format, and will generate files accordingly. Also, note that `<key>` can include slashes, allowing for nesting folders.
|
package/__index__.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './src/service';
|
|
2
|
-
export * from './src/types';
|
|
3
|
-
export * from './src/config';
|
|
4
|
-
export * from './src/resource';
|
|
5
|
-
export * from './src/transport';
|
|
6
|
-
export * from './src/util';
|
|
7
|
-
export * from './src/template';
|
|
1
|
+
export * from './src/service.ts';
|
|
2
|
+
export * from './src/types.ts';
|
|
3
|
+
export * from './src/config.ts';
|
|
4
|
+
export * from './src/resource.ts';
|
|
5
|
+
export * from './src/transport.ts';
|
|
6
|
+
export * from './src/util.ts';
|
|
7
|
+
export * from './src/template.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
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/config": "^6.0.0
|
|
27
|
-
"@travetto/di": "^6.0.0
|
|
28
|
-
"@travetto/runtime": "^6.0.0
|
|
26
|
+
"@travetto/config": "^6.0.0",
|
|
27
|
+
"@travetto/di": "^6.0.0",
|
|
28
|
+
"@travetto/runtime": "^6.0.0",
|
|
29
29
|
"@types/mustache": "^4.2.5",
|
|
30
30
|
"mustache": "^4.2.0"
|
|
31
31
|
},
|
package/src/service.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Runtime, RuntimeResources } from '@travetto/runtime';
|
|
2
2
|
import { Injectable } from '@travetto/di';
|
|
3
3
|
|
|
4
|
-
import { EmailCompiled, EmailOptions, SentEmail } from './types';
|
|
5
|
-
import { MailTransport } from './transport';
|
|
6
|
-
import { MailInterpolator } from './template';
|
|
7
|
-
import { MailUtil } from './util';
|
|
4
|
+
import { EmailCompiled, EmailOptions, SentEmail } from './types.ts';
|
|
5
|
+
import { MailTransport } from './transport.ts';
|
|
6
|
+
import { MailInterpolator } from './template.ts';
|
|
7
|
+
import { MailUtil } from './util.ts';
|
|
8
8
|
|
|
9
9
|
type MessageWithoutBody = Omit<EmailOptions, keyof EmailCompiled>;
|
|
10
10
|
|
package/src/template.ts
CHANGED
package/src/transport.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { castTo } from '@travetto/runtime';
|
|
2
|
+
import { EmailOptions, SentEmail } from './types.ts';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Default mail transport
|
|
5
6
|
*
|
|
6
|
-
* @concrete
|
|
7
|
+
* @concrete
|
|
7
8
|
*/
|
|
8
9
|
export interface MailTransport {
|
|
9
10
|
send<S extends SentEmail = SentEmail>(mail: EmailOptions): Promise<S>;
|
|
@@ -13,7 +14,7 @@ export interface MailTransport {
|
|
|
13
14
|
* Transport that consumes messages without sending
|
|
14
15
|
*/
|
|
15
16
|
export class NullTransport implements MailTransport {
|
|
16
|
-
async send<S extends SentEmail = SentEmail>(
|
|
17
|
-
return
|
|
17
|
+
async send<S extends SentEmail = SentEmail>(): Promise<S> {
|
|
18
|
+
return castTo({});
|
|
18
19
|
}
|
|
19
20
|
}
|
package/src/types.ts
CHANGED
package/src/util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Runtime, BinaryUtil } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { EmailAttachment, EmailIdentity, EmailIdentityList, EmailOptions } from './types';
|
|
3
|
+
import { EmailAttachment, EmailIdentity, EmailIdentityList, EmailOptions } from './types.ts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Utilities for email
|
package/src/internal/types.ts
DELETED