@allthings/cloud-toolkit 2.1.0 → 2.2.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 +27 -19
- package/dist/lib.esm.js +27 -19
- package/dist/lib.umd.min.js +1 -1
- package/dist/src/aws/ses.d.ts +1 -0
- package/package.json +1 -1
package/dist/lib.cjs.js
CHANGED
|
@@ -313,32 +313,40 @@ const DEFAULT_CLIENT_CONFIG = {
|
|
|
313
313
|
clientConfig: { region: 'eu-west-1' },
|
|
314
314
|
};
|
|
315
315
|
const sendMail = async (config, transport, options, from) => {
|
|
316
|
-
|
|
317
|
-
if (
|
|
318
|
-
config.logger
|
|
316
|
+
try {
|
|
317
|
+
if (!options.html && !options.text) {
|
|
318
|
+
if (config.logger) {
|
|
319
|
+
config.logger.error('The option text or html needs to be set.');
|
|
320
|
+
}
|
|
321
|
+
return false;
|
|
319
322
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
if (!options.to || !options.subject) {
|
|
324
|
+
if (config.logger) {
|
|
325
|
+
config.logger.error('The fields to and subject have to be set.');
|
|
326
|
+
}
|
|
327
|
+
return false;
|
|
325
328
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
329
|
+
const transportResponse = await transport.sendMail({
|
|
330
|
+
from,
|
|
331
|
+
...options,
|
|
332
|
+
});
|
|
333
|
+
if (config.responseCallback) {
|
|
334
|
+
await config.responseCallback(transportResponse);
|
|
335
|
+
}
|
|
336
|
+
if (!transportResponse) {
|
|
337
|
+
if (config.logger) {
|
|
338
|
+
config.logger.error('Sending email failed!');
|
|
339
|
+
}
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
return true;
|
|
334
343
|
}
|
|
335
|
-
|
|
344
|
+
catch (error) {
|
|
336
345
|
if (config.logger) {
|
|
337
|
-
config.logger.error(
|
|
346
|
+
config.logger.error(error);
|
|
338
347
|
}
|
|
339
348
|
return false;
|
|
340
349
|
}
|
|
341
|
-
return true;
|
|
342
350
|
};
|
|
343
351
|
const ses = (fromEmailAddress, userConfig) => {
|
|
344
352
|
const { clientConfig, ...config } = {
|
package/dist/lib.esm.js
CHANGED
|
@@ -293,32 +293,40 @@ const DEFAULT_CLIENT_CONFIG = {
|
|
|
293
293
|
clientConfig: { region: 'eu-west-1' },
|
|
294
294
|
};
|
|
295
295
|
const sendMail = async (config, transport, options, from) => {
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
config.logger
|
|
296
|
+
try {
|
|
297
|
+
if (!options.html && !options.text) {
|
|
298
|
+
if (config.logger) {
|
|
299
|
+
config.logger.error('The option text or html needs to be set.');
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
299
302
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
if (!options.to || !options.subject) {
|
|
304
|
+
if (config.logger) {
|
|
305
|
+
config.logger.error('The fields to and subject have to be set.');
|
|
306
|
+
}
|
|
307
|
+
return false;
|
|
305
308
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
const transportResponse = await transport.sendMail({
|
|
310
|
+
from,
|
|
311
|
+
...options,
|
|
312
|
+
});
|
|
313
|
+
if (config.responseCallback) {
|
|
314
|
+
await config.responseCallback(transportResponse);
|
|
315
|
+
}
|
|
316
|
+
if (!transportResponse) {
|
|
317
|
+
if (config.logger) {
|
|
318
|
+
config.logger.error('Sending email failed!');
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
return true;
|
|
314
323
|
}
|
|
315
|
-
|
|
324
|
+
catch (error) {
|
|
316
325
|
if (config.logger) {
|
|
317
|
-
config.logger.error(
|
|
326
|
+
config.logger.error(error);
|
|
318
327
|
}
|
|
319
328
|
return false;
|
|
320
329
|
}
|
|
321
|
-
return true;
|
|
322
330
|
};
|
|
323
331
|
const ses = (fromEmailAddress, userConfig) => {
|
|
324
332
|
const { clientConfig, ...config } = {
|