@solidstarters/solid-core 1.2.50 → 1.2.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.50",
3
+ "version": "1.2.51",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/interfaces.ts CHANGED
@@ -7,10 +7,10 @@ import { CreateMenuItemMetadataDto } from './dtos/create-menu-item-metadata.dto'
7
7
  import { DatasourceType } from './dtos/create-model-metadata.dto';
8
8
  import { CreateModuleMetadataDto } from './dtos/create-module-metadata.dto';
9
9
  import { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';
10
+ import { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';
10
11
  import { CreateViewMetadataDto } from './dtos/create-view-metadata.dto';
11
12
  import { FieldMetadata } from './entities/field-metadata.entity';
12
13
  import { Media } from './entities/media.entity';
13
- import { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';
14
14
 
15
15
  export interface FieldCrudManager {
16
16
  // fieldMetadata: FieldMetadata;
@@ -111,7 +111,10 @@ export interface IMail {
111
111
  subject: string,
112
112
  body: string,
113
113
  shouldQueueEmails: boolean,
114
- attachments?: MailAttachmentWrapper[],
114
+ wrapperAttachments?: MailAttachmentWrapper[],
115
+ attachments?: MailAttachment[],
116
+ parentEntity?: any,
117
+ parentEntityId?: any,
115
118
  ): Promise<void>;
116
119
 
117
120
  sendEmailUsingTemplate(
@@ -119,6 +122,10 @@ export interface IMail {
119
122
  templateName: string,
120
123
  templateParams: any,
121
124
  shouldQueueEmails: boolean,
125
+ wrapperAttachments?: MailAttachmentWrapper[],
126
+ attachments?: MailAttachment[],
127
+ parentEntity?: any,
128
+ parentEntityId?: any,
122
129
  ): Promise<void>;
123
130
  }
124
131
 
@@ -140,8 +147,11 @@ export interface MailAttachmentWrapper {
140
147
 
141
148
  export interface MailAttachment {
142
149
  filename: string;
143
- templatePath: string;
144
- templateParams: any;
150
+ templatePath?: string;
151
+ templateParams?: any;
152
+ content?: string | Buffer;
153
+ contentType?: string;
154
+ path?: string;
145
155
  }
146
156
 
147
157
  export enum BrokerType {
@@ -4881,7 +4881,7 @@
4881
4881
  "type": "kanban",
4882
4882
  "attrs": {
4883
4883
  "swimlanesCount": 10,
4884
- "recordsInSwimlane": 5,
4884
+ "recordsInSwimlane": 20,
4885
4885
  "enableGlobalSearch": true,
4886
4886
  "create": true,
4887
4887
  "edit": true,
@@ -4913,7 +4913,7 @@
4913
4913
  "attrs": {
4914
4914
  "name": "col-1",
4915
4915
  "label": "",
4916
- "className": "col-6"
4916
+ "className": "col-12"
4917
4917
  },
4918
4918
  "children": [
4919
4919
  {
@@ -5,11 +5,10 @@ import { EmailQueuePublisher } from 'src/jobs/email-publisher.service';
5
5
  import commonConfig from 'src/config/common.config';
6
6
  import { EmailTemplateService } from '../email-template.service';
7
7
  import Handlebars from "handlebars";
8
- import { IMail } from "../../interfaces";
8
+ import { IMail, MailAttachment } from "../../interfaces";
9
9
 
10
10
  const nodemailer = require("nodemailer");
11
11
 
12
-
13
12
  @Injectable()
14
13
  export class SMTPEMailService implements IMail {
15
14
  private readonly logger = new Logger(SMTPEMailService.name);
@@ -32,7 +31,7 @@ export class SMTPEMailService implements IMail {
32
31
  });
33
32
  }
34
33
 
35
- async sendEmailUsingTemplate(to: string, templateName: string, templateParams: any, shouldQueueEmails = false, parentEntity = null, parentEntityId = null): Promise<void> {
34
+ async sendEmailUsingTemplate(to: string, templateName: string, templateParams: any, shouldQueueEmails = false, parentEntity = null, parentEntityId = null, attachments: MailAttachment[] = [], cc: string[] = []): Promise<void> {
36
35
  // Load template and evaluate it.
37
36
  const emailTemplate = await this.emailTemplateService.findOneByName(templateName);
38
37
  if (!emailTemplate) {
@@ -48,16 +47,18 @@ export class SMTPEMailService implements IMail {
48
47
  const subject = subjectTemplate(templateParams);
49
48
 
50
49
  // Finally send the email.
51
- await this.sendEmail(to, subject, body, shouldQueueEmails, parentEntity, parentEntityId);
50
+ await this.sendEmail(to, subject, body, shouldQueueEmails, parentEntity, parentEntityId, attachments);
52
51
  }
53
52
 
54
- async sendEmail(to: string, subject: string, body: string, shouldQueueEmails = false, parentEntity = null, parentEntityId = null): Promise<void> {
53
+ async sendEmail(to: string, subject: string, body: string, shouldQueueEmails = false, parentEntity = null, parentEntityId = null, attachments: MailAttachment[] = [], cc: string[]=[]): Promise<void> {
55
54
  const message = {
56
55
  payload: {
57
56
  from: this.commonConfiguration.smtpMail.from,
58
57
  to: to,
59
58
  subject: subject,
60
- body: body
59
+ body: body,
60
+ attachments: attachments,
61
+ cc: cc,
61
62
  },
62
63
  parentEntity: parentEntity,
63
64
  parentEntityId: parentEntityId,
@@ -85,13 +86,30 @@ export class SMTPEMailService implements IMail {
85
86
  }
86
87
 
87
88
  async sendEmailSynchronously(message: QueueMessage<any>): Promise<void> {
88
- const { from, to, subject, body } = message.payload;
89
+ const { from, to, subject, body, attachments, cc } = message.payload;
90
+
91
+ const attachmentsList = attachments.map((attachment: MailAttachment) => {
92
+ const attachmentEntry = {
93
+ filename: attachment.filename,
94
+ contentType: attachment.contentType,
95
+ }
96
+ if (attachment.path) {
97
+ attachmentEntry['path'] = attachment.path;
98
+ }
99
+ if (attachment.content) {
100
+ attachmentEntry['content'] = attachment.content;
101
+ }
102
+ return attachmentEntry;
103
+ });
104
+
89
105
  // throw new Error('Random error....');
90
106
  const r = await this.transporter.sendMail({
91
107
  from: from,
92
108
  to: to,
109
+ cc: cc,
93
110
  subject: subject,
94
- html: body
111
+ html: body,
112
+ attachments: attachmentsList,
95
113
  });
96
114
  // this.logger.debug(`Sending email to ${to} with subject ${subject} and body ${body}`);
97
115
  this.logger.debug(`Sending email to ${to} with subject ${subject}`);