@pearl-framework/mail 0.1.0 → 0.1.1
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/.turbo/turbo-build.log +1 -1
- package/dist/mail/Mailable.d.ts +15 -17
- package/dist/mail/Mailable.d.ts.map +1 -1
- package/dist/mail/Mailable.js +6 -4
- package/dist/mail/Mailable.js.map +1 -1
- package/package.json +1 -1
- package/src/mail/Mailable.ts +107 -109
package/.turbo/turbo-build.log
CHANGED
package/dist/mail/Mailable.d.ts
CHANGED
|
@@ -29,28 +29,31 @@ export interface BuiltMail extends MailContent {
|
|
|
29
29
|
*
|
|
30
30
|
* Usage:
|
|
31
31
|
* export class WelcomeEmail extends Mailable {
|
|
32
|
-
* constructor(private readonly
|
|
32
|
+
* constructor(private readonly recipient: string) {
|
|
33
33
|
* super()
|
|
34
34
|
* }
|
|
35
35
|
*
|
|
36
36
|
* build(): this {
|
|
37
37
|
* return this
|
|
38
|
-
* .to(this.
|
|
38
|
+
* .to(this.recipient)
|
|
39
39
|
* .subject('Welcome to Pearl!')
|
|
40
|
-
* .html(`<h1>Hi
|
|
40
|
+
* .html(`<h1>Hi there!</h1>`)
|
|
41
41
|
* }
|
|
42
42
|
* }
|
|
43
|
+
*
|
|
44
|
+
* Note: Do not use 'to' as a constructor parameter name in subclasses —
|
|
45
|
+
* it conflicts with the Mailable.to() builder method. Use 'recipient' instead.
|
|
43
46
|
*/
|
|
44
47
|
export declare abstract class Mailable {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
protected _from?: MailAddress | string;
|
|
49
|
+
protected _to: Array<MailAddress | string>;
|
|
50
|
+
protected _cc: Array<MailAddress | string>;
|
|
51
|
+
protected _bcc: Array<MailAddress | string>;
|
|
52
|
+
protected _replyTo?: MailAddress | string;
|
|
53
|
+
protected _subject: string;
|
|
54
|
+
protected _html?: string;
|
|
55
|
+
protected _text?: string;
|
|
56
|
+
protected _attachments: Attachment[];
|
|
54
57
|
from(address: MailAddress | string): this;
|
|
55
58
|
to(...addresses: Array<MailAddress | string>): this;
|
|
56
59
|
cc(...addresses: Array<MailAddress | string>): this;
|
|
@@ -60,13 +63,8 @@ export declare abstract class Mailable {
|
|
|
60
63
|
html(content: string): this;
|
|
61
64
|
text(content: string): this;
|
|
62
65
|
attach(attachment: Attachment): this;
|
|
63
|
-
/**
|
|
64
|
-
* Implement this to configure the email.
|
|
65
|
-
* Call this.to(), this.subject(), this.html() etc.
|
|
66
|
-
*/
|
|
67
66
|
abstract build(): this | Promise<this>;
|
|
68
67
|
compile(defaultFrom?: MailAddress | string): Promise<BuiltMail>;
|
|
69
|
-
/** Override to send via queue instead of synchronously */
|
|
70
68
|
shouldQueue(): boolean;
|
|
71
69
|
get queue(): string;
|
|
72
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mailable.d.ts","sourceRoot":"","sources":["../../src/mail/Mailable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,MAAM,WAAW,WAAW;
|
|
1
|
+
{"version":3,"file":"Mailable.d.ts","sourceRoot":"","sources":["../../src/mail/Mailable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;IAC3B,EAAE,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAA;IAC/B,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAA;IAChC,GAAG,CAAC,EAAE,KAAK,CAA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AW,GAAG,MAAM,GAAG,IAAI;IAKzC,EAAE,CAAC,GAAG,SAAS,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,GAAG,IAAI;IAKnD,EAAE,CAAC,GAAG,SAAS,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,GAAG,IAAI;IAKnD,GAAG,CAAC,GAAG,SAAS,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,GAAG,IAAI;IAKpD,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAK5C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3B,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAOpC,QAAQ,CAAC,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhC,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAoBrE,WAAW,IAAI,OAAO;IAItB,IAAI,KAAK,IAAI,MAAM,CAElB;CACF"}
|
package/dist/mail/Mailable.js
CHANGED
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
5
|
* export class WelcomeEmail extends Mailable {
|
|
6
|
-
* constructor(private readonly
|
|
6
|
+
* constructor(private readonly recipient: string) {
|
|
7
7
|
* super()
|
|
8
8
|
* }
|
|
9
9
|
*
|
|
10
10
|
* build(): this {
|
|
11
11
|
* return this
|
|
12
|
-
* .to(this.
|
|
12
|
+
* .to(this.recipient)
|
|
13
13
|
* .subject('Welcome to Pearl!')
|
|
14
|
-
* .html(`<h1>Hi
|
|
14
|
+
* .html(`<h1>Hi there!</h1>`)
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
|
+
*
|
|
18
|
+
* Note: Do not use 'to' as a constructor parameter name in subclasses —
|
|
19
|
+
* it conflicts with the Mailable.to() builder method. Use 'recipient' instead.
|
|
17
20
|
*/
|
|
18
21
|
export class Mailable {
|
|
19
22
|
_from;
|
|
@@ -78,7 +81,6 @@ export class Mailable {
|
|
|
78
81
|
};
|
|
79
82
|
}
|
|
80
83
|
// ─── Queue support ────────────────────────────────────────────────────────
|
|
81
|
-
/** Override to send via queue instead of synchronously */
|
|
82
84
|
shouldQueue() {
|
|
83
85
|
return false;
|
|
84
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mailable.js","sourceRoot":"","sources":["../../src/mail/Mailable.ts"],"names":[],"mappings":"AA+BA
|
|
1
|
+
{"version":3,"file":"Mailable.js","sourceRoot":"","sources":["../../src/mail/Mailable.ts"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAgB,QAAQ;IAClB,KAAK,CAAuB;IAC5B,GAAG,GAAgC,EAAE,CAAA;IACrC,GAAG,GAAgC,EAAE,CAAA;IACrC,IAAI,GAAgC,EAAE,CAAA;IACtC,QAAQ,CAAuB;IAC/B,QAAQ,GAAG,EAAE,CAAA;IACb,KAAK,CAAS;IACd,KAAK,CAAS;IACd,YAAY,GAAiB,EAAE,CAAA;IAEzC,6EAA6E;IAE7E,IAAI,CAAC,OAA6B;QAChC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAA;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,EAAE,CAAC,GAAG,SAAsC;QAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,EAAE,CAAC,GAAG,SAAsC;QAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,GAAG,CAAC,GAAG,SAAsC;QAC3C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AAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YACrD,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YACrD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;SACpE,CAAA;IACH,CAAC;IAED,6EAA6E;IAE7E,WAAW;QACT,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/mail/Mailable.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { Attachment } from 'nodemailer/lib/mailer/index.js'
|
|
2
2
|
|
|
3
3
|
export interface MailAddress {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name?: string
|
|
5
|
+
address: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface MailEnvelope {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
from?: MailAddress | string
|
|
10
|
+
to: Array<MailAddress | string>
|
|
11
|
+
cc?: Array<MailAddress | string>
|
|
12
|
+
bcc?: Array<MailAddress | string>
|
|
13
|
+
replyTo?: MailAddress | string
|
|
14
|
+
subject: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface MailContent {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
html?: string
|
|
19
|
+
text?: string
|
|
20
|
+
attachments?: Attachment[]
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface BuiltMail extends MailContent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
from?: MailAddress | string
|
|
25
|
+
to: Array<MailAddress | string>
|
|
26
|
+
cc?: Array<MailAddress | string>
|
|
27
|
+
bcc?: Array<MailAddress | string>
|
|
28
|
+
replyTo?: MailAddress | string
|
|
29
|
+
subject: string
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -34,110 +34,108 @@ export interface BuiltMail extends MailContent {
|
|
|
34
34
|
*
|
|
35
35
|
* Usage:
|
|
36
36
|
* export class WelcomeEmail extends Mailable {
|
|
37
|
-
* constructor(private readonly
|
|
37
|
+
* constructor(private readonly recipient: string) {
|
|
38
38
|
* super()
|
|
39
39
|
* }
|
|
40
40
|
*
|
|
41
41
|
* build(): this {
|
|
42
42
|
* return this
|
|
43
|
-
* .to(this.
|
|
43
|
+
* .to(this.recipient)
|
|
44
44
|
* .subject('Welcome to Pearl!')
|
|
45
|
-
* .html(`<h1>Hi
|
|
45
|
+
* .html(`<h1>Hi there!</h1>`)
|
|
46
46
|
* }
|
|
47
47
|
* }
|
|
48
|
+
*
|
|
49
|
+
* Note: Do not use 'to' as a constructor parameter name in subclasses —
|
|
50
|
+
* it conflicts with the Mailable.to() builder method. Use 'recipient' instead.
|
|
48
51
|
*/
|
|
49
52
|
export abstract class Mailable {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
protected _from?: MailAddress | string
|
|
54
|
+
protected _to: Array<MailAddress | string> = []
|
|
55
|
+
protected _cc: Array<MailAddress | string> = []
|
|
56
|
+
protected _bcc: Array<MailAddress | string> = []
|
|
57
|
+
protected _replyTo?: MailAddress | string
|
|
58
|
+
protected _subject = ''
|
|
59
|
+
protected _html?: string
|
|
60
|
+
protected _text?: string
|
|
61
|
+
protected _attachments: Attachment[] = []
|
|
62
|
+
|
|
63
|
+
// ─── Builder methods ──────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
from(address: MailAddress | string): this {
|
|
66
|
+
this._from = address
|
|
67
|
+
return this
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
to(...addresses: Array<MailAddress | string>): this {
|
|
71
|
+
this._to.push(...addresses)
|
|
72
|
+
return this
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
cc(...addresses: Array<MailAddress | string>): this {
|
|
76
|
+
this._cc.push(...addresses)
|
|
77
|
+
return this
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
bcc(...addresses: Array<MailAddress | string>): this {
|
|
81
|
+
this._bcc.push(...addresses)
|
|
82
|
+
return this
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
replyTo(address: MailAddress | string): this {
|
|
86
|
+
this._replyTo = address
|
|
87
|
+
return this
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
subject(value: string): this {
|
|
91
|
+
this._subject = value
|
|
92
|
+
return this
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
html(content: string): this {
|
|
96
|
+
this._html = content
|
|
97
|
+
return this
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
text(content: string): this {
|
|
101
|
+
this._text = content
|
|
102
|
+
return this
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
attach(attachment: Attachment): this {
|
|
106
|
+
this._attachments.push(attachment)
|
|
107
|
+
return this
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ─── Build ────────────────────────────────────────────────────────────────
|
|
111
|
+
|
|
112
|
+
abstract build(): this | Promise<this>
|
|
113
|
+
|
|
114
|
+
async compile(defaultFrom?: MailAddress | string): Promise<BuiltMail> {
|
|
115
|
+
await this.build()
|
|
116
|
+
|
|
117
|
+
const from = this._from ?? defaultFrom
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
...(from !== undefined && { from }),
|
|
121
|
+
to: this._to,
|
|
122
|
+
...(this._cc.length && { cc: this._cc }),
|
|
123
|
+
...(this._bcc.length && { bcc: this._bcc }),
|
|
124
|
+
...(this._replyTo !== undefined && { replyTo: this._replyTo }),
|
|
125
|
+
subject: this._subject,
|
|
126
|
+
...(this._html !== undefined && { html: this._html }),
|
|
127
|
+
...(this._text !== undefined && { text: this._text }),
|
|
128
|
+
...(this._attachments.length && { attachments: this._attachments }),
|
|
70
129
|
}
|
|
130
|
+
}
|
|
71
131
|
|
|
72
|
-
|
|
73
|
-
this._cc.push(...addresses)
|
|
74
|
-
return this
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
bcc(...addresses: Array<MailAddress | string>): this {
|
|
78
|
-
this._bcc.push(...addresses)
|
|
79
|
-
return this
|
|
80
|
-
}
|
|
132
|
+
// ─── Queue support ────────────────────────────────────────────────────────
|
|
81
133
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
subject(value: string): this {
|
|
88
|
-
this._subject = value
|
|
89
|
-
return this
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
html(content: string): this {
|
|
93
|
-
this._html = content
|
|
94
|
-
return this
|
|
95
|
-
}
|
|
134
|
+
shouldQueue(): boolean {
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
96
137
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
attach(attachment: Attachment): this {
|
|
103
|
-
this._attachments.push(attachment)
|
|
104
|
-
return this
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ─── Build ────────────────────────────────────────────────────────────────
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Implement this to configure the email.
|
|
111
|
-
* Call this.to(), this.subject(), this.html() etc.
|
|
112
|
-
*/
|
|
113
|
-
abstract build(): this | Promise<this>
|
|
114
|
-
|
|
115
|
-
async compile(defaultFrom?: MailAddress | string): Promise<BuiltMail> {
|
|
116
|
-
await this.build()
|
|
117
|
-
|
|
118
|
-
const from = this._from ?? defaultFrom
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
...(from !== undefined && { from }),
|
|
122
|
-
to: this._to,
|
|
123
|
-
...(this._cc.length && { cc: this._cc }),
|
|
124
|
-
...(this._bcc.length && { bcc: this._bcc }),
|
|
125
|
-
...(this._replyTo !== undefined && { replyTo: this._replyTo }),
|
|
126
|
-
subject: this._subject,
|
|
127
|
-
...(this._html !== undefined && { html: this._html }),
|
|
128
|
-
...(this._text !== undefined && { text: this._text }),
|
|
129
|
-
...(this._attachments.length && { attachments: this._attachments }),
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ─── Queue support ────────────────────────────────────────────────────────
|
|
134
|
-
|
|
135
|
-
/** Override to send via queue instead of synchronously */
|
|
136
|
-
shouldQueue(): boolean {
|
|
137
|
-
return false
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
get queue(): string {
|
|
141
|
-
return 'mail'
|
|
142
|
-
}
|
|
138
|
+
get queue(): string {
|
|
139
|
+
return 'mail'
|
|
140
|
+
}
|
|
143
141
|
}
|