@pristine-ts/aws 0.0.225 → 0.0.227

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 (46) hide show
  1. package/dist/lib/cjs/clients/clients.js +1 -0
  2. package/dist/lib/cjs/clients/clients.js.map +1 -1
  3. package/dist/lib/cjs/clients/ses.client.js +130 -0
  4. package/dist/lib/cjs/clients/ses.client.js.map +1 -0
  5. package/dist/lib/cjs/errors/errors.js +1 -0
  6. package/dist/lib/cjs/errors/errors.js.map +1 -1
  7. package/dist/lib/cjs/errors/ses-send.error.js +26 -0
  8. package/dist/lib/cjs/errors/ses-send.error.js.map +1 -0
  9. package/dist/lib/cjs/interfaces/interfaces.js +1 -0
  10. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
  11. package/dist/lib/cjs/interfaces/ses-client.interface.js +3 -0
  12. package/dist/lib/cjs/interfaces/ses-client.interface.js.map +1 -0
  13. package/dist/lib/cjs/models/email.model.js +7 -0
  14. package/dist/lib/cjs/models/email.model.js.map +1 -0
  15. package/dist/lib/cjs/models/models.js +1 -0
  16. package/dist/lib/cjs/models/models.js.map +1 -1
  17. package/dist/lib/cjs/models/ses-message-sent-confirmation.model.js +10 -0
  18. package/dist/lib/cjs/models/ses-message-sent-confirmation.model.js.map +1 -0
  19. package/dist/lib/esm/clients/clients.js +1 -0
  20. package/dist/lib/esm/clients/clients.js.map +1 -1
  21. package/dist/lib/esm/clients/ses.client.js +127 -0
  22. package/dist/lib/esm/clients/ses.client.js.map +1 -0
  23. package/dist/lib/esm/errors/errors.js +1 -0
  24. package/dist/lib/esm/errors/errors.js.map +1 -1
  25. package/dist/lib/esm/errors/ses-send.error.js +22 -0
  26. package/dist/lib/esm/errors/ses-send.error.js.map +1 -0
  27. package/dist/lib/esm/interfaces/interfaces.js +1 -0
  28. package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
  29. package/dist/lib/esm/interfaces/ses-client.interface.js +2 -0
  30. package/dist/lib/esm/interfaces/ses-client.interface.js.map +1 -0
  31. package/dist/lib/esm/models/email.model.js +3 -0
  32. package/dist/lib/esm/models/email.model.js.map +1 -0
  33. package/dist/lib/esm/models/models.js +1 -0
  34. package/dist/lib/esm/models/models.js.map +1 -1
  35. package/dist/lib/esm/models/ses-message-sent-confirmation.model.js +6 -0
  36. package/dist/lib/esm/models/ses-message-sent-confirmation.model.js.map +1 -0
  37. package/dist/types/clients/clients.d.ts +1 -0
  38. package/dist/types/clients/ses.client.d.ts +20 -0
  39. package/dist/types/errors/errors.d.ts +1 -0
  40. package/dist/types/errors/ses-send.error.d.ts +13 -0
  41. package/dist/types/interfaces/interfaces.d.ts +1 -0
  42. package/dist/types/interfaces/ses-client.interface.d.ts +31 -0
  43. package/dist/types/models/email.model.d.ts +29 -0
  44. package/dist/types/models/models.d.ts +1 -0
  45. package/dist/types/models/ses-message-sent-confirmation.model.d.ts +7 -0
  46. package/package.json +8 -7
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dynamodb.client"), exports);
18
18
  __exportStar(require("./event-bridge.client"), exports);
19
19
  __exportStar(require("./s3.client"), exports);
20
+ __exportStar(require("./ses.client"), exports);
20
21
  __exportStar(require("./sqs.client"), exports);
