core-services-sdk 1.3.8 → 1.3.9
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-services-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-ses": "^3.862.0",
|
|
23
23
|
"@aws-sdk/credential-provider-node": "^3.862.0",
|
|
24
|
+
"@sendgrid/mail": "^8.1.5",
|
|
24
25
|
"amqplib": "^0.10.8",
|
|
25
26
|
"crypto": "^1.0.1",
|
|
26
27
|
"dot": "^1.1.3",
|
|
27
28
|
"fastify": "^5.4.0",
|
|
28
29
|
"http-status": "^2.1.0",
|
|
29
|
-
"mongodb": "^6.
|
|
30
|
+
"mongodb": "^6.18.0",
|
|
30
31
|
"node-fetch": "^3.3.2",
|
|
31
32
|
"nodemailer": "^7.0.5",
|
|
32
|
-
"nodemailer-sendgrid-transport": "^0.2.0",
|
|
33
33
|
"pino": "^9.7.0",
|
|
34
34
|
"uuid": "^11.1.0",
|
|
35
35
|
"xml2js": "^0.6.2"
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"url": "^0.11.4",
|
|
41
41
|
"vitest": "^3.2.4"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import nodemailer from 'nodemailer'
|
|
2
|
-
import
|
|
3
|
-
import { SESClient, SendRawEmailCommand } from '@aws-sdk/client-ses'
|
|
2
|
+
import sgMail from '@sendgrid/mail'
|
|
4
3
|
import { defaultProvider } from '@aws-sdk/credential-provider-node'
|
|
4
|
+
import { SESClient, SendRawEmailCommand } from '@aws-sdk/client-ses'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Factory for creating
|
|
7
|
+
* Factory for creating email transporters based on configuration.
|
|
8
8
|
*/
|
|
9
9
|
export class TransportFactory {
|
|
10
10
|
/**
|
|
@@ -30,8 +30,9 @@ export class TransportFactory {
|
|
|
30
30
|
* @param {string} config.secretAccessKey - AWS secret
|
|
31
31
|
* @param {string} config.region - AWS region
|
|
32
32
|
*
|
|
33
|
-
* @returns {import('nodemailer').Transporter}
|
|
33
|
+
* @returns {import('nodemailer').Transporter | typeof import('@sendgrid/mail')}
|
|
34
34
|
*/
|
|
35
|
+
|
|
35
36
|
static create(config) {
|
|
36
37
|
switch (config.type) {
|
|
37
38
|
case 'smtp':
|
|
@@ -49,11 +50,11 @@ export class TransportFactory {
|
|
|
49
50
|
})
|
|
50
51
|
|
|
51
52
|
case 'sendgrid':
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (!config.apiKey) {
|
|
54
|
+
throw new Error('Missing SendGrid API key')
|
|
55
|
+
}
|
|
56
|
+
sgMail.setApiKey(config.apiKey)
|
|
57
|
+
return sgMail // Not a Nodemailer transport, but SendGrid's mail API
|
|
57
58
|
|
|
58
59
|
case 'ses': {
|
|
59
60
|
const sesClient = new SESClient({
|