@servicelabsco/nestjs-utility-services 1.2.91 → 1.2.92

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 (55) hide show
  1. package/dist/migrations/1710834052315-AddTrackingIdentifierSysMailLogsTable.d.ts +5 -0
  2. package/dist/migrations/1710834052315-AddTrackingIdentifierSysMailLogsTable.js +17 -0
  3. package/dist/migrations/1710834052315-AddTrackingIdentifierSysMailLogsTable.js.map +1 -0
  4. package/dist/platformUtility/dtos/mail.options.dto.d.ts +1 -0
  5. package/dist/platformUtility/dtos/mail.options.dto.js +5 -0
  6. package/dist/platformUtility/dtos/mail.options.dto.js.map +1 -1
  7. package/dist/platformUtility/es6.classes.d.ts +7 -3
  8. package/dist/platformUtility/es6.classes.js +9 -1
  9. package/dist/platformUtility/es6.classes.js.map +1 -1
  10. package/dist/platformUtility/jobs/index.d.ts +2 -0
  11. package/dist/platformUtility/jobs/index.js +2 -0
  12. package/dist/platformUtility/jobs/index.js.map +1 -1
  13. package/dist/platformUtility/jobs/process.ses.delivery.webhook.job.d.ts +9 -0
  14. package/dist/platformUtility/jobs/process.ses.delivery.webhook.job.js +41 -0
  15. package/dist/platformUtility/jobs/process.ses.delivery.webhook.job.js.map +1 -0
  16. package/dist/platformUtility/jobs/process.tracking.webhook.job.d.ts +8 -0
  17. package/dist/platformUtility/jobs/process.tracking.webhook.job.js +51 -0
  18. package/dist/platformUtility/jobs/process.tracking.webhook.job.js.map +1 -0
  19. package/dist/platformUtility/libraries/index.d.ts +2 -0
  20. package/dist/platformUtility/libraries/index.js +2 -0
  21. package/dist/platformUtility/libraries/index.js.map +1 -1
  22. package/dist/platformUtility/libraries/process.common.mail.d.ts +1 -0
  23. package/dist/platformUtility/libraries/process.common.mail.js +9 -0
  24. package/dist/platformUtility/libraries/process.common.mail.js.map +1 -1
  25. package/dist/platformUtility/libraries/process.common.ses.mail.d.ts +15 -0
  26. package/dist/platformUtility/libraries/process.common.ses.mail.js +40 -0
  27. package/dist/platformUtility/libraries/process.common.ses.mail.js.map +1 -0
  28. package/dist/platformUtility/libraries/process.common.smtp.mail.d.ts +6 -3
  29. package/dist/platformUtility/libraries/process.common.smtp.mail.js +0 -38
  30. package/dist/platformUtility/libraries/process.common.smtp.mail.js.map +1 -1
  31. package/dist/platformUtility/libraries/process.ses.mail.d.ts +13 -4
  32. package/dist/platformUtility/libraries/process.ses.mail.js +74 -6
  33. package/dist/platformUtility/libraries/process.ses.mail.js.map +1 -1
  34. package/dist/platformUtility/libraries/process.ses.raw.mail.d.ts +30 -0
  35. package/dist/platformUtility/libraries/process.ses.raw.mail.js +124 -0
  36. package/dist/platformUtility/libraries/process.ses.raw.mail.js.map +1 -0
  37. package/dist/platformUtility/libraries/process.smtp.mail.d.ts +9 -2
  38. package/dist/platformUtility/libraries/process.smtp.mail.js +68 -5
  39. package/dist/platformUtility/libraries/process.smtp.mail.js.map +1 -1
  40. package/dist/platformUtility/services/es6.jobs.service.d.ts +5 -1
  41. package/dist/platformUtility/services/es6.jobs.service.js +9 -1
  42. package/dist/platformUtility/services/es6.jobs.service.js.map +1 -1
  43. package/dist/platformUtility/services/index.d.ts +1 -0
  44. package/dist/platformUtility/services/index.js +1 -0
  45. package/dist/platformUtility/services/index.js.map +1 -1
  46. package/dist/platformUtility/services/mail.service.d.ts +4 -1
  47. package/dist/platformUtility/services/mail.service.js +24 -10
  48. package/dist/platformUtility/services/mail.service.js.map +1 -1
  49. package/dist/platformUtility/services/ses.mail.notification.service.d.ts +10 -0
  50. package/dist/platformUtility/services/ses.mail.notification.service.js +51 -0
  51. package/dist/platformUtility/services/ses.mail.notification.service.js.map +1 -0
  52. package/dist/system/entities/mail.log.entity.d.ts +3 -0
  53. package/dist/system/entities/mail.log.entity.js +12 -0
  54. package/dist/system/entities/mail.log.entity.js.map +1 -1
  55. package/package.json +4 -2
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SesMailNotificationService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const mail_log_entity_1 = require("../../system/entities/mail.log.entity");
15
+ let SesMailNotificationService = class SesMailNotificationService {
16
+ constructor() { }
17
+ async getNotificationPayload(payload) {
18
+ if (payload.Type !== 'Notification')
19
+ return;
20
+ const notificationPayload = JSON.parse(payload.Message);
21
+ let identifier = notificationPayload.mail.headers.find((header) => header.name === 'References')?.value;
22
+ if (!identifier)
23
+ identifier = notificationPayload.mail.messageId;
24
+ if (!identifier)
25
+ return;
26
+ let mailLogEntity = await mail_log_entity_1.MailLogEntity.findOne({ where: { identifier: identifier } });
27
+ if (!mailLogEntity)
28
+ return;
29
+ return { notificationPayload, mailLogEntity };
30
+ }
31
+ async processSesDeliveryData(notificationPayload, mailLogEntity) {
32
+ const deliveries = mailLogEntity.tracking_attributes?.deliveries || [];
33
+ const data = { emails: notificationPayload.delivery.recipients, delivered_at: notificationPayload.delivery.timestamp };
34
+ deliveries.push(data);
35
+ mailLogEntity.tracking_attributes = { ...mailLogEntity.tracking_attributes, deliveries };
36
+ return mailLogEntity.save();
37
+ }
38
+ async processSesBounceData(notificationPayload, mailLogEntity) {
39
+ const data = { emails: notificationPayload.bounce.bouncedRecipients, bounced_at: notificationPayload.bounce.timestamp };
40
+ const bounces = mailLogEntity.tracking_attributes?.bounces || [];
41
+ bounces.push(data);
42
+ mailLogEntity.tracking_attributes = { ...mailLogEntity.tracking_attributes, bounces };
43
+ return mailLogEntity.save();
44
+ }
45
+ };
46
+ exports.SesMailNotificationService = SesMailNotificationService;
47
+ exports.SesMailNotificationService = SesMailNotificationService = __decorate([
48
+ (0, common_1.Injectable)(),
49
+ __metadata("design:paramtypes", [])
50
+ ], SesMailNotificationService);
51
+ //# sourceMappingURL=ses.mail.notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses.mail.notification.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/ses.mail.notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,2EAAsE;AAQ/D,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACnC,gBAAe,CAAC;IAEhB,KAAK,CAAC,sBAAsB,CAAC,OAAY;QACrC,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc;YAAE,OAAO;QAE5C,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAExD,IAAI,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,KAAK,CAAC;QAExG,IAAI,CAAC,UAAU;YAAE,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC;QAEjE,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,IAAI,aAAa,GAAG,MAAM,+BAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QAEvF,IAAI,CAAC,aAAa;YAAE,OAAO;QAE3B,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,mBAAwB,EAAE,aAA4B;QAC/E,MAAM,UAAU,GAAU,aAAa,CAAC,mBAAmB,EAAE,UAAU,IAAI,EAAE,CAAC;QAE9E,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,EAAE,mBAAmB,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;QAEvH,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtB,aAAa,CAAC,mBAAmB,GAAG,EAAE,GAAG,aAAa,CAAC,mBAAmB,EAAE,UAAU,EAAE,CAAC;QAEzF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,mBAAwB,EAAE,aAA4B;QAC7E,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAExH,MAAM,OAAO,GAAU,aAAa,CAAC,mBAAmB,EAAE,OAAO,IAAI,EAAE,CAAC;QAExE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnB,aAAa,CAAC,mBAAmB,GAAG,EAAE,GAAG,aAAa,CAAC,mBAAmB,EAAE,OAAO,EAAE,CAAC;QAEtF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CACJ,CAAA;AA5CY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;;GACA,0BAA0B,CA4CtC"}
@@ -4,10 +4,13 @@ export declare class MailLogEntity extends CommonEntity {
4
4
  source_id: number;
5
5
  gateway: string;
6
6
  identifier: string;
7
+ tracking_identifier: string;
7
8
  body: string;
8
9
  subject: string;
9
10
  processed_on: Date;
10
11
  delivered_on: Date;
11
12
  opened_on: Date;
13
+ last_opened_at: Date;
12
14
  attributes: any;
15
+ tracking_attributes: any;
13
16
  }
