@tomei/mailer 0.5.8 → 0.5.10
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/package.json +44 -44
- package/src/enum/email-status.enum.ts +4 -4
- package/src/enum/index.ts +1 -1
- package/src/interfaces/log-transaction-options.interface.ts +18 -18
- package/src/interfaces/mail-config.interface.ts +8 -8
- package/src/interfaces/mail-log.interface.ts +12 -12
- package/src/mailer/index.ts +2 -2
- package/src/mailer/mailer.base.ts +110 -110
- package/src/mailer/smtp-mailer.ts +57 -57
- package/dist/__tests__/unit/mailer/mailer.spec.d.ts +0 -1
- package/dist/__tests__/unit/mailer/mailer.spec.js +0 -200
- package/dist/__tests__/unit/mailer/mailer.spec.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/src/enum/email-status.enum.d.ts +0 -4
- package/dist/src/enum/email-status.enum.js +0 -9
- package/dist/src/enum/email-status.enum.js.map +0 -1
- package/dist/src/enum/index.d.ts +0 -1
- package/dist/src/enum/index.js +0 -6
- package/dist/src/enum/index.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -20
- package/dist/src/index.js.map +0 -1
- package/dist/src/interfaces/index.d.ts +0 -3
- package/dist/src/interfaces/index.js +0 -3
- package/dist/src/interfaces/index.js.map +0 -1
- package/dist/src/interfaces/log-transaction-options.interface.d.ts +0 -18
- package/dist/src/interfaces/log-transaction-options.interface.js +0 -3
- package/dist/src/interfaces/log-transaction-options.interface.js.map +0 -1
- package/dist/src/interfaces/mail-config.interface.d.ts +0 -8
- package/dist/src/interfaces/mail-config.interface.js +0 -3
- package/dist/src/interfaces/mail-config.interface.js.map +0 -1
- package/dist/src/interfaces/mail-log.interface.d.ts +0 -11
- package/dist/src/interfaces/mail-log.interface.js +0 -3
- package/dist/src/interfaces/mail-log.interface.js.map +0 -1
- package/dist/src/mailer/helpers/helpers.d.ts +0 -1
- package/dist/src/mailer/helpers/helpers.js +0 -36
- package/dist/src/mailer/helpers/helpers.js.map +0 -1
- package/dist/src/mailer/index.d.ts +0 -2
- package/dist/src/mailer/index.js +0 -8
- package/dist/src/mailer/index.js.map +0 -1
- package/dist/src/mailer/mailer.base.d.ts +0 -9
- package/dist/src/mailer/mailer.base.js +0 -113
- package/dist/src/mailer/mailer.base.js.map +0 -1
- package/dist/src/mailer/smtp-mailer.d.ts +0 -7
- package/dist/src/mailer/smtp-mailer.js +0 -53
- package/dist/src/mailer/smtp-mailer.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const src_1 = require("../../../src");
|
|
13
|
-
const config_1 = require("@tomei/config");
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const path = require("path");
|
|
16
|
-
const smtp_mailer_1 = require("../../../src/mailer/smtp-mailer");
|
|
17
|
-
describe('Mailer', () => {
|
|
18
|
-
const mailer = new src_1.SMTPMailer();
|
|
19
|
-
const from = 'test@test.com';
|
|
20
|
-
const to = 'recipients@mail.com';
|
|
21
|
-
const subject = 'Test Subject';
|
|
22
|
-
const html = 'Test Message';
|
|
23
|
-
const expectedResult = {
|
|
24
|
-
from,
|
|
25
|
-
cc: '',
|
|
26
|
-
to: 'recipients@mail.com',
|
|
27
|
-
subject: 'test email',
|
|
28
|
-
html: '<div>{"systemCode":"SSO","apiUrl":"user/hello","transactionName":"add user","dbName":"Prod","tableName":"sso_users","dataBefore":"{\\"users\\":[]}","dataAfter":"{\\"users\\":[\\"budi\\",\\"rudi\\",\\"dido\\"]}","performAt":"2023-07-04T00:00:00.000Z","note":"test"}</div>',
|
|
29
|
-
};
|
|
30
|
-
afterEach(() => {
|
|
31
|
-
jest.clearAllMocks();
|
|
32
|
-
});
|
|
33
|
-
describe('log', () => {
|
|
34
|
-
const logData = {
|
|
35
|
-
duration: 1000,
|
|
36
|
-
from: from,
|
|
37
|
-
to: 'to@to.com',
|
|
38
|
-
cc: '',
|
|
39
|
-
subject: 'test email',
|
|
40
|
-
rawContent: 'test',
|
|
41
|
-
date: new Date(),
|
|
42
|
-
status: src_1.EmailStatus.Sent,
|
|
43
|
-
};
|
|
44
|
-
it('should create new log folder if none exist', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
jest.spyOn(fs, 'existsSync').mockReturnValueOnce(false);
|
|
46
|
-
jest.spyOn(fs, 'mkdirSync').mockReturnValueOnce(null);
|
|
47
|
-
jest.spyOn(fs, 'appendFileSync').mockReturnValueOnce(null);
|
|
48
|
-
src_1.MailerBase.log(logData);
|
|
49
|
-
expect(fs.existsSync).toHaveBeenCalledTimes(1);
|
|
50
|
-
expect(fs.existsSync).toHaveBeenCalledWith(path.join(process.cwd(), 'mail-log'));
|
|
51
|
-
expect(fs.mkdirSync).toHaveBeenCalledTimes(1);
|
|
52
|
-
expect(fs.mkdirSync).toHaveBeenCalledWith(path.join(process.cwd(), 'mail-log'));
|
|
53
|
-
expect(fs.appendFileSync).toHaveBeenCalledTimes(1);
|
|
54
|
-
}));
|
|
55
|
-
it('should create new log file in existing log folder', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
const existSyncMock = jest
|
|
57
|
-
.spyOn(fs, 'existsSync')
|
|
58
|
-
.mockReturnValueOnce(true);
|
|
59
|
-
jest.spyOn(fs, 'mkdirSync').mockReturnValueOnce(null);
|
|
60
|
-
jest.spyOn(fs, 'appendFileSync').mockReturnValueOnce(null);
|
|
61
|
-
src_1.MailerBase.log(logData);
|
|
62
|
-
expect(existSyncMock).toHaveBeenCalledTimes(1);
|
|
63
|
-
expect(fs.mkdirSync).toHaveBeenCalledTimes(0);
|
|
64
|
-
}));
|
|
65
|
-
});
|
|
66
|
-
describe('send', () => {
|
|
67
|
-
it('should send email successfully and create log transaction', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
jest
|
|
69
|
-
.spyOn(config_1.ComponentConfig, 'getComponentConfigValue')
|
|
70
|
-
.mockImplementationOnce(() => true);
|
|
71
|
-
const sendMailMock = jest
|
|
72
|
-
.spyOn(mailer, 'sendMail')
|
|
73
|
-
.mockResolvedValueOnce();
|
|
74
|
-
const log = jest
|
|
75
|
-
.spyOn(src_1.MailerBase, 'log')
|
|
76
|
-
.mockImplementationOnce(() => Promise.resolve());
|
|
77
|
-
const options = {
|
|
78
|
-
from,
|
|
79
|
-
to,
|
|
80
|
-
subject,
|
|
81
|
-
html,
|
|
82
|
-
};
|
|
83
|
-
yield mailer.send({
|
|
84
|
-
from: from,
|
|
85
|
-
to: to,
|
|
86
|
-
subject: subject,
|
|
87
|
-
html: html,
|
|
88
|
-
});
|
|
89
|
-
expect(sendMailMock).toHaveBeenCalledTimes(1);
|
|
90
|
-
expect(sendMailMock).toHaveBeenCalledWith(options);
|
|
91
|
-
expect(log).toHaveBeenCalledTimes(1);
|
|
92
|
-
}));
|
|
93
|
-
it('should send email successfully and not create log transaction', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
jest
|
|
95
|
-
.spyOn(config_1.ComponentConfig, 'getComponentConfigValue')
|
|
96
|
-
.mockImplementationOnce(() => false);
|
|
97
|
-
const sendMailMock = jest
|
|
98
|
-
.spyOn(mailer, 'sendMail')
|
|
99
|
-
.mockResolvedValueOnce();
|
|
100
|
-
const log = jest
|
|
101
|
-
.spyOn(src_1.MailerBase, 'log')
|
|
102
|
-
.mockImplementationOnce(() => Promise.resolve());
|
|
103
|
-
const options = {
|
|
104
|
-
from,
|
|
105
|
-
to,
|
|
106
|
-
subject,
|
|
107
|
-
html,
|
|
108
|
-
};
|
|
109
|
-
yield mailer.send({
|
|
110
|
-
from: from,
|
|
111
|
-
to: to,
|
|
112
|
-
subject: subject,
|
|
113
|
-
html: html,
|
|
114
|
-
});
|
|
115
|
-
expect(sendMailMock).toHaveBeenCalledTimes(1);
|
|
116
|
-
expect(sendMailMock).toHaveBeenCalledWith(options);
|
|
117
|
-
expect(log).toHaveBeenCalledTimes(0);
|
|
118
|
-
}));
|
|
119
|
-
});
|
|
120
|
-
describe('sendMail', () => {
|
|
121
|
-
it('should send email successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
-
const sendMailMock = jest.fn();
|
|
123
|
-
jest.spyOn(smtp_mailer_1.nodemailer, 'createTransport').mockReturnValueOnce({
|
|
124
|
-
sendMail: sendMailMock
|
|
125
|
-
});
|
|
126
|
-
jest
|
|
127
|
-
.spyOn(config_1.ComponentConfig, 'getComponentConfigValue')
|
|
128
|
-
.mockImplementation((componentName, configKey) => {
|
|
129
|
-
if (componentName !== '@tomei/mailer') {
|
|
130
|
-
throw new Error('Invalid component name');
|
|
131
|
-
}
|
|
132
|
-
if (configKey == 'port') {
|
|
133
|
-
return 587;
|
|
134
|
-
}
|
|
135
|
-
else if (configKey == 'secure') {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
return 'smtp.gmail.com';
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
yield mailer.sendMail(expectedResult);
|
|
143
|
-
expect(sendMailMock).toHaveBeenCalledTimes(1);
|
|
144
|
-
expect(sendMailMock).toHaveBeenCalledWith(expectedResult);
|
|
145
|
-
}));
|
|
146
|
-
});
|
|
147
|
-
describe('logTransaction', () => {
|
|
148
|
-
const before = { users: [] };
|
|
149
|
-
const after = { users: ['budi', 'rudi', 'dido'] };
|
|
150
|
-
const options = {
|
|
151
|
-
options: {
|
|
152
|
-
from: from,
|
|
153
|
-
to: 'recipients@mail.com',
|
|
154
|
-
subject: 'test email',
|
|
155
|
-
},
|
|
156
|
-
logData: {
|
|
157
|
-
systemCode: 'SSO',
|
|
158
|
-
apiUrl: 'user/hello',
|
|
159
|
-
transactionName: 'add user',
|
|
160
|
-
dbName: 'Prod',
|
|
161
|
-
tableName: 'sso_users',
|
|
162
|
-
dataBefore: JSON.stringify(before),
|
|
163
|
-
dataAfter: JSON.stringify(after),
|
|
164
|
-
performAt: new Date('2023-07-04'),
|
|
165
|
-
note: 'test',
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
it('should send transactionLog successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
-
const sendMailMock = jest
|
|
170
|
-
.spyOn(mailer, 'sendMail')
|
|
171
|
-
.mockResolvedValueOnce();
|
|
172
|
-
const log = jest
|
|
173
|
-
.spyOn(src_1.MailerBase, 'log')
|
|
174
|
-
.mockImplementationOnce(() => Promise.resolve());
|
|
175
|
-
yield mailer.logTransaction(options);
|
|
176
|
-
const expectedResult = {
|
|
177
|
-
from,
|
|
178
|
-
cc: '',
|
|
179
|
-
to: 'recipients@mail.com',
|
|
180
|
-
subject: 'test email',
|
|
181
|
-
html: '<div>{"systemCode":"SSO","apiUrl":"user/hello","transactionName":"add user","dbName":"Prod","tableName":"sso_users","dataBefore":"{\\"users\\":[]}","dataAfter":"{\\"users\\":[\\"budi\\",\\"rudi\\",\\"dido\\"]}","performAt":"2023-07-04T00:00:00.000Z","note":"test"}</div>',
|
|
182
|
-
};
|
|
183
|
-
expect(sendMailMock).toHaveBeenCalledTimes(1);
|
|
184
|
-
expect(sendMailMock).toHaveBeenCalledWith(expectedResult);
|
|
185
|
-
expect(log).toBeCalledTimes(1);
|
|
186
|
-
}));
|
|
187
|
-
it('should retry send when the first one failed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
|
-
const sendMailMock = jest
|
|
189
|
-
.spyOn(mailer, 'sendMail')
|
|
190
|
-
.mockRejectedValue(new Error('error'));
|
|
191
|
-
const log = jest
|
|
192
|
-
.spyOn(src_1.MailerBase, 'log')
|
|
193
|
-
.mockImplementationOnce(() => Promise.resolve());
|
|
194
|
-
yield mailer.logTransaction(options);
|
|
195
|
-
expect(sendMailMock).toHaveBeenCalledTimes(2);
|
|
196
|
-
expect(log).toBeCalledTimes(1);
|
|
197
|
-
}));
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
//# sourceMappingURL=mailer.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mailer.spec.js","sourceRoot":"","sources":["../../../../__tests__/unit/mailer/mailer.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAmE;AACnE,0CAAgD;AAChD,yBAAyB;AACzB,6BAA6B;AAC7B,iEAA4D;AAE5D,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,MAAM,GAAG,IAAI,gBAAU,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,eAAe,CAAC;IAC7B,MAAM,EAAE,GAAG,qBAAqB,CAAC;IACjC,MAAM,OAAO,GAAG,cAAc,CAAC;IAC/B,MAAM,IAAI,GAAG,cAAc,CAAC;IAC5B,MAAM,cAAc,GAAG;QACrB,IAAI;QACJ,EAAE,EAAE,EAAE;QACN,EAAE,EAAE,qBAAqB;QACzB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,gRAAgR;KACvR,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,IAAI;YACd,IA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C;iBACxB,sBAAsB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAEnD,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACrC,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src';
|
package/dist/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./src"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailStatus = void 0;
|
|
4
|
-
var EmailStatus;
|
|
5
|
-
(function (EmailStatus) {
|
|
6
|
-
EmailStatus["Sent"] = "Sent";
|
|
7
|
-
EmailStatus["Failed"] = "Failed";
|
|
8
|
-
})(EmailStatus || (exports.EmailStatus = EmailStatus = {}));
|
|
9
|
-
//# sourceMappingURL=email-status.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-status.enum.js","sourceRoot":"","sources":["../../../src/enum/email-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
|
package/dist/src/enum/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EmailStatus } from './email-status.enum';
|
package/dist/src/enum/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailStatus = void 0;
|
|
4
|
-
var email_status_enum_1 = require("./email-status.enum");
|
|
5
|
-
Object.defineProperty(exports, "EmailStatus", { enumerable: true, get: function () { return email_status_enum_1.EmailStatus; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enum/index.ts"],"names":[],"mappings":";;;AAAA,yDAAkD;AAAzC,gHAAA,WAAW,OAAA"}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./enum"), exports);
|
|
18
|
-
__exportStar(require("./mailer"), exports);
|
|
19
|
-
__exportStar(require("./interfaces"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface ILogTransactionOption {
|
|
2
|
-
options: {
|
|
3
|
-
from: string;
|
|
4
|
-
to: string;
|
|
5
|
-
subject: string;
|
|
6
|
-
};
|
|
7
|
-
logData: {
|
|
8
|
-
systemCode: string;
|
|
9
|
-
apiUrl: string;
|
|
10
|
-
transactionName: string;
|
|
11
|
-
dbName: string;
|
|
12
|
-
tableName: string;
|
|
13
|
-
dataBefore: string;
|
|
14
|
-
dataAfter: string;
|
|
15
|
-
performAt: Date;
|
|
16
|
-
note: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log-transaction-options.interface.js","sourceRoot":"","sources":["../../../src/interfaces/log-transaction-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mail-config.interface.js","sourceRoot":"","sources":["../../../src/interfaces/mail-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mail-log.interface.js","sourceRoot":"","sources":["../../../src/interfaces/mail-log.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateLogTransactionHTML: (tableContent: any) => string;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateLogTransactionHTML = void 0;
|
|
4
|
-
const generateLogTransactionHTML = (tableContent) => {
|
|
5
|
-
const introductionText = `
|
|
6
|
-
<p>
|
|
7
|
-
As part of our organization's data management practices, this email contains a snapshot of the database transaction data. This data comprises a record of recent transactions that have occurred within our system, including updates, insertions, and deletions. It serves as a critical piece in our backup process, allowing us to restore the database to a specific point in time if necessary
|
|
8
|
-
</p>
|
|
9
|
-
<p> </p>
|
|
10
|
-
`;
|
|
11
|
-
let table = '';
|
|
12
|
-
for (const key in tableContent) {
|
|
13
|
-
const tmp = `
|
|
14
|
-
<tr>
|
|
15
|
-
<td style="text-align:center" >
|
|
16
|
-
<strong>${key}</strong>
|
|
17
|
-
</td>
|
|
18
|
-
<td>
|
|
19
|
-
<p>${tableContent[key]}</p>
|
|
20
|
-
</td>
|
|
21
|
-
</tr>
|
|
22
|
-
`;
|
|
23
|
-
table = table.concat(tmp);
|
|
24
|
-
}
|
|
25
|
-
table = `
|
|
26
|
-
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
|
|
27
|
-
<tbody>
|
|
28
|
-
${table}
|
|
29
|
-
</tbody>
|
|
30
|
-
</table>
|
|
31
|
-
`;
|
|
32
|
-
const content = introductionText.concat(table);
|
|
33
|
-
return content;
|
|
34
|
-
};
|
|
35
|
-
exports.generateLogTransactionHTML = generateLogTransactionHTML;
|
|
36
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/mailer/helpers/helpers.ts"],"names":[],"mappings":";;;AAAO,MAAM,0BAA0B,GAAG,CAAC,YAAiB,EAAE,EAAE;IAC9D,MAAM,gBAAgB,GAAG;;;;;KAKtB,CAAC;IACJ,IAAI,KAAK,GAAW,EAAE,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;QAC9B,MAAM,GAAG,GAAG;;;oBAGI,GAAG;;;eAGR,YAAY,CAAC,GAAG,CAAC;;;OAGzB,CAAC;QACJ,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC3B;IAED,KAAK,GAAG;;;QAGF,KAAK;;;KAGR,CAAC;IACJ,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE/C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAjCW,QAAA,0BAA0B,8BAiCrC"}
|
package/dist/src/mailer/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SMTPMailer = exports.MailerBase = void 0;
|
|
4
|
-
var mailer_base_1 = require("./mailer.base");
|
|
5
|
-
Object.defineProperty(exports, "MailerBase", { enumerable: true, get: function () { return mailer_base_1.MailerBase; } });
|
|
6
|
-
var smtp_mailer_1 = require("./smtp-mailer");
|
|
7
|
-
Object.defineProperty(exports, "SMTPMailer", { enumerable: true, get: function () { return smtp_mailer_1.SMTPMailer; } });
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mailer/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IMailLog } from 'src/interfaces/mail-log.interface';
|
|
2
|
-
import { ILogTransactionOption } from '../interfaces/log-transaction-options.interface';
|
|
3
|
-
import { ISendMailConfig } from '../interfaces/mail-config.interface';
|
|
4
|
-
export declare abstract class MailerBase {
|
|
5
|
-
abstract sendMail(options: any): Promise<any>;
|
|
6
|
-
send(options: ISendMailConfig): Promise<any>;
|
|
7
|
-
logTransaction(logOptions: ILogTransactionOption): Promise<void>;
|
|
8
|
-
static log(mailLogOptions: IMailLog): void;
|
|
9
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MailerBase = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
const email_status_enum_1 = require("../enum/email-status.enum");
|
|
16
|
-
const config_1 = require("@tomei/config");
|
|
17
|
-
class MailerBase {
|
|
18
|
-
send(options) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const start = Date.now();
|
|
21
|
-
let status;
|
|
22
|
-
try {
|
|
23
|
-
yield this.sendMail(options);
|
|
24
|
-
status = email_status_enum_1.EmailStatus.Sent;
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
status = email_status_enum_1.EmailStatus.Failed;
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
const duration = Date.now() - start;
|
|
31
|
-
const isLogEnabled = config_1.ComponentConfig.getComponentConfigValue('@tomei/mailer', 'isLogEnabled');
|
|
32
|
-
if (isLogEnabled) {
|
|
33
|
-
MailerBase.log({
|
|
34
|
-
duration,
|
|
35
|
-
from: options.from,
|
|
36
|
-
to: typeof options.to === 'string' ? options.to : options.to.join(','),
|
|
37
|
-
cc: typeof options.cc === 'string'
|
|
38
|
-
? options.cc
|
|
39
|
-
: options.cc
|
|
40
|
-
? options.cc.join(',')
|
|
41
|
-
: '',
|
|
42
|
-
subject: options.subject,
|
|
43
|
-
rawContent: options.html,
|
|
44
|
-
date: new Date(),
|
|
45
|
-
status: status,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
logTransaction(logOptions) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const startTime = new Date().getTime();
|
|
54
|
-
let endTime;
|
|
55
|
-
const options = {
|
|
56
|
-
from: logOptions.options.from,
|
|
57
|
-
to: logOptions.options.to,
|
|
58
|
-
subject: logOptions.options.subject,
|
|
59
|
-
html: `<div>${JSON.stringify(logOptions.logData)}</div>`,
|
|
60
|
-
cc: '',
|
|
61
|
-
};
|
|
62
|
-
let result;
|
|
63
|
-
try {
|
|
64
|
-
yield this.sendMail(options);
|
|
65
|
-
result = email_status_enum_1.EmailStatus.Sent;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
try {
|
|
69
|
-
console.info('Retry to send mail');
|
|
70
|
-
yield this.sendMail(options);
|
|
71
|
-
}
|
|
72
|
-
catch (retryError) {
|
|
73
|
-
result = email_status_enum_1.EmailStatus.Failed;
|
|
74
|
-
console.error(retryError);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
endTime = new Date().getTime();
|
|
79
|
-
const duration = endTime - startTime;
|
|
80
|
-
const mailLogOptions = {
|
|
81
|
-
duration,
|
|
82
|
-
from: options.from,
|
|
83
|
-
to: options.to,
|
|
84
|
-
cc: '',
|
|
85
|
-
subject: options.subject,
|
|
86
|
-
rawContent: options.html,
|
|
87
|
-
date: new Date(),
|
|
88
|
-
status: result,
|
|
89
|
-
};
|
|
90
|
-
MailerBase.log(mailLogOptions);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
static log(mailLogOptions) {
|
|
95
|
-
try {
|
|
96
|
-
const logFolderPath = path.join(process.cwd(), 'mail-log');
|
|
97
|
-
if (!fs.existsSync(logFolderPath)) {
|
|
98
|
-
fs.mkdirSync(logFolderPath);
|
|
99
|
-
}
|
|
100
|
-
const currentDate = new Date();
|
|
101
|
-
const formattedDate = currentDate.toISOString().slice(0, 10);
|
|
102
|
-
const logFileName = `${formattedDate}.log`;
|
|
103
|
-
const logFilePath = path.join(logFolderPath, logFileName);
|
|
104
|
-
const stringData = JSON.stringify(mailLogOptions);
|
|
105
|
-
fs.appendFileSync(logFilePath, '\n' + stringData);
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
throw new Error('Error occurred while logging mail');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.MailerBase = MailerBase;
|
|
113
|
-
//# sourceMappingURL=mailer.base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mailer.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AAE,IAAI,IAAI,EAAE;oBAChB,MAAM,EAAE,MAAM;iBACf,CAAC;gBACF,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aAChC;QACH,CAAC;KAAA;IAED,MAAM,CAAC,GAAG,CAAC,cAAwB;QACjC,IAAI;YACF,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;YAE3D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;gBACjC,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;aAC7B;YAED,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;YAC/B,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7D,MAAM,WAAW,GAAG,GAAG,aAAa,MAAM,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAElD,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC;SACnD;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;IACH,CAAC;CACF;AArGD,gCAqGC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MailerBase } from './mailer.base';
|
|
2
|
-
import * as nodemailer from 'nodemailer';
|
|
3
|
-
import { ISendMailConfig } from 'src/interfaces/mail-config.interface';
|
|
4
|
-
export declare class SMTPMailer extends MailerBase {
|
|
5
|
-
sendMail(options: ISendMailConfig): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export { nodemailer };
|