@stacksjs/email 0.66.0 → 0.68.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/dist/config.d.ts +3 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +0 -3
- package/dist/template.d.ts +6 -5
- package/dist/types.d.ts +35 -31
- package/package.json +7 -9
- package/dist/drivers/index.d.ts +0 -1
- package/dist/drivers/mailgun.d.ts +0 -0
- package/dist/drivers/nodemailer.d.ts +0 -0
- package/dist/drivers/ses.d.ts +0 -0
- package/dist/email.d.ts +0 -0
- package/dist/index.js.map +0 -9
- package/dist/send.d.ts +0 -0
- package/dist/server/converter.d.ts +0 -0
- package/dist/server/inbound.d.ts +0 -0
- package/dist/server/outbound.d.ts +0 -0
- package/dist/utils/config.d.ts +0 -3
- package/src/drivers/index.ts +0 -3
- package/src/drivers/mailgun.ts +0 -21
- package/src/drivers/nodemailer.ts +0 -23
- package/src/drivers/ses.ts +0 -23
- package/src/email.ts +0 -80
- package/src/index.ts +0 -3
- package/src/send.ts +0 -38
- package/src/server/converter.ts +0 -302
- package/src/server/inbound.ts +0 -404
- package/src/server/outbound.ts +0 -296
- package/src/template.ts +0 -20
- package/src/types.ts +0 -39
- package/src/utils/config.ts +0 -5
package/dist/config.d.ts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './drivers'
|
|
2
|
+
export * from './email.ts'
|
|
3
|
+
export * from './types'
|
package/dist/index.js
CHANGED
package/dist/template.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { I18n } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { I18n } from 'vue-email';
|
|
2
|
+
|
|
3
|
+
export declare interface RenderOptions {
|
|
4
|
+
props?: Record<string, unknown>
|
|
5
|
+
i18n?: I18n
|
|
5
6
|
}
|
|
6
|
-
export declare function template(path: string, options?: RenderOptions): Promise<string>;
|
|
7
|
+
export declare function template(path: string, options?: RenderOptions): Promise<string>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
export interface Message {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export declare interface Message {
|
|
2
|
+
name: string
|
|
3
|
+
subject: string
|
|
4
|
+
to: string
|
|
5
|
+
from?: {
|
|
6
|
+
name: string
|
|
7
|
+
address: string
|
|
8
|
+
}
|
|
9
|
+
template: string
|
|
10
|
+
handle?: () => Promise<{ message: string }>
|
|
11
|
+
onError?: (error: Error) => Promise<{ message: string }>
|
|
12
|
+
onSuccess?: () => void
|
|
13
13
|
}
|
|
14
|
-
export interface SendEmailParams {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
subject: string;
|
|
32
|
-
html: string;
|
|
14
|
+
export declare interface SendEmailParams {
|
|
15
|
+
Source: string
|
|
16
|
+
Destination: {
|
|
17
|
+
ToAddresses: string[]
|
|
18
|
+
}
|
|
19
|
+
Message: {
|
|
20
|
+
Body: {
|
|
21
|
+
Html: {
|
|
22
|
+
Charset: 'UTF-8'
|
|
23
|
+
Data: string
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
Subject: {
|
|
27
|
+
Charset: 'UTF-8'
|
|
28
|
+
Data: string
|
|
29
|
+
}
|
|
30
|
+
}
|
|
33
31
|
}
|
|
32
|
+
export declare interface EmailParams {
|
|
33
|
+
to: string
|
|
34
|
+
from: string
|
|
35
|
+
subject: string
|
|
36
|
+
html: string
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/email",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.68.0",
|
|
5
5
|
"description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -19,17 +19,15 @@
|
|
|
19
19
|
"keywords": ["email", "ses", "aws", "stacks", "emailjs", "mailgun"],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"bun": "./src/index.ts",
|
|
23
22
|
"import": "./dist/index.js"
|
|
24
23
|
},
|
|
25
24
|
"./*": {
|
|
26
|
-
"bun": "./src/*",
|
|
27
25
|
"import": "./dist/*"
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
28
|
"module": "dist/index.js",
|
|
31
29
|
"types": "dist/index.d.ts",
|
|
32
|
-
"files": ["README.md", "dist"
|
|
30
|
+
"files": ["README.md", "dist"],
|
|
33
31
|
"scripts": {
|
|
34
32
|
"build": "bun build.ts",
|
|
35
33
|
"build:inbound": "bun build-inbound.ts",
|
|
@@ -37,14 +35,14 @@
|
|
|
37
35
|
"prepublishOnly": "bun run build"
|
|
38
36
|
},
|
|
39
37
|
"dependencies": {
|
|
40
|
-
"@stacksjs/cli": "0.
|
|
41
|
-
"@stacksjs/config": "0.
|
|
42
|
-
"@stacksjs/error-handling": "0.
|
|
43
|
-
"@stacksjs/types": "0.
|
|
38
|
+
"@stacksjs/cli": "0.67.0",
|
|
39
|
+
"@stacksjs/config": "0.67.0",
|
|
40
|
+
"@stacksjs/error-handling": "0.67.0",
|
|
41
|
+
"@stacksjs/types": "0.67.0",
|
|
44
42
|
"aws-sdk": "^2.1691.0",
|
|
45
43
|
"vue-email": "^0.8.11"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
|
-
"@stacksjs/development": "0.
|
|
46
|
+
"@stacksjs/development": "0.67.0"
|
|
49
47
|
}
|
|
50
48
|
}
|
package/dist/drivers/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as ses from "./ses";
|
|
File without changes
|
|
File without changes
|
package/dist/drivers/ses.d.ts
DELETED
|
File without changes
|
package/dist/email.d.ts
DELETED
|
File without changes
|
package/dist/index.js.map
DELETED
package/dist/send.d.ts
DELETED
|
File without changes
|
|
File without changes
|
package/dist/server/inbound.d.ts
DELETED
|
File without changes
|
|
File without changes
|
package/dist/utils/config.d.ts
DELETED
package/src/drivers/index.ts
DELETED
package/src/drivers/mailgun.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// import { MailgunEmailProvider } from '@novu/mailgun'
|
|
2
|
-
// import type { EmailOptions } from '@stacksjs/types'
|
|
3
|
-
// import type { ResultAsync } from '@stacksjs/error-handling'
|
|
4
|
-
// import { notification } from '@stacksjs/config'
|
|
5
|
-
// import { send as sendEmail } from '../send'
|
|
6
|
-
//
|
|
7
|
-
// const env = notification.email
|
|
8
|
-
// const service = notification.email?.drivers.mailgun
|
|
9
|
-
//
|
|
10
|
-
// const provider = new MailgunEmailProvider({
|
|
11
|
-
// apiKey: service?.key || '',
|
|
12
|
-
// domain: service?.domain || '',
|
|
13
|
-
// username: service?.username || '',
|
|
14
|
-
// from: env?.from.address || '',
|
|
15
|
-
// })
|
|
16
|
-
//
|
|
17
|
-
// async function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>> {
|
|
18
|
-
// return sendEmail(options, provider, 'Mailgun', css)
|
|
19
|
-
// }
|
|
20
|
-
//
|
|
21
|
-
// export { send as Send, send }
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// import { NodemailerProvider } from '@novu/nodemailer'
|
|
2
|
-
// import type { EmailOptions } from '@stacksjs/types'
|
|
3
|
-
// import type { ResultAsync } from '@stacksjs/error-handling'
|
|
4
|
-
// import { notification } from '@stacksjs/config'
|
|
5
|
-
// import { send as sendEmail } from '../send'
|
|
6
|
-
//
|
|
7
|
-
// const env = notification.email
|
|
8
|
-
// const service = notification.email?.drivers.nodemailer
|
|
9
|
-
//
|
|
10
|
-
// const provider = new NodemailerProvider({
|
|
11
|
-
// from: env?.from.address || '',
|
|
12
|
-
// host: service?.host || '',
|
|
13
|
-
// user: service?.user,
|
|
14
|
-
// password: service?.password,
|
|
15
|
-
// port: service?.port || 587,
|
|
16
|
-
// secure: service?.secure,
|
|
17
|
-
// })
|
|
18
|
-
//
|
|
19
|
-
// async function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>> {
|
|
20
|
-
// return sendEmail(options, provider, 'Nodemailer', css)
|
|
21
|
-
// }
|
|
22
|
-
//
|
|
23
|
-
// export { send as Send, send }
|
package/src/drivers/ses.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// import { SESEmailProvider } from '@novu/ses'
|
|
2
|
-
// import type { EmailOptions } from '@stacksjs/types'
|
|
3
|
-
// import { notification } from '@stacksjs/config'
|
|
4
|
-
// import type { ResultAsync } from '@stacksjs/error-handling'
|
|
5
|
-
// import { send as sendEmail } from '../send'
|
|
6
|
-
|
|
7
|
-
// const email = notification.email
|
|
8
|
-
// const env = email?.drivers?.ses
|
|
9
|
-
|
|
10
|
-
// // const provider = new SESEmailProvider({
|
|
11
|
-
// const provider = new SESEmailProvider({
|
|
12
|
-
// region: env?.region || 'us-east-1',
|
|
13
|
-
// accessKeyId: env?.key || '',
|
|
14
|
-
// secretAccessKey: env?.secret || '',
|
|
15
|
-
// senderName: email?.from.name || 'Stacks',
|
|
16
|
-
// from: email?.from.address || '',
|
|
17
|
-
// })
|
|
18
|
-
|
|
19
|
-
// async function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>> {
|
|
20
|
-
// return sendEmail(options, provider, 'Ses', css)
|
|
21
|
-
// }
|
|
22
|
-
|
|
23
|
-
// export { send as Send, send }
|
package/src/email.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// import { SES } from '@aws-sdk/client-ses'
|
|
2
|
-
// import { log } from '@stacksjs/logging'
|
|
3
|
-
// import type { RenderOptions } from './template'
|
|
4
|
-
// import { template } from './template'
|
|
5
|
-
// import type { Message, SendEmailParams } from './types'
|
|
6
|
-
|
|
7
|
-
// export class Email {
|
|
8
|
-
// private client: SES
|
|
9
|
-
|
|
10
|
-
// constructor(private message: Message) {
|
|
11
|
-
// this.client = new SES({ region: 'us-east-1' })
|
|
12
|
-
// this.message = message
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// public async send(options?: RenderOptions): Promise<{ message: string }> {
|
|
16
|
-
// log.info('Sending email...')
|
|
17
|
-
// const path = this.message.template
|
|
18
|
-
|
|
19
|
-
// try {
|
|
20
|
-
// const templ = await template(path, options)
|
|
21
|
-
|
|
22
|
-
// const params: SendEmailParams = {
|
|
23
|
-
// Source: this.message.from?.address || '',
|
|
24
|
-
|
|
25
|
-
// Destination: {
|
|
26
|
-
// ToAddresses: [this.message.to],
|
|
27
|
-
// },
|
|
28
|
-
|
|
29
|
-
// Message: {
|
|
30
|
-
// Body: {
|
|
31
|
-
// Html: {
|
|
32
|
-
// Charset: 'UTF-8',
|
|
33
|
-
// Data: templ.html,
|
|
34
|
-
// },
|
|
35
|
-
// },
|
|
36
|
-
|
|
37
|
-
// Subject: {
|
|
38
|
-
// Charset: 'UTF-8',
|
|
39
|
-
// Data: this.message.subject,
|
|
40
|
-
// },
|
|
41
|
-
// },
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
|
-
// await this.client.sendEmail(params)
|
|
45
|
-
|
|
46
|
-
// let returnMsg: { message: string } = { message: 'Email sent' }
|
|
47
|
-
|
|
48
|
-
// if (this.message.handle) returnMsg = await this.message.handle()
|
|
49
|
-
|
|
50
|
-
// await this.onSuccess()
|
|
51
|
-
|
|
52
|
-
// return returnMsg
|
|
53
|
-
// } catch (error) {
|
|
54
|
-
// return this.onError(error as Error)
|
|
55
|
-
// }
|
|
56
|
-
// }
|
|
57
|
-
|
|
58
|
-
// public async onError(error: Error) {
|
|
59
|
-
// log.error(error)
|
|
60
|
-
|
|
61
|
-
// if (!this.message.onError) return
|
|
62
|
-
|
|
63
|
-
// return await this.message.onError(error)
|
|
64
|
-
// }
|
|
65
|
-
|
|
66
|
-
// // public onSuccess() {
|
|
67
|
-
// // try {
|
|
68
|
-
// // if (!this.message.onSuccess) return
|
|
69
|
-
|
|
70
|
-
// // this.message.onSuccess()
|
|
71
|
-
// // } catch (error) {
|
|
72
|
-
// // return this.onError(error as Error)
|
|
73
|
-
// // }
|
|
74
|
-
// // }
|
|
75
|
-
// }
|
|
76
|
-
|
|
77
|
-
// export type { Message }
|
|
78
|
-
|
|
79
|
-
// // export const email = (options: Message) => new Email(options)
|
|
80
|
-
// export default Email
|
package/src/index.ts
DELETED
package/src/send.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// import { italic } from '@stacksjs/cli'
|
|
2
|
-
// import { ResultAsync } from '@stacksjs/error-handling'
|
|
3
|
-
// import type { EmailOptions } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
// // import { stringify } from 'json5'
|
|
6
|
-
|
|
7
|
-
// export async function send(
|
|
8
|
-
// options: EmailOptions,
|
|
9
|
-
// provider: any,
|
|
10
|
-
// providerName: string,
|
|
11
|
-
// ): Promise<ResultAsync<any, Error>> {
|
|
12
|
-
// // const template = `
|
|
13
|
-
// // <extends src="./src/notifications/src/utils/template.html">
|
|
14
|
-
// // <block name="template">
|
|
15
|
-
// // ${options.html}
|
|
16
|
-
// // </block>
|
|
17
|
-
// // </extends>`
|
|
18
|
-
|
|
19
|
-
// // await Maizzle.render(
|
|
20
|
-
// // template,
|
|
21
|
-
// // {
|
|
22
|
-
// // tailwind: {
|
|
23
|
-
// // // config: stringify(config),
|
|
24
|
-
// // css,
|
|
25
|
-
// // maizzle: maizzleConfig,
|
|
26
|
-
// // },
|
|
27
|
-
// // },
|
|
28
|
-
// // )
|
|
29
|
-
// // .then(({ html }: any) => {
|
|
30
|
-
// // options.html = html
|
|
31
|
-
// // })
|
|
32
|
-
// // .catch((error: any) => log.error(`Failed to render email template using provider: ${italic(providerName)}.`, error))
|
|
33
|
-
|
|
34
|
-
// return ResultAsync.fromPromise(
|
|
35
|
-
// provider.sendMessage(options),
|
|
36
|
-
// () => new Error(`Failed to send message using provider: ${italic(providerName)}`),
|
|
37
|
-
// )
|
|
38
|
-
// }
|