@punks/backend-entity-manager 0.0.464 → 0.0.465

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
@@ -22793,7 +22793,7 @@ exports.EmailService = class EmailService {
22793
22793
  constructor(registry) {
22794
22794
  this.registry = registry;
22795
22795
  }
22796
- async sendTemplatedEmail(input) {
22796
+ async sendTemplatedEmail(input, options) {
22797
22797
  const template = this.getTemplate(input.templateId);
22798
22798
  const transformedPayload = (await this.templateMiddleware?.processPayload(input.payload)) ??
22799
22799
  input.payload;
@@ -22806,11 +22806,11 @@ exports.EmailService = class EmailService {
22806
22806
  ...transformedInput,
22807
22807
  ...normalizeAddresses(transformedInput),
22808
22808
  };
22809
- await this.provider.sendTemplatedEmail(normalizedInput, template);
22809
+ await this.provider.sendTemplatedEmail(normalizedInput, template, options);
22810
22810
  await this.logger.logTemplatedEmail(normalizedInput);
22811
22811
  }
22812
- async sendHtmlEmail(input) {
22813
- await this.provider.sendHtmlEmail(input);
22812
+ async sendHtmlEmail(input, options) {
22813
+ await this.provider.sendHtmlEmail(input, options);
22814
22814
  await this.logger.logHtmlEmail(input);
22815
22815
  }
22816
22816
  getTemplate(templateId) {
@@ -41154,7 +41154,7 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
41154
41154
  constructor() {
41155
41155
  this.client = createClient$2(awsSesSettings.value);
41156
41156
  }
41157
- async sendTemplatedEmail(input, template) {
41157
+ async sendTemplatedEmail(input, template, options) {
41158
41158
  const processedPayload = await template.processPayload(input.payload);
41159
41159
  const templateData = await template.getTemplateData(processedPayload);
41160
41160
  await this.sendHtmlEmail({
@@ -41168,7 +41168,7 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
41168
41168
  attachments: input.attachments,
41169
41169
  });
41170
41170
  }
41171
- async sendHtmlEmail(input) {
41171
+ async sendHtmlEmail(input, options) {
41172
41172
  await this.client.send(new clientSes.SendEmailCommand({
41173
41173
  Source: input.from ?? input.from ?? awsSesSettings.value.defaultSender,
41174
41174
  Destination: {
@@ -41253,7 +41253,7 @@ let SendgridEmailProvider = class SendgridEmailProvider {
41253
41253
  this.client = new mail.MailService();
41254
41254
  this.client.setApiKey(sendgridSettings.value.apiKey);
41255
41255
  }
41256
- async sendTemplatedEmail(input, template) {
41256
+ async sendTemplatedEmail(input, template, options) {
41257
41257
  if (!input.to?.length && !input.cc?.length && !input.bcc?.length) {
41258
41258
  throw new Error(`No recipient specified for email ${input.templateId}`);
41259
41259
  }
@@ -41308,6 +41308,31 @@ let SendgridEmailProvider = class SendgridEmailProvider {
41308
41308
  ? attachment.content.toString("base64")
41309
41309
  : attachment.content,
41310
41310
  })),
41311
+ mailSettings: {
41312
+ ...(options?.sandboxMode
41313
+ ? {
41314
+ sandboxMode: {
41315
+ enable: options.sandboxMode,
41316
+ },
41317
+ }
41318
+ : {}),
41319
+ ...(options?.forceDelivery
41320
+ ? {
41321
+ bypassListManagement: {
41322
+ enable: options.forceDelivery,
41323
+ },
41324
+ bypassBounceManagement: {
41325
+ enable: options.forceDelivery,
41326
+ },
41327
+ bypassUnsubscribeManagement: {
41328
+ enable: options.forceDelivery,
41329
+ },
41330
+ bypassSpamManagement: {
41331
+ enable: options.forceDelivery,
41332
+ },
41333
+ }
41334
+ : {}),
41335
+ },
41311
41336
  });
41312
41337
  if (sendgridSettings.value.loggingEnabled) {
41313
41338
  this.logger.info("Sending templated email", {
@@ -41419,7 +41444,7 @@ exports.InMemoryEmailProvider = class InMemoryEmailProvider {
41419
41444
  constructor() {
41420
41445
  this.sentEmails = [];
41421
41446
  }
41422
- async sendTemplatedEmail(input, template) {
41447
+ async sendTemplatedEmail(input, template, options) {
41423
41448
  this.sentEmails.push({
41424
41449
  input,
41425
41450
  template,