@stacksjs/email 0.46.4 → 0.47.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.
@@ -0,0 +1,2 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ export declare function send(options: EmailOptions, provider: any, providerName: string, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
@@ -0,0 +1,30 @@
1
+ import { italic } from "@stacksjs/cli";
2
+ import { log } from "@stacksjs/logging";
3
+ import { ResultAsync } from "@stacksjs/error-handling";
4
+ import * as Maizzle from "@maizzle/framework";
5
+ import * as maizzleConfig from "../../../utils/config";
6
+ import { config } from "../tailwind.config";
7
+ export async function send(options, provider, providerName, css) {
8
+ const template = `
9
+ <extends src="./core/notifications/src/utils/template.html">
10
+ <block name="template">
11
+ ${options.html}
12
+ </block>
13
+ </extends>`;
14
+ await Maizzle.render(
15
+ template,
16
+ {
17
+ tailwind: {
18
+ config,
19
+ css,
20
+ maizzle: maizzleConfig
21
+ }
22
+ }
23
+ ).then(({ html }) => {
24
+ options.html = html;
25
+ }).catch((error) => log.error(`Failed to render email template using provider: ${italic(providerName)}.`, error));
26
+ return ResultAsync.fromPromise(
27
+ provider.sendMessage(options),
28
+ () => new Error(`Failed to send message using provider: ${italic(providerName)}`)
29
+ );
30
+ }
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,16 @@
1
+ import { EmailJsProvider } from "@novu/emailjs";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.emailjs;
5
+ const provider = new EmailJsProvider({
6
+ from: env.from,
7
+ host: env.host,
8
+ user: env.user,
9
+ password: env.password,
10
+ port: env.port,
11
+ secure: env.secure
12
+ });
13
+ async function send(options, css) {
14
+ return sendEmail(options, provider, "EmailJS", css);
15
+ }
16
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,14 @@
1
+ import { MailgunEmailProvider } from "@novu/mailgun";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.mailgun;
5
+ const provider = new MailgunEmailProvider({
6
+ apiKey: env.key,
7
+ domain: env.domain,
8
+ username: env.username,
9
+ from: env.from
10
+ });
11
+ async function send(options, css) {
12
+ return sendEmail(options, provider, "Mailgun", css);
13
+ }
14
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,13 @@
1
+ import { MailjetEmailProvider } from "@novu/mailjet";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.mailjet;
5
+ const provider = new MailjetEmailProvider({
6
+ apiKey: env.key,
7
+ apiSecret: env.secret,
8
+ from: env.from
9
+ });
10
+ async function send(options, css) {
11
+ return sendEmail(options, provider, "Mailjet", css);
12
+ }
13
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,12 @@
1
+ import { MandrillProvider } from "@novu/mandrill";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.mandrill;
5
+ const provider = new MandrillProvider({
6
+ apiKey: env.key,
7
+ from: env.from
8
+ });
9
+ async function send(options, css) {
10
+ return sendEmail(options, provider, "Mandrill", css);
11
+ }
12
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,12 @@
1
+ import { NetCoreProvider } from "@novu/netcore";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.netcore;
5
+ const provider = new NetCoreProvider({
6
+ apiKey: env.key,
7
+ from: env.from
8
+ });
9
+ async function send(options, css) {
10
+ return sendEmail(options, provider, "Netcore", css);
11
+ }
12
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,16 @@
1
+ import { NodemailerProvider } from "@novu/nodemailer";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.nodemailer;
5
+ const provider = new NodemailerProvider({
6
+ from: env.from,
7
+ host: env.host,
8
+ user: env.user,
9
+ password: env.password,
10
+ port: env.port,
11
+ secure: env.secure
12
+ });
13
+ async function send(options, css) {
14
+ return sendEmail(options, provider, "Nodemailer", css);
15
+ }
16
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,12 @@
1
+ import { PostmarkEmailProvider } from "@novu/postmark";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.postmark;
5
+ const provider = new PostmarkEmailProvider({
6
+ apiKey: env.key,
7
+ from: env.from
8
+ });
9
+ async function send(options, css) {
10
+ return sendEmail(options, provider, "Postmark", css);
11
+ }
12
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,13 @@
1
+ import { SendgridEmailProvider } from "@novu/sendgrid";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.sendgrid;
5
+ const provider = new SendgridEmailProvider({
6
+ apiKey: env.key,
7
+ from: env.from,
8
+ senderName: env.senderName
9
+ });
10
+ async function send(options, css) {
11
+ return sendEmail(options, provider, "Sendgrid", css);
12
+ }
13
+ export { send as Send, send };
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ declare function send(options: EmailOptions, css?: string): Promise<import("neverthrow").Result<unknown, Error>>;
3
+ export { send as Send, send };
@@ -0,0 +1,14 @@
1
+ import { SESEmailProvider } from "@novu/ses";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "./actions/send.mjs";
4
+ const env = notification.email.ses;
5
+ const provider = new SESEmailProvider({
6
+ region: env.region,
7
+ accessKeyId: env.key,
8
+ secretAccessKey: env.secret,
9
+ from: env.from
10
+ });
11
+ async function send(options, css) {
12
+ return sendEmail(options, provider, "Ses", css);
13
+ }
14
+ export { send as Send, send };
package/dist/index.d.ts CHANGED
@@ -1 +1,9 @@
1
- export {};
1
+ export * as sendgrid from './drivers/sendgrid';
2
+ export * as mailgun from './drivers/mailgun';
3
+ export * as mailjet from './drivers/mailjet';
4
+ export * as mandrill from './drivers/mandrill';
5
+ export * as netcore from './drivers/netcore';
6
+ export * as nodemailer from './drivers/nodemailer';
7
+ export * as postmark from './drivers/postmark';
8
+ export * as ses from './drivers/ses';
9
+ export * as emailjs from './drivers/emailjs';
package/dist/index.mjs CHANGED
@@ -1 +1,9 @@
1
- export {};
1
+ export * as sendgrid from "./drivers/sendgrid.mjs";
2
+ export * as mailgun from "./drivers/mailgun.mjs";
3
+ export * as mailjet from "./drivers/mailjet.mjs";
4
+ export * as mandrill from "./drivers/mandrill.mjs";
5
+ export * as netcore from "./drivers/netcore.mjs";
6
+ export * as nodemailer from "./drivers/nodemailer.mjs";
7
+ export * as postmark from "./drivers/postmark.mjs";
8
+ export * as ses from "./drivers/ses.mjs";
9
+ export * as emailjs from "./drivers/emailjs.mjs";
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ email: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { email } from "@stacksjs/config";
2
+ export default {
3
+ email
4
+ };
@@ -0,0 +1,8 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ Testing...
7
+ <block name="template"></block>
8
+ </body>
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@stacksjs/email",
3
3
  "type": "module",
4
- "version": "0.46.4",
5
- "packageManager": "pnpm@7.19.0",
4
+ "version": "0.47.1",
5
+ "packageManager": "pnpm@7.21.0",
6
6
  "description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -35,18 +35,30 @@
35
35
  ],
36
36
  "engines": {
37
37
  "node": ">=v18.12.1",
38
- "pnpm": ">=7.19.0"
38
+ "pnpm": ">=7.21.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@stacksjs/cli": "0.46.4",
42
- "@stacksjs/config": "0.46.4",
43
- "@stacksjs/error-handling": "0.46.4",
44
- "@stacksjs/types": "0.46.4"
41
+ "@maizzle/framework": "latest",
42
+ "@novu/emailjs": "^0.10.0",
43
+ "@novu/mailgun": "^0.10.0",
44
+ "@novu/mailjet": "^0.10.0",
45
+ "@novu/mandrill": "^0.10.0",
46
+ "@novu/netcore": "^0.10.0",
47
+ "@novu/node": "^0.10.0",
48
+ "@novu/nodemailer": "^0.10.0",
49
+ "@novu/postmark": "^0.10.0",
50
+ "@novu/sendgrid": "^0.10.0",
51
+ "@novu/ses": "^0.10.0",
52
+ "@novu/stateless": "^0.10.0",
53
+ "@stacksjs/cli": "0.47.1",
54
+ "@stacksjs/config": "0.47.1",
55
+ "@stacksjs/error-handling": "0.47.1",
56
+ "@stacksjs/types": "0.47.1"
45
57
  },
46
58
  "devDependencies": {
47
59
  "mkdist": "^1.0.0",
48
60
  "typescript": "^4.9.4",
49
- "@stacksjs/testing": "0.46.4"
61
+ "@stacksjs/testing": "0.47.1"
50
62
  },
51
63
  "scripts": {
52
64
  "build": "mkdist -d",