@punks/backend-entity-manager 0.0.508 → 0.0.510
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/cjs/index.js +85 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +67 -22
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -2
package/dist/cjs/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var swagger = require('@nestjs/swagger');
|
|
|
23
23
|
var clientS3 = require('@aws-sdk/client-s3');
|
|
24
24
|
var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
25
25
|
var clientSes = require('@aws-sdk/client-ses');
|
|
26
|
+
var nodemailer = require('nodemailer');
|
|
26
27
|
var mail = require('@sendgrid/mail');
|
|
27
28
|
var clientBatch = require('@aws-sdk/client-batch');
|
|
28
29
|
var clientCloudwatchLogs = require('@aws-sdk/client-cloudwatch-logs');
|
|
@@ -37,8 +38,27 @@ var clientSecretsManager = require('@aws-sdk/client-secrets-manager');
|
|
|
37
38
|
|
|
38
39
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
40
|
|
|
41
|
+
function _interopNamespace(e) {
|
|
42
|
+
if (e && e.__esModule) return e;
|
|
43
|
+
var n = Object.create(null);
|
|
44
|
+
if (e) {
|
|
45
|
+
Object.keys(e).forEach(function (k) {
|
|
46
|
+
if (k !== 'default') {
|
|
47
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
48
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return e[k]; }
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
n["default"] = e;
|
|
56
|
+
return Object.freeze(n);
|
|
57
|
+
}
|
|
58
|
+
|
|
40
59
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
41
60
|
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
61
|
+
var nodemailer__namespace = /*#__PURE__*/_interopNamespace(nodemailer);
|
|
42
62
|
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
43
63
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
44
64
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
@@ -41331,6 +41351,7 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
|
|
|
41331
41351
|
subjectTemplate: input.subjectTemplate,
|
|
41332
41352
|
bodyTemplate: input.bodyTemplate,
|
|
41333
41353
|
payload: input.payload,
|
|
41354
|
+
attachments: input.attachments,
|
|
41334
41355
|
});
|
|
41335
41356
|
}
|
|
41336
41357
|
return;
|
|
@@ -41343,31 +41364,72 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
|
|
|
41343
41364
|
subjectTemplate: input.subjectTemplate,
|
|
41344
41365
|
bodyTemplate: input.bodyTemplate,
|
|
41345
41366
|
payload: input.payload,
|
|
41367
|
+
attachments: input.attachments,
|
|
41346
41368
|
});
|
|
41347
41369
|
}
|
|
41348
|
-
async invokeEmailSend({ from, to, cc, bcc, subjectTemplate, bodyTemplate, payload, }) {
|
|
41349
|
-
|
|
41350
|
-
|
|
41351
|
-
|
|
41352
|
-
|
|
41353
|
-
|
|
41354
|
-
|
|
41355
|
-
|
|
41356
|
-
|
|
41357
|
-
|
|
41358
|
-
|
|
41359
|
-
|
|
41360
|
-
|
|
41361
|
-
|
|
41370
|
+
async invokeEmailSend({ from, to, cc, bcc, subjectTemplate, bodyTemplate, payload, attachments, }) {
|
|
41371
|
+
const subject = renderHandlebarsTemplate({
|
|
41372
|
+
template: subjectTemplate,
|
|
41373
|
+
context: payload,
|
|
41374
|
+
});
|
|
41375
|
+
const htmlBody = renderHandlebarsTemplate({
|
|
41376
|
+
template: bodyTemplate,
|
|
41377
|
+
context: payload,
|
|
41378
|
+
});
|
|
41379
|
+
// If no attachments, use the simpler SendEmailCommand
|
|
41380
|
+
if (!attachments || attachments.length === 0) {
|
|
41381
|
+
await this.client.send(new clientSes.SendEmailCommand({
|
|
41382
|
+
Source: from,
|
|
41383
|
+
Destination: {
|
|
41384
|
+
ToAddresses: to ?? [],
|
|
41385
|
+
CcAddresses: cc ?? [],
|
|
41386
|
+
BccAddresses: bcc ?? [],
|
|
41362
41387
|
},
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
Data:
|
|
41366
|
-
|
|
41367
|
-
|
|
41368
|
-
|
|
41388
|
+
Message: {
|
|
41389
|
+
Subject: {
|
|
41390
|
+
Data: subject,
|
|
41391
|
+
},
|
|
41392
|
+
Body: {
|
|
41393
|
+
Html: {
|
|
41394
|
+
Data: htmlBody,
|
|
41395
|
+
},
|
|
41369
41396
|
},
|
|
41370
41397
|
},
|
|
41398
|
+
}));
|
|
41399
|
+
return;
|
|
41400
|
+
}
|
|
41401
|
+
// // With attachments, use SendRawEmailCommand
|
|
41402
|
+
// const rawMessage = this.buildRawEmailMessage({
|
|
41403
|
+
// from,
|
|
41404
|
+
// to: to ?? [],
|
|
41405
|
+
// cc: cc ?? [],
|
|
41406
|
+
// bcc: bcc ?? [],
|
|
41407
|
+
// subject,
|
|
41408
|
+
// htmlBody,
|
|
41409
|
+
// attachments,
|
|
41410
|
+
// })
|
|
41411
|
+
const message = {
|
|
41412
|
+
from: from,
|
|
41413
|
+
to: to ?? [],
|
|
41414
|
+
cc: cc ?? [],
|
|
41415
|
+
bcc: bcc ?? [],
|
|
41416
|
+
subject: subject,
|
|
41417
|
+
html: htmlBody,
|
|
41418
|
+
attachments: attachments.map((attachment) => ({
|
|
41419
|
+
filename: attachment.filename,
|
|
41420
|
+
content: attachment.content,
|
|
41421
|
+
contentType: attachment.type,
|
|
41422
|
+
})),
|
|
41423
|
+
};
|
|
41424
|
+
const transporter = nodemailer__namespace.createTransport({
|
|
41425
|
+
streamTransport: true,
|
|
41426
|
+
newline: "unix",
|
|
41427
|
+
buffer: true,
|
|
41428
|
+
});
|
|
41429
|
+
const rawEmail = await transporter.sendMail(message);
|
|
41430
|
+
await this.client.send(new clientSes.SendRawEmailCommand({
|
|
41431
|
+
RawMessage: {
|
|
41432
|
+
Data: rawEmail.message,
|
|
41371
41433
|
},
|
|
41372
41434
|
}));
|
|
41373
41435
|
}
|
|
@@ -42019,7 +42081,9 @@ let AwsJobsProvider = class AwsJobsProvider {
|
|
|
42019
42081
|
instanceId,
|
|
42020
42082
|
jobUid: definition.uid,
|
|
42021
42083
|
overrides: {
|
|
42022
|
-
command: awsInvocationParams.startCommand
|
|
42084
|
+
command: awsInvocationParams.startCommand
|
|
42085
|
+
?.map((x) => replacePlaceholders(replacePayload(x, payload), commandPlaceholders))
|
|
42086
|
+
.filter((x) => x?.trim()),
|
|
42023
42087
|
batchComputeEnvironment: awsInfrastructureParams.batchComputeEnvironment,
|
|
42024
42088
|
},
|
|
42025
42089
|
variables: input.variables,
|