@punks/backend-entity-manager 0.0.55 → 0.0.58

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
@@ -18949,8 +18949,15 @@ exports.EventsService = class EventsService {
18949
18949
  constructor(registry) {
18950
18950
  this.registry = registry;
18951
18951
  }
18952
- async emitEvent(eventName, eventPayload) {
18953
- await this.eventEmitter.emit(eventName, eventPayload);
18952
+ async emitEvent(eventName, eventData) {
18953
+ await this.eventEmitter.emit(eventName, this.buildPayload(eventName, eventData));
18954
+ }
18955
+ buildPayload(eventName, eventData) {
18956
+ return {
18957
+ ...eventData,
18958
+ type: eventName,
18959
+ timestamp: eventData.timestamp ?? new Date(),
18960
+ };
18954
18961
  }
18955
18962
  get eventEmitter() {
18956
18963
  return this.registry
@@ -19081,7 +19088,8 @@ let UserRegistrationHandler = class UserRegistrationHandler {
19081
19088
  this.jwtProvider = jwtProvider;
19082
19089
  }
19083
19090
  async execute(input) {
19084
- const user = await this.resolveUser(input.email, input.context);
19091
+ const user = (await this.resolveUser(input.email, input.context)) ??
19092
+ (await this.resolveUser(input.userName, input.context));
19085
19093
  if (user && user.verified) {
19086
19094
  return {
19087
19095
  success: false,
@@ -25163,12 +25171,14 @@ let SendgridEmailProvider = class SendgridEmailProvider {
25163
25171
  }
25164
25172
  await this.client.send(request);
25165
25173
  await this.eventsService.emitEvent(PlatformEvents.Messaging.EmailSent, {
25166
- from: request.from,
25167
- to: request.to,
25168
- cc: request.cc,
25169
- bcc: request.bcc,
25170
- payload: processedPayload,
25171
- request,
25174
+ payload: {
25175
+ from: request.from,
25176
+ to: request.to,
25177
+ cc: request.cc,
25178
+ bcc: request.bcc,
25179
+ payload: processedPayload,
25180
+ request,
25181
+ },
25172
25182
  });
25173
25183
  if (sendgridSettings.value.loggingEnabled) {
25174
25184
  this.logger.info("Templated email sent", {
@@ -25204,13 +25214,15 @@ let SendgridEmailProvider = class SendgridEmailProvider {
25204
25214
  }
25205
25215
  await this.client.send(request);
25206
25216
  await this.eventsService.emitEvent(PlatformEvents.Messaging.EmailSent, {
25207
- from: request.from,
25208
- to: request.to,
25209
- cc: request.cc,
25210
- bcc: request.bcc,
25211
- body: request.html,
25212
- subject: request.subject,
25213
- request,
25217
+ payload: {
25218
+ from: request.from,
25219
+ to: request.to,
25220
+ cc: request.cc,
25221
+ bcc: request.bcc,
25222
+ body: request.html,
25223
+ subject: request.subject,
25224
+ request,
25225
+ },
25214
25226
  });
25215
25227
  if (sendgridSettings.value.loggingEnabled) {
25216
25228
  this.logger.info("Html email sent", {