@tomei/mailer 1.0.1 → 1.1.0-test.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.
Files changed (53) hide show
  1. package/.gitlab-ci.yml +237 -16
  2. package/.husky/commit-msg +15 -15
  3. package/.husky/pre-commit +0 -0
  4. package/dist/src/interfaces/mail-config.interface.d.ts +1 -0
  5. package/dist/src/mailer/helpers/helpers.spec.js +31 -0
  6. package/dist/src/mailer/helpers/helpers.spec.js.map +1 -0
  7. package/dist/src/mailer/index.d.ts +1 -1
  8. package/dist/src/mailer/index.js.map +1 -1
  9. package/dist/src/mailer/mailer.base.d.ts +3 -0
  10. package/dist/src/mailer/mailer.base.js +3 -0
  11. package/dist/src/mailer/mailer.base.js.map +1 -1
  12. package/dist/src/mailer/smtp-mailer.js +12 -0
  13. package/dist/src/mailer/smtp-mailer.js.map +1 -1
  14. package/dist/tsconfig.tsbuildinfo +1 -1
  15. package/eslint.config.mjs +58 -58
  16. package/jest.config.js +3 -0
  17. package/package.json +47 -47
  18. package/sonar-project.properties +12 -12
  19. package/src/enum/email-status.enum.ts +4 -4
  20. package/src/enum/index.ts +1 -1
  21. package/src/interfaces/EmailLog.ts +91 -91
  22. package/src/interfaces/IEmailRepository.ts +15 -15
  23. package/src/interfaces/log-transaction-options.interface.ts +18 -18
  24. package/src/interfaces/mail-config.interface.ts +9 -8
  25. package/src/interfaces/mail-log.interface.ts +12 -12
  26. package/src/mailer/helpers/helpers.spec.ts +32 -0
  27. package/src/mailer/index.ts +2 -2
  28. package/src/mailer/mailer.base.ts +123 -110
  29. package/src/mailer/smtp-mailer.ts +142 -121
  30. package/dist/__tests__/unit/infrastructure/repositories/file-system-mail-log.repository.spec.js +0 -47
  31. package/dist/__tests__/unit/infrastructure/repositories/file-system-mail-log.repository.spec.js.map +0 -1
  32. package/dist/src/core/entity/email-log.entity.d.ts +0 -35
  33. package/dist/src/core/entity/email-log.entity.js +0 -43
  34. package/dist/src/core/entity/email-log.entity.js.map +0 -1
  35. package/dist/src/core/enum/email-status.enum.d.ts +0 -5
  36. package/dist/src/core/enum/email-status.enum.js +0 -10
  37. package/dist/src/core/enum/email-status.enum.js.map +0 -1
  38. package/dist/src/core/index.d.ts +0 -4
  39. package/dist/src/core/index.js +0 -8
  40. package/dist/src/core/index.js.map +0 -1
  41. package/dist/src/core/interface/email-log.interface.d.ts +0 -18
  42. package/dist/src/core/interface/email-log.interface.js +0 -3
  43. package/dist/src/core/interface/email-log.interface.js.map +0 -1
  44. package/dist/src/core/interface/i-email-repository.d.ts +0 -16
  45. package/dist/src/core/interface/i-email-repository.js +0 -3
  46. package/dist/src/core/interface/i-email-repository.js.map +0 -1
  47. package/dist/src/domain/repositories/mail-log.repository.d.ts +0 -4
  48. package/dist/src/domain/repositories/mail-log.repository.js +0 -3
  49. package/dist/src/domain/repositories/mail-log.repository.js.map +0 -1
  50. package/dist/src/infrastructure/repositories/file-system-mail-log.repository.d.ts +0 -5
  51. package/dist/src/infrastructure/repositories/file-system-mail-log.repository.js +0 -26
  52. package/dist/src/infrastructure/repositories/file-system-mail-log.repository.js.map +0 -1
  53. /package/dist/{__tests__/unit/infrastructure/repositories/file-system-mail-log.repository.spec.d.ts → src/mailer/helpers/helpers.spec.d.ts} +0 -0
@@ -1,4 +0,0 @@
1
- export { EmailStatus } from './enum/email-status.enum';
2
- export { EmailLogInterface } from './interface/email-log.interface';
3
- export { EmailFilters, IEmailRepository } from './interface/i-email-repository';
4
- export { EmailLog } from './entity/email-log.entity';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailLog = exports.EmailStatus = void 0;
4
- var email_status_enum_1 = require("./enum/email-status.enum");
5
- Object.defineProperty(exports, "EmailStatus", { enumerable: true, get: function () { return email_status_enum_1.EmailStatus; } });
6
- var email_log_entity_1 = require("./entity/email-log.entity");
7
- Object.defineProperty(exports, "EmailLog", { enumerable: true, get: function () { return email_log_entity_1.EmailLog; } });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,8DAAuD;AAA9C,gHAAA,WAAW,OAAA;AAGpB,8DAAqD;AAA5C,4GAAA,QAAQ,OAAA"}
@@ -1,18 +0,0 @@
1
- import { EmailStatus } from "../enum/email-status.enum";
2
- export interface EmailLogInterface {
3
- id: string;
4
- recipient: string;
5
- subject: string;
6
- emailType: string;
7
- bodyHtml: string;
8
- bodyText: string;
9
- payload: string;
10
- status: EmailStatus;
11
- error?: string;
12
- sentAt: Date;
13
- createdAt: Date;
14
- updatedAt?: Date;
15
- resentFromId?: string;
16
- resendMethod?: string;
17
- resentById?: string;
18
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=email-log.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email-log.interface.js","sourceRoot":"","sources":["../../../../src/core/interface/email-log.interface.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { EmailLogInterface } from "./email-log.interface";
2
- import { EmailStatus } from "../enum/email-status.enum";
3
- export interface EmailFilters {
4
- status?: EmailStatus;
5
- search?: string;
6
- startDate?: Date;
7
- endDate?: Date;
8
- emailType?: string;
9
- resentFromId?: string;
10
- resendMethod?: string;
11
- resentById?: string;
12
- }
13
- export interface IEmailRepository {
14
- list(): Promise<EmailLogInterface[]>;
15
- list(filters: EmailFilters): Promise<EmailLogInterface[]>;
16
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=i-email-repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"i-email-repository.js","sourceRoot":"","sources":["../../../../src/core/interface/i-email-repository.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import { IMailLog } from '../../interfaces/mail-log.interface';
2
- export interface IMailLogRepository {
3
- save(log: IMailLog): Promise<void> | void;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=mail-log.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-log.repository.js","sourceRoot":"","sources":["../../../../src/domain/repositories/mail-log.repository.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { IMailLog } from '../../interfaces/mail-log.interface';
2
- import { IMailLogRepository } from '../../domain/repositories/mail-log.repository';
3
- export declare class FileSystemMailLogRepository implements IMailLogRepository {
4
- save(mailLogOptions: IMailLog): void;
5
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileSystemMailLogRepository = void 0;
4
- const fs = require("fs");
5
- const path = require("path");
6
- class FileSystemMailLogRepository {
7
- save(mailLogOptions) {
8
- try {
9
- const logFolderPath = path.join(process.cwd(), 'mail-log');
10
- if (!fs.existsSync(logFolderPath)) {
11
- fs.mkdirSync(logFolderPath);
12
- }
13
- const currentDate = new Date();
14
- const formattedDate = currentDate.toISOString().slice(0, 10);
15
- const logFileName = `${formattedDate}.log`;
16
- const logFilePath = path.join(logFolderPath, logFileName);
17
- const stringData = JSON.stringify(mailLogOptions);
18
- fs.appendFileSync(logFilePath, '\n' + stringData);
19
- }
20
- catch (error) {
21
- throw new Error('Error occurred while logging mail');
22
- }
23
- }
24
- }
25
- exports.FileSystemMailLogRepository = FileSystemMailLogRepository;
26
- //# sourceMappingURL=file-system-mail-log.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-system-mail-log.repository.js","sourceRoot":"","sources":["../../../../src/infrastructure/repositories/file-system-mail-log.repository.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAI7B,MAAa,2BAA2B;IACtC,IAAI,CAAC,cAAwB;QAC3B,IAAI,CAAC;YACH,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,CAAC;gBAClC,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;YAE/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;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF;AArBD,kEAqBC"}