av6-core 1.7.2 → 1.7.3

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/index.js CHANGED
@@ -3512,7 +3512,7 @@ var NotificationService = class {
3512
3512
  return cfg;
3513
3513
  }
3514
3514
  async createDeliveryParent(cfg, evt) {
3515
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3515
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3516
3516
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3517
3517
  return this.prisma.eventDelivery.create({
3518
3518
  data: {
@@ -3582,7 +3582,7 @@ var NotificationService = class {
3582
3582
  this.logger.info("[NotificationService] Email: no recipients resolved");
3583
3583
  return;
3584
3584
  }
3585
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3585
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3586
3586
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3587
3587
  const msg = renderEmailTemplate({ body: tpl.bodyHtml ?? "", subject: tpl.subject ?? "" }, mergedData);
3588
3588
  const provider = new EmailProvider(this.prisma, this.logger, cfg.serviceEvent.serviceDomain);
@@ -3614,7 +3614,7 @@ var NotificationService = class {
3614
3614
  this.logger.info("[NotificationService] SMS: no recipients resolved");
3615
3615
  return;
3616
3616
  }
3617
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3617
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3618
3618
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3619
3619
  const body = renderTemplate(tpl.bodyText ?? "", mergedData);
3620
3620
  const provider = new SmsProvider(this.logger, {
@@ -3695,7 +3695,7 @@ var NotificationService = class {
3695
3695
  this.logger.info("[NotificationService] APP: no userIds resolved");
3696
3696
  return;
3697
3697
  }
3698
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3698
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3699
3699
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3700
3700
  const title = renderTemplate(tpl.subject ?? "", mergedData);
3701
3701
  const body = renderTemplate(tpl.bodyText ?? "", mergedData);
@@ -3791,7 +3791,7 @@ var NotificationService = class {
3791
3791
  this.logger.error("[NotificationService] WEB: no recipients resolved");
3792
3792
  return;
3793
3793
  }
3794
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3794
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3795
3795
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3796
3796
  const message = renderTemplate(webTpl.bodyText ?? "", mergedData);
3797
3797
  const link = webUrlTpl ? renderTemplate(webUrlTpl ?? "", mergedData) : null;
@@ -3851,7 +3851,7 @@ var NotificationService = class {
3851
3851
  this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
3852
3852
  return;
3853
3853
  }
3854
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3854
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3855
3855
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3856
3856
  const message = renderTemplate(tpl.bodyText ?? "", mergedData);
3857
3857
  const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(mergedData, x));
@@ -3907,7 +3907,7 @@ var NotificationService = class {
3907
3907
  // Recipient resolution
3908
3908
  // --------------------------------------------------------------------------------------
3909
3909
  async getRecipients(eventConfig, evt) {
3910
- const defaultValues = eventConfig.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3910
+ const defaultValues = eventConfig.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3911
3911
  const mergedData = (0, import_lodash.default)({}, defaultValues, evt.data ?? {});
3912
3912
  const recipients = await resolveAllRecipients({
3913
3913
  prisma: this.prisma,
package/dist/index.mjs CHANGED
@@ -3461,7 +3461,7 @@ var NotificationService = class {
3461
3461
  return cfg;
3462
3462
  }
3463
3463
  async createDeliveryParent(cfg, evt) {
3464
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3464
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3465
3465
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3466
3466
  return this.prisma.eventDelivery.create({
3467
3467
  data: {
@@ -3531,7 +3531,7 @@ var NotificationService = class {
3531
3531
  this.logger.info("[NotificationService] Email: no recipients resolved");
3532
3532
  return;
3533
3533
  }
3534
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3534
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3535
3535
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3536
3536
  const msg = renderEmailTemplate({ body: tpl.bodyHtml ?? "", subject: tpl.subject ?? "" }, mergedData);
3537
3537
  const provider = new EmailProvider(this.prisma, this.logger, cfg.serviceEvent.serviceDomain);
@@ -3563,7 +3563,7 @@ var NotificationService = class {
3563
3563
  this.logger.info("[NotificationService] SMS: no recipients resolved");
3564
3564
  return;
3565
3565
  }
3566
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3566
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3567
3567
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3568
3568
  const body = renderTemplate(tpl.bodyText ?? "", mergedData);
3569
3569
  const provider = new SmsProvider(this.logger, {
@@ -3644,7 +3644,7 @@ var NotificationService = class {
3644
3644
  this.logger.info("[NotificationService] APP: no userIds resolved");
3645
3645
  return;
3646
3646
  }
3647
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3647
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3648
3648
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3649
3649
  const title = renderTemplate(tpl.subject ?? "", mergedData);
3650
3650
  const body = renderTemplate(tpl.bodyText ?? "", mergedData);
@@ -3740,7 +3740,7 @@ var NotificationService = class {
3740
3740
  this.logger.error("[NotificationService] WEB: no recipients resolved");
3741
3741
  return;
3742
3742
  }
3743
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3743
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3744
3744
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3745
3745
  const message = renderTemplate(webTpl.bodyText ?? "", mergedData);
3746
3746
  const link = webUrlTpl ? renderTemplate(webUrlTpl ?? "", mergedData) : null;
@@ -3800,7 +3800,7 @@ var NotificationService = class {
3800
3800
  this.logger.info("[NotificationService] WhatsApp: no recipients resolved");
3801
3801
  return;
3802
3802
  }
3803
- const defaultValues = cfg.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3803
+ const defaultValues = cfg.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3804
3804
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3805
3805
  const message = renderTemplate(tpl.bodyText ?? "", mergedData);
3806
3806
  const dataWp = tpl.extra?.bodyValues?.map((x) => getNestedValue(mergedData, x));
@@ -3856,7 +3856,7 @@ var NotificationService = class {
3856
3856
  // Recipient resolution
3857
3857
  // --------------------------------------------------------------------------------------
3858
3858
  async getRecipients(eventConfig, evt) {
3859
- const defaultValues = eventConfig.eventConfigKeys?.map((x) => ({ [x.key]: x.defaultValue })) ?? {};
3859
+ const defaultValues = eventConfig.eventConfigKeys?.reduce((acc, x) => ({ ...acc, [x.key]: x.defaultValue }), {}) ?? {};
3860
3860
  const mergedData = merge({}, defaultValues, evt.data ?? {});
3861
3861
  const recipients = await resolveAllRecipients({
3862
3862
  prisma: this.prisma,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",