21
22
  //# sourceMappingURL=clients.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,8CAA4B;AAC5B,+CAA6B"}
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,8CAA4B;AAC5B,+CAA6B;AAC7B,+CAA6B"}
@@ -0,0 +1,130 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SesClient = void 0;
25
+ const aws_module_keyname_1 = require("../aws.module.keyname");
26
+ const common_1 = require("@pristine-ts/common");
27
+ const tsyringe_1 = require("tsyringe");
28
+ const client_ses_1 = require("@aws-sdk/client-ses");
29
+ const ses_send_error_1 = require("../errors/ses-send.error");
30
+ let SesClient = class SesClient {
31
+ /**
32
+ * The client to use to interact with AWS SES. It is a wrapper around the SESClient of @aws-sdk/client-ses.
33
+ * @param logHandler The log handler used to output logs.
34
+ * @param region The aws region for which the client will be used.
35
+ */
36
+ constructor(logHandler, region) {
37
+ this.logHandler = logHandler;
38
+ this.region = region;
39
+ }
40
+ getClient(endpoint) {
41
+ return new client_ses_1.SESClient({
42
+ region: this.region,
43
+ endpoint: endpoint !== null && endpoint !== void 0 ? endpoint : undefined,
44
+ });
45
+ }
46
+ sendTemplate(email, templateName, templateData, endpoint) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ try {
49
+ const client = this.getClient(endpoint);
50
+ const sendEmailCommand = new client_ses_1.SendTemplatedEmailCommand({
51
+ Source: email.from,
52
+ Destination: {
53
+ ToAddresses: email.toAddresses,
54
+ CcAddresses: email.ccAddresses,
55
+ BccAddresses: email.bccAddresses,
56
+ },
57
+ Template: templateName,
58
+ TemplateData: JSON.stringify(templateData),
59
+ });
60
+ const response = yield client.send(sendEmailCommand);
61
+ return {
62
+ messageId: response.MessageId,
63
+ metadata: response.$metadata,
64
+ };
65
+ }
66
+ catch (error) {
67
+ this.logHandler.error("There was an error sending the email.", {
68
+ error,
69
+ email,
70
+ endpoint,
71
+ }, aws_module_keyname_1.AwsModuleKeyname);
72
+ throw new ses_send_error_1.SesSendError(error, email);
73
+ }
74
+ });
75
+ }
76
+ send(email, endpoint) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ try {
79
+ const client = this.getClient(endpoint);
80
+ const sendEmailCommand = new client_ses_1.SendEmailCommand({
81
+ Message: {
82
+ Subject: {
83
+ Data: email.subject,
84
+ Charset: "UTF-8",
85
+ },
86
+ Body: {
87
+ Text: {
88
+ Data: email.body.text,
89
+ Charset: "UTF-8",
90
+ },
91
+ Html: {
92
+ Data: email.body.text,
93
+ Charset: "UTF-8",
94
+ },
95
+ },
96
+ },
97
+ Destination: {
98
+ ToAddresses: email.toAddresses,
99
+ CcAddresses: email.ccAddresses,
100
+ BccAddresses: email.bccAddresses,
101
+ },
102
+ Source: email.from,
103
+ });
104
+ const response = yield client.send(sendEmailCommand);
105
+ return {
106
+ messageId: response.MessageId,
107
+ metadata: response.$metadata,
108
+ };
109
+ }
110
+ catch (error) {
111
+ this.logHandler.error("There was an error sending the email.", {
112
+ error,
113
+ email,
114
+ endpoint,
115
+ }, aws_module_keyname_1.AwsModuleKeyname);
116
+ throw new ses_send_error_1.SesSendError(error, email);
117
+ }
118
+ });
119
+ }
120
+ };
121
+ SesClient = __decorate([
122
+ (0, common_1.tag)("SesClientInterface"),
123
+ (0, common_1.moduleScoped)(aws_module_keyname_1.AwsModuleKeyname),
124
+ (0, tsyringe_1.injectable)(),
125
+ __param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
126
+ __param(1, (0, tsyringe_1.inject)("%pristine.aws.region%")),
127
+ __metadata("design:paramtypes", [Object, String])
128
+ ], SesClient);
129
+ exports.SesClient = SesClient;
130
+ //# sourceMappingURL=ses.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses.client.js","sourceRoot":"","sources":["../../../../src/clients/ses.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAuD;AACvD,gDAAsD;AACtD,uCAA4C;AAG5C,oDAM6B;AAI7B,6DAAsD;AAK/C,IAAM,SAAS,GAAf,MAAM,SAAS;IAClB;;;;OAIG;IACH,YACoD,UAA+B,EAC7B,MAAc;QADhB,eAAU,GAAV,UAAU,CAAqB;QAC7B,WAAM,GAAN,MAAM,CAAQ;IAEpE,CAAC;IAED,SAAS,CAAC,QAAiB;QACvB,OAAO,IAAI,sBAAS,CAAC;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,SAAS;SAClC,CAAC,CAAC;IACP,CAAC;IAEK,YAAY,CAAC,KAAiB,EAAE,YAAoB,EAAE,YAAuC,EAAE,QAAiB;;YAClH,IAAI;gBACA,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAExC,MAAM,gBAAgB,GAAG,IAAI,sCAAyB,CAAC;oBACnD,MAAM,EAAE,KAAK,CAAC,IAAI;oBAClB,WAAW,EAAE;wBACT,WAAW,EAAE,KAAK,CAAC,WAAW;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AAK,CAAC,YAAY;qBACnC;oBACD,MAAM,EAAE,KAAK,CAAC,IAAI;iBACrB,CAAC,CAAC;gBAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBAErD,OAAO;oBACH,SAAS,EAAE,QAAQ,CAAC,SAAS;oBAC7B,QAAQ,EAAE,QAAQ,CAAC,SAAS;iBAC/B,CAAC;aACL;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,uCAAuC,EAAE;oBAC3D,KAAK;oBACL,KAAK;oBACL,QAAQ;iBACX,EAAE,qCAAgB,CAAC,CAAC;gBAErB,MAAM,IAAI,6BAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACxC;QACL,CAAC;KAAA;CAEJ,CAAA;AAjGY,SAAS;IAHrB,IAAA,YAAG,EAAC,oBAAoB,CAAC;IACzB,IAAA,qBAAY,EAAC,qCAAgB,CAAC;IAC9B,IAAA,qBAAU,GAAE;IAQJ,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,iBAAM,EAAC,uBAAuB,CAAC,CAAA;;GAR3B,SAAS,CAiGrB;AAjGY,8BAAS"}
@@ -22,5 +22,6 @@ __exportStar(require("./dynamodb-table-not-found.error"), exports);
22
22
  __exportStar(require("./dynamodb-validation.error"), exports);
