@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 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#L15) 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#L44) input.
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-rc.1",
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-rc.1",
27
- "@travetto/di": "^6.0.0-rc.1",
28
- "@travetto/runtime": "^6.0.0-rc.1",
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
@@ -6,7 +6,7 @@ import { RuntimeResources } from '@travetto/runtime';
6
6
  /**
7
7
  * Mail interpolation engine
8
8
  *
9
- * @concrete ./internal/types#MailInterpolatorTarget
9
+ * @concrete
10
10
  */
11
11
  export interface MailInterpolator {
12
12
  /**
package/src/transport.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { EmailOptions, SentEmail } from './types';
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 ./internal/types#MailTransportTarget
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>(mail: EmailOptions): Promise<S> {
17
- return undefined! ?? {};
17
+ async send<S extends SentEmail = SentEmail>(): Promise<S> {
18
+ return castTo({});
18
19
  }
19
20
  }
package/src/types.ts CHANGED
@@ -40,6 +40,7 @@ export type EmailIdentityList = EmailIdentity | EmailIdentity[];
40
40
 
41
41
  /**
42
42
  * Full message options
43
+ * @concrete
43
44
  */
44
45
  export interface EmailOptions {
45
46
  html: string;
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
@@ -1,2 +0,0 @@
1
- export class MailInterpolatorTarget { }
2
- export class MailTransportTarget { }