idea-aws 4.0.7 → 4.0.9

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/src/ses.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import * as AWSSESv2 from '@aws-sdk/client-sesv2';
2
+ import * as AWSSES from '@aws-sdk/client-sesv2';
3
3
  import { SentMessageInfo as NodemailerSentMessageInfo } from 'nodemailer';
4
4
  import { Headers } from 'nodemailer/lib/mailer';
5
5
  import { Logger } from './logger';
@@ -7,13 +7,13 @@ import { Logger } from './logger';
7
7
  * A wrapper for AWS Simple Email Service.
8
8
  */
9
9
  export declare class SES {
10
- protected ses: AWSSESv2.SESv2Client;
10
+ protected ses: AWSSES.SESv2Client;
11
11
  logger: Logger;
12
12
  constructor(options?: {
13
13
  region?: string;
14
14
  debug: boolean;
15
15
  });
16
- getTemplate(templateName: string): Promise<AWSSESv2.EmailTemplateContent>;
16
+ getTemplate(templateName: string): Promise<AWSSES.EmailTemplateContent>;
17
17
  setTemplate(templateName: string, subject: string, content: string, isHTML?: boolean): Promise<void>;
18
18
  deleteTemplate(templateName: string): Promise<void>;
19
19
  testTemplate(templateName: string, data: {
@@ -22,12 +22,12 @@ export declare class SES {
22
22
  /**
23
23
  * Send a templated email through AWS Simple Email Service.
24
24
  */
25
- sendTemplatedEmail(emailData: TemplatedEmailData, sesParams: SESParams): Promise<AWSSESv2.SendEmailCommandOutput>;
25
+ sendTemplatedEmail(emailData: TemplatedEmailData, sesParams: SESParams): Promise<AWSSES.SendEmailCommandOutput>;
26
26
  /**
27
27
  * Send an email through AWS Simple Email Service.
28
28
  * It supports IDEA's teams custom configuration.
29
29
  */
30
- sendEmail(emailData: EmailData, sesParams: SESParams): Promise<AWSSESv2.SendEmailResponse | NodemailerSentMessageInfo>;
30
+ sendEmail(emailData: EmailData, sesParams: SESParams): Promise<AWSSES.SendEmailResponse | NodemailerSentMessageInfo>;
31
31
  private searchForCustomSESConfigByTeamId;
32
32
  private sendEmailWithSES;
33
33
  private sendEmailWithNodemailer;
package/dist/src/ses.js CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.SES = void 0;
27
27
  const client_ses_1 = require("@aws-sdk/client-ses");
28
- const AWSSESv2 = __importStar(require("@aws-sdk/client-sesv2"));
28
+ const AWSSES = __importStar(require("@aws-sdk/client-sesv2"));
29
29
  const nodemailer_1 = require("nodemailer");
30
30
  const dynamoDB_1 = require("./dynamoDB");
31
31
  const logger_1 = require("./logger");
@@ -35,21 +35,21 @@ const logger_1 = require("./logger");
35
35
  class SES {
36
36
  constructor(options = { debug: true }) {
37
37
  this.logger = new logger_1.Logger();
38
- this.ses = new AWSSESv2.SESv2Client({ region: options.region });
38
+ this.ses = new AWSSES.SESv2Client({ region: options.region });
39
39
  this.logger.level = options.debug ? 'DEBUG' : 'INFO';
40
40
  }
41
41
  //
42
42
  // CONFIG
43
43
  //
44
44
  async getTemplate(templateName) {
45
- const command = new AWSSESv2.GetEmailTemplateCommand({ TemplateName: templateName });
45
+ const command = new AWSSES.GetEmailTemplateCommand({ TemplateName: templateName });
46
46
  const { TemplateContent } = await this.ses.send(command);
47
47
  return TemplateContent;
48
48
  }
49
49
  async setTemplate(templateName, subject, content, isHTML) {
50
50
  let isNew = false;
51
51
  try {
52
- const command = new AWSSESv2.GetEmailTemplateCommand({ TemplateName: templateName });
52
+ const command = new AWSSES.GetEmailTemplateCommand({ TemplateName: templateName });
53
53
  await this.ses.send(command);
54
54
  }
55
55
  catch (notFound) {
@@ -65,17 +65,17 @@ class SES {
65
65
  template.TemplateContent.Text = content;
66
66
  let command;
67
67
  if (isNew)
68
- command = new AWSSESv2.CreateEmailTemplateCommand(template);
68
+ command = new AWSSES.CreateEmailTemplateCommand(template);
69
69
  else
70
- command = new AWSSESv2.UpdateEmailTemplateCommand(template);
70
+ command = new AWSSES.UpdateEmailTemplateCommand(template);
71
71
  await this.ses.send(command);
72
72
  }
73
73
  async deleteTemplate(templateName) {
74
- const command = new AWSSESv2.DeleteEmailTemplateCommand({ TemplateName: templateName });
74
+ const command = new AWSSES.DeleteEmailTemplateCommand({ TemplateName: templateName });
75
75
  await this.ses.send(command);
76
76
  }
77
77
  async testTemplate(templateName, data) {
78
- const command = new AWSSESv2.TestRenderEmailTemplateCommand({
78
+ const command = new AWSSES.TestRenderEmailTemplateCommand({
79
79
  TemplateName: templateName,
80
80
  TemplateData: JSON.stringify(data)
81
81
  });
@@ -89,7 +89,7 @@ class SES {
89
89
  * Send a templated email through AWS Simple Email Service.
90
90
  */
91
91
  async sendTemplatedEmail(emailData, sesParams) {
92
- const command = new AWSSESv2.SendEmailCommand({
92
+ const command = new AWSSES.SendEmailCommand({
93
93
  Destination: this.prepareEmailDestination(emailData),
94
94
  Content: {
95
95
  Template: {
@@ -106,7 +106,7 @@ class SES {
106
106
  if (this.ses.config.region === sesParams.region)
107
107
  ses = this.ses;
108
108
  else
109
- ses = new AWSSESv2.SESv2Client({ region: sesParams.region });
109
+ ses = new AWSSES.SESv2Client({ region: sesParams.region });
110
110
  this.logger.debug('SES send templated email');
111
111
  return await ses.send(command);
112
112
  }
@@ -135,7 +135,7 @@ class SES {
135
135
  }
136
136
  }
137
137
  async sendEmailWithSES(emailData, sesParams) {
138
- const command = new AWSSESv2.SendEmailCommand({
138
+ const command = new AWSSES.SendEmailCommand({
139
139
  Destination: this.prepareEmailDestination(emailData),
140
140
  Content: { Simple: this.prepareEmailMessage(emailData) },
141
141
  ReplyToAddresses: emailData.replyToAddresses,
@@ -146,7 +146,7 @@ class SES {
146
146
  if (this.ses.config.region === sesParams.region)
147
147
  ses = this.ses;
148
148
  else
149
- ses = new AWSSESv2.SESv2Client({ region: sesParams.region });
149
+ ses = new AWSSES.SESv2Client({ region: sesParams.region });
150
150
  this.logger.debug('SES send email');
151
151
  return await ses.send(command);
152
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "description": "AWS wrappers to use in IDEA's back-ends",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",