23
23
  __exportStar(require("./event-bridge-send-message.error"), exports);
24
24
  __exportStar(require("./ssm-resolver.error"), exports);
25
+ __exportStar(require("./ses-send.error"), exports);
25
26
  __exportStar(require("./sqs-send-message.error"), exports);
26
27
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uEAAqD;AACrD,iGAAiG;AACjG,mDAAmD;AACnD,mEAAiD;AACjD,8DAA4C;AAC5C,oEAAkD;AAClD,uDAAqC;AACrC,2DAAyC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uEAAqD;AACrD,iGAAiG;AACjG,mDAAmD;AACnD,mEAAiD;AACjD,8DAA4C;AAC5C,oEAAkD;AAClD,uDAAqC;AACrC,mDAAiC;AACjC,2DAAyC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SesSendError = void 0;
4
+ const common_1 = require("@pristine-ts/common");
5
+ /**
6
+ * This Error represents an error when trying to send a message to Sqs
7
+ */
8
+ class SesSendError extends common_1.LoggableError {
9
+ /**
10
+ * This Error represents an error when trying to send a message to Sqs
11
+ * @param originalError The original error that was caught.
12
+ * @param email
13
+ */
14
+ constructor(originalError, email) {
15
+ super("There was an error sending an email to SES", {
16
+ originalError,
17
+ email
18
+ });
19
+ // Set the prototype explicitly.
20
+ // As specified in the documentation in TypeScript
21
+ // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
22
+ Object.setPrototypeOf(this, SesSendError.prototype);
23
+ }
24
+ }
25
+ exports.SesSendError = SesSendError;
26
+ //# sourceMappingURL=ses-send.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-send.error.js","sourceRoot":"","sources":["../../../../src/errors/ses-send.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,YAAa,SAAQ,sBAAa;IAE3C;;;;OAIG;IACH,YAAmB,aAAqB,EACrB,KAAkB;QAEjC,KAAK,CACD,4CAA4C,EAC5C;YACI,aAAa;YACb,KAAK;SACR,CACJ,CAAC;QAEF,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACJ;AAvBD,oCAuBC"}
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dynamodb-client.interface"), exports);
18
18
  __exportStar(require("./event-bridge-client.interface"), exports);
19
19
  __exportStar(require("./s3-client.interface"), exports);
20
+ __exportStar(require("./ses-client.interface"), exports);
20
21
  __exportStar(require("./sqs-client.interface"), exports);
