@punks/backend-entity-manager 0.0.343 → 0.0.345

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
@@ -413,7 +413,7 @@ class EntityCreateAction {
413
413
  if (!entity) {
414
414
  throw new Error(`Newly created entity not found with id ${ref.id}`);
415
415
  }
416
- const result = converter?.toEntityDto(entity) ?? entity;
416
+ const result = (await converter?.toEntityDto(entity)) ?? entity;
417
417
  this.logger.debug("Create action completed", { input, result });
418
418
  return result;
419
419
  }
@@ -481,7 +481,7 @@ class EntityGetAction {
481
481
  const entity = await this.services.resolveGetQuery().execute(id);
482
482
  const converter = this.services.resolveConverter();
483
483
  return entity
484
- ? converter?.toEntityDto(entity) ?? entity
484
+ ? (await converter?.toEntityDto(entity)) ?? entity
485
485
  : undefined;
486
486
  }
487
487
  }
@@ -523,7 +523,7 @@ class EntitiesSearchAction {
523
523
  const results = await searchQuery.execute(request);
524
524
  const converter = this.services.resolveConverter();
525
525
  return {
526
- items: results.items.map((x) => (converter?.toListItemDto(x) ?? x)),
526
+ items: await backendCore.mapAsync(results.items, async (x) => ((await converter?.toListItemDto(x)) ?? x)),
527
527
  paging: results.paging,
528
528
  childrenMap: results.childrenMap,
529
529
  facets: results.facets,
@@ -550,7 +550,7 @@ class EntityUpdateAction {
550
550
  if (!entity) {
551
551
  throw new Error(`Newly created entity not found with id ${id}`);
552
552
  }
553
- const result = converter?.toEntityDto(entity) ?? entity;
553
+ const result = (await converter?.toEntityDto(entity)) ?? entity;
554
554
  this.logger.debug("Update action started", { id, input, result });
555
555
  return result;
556
556
  }
@@ -582,7 +582,7 @@ class EntityUpsertAction {
582
582
  if (!entity) {
583
583
  throw new Error(`Newly created entity not found with id ${id}`);
584
584
  }
585
- const result = converter?.toEntityDto(entity) ?? entity;
585
+ const result = (await converter?.toEntityDto(entity)) ?? entity;
586
586
  this.logger.debug("Upsert action started", { id, input, result });
587
587
  return result;
588
588
  }