@flusys/nestjs-email 5.1.0 → 5.1.2
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.
|
@@ -21,6 +21,7 @@ _export(exports, {
|
|
|
21
21
|
});
|
|
22
22
|
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
23
23
|
const _swagger = require("@nestjs/swagger");
|
|
24
|
+
const _classtransformer = require("class-transformer");
|
|
24
25
|
const _classvalidator = require("class-validator");
|
|
25
26
|
const _enums = require("../enums");
|
|
26
27
|
function _define_property(obj, key, value) {
|
|
@@ -57,6 +58,7 @@ let CreateEmailConfigDto = class CreateEmailConfigDto {
|
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
_ts_decorate([
|
|
61
|
+
(0, _classtransformer.Expose)(),
|
|
60
62
|
(0, _swagger.ApiProperty)({
|
|
61
63
|
example: 'Production SMTP'
|
|
62
64
|
}),
|
|
@@ -66,6 +68,7 @@ _ts_decorate([
|
|
|
66
68
|
_ts_metadata("design:type", String)
|
|
67
69
|
], CreateEmailConfigDto.prototype, "name", void 0);
|
|
68
70
|
_ts_decorate([
|
|
71
|
+
(0, _classtransformer.Expose)(),
|
|
69
72
|
(0, _swagger.ApiProperty)({
|
|
70
73
|
enum: _enums.EmailProviderTypeEnum,
|
|
71
74
|
example: _enums.EmailProviderTypeEnum.SMTP
|
|
@@ -75,6 +78,7 @@ _ts_decorate([
|
|
|
75
78
|
_ts_metadata("design:type", typeof _enums.EmailProviderTypeEnum === "undefined" ? Object : _enums.EmailProviderTypeEnum)
|
|
76
79
|
], CreateEmailConfigDto.prototype, "provider", void 0);
|
|
77
80
|
_ts_decorate([
|
|
81
|
+
(0, _classtransformer.Expose)(),
|
|
78
82
|
(0, _swagger.ApiProperty)({
|
|
79
83
|
type: 'object',
|
|
80
84
|
description: 'Provider-specific configuration (SMTP: host, port, secure, auth)',
|
|
@@ -85,6 +89,7 @@ _ts_decorate([
|
|
|
85
89
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
86
90
|
], CreateEmailConfigDto.prototype, "config", void 0);
|
|
87
91
|
_ts_decorate([
|
|
92
|
+
(0, _classtransformer.Expose)(),
|
|
88
93
|
(0, _swagger.ApiPropertyOptional)({
|
|
89
94
|
example: 'noreply@example.com'
|
|
90
95
|
}),
|
|
@@ -93,6 +98,7 @@ _ts_decorate([
|
|
|
93
98
|
_ts_metadata("design:type", String)
|
|
94
99
|
], CreateEmailConfigDto.prototype, "fromEmail", void 0);
|
|
95
100
|
_ts_decorate([
|
|
101
|
+
(0, _classtransformer.Expose)(),
|
|
96
102
|
(0, _swagger.ApiPropertyOptional)({
|
|
97
103
|
example: 'FLUSYS'
|
|
98
104
|
}),
|
|
@@ -102,6 +108,7 @@ _ts_decorate([
|
|
|
102
108
|
_ts_metadata("design:type", String)
|
|
103
109
|
], CreateEmailConfigDto.prototype, "fromName", void 0);
|
|
104
110
|
_ts_decorate([
|
|
111
|
+
(0, _classtransformer.Expose)(),
|
|
105
112
|
(0, _swagger.ApiPropertyOptional)({
|
|
106
113
|
example: true
|
|
107
114
|
}),
|
|
@@ -110,6 +117,7 @@ _ts_decorate([
|
|
|
110
117
|
_ts_metadata("design:type", Boolean)
|
|
111
118
|
], CreateEmailConfigDto.prototype, "isActive", void 0);
|
|
112
119
|
_ts_decorate([
|
|
120
|
+
(0, _classtransformer.Expose)(),
|
|
113
121
|
(0, _swagger.ApiPropertyOptional)({
|
|
114
122
|
example: false,
|
|
115
123
|
description: 'Set as default email configuration'
|
|
@@ -124,6 +132,7 @@ let UpdateEmailConfigDto = class UpdateEmailConfigDto extends (0, _swagger.Parti
|
|
|
124
132
|
}
|
|
125
133
|
};
|
|
126
134
|
_ts_decorate([
|
|
135
|
+
(0, _classtransformer.Expose)(),
|
|
127
136
|
(0, _swagger.ApiProperty)({
|
|
128
137
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
129
138
|
}),
|
|
@@ -136,3 +145,68 @@ let EmailConfigResponseDto = class EmailConfigResponseDto extends _dtos.Identity
|
|
|
136
145
|
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);
|
|
137
146
|
}
|
|
138
147
|
};
|
|
148
|
+
_ts_decorate([
|
|
149
|
+
(0, _swagger.ApiProperty)({
|
|
150
|
+
description: 'Human-readable name for this email configuration',
|
|
151
|
+
example: 'Primary Transactional Email'
|
|
152
|
+
}),
|
|
153
|
+
(0, _classtransformer.Expose)(),
|
|
154
|
+
_ts_metadata("design:type", String)
|
|
155
|
+
], EmailConfigResponseDto.prototype, "name", void 0);
|
|
156
|
+
_ts_decorate([
|
|
157
|
+
(0, _swagger.ApiProperty)({
|
|
158
|
+
description: 'The email provider type used for this configuration',
|
|
159
|
+
enum: _enums.EmailProviderTypeEnum,
|
|
160
|
+
example: _enums.EmailProviderTypeEnum.SMTP
|
|
161
|
+
}),
|
|
162
|
+
(0, _classtransformer.Expose)(),
|
|
163
|
+
_ts_metadata("design:type", typeof _enums.EmailProviderTypeEnum === "undefined" ? Object : _enums.EmailProviderTypeEnum)
|
|
164
|
+
], EmailConfigResponseDto.prototype, "provider", void 0);
|
|
165
|
+
_ts_decorate([
|
|
166
|
+
(0, _swagger.ApiProperty)({
|
|
167
|
+
description: 'Provider-specific configuration key-value pairs',
|
|
168
|
+
type: 'object',
|
|
169
|
+
additionalProperties: true,
|
|
170
|
+
example: {
|
|
171
|
+
host: 'smtp.example.com',
|
|
172
|
+
port: 587,
|
|
173
|
+
secure: true
|
|
174
|
+
}
|
|
175
|
+
}),
|
|
176
|
+
(0, _classtransformer.Expose)(),
|
|
177
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
178
|
+
], EmailConfigResponseDto.prototype, "config", void 0);
|
|
179
|
+
_ts_decorate([
|
|
180
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
181
|
+
description: 'The email address used in the "From" field',
|
|
182
|
+
example: 'no-reply@example.com',
|
|
183
|
+
nullable: true
|
|
184
|
+
}),
|
|
185
|
+
(0, _classtransformer.Expose)(),
|
|
186
|
+
_ts_metadata("design:type", Object)
|
|
187
|
+
], EmailConfigResponseDto.prototype, "fromEmail", void 0);
|
|
188
|
+
_ts_decorate([
|
|
189
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
190
|
+
description: 'The display name used in the "From" field',
|
|
191
|
+
example: 'Acme Notifications',
|
|
192
|
+
nullable: true
|
|
193
|
+
}),
|
|
194
|
+
(0, _classtransformer.Expose)(),
|
|
195
|
+
_ts_metadata("design:type", Object)
|
|
196
|
+
], EmailConfigResponseDto.prototype, "fromName", void 0);
|
|
197
|
+
_ts_decorate([
|
|
198
|
+
(0, _swagger.ApiProperty)({
|
|
199
|
+
description: 'Whether this email configuration is currently active',
|
|
200
|
+
example: true
|
|
201
|
+
}),
|
|
202
|
+
(0, _classtransformer.Expose)(),
|
|
203
|
+
_ts_metadata("design:type", Boolean)
|
|
204
|
+
], EmailConfigResponseDto.prototype, "isActive", void 0);
|
|
205
|
+
_ts_decorate([
|
|
206
|
+
(0, _swagger.ApiProperty)({
|
|
207
|
+
description: 'Whether this is the default email configuration',
|
|
208
|
+
example: false
|
|
209
|
+
}),
|
|
210
|
+
(0, _classtransformer.Expose)(),
|
|
211
|
+
_ts_metadata("design:type", Boolean)
|
|
212
|
+
], EmailConfigResponseDto.prototype, "isDefault", void 0);
|
|
@@ -21,6 +21,7 @@ _export(exports, {
|
|
|
21
21
|
});
|
|
22
22
|
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
23
23
|
const _swagger = require("@nestjs/swagger");
|
|
24
|
+
const _classtransformer = require("class-transformer");
|
|
24
25
|
const _classvalidator = require("class-validator");
|
|
25
26
|
function _define_property(obj, key, value) {
|
|
26
27
|
if (key in obj) {
|
|
@@ -157,45 +158,95 @@ let EmailTemplateResponseDto = class EmailTemplateResponseDto extends _dtos.Iden
|
|
|
157
158
|
}
|
|
158
159
|
};
|
|
159
160
|
_ts_decorate([
|
|
160
|
-
(0, _swagger.ApiProperty)(
|
|
161
|
+
(0, _swagger.ApiProperty)({
|
|
162
|
+
description: 'Human-readable name of the email template',
|
|
163
|
+
example: 'Welcome Email'
|
|
164
|
+
}),
|
|
165
|
+
(0, _classtransformer.Expose)(),
|
|
161
166
|
_ts_metadata("design:type", String)
|
|
162
167
|
], EmailTemplateResponseDto.prototype, "name", void 0);
|
|
163
168
|
_ts_decorate([
|
|
164
|
-
(0, _swagger.ApiProperty)(
|
|
169
|
+
(0, _swagger.ApiProperty)({
|
|
170
|
+
description: 'URL-friendly unique identifier for the template',
|
|
171
|
+
example: 'welcome-email'
|
|
172
|
+
}),
|
|
173
|
+
(0, _classtransformer.Expose)(),
|
|
165
174
|
_ts_metadata("design:type", String)
|
|
166
175
|
], EmailTemplateResponseDto.prototype, "slug", void 0);
|
|
167
176
|
_ts_decorate([
|
|
168
|
-
(0, _swagger.ApiPropertyOptional)(
|
|
177
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
178
|
+
description: 'Optional description of the template purpose',
|
|
179
|
+
example: 'Sent to new users upon successful registration',
|
|
180
|
+
nullable: true
|
|
181
|
+
}),
|
|
182
|
+
(0, _classtransformer.Expose)(),
|
|
169
183
|
_ts_metadata("design:type", Object)
|
|
170
184
|
], EmailTemplateResponseDto.prototype, "description", void 0);
|
|
171
185
|
_ts_decorate([
|
|
172
|
-
(0, _swagger.ApiProperty)(
|
|
186
|
+
(0, _swagger.ApiProperty)({
|
|
187
|
+
description: 'Email subject line, supports template variables',
|
|
188
|
+
example: 'Welcome to Acme, {{firstName}}!'
|
|
189
|
+
}),
|
|
190
|
+
(0, _classtransformer.Expose)(),
|
|
173
191
|
_ts_metadata("design:type", String)
|
|
174
192
|
], EmailTemplateResponseDto.prototype, "subject", void 0);
|
|
175
193
|
_ts_decorate([
|
|
176
194
|
(0, _swagger.ApiProperty)({
|
|
195
|
+
description: 'JSON schema defining the variables accepted by this template',
|
|
177
196
|
type: 'object',
|
|
178
|
-
additionalProperties: true
|
|
197
|
+
additionalProperties: true,
|
|
198
|
+
example: {
|
|
199
|
+
firstName: {
|
|
200
|
+
type: 'string'
|
|
201
|
+
},
|
|
202
|
+
activationUrl: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
format: 'uri'
|
|
205
|
+
}
|
|
206
|
+
}
|
|
179
207
|
}),
|
|
208
|
+
(0, _classtransformer.Expose)(),
|
|
180
209
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
181
210
|
], EmailTemplateResponseDto.prototype, "schema", void 0);
|
|
182
211
|
_ts_decorate([
|
|
183
|
-
(0, _swagger.ApiProperty)(
|
|
212
|
+
(0, _swagger.ApiProperty)({
|
|
213
|
+
description: 'HTML body of the email template',
|
|
214
|
+
example: '<h1>Welcome, {{firstName}}!</h1><p>Click <a href="{{activationUrl}}">here</a> to activate.</p>'
|
|
215
|
+
}),
|
|
216
|
+
(0, _classtransformer.Expose)(),
|
|
184
217
|
_ts_metadata("design:type", String)
|
|
185
218
|
], EmailTemplateResponseDto.prototype, "htmlContent", void 0);
|
|
186
219
|
_ts_decorate([
|
|
187
|
-
(0, _swagger.ApiPropertyOptional)(
|
|
220
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
221
|
+
description: 'Plain-text fallback body for email clients that do not render HTML',
|
|
222
|
+
example: 'Welcome, {{firstName}}! Activate your account at {{activationUrl}}',
|
|
223
|
+
nullable: true
|
|
224
|
+
}),
|
|
225
|
+
(0, _classtransformer.Expose)(),
|
|
188
226
|
_ts_metadata("design:type", Object)
|
|
189
227
|
], EmailTemplateResponseDto.prototype, "textContent", void 0);
|
|
190
228
|
_ts_decorate([
|
|
191
|
-
(0, _swagger.ApiProperty)(
|
|
229
|
+
(0, _swagger.ApiProperty)({
|
|
230
|
+
description: 'Version number of the schema definition for this template',
|
|
231
|
+
example: 1,
|
|
232
|
+
minimum: 1
|
|
233
|
+
}),
|
|
234
|
+
(0, _classtransformer.Expose)(),
|
|
192
235
|
_ts_metadata("design:type", Number)
|
|
193
236
|
], EmailTemplateResponseDto.prototype, "schemaVersion", void 0);
|
|
194
237
|
_ts_decorate([
|
|
195
|
-
(0, _swagger.ApiProperty)(
|
|
238
|
+
(0, _swagger.ApiProperty)({
|
|
239
|
+
description: 'Whether this template is currently active and usable',
|
|
240
|
+
example: true
|
|
241
|
+
}),
|
|
242
|
+
(0, _classtransformer.Expose)(),
|
|
196
243
|
_ts_metadata("design:type", Boolean)
|
|
197
244
|
], EmailTemplateResponseDto.prototype, "isActive", void 0);
|
|
198
245
|
_ts_decorate([
|
|
199
|
-
(0, _swagger.ApiProperty)(
|
|
246
|
+
(0, _swagger.ApiProperty)({
|
|
247
|
+
description: 'Whether this template renders as HTML; false means plain-text only',
|
|
248
|
+
example: true
|
|
249
|
+
}),
|
|
250
|
+
(0, _classtransformer.Expose)(),
|
|
200
251
|
_ts_metadata("design:type", Boolean)
|
|
201
252
|
], EmailTemplateResponseDto.prototype, "isHtml", void 0);
|
|
@@ -22,6 +22,7 @@ function _ts_metadata(k, v) {
|
|
|
22
22
|
}
|
|
23
23
|
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
24
24
|
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
25
|
+
import { Expose } from 'class-transformer';
|
|
25
26
|
import { IsBoolean, IsEmail, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
|
|
26
27
|
import { EmailProviderTypeEnum } from '../enums';
|
|
27
28
|
export class CreateEmailConfigDto {
|
|
@@ -36,6 +37,7 @@ export class CreateEmailConfigDto {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
_ts_decorate([
|
|
40
|
+
Expose(),
|
|
39
41
|
ApiProperty({
|
|
40
42
|
example: 'Production SMTP'
|
|
41
43
|
}),
|
|
@@ -45,6 +47,7 @@ _ts_decorate([
|
|
|
45
47
|
_ts_metadata("design:type", String)
|
|
46
48
|
], CreateEmailConfigDto.prototype, "name", void 0);
|
|
47
49
|
_ts_decorate([
|
|
50
|
+
Expose(),
|
|
48
51
|
ApiProperty({
|
|
49
52
|
enum: EmailProviderTypeEnum,
|
|
50
53
|
example: EmailProviderTypeEnum.SMTP
|
|
@@ -54,6 +57,7 @@ _ts_decorate([
|
|
|
54
57
|
_ts_metadata("design:type", typeof EmailProviderTypeEnum === "undefined" ? Object : EmailProviderTypeEnum)
|
|
55
58
|
], CreateEmailConfigDto.prototype, "provider", void 0);
|
|
56
59
|
_ts_decorate([
|
|
60
|
+
Expose(),
|
|
57
61
|
ApiProperty({
|
|
58
62
|
type: 'object',
|
|
59
63
|
description: 'Provider-specific configuration (SMTP: host, port, secure, auth)',
|
|
@@ -64,6 +68,7 @@ _ts_decorate([
|
|
|
64
68
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
65
69
|
], CreateEmailConfigDto.prototype, "config", void 0);
|
|
66
70
|
_ts_decorate([
|
|
71
|
+
Expose(),
|
|
67
72
|
ApiPropertyOptional({
|
|
68
73
|
example: 'noreply@example.com'
|
|
69
74
|
}),
|
|
@@ -72,6 +77,7 @@ _ts_decorate([
|
|
|
72
77
|
_ts_metadata("design:type", String)
|
|
73
78
|
], CreateEmailConfigDto.prototype, "fromEmail", void 0);
|
|
74
79
|
_ts_decorate([
|
|
80
|
+
Expose(),
|
|
75
81
|
ApiPropertyOptional({
|
|
76
82
|
example: 'FLUSYS'
|
|
77
83
|
}),
|
|
@@ -81,6 +87,7 @@ _ts_decorate([
|
|
|
81
87
|
_ts_metadata("design:type", String)
|
|
82
88
|
], CreateEmailConfigDto.prototype, "fromName", void 0);
|
|
83
89
|
_ts_decorate([
|
|
90
|
+
Expose(),
|
|
84
91
|
ApiPropertyOptional({
|
|
85
92
|
example: true
|
|
86
93
|
}),
|
|
@@ -89,6 +96,7 @@ _ts_decorate([
|
|
|
89
96
|
_ts_metadata("design:type", Boolean)
|
|
90
97
|
], CreateEmailConfigDto.prototype, "isActive", void 0);
|
|
91
98
|
_ts_decorate([
|
|
99
|
+
Expose(),
|
|
92
100
|
ApiPropertyOptional({
|
|
93
101
|
example: false,
|
|
94
102
|
description: 'Set as default email configuration'
|
|
@@ -103,6 +111,7 @@ export class UpdateEmailConfigDto extends PartialType(CreateEmailConfigDto) {
|
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
_ts_decorate([
|
|
114
|
+
Expose(),
|
|
106
115
|
ApiProperty({
|
|
107
116
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
108
117
|
}),
|
|
@@ -115,3 +124,68 @@ export class EmailConfigResponseDto extends IdentityResponseDto {
|
|
|
115
124
|
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);
|
|
116
125
|
}
|
|
117
126
|
}
|
|
127
|
+
_ts_decorate([
|
|
128
|
+
ApiProperty({
|
|
129
|
+
description: 'Human-readable name for this email configuration',
|
|
130
|
+
example: 'Primary Transactional Email'
|
|
131
|
+
}),
|
|
132
|
+
Expose(),
|
|
133
|
+
_ts_metadata("design:type", String)
|
|
134
|
+
], EmailConfigResponseDto.prototype, "name", void 0);
|
|
135
|
+
_ts_decorate([
|
|
136
|
+
ApiProperty({
|
|
137
|
+
description: 'The email provider type used for this configuration',
|
|
138
|
+
enum: EmailProviderTypeEnum,
|
|
139
|
+
example: EmailProviderTypeEnum.SMTP
|
|
140
|
+
}),
|
|
141
|
+
Expose(),
|
|
142
|
+
_ts_metadata("design:type", typeof EmailProviderTypeEnum === "undefined" ? Object : EmailProviderTypeEnum)
|
|
143
|
+
], EmailConfigResponseDto.prototype, "provider", void 0);
|
|
144
|
+
_ts_decorate([
|
|
145
|
+
ApiProperty({
|
|
146
|
+
description: 'Provider-specific configuration key-value pairs',
|
|
147
|
+
type: 'object',
|
|
148
|
+
additionalProperties: true,
|
|
149
|
+
example: {
|
|
150
|
+
host: 'smtp.example.com',
|
|
151
|
+
port: 587,
|
|
152
|
+
secure: true
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
Expose(),
|
|
156
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
157
|
+
], EmailConfigResponseDto.prototype, "config", void 0);
|
|
158
|
+
_ts_decorate([
|
|
159
|
+
ApiPropertyOptional({
|
|
160
|
+
description: 'The email address used in the "From" field',
|
|
161
|
+
example: 'no-reply@example.com',
|
|
162
|
+
nullable: true
|
|
163
|
+
}),
|
|
164
|
+
Expose(),
|
|
165
|
+
_ts_metadata("design:type", Object)
|
|
166
|
+
], EmailConfigResponseDto.prototype, "fromEmail", void 0);
|
|
167
|
+
_ts_decorate([
|
|
168
|
+
ApiPropertyOptional({
|
|
169
|
+
description: 'The display name used in the "From" field',
|
|
170
|
+
example: 'Acme Notifications',
|
|
171
|
+
nullable: true
|
|
172
|
+
}),
|
|
173
|
+
Expose(),
|
|
174
|
+
_ts_metadata("design:type", Object)
|
|
175
|
+
], EmailConfigResponseDto.prototype, "fromName", void 0);
|
|
176
|
+
_ts_decorate([
|
|
177
|
+
ApiProperty({
|
|
178
|
+
description: 'Whether this email configuration is currently active',
|
|
179
|
+
example: true
|
|
180
|
+
}),
|
|
181
|
+
Expose(),
|
|
182
|
+
_ts_metadata("design:type", Boolean)
|
|
183
|
+
], EmailConfigResponseDto.prototype, "isActive", void 0);
|
|
184
|
+
_ts_decorate([
|
|
185
|
+
ApiProperty({
|
|
186
|
+
description: 'Whether this is the default email configuration',
|
|
187
|
+
example: false
|
|
188
|
+
}),
|
|
189
|
+
Expose(),
|
|
190
|
+
_ts_metadata("design:type", Boolean)
|
|
191
|
+
], EmailConfigResponseDto.prototype, "isDefault", void 0);
|
|
@@ -22,6 +22,7 @@ function _ts_metadata(k, v) {
|
|
|
22
22
|
}
|
|
23
23
|
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
24
24
|
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
25
|
+
import { Expose } from 'class-transformer';
|
|
25
26
|
import { IsBoolean, IsNotEmpty, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
|
|
26
27
|
export class CreateEmailTemplateDto {
|
|
27
28
|
constructor(){
|
|
@@ -136,45 +137,95 @@ export class EmailTemplateResponseDto extends IdentityResponseDto {
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
_ts_decorate([
|
|
139
|
-
ApiProperty(
|
|
140
|
+
ApiProperty({
|
|
141
|
+
description: 'Human-readable name of the email template',
|
|
142
|
+
example: 'Welcome Email'
|
|
143
|
+
}),
|
|
144
|
+
Expose(),
|
|
140
145
|
_ts_metadata("design:type", String)
|
|
141
146
|
], EmailTemplateResponseDto.prototype, "name", void 0);
|
|
142
147
|
_ts_decorate([
|
|
143
|
-
ApiProperty(
|
|
148
|
+
ApiProperty({
|
|
149
|
+
description: 'URL-friendly unique identifier for the template',
|
|
150
|
+
example: 'welcome-email'
|
|
151
|
+
}),
|
|
152
|
+
Expose(),
|
|
144
153
|
_ts_metadata("design:type", String)
|
|
145
154
|
], EmailTemplateResponseDto.prototype, "slug", void 0);
|
|
146
155
|
_ts_decorate([
|
|
147
|
-
ApiPropertyOptional(
|
|
156
|
+
ApiPropertyOptional({
|
|
157
|
+
description: 'Optional description of the template purpose',
|
|
158
|
+
example: 'Sent to new users upon successful registration',
|
|
159
|
+
nullable: true
|
|
160
|
+
}),
|
|
161
|
+
Expose(),
|
|
148
162
|
_ts_metadata("design:type", Object)
|
|
149
163
|
], EmailTemplateResponseDto.prototype, "description", void 0);
|
|
150
164
|
_ts_decorate([
|
|
151
|
-
ApiProperty(
|
|
165
|
+
ApiProperty({
|
|
166
|
+
description: 'Email subject line, supports template variables',
|
|
167
|
+
example: 'Welcome to Acme, {{firstName}}!'
|
|
168
|
+
}),
|
|
169
|
+
Expose(),
|
|
152
170
|
_ts_metadata("design:type", String)
|
|
153
171
|
], EmailTemplateResponseDto.prototype, "subject", void 0);
|
|
154
172
|
_ts_decorate([
|
|
155
173
|
ApiProperty({
|
|
174
|
+
description: 'JSON schema defining the variables accepted by this template',
|
|
156
175
|
type: 'object',
|
|
157
|
-
additionalProperties: true
|
|
176
|
+
additionalProperties: true,
|
|
177
|
+
example: {
|
|
178
|
+
firstName: {
|
|
179
|
+
type: 'string'
|
|
180
|
+
},
|
|
181
|
+
activationUrl: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
format: 'uri'
|
|
184
|
+
}
|
|
185
|
+
}
|
|
158
186
|
}),
|
|
187
|
+
Expose(),
|
|
159
188
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
160
189
|
], EmailTemplateResponseDto.prototype, "schema", void 0);
|
|
161
190
|
_ts_decorate([
|
|
162
|
-
ApiProperty(
|
|
191
|
+
ApiProperty({
|
|
192
|
+
description: 'HTML body of the email template',
|
|
193
|
+
example: '<h1>Welcome, {{firstName}}!</h1><p>Click <a href="{{activationUrl}}">here</a> to activate.</p>'
|
|
194
|
+
}),
|
|
195
|
+
Expose(),
|
|
163
196
|
_ts_metadata("design:type", String)
|
|
164
197
|
], EmailTemplateResponseDto.prototype, "htmlContent", void 0);
|
|
165
198
|
_ts_decorate([
|
|
166
|
-
ApiPropertyOptional(
|
|
199
|
+
ApiPropertyOptional({
|
|
200
|
+
description: 'Plain-text fallback body for email clients that do not render HTML',
|
|
201
|
+
example: 'Welcome, {{firstName}}! Activate your account at {{activationUrl}}',
|
|
202
|
+
nullable: true
|
|
203
|
+
}),
|
|
204
|
+
Expose(),
|
|
167
205
|
_ts_metadata("design:type", Object)
|
|
168
206
|
], EmailTemplateResponseDto.prototype, "textContent", void 0);
|
|
169
207
|
_ts_decorate([
|
|
170
|
-
ApiProperty(
|
|
208
|
+
ApiProperty({
|
|
209
|
+
description: 'Version number of the schema definition for this template',
|
|
210
|
+
example: 1,
|
|
211
|
+
minimum: 1
|
|
212
|
+
}),
|
|
213
|
+
Expose(),
|
|
171
214
|
_ts_metadata("design:type", Number)
|
|
172
215
|
], EmailTemplateResponseDto.prototype, "schemaVersion", void 0);
|
|
173
216
|
_ts_decorate([
|
|
174
|
-
ApiProperty(
|
|
217
|
+
ApiProperty({
|
|
218
|
+
description: 'Whether this template is currently active and usable',
|
|
219
|
+
example: true
|
|
220
|
+
}),
|
|
221
|
+
Expose(),
|
|
175
222
|
_ts_metadata("design:type", Boolean)
|
|
176
223
|
], EmailTemplateResponseDto.prototype, "isActive", void 0);
|
|
177
224
|
_ts_decorate([
|
|
178
|
-
ApiProperty(
|
|
225
|
+
ApiProperty({
|
|
226
|
+
description: 'Whether this template renders as HTML; false means plain-text only',
|
|
227
|
+
example: true
|
|
228
|
+
}),
|
|
229
|
+
Expose(),
|
|
179
230
|
_ts_metadata("design:type", Boolean)
|
|
180
231
|
], EmailTemplateResponseDto.prototype, "isHtml", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-email",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Modular email package with SMTP, SendGrid, and Mailgun providers",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "fesm/index.js",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@flusys/nestjs-core": "5.1.
|
|
109
|
-
"@flusys/nestjs-shared": "5.1.
|
|
108
|
+
"@flusys/nestjs-core": "5.1.2",
|
|
109
|
+
"@flusys/nestjs-shared": "5.1.2"
|
|
110
110
|
}
|
|
111
111
|
}
|