21
22
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,kEAAgD;AAChD,wDAAsC;AACtC,yDAAuC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,kEAAgD;AAChD,wDAAsC;AACtC,yDAAuC;AACvC,yDAAuC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ses-client.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-client.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/ses-client.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailModel = void 0;
4
+ class EmailModel {
5
+ }
6
+ exports.EmailModel = EmailModel;
7
+ //# sourceMappingURL=email.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.model.js","sourceRoot":"","sources":["../../../../src/models/email.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;CAkCtB;AAlCD,gCAkCC"}
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dynamic-table-name.model"), exports);
18
18
  __exportStar(require("./dynamodb.model"), exports);
19
19
  __exportStar(require("./dynamodb-keys.model"), exports);
20
+ __exportStar(require("./email.model"), exports);
20
21
  __exportStar(require("./event-bridge-message.model"), exports);
21
22
  __exportStar(require("./identity.model"), exports);
22
23
  __exportStar(require("./kafka-message.model"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,mDAAiC;AACjC,wDAAsC;AACtC,+DAA6C;AAC7C,mDAAiC;AACjC,wDAAsC;AACtC,6DAA2C;AAC3C,4DAA0C;AAC1C,6CAA2B;AAC3B,oDAAkC;AAClC,oDAAkC;AAClC,8CAA4B;AAC5B,gEAA8C;AAC9C,yDAAuC;AACvC,wEAAsD"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,mDAAiC;AACjC,wDAAsC;AACtC,gDAA8B;AAC9B,+DAA6C;AAC7C,mDAAiC;AACjC,wDAAsC;AACtC,6DAA2C;AAC3C,4DAA0C;AAC1C,6CAA2B;AAC3B,oDAAkC;AAClC,oDAAkC;AAClC,8CAA4B;AAC5B,gEAA8C;AAC9C,yDAAuC;AACvC,wEAAsD"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SesMessageSentConfirmationModel = void 0;
4
+ /**
5
+ * Model representing the confirmation when an Email is properly sent.
6
+ */
7
+ class SesMessageSentConfirmationModel {
8
+ }
9
+ exports.SesMessageSentConfirmationModel = SesMessageSentConfirmationModel;
10
+ //# sourceMappingURL=ses-message-sent-confirmation.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-message-sent-confirmation.model.js","sourceRoot":"","sources":["../../../../src/models/ses-message-sent-confirmation.model.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,+BAA+B;CAI3C;AAJD,0EAIC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./dynamodb.client";
2
2
  export * from "./event-bridge.client";
3
3
  export * from "./s3.client";
4
+ export * from "./ses.client";
4
5
  export * from "./sqs.client";
5
6
  //# sourceMappingURL=clients.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,127 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ import { AwsModuleKeyname } from "../aws.module.keyname";
23
+ import { moduleScoped, tag } from "@pristine-ts/common";
24
+ import { inject, injectable } from "tsyringe";
25
+ import { SendEmailCommand, SendTemplatedEmailCommand, SESClient } from "@aws-sdk/client-ses";
26
+ import { SesSendError } from "../errors/ses-send.error";
27
+ let SesClient = class SesClient {
28
+ /**
29
+ * The client to use to interact with AWS SES. It is a wrapper around the SESClient of @aws-sdk/client-ses.
30
+ * @param logHandler The log handler used to output logs.
31
+ * @param region The aws region for which the client will be used.
32
+ */
33
+ constructor(logHandler, region) {
34
+ this.logHandler = logHandler;
35
+ this.region = region;
36
+ }
37
+ getClient(endpoint) {
38
+ return new SESClient({
39
+ region: this.region,
40
+ endpoint: endpoint !== null && endpoint !== void 0 ? endpoint : undefined,
41
+ });
42
+ }
43
+ sendTemplate(email, templateName, templateData, endpoint) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ const client = this.getClient(endpoint);
47
+ const sendEmailCommand = new SendTemplatedEmailCommand({
48
+ Source: email.from,
49
+ Destination: {
50
+ ToAddresses: email.toAddresses,
51
+ CcAddresses: email.ccAddresses,
52
+ BccAddresses: email.bccAddresses,
53
+ },
54
+ Template: templateName,
55
+ TemplateData: JSON.stringify(templateData),
56
+ });
57
+ const response = yield client.send(sendEmailCommand);
58
+ return {
59
+ messageId: response.MessageId,
60
+ metadata: response.$metadata,
61
+ };
62
+ }
63
+ catch (error) {
64
+ this.logHandler.error("There was an error sending the email.", {
65
+ error,
66
+ email,
67
+ endpoint,
68
+ }, AwsModuleKeyname);
69
+ throw new SesSendError(error, email);
70
+ }
71
+ });
72
+ }
73
+ send(email, endpoint) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ try {
76
+ const client = this.getClient(endpoint);
77
+ const sendEmailCommand = new SendEmailCommand({
78
+ Message: {
79
+ Subject: {
80
+ Data: email.subject,
81
+ Charset: "UTF-8",
82
+ },
83
+ Body: {
84
+ Text: {
85
+ Data: email.body.text,
86
+ Charset: "UTF-8",
87
+ },
88
+ Html: {
89
+ Data: email.body.text,
90
+ Charset: "UTF-8",
91
+ },
92
+ },
93
+ },
94
+ Destination: {
95
+ ToAddresses: email.toAddresses,
96
+ CcAddresses: email.ccAddresses,
97
+ BccAddresses: email.bccAddresses,
98
+ },
99
+ Source: email.from,
100
+ });
101
+ const response = yield client.send(sendEmailCommand);
102
+ return {
103
+ messageId: response.MessageId,
104
+ metadata: response.$metadata,
105
+ };
106
+ }
107
+ catch (error) {
108
+ this.logHandler.error("There was an error sending the email.", {
109
+ error,
110
+ email,
111
+ endpoint,
112
+ }, AwsModuleKeyname);
113
+ throw new SesSendError(error, email);
114
+ }
115
+ });
116
+ }
117
+ };
118
+ SesClient = __decorate([
119
+ tag("SesClientInterface"),
120
+ moduleScoped(AwsModuleKeyname),
121
+ injectable(),
122
+ __param(0, inject("LogHandlerInterface")),
123
+ __param(1, inject("%pristine.aws.region%")),
124
+ __metadata("design:paramtypes", [Object, String])
125
+ ], SesClient);
126
+ export { SesClient };
127
+ //# sourceMappingURL=ses.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses.client.js","sourceRoot":"","sources":["../../../../src/clients/ses.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAG5C,OAAO,EAEH,gBAAgB,EAEhB,yBAAyB,EACzB,SAAS,EACZ,MAAM,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rB,GAAG,CAAC,oBAAoB,CAAC;IACzB,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;IAQJ,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;GAR3B,SAAS,CAiGrB;SAjGY,SAAS"}
@@ -6,5 +6,6 @@ export * from "./dynamodb-table-not-found.error";
6
6
  export * from "./dynamodb-validation.error";
