@proteinjs/email-server 1.2.0 → 1.2.1
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/CHANGELOG.md +11 -0
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/EmailSender.js +4 -4
- package/dist/src/EmailSender.js.map +1 -1
- package/generated/index.ts +1 -1
- package/package.json +3 -3
- package/src/EmailSender.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.1](https://github.com/proteinjs/notifications/compare/@proteinjs/email-server@1.2.0...@proteinjs/email-server@1.2.1) (2024-08-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* refactored to implement new @proteinjs/logger/Logger api ([fd48238](https://github.com/proteinjs/notifications/commit/fd48238a2b2899f6509bda13a8407f6afac49663))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [1.2.0](https://github.com/proteinjs/notifications/compare/@proteinjs/email-server@1.1.1...@proteinjs/email-server@1.2.0) (2024-08-08)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,YAAY,CAAC;AAqBpB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
require("@proteinjs/logger");
|
|
18
19
|
require("@proteinjs/reflection");
|
|
19
|
-
require("@proteinjs/util");
|
|
20
20
|
require("nodemailer");
|
|
21
21
|
/** Generate Source Graph */
|
|
22
22
|
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/EmailSender.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getEmailConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"EmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/EmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultInviteEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/configs/InviteEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"InviteEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/InviteEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordResetEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/configs/PasswordResetEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordResetEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordResetEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultPasswordUpdatedEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultPasswordUpdatedEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/configs/PasswordUpdatedEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultPasswordUpdatedEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"PasswordUpdatedEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/PasswordUpdatedEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"value\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"DefaultSignupConfirmationEmailConfigFactory\",\"filePath\":\"/home/runner/work/notifications/notifications/packages/email/server/src/configs/SignupConfirmationEmailConfig.ts\",\"qualifiedName\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"properties\":[],\"methods\":[{\"name\":\"getConfig\",\"returnType\":{\"packageName\":\"@proteinjs/email-server\",\"name\":\"SignupConfirmationEmailConfig\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/email-server/SignupConfirmationEmailConfig\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}}],\"edges\":[{\"v\":\"@proteinjs/email-server/DefaultEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultInviteEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultPasswordUpdatedEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/email-server/DefaultSignupConfirmationEmailConfigFactory\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,iCAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,6BAA2B;AAC3B,iCAA+B;AAC/B,sBAAoB;AAGpB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,uiMAAuiM,CAAC;AAG5jM,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
package/dist/src/EmailSender.js
CHANGED
|
@@ -52,7 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.createEmailSender = exports.EmailSender = void 0;
|
|
54
54
|
var nodemailer_1 = __importDefault(require("nodemailer"));
|
|
55
|
-
var
|
|
55
|
+
var logger_1 = require("@proteinjs/logger");
|
|
56
56
|
var reflection_1 = require("@proteinjs/reflection");
|
|
57
57
|
var EmailSender = /** @class */ (function () {
|
|
58
58
|
function EmailSender(config) {
|
|
@@ -64,7 +64,7 @@ var EmailSender = /** @class */ (function () {
|
|
|
64
64
|
auth: this.config.auth,
|
|
65
65
|
});
|
|
66
66
|
this.fromAddress = this.config.from;
|
|
67
|
-
this.logger = new
|
|
67
|
+
this.logger = new logger_1.Logger({ name: this.constructor.name });
|
|
68
68
|
}
|
|
69
69
|
EmailSender.prototype.getDefaultEmailConfig = function () {
|
|
70
70
|
if (!EmailSender.defaultEmailConfig) {
|
|
@@ -89,11 +89,11 @@ var EmailSender = /** @class */ (function () {
|
|
|
89
89
|
return [4 /*yield*/, this.transporter.sendMail(finalMailOptions)];
|
|
90
90
|
case 2:
|
|
91
91
|
_a.sent();
|
|
92
|
-
this.logger.info("Email sent successfully to ".concat(mailOptions.to));
|
|
92
|
+
this.logger.info({ message: "Email sent successfully to ".concat(mailOptions.to) });
|
|
93
93
|
return [3 /*break*/, 4];
|
|
94
94
|
case 3:
|
|
95
95
|
error_1 = _a.sent();
|
|
96
|
-
this.logger.error('Error sending email
|
|
96
|
+
this.logger.error({ message: 'Error sending email', error: error_1 });
|
|
97
97
|
throw new Error('Failed to send email');
|
|
98
98
|
case 4: return [2 /*return*/];
|
|
99
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSender.js","sourceRoot":"","sources":["../../src/EmailSender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"EmailSender.js","sourceRoot":"","sources":["../../src/EmailSender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAoC;AACpC,4CAA2C;AAC3C,oDAAmE;A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AAO,EAAE,qCAA8B,WAAW,CAAC,EAAE,CAAE,EAAE,CAAC,CAAC;;;;wBAE9E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,KAAK,SAAA,EAAE,CAAC,CAAC;wBAC7D,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;;;;;KAE3C;IACH,kBAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,kCAAW;AAoDxB,SAAgB,iBAAiB,CAAC,MAAmB;IACnD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,8CAEC"}
|
package/generated/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/email-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Email server libraries",
|
|
5
5
|
"main": "./dist/generated/index.js",
|
|
6
6
|
"types": "./dist/generated/index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"watch": "reflection-watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@proteinjs/logger": "1.0.4",
|
|
26
27
|
"@proteinjs/reflection": "1.1.8",
|
|
27
|
-
"@proteinjs/util": "1.4.0",
|
|
28
28
|
"nodemailer": "6.9.14"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"ts-jest": "29.1.1",
|
|
42
42
|
"typescript": "5.2.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b0d44246c29759253ad1cae3f6eb1065041b72fc"
|
|
45
45
|
}
|
package/src/EmailSender.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nodemailer from 'nodemailer';
|
|
2
|
-
import { Logger } from '@proteinjs/
|
|
2
|
+
import { Logger } from '@proteinjs/logger';
|
|
3
3
|
import { Loadable, SourceRepository } from '@proteinjs/reflection';
|
|
4
4
|
import Mail from 'nodemailer/lib/mailer';
|
|
5
5
|
|
|
@@ -37,7 +37,7 @@ export class EmailSender {
|
|
|
37
37
|
auth: this.config.auth,
|
|
38
38
|
});
|
|
39
39
|
this.fromAddress = this.config.from;
|
|
40
|
-
this.logger = new Logger(
|
|
40
|
+
this.logger = new Logger({ name: this.constructor.name });
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
private getDefaultEmailConfig(): EmailConfig {
|
|
@@ -65,9 +65,9 @@ export class EmailSender {
|
|
|
65
65
|
|
|
66
66
|
try {
|
|
67
67
|
await this.transporter.sendMail(finalMailOptions);
|
|
68
|
-
this.logger.info(`Email sent successfully to ${mailOptions.to}`);
|
|
68
|
+
this.logger.info({ message: `Email sent successfully to ${mailOptions.to}` });
|
|
69
69
|
} catch (error: any) {
|
|
70
|
-
this.logger.error('Error sending email
|
|
70
|
+
this.logger.error({ message: 'Error sending email', error });
|
|
71
71
|
throw new Error('Failed to send email');
|
|
72
72
|
}
|
|
73
73
|
}
|