@punks/backend-entity-manager 0.0.505 → 0.0.508

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
@@ -23813,7 +23813,7 @@ let UserCreationHandler = class UserCreationHandler {
23813
23813
  error: exports.UserCreationError.UserAlreadyExists,
23814
23814
  };
23815
23815
  }
23816
- if (user && !user.verified) {
23816
+ if (user && !user.verified && input.password) {
23817
23817
  const passwordHash = await this.createPasswordHash(input.password, user.id);
23818
23818
  await this.services.getUsersService().update(user.id, {
23819
23819
  passwordHash,
@@ -23827,10 +23827,11 @@ let UserCreationHandler = class UserCreationHandler {
23827
23827
  };
23828
23828
  }
23829
23829
  const newUser = await this.createUser(input.email, input.userName, input.registrationInfo, input.context);
23830
- const passwordHash = await this.createPasswordHash(input.password, newUser.id);
23831
23830
  await this.services.getUsersService().update(newUser.id, {
23832
- passwordHash,
23833
- passwordUpdateTimestamp: new Date(),
23831
+ ...(input.password && {
23832
+ passwordHash: await this.createPasswordHash(input.password, newUser.id),
23833
+ passwordUpdateTimestamp: new Date(),
23834
+ }),
23834
23835
  verified: input.verified ?? true,
23835
23836
  });
23836
23837
  this.logger.debug(`New user created: ${input.email} - ${input.userName}`, {
@@ -41315,28 +41316,55 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
41315
41316
  cc: input.cc ?? templateData.cc,
41316
41317
  from: input.from ?? templateData.from,
41317
41318
  attachments: input.attachments,
41318
- });
41319
+ }, options);
41319
41320
  }
41320
41321
  async sendHtmlEmail(input, options) {
41322
+ const from = input.from || awsSesSettings.value.defaultSender;
41323
+ if (!from) {
41324
+ throw new Error("No sender address provided");
41325
+ }
41326
+ if (awsSesSettings.value.sandboxMode || options?.sandboxMode) {
41327
+ if (awsSesSettings.value.sandboxAddresses?.length) {
41328
+ await this.invokeEmailSend({
41329
+ from,
41330
+ to: awsSesSettings.value.sandboxAddresses,
41331
+ subjectTemplate: input.subjectTemplate,
41332
+ bodyTemplate: input.bodyTemplate,
41333
+ payload: input.payload,
41334
+ });
41335
+ }
41336
+ return;
41337
+ }
41338
+ await this.invokeEmailSend({
41339
+ from,
41340
+ to: input.to ?? [],
41341
+ cc: input.cc ?? awsSesSettings.value.defaultCc ?? [],
41342
+ bcc: input.bcc ?? awsSesSettings.value.defaultBcc ?? [],
41343
+ subjectTemplate: input.subjectTemplate,
41344
+ bodyTemplate: input.bodyTemplate,
41345
+ payload: input.payload,
41346
+ });
41347
+ }
41348
+ async invokeEmailSend({ from, to, cc, bcc, subjectTemplate, bodyTemplate, payload, }) {
41321
41349
  await this.client.send(new clientSes.SendEmailCommand({
41322
- Source: input.from ?? input.from ?? awsSesSettings.value.defaultSender,
41350
+ Source: from,
41323
41351
  Destination: {
41324
- ToAddresses: input.to ?? input.to ?? [],
41325
- CcAddresses: input.cc ?? awsSesSettings.value.defaultCc ?? [],
41326
- BccAddresses: input.bcc ?? awsSesSettings.value.defaultBcc ?? [],
41352
+ ToAddresses: to ?? [],
41353
+ CcAddresses: cc ?? [],
41354
+ BccAddresses: bcc ?? [],
41327
41355
  },
41328
41356
  Message: {
41329
41357
  Subject: {
41330
41358
  Data: renderHandlebarsTemplate({
41331
- template: input.subjectTemplate,
41332
- context: input.payload,
41359
+ template: subjectTemplate,
41360
+ context: payload,
41333
41361
  }),
41334
41362
  },
41335
41363
  Body: {
41336
41364
  Html: {
41337
41365
  Data: renderHandlebarsTemplate({
41338
- template: input.bodyTemplate,
41339
- context: input.payload,
41366
+ template: bodyTemplate,
41367
+ context: payload,
41340
41368
  }),
41341
41369
  },
41342
41370
  },