7
7
  export * from "./event-bridge-send-message.error";
8
8
  export * from "./ssm-resolver.error";
9
+ export * from "./ses-send.error";
9
10
  export * from "./sqs-send-message.error";
10
11
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sCAAsC,CAAC;AACrD,iGAAiG;AACjG,mDAAmD;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sCAAsC,CAAC;AACrD,iGAAiG;AACjG,mDAAmD;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { LoggableError } from "@pristine-ts/common";
2
+ /**
3
+ * This Error represents an error when trying to send a message to Sqs
4
+ */
5
+ export class SesSendError extends LoggableError {
6
+ /**
7
+ * This Error represents an error when trying to send a message to Sqs
8
+ * @param originalError The original error that was caught.
9
+ * @param email
10
+ */
11
+ constructor(originalError, email) {
12
+ super("There was an error sending an email to SES", {
13
+ originalError,
14
+ email
15
+ });
16
+ // Set the prototype explicitly.
17
+ // As specified in the documentation in TypeScript
18
+ // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
19
+ Object.setPrototypeOf(this, SesSendError.prototype);
20
+ }
21
+ }
22
+ //# sourceMappingURL=ses-send.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-send.error.js","sourceRoot":"","sources":["../../../../src/errors/ses-send.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,aAAa;IAE3C;;;;OAIG;IACH,YAAmB,aAAqB,EACrB,KAAkB;QAEjC,KAAK,CACD,4CAA4C,EAC5C;YACI,aAAa;YACb,KAAK;SACR,CACJ,CAAC;QAEF,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACJ"}
@@ -1,5 +1,6 @@
1
1
  export * from "./dynamodb-client.interface";
