@stacksjs/email 0.59.11 → 0.61.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/email",
3
3
  "type": "module",
4
- "version": "0.59.11",
4
+ "version": "0.61.1",
5
5
  "description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -60,8 +60,8 @@
60
60
  "@stacksjs/config": "latest",
61
61
  "@stacksjs/error-handling": "latest",
62
62
  "@stacksjs/types": "latest",
63
- "aws-sdk": "^2.1572.0",
64
- "vue-email": "^0.8.10"
63
+ "aws-sdk": "^2.1624.0",
64
+ "vue-email": "^0.8.11"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@stacksjs/development": "latest"
package/src/email.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { SES } from '@aws-sdk/client-ses'
2
+ import { log } from '@stacksjs/logging'
2
3
  import type { RenderOptions } from './template'
3
4
  import { template } from './template'
4
5
  import type { Message, SendEmailParams } from './types'
@@ -44,14 +45,12 @@ export class Email {
44
45
 
45
46
  let returnMsg: { message: string } = { message: 'Email sent' }
46
47
 
47
- if (this.message.handle)
48
- returnMsg = await this.message.handle()
48
+ if (this.message.handle) returnMsg = await this.message.handle()
49
49
 
50
50
  await this.onSuccess()
51
51
 
52
52
  return returnMsg
53
- }
54
- catch (error) {
53
+ } catch (error) {
55
54
  return this.onError(error as Error)
56
55
  }
57
56
  }
@@ -59,20 +58,17 @@ export class Email {
59
58
  public async onError(error: Error) {
60
59
  log.error(error)
61
60
 
62
- if (!this.message.onError)
63
- return
61
+ if (!this.message.onError) return
64
62
 
65
63
  return await this.message.onError(error)
66
64
  }
67
65
 
68
66
  public onSuccess() {
69
67
  try {
70
- if (!this.message.onSuccess)
71
- return
68
+ if (!this.message.onSuccess) return
72
69
 
73
70
  this.message.onSuccess()
74
- }
75
- catch (error) {
71
+ } catch (error) {
76
72
  return this.onError(error as Error)
77
73
  }
78
74
  }
package/src/send.ts CHANGED
@@ -4,7 +4,11 @@ import type { EmailOptions } from '@stacksjs/types'
4
4
 
5
5
  // import { stringify } from 'json5'
6
6
 
7
- export async function send(options: EmailOptions, provider: any, providerName: string): Promise<ResultAsync<any, Error>> {
7
+ export async function send(
8
+ options: EmailOptions,
9
+ provider: any,
10
+ providerName: string,
11
+ ): Promise<ResultAsync<any, Error>> {
8
12
  // const template = `
9
13
  // <extends src="./src/notifications/src/utils/template.html">
10
14
  // <block name="template">
@@ -1,6 +1,3 @@
1
- // /* eslint-disable eslint-comments/no-unlimited-disable */
2
- // /* eslint-disable */
3
- //
4
1
  // const AWS = require('aws-sdk')
5
2
  // const mime = require('mime')
6
3
  // const parser = require('mailparser').simpleParser
@@ -1,5 +1,3 @@
1
- // /* eslint-disable eslint-comments/no-unlimited-disable */
2
- // /* eslint-disable */
3
1
  // import type Stream from 'node:stream'
4
2
  // import * as AWS from 'aws-sdk'
5
3
  // import moment from 'moment'
package/src/template.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process'
2
- import { config } from '@vue-email/compiler'
3
2
  import { path } from '@stacksjs/path'
3
+ import { config } from '@vue-email/compiler'
4
4
  import type { I18n } from 'vue-email'
5
5
 
6
6
  export interface RenderOptions {
@@ -1 +0,0 @@
1
- export * as ses from './ses';
@@ -1 +0,0 @@
1
- export {};
package/dist/email.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { RenderOptions } from './template';
2
- import type { Message } from './types';
3
- export declare class Email {
4
- private message;
5
- private client;
6
- constructor(message: Message);
7
- send(options?: RenderOptions): Promise<{
8
- message: string;
9
- } | undefined>;
10
- onError(error: Error): Promise<{
11
- message: string;
12
- } | undefined>;
13
- onSuccess(): Promise<{
14
- message: string;
15
- } | undefined> | undefined;
16
- }
17
- export type { Message };
18
- export declare const email: (options: Message) => Email;
19
- export default Email;
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './drivers';
2
- export * from './email.ts';
3
- export * from './types';
@@ -1,6 +0,0 @@
1
- import type { I18n } from 'vue-email';
2
- export interface RenderOptions {
3
- props?: Record<string, unknown>;
4
- i18n?: I18n;
5
- }
6
- export declare const template: (path: string, options?: RenderOptions) => Promise<import("@vue-email/compiler").Result>;
package/dist/types.d.ts DELETED
@@ -1,41 +0,0 @@
1
- export 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<{
11
- message: string;
12
- }>;
13
- onError?: (error: Error) => Promise<{
14
- message: string;
15
- }>;
16
- onSuccess?: () => void;
17
- }
18
- export interface SendEmailParams {
19
- Source: string;
20
- Destination: {
21
- ToAddresses: string[];
22
- };
23
- Message: {
24
- Body: {
25
- Html: {
26
- Charset: 'UTF-8';
27
- Data: string;
28
- };
29
- };
30
- Subject: {
31
- Charset: 'UTF-8';
32
- Data: string;
33
- };
34
- };
35
- }
36
- export interface EmailParams {
37
- to: string;
38
- from: string;
39
- subject: string;
40
- html: string;
41
- }