@punks/backend-entity-manager 0.0.505 → 0.0.506

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 CHANGED
@@ -41315,28 +41315,55 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
41315
41315
  cc: input.cc ?? templateData.cc,
41316
41316
  from: input.from ?? templateData.from,
41317
41317
  attachments: input.attachments,
41318
- });
41318
+ }, options);
41319
41319
  }
41320
41320
  async sendHtmlEmail(input, options) {
41321
+ const from = input.from || awsSesSettings.value.defaultSender;
41322
+ if (!from) {
41323
+ throw new Error("No sender address provided");
41324
+ }
41325
+ if (awsSesSettings.value.sandboxMode || options?.sandboxMode) {
41326
+ if (awsSesSettings.value.sandboxAddresses?.length) {
41327
+ await this.invokeEmailSend({
41328
+ from,
41329
+ to: awsSesSettings.value.sandboxAddresses,
41330
+ subjectTemplate: input.subjectTemplate,
41331
+ bodyTemplate: input.bodyTemplate,
41332
+ payload: input.payload,
41333
+ });
41334
+ }
41335
+ return;
41336
+ }
41337
+ await this.invokeEmailSend({
41338
+ from,
41339
+ to: input.to ?? [],
41340
+ cc: input.cc ?? awsSesSettings.value.defaultCc ?? [],
41341
+ bcc: input.bcc ?? awsSesSettings.value.defaultBcc ?? [],
41342
+ subjectTemplate: input.subjectTemplate,
41343
+ bodyTemplate: input.bodyTemplate,
41344
+ payload: input.payload,
41345
+ });
41346
+ }
41347
+ async invokeEmailSend({ from, to, cc, bcc, subjectTemplate, bodyTemplate, payload, }) {
41321
41348
  await this.client.send(new clientSes.SendEmailCommand({
41322
- Source: input.from ?? input.from ?? awsSesSettings.value.defaultSender,
41349
+ Source: from,
41323
41350
  Destination: {
41324
- ToAddresses: input.to ?? input.to ?? [],
41325
- CcAddresses: input.cc ?? awsSesSettings.value.defaultCc ?? [],
41326
- BccAddresses: input.bcc ?? awsSesSettings.value.defaultBcc ?? [],
41351
+ ToAddresses: to ?? [],
41352
+ CcAddresses: cc ?? [],
41353
+ BccAddresses: bcc ?? [],
41327
41354
  },
41328
41355
  Message: {
41329
41356
  Subject: {
41330
41357
  Data: renderHandlebarsTemplate({
41331
- template: input.subjectTemplate,
41332
- context: input.payload,
41358
+ template: subjectTemplate,
41359
+ context: payload,
41333
41360
  }),
41334
41361
  },
41335
41362
  Body: {
41336
41363
  Html: {
41337
41364
  Data: renderHandlebarsTemplate({
41338
- template: input.bodyTemplate,
41339
- context: input.payload,
41365
+ template: bodyTemplate,
41366
+ context: payload,
41340
41367
  }),
41341
41368
  },
41342
41369
  },