2
2
  export * from "./event-bridge-client.interface";
3
3
  export * from "./s3-client.interface";
4
+ export * from "./ses-client.interface";
4
5
  export * from "./sqs-client.interface";
5
6
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ses-client.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-client.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/ses-client.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export class EmailModel {
2
+ }
3
+ //# sourceMappingURL=email.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.model.js","sourceRoot":"","sources":["../../../../src/models/email.model.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;CAkCtB"}
@@ -1,6 +1,7 @@
1
1
  export * from "./dynamic-table-name.model";
2
2
  export * from "./dynamodb.model";
3
3
  export * from "./dynamodb-keys.model";
4
+ export * from "./email.model";
4
5
  export * from "./event-bridge-message.model";
5
6
  export * from "./identity.model";
6
7
  export * from "./kafka-message.model";
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Model representing the confirmation when an Email is properly sent.
3
+ */
4
+ export class SesMessageSentConfirmationModel {
5
+ }
6
+ //# sourceMappingURL=ses-message-sent-confirmation.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses-message-sent-confirmation.model.js","sourceRoot":"","sources":["../../../../src/models/ses-message-sent-confirmation.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,+BAA+B;CAI3C"}
@@ -1,4 +1,5 @@
1
1
  export * from "./dynamodb.client";
2
2
  export * from "./event-bridge.client";
3
3
  export * from "./s3.client";
4
+ export * from "./ses.client";
4
5
  export * from "./sqs.client";
@@ -0,0 +1,20 @@
1
+ import { SesClientInterface } from "../interfaces/ses-client.interface";
2
+ import { LogHandlerInterface } from "@pristine-ts/logging";
3
+ import { SESClient } from "@aws-sdk/client-ses";
4
+ import { EmailModel } from "../models/email.model";
5
+ import { SesMessageSentConfirmationModel } from "../models/ses-message-sent-confirmation.model";
6
+ export declare class SesClient implements SesClientInterface {
7
+ private readonly logHandler;
8
+ private readonly region;
9
+ /**
10
+ * The client to use to interact with AWS SES. It is a wrapper around the SESClient of @aws-sdk/client-ses.
11
+ * @param logHandler The log handler used to output logs.
12
+ * @param region The aws region for which the client will be used.
13
+ */
14
+ constructor(logHandler: LogHandlerInterface, region: string);
15
+ getClient(endpoint?: string): SESClient;
16
+ sendTemplate(email: EmailModel, templateName: string, templateData: {
17
+ [key in string]: string;
18
+ }, endpoint?: string): Promise<SesMessageSentConfirmationModel>;
19
+ send(email: EmailModel, endpoint?: string): Promise<SesMessageSentConfirmationModel>;
20
+ }
@@ -4,4 +4,5 @@ export * from "./dynamodb-table-not-found.error";
4
4
  export * from "./dynamodb-validation.error";
5
5
  export * from "./event-bridge-send-message.error";
6
6
  export * from "./ssm-resolver.error";
7
+ export * from "./ses-send.error";
7
8
  export * from "./sqs-send-message.error";
