@allthings/cloud-toolkit 2.4.0 → 2.5.0-dev.2

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/lib.cjs.js CHANGED
@@ -8,7 +8,7 @@ var libDynamodb = require('@aws-sdk/lib-dynamodb');
8
8
  var Bottleneck = require('bottleneck');
9
9
  var clientLambda = require('@aws-sdk/client-lambda');
10
10
  var clientSsm = require('@aws-sdk/client-ssm');
11
- var aws$1 = require('@aws-sdk/client-ses');
11
+ var clientSesv2 = require('@aws-sdk/client-sesv2');
12
12
  var nodemailer = require('nodemailer');
13
13
  var clientSqs = require('@aws-sdk/client-sqs');
14
14
  var winston = require('winston');
@@ -33,7 +33,6 @@ function _interopNamespaceDefault(e) {
33
33
  var querystring__namespace = /*#__PURE__*/_interopNamespaceDefault(querystring);
34
34
  var zlib__namespace = /*#__PURE__*/_interopNamespaceDefault(zlib);
35
35
  var crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
36
- var aws__namespace = /*#__PURE__*/_interopNamespaceDefault(aws$1);
37
36
 
38
37
  const defaultErrorHandler = (request, response, error) => {
39
38
  const { requestId } = request.requestContext;
@@ -973,7 +972,7 @@ const parameterStore = (userConfig) => {
973
972
  const DEFAULT_CLIENT_CONFIG = {
974
973
  clientConfig: { region: 'eu-west-1' },
975
974
  };
976
- const sendMail = async (config, transport, options, from, responseCallback) => {
975
+ const sendMail = async (config, transport, options, responseCallback) => {
977
976
  try {
978
977
  if (!options.html && !options.text) {
979
978
  if (config.logger) {
@@ -987,10 +986,7 @@ const sendMail = async (config, transport, options, from, responseCallback) => {
987
986
  }
988
987
  return false;
989
988
  }
990
- const transportResponse = await transport.sendMail({
991
- from,
992
- ...options,
993
- });
989
+ const transportResponse = await transport.sendMail(options);
994
990
  if (responseCallback) {
995
991
  await responseCallback(transportResponse);
996
992
  }
@@ -1009,17 +1005,17 @@ const sendMail = async (config, transport, options, from, responseCallback) => {
1009
1005
  return false;
1010
1006
  }
1011
1007
  };
1012
- const ses = (fromEmailAddress, userConfig) => {
1008
+ const ses = (userConfig) => {
1013
1009
  const { clientConfig, ...config } = {
1014
1010
  ...DEFAULT_CLIENT_CONFIG,
1015
1011
  ...userConfig,
1016
1012
  };
1017
- const sesClient = new aws__namespace.SESClient(clientConfig);
1013
+ const sesClient = new clientSesv2.SESv2Client(clientConfig);
1018
1014
  const transport = nodemailer.createTransport(userConfig.customSMTPConfig ?? {
1019
- SES: { aws: aws__namespace, ses: sesClient },
1015
+ SES: { SendEmailCommand: clientSesv2.SendEmailCommand, sesClient },
1020
1016
  });
1021
1017
  return {
1022
- sendMail: (options, responseCallback) => sendMail(config, transport, options, fromEmailAddress, responseCallback),
1018
+ sendMail: (options, responseCallback) => sendMail(config, transport, options, responseCallback),
1023
1019
  };
1024
1020
  };
1025
1021
 
package/dist/lib.esm.js CHANGED
@@ -6,7 +6,7 @@ import { DynamoDBDocumentClient, UpdateCommand, ScanCommand, QueryCommand, PutCo
6
6
  import Bottleneck from 'bottleneck';
7
7
  import { LambdaClient, InvokeCommand } from '@aws-sdk/client-lambda';
8
8
  import { SSMClient, GetParametersCommand, GetParameterCommand } from '@aws-sdk/client-ssm';
9
- import * as aws$1 from '@aws-sdk/client-ses';
9
+ import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-sesv2';
10
10
  import { createTransport } from 'nodemailer';
11
11
  import { SQSClient, SendMessageCommand, GetQueueUrlCommand, ReceiveMessageCommand, DeleteMessageCommand } from '@aws-sdk/client-sqs';
12
12
  import { format, createLogger, transports } from 'winston';
@@ -950,7 +950,7 @@ const parameterStore = (userConfig) => {
950
950
  const DEFAULT_CLIENT_CONFIG = {
951
951
  clientConfig: { region: 'eu-west-1' },
952
952
  };
953
- const sendMail = async (config, transport, options, from, responseCallback) => {
953
+ const sendMail = async (config, transport, options, responseCallback) => {
954
954
  try {
955
955
  if (!options.html && !options.text) {
956
956
  if (config.logger) {
@@ -964,10 +964,7 @@ const sendMail = async (config, transport, options, from, responseCallback) => {
964
964
  }
965
965
  return false;
966
966
  }
967
- const transportResponse = await transport.sendMail({
968
- from,
969
- ...options,
970
- });
967
+ const transportResponse = await transport.sendMail(options);
971
968
  if (responseCallback) {
972
969
  await responseCallback(transportResponse);
973
970
  }
@@ -986,17 +983,17 @@ const sendMail = async (config, transport, options, from, responseCallback) => {
986
983
  return false;
987
984
  }
988
985
  };
989
- const ses = (fromEmailAddress, userConfig) => {
986
+ const ses = (userConfig) => {
990
987
  const { clientConfig, ...config } = {
991
988
  ...DEFAULT_CLIENT_CONFIG,
992
989
  ...userConfig,
993
990
  };
994
- const sesClient = new aws$1.SESClient(clientConfig);
991
+ const sesClient = new SESv2Client(clientConfig);
995
992
  const transport = createTransport(userConfig.customSMTPConfig ?? {
996
- SES: { aws: aws$1, ses: sesClient },
993
+ SES: { SendEmailCommand, sesClient },
997
994
  });
998
995
  return {
999
- sendMail: (options, responseCallback) => sendMail(config, transport, options, fromEmailAddress, responseCallback),
996
+ sendMail: (options, responseCallback) => sendMail(config, transport, options, responseCallback),
1000
997
  };
1001
998
  };
1002
999