@8ms/helpers 1.0.21 → 1.0.22
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.
|
@@ -142,22 +142,17 @@ var SimpleEmail = /** @class */ (function (_super) {
|
|
|
142
142
|
SimpleEmail.prototype.send = function (_a) {
|
|
143
143
|
var SesLib = _a.SesLib, client = _a.client;
|
|
144
144
|
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var SendEmailCommand, response,
|
|
145
|
+
var SendEmailCommand, response, params, command, apiResponse, error_1;
|
|
146
146
|
return __generator(this, function (_b) {
|
|
147
147
|
switch (_b.label) {
|
|
148
148
|
case 0:
|
|
149
149
|
SendEmailCommand = SesLib.SendEmailCommand;
|
|
150
150
|
response = __assign({}, api_1.ApiPlaceholder);
|
|
151
|
-
clean = {
|
|
152
|
-
bcc: (0, uniq_1.default)(this.bcc.filter(function (value) { return value !== undefined && value !== null; })),
|
|
153
|
-
cc: (0, uniq_1.default)(this.cc.filter(function (value) { return value !== undefined && value !== null; })),
|
|
154
|
-
to: (0, uniq_1.default)(this.to.filter(function (value) { return value !== undefined && value !== null; })),
|
|
155
|
-
};
|
|
156
151
|
params = {
|
|
157
152
|
Destination: {
|
|
158
|
-
BccAddresses:
|
|
159
|
-
CcAddresses:
|
|
160
|
-
ToAddresses:
|
|
153
|
+
BccAddresses: this._filterRecipients({ field: 'bcc' }),
|
|
154
|
+
CcAddresses: this._filterRecipients({ field: 'cc' }),
|
|
155
|
+
ToAddresses: this._filterRecipients({ field: 'to' }),
|
|
161
156
|
},
|
|
162
157
|
Message: {
|
|
163
158
|
Body: {
|
|
@@ -204,6 +199,19 @@ var SimpleEmail = /** @class */ (function (_super) {
|
|
|
204
199
|
});
|
|
205
200
|
});
|
|
206
201
|
};
|
|
202
|
+
SimpleEmail.prototype._filterRecipients = function (_a) {
|
|
203
|
+
var field = _a.field;
|
|
204
|
+
// Remove all undefined and null values
|
|
205
|
+
var response = this[field].filter(function (recipient) { return undefined !== recipient && null !== recipient; });
|
|
206
|
+
// Clean all the values
|
|
207
|
+
response = response.map(function (recipient) { return recipient.toLowerCase()
|
|
208
|
+
.trim(); });
|
|
209
|
+
// Remove all empty values
|
|
210
|
+
response = response.filter(function (recipient) { return '' !== recipient; });
|
|
211
|
+
// Return only unique values
|
|
212
|
+
response = (0, uniq_1.default)(response);
|
|
213
|
+
return response;
|
|
214
|
+
};
|
|
207
215
|
return SimpleEmail;
|
|
208
216
|
}(Class_1.BaseClass));
|
|
209
217
|
exports.default = SimpleEmail;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@babel/preset-flow": "7.16.7",
|
|
25
25
|
"@babel/preset-typescript": "7.16.7",
|
|
26
26
|
"@types/jest": "27.4.1",
|
|
27
|
-
"@types/lodash": "4.14.
|
|
27
|
+
"@types/lodash": "4.14.180",
|
|
28
28
|
"@types/node": "17.0.21",
|
|
29
29
|
"babel-jest": "27.5.1",
|
|
30
30
|
"jest": "27.5.1",
|