@flusys/nestjs-email 1.0.0-rc

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 (131) hide show
  1. package/README.md +552 -0
  2. package/cjs/config/email-config.service.js +81 -0
  3. package/cjs/config/email.constants.js +22 -0
  4. package/cjs/config/index.js +19 -0
  5. package/cjs/controllers/email-config.controller.js +101 -0
  6. package/cjs/controllers/email-send.controller.js +142 -0
  7. package/cjs/controllers/email-template.controller.js +128 -0
  8. package/cjs/controllers/index.js +20 -0
  9. package/cjs/docs/email-swagger.config.js +176 -0
  10. package/cjs/docs/index.js +11 -0
  11. package/cjs/dtos/email-config.dto.js +238 -0
  12. package/cjs/dtos/email-send.dto.js +444 -0
  13. package/cjs/dtos/email-template.dto.js +283 -0
  14. package/cjs/dtos/index.js +20 -0
  15. package/cjs/entities/email-config-base.entity.js +111 -0
  16. package/cjs/entities/email-config-with-company.entity.js +63 -0
  17. package/cjs/entities/email-config.entity.js +25 -0
  18. package/cjs/entities/email-template-base.entity.js +133 -0
  19. package/cjs/entities/email-template-with-company.entity.js +65 -0
  20. package/cjs/entities/email-template.entity.js +30 -0
  21. package/cjs/entities/index.js +41 -0
  22. package/cjs/enums/email-provider-type.enum.js +18 -0
  23. package/cjs/enums/index.js +18 -0
  24. package/cjs/index.js +28 -0
  25. package/cjs/interfaces/email-config.interface.js +4 -0
  26. package/cjs/interfaces/email-module-options.interface.js +4 -0
  27. package/cjs/interfaces/email-provider.interface.js +4 -0
  28. package/cjs/interfaces/email-template.interface.js +4 -0
  29. package/cjs/interfaces/index.js +21 -0
  30. package/cjs/modules/email.module.js +161 -0
  31. package/cjs/modules/index.js +18 -0
  32. package/cjs/providers/email-factory.service.js +144 -0
  33. package/cjs/providers/email-provider.registry.js +41 -0
  34. package/cjs/providers/index.js +22 -0
  35. package/cjs/providers/mailgun-provider.js +107 -0
  36. package/cjs/providers/sendgrid-provider.js +135 -0
  37. package/cjs/providers/smtp-provider.js +166 -0
  38. package/cjs/services/email-datasource.provider.js +187 -0
  39. package/cjs/services/email-provider-config.service.js +150 -0
  40. package/cjs/services/email-send.service.js +211 -0
  41. package/cjs/services/email-template.service.js +158 -0
  42. package/cjs/services/index.js +21 -0
  43. package/cjs/utils/email-templates.util.js +129 -0
  44. package/cjs/utils/index.js +18 -0
  45. package/config/email-config.service.d.ts +16 -0
  46. package/config/email.constants.d.ts +2 -0
  47. package/config/index.d.ts +2 -0
  48. package/controllers/email-config.controller.d.ts +17 -0
  49. package/controllers/email-send.controller.d.ts +11 -0
  50. package/controllers/email-template.controller.d.ts +25 -0
  51. package/controllers/index.d.ts +3 -0
  52. package/docs/email-swagger.config.d.ts +3 -0
  53. package/docs/index.d.ts +1 -0
  54. package/dtos/email-config.dto.d.ts +30 -0
  55. package/dtos/email-send.dto.d.ts +46 -0
  56. package/dtos/email-template.dto.d.ts +39 -0
  57. package/dtos/index.d.ts +3 -0
  58. package/entities/email-config-base.entity.d.ts +11 -0
  59. package/entities/email-config-with-company.entity.d.ts +4 -0
  60. package/entities/email-config.entity.d.ts +3 -0
  61. package/entities/email-template-base.entity.d.ts +14 -0
  62. package/entities/email-template-with-company.entity.d.ts +4 -0
  63. package/entities/email-template.entity.d.ts +3 -0
  64. package/entities/index.d.ts +7 -0
  65. package/enums/email-provider-type.enum.d.ts +5 -0
  66. package/enums/index.d.ts +1 -0
  67. package/fesm/config/email-config.service.js +71 -0
  68. package/fesm/config/email.constants.js +4 -0
  69. package/fesm/config/index.js +2 -0
  70. package/fesm/controllers/email-config.controller.js +91 -0
  71. package/fesm/controllers/email-send.controller.js +132 -0
  72. package/fesm/controllers/email-template.controller.js +118 -0
  73. package/fesm/controllers/index.js +3 -0
  74. package/fesm/docs/email-swagger.config.js +172 -0
  75. package/fesm/docs/index.js +1 -0
  76. package/fesm/dtos/email-config.dto.js +217 -0
  77. package/fesm/dtos/email-send.dto.js +414 -0
  78. package/fesm/dtos/email-template.dto.js +262 -0
  79. package/fesm/dtos/index.js +3 -0
  80. package/fesm/entities/email-config-base.entity.js +101 -0
  81. package/fesm/entities/email-config-with-company.entity.js +53 -0
  82. package/fesm/entities/email-config.entity.js +15 -0
  83. package/fesm/entities/email-template-base.entity.js +123 -0
  84. package/fesm/entities/email-template-with-company.entity.js +55 -0
  85. package/fesm/entities/email-template.entity.js +20 -0
  86. package/fesm/entities/index.js +20 -0
  87. package/fesm/enums/email-provider-type.enum.js +8 -0
  88. package/fesm/enums/index.js +1 -0
  89. package/fesm/index.js +11 -0
  90. package/fesm/interfaces/email-config.interface.js +1 -0
  91. package/fesm/interfaces/email-module-options.interface.js +1 -0
  92. package/fesm/interfaces/email-provider.interface.js +1 -0
  93. package/fesm/interfaces/email-template.interface.js +1 -0
  94. package/fesm/interfaces/index.js +4 -0
  95. package/fesm/modules/email.module.js +151 -0
  96. package/fesm/modules/index.js +1 -0
  97. package/fesm/providers/email-factory.service.js +93 -0
  98. package/fesm/providers/email-provider.registry.js +31 -0
  99. package/fesm/providers/index.js +5 -0
  100. package/fesm/providers/mailgun-provider.js +97 -0
  101. package/fesm/providers/sendgrid-provider.js +125 -0
  102. package/fesm/providers/smtp-provider.js +115 -0
  103. package/fesm/services/email-datasource.provider.js +136 -0
  104. package/fesm/services/email-provider-config.service.js +140 -0
  105. package/fesm/services/email-send.service.js +201 -0
  106. package/fesm/services/email-template.service.js +148 -0
  107. package/fesm/services/index.js +4 -0
  108. package/fesm/utils/email-templates.util.js +111 -0
  109. package/fesm/utils/index.js +1 -0
  110. package/index.d.ts +10 -0
  111. package/interfaces/email-config.interface.d.ts +34 -0
  112. package/interfaces/email-module-options.interface.d.ts +25 -0
  113. package/interfaces/email-provider.interface.d.ts +34 -0
  114. package/interfaces/email-template.interface.d.ts +64 -0
  115. package/interfaces/index.d.ts +4 -0
  116. package/modules/email.module.d.ts +9 -0
  117. package/modules/index.d.ts +1 -0
  118. package/package.json +105 -0
  119. package/providers/email-factory.service.d.ts +14 -0
  120. package/providers/email-provider.registry.d.ts +10 -0
  121. package/providers/index.d.ts +5 -0
  122. package/providers/mailgun-provider.d.ts +11 -0
  123. package/providers/sendgrid-provider.d.ts +11 -0
  124. package/providers/smtp-provider.d.ts +11 -0
  125. package/services/email-datasource.provider.d.ts +25 -0
  126. package/services/email-provider-config.service.d.ts +32 -0
  127. package/services/email-send.service.d.ts +20 -0
  128. package/services/email-template.service.d.ts +31 -0
  129. package/services/index.d.ts +4 -0
  130. package/utils/email-templates.util.d.ts +2 -0
  131. package/utils/index.d.ts +1 -0
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get CreateEmailConfigDto () {
13
+ return CreateEmailConfigDto;
14
+ },
15
+ get EmailConfigResponseDto () {
16
+ return EmailConfigResponseDto;
17
+ },
18
+ get UpdateEmailConfigDto () {
19
+ return UpdateEmailConfigDto;
20
+ }
21
+ });
22
+ const _dtos = require("@flusys/nestjs-shared/dtos");
23
+ const _swagger = require("@nestjs/swagger");
24
+ const _classvalidator = require("class-validator");
25
+ const _enums = require("../enums");
26
+ function _define_property(obj, key, value) {
27
+ if (key in obj) {
28
+ Object.defineProperty(obj, key, {
29
+ value: value,
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true
33
+ });
34
+ } else {
35
+ obj[key] = value;
36
+ }
37
+ return obj;
38
+ }
39
+ function _ts_decorate(decorators, target, key, desc) {
40
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
42
+ 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;
43
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
44
+ }
45
+ function _ts_metadata(k, v) {
46
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
47
+ }
48
+ let CreateEmailConfigDto = class CreateEmailConfigDto {
49
+ constructor(){
50
+ _define_property(this, "name", void 0);
51
+ _define_property(this, "provider", void 0);
52
+ _define_property(this, "config", void 0);
53
+ _define_property(this, "fromEmail", void 0);
54
+ _define_property(this, "fromName", void 0);
55
+ _define_property(this, "isActive", void 0);
56
+ _define_property(this, "isDefault", void 0);
57
+ }
58
+ };
59
+ _ts_decorate([
60
+ (0, _swagger.ApiProperty)({
61
+ example: 'Production SMTP'
62
+ }),
63
+ (0, _classvalidator.IsString)(),
64
+ (0, _classvalidator.IsNotEmpty)(),
65
+ (0, _classvalidator.MaxLength)(255),
66
+ _ts_metadata("design:type", String)
67
+ ], CreateEmailConfigDto.prototype, "name", void 0);
68
+ _ts_decorate([
69
+ (0, _swagger.ApiProperty)({
70
+ enum: _enums.EmailProviderTypeEnum,
71
+ example: _enums.EmailProviderTypeEnum.SMTP,
72
+ description: 'Email provider type'
73
+ }),
74
+ (0, _classvalidator.IsEnum)(_enums.EmailProviderTypeEnum),
75
+ (0, _classvalidator.IsNotEmpty)(),
76
+ _ts_metadata("design:type", typeof _enums.EmailProviderTypeEnum === "undefined" ? Object : _enums.EmailProviderTypeEnum)
77
+ ], CreateEmailConfigDto.prototype, "provider", void 0);
78
+ _ts_decorate([
79
+ (0, _swagger.ApiProperty)({
80
+ type: 'object',
81
+ properties: {
82
+ host: {
83
+ type: 'string',
84
+ example: 'smtp.gmail.com',
85
+ description: 'SMTP host'
86
+ },
87
+ port: {
88
+ type: 'number',
89
+ example: 587,
90
+ description: 'SMTP port'
91
+ },
92
+ secure: {
93
+ type: 'boolean',
94
+ example: false,
95
+ description: 'Use TLS'
96
+ },
97
+ auth: {
98
+ type: 'object',
99
+ properties: {
100
+ user: {
101
+ type: 'string',
102
+ example: 'user@gmail.com'
103
+ },
104
+ pass: {
105
+ type: 'string',
106
+ example: 'app-password'
107
+ }
108
+ }
109
+ }
110
+ },
111
+ additionalProperties: true,
112
+ description: 'Provider-specific configuration'
113
+ }),
114
+ (0, _classvalidator.IsObject)(),
115
+ (0, _classvalidator.IsNotEmpty)(),
116
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
117
+ ], CreateEmailConfigDto.prototype, "config", void 0);
118
+ _ts_decorate([
119
+ (0, _swagger.ApiPropertyOptional)({
120
+ example: 'noreply@example.com'
121
+ }),
122
+ (0, _classvalidator.IsEmail)(),
123
+ (0, _classvalidator.IsOptional)(),
124
+ _ts_metadata("design:type", String)
125
+ ], CreateEmailConfigDto.prototype, "fromEmail", void 0);
126
+ _ts_decorate([
127
+ (0, _swagger.ApiPropertyOptional)({
128
+ example: 'FLUSYS'
129
+ }),
130
+ (0, _classvalidator.IsString)(),
131
+ (0, _classvalidator.IsOptional)(),
132
+ (0, _classvalidator.MaxLength)(255),
133
+ _ts_metadata("design:type", String)
134
+ ], CreateEmailConfigDto.prototype, "fromName", void 0);
135
+ _ts_decorate([
136
+ (0, _swagger.ApiPropertyOptional)({
137
+ example: true
138
+ }),
139
+ (0, _classvalidator.IsBoolean)(),
140
+ (0, _classvalidator.IsOptional)(),
141
+ _ts_metadata("design:type", Boolean)
142
+ ], CreateEmailConfigDto.prototype, "isActive", void 0);
143
+ _ts_decorate([
144
+ (0, _swagger.ApiPropertyOptional)({
145
+ example: false,
146
+ description: 'Set as default email configuration'
147
+ }),
148
+ (0, _classvalidator.IsBoolean)(),
149
+ (0, _classvalidator.IsOptional)(),
150
+ _ts_metadata("design:type", Boolean)
151
+ ], CreateEmailConfigDto.prototype, "isDefault", void 0);
152
+ let UpdateEmailConfigDto = class UpdateEmailConfigDto {
153
+ constructor(){
154
+ _define_property(this, "id", void 0);
155
+ _define_property(this, "name", void 0);
156
+ _define_property(this, "provider", void 0);
157
+ _define_property(this, "config", void 0);
158
+ _define_property(this, "fromEmail", void 0);
159
+ _define_property(this, "fromName", void 0);
160
+ _define_property(this, "isActive", void 0);
161
+ _define_property(this, "isDefault", void 0);
162
+ }
163
+ };
164
+ _ts_decorate([
165
+ (0, _swagger.ApiProperty)({
166
+ example: '123e4567-e89b-12d3-a456-426614174000'
167
+ }),
168
+ (0, _classvalidator.IsString)(),
169
+ (0, _classvalidator.IsNotEmpty)(),
170
+ _ts_metadata("design:type", String)
171
+ ], UpdateEmailConfigDto.prototype, "id", void 0);
172
+ _ts_decorate([
173
+ (0, _swagger.ApiPropertyOptional)({
174
+ example: 'Production SMTP'
175
+ }),
176
+ (0, _classvalidator.IsString)(),
177
+ (0, _classvalidator.IsOptional)(),
178
+ (0, _classvalidator.MaxLength)(255),
179
+ _ts_metadata("design:type", String)
180
+ ], UpdateEmailConfigDto.prototype, "name", void 0);
181
+ _ts_decorate([
182
+ (0, _swagger.ApiPropertyOptional)({
183
+ enum: _enums.EmailProviderTypeEnum,
184
+ example: _enums.EmailProviderTypeEnum.SMTP
185
+ }),
186
+ (0, _classvalidator.IsEnum)(_enums.EmailProviderTypeEnum),
187
+ (0, _classvalidator.IsOptional)(),
188
+ _ts_metadata("design:type", typeof _enums.EmailProviderTypeEnum === "undefined" ? Object : _enums.EmailProviderTypeEnum)
189
+ ], UpdateEmailConfigDto.prototype, "provider", void 0);
190
+ _ts_decorate([
191
+ (0, _swagger.ApiPropertyOptional)({
192
+ type: 'object',
193
+ additionalProperties: true,
194
+ description: 'Provider-specific configuration'
195
+ }),
196
+ (0, _classvalidator.IsObject)(),
197
+ (0, _classvalidator.IsOptional)(),
198
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
199
+ ], UpdateEmailConfigDto.prototype, "config", void 0);
200
+ _ts_decorate([
201
+ (0, _swagger.ApiPropertyOptional)({
202
+ example: 'noreply@example.com'
203
+ }),
204
+ (0, _classvalidator.IsEmail)(),
205
+ (0, _classvalidator.IsOptional)(),
206
+ _ts_metadata("design:type", String)
207
+ ], UpdateEmailConfigDto.prototype, "fromEmail", void 0);
208
+ _ts_decorate([
209
+ (0, _swagger.ApiPropertyOptional)({
210
+ example: 'FLUSYS'
211
+ }),
212
+ (0, _classvalidator.IsString)(),
213
+ (0, _classvalidator.IsOptional)(),
214
+ (0, _classvalidator.MaxLength)(255),
215
+ _ts_metadata("design:type", String)
216
+ ], UpdateEmailConfigDto.prototype, "fromName", void 0);
217
+ _ts_decorate([
218
+ (0, _swagger.ApiPropertyOptional)({
219
+ example: true
220
+ }),
221
+ (0, _classvalidator.IsBoolean)(),
222
+ (0, _classvalidator.IsOptional)(),
223
+ _ts_metadata("design:type", Boolean)
224
+ ], UpdateEmailConfigDto.prototype, "isActive", void 0);
225
+ _ts_decorate([
226
+ (0, _swagger.ApiPropertyOptional)({
227
+ example: false,
228
+ description: 'Set as default email configuration'
229
+ }),
230
+ (0, _classvalidator.IsBoolean)(),
231
+ (0, _classvalidator.IsOptional)(),
232
+ _ts_metadata("design:type", Boolean)
233
+ ], UpdateEmailConfigDto.prototype, "isDefault", void 0);
234
+ let EmailConfigResponseDto = class EmailConfigResponseDto extends _dtos.IdentityResponseDto {
235
+ constructor(...args){
236
+ super(...args), _define_property(this, "name", void 0), _define_property(this, "provider", void 0), _define_property(this, "config", void 0), _define_property(this, "fromEmail", void 0), _define_property(this, "fromName", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0);
237
+ }
238
+ };
@@ -0,0 +1,444 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get EmailAttachmentDto () {
13
+ return EmailAttachmentDto;
14
+ },
15
+ get EmailSendResultDto () {
16
+ return EmailSendResultDto;
17
+ },
18
+ get IsEmailOrEmailArrayConstraint () {
19
+ return IsEmailOrEmailArrayConstraint;
20
+ },
21
+ get SendEmailDto () {
22
+ return SendEmailDto;
23
+ },
24
+ get SendTemplateEmailDto () {
25
+ return SendTemplateEmailDto;
26
+ },
27
+ get TestEmailDto () {
28
+ return TestEmailDto;
29
+ }
30
+ });
31
+ const _swagger = require("@nestjs/swagger");
32
+ const _classvalidator = require("class-validator");
33
+ const _classtransformer = require("class-transformer");
34
+ function _define_property(obj, key, value) {
35
+ if (key in obj) {
36
+ Object.defineProperty(obj, key, {
37
+ value: value,
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true
41
+ });
42
+ } else {
43
+ obj[key] = value;
44
+ }
45
+ return obj;
46
+ }
47
+ function _ts_decorate(decorators, target, key, desc) {
48
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
50
+ 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;
51
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
52
+ }
53
+ function _ts_metadata(k, v) {
54
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
55
+ }
56
+ let IsEmailOrEmailArrayConstraint = class IsEmailOrEmailArrayConstraint {
57
+ validate(value) {
58
+ if (typeof value === 'string') {
59
+ return this.emailRegex.test(value);
60
+ }
61
+ if (Array.isArray(value)) {
62
+ return value.length > 0 && value.every((email)=>typeof email === 'string' && this.emailRegex.test(email));
63
+ }
64
+ return false;
65
+ }
66
+ defaultMessage(args) {
67
+ const value = args.value;
68
+ if (Array.isArray(value)) {
69
+ const invalidEmails = value.filter((v)=>typeof v !== 'string' || !this.emailRegex.test(v));
70
+ return `Invalid email(s) in array: ${invalidEmails.join(', ')}`;
71
+ }
72
+ return `${args.property} must be a valid email address or array of email addresses`;
73
+ }
74
+ constructor(){
75
+ _define_property(this, "emailRegex", /^[^\s@]+@[^\s@]+\.[^\s@]+$/);
76
+ }
77
+ };
78
+ IsEmailOrEmailArrayConstraint = _ts_decorate([
79
+ (0, _classvalidator.ValidatorConstraint)({
80
+ name: 'isEmailOrEmailArray',
81
+ async: false
82
+ })
83
+ ], IsEmailOrEmailArrayConstraint);
84
+ function IsEmailOrEmailArray(validationOptions) {
85
+ return function(object, propertyName) {
86
+ (0, _classvalidator.registerDecorator)({
87
+ name: 'isEmailOrEmailArray',
88
+ target: object.constructor,
89
+ propertyName,
90
+ options: validationOptions,
91
+ validator: IsEmailOrEmailArrayConstraint
92
+ });
93
+ };
94
+ }
95
+ function RequireTemplateIdOrSlug(validationOptions) {
96
+ return function(object, propertyName) {
97
+ (0, _classvalidator.registerDecorator)({
98
+ name: 'requireTemplateIdOrSlug',
99
+ target: object.constructor,
100
+ propertyName,
101
+ options: validationOptions,
102
+ validator: {
103
+ validate (_value, args) {
104
+ const obj = args.object;
105
+ return !!(obj.templateId || obj.templateSlug);
106
+ },
107
+ defaultMessage () {
108
+ return 'Either templateId or templateSlug must be provided';
109
+ }
110
+ }
111
+ });
112
+ };
113
+ }
114
+ let EmailAttachmentDto = class EmailAttachmentDto {
115
+ constructor(){
116
+ _define_property(this, "filename", void 0);
117
+ _define_property(this, "content", void 0);
118
+ _define_property(this, "contentType", void 0);
119
+ }
120
+ };
121
+ _ts_decorate([
122
+ (0, _swagger.ApiProperty)({
123
+ example: 'document.pdf'
124
+ }),
125
+ (0, _classvalidator.IsString)(),
126
+ (0, _classvalidator.IsNotEmpty)(),
127
+ _ts_metadata("design:type", String)
128
+ ], EmailAttachmentDto.prototype, "filename", void 0);
129
+ _ts_decorate([
130
+ (0, _swagger.ApiProperty)({
131
+ description: 'Base64 encoded content'
132
+ }),
133
+ (0, _classvalidator.IsString)(),
134
+ (0, _classvalidator.IsNotEmpty)(),
135
+ _ts_metadata("design:type", String)
136
+ ], EmailAttachmentDto.prototype, "content", void 0);
137
+ _ts_decorate([
138
+ (0, _swagger.ApiPropertyOptional)({
139
+ example: 'application/pdf'
140
+ }),
141
+ (0, _classvalidator.IsString)(),
142
+ (0, _classvalidator.IsOptional)(),
143
+ _ts_metadata("design:type", String)
144
+ ], EmailAttachmentDto.prototype, "contentType", void 0);
145
+ let SendEmailDto = class SendEmailDto {
146
+ constructor(){
147
+ _define_property(this, "to", void 0);
148
+ _define_property(this, "cc", void 0);
149
+ _define_property(this, "bcc", void 0);
150
+ _define_property(this, "subject", void 0);
151
+ _define_property(this, "html", void 0);
152
+ _define_property(this, "text", void 0);
153
+ _define_property(this, "from", void 0);
154
+ _define_property(this, "fromName", void 0);
155
+ _define_property(this, "replyTo", void 0);
156
+ _define_property(this, "emailConfigId", void 0);
157
+ _define_property(this, "attachments", void 0);
158
+ }
159
+ };
160
+ _ts_decorate([
161
+ (0, _swagger.ApiProperty)({
162
+ example: 'user@example.com',
163
+ description: 'Recipient email(s) - single email or array of emails',
164
+ oneOf: [
165
+ {
166
+ type: 'string'
167
+ },
168
+ {
169
+ type: 'array',
170
+ items: {
171
+ type: 'string'
172
+ }
173
+ }
174
+ ]
175
+ }),
176
+ (0, _classvalidator.IsNotEmpty)(),
177
+ IsEmailOrEmailArray(),
178
+ _ts_metadata("design:type", Object)
179
+ ], SendEmailDto.prototype, "to", void 0);
180
+ _ts_decorate([
181
+ (0, _swagger.ApiPropertyOptional)({
182
+ description: 'CC recipients - single email or array'
183
+ }),
184
+ (0, _classvalidator.IsOptional)(),
185
+ IsEmailOrEmailArray(),
186
+ _ts_metadata("design:type", Object)
187
+ ], SendEmailDto.prototype, "cc", void 0);
188
+ _ts_decorate([
189
+ (0, _swagger.ApiPropertyOptional)({
190
+ description: 'BCC recipients - single email or array'
191
+ }),
192
+ (0, _classvalidator.IsOptional)(),
193
+ IsEmailOrEmailArray(),
194
+ _ts_metadata("design:type", Object)
195
+ ], SendEmailDto.prototype, "bcc", void 0);
196
+ _ts_decorate([
197
+ (0, _swagger.ApiProperty)({
198
+ example: 'Welcome to our platform!'
199
+ }),
200
+ (0, _classvalidator.IsString)(),
201
+ (0, _classvalidator.IsNotEmpty)(),
202
+ _ts_metadata("design:type", String)
203
+ ], SendEmailDto.prototype, "subject", void 0);
204
+ _ts_decorate([
205
+ (0, _swagger.ApiProperty)({
206
+ example: '<h1>Hello!</h1><p>Welcome to our platform.</p>'
207
+ }),
208
+ (0, _classvalidator.IsString)(),
209
+ (0, _classvalidator.IsNotEmpty)(),
210
+ _ts_metadata("design:type", String)
211
+ ], SendEmailDto.prototype, "html", void 0);
212
+ _ts_decorate([
213
+ (0, _swagger.ApiPropertyOptional)({
214
+ example: 'Hello! Welcome to our platform.'
215
+ }),
216
+ (0, _classvalidator.IsString)(),
217
+ (0, _classvalidator.IsOptional)(),
218
+ _ts_metadata("design:type", String)
219
+ ], SendEmailDto.prototype, "text", void 0);
220
+ _ts_decorate([
221
+ (0, _swagger.ApiPropertyOptional)({
222
+ example: 'sender@example.com'
223
+ }),
224
+ (0, _classvalidator.IsEmail)(),
225
+ (0, _classvalidator.IsOptional)(),
226
+ _ts_metadata("design:type", String)
227
+ ], SendEmailDto.prototype, "from", void 0);
228
+ _ts_decorate([
229
+ (0, _swagger.ApiPropertyOptional)({
230
+ example: 'FLUSYS'
231
+ }),
232
+ (0, _classvalidator.IsString)(),
233
+ (0, _classvalidator.IsOptional)(),
234
+ _ts_metadata("design:type", String)
235
+ ], SendEmailDto.prototype, "fromName", void 0);
236
+ _ts_decorate([
237
+ (0, _swagger.ApiPropertyOptional)({
238
+ example: 'reply@example.com'
239
+ }),
240
+ (0, _classvalidator.IsEmail)(),
241
+ (0, _classvalidator.IsOptional)(),
242
+ _ts_metadata("design:type", String)
243
+ ], SendEmailDto.prototype, "replyTo", void 0);
244
+ _ts_decorate([
245
+ (0, _swagger.ApiPropertyOptional)({
246
+ description: 'Email configuration ID to use'
247
+ }),
248
+ (0, _classvalidator.IsUUID)(),
249
+ (0, _classvalidator.IsOptional)(),
250
+ _ts_metadata("design:type", String)
251
+ ], SendEmailDto.prototype, "emailConfigId", void 0);
252
+ _ts_decorate([
253
+ (0, _swagger.ApiPropertyOptional)({
254
+ type: [
255
+ EmailAttachmentDto
256
+ ]
257
+ }),
258
+ (0, _classvalidator.IsArray)(),
259
+ (0, _classvalidator.ValidateNested)({
260
+ each: true
261
+ }),
262
+ (0, _classtransformer.Type)(()=>EmailAttachmentDto),
263
+ (0, _classvalidator.IsOptional)(),
264
+ _ts_metadata("design:type", Array)
265
+ ], SendEmailDto.prototype, "attachments", void 0);
266
+ let SendTemplateEmailDto = class SendTemplateEmailDto {
267
+ constructor(){
268
+ _define_property(this, "templateId", void 0);
269
+ _define_property(this, "templateSlug", void 0);
270
+ _define_property(this, "to", void 0);
271
+ _define_property(this, "cc", void 0);
272
+ _define_property(this, "bcc", void 0);
273
+ _define_property(this, "variables", void 0);
274
+ _define_property(this, "from", void 0);
275
+ _define_property(this, "fromName", void 0);
276
+ _define_property(this, "replyTo", void 0);
277
+ _define_property(this, "emailConfigId", void 0);
278
+ _define_property(this, "attachments", void 0);
279
+ }
280
+ };
281
+ _ts_decorate([
282
+ (0, _swagger.ApiPropertyOptional)({
283
+ description: 'Template ID (required if templateSlug not provided)'
284
+ }),
285
+ (0, _classvalidator.IsUUID)(),
286
+ (0, _classvalidator.IsOptional)(),
287
+ RequireTemplateIdOrSlug({
288
+ message: 'Either templateId or templateSlug must be provided'
289
+ }),
290
+ _ts_metadata("design:type", String)
291
+ ], SendTemplateEmailDto.prototype, "templateId", void 0);
292
+ _ts_decorate([
293
+ (0, _swagger.ApiPropertyOptional)({
294
+ example: 'welcome-email',
295
+ description: 'Template slug (required if templateId not provided)'
296
+ }),
297
+ (0, _classvalidator.IsString)(),
298
+ (0, _classvalidator.IsOptional)(),
299
+ _ts_metadata("design:type", String)
300
+ ], SendTemplateEmailDto.prototype, "templateSlug", void 0);
301
+ _ts_decorate([
302
+ (0, _swagger.ApiProperty)({
303
+ example: 'user@example.com',
304
+ description: 'Recipient email(s) - single email or array of emails',
305
+ oneOf: [
306
+ {
307
+ type: 'string'
308
+ },
309
+ {
310
+ type: 'array',
311
+ items: {
312
+ type: 'string'
313
+ }
314
+ }
315
+ ]
316
+ }),
317
+ (0, _classvalidator.IsNotEmpty)(),
318
+ IsEmailOrEmailArray(),
319
+ _ts_metadata("design:type", Object)
320
+ ], SendTemplateEmailDto.prototype, "to", void 0);
321
+ _ts_decorate([
322
+ (0, _swagger.ApiPropertyOptional)({
323
+ description: 'CC recipients - single email or array'
324
+ }),
325
+ (0, _classvalidator.IsOptional)(),
326
+ IsEmailOrEmailArray(),
327
+ _ts_metadata("design:type", Object)
328
+ ], SendTemplateEmailDto.prototype, "cc", void 0);
329
+ _ts_decorate([
330
+ (0, _swagger.ApiPropertyOptional)({
331
+ description: 'BCC recipients - single email or array'
332
+ }),
333
+ (0, _classvalidator.IsOptional)(),
334
+ IsEmailOrEmailArray(),
335
+ _ts_metadata("design:type", Object)
336
+ ], SendTemplateEmailDto.prototype, "bcc", void 0);
337
+ _ts_decorate([
338
+ (0, _swagger.ApiPropertyOptional)({
339
+ type: 'object',
340
+ additionalProperties: true,
341
+ example: {
342
+ userName: 'John',
343
+ activationLink: 'https://...'
344
+ },
345
+ description: 'Template variables to interpolate'
346
+ }),
347
+ (0, _classvalidator.IsObject)(),
348
+ (0, _classvalidator.IsOptional)(),
349
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
350
+ ], SendTemplateEmailDto.prototype, "variables", void 0);
351
+ _ts_decorate([
352
+ (0, _swagger.ApiPropertyOptional)({
353
+ example: 'sender@example.com'
354
+ }),
355
+ (0, _classvalidator.IsEmail)(),
356
+ (0, _classvalidator.IsOptional)(),
357
+ _ts_metadata("design:type", String)
358
+ ], SendTemplateEmailDto.prototype, "from", void 0);
359
+ _ts_decorate([
360
+ (0, _swagger.ApiPropertyOptional)({
361
+ example: 'FLUSYS'
362
+ }),
363
+ (0, _classvalidator.IsString)(),
364
+ (0, _classvalidator.IsOptional)(),
365
+ _ts_metadata("design:type", String)
366
+ ], SendTemplateEmailDto.prototype, "fromName", void 0);
367
+ _ts_decorate([
368
+ (0, _swagger.ApiPropertyOptional)({
369
+ example: 'reply@example.com'
370
+ }),
371
+ (0, _classvalidator.IsEmail)(),
372
+ (0, _classvalidator.IsOptional)(),
373
+ _ts_metadata("design:type", String)
374
+ ], SendTemplateEmailDto.prototype, "replyTo", void 0);
375
+ _ts_decorate([
376
+ (0, _swagger.ApiPropertyOptional)({
377
+ description: 'Email configuration ID to use'
378
+ }),
379
+ (0, _classvalidator.IsUUID)(),
380
+ (0, _classvalidator.IsOptional)(),
381
+ _ts_metadata("design:type", String)
382
+ ], SendTemplateEmailDto.prototype, "emailConfigId", void 0);
383
+ _ts_decorate([
384
+ (0, _swagger.ApiPropertyOptional)({
385
+ type: [
386
+ EmailAttachmentDto
387
+ ]
388
+ }),
389
+ (0, _classvalidator.IsArray)(),
390
+ (0, _classvalidator.ValidateNested)({
391
+ each: true
392
+ }),
393
+ (0, _classtransformer.Type)(()=>EmailAttachmentDto),
394
+ (0, _classvalidator.IsOptional)(),
395
+ _ts_metadata("design:type", Array)
396
+ ], SendTemplateEmailDto.prototype, "attachments", void 0);
397
+ let TestEmailDto = class TestEmailDto {
398
+ constructor(){
399
+ _define_property(this, "emailConfigId", void 0);
400
+ _define_property(this, "recipient", void 0);
401
+ }
402
+ };
403
+ _ts_decorate([
404
+ (0, _swagger.ApiProperty)({
405
+ description: 'Email configuration ID'
406
+ }),
407
+ (0, _classvalidator.IsUUID)(),
408
+ (0, _classvalidator.IsNotEmpty)(),
409
+ _ts_metadata("design:type", String)
410
+ ], TestEmailDto.prototype, "emailConfigId", void 0);
411
+ _ts_decorate([
412
+ (0, _swagger.ApiProperty)({
413
+ example: 'test@example.com',
414
+ description: 'Test recipient'
415
+ }),
416
+ (0, _classvalidator.IsEmail)(),
417
+ (0, _classvalidator.IsNotEmpty)(),
418
+ _ts_metadata("design:type", String)
419
+ ], TestEmailDto.prototype, "recipient", void 0);
420
+ let EmailSendResultDto = class EmailSendResultDto {
421
+ constructor(){
422
+ _define_property(this, "success", void 0);
423
+ _define_property(this, "messageId", void 0);
424
+ _define_property(this, "error", void 0);
425
+ }
426
+ };
427
+ _ts_decorate([
428
+ (0, _swagger.ApiProperty)({
429
+ example: true
430
+ }),
431
+ _ts_metadata("design:type", Boolean)
432
+ ], EmailSendResultDto.prototype, "success", void 0);
433
+ _ts_decorate([
434
+ (0, _swagger.ApiPropertyOptional)({
435
+ example: '<message-id@mail.example.com>'
436
+ }),
437
+ _ts_metadata("design:type", String)
438
+ ], EmailSendResultDto.prototype, "messageId", void 0);
439
+ _ts_decorate([
440
+ (0, _swagger.ApiPropertyOptional)({
441
+ example: 'Connection refused'
442
+ }),
443
+ _ts_metadata("design:type", String)
444
+ ], EmailSendResultDto.prototype, "error", void 0);