@@ -0,0 +1,13 @@
1
+ import { LoggableError } from "@pristine-ts/common";
2
+ import { EmailModel } from "../models/email.model";
3
+ /**
4
+ * This Error represents an error when trying to send a message to Sqs
5
+ */
6
+ export declare class SesSendError extends LoggableError {
7
+ /**
8
+ * This Error represents an error when trying to send a message to Sqs
9
+ * @param originalError The original error that was caught.
10
+ * @param email
11
+ */
12
+ constructor(originalError?: Error, email?: EmailModel);
13
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./dynamodb-client.interface";
2
2
  export * from "./event-bridge-client.interface";
3
3
  export * from "./s3-client.interface";
4
+ export * from "./ses-client.interface";
4
5
  export * from "./sqs-client.interface";
@@ -0,0 +1,31 @@
1
+ import { SESClient } from "@aws-sdk/client-ses";
2
+ import { EmailModel } from "../models/email.model";
3
+ import { SesMessageSentConfirmationModel } from "../models/ses-message-sent-confirmation.model";
4
+ /**
5
+ * The SESClient Interface defines the methods that an SES client must implement.
6
+ * When injecting the SES client the 'SesClientInterface' tag should be used.
7
+ */
8
+ export interface SesClientInterface {
9
+ /**
10
+ * Returns the instantiated SESClient from the @aws-sdk/client-sqs library.
11
+ * @param endpoint The endpoint for which the SES client is created.
12
+ */
13
+ getClient(endpoint?: string): SESClient;
14
+ /**
15
+ * This sends an email.
16
+ *
17
+ * @param email
18
+ * @param endpoint
19
+ */
20
+ send(email: EmailModel, endpoint?: string): Promise<SesMessageSentConfirmationModel>;
21
+ /**
22
+ * This sends an email with the specified template and template Data.
23
+ * @param email
24
+ * @param templateName
25
+ * @param templateData
26
+ * @param endpoint
27
+ */
28
+ sendTemplate(email: EmailModel, templateName: string, templateData: {
29
+ [key in string]: string;
30
+ }, endpoint?: string): Promise<SesMessageSentConfirmationModel>;
31
+ }
@@ -0,0 +1,29 @@
1
+ export declare class EmailModel {
2
+ /**
3
+ * The to email addresses.
4
+ */
5
+ toAddresses: string[];
6
+ /**
7
+ * The cc email addresses.
8
+ */
9
+ ccAddresses: string[];
10
+ /**
11
+ * The bcc email addresses.
12
+ */
13
+ bccAddresses: string[];
14
+ /**
15
+ * From email address
16
+ */
17
+ from: string;
18
+ /**
19
+ * The subject
20
+ */
21
+ subject: string;
22
+ /**
23
+ * The body.
24
+ */
25
+ body: {
26
+ html: string;
27
+ text: string;
28
+ };
29
+ }
@@ -1,6 +1,7 @@
1
1
  export * from "./dynamic-table-name.model";
2
2
  export * from "./dynamodb.model";
3
3
  export * from "./dynamodb-keys.model";
4
+ export * from "./email.model";
4
5
  export * from "./event-bridge-message.model";
5
6
  export * from "./identity.model";
6
7
  export * from "./kafka-message.model";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Model representing the confirmation when an Email is properly sent.
3
+ */
4
+ export declare class SesMessageSentConfirmationModel {
5
+ messageId?: string;
6
+ metadata?: any;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pristine-ts/aws",
3
- "version": "0.0.225",
3
+ "version": "0.0.227",
4
4
  "description": "",
5
5
  "module": "dist/lib/esm/aws.module.js",
6
6
  "main": "dist/lib/cjs/aws.module.js",
@@ -20,17 +20,18 @@
20
20
  "@aws-sdk/client-dynamodb": "^3.211.0",
21
21
  "@aws-sdk/client-eventbridge": "^3.211.0",
22
22
  "@aws-sdk/client-s3": "^3.211.0",
23
+ "@aws-sdk/client-ses": "^3.211.0",
23
24
  "@aws-sdk/client-sqs": "^3.211.0",
24
25
  "@aws-sdk/client-ssm": "^3.211.0",
25
26
  "@aws-sdk/s3-request-presigner": "^3.211.0",
26
27
  "@awslabs-community-fork/dynamodb-data-mapper": "^0.7.9",
27
28
  "@awslabs-community-fork/dynamodb-data-marshaller": "^0.7.9",
28
29
  "@awslabs-community-fork/dynamodb-expressions": "^0.7.9",
29
- "@pristine-ts/common": "^0.0.225",
30
- "@pristine-ts/core": "^0.0.225",
31
- "@pristine-ts/logging": "^0.0.225",
32
- "@pristine-ts/networking": "^0.0.225",
33
- "@pristine-ts/security": "^0.0.225"
30
+ "@pristine-ts/common": "^0.0.227",
31
+ "@pristine-ts/core": "^0.0.227",
32
+ "@pristine-ts/logging": "^0.0.227",
33
+ "@pristine-ts/networking": "^0.0.227",
34
+ "@pristine-ts/security": "^0.0.227"
34
35
  },
35
36
  "publishConfig": {
36
37
  "access": "public"
@@ -69,5 +70,5 @@
69
70
  "src/*.{js,ts}"
70
71
  ]
71
72
  },
72
- "gitHead": "be49c29a657cb62a1a642d4978b26522c08e7b18"
73
+ "gitHead": "a926c2c98ecb07f45ca7554a537f7b0d904a87b8"
73
74
  }