@@ -31,6 +31,10 @@ __decorate([
31
31
  (0, typeorm_1.Column)(),
32
32
  __metadata("design:type", String)
33
33
  ], MailLogEntity.prototype, "identifier", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)(),
36
+ __metadata("design:type", String)
37
+ ], MailLogEntity.prototype, "tracking_identifier", void 0);
34
38
  __decorate([
35
39
  (0, typeorm_1.Column)(),
36
40
  __metadata("design:type", String)
@@ -51,10 +55,18 @@ __decorate([
51
55
  (0, typeorm_1.Column)(),
52
56
  __metadata("design:type", Date)
53
57
  ], MailLogEntity.prototype, "opened_on", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.Column)(),
60
+ __metadata("design:type", Date)
61
+ ], MailLogEntity.prototype, "last_opened_at", void 0);
54
62
  __decorate([
55
63
  (0, typeorm_1.Column)('json'),
56
64
  __metadata("design:type", Object)
57
65
  ], MailLogEntity.prototype, "attributes", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)('json'),
68
+ __metadata("design:type", Object)
69
+ ], MailLogEntity.prototype, "tracking_attributes", void 0);
58
70
  exports.MailLogEntity = MailLogEntity = __decorate([
59
71
  (0, typeorm_1.Entity)('sys_mail_logs')
60
72
  ], MailLogEntity);
@@ -1 +1 @@
1
- {"version":3,"file":"mail.log.entity.js","sourceRoot":"","sources":["../../../src/system/entities/mail.log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,0EAAsE;AAS/D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAY;CAgC9C,CAAA;AAhCY,sCAAa;AAEtB;IADC,IAAA,gBAAM,GAAE;;kDACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;gDACS;AAGlB;IADC,IAAA,gBAAM,GAAE;;8CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;iDACU;AAGnB;IADC,IAAA,gBAAM,GAAE;;2CACI;AAGb;IADC,IAAA,gBAAM,GAAE;;8CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;8BACK,IAAI;mDAAC;AAGnB;IADC,IAAA,gBAAM,GAAE;8BACK,IAAI;mDAAC;AAGnB;IADC,IAAA,gBAAM,GAAE;8BACE,IAAI;gDAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;iDACC;wBA7BP,aAAa;IADzB,IAAA,gBAAM,EAAC,eAAe,CAAC;GACX,aAAa,CAgCzB"}
1
+ {"version":3,"file":"mail.log.entity.js","sourceRoot":"","sources":["../../../src/system/entities/mail.log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,0EAAsE;AAS/D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAY;CAyC9C,CAAA;AAzCY,sCAAa;AAEtB;IADC,IAAA,gBAAM,GAAE;;kDACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;gDACS;AAGlB;IADC,IAAA,gBAAM,GAAE;;8CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;iDACU;AAGnB;IADC,IAAA,gBAAM,GAAE;;0DACmB;AAG5B;IADC,IAAA,gBAAM,GAAE;;2CACI;AAGb;IADC,IAAA,gBAAM,GAAE;;8CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;8BACK,IAAI;mDAAC;AAGnB;IADC,IAAA,gBAAM,GAAE;8BACK,IAAI;mDAAC;AAGnB;IADC,IAAA,gBAAM,GAAE;8BACE,IAAI;gDAAC;AAGhB;IADC,IAAA,gBAAM,GAAE;8BACO,IAAI;qDAAC;AAGrB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;iDACC;AAGhB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;0DACU;wBAtChB,aAAa;IADzB,IAAA,gBAAM,EAAC,eAAe,CAAC;GACX,aAAa,CAyCzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicelabsco/nestjs-utility-services",
3
- "version": "1.2.91",
3
+ "version": "1.2.92",
4
4
  "description": "NestJS generic packages to support development",
5
5
  "author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
6
6
  "license": "MIT",
@@ -31,7 +31,8 @@
31
31
  "m:c": "./node_modules/.bin/ts-node ./node_modules/.bin/typeorm migration:create -d src/config/orm.config.ts",
32
32
  "m:rev": "./node_modules/.bin/ts-node ./node_modules/.bin/typeorm migration:revert -d src/config/orm.config.ts",
33
33
  "command": "npx nestjs-command",
34
- "console": "node dist/console.js"
34
+ "console": "node dist/console.js",
35
+ "save": "bash ./commit.sh"
35
36
  },
36
37
  "keywords": [
37
38
  "nestjs"
@@ -48,6 +49,7 @@
48
49
  "@aws-sdk/client-dynamodb": "^3.414.0",
49
50
  "@aws-sdk/client-s3": "^3.414.0",
50
51
  "@aws-sdk/client-secrets-manager": "^3.433.0",
52
+ "@aws-sdk/client-ses": "^3.556.0",
51
53
  "@aws-sdk/client-sqs": "^3.414.0",
52
54
  "@aws-sdk/lib-storage": "^3.414.0",
53
55
  "@aws-sdk/s3-request-presigner": "^3.414.0",