@flusys/nestjs-email 1.1.0-beta

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.
Files changed (124) hide show
  1. package/cjs/config/email-config.service.js +94 -0
  2. package/cjs/config/email.constants.js +40 -0
  3. package/cjs/config/index.js +19 -0
  4. package/cjs/controllers/email-config.controller.js +59 -0
  5. package/cjs/controllers/email-send.controller.js +142 -0
  6. package/cjs/controllers/email-template.controller.js +84 -0
  7. package/cjs/controllers/index.js +20 -0
  8. package/cjs/docs/email-swagger.config.js +176 -0
  9. package/cjs/docs/index.js +11 -0
  10. package/cjs/dtos/email-config.dto.js +238 -0
  11. package/cjs/dtos/email-send.dto.js +376 -0
  12. package/cjs/dtos/email-template.dto.js +283 -0
  13. package/cjs/dtos/index.js +20 -0
  14. package/cjs/entities/email-config-base.entity.js +111 -0
  15. package/cjs/entities/email-config-with-company.entity.js +63 -0
  16. package/cjs/entities/email-config.entity.js +25 -0
  17. package/cjs/entities/email-template-base.entity.js +134 -0
  18. package/cjs/entities/email-template-with-company.entity.js +63 -0
  19. package/cjs/entities/email-template.entity.js +25 -0
  20. package/cjs/entities/index.js +41 -0
  21. package/cjs/enums/email-provider-type.enum.js +18 -0
  22. package/cjs/enums/index.js +18 -0
  23. package/cjs/index.js +27 -0
  24. package/cjs/interfaces/email-config.interface.js +4 -0
  25. package/cjs/interfaces/email-module-options.interface.js +4 -0
  26. package/cjs/interfaces/email-provider.interface.js +6 -0
  27. package/cjs/interfaces/email-template.interface.js +4 -0
  28. package/cjs/interfaces/index.js +21 -0
  29. package/cjs/modules/email.module.js +177 -0
  30. package/cjs/modules/index.js +18 -0
  31. package/cjs/providers/email-factory.service.js +160 -0
  32. package/cjs/providers/email-provider.registry.js +51 -0
  33. package/cjs/providers/index.js +22 -0
  34. package/cjs/providers/mailgun-provider.js +125 -0
  35. package/cjs/providers/sendgrid-provider.js +156 -0
  36. package/cjs/providers/smtp-provider.js +185 -0
  37. package/cjs/services/email-datasource.provider.js +215 -0
  38. package/cjs/services/email-provider-config.service.js +180 -0
  39. package/cjs/services/email-send.service.js +228 -0
  40. package/cjs/services/email-template.service.js +186 -0
  41. package/cjs/services/index.js +21 -0
  42. package/config/email-config.service.d.ts +13 -0
  43. package/config/email.constants.d.ts +11 -0
  44. package/config/index.d.ts +2 -0
  45. package/controllers/email-config.controller.d.ts +17 -0
  46. package/controllers/email-send.controller.d.ts +19 -0
  47. package/controllers/email-template.controller.d.ts +25 -0
  48. package/controllers/index.d.ts +3 -0
  49. package/docs/email-swagger.config.d.ts +3 -0
  50. package/docs/index.d.ts +1 -0
  51. package/dtos/email-config.dto.d.ts +33 -0
  52. package/dtos/email-send.dto.d.ts +45 -0
  53. package/dtos/email-template.dto.d.ts +42 -0
  54. package/dtos/index.d.ts +3 -0
  55. package/entities/email-config-base.entity.d.ts +11 -0
  56. package/entities/email-config-with-company.entity.d.ts +4 -0
  57. package/entities/email-config.entity.d.ts +3 -0
  58. package/entities/email-template-base.entity.d.ts +14 -0
  59. package/entities/email-template-with-company.entity.d.ts +4 -0
  60. package/entities/email-template.entity.d.ts +3 -0
  61. package/entities/index.d.ts +7 -0
  62. package/enums/email-provider-type.enum.d.ts +5 -0
  63. package/enums/index.d.ts +1 -0
  64. package/fesm/config/email-config.service.js +84 -0
  65. package/fesm/config/email.constants.js +13 -0
  66. package/fesm/config/index.js +2 -0
  67. package/fesm/controllers/email-config.controller.js +49 -0
  68. package/fesm/controllers/email-send.controller.js +132 -0
  69. package/fesm/controllers/email-template.controller.js +74 -0
  70. package/fesm/controllers/index.js +3 -0
  71. package/fesm/docs/email-swagger.config.js +172 -0
  72. package/fesm/docs/index.js +1 -0
  73. package/fesm/dtos/email-config.dto.js +223 -0
  74. package/fesm/dtos/email-send.dto.js +360 -0
  75. package/fesm/dtos/email-template.dto.js +268 -0
  76. package/fesm/dtos/index.js +3 -0
  77. package/fesm/entities/email-config-base.entity.js +101 -0
  78. package/fesm/entities/email-config-with-company.entity.js +53 -0
  79. package/fesm/entities/email-config.entity.js +15 -0
  80. package/fesm/entities/email-template-base.entity.js +124 -0
  81. package/fesm/entities/email-template-with-company.entity.js +53 -0
  82. package/fesm/entities/email-template.entity.js +15 -0
  83. package/fesm/entities/index.js +20 -0
  84. package/fesm/enums/email-provider-type.enum.js +8 -0
  85. package/fesm/enums/index.js +1 -0
  86. package/fesm/index.js +10 -0
  87. package/fesm/interfaces/email-config.interface.js +3 -0
  88. package/fesm/interfaces/email-module-options.interface.js +3 -0
  89. package/fesm/interfaces/email-provider.interface.js +5 -0
  90. package/fesm/interfaces/email-template.interface.js +3 -0
  91. package/fesm/interfaces/index.js +4 -0
  92. package/fesm/modules/email.module.js +167 -0
  93. package/fesm/modules/index.js +1 -0
  94. package/fesm/providers/email-factory.service.js +109 -0
  95. package/fesm/providers/email-provider.registry.js +44 -0
  96. package/fesm/providers/index.js +5 -0
  97. package/fesm/providers/mailgun-provider.js +119 -0
  98. package/fesm/providers/sendgrid-provider.js +150 -0
  99. package/fesm/providers/smtp-provider.js +137 -0
  100. package/fesm/services/email-datasource.provider.js +164 -0
  101. package/fesm/services/email-provider-config.service.js +170 -0
  102. package/fesm/services/email-send.service.js +218 -0
  103. package/fesm/services/email-template.service.js +176 -0
  104. package/fesm/services/index.js +4 -0
  105. package/index.d.ts +9 -0
  106. package/interfaces/email-config.interface.d.ts +28 -0
  107. package/interfaces/email-module-options.interface.d.ts +26 -0
  108. package/interfaces/email-provider.interface.d.ts +34 -0
  109. package/interfaces/email-template.interface.d.ts +64 -0
  110. package/interfaces/index.d.ts +4 -0
  111. package/modules/email.module.d.ts +9 -0
  112. package/modules/index.d.ts +1 -0
  113. package/package.json +105 -0
  114. package/providers/email-factory.service.d.ts +14 -0
  115. package/providers/email-provider.registry.d.ts +10 -0
  116. package/providers/index.d.ts +5 -0
  117. package/providers/mailgun-provider.d.ts +11 -0
  118. package/providers/sendgrid-provider.d.ts +11 -0
  119. package/providers/smtp-provider.d.ts +11 -0
  120. package/services/email-datasource.provider.d.ts +25 -0
  121. package/services/email-provider-config.service.d.ts +32 -0
  122. package/services/email-send.service.d.ts +20 -0
  123. package/services/email-template.service.d.ts +31 -0
  124. package/services/index.d.ts +4 -0
@@ -0,0 +1,360 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _ts_decorate(decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ }
20
+ function _ts_metadata(k, v) {
21
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
+ }
23
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
24
+ import { IsArray, IsEmail, IsNotEmpty, IsObject, IsOptional, IsString, IsUUID, registerDecorator, ValidateNested } from 'class-validator';
25
+ import { Type } from 'class-transformer';
26
+ /**
27
+ * Custom validator: Requires at least one of templateId or templateSlug
28
+ */ function RequireTemplateIdOrSlug(validationOptions) {
29
+ return function(object, propertyName) {
30
+ registerDecorator({
31
+ name: 'requireTemplateIdOrSlug',
32
+ target: object.constructor,
33
+ propertyName,
34
+ options: validationOptions,
35
+ validator: {
36
+ validate (_value, args) {
37
+ const obj = args.object;
38
+ return !!(obj.templateId || obj.templateSlug);
39
+ },
40
+ defaultMessage () {
41
+ return 'Either templateId or templateSlug must be provided';
42
+ }
43
+ }
44
+ });
45
+ };
46
+ }
47
+ /**
48
+ * Email attachment DTO
49
+ */ export class EmailAttachmentDto {
50
+ constructor(){
51
+ _define_property(this, "filename", void 0);
52
+ _define_property(this, "content", void 0);
53
+ _define_property(this, "contentType", void 0);
54
+ }
55
+ }
56
+ _ts_decorate([
57
+ ApiProperty({
58
+ example: 'document.pdf'
59
+ }),
60
+ IsString(),
61
+ IsNotEmpty(),
62
+ _ts_metadata("design:type", String)
63
+ ], EmailAttachmentDto.prototype, "filename", void 0);
64
+ _ts_decorate([
65
+ ApiProperty({
66
+ description: 'Base64 encoded content'
67
+ }),
68
+ IsString(),
69
+ IsNotEmpty(),
70
+ _ts_metadata("design:type", String)
71
+ ], EmailAttachmentDto.prototype, "content", void 0);
72
+ _ts_decorate([
73
+ ApiPropertyOptional({
74
+ example: 'application/pdf'
75
+ }),
76
+ IsString(),
77
+ IsOptional(),
78
+ _ts_metadata("design:type", String)
79
+ ], EmailAttachmentDto.prototype, "contentType", void 0);
80
+ /**
81
+ * DTO for sending email directly
82
+ */ export class SendEmailDto {
83
+ constructor(){
84
+ _define_property(this, "to", void 0);
85
+ _define_property(this, "cc", void 0);
86
+ _define_property(this, "bcc", void 0);
87
+ _define_property(this, "subject", void 0);
88
+ _define_property(this, "html", void 0);
89
+ _define_property(this, "text", void 0);
90
+ _define_property(this, "from", void 0);
91
+ _define_property(this, "fromName", void 0);
92
+ _define_property(this, "replyTo", void 0);
93
+ _define_property(this, "emailConfigId", void 0);
94
+ _define_property(this, "attachments", void 0);
95
+ }
96
+ }
97
+ _ts_decorate([
98
+ ApiProperty({
99
+ example: 'user@example.com',
100
+ description: 'Recipient email(s)'
101
+ }),
102
+ IsNotEmpty(),
103
+ _ts_metadata("design:type", Object)
104
+ ], SendEmailDto.prototype, "to", void 0);
105
+ _ts_decorate([
106
+ ApiPropertyOptional({
107
+ description: 'CC recipients'
108
+ }),
109
+ IsOptional(),
110
+ _ts_metadata("design:type", Object)
111
+ ], SendEmailDto.prototype, "cc", void 0);
112
+ _ts_decorate([
113
+ ApiPropertyOptional({
114
+ description: 'BCC recipients'
115
+ }),
116
+ IsOptional(),
117
+ _ts_metadata("design:type", Object)
118
+ ], SendEmailDto.prototype, "bcc", void 0);
119
+ _ts_decorate([
120
+ ApiProperty({
121
+ example: 'Welcome to our platform!'
122
+ }),
123
+ IsString(),
124
+ IsNotEmpty(),
125
+ _ts_metadata("design:type", String)
126
+ ], SendEmailDto.prototype, "subject", void 0);
127
+ _ts_decorate([
128
+ ApiProperty({
129
+ example: '<h1>Hello!</h1><p>Welcome to our platform.</p>'
130
+ }),
131
+ IsString(),
132
+ IsNotEmpty(),
133
+ _ts_metadata("design:type", String)
134
+ ], SendEmailDto.prototype, "html", void 0);
135
+ _ts_decorate([
136
+ ApiPropertyOptional({
137
+ example: 'Hello! Welcome to our platform.'
138
+ }),
139
+ IsString(),
140
+ IsOptional(),
141
+ _ts_metadata("design:type", String)
142
+ ], SendEmailDto.prototype, "text", void 0);
143
+ _ts_decorate([
144
+ ApiPropertyOptional({
145
+ example: 'sender@example.com'
146
+ }),
147
+ IsEmail(),
148
+ IsOptional(),
149
+ _ts_metadata("design:type", String)
150
+ ], SendEmailDto.prototype, "from", void 0);
151
+ _ts_decorate([
152
+ ApiPropertyOptional({
153
+ example: 'FLUSYS'
154
+ }),
155
+ IsString(),
156
+ IsOptional(),
157
+ _ts_metadata("design:type", String)
158
+ ], SendEmailDto.prototype, "fromName", void 0);
159
+ _ts_decorate([
160
+ ApiPropertyOptional({
161
+ example: 'reply@example.com'
162
+ }),
163
+ IsEmail(),
164
+ IsOptional(),
165
+ _ts_metadata("design:type", String)
166
+ ], SendEmailDto.prototype, "replyTo", void 0);
167
+ _ts_decorate([
168
+ ApiPropertyOptional({
169
+ description: 'Email configuration ID to use'
170
+ }),
171
+ IsUUID(),
172
+ IsOptional(),
173
+ _ts_metadata("design:type", String)
174
+ ], SendEmailDto.prototype, "emailConfigId", void 0);
175
+ _ts_decorate([
176
+ ApiPropertyOptional({
177
+ type: [
178
+ EmailAttachmentDto
179
+ ]
180
+ }),
181
+ IsArray(),
182
+ ValidateNested({
183
+ each: true
184
+ }),
185
+ Type(()=>EmailAttachmentDto),
186
+ IsOptional(),
187
+ _ts_metadata("design:type", Array)
188
+ ], SendEmailDto.prototype, "attachments", void 0);
189
+ /**
190
+ * DTO for sending email using template
191
+ * Requires either templateId or templateSlug (at least one must be provided)
192
+ */ export class SendTemplateEmailDto {
193
+ constructor(){
194
+ _define_property(this, "templateId", void 0);
195
+ _define_property(this, "templateSlug", void 0);
196
+ _define_property(this, "to", void 0);
197
+ _define_property(this, "cc", void 0);
198
+ _define_property(this, "bcc", void 0);
199
+ _define_property(this, "variables", void 0);
200
+ _define_property(this, "from", void 0);
201
+ _define_property(this, "fromName", void 0);
202
+ _define_property(this, "replyTo", void 0);
203
+ _define_property(this, "emailConfigId", void 0);
204
+ _define_property(this, "attachments", void 0);
205
+ }
206
+ }
207
+ _ts_decorate([
208
+ ApiPropertyOptional({
209
+ description: 'Template ID (required if templateSlug not provided)'
210
+ }),
211
+ IsUUID(),
212
+ IsOptional(),
213
+ RequireTemplateIdOrSlug({
214
+ message: 'Either templateId or templateSlug must be provided'
215
+ }),
216
+ _ts_metadata("design:type", String)
217
+ ], SendTemplateEmailDto.prototype, "templateId", void 0);
218
+ _ts_decorate([
219
+ ApiPropertyOptional({
220
+ example: 'welcome-email',
221
+ description: 'Template slug (required if templateId not provided)'
222
+ }),
223
+ IsString(),
224
+ IsOptional(),
225
+ _ts_metadata("design:type", String)
226
+ ], SendTemplateEmailDto.prototype, "templateSlug", void 0);
227
+ _ts_decorate([
228
+ ApiProperty({
229
+ example: 'user@example.com',
230
+ description: 'Recipient email(s)'
231
+ }),
232
+ IsNotEmpty(),
233
+ _ts_metadata("design:type", Object)
234
+ ], SendTemplateEmailDto.prototype, "to", void 0);
235
+ _ts_decorate([
236
+ ApiPropertyOptional({
237
+ description: 'CC recipients'
238
+ }),
239
+ IsOptional(),
240
+ _ts_metadata("design:type", Object)
241
+ ], SendTemplateEmailDto.prototype, "cc", void 0);
242
+ _ts_decorate([
243
+ ApiPropertyOptional({
244
+ description: 'BCC recipients'
245
+ }),
246
+ IsOptional(),
247
+ _ts_metadata("design:type", Object)
248
+ ], SendTemplateEmailDto.prototype, "bcc", void 0);
249
+ _ts_decorate([
250
+ ApiPropertyOptional({
251
+ type: 'object',
252
+ additionalProperties: true,
253
+ example: {
254
+ userName: 'John',
255
+ activationLink: 'https://...'
256
+ },
257
+ description: 'Template variables to interpolate'
258
+ }),
259
+ IsObject(),
260
+ IsOptional(),
261
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
262
+ ], SendTemplateEmailDto.prototype, "variables", void 0);
263
+ _ts_decorate([
264
+ ApiPropertyOptional({
265
+ example: 'sender@example.com'
266
+ }),
267
+ IsEmail(),
268
+ IsOptional(),
269
+ _ts_metadata("design:type", String)
270
+ ], SendTemplateEmailDto.prototype, "from", void 0);
271
+ _ts_decorate([
272
+ ApiPropertyOptional({
273
+ example: 'FLUSYS'
274
+ }),
275
+ IsString(),
276
+ IsOptional(),
277
+ _ts_metadata("design:type", String)
278
+ ], SendTemplateEmailDto.prototype, "fromName", void 0);
279
+ _ts_decorate([
280
+ ApiPropertyOptional({
281
+ example: 'reply@example.com'
282
+ }),
283
+ IsEmail(),
284
+ IsOptional(),
285
+ _ts_metadata("design:type", String)
286
+ ], SendTemplateEmailDto.prototype, "replyTo", void 0);
287
+ _ts_decorate([
288
+ ApiPropertyOptional({
289
+ description: 'Email configuration ID to use'
290
+ }),
291
+ IsUUID(),
292
+ IsOptional(),
293
+ _ts_metadata("design:type", String)
294
+ ], SendTemplateEmailDto.prototype, "emailConfigId", void 0);
295
+ _ts_decorate([
296
+ ApiPropertyOptional({
297
+ type: [
298
+ EmailAttachmentDto
299
+ ]
300
+ }),
301
+ IsArray(),
302
+ ValidateNested({
303
+ each: true
304
+ }),
305
+ Type(()=>EmailAttachmentDto),
306
+ IsOptional(),
307
+ _ts_metadata("design:type", Array)
308
+ ], SendTemplateEmailDto.prototype, "attachments", void 0);
309
+ /**
310
+ * DTO for test email
311
+ */ export class TestEmailDto {
312
+ constructor(){
313
+ _define_property(this, "emailConfigId", void 0);
314
+ _define_property(this, "recipient", void 0);
315
+ }
316
+ }
317
+ _ts_decorate([
318
+ ApiProperty({
319
+ description: 'Email configuration ID'
320
+ }),
321
+ IsUUID(),
322
+ IsNotEmpty(),
323
+ _ts_metadata("design:type", String)
324
+ ], TestEmailDto.prototype, "emailConfigId", void 0);
325
+ _ts_decorate([
326
+ ApiProperty({
327
+ example: 'test@example.com',
328
+ description: 'Test recipient'
329
+ }),
330
+ IsEmail(),
331
+ IsNotEmpty(),
332
+ _ts_metadata("design:type", String)
333
+ ], TestEmailDto.prototype, "recipient", void 0);
334
+ /**
335
+ * Response DTO for email send result
336
+ */ export class EmailSendResultDto {
337
+ constructor(){
338
+ _define_property(this, "success", void 0);
339
+ _define_property(this, "messageId", void 0);
340
+ _define_property(this, "error", void 0);
341
+ }
342
+ }
343
+ _ts_decorate([
344
+ ApiProperty({
345
+ example: true
346
+ }),
347
+ _ts_metadata("design:type", Boolean)
348
+ ], EmailSendResultDto.prototype, "success", void 0);
349
+ _ts_decorate([
350
+ ApiPropertyOptional({
351
+ example: '<message-id@mail.example.com>'
352
+ }),
353
+ _ts_metadata("design:type", String)
354
+ ], EmailSendResultDto.prototype, "messageId", void 0);
355
+ _ts_decorate([
356
+ ApiPropertyOptional({
357
+ example: 'Connection refused'
358
+ }),
359
+ _ts_metadata("design:type", String)
360
+ ], EmailSendResultDto.prototype, "error", void 0);
@@ -0,0 +1,268 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _ts_decorate(decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ }
20
+ function _ts_metadata(k, v) {
21
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
+ }
23
+ import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
24
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
25
+ import { IsBoolean, IsNotEmpty, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
26
+ /**
27
+ * DTO for creating email template
28
+ */ export class CreateEmailTemplateDto {
29
+ constructor(){
30
+ _define_property(this, "name", void 0);
31
+ _define_property(this, "slug", void 0);
32
+ _define_property(this, "description", void 0);
33
+ _define_property(this, "subject", void 0);
34
+ _define_property(this, "schema", void 0);
35
+ _define_property(this, "htmlContent", void 0);
36
+ _define_property(this, "textContent", void 0);
37
+ _define_property(this, "isActive", void 0);
38
+ _define_property(this, "isHtml", void 0);
39
+ _define_property(this, "metadata", void 0);
40
+ }
41
+ }
42
+ _ts_decorate([
43
+ ApiProperty({
44
+ example: 'Welcome Email'
45
+ }),
46
+ IsString(),
47
+ IsNotEmpty(),
48
+ MaxLength(255),
49
+ _ts_metadata("design:type", String)
50
+ ], CreateEmailTemplateDto.prototype, "name", void 0);
51
+ _ts_decorate([
52
+ ApiProperty({
53
+ example: 'welcome-email'
54
+ }),
55
+ IsString(),
56
+ IsNotEmpty(),
57
+ MaxLength(255),
58
+ _ts_metadata("design:type", String)
59
+ ], CreateEmailTemplateDto.prototype, "slug", void 0);
60
+ _ts_decorate([
61
+ ApiPropertyOptional({
62
+ example: 'Email sent to new users upon registration'
63
+ }),
64
+ IsString(),
65
+ IsOptional(),
66
+ MaxLength(500),
67
+ _ts_metadata("design:type", String)
68
+ ], CreateEmailTemplateDto.prototype, "description", void 0);
69
+ _ts_decorate([
70
+ ApiProperty({
71
+ example: 'Welcome to {{appName}}!'
72
+ }),
73
+ IsString(),
74
+ IsNotEmpty(),
75
+ MaxLength(500),
76
+ _ts_metadata("design:type", String)
77
+ ], CreateEmailTemplateDto.prototype, "subject", void 0);
78
+ _ts_decorate([
79
+ ApiProperty({
80
+ type: 'object',
81
+ additionalProperties: true,
82
+ description: 'Visual builder schema (sections, blocks, settings)',
83
+ example: {
84
+ id: 'template-1',
85
+ version: '1.0.0',
86
+ sections: [],
87
+ settings: {}
88
+ }
89
+ }),
90
+ IsObject(),
91
+ IsNotEmpty(),
92
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
93
+ ], CreateEmailTemplateDto.prototype, "schema", void 0);
94
+ _ts_decorate([
95
+ ApiProperty({
96
+ example: '<h1>Welcome {{userName}}!</h1><p>Thanks for joining us.</p>',
97
+ description: 'Rendered HTML content with {{variable}} placeholders'
98
+ }),
99
+ IsString(),
100
+ IsNotEmpty(),
101
+ _ts_metadata("design:type", String)
102
+ ], CreateEmailTemplateDto.prototype, "htmlContent", void 0);
103
+ _ts_decorate([
104
+ ApiPropertyOptional({
105
+ example: 'Welcome {{userName}}!\n\nThanks for joining us.',
106
+ description: 'Plain text fallback content'
107
+ }),
108
+ IsString(),
109
+ IsOptional(),
110
+ _ts_metadata("design:type", String)
111
+ ], CreateEmailTemplateDto.prototype, "textContent", void 0);
112
+ _ts_decorate([
113
+ ApiPropertyOptional({
114
+ example: true
115
+ }),
116
+ IsBoolean(),
117
+ IsOptional(),
118
+ _ts_metadata("design:type", Boolean)
119
+ ], CreateEmailTemplateDto.prototype, "isActive", void 0);
120
+ _ts_decorate([
121
+ ApiPropertyOptional({
122
+ example: true,
123
+ description: 'Whether template uses HTML (true) or plain text (false)'
124
+ }),
125
+ IsBoolean(),
126
+ IsOptional(),
127
+ _ts_metadata("design:type", Boolean)
128
+ ], CreateEmailTemplateDto.prototype, "isHtml", void 0);
129
+ _ts_decorate([
130
+ ApiPropertyOptional({
131
+ type: 'object',
132
+ additionalProperties: true,
133
+ description: 'Additional metadata (tags, category, etc.)',
134
+ example: {
135
+ category: 'onboarding',
136
+ tags: [
137
+ 'welcome',
138
+ 'new-user'
139
+ ]
140
+ }
141
+ }),
142
+ IsObject(),
143
+ IsOptional(),
144
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
145
+ ], CreateEmailTemplateDto.prototype, "metadata", void 0);
146
+ /**
147
+ * DTO for updating email template
148
+ */ export class UpdateEmailTemplateDto {
149
+ constructor(){
150
+ _define_property(this, "id", void 0);
151
+ _define_property(this, "name", void 0);
152
+ _define_property(this, "slug", void 0);
153
+ _define_property(this, "description", void 0);
154
+ _define_property(this, "subject", void 0);
155
+ _define_property(this, "schema", void 0);
156
+ _define_property(this, "htmlContent", void 0);
157
+ _define_property(this, "textContent", void 0);
158
+ _define_property(this, "isActive", void 0);
159
+ _define_property(this, "isHtml", void 0);
160
+ _define_property(this, "metadata", void 0);
161
+ }
162
+ }
163
+ _ts_decorate([
164
+ ApiProperty({
165
+ example: '123e4567-e89b-12d3-a456-426614174000'
166
+ }),
167
+ IsString(),
168
+ IsNotEmpty(),
169
+ _ts_metadata("design:type", String)
170
+ ], UpdateEmailTemplateDto.prototype, "id", void 0);
171
+ _ts_decorate([
172
+ ApiPropertyOptional({
173
+ example: 'Welcome Email'
174
+ }),
175
+ IsString(),
176
+ IsOptional(),
177
+ MaxLength(255),
178
+ _ts_metadata("design:type", String)
179
+ ], UpdateEmailTemplateDto.prototype, "name", void 0);
180
+ _ts_decorate([
181
+ ApiPropertyOptional({
182
+ example: 'welcome-email'
183
+ }),
184
+ IsString(),
185
+ IsOptional(),
186
+ MaxLength(255),
187
+ _ts_metadata("design:type", String)
188
+ ], UpdateEmailTemplateDto.prototype, "slug", void 0);
189
+ _ts_decorate([
190
+ ApiPropertyOptional({
191
+ example: 'Email sent to new users upon registration'
192
+ }),
193
+ IsString(),
194
+ IsOptional(),
195
+ MaxLength(500),
196
+ _ts_metadata("design:type", String)
197
+ ], UpdateEmailTemplateDto.prototype, "description", void 0);
198
+ _ts_decorate([
199
+ ApiPropertyOptional({
200
+ example: 'Welcome to {{appName}}!'
201
+ }),
202
+ IsString(),
203
+ IsOptional(),
204
+ MaxLength(500),
205
+ _ts_metadata("design:type", String)
206
+ ], UpdateEmailTemplateDto.prototype, "subject", void 0);
207
+ _ts_decorate([
208
+ ApiPropertyOptional({
209
+ type: 'object',
210
+ additionalProperties: true,
211
+ description: 'Visual builder schema'
212
+ }),
213
+ IsObject(),
214
+ IsOptional(),
215
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
216
+ ], UpdateEmailTemplateDto.prototype, "schema", void 0);
217
+ _ts_decorate([
218
+ ApiPropertyOptional({
219
+ example: '<h1>Welcome {{userName}}!</h1>',
220
+ description: 'Rendered HTML content'
221
+ }),
222
+ IsString(),
223
+ IsOptional(),
224
+ _ts_metadata("design:type", String)
225
+ ], UpdateEmailTemplateDto.prototype, "htmlContent", void 0);
226
+ _ts_decorate([
227
+ ApiPropertyOptional({
228
+ example: 'Welcome {{userName}}!',
229
+ description: 'Plain text fallback'
230
+ }),
231
+ IsString(),
232
+ IsOptional(),
233
+ _ts_metadata("design:type", String)
234
+ ], UpdateEmailTemplateDto.prototype, "textContent", void 0);
235
+ _ts_decorate([
236
+ ApiPropertyOptional({
237
+ example: true
238
+ }),
239
+ IsBoolean(),
240
+ IsOptional(),
241
+ _ts_metadata("design:type", Boolean)
242
+ ], UpdateEmailTemplateDto.prototype, "isActive", void 0);
243
+ _ts_decorate([
244
+ ApiPropertyOptional({
245
+ example: true,
246
+ description: 'Whether template uses HTML (true) or plain text (false)'
247
+ }),
248
+ IsBoolean(),
249
+ IsOptional(),
250
+ _ts_metadata("design:type", Boolean)
251
+ ], UpdateEmailTemplateDto.prototype, "isHtml", void 0);
252
+ _ts_decorate([
253
+ ApiPropertyOptional({
254
+ type: 'object',
255
+ additionalProperties: true,
256
+ description: 'Additional metadata'
257
+ }),
258
+ IsObject(),
259
+ IsOptional(),
260
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
261
+ ], UpdateEmailTemplateDto.prototype, "metadata", void 0);
262
+ /**
263
+ * Response DTO for email template
264
+ */ export class EmailTemplateResponseDto extends IdentityResponseDto {
265
+ constructor(...args){
266
+ super(...args), _define_property(this, "name", void 0), _define_property(this, "slug", void 0), _define_property(this, "description", void 0), _define_property(this, "subject", void 0), _define_property(this, "schema", void 0), _define_property(this, "htmlContent", void 0), _define_property(this, "textContent", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isHtml", void 0), _define_property(this, "metadata", void 0);
267
+ }
268
+ }
@@ -0,0 +1,3 @@
1
+ export * from './email-config.dto';
2
+ export * from './email-template.dto';
3
+ export * from './email-send.dto';