@matthesketh/utopia-email 0.0.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/adapters/resend.cjs +88 -0
- package/dist/adapters/resend.d.cts +10 -0
- package/dist/adapters/resend.d.ts +10 -0
- package/dist/adapters/resend.js +53 -0
- package/dist/adapters/sendgrid.cjs +101 -0
- package/dist/adapters/sendgrid.d.cts +10 -0
- package/dist/adapters/sendgrid.d.ts +10 -0
- package/dist/adapters/sendgrid.js +66 -0
- package/dist/adapters/smtp.cjs +93 -0
- package/dist/adapters/smtp.d.cts +10 -0
- package/dist/adapters/smtp.d.ts +10 -0
- package/dist/adapters/smtp.js +58 -0
- package/dist/index.cjs +776 -0
- package/dist/index.d.cts +135 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +774 -0
- package/dist/types-C3uNsSmw.d.cts +75 -0
- package/dist/types-C3uNsSmw.d.ts +75 -0
- package/package.json +86 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
interface RenderEmailOptions {
|
|
2
|
+
/** Email subject line (can also be set in MailerSendOptions). */
|
|
3
|
+
subject?: string;
|
|
4
|
+
/** Hidden preview text shown in email clients. */
|
|
5
|
+
previewText?: string;
|
|
6
|
+
/** Skip CSS inlining (keep styles in <style> block only). */
|
|
7
|
+
skipInlining?: boolean;
|
|
8
|
+
/** Skip the <style> block entirely (only inline styles). */
|
|
9
|
+
skipStyleBlock?: boolean;
|
|
10
|
+
/** Extra HTML to inject into <head>. */
|
|
11
|
+
headContent?: string;
|
|
12
|
+
}
|
|
13
|
+
interface RenderEmailResult {
|
|
14
|
+
/** Full email HTML document. */
|
|
15
|
+
html: string;
|
|
16
|
+
/** Plain text fallback. */
|
|
17
|
+
text: string;
|
|
18
|
+
/** Subject if provided via options. */
|
|
19
|
+
subject?: string;
|
|
20
|
+
}
|
|
21
|
+
interface EmailAdapter {
|
|
22
|
+
send(message: EmailMessage): Promise<EmailResult>;
|
|
23
|
+
}
|
|
24
|
+
interface EmailMessage {
|
|
25
|
+
to: string | string[];
|
|
26
|
+
from: string;
|
|
27
|
+
subject: string;
|
|
28
|
+
html: string;
|
|
29
|
+
text: string;
|
|
30
|
+
cc?: string | string[];
|
|
31
|
+
bcc?: string | string[];
|
|
32
|
+
replyTo?: string;
|
|
33
|
+
attachments?: EmailAttachment[];
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
interface EmailResult {
|
|
37
|
+
success: boolean;
|
|
38
|
+
messageId?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
interface EmailAttachment {
|
|
42
|
+
filename: string;
|
|
43
|
+
content: string | Buffer;
|
|
44
|
+
contentType?: string;
|
|
45
|
+
encoding?: string;
|
|
46
|
+
}
|
|
47
|
+
interface MailerSendOptions {
|
|
48
|
+
to: string | string[];
|
|
49
|
+
from: string;
|
|
50
|
+
subject?: string;
|
|
51
|
+
component: any;
|
|
52
|
+
props?: Record<string, any>;
|
|
53
|
+
renderOptions?: RenderEmailOptions;
|
|
54
|
+
cc?: string | string[];
|
|
55
|
+
bcc?: string | string[];
|
|
56
|
+
replyTo?: string;
|
|
57
|
+
attachments?: EmailAttachment[];
|
|
58
|
+
}
|
|
59
|
+
interface SmtpConfig {
|
|
60
|
+
host: string;
|
|
61
|
+
port: number;
|
|
62
|
+
secure?: boolean;
|
|
63
|
+
auth?: {
|
|
64
|
+
user: string;
|
|
65
|
+
pass: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface ResendConfig {
|
|
69
|
+
apiKey: string;
|
|
70
|
+
}
|
|
71
|
+
interface SendGridConfig {
|
|
72
|
+
apiKey: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type { EmailAdapter as E, MailerSendOptions as M, RenderEmailOptions as R, SendGridConfig as S, RenderEmailResult as a, EmailResult as b, EmailAttachment as c, EmailMessage as d, ResendConfig as e, SmtpConfig as f };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
interface RenderEmailOptions {
|
|
2
|
+
/** Email subject line (can also be set in MailerSendOptions). */
|
|
3
|
+
subject?: string;
|
|
4
|
+
/** Hidden preview text shown in email clients. */
|
|
5
|
+
previewText?: string;
|
|
6
|
+
/** Skip CSS inlining (keep styles in <style> block only). */
|
|
7
|
+
skipInlining?: boolean;
|
|
8
|
+
/** Skip the <style> block entirely (only inline styles). */
|
|
9
|
+
skipStyleBlock?: boolean;
|
|
10
|
+
/** Extra HTML to inject into <head>. */
|
|
11
|
+
headContent?: string;
|
|
12
|
+
}
|
|
13
|
+
interface RenderEmailResult {
|
|
14
|
+
/** Full email HTML document. */
|
|
15
|
+
html: string;
|
|
16
|
+
/** Plain text fallback. */
|
|
17
|
+
text: string;
|
|
18
|
+
/** Subject if provided via options. */
|
|
19
|
+
subject?: string;
|
|
20
|
+
}
|
|
21
|
+
interface EmailAdapter {
|
|
22
|
+
send(message: EmailMessage): Promise<EmailResult>;
|
|
23
|
+
}
|
|
24
|
+
interface EmailMessage {
|
|
25
|
+
to: string | string[];
|
|
26
|
+
from: string;
|
|
27
|
+
subject: string;
|
|
28
|
+
html: string;
|
|
29
|
+
text: string;
|
|
30
|
+
cc?: string | string[];
|
|
31
|
+
bcc?: string | string[];
|
|
32
|
+
replyTo?: string;
|
|
33
|
+
attachments?: EmailAttachment[];
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
interface EmailResult {
|
|
37
|
+
success: boolean;
|
|
38
|
+
messageId?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
interface EmailAttachment {
|
|
42
|
+
filename: string;
|
|
43
|
+
content: string | Buffer;
|
|
44
|
+
contentType?: string;
|
|
45
|
+
encoding?: string;
|
|
46
|
+
}
|
|
47
|
+
interface MailerSendOptions {
|
|
48
|
+
to: string | string[];
|
|
49
|
+
from: string;
|
|
50
|
+
subject?: string;
|
|
51
|
+
component: any;
|
|
52
|
+
props?: Record<string, any>;
|
|
53
|
+
renderOptions?: RenderEmailOptions;
|
|
54
|
+
cc?: string | string[];
|
|
55
|
+
bcc?: string | string[];
|
|
56
|
+
replyTo?: string;
|
|
57
|
+
attachments?: EmailAttachment[];
|
|
58
|
+
}
|
|
59
|
+
interface SmtpConfig {
|
|
60
|
+
host: string;
|
|
61
|
+
port: number;
|
|
62
|
+
secure?: boolean;
|
|
63
|
+
auth?: {
|
|
64
|
+
user: string;
|
|
65
|
+
pass: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface ResendConfig {
|
|
69
|
+
apiKey: string;
|
|
70
|
+
}
|
|
71
|
+
interface SendGridConfig {
|
|
72
|
+
apiKey: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type { EmailAdapter as E, MailerSendOptions as M, RenderEmailOptions as R, SendGridConfig as S, RenderEmailResult as a, EmailResult as b, EmailAttachment as c, EmailMessage as d, ResendConfig as e, SmtpConfig as f };
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@matthesketh/utopia-email",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Template-based email rendering for UtopiaJS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Matt <matt@matthesketh.pro>",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/wrxck/utopiajs.git",
|
|
11
|
+
"directory": "packages/email"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/wrxck/utopiajs/tree/main/packages/email",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"email",
|
|
16
|
+
"templates",
|
|
17
|
+
"smtp",
|
|
18
|
+
"resend",
|
|
19
|
+
"sendgrid",
|
|
20
|
+
"utopiajs"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20.0.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"require": "./dist/index.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./smtp": {
|
|
39
|
+
"types": "./dist/adapters/smtp.d.ts",
|
|
40
|
+
"import": "./dist/adapters/smtp.js",
|
|
41
|
+
"require": "./dist/adapters/smtp.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./resend": {
|
|
44
|
+
"types": "./dist/adapters/resend.d.ts",
|
|
45
|
+
"import": "./dist/adapters/resend.js",
|
|
46
|
+
"require": "./dist/adapters/resend.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./sendgrid": {
|
|
49
|
+
"types": "./dist/adapters/sendgrid.d.ts",
|
|
50
|
+
"import": "./dist/adapters/sendgrid.js",
|
|
51
|
+
"require": "./dist/adapters/sendgrid.cjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist"
|
|
56
|
+
],
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@matthesketh/utopia-server": "0.0.1",
|
|
59
|
+
"@matthesketh/utopia-core": "0.0.1"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@sendgrid/mail": "^7.0.0 || ^8.0.0",
|
|
63
|
+
"nodemailer": "^6.0.0",
|
|
64
|
+
"resend": "^3.0.0 || ^4.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"nodemailer": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"resend": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@sendgrid/mail": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@sendgrid/mail": "^8.1.6",
|
|
79
|
+
"@types/nodemailer": "^7.0.9",
|
|
80
|
+
"nodemailer": "^8.0.1",
|
|
81
|
+
"resend": "^6.9.1"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "tsup src/index.ts src/adapters/smtp.ts src/adapters/resend.ts src/adapters/sendgrid.ts --format esm,cjs --dts"
|
|
85
|
+
}
|
|
86
|
+
}
|