@punks/backend-entity-manager 0.0.478 → 0.0.480

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.
@@ -35,7 +35,7 @@ export interface IEntityUpsertAction<TEntity, TEntityId, TEntityUpdateDto, TEnti
35
35
  execute(id: TEntityId, input: TEntityUpdateDto): Promise<TEntityDto>;
36
36
  }
37
37
  export interface IEntitiesSearchActionOptions<TEntity, TEntitySearchParameters extends IEntitySearchParameters<TEntity, unknown, unknown>, TListItemDto> extends IEntitiesSearchQueryOptions<TEntity, TEntitySearchParameters> {
38
- converter?: (item: TEntity) => TListItemDto[];
38
+ converter?: (item: TEntity) => TListItemDto;
39
39
  }
40
40
  export interface IEntitiesSearchAction<TEntity, TEntitySearchParameters extends IEntitySearchParameters<TEntity, TSorting, TCursor>, TEntityListItemDto, TSorting extends SortingType, TCursor, TFacets extends IEntityFacets> {
41
41
  execute(request: TEntitySearchParameters, options?: IEntitiesSearchActionOptions<TEntity, TEntitySearchParameters, TEntityListItemDto>): Promise<IEntitiesSearchResults<TEntity, TEntitySearchParameters, TEntityListItemDto, TSorting, TCursor, TFacets>>;
@@ -6,6 +6,7 @@ export declare class EmailService {
6
6
  sendTemplatedEmail<TPayload>(input: TemplatedEmailInput<TPayload>, options?: EmailSendOptions): Promise<void>;
7
7
  sendHtmlEmail<TPayload>(input: HtmlEmailInput<TPayload>, options?: EmailSendOptions): Promise<void>;
8
8
  private getTemplate;
9
+ private hasRecipients;
9
10
  private get templateMiddleware();
10
11
  private get templates();
11
12
  private get provider();
package/dist/esm/index.js CHANGED
@@ -22794,11 +22794,15 @@ let EmailService = class EmailService {
22794
22794
  ...transformedInput,
22795
22795
  ...normalizeAddresses(transformedInput),
22796
22796
  };
22797
- await this.provider.sendTemplatedEmail(normalizedInput, template, options);
22797
+ if (this.hasRecipients(normalizedInput)) {
22798
+ await this.provider.sendTemplatedEmail(normalizedInput, template, options);
22799
+ }
22798
22800
  await this.logger.logTemplatedEmail(normalizedInput);
22799
22801
  }
22800
22802
  async sendHtmlEmail(input, options) {
22801
- await this.provider.sendHtmlEmail(input, options);
22803
+ if (this.hasRecipients(input)) {
22804
+ await this.provider.sendHtmlEmail(input, options);
22805
+ }
22802
22806
  await this.logger.logHtmlEmail(input);
22803
22807
  }
22804
22808
  getTemplate(templateId) {
@@ -22808,6 +22812,9 @@ let EmailService = class EmailService {
22808
22812
  }
22809
22813
  return template;
22810
22814
  }
22815
+ hasRecipients(input) {
22816
+ return input.to?.length || input.cc?.length || input.bcc?.length;
22817
+ }
22811
22818
  get templateMiddleware() {
22812
22819
  return this.registry
22813
22820
  .getContainer()