@strapi/provider-email-amazon-ses 5.46.0 → 5.47.0
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/README.md +91 -12
- package/dist/index.d.ts +2 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -28
- package/dist/index.mjs.map +1 -1
- package/dist/utils.d.ts +53 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +139 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +132 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -23,17 +23,94 @@ npm install @strapi/provider-email-amazon-ses --save
|
|
|
23
23
|
|
|
24
24
|
## Configuration
|
|
25
25
|
|
|
26
|
-
| Variable | Type | Description
|
|
27
|
-
| ----------------------- | ----------------------- |
|
|
28
|
-
| provider | string | The name of the provider you use
|
|
29
|
-
| providerOptions | object |
|
|
30
|
-
|
|
|
31
|
-
| settings
|
|
32
|
-
| settings.
|
|
26
|
+
| Variable | Type | Description | Required | Default |
|
|
27
|
+
| ----------------------- | ----------------------- | --------------------------------------------------------------------- | -------- | ----------- |
|
|
28
|
+
| provider | string | The name of the provider you use | yes | |
|
|
29
|
+
| providerOptions | object | Passed to the AWS SDK v3 `SESClient` constructor (see examples below) | yes | |
|
|
30
|
+
| providerOptions.region | string | AWS region for SES | no | `us-east-1` |
|
|
31
|
+
| settings | object | Settings | no | {} |
|
|
32
|
+
| settings.defaultFrom | string | Default sender mail address | no | undefined |
|
|
33
|
+
| settings.defaultReplyTo | string \| array<string> | Default address or addresses the receiver is asked to reply to | no | undefined |
|
|
33
34
|
|
|
34
35
|
> :warning: The Shipper Email (or defaultfrom) may also need to be changed in the `Email Templates` tab on the admin panel for emails to send properly
|
|
35
36
|
|
|
36
|
-
### Example
|
|
37
|
+
### Example: Using IAM roles (recommended for AWS deployments)
|
|
38
|
+
|
|
39
|
+
When running on AWS infrastructure (EC2, ECS, EKS, Lambda, etc.), credentials are resolved from the instance or task IAM role. No access keys are required in configuration.
|
|
40
|
+
|
|
41
|
+
**Path -** `./config/plugins.js`
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
module.exports = ({ env }) => ({
|
|
45
|
+
// ...
|
|
46
|
+
email: {
|
|
47
|
+
config: {
|
|
48
|
+
provider: 'amazon-ses',
|
|
49
|
+
providerOptions: {
|
|
50
|
+
region: env('AWS_REGION', 'us-east-1'),
|
|
51
|
+
},
|
|
52
|
+
settings: {
|
|
53
|
+
defaultFrom: 'myemail@protonmail.com',
|
|
54
|
+
defaultReplyTo: 'myemail@protonmail.com',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
// ...
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Path -** `.env`
|
|
63
|
+
|
|
64
|
+
```env
|
|
65
|
+
AWS_REGION=us-east-1
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The AWS SDK resolves credentials in this order:
|
|
69
|
+
|
|
70
|
+
1. Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
|
|
71
|
+
2. Shared credentials file (`~/.aws/credentials`)
|
|
72
|
+
3. IAM roles for Amazon EC2 / ECS / EKS (including IRSA)
|
|
73
|
+
|
|
74
|
+
### Example: Using explicit credentials
|
|
75
|
+
|
|
76
|
+
For local development or non-AWS environments:
|
|
77
|
+
|
|
78
|
+
**Path -** `./config/plugins.js`
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
module.exports = ({ env }) => ({
|
|
82
|
+
// ...
|
|
83
|
+
email: {
|
|
84
|
+
config: {
|
|
85
|
+
provider: 'amazon-ses',
|
|
86
|
+
providerOptions: {
|
|
87
|
+
region: env('AWS_REGION', 'us-east-1'),
|
|
88
|
+
credentials: {
|
|
89
|
+
accessKeyId: env('AWS_ACCESS_KEY_ID'),
|
|
90
|
+
secretAccessKey: env('AWS_SECRET_ACCESS_KEY'),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
settings: {
|
|
94
|
+
defaultFrom: 'myemail@protonmail.com',
|
|
95
|
+
defaultReplyTo: 'myemail@protonmail.com',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
// ...
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Path -** `.env`
|
|
104
|
+
|
|
105
|
+
```env
|
|
106
|
+
AWS_ACCESS_KEY_ID=your-access-key-id
|
|
107
|
+
AWS_SECRET_ACCESS_KEY=your-secret-access-key
|
|
108
|
+
AWS_REGION=us-east-1
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Example: Legacy configuration (backwards compatible)
|
|
112
|
+
|
|
113
|
+
The legacy `node-ses` format using `key`, `secret`, and `amazon` is still supported. The provider maps these to AWS SDK v3 options (`credentials`, `endpoint`, and `region` parsed from the `amazon` URL).
|
|
37
114
|
|
|
38
115
|
**Path -** `./config/plugins.js`
|
|
39
116
|
|
|
@@ -46,7 +123,7 @@ module.exports = ({ env }) => ({
|
|
|
46
123
|
providerOptions: {
|
|
47
124
|
key: env('AWS_SES_KEY'),
|
|
48
125
|
secret: env('AWS_SES_SECRET'),
|
|
49
|
-
amazon: `https://email.${env('AWS_SES_REGION', 'us-east-1')}.amazonaws.com`,
|
|
126
|
+
amazon: `https://email.${env('AWS_SES_REGION', 'us-east-1')}.amazonaws.com`,
|
|
50
127
|
},
|
|
51
128
|
settings: {
|
|
52
129
|
defaultFrom: 'myemail@protonmail.com',
|
|
@@ -61,7 +138,9 @@ module.exports = ({ env }) => ({
|
|
|
61
138
|
**Path -** `.env`
|
|
62
139
|
|
|
63
140
|
```env
|
|
64
|
-
AWS_SES_KEY=
|
|
65
|
-
AWS_SES_SECRET=
|
|
66
|
-
AWS_SES_REGION=
|
|
141
|
+
AWS_SES_KEY=your-access-key-id
|
|
142
|
+
AWS_SES_SECRET=your-secret-access-key
|
|
143
|
+
AWS_SES_REGION=us-east-1
|
|
67
144
|
```
|
|
145
|
+
|
|
146
|
+
You may also use `credentials: { key, secret }` with `region` instead of top-level `key` / `secret`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
defaultFrom: string;
|
|
3
|
-
defaultReplyTo: string;
|
|
4
|
-
}
|
|
5
|
-
interface SendOptions {
|
|
6
|
-
from?: string;
|
|
7
|
-
to: string;
|
|
8
|
-
cc: string;
|
|
9
|
-
bcc: string;
|
|
10
|
-
replyTo?: string;
|
|
11
|
-
subject: string;
|
|
12
|
-
text: string;
|
|
13
|
-
html: string;
|
|
14
|
-
[key: string]: unknown;
|
|
15
|
-
}
|
|
16
|
-
interface ProviderOptions {
|
|
17
|
-
key: string;
|
|
18
|
-
secret: string;
|
|
19
|
-
amazon?: string;
|
|
20
|
-
}
|
|
1
|
+
import { type ProviderOptions, type ProviderSettings, type SendOptions } from './utils';
|
|
21
2
|
declare const _default: {
|
|
22
|
-
init(providerOptions: ProviderOptions, settings:
|
|
3
|
+
init(providerOptions: ProviderOptions, settings: ProviderSettings): {
|
|
23
4
|
send(options: SendOptions): Promise<void>;
|
|
24
5
|
};
|
|
25
6
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;;0BAGO,eAAe,YAAY,gBAAgB;sBAIzC,WAAW,GAAG,QAAQ,IAAI,CAAC;;;AALrD,wBAUE"}
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clientSes = require('@aws-sdk/client-ses');
|
|
4
|
+
var utils = require('./utils.js');
|
|
4
5
|
|
|
5
6
|
var index = {
|
|
6
7
|
init (providerOptions, settings) {
|
|
7
|
-
const client =
|
|
8
|
+
const client = new clientSes.SESClient(utils.getClientConfig(providerOptions));
|
|
8
9
|
return {
|
|
9
|
-
send (options) {
|
|
10
|
-
|
|
11
|
-
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
12
|
-
const msg = {
|
|
13
|
-
from: from || settings.defaultFrom,
|
|
14
|
-
subject,
|
|
15
|
-
message: html,
|
|
16
|
-
to,
|
|
17
|
-
cc,
|
|
18
|
-
bcc,
|
|
19
|
-
replyTo: replyTo || settings.defaultReplyTo,
|
|
20
|
-
altText: text,
|
|
21
|
-
...rest
|
|
22
|
-
};
|
|
23
|
-
client.sendEmail(msg, (err)=>{
|
|
24
|
-
if (err) {
|
|
25
|
-
if (err.Message) {
|
|
26
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
27
|
-
reject(`${err.Message} ${err.Detail ? err.Detail : ''}`);
|
|
28
|
-
}
|
|
29
|
-
reject(err);
|
|
30
|
-
} else {
|
|
31
|
-
resolve();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
10
|
+
async send (options) {
|
|
11
|
+
await client.send(new clientSes.SendEmailCommand(utils.buildSendEmailCommandInput(options, settings)));
|
|
35
12
|
}
|
|
36
13
|
};
|
|
37
14
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';\n\nimport {\n buildSendEmailCommandInput,\n getClientConfig,\n type ProviderOptions,\n type ProviderSettings,\n type SendOptions,\n} from './utils';\n\nexport default {\n init(providerOptions: ProviderOptions, settings: ProviderSettings) {\n const client = new SESClient(getClientConfig(providerOptions));\n\n return {\n async send(options: SendOptions): Promise<void> {\n await client.send(new SendEmailCommand(buildSendEmailCommandInput(options, settings)));\n },\n };\n },\n};\n"],"names":["init","providerOptions","settings","client","SESClient","getClientConfig","send","options","SendEmailCommand","buildSendEmailCommandInput"],"mappings":";;;;;AAUA,YAAe;IACbA,IAAAA,CAAAA,CAAKC,eAAgC,EAAEC,QAA0B,EAAA;QAC/D,MAAMC,MAAAA,GAAS,IAAIC,mBAAAA,CAAUC,qBAAAA,CAAgBJ,eAAAA,CAAAA,CAAAA;QAE7C,OAAO;AACL,YAAA,MAAMK,MAAKC,OAAoB,EAAA;AAC7B,gBAAA,MAAMJ,OAAOG,IAAI,CAAC,IAAIE,0BAAAA,CAAiBC,iCAA2BF,OAAAA,EAASL,QAAAA,CAAAA,CAAAA,CAAAA;AAC7E,YAAA;AACF,SAAA;AACF,IAAA;AACF,CAAA;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';
|
|
2
|
+
import { getClientConfig, buildSendEmailCommandInput } from './utils.mjs';
|
|
2
3
|
|
|
3
4
|
var index = {
|
|
4
5
|
init (providerOptions, settings) {
|
|
5
|
-
const client =
|
|
6
|
+
const client = new SESClient(getClientConfig(providerOptions));
|
|
6
7
|
return {
|
|
7
|
-
send (options) {
|
|
8
|
-
|
|
9
|
-
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
10
|
-
const msg = {
|
|
11
|
-
from: from || settings.defaultFrom,
|
|
12
|
-
subject,
|
|
13
|
-
message: html,
|
|
14
|
-
to,
|
|
15
|
-
cc,
|
|
16
|
-
bcc,
|
|
17
|
-
replyTo: replyTo || settings.defaultReplyTo,
|
|
18
|
-
altText: text,
|
|
19
|
-
...rest
|
|
20
|
-
};
|
|
21
|
-
client.sendEmail(msg, (err)=>{
|
|
22
|
-
if (err) {
|
|
23
|
-
if (err.Message) {
|
|
24
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
25
|
-
reject(`${err.Message} ${err.Detail ? err.Detail : ''}`);
|
|
26
|
-
}
|
|
27
|
-
reject(err);
|
|
28
|
-
} else {
|
|
29
|
-
resolve();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
});
|
|
8
|
+
async send (options) {
|
|
9
|
+
await client.send(new SendEmailCommand(buildSendEmailCommandInput(options, settings)));
|
|
33
10
|
}
|
|
34
11
|
};
|
|
35
12
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';\n\nimport {\n buildSendEmailCommandInput,\n getClientConfig,\n type ProviderOptions,\n type ProviderSettings,\n type SendOptions,\n} from './utils';\n\nexport default {\n init(providerOptions: ProviderOptions, settings: ProviderSettings) {\n const client = new SESClient(getClientConfig(providerOptions));\n\n return {\n async send(options: SendOptions): Promise<void> {\n await client.send(new SendEmailCommand(buildSendEmailCommandInput(options, settings)));\n },\n };\n },\n};\n"],"names":["init","providerOptions","settings","client","SESClient","getClientConfig","send","options","SendEmailCommand","buildSendEmailCommandInput"],"mappings":";;;AAUA,YAAe;IACbA,IAAAA,CAAAA,CAAKC,eAAgC,EAAEC,QAA0B,EAAA;QAC/D,MAAMC,MAAAA,GAAS,IAAIC,SAAAA,CAAUC,eAAAA,CAAgBJ,eAAAA,CAAAA,CAAAA;QAE7C,OAAO;AACL,YAAA,MAAMK,MAAKC,OAAoB,EAAA;AAC7B,gBAAA,MAAMJ,OAAOG,IAAI,CAAC,IAAIE,gBAAAA,CAAiBC,2BAA2BF,OAAAA,EAASL,QAAAA,CAAAA,CAAAA,CAAAA;AAC7E,YAAA;AACF,SAAA;AACF,IAAA;AACF,CAAA;;;;"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SendEmailCommandInput, SESClientConfig } from '@aws-sdk/client-ses';
|
|
2
|
+
/** Default SES API host when `amazon` is omitted (same as legacy node-ses). */
|
|
3
|
+
export declare const DEFAULT_SES_ENDPOINT = "https://email.us-east-1.amazonaws.com";
|
|
4
|
+
export declare const SES_ENDPOINT_REGION_PATTERN: RegExp;
|
|
5
|
+
export interface ProviderCredentials {
|
|
6
|
+
key: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
sessionToken?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProviderOptions extends Omit<SESClientConfig, 'credentials'> {
|
|
11
|
+
credentials?: ProviderCredentials | NonNullable<SESClientConfig['credentials']>;
|
|
12
|
+
key?: string;
|
|
13
|
+
secret?: string;
|
|
14
|
+
amazon?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProviderSettings {
|
|
17
|
+
defaultFrom: string;
|
|
18
|
+
defaultReplyTo: string | string[];
|
|
19
|
+
}
|
|
20
|
+
export interface SendOptions {
|
|
21
|
+
from?: string;
|
|
22
|
+
to: string | string[];
|
|
23
|
+
cc?: string | string[];
|
|
24
|
+
bcc?: string | string[];
|
|
25
|
+
replyTo?: string | string[];
|
|
26
|
+
subject: string;
|
|
27
|
+
text: string;
|
|
28
|
+
html: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
type EndpointInput = string | SESClientConfig['endpoint'];
|
|
32
|
+
export declare const regionFromEndpoint: (endpoint?: EndpointInput) => string | undefined;
|
|
33
|
+
/** Matches node-ses `extractRecipient`: arrays pass through, strings become a single entry. */
|
|
34
|
+
export declare const toAddressList: (value?: string | string[]) => string[] | undefined;
|
|
35
|
+
export interface LegacyMessageTag {
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Maps legacy node-ses `providerOptions` and AWS SDK v3 `SESClient` config.
|
|
41
|
+
*
|
|
42
|
+
* Rewrites:
|
|
43
|
+
* - `key` / `secret` → `credentials.accessKeyId` / `credentials.secretAccessKey`
|
|
44
|
+
* - `credentials: { key, secret }` → AWS credential object
|
|
45
|
+
* - `amazon` → `endpoint`
|
|
46
|
+
* - region from `amazon` / `endpoint` host (`email.<region>.amazonaws.com`)
|
|
47
|
+
* - `key` + `secret` only → `region: us-east-1` (node-ses default endpoint behavior)
|
|
48
|
+
*/
|
|
49
|
+
export declare const getClientConfig: (providerOptions: ProviderOptions) => SESClientConfig;
|
|
50
|
+
/** Builds SendEmail input (html → Html body, text → Text body; legacy node-ses message/altText). */
|
|
51
|
+
export declare const buildSendEmailCommandInput: (options: SendOptions, settings: ProviderSettings) => SendEmailCommandInput;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAElF,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,0CAA0C,CAAC;AAE5E,eAAO,MAAM,2BAA2B,QAAyC,CAAC;AAElF,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC;IAC3E,WAAW,CAAC,EAAE,mBAAmB,GAAG,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,KAAK,aAAa,GAAG,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AAkB1D,eAAO,MAAM,kBAAkB,cAAe,aAAa,KAAG,MAAM,GAAG,SAatE,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,aAAa,WAAY,MAAM,GAAG,MAAM,EAAE,KAAG,MAAM,EAAE,GAAG,SAUpE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAuBD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,oBAAqB,eAAe,KAAG,eAmDlE,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,0BAA0B,YAC5B,WAAW,YACV,gBAAgB,KACzB,qBAmDF,CAAC"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** Default SES API host when `amazon` is omitted (same as legacy node-ses). */ const DEFAULT_SES_ENDPOINT = 'https://email.us-east-1.amazonaws.com';
|
|
4
|
+
const SES_ENDPOINT_REGION_PATTERN = /email\.([a-z0-9-]+)\.amazonaws\.com/i;
|
|
5
|
+
const resolveEndpointUrl = (endpoint)=>{
|
|
6
|
+
if (!endpoint) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
if (typeof endpoint === 'string') {
|
|
10
|
+
return endpoint;
|
|
11
|
+
}
|
|
12
|
+
if (typeof endpoint === 'object' && 'url' in endpoint && typeof endpoint.url === 'string') {
|
|
13
|
+
return endpoint.url;
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
const regionFromEndpoint = (endpoint)=>{
|
|
18
|
+
const endpointUrl = resolveEndpointUrl(endpoint);
|
|
19
|
+
if (!endpointUrl) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const match = new URL(endpointUrl).hostname.match(SES_ENDPOINT_REGION_PATTERN);
|
|
24
|
+
return match?.[1];
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** Matches node-ses `extractRecipient`: arrays pass through, strings become a single entry. */ const toAddressList = (value)=>{
|
|
30
|
+
if (!value) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
return [
|
|
37
|
+
value
|
|
38
|
+
];
|
|
39
|
+
};
|
|
40
|
+
const mapLegacyMessageTags = (messageTags)=>{
|
|
41
|
+
if (!Array.isArray(messageTags)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return messageTags.filter((tag)=>typeof tag === 'object' && tag !== null && 'name' in tag && 'value' in tag && typeof tag.name === 'string' && typeof tag.value === 'string').map((tag)=>({
|
|
45
|
+
Name: tag.name,
|
|
46
|
+
Value: tag.value
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Maps legacy node-ses `providerOptions` and AWS SDK v3 `SESClient` config.
|
|
51
|
+
*
|
|
52
|
+
* Rewrites:
|
|
53
|
+
* - `key` / `secret` → `credentials.accessKeyId` / `credentials.secretAccessKey`
|
|
54
|
+
* - `credentials: { key, secret }` → AWS credential object
|
|
55
|
+
* - `amazon` → `endpoint`
|
|
56
|
+
* - region from `amazon` / `endpoint` host (`email.<region>.amazonaws.com`)
|
|
57
|
+
* - `key` + `secret` only → `region: us-east-1` (node-ses default endpoint behavior)
|
|
58
|
+
*/ const getClientConfig = (providerOptions)=>{
|
|
59
|
+
const { key, secret, amazon, credentials, region, ...clientConfig } = providerOptions;
|
|
60
|
+
const hasLegacyStaticCredentials = Boolean(key && secret);
|
|
61
|
+
const endpoint = amazon || providerOptions.endpoint || (hasLegacyStaticCredentials ? DEFAULT_SES_ENDPOINT : undefined);
|
|
62
|
+
const parsedRegionFromEndpoint = regionFromEndpoint(endpoint);
|
|
63
|
+
const explicitCredentials = (credentials && typeof credentials === 'object' && 'key' in credentials ? {
|
|
64
|
+
accessKeyId: credentials.key,
|
|
65
|
+
secretAccessKey: credentials.secret,
|
|
66
|
+
...credentials.sessionToken ? {
|
|
67
|
+
sessionToken: credentials.sessionToken
|
|
68
|
+
} : {}
|
|
69
|
+
} : credentials) || (key && secret ? {
|
|
70
|
+
accessKeyId: key,
|
|
71
|
+
secretAccessKey: secret
|
|
72
|
+
} : undefined);
|
|
73
|
+
const unparseableLegacyAmazon = Boolean(amazon && hasLegacyStaticCredentials && !parsedRegionFromEndpoint);
|
|
74
|
+
const resolvedRegion = region || parsedRegionFromEndpoint || (unparseableLegacyAmazon || hasLegacyStaticCredentials && !parsedRegionFromEndpoint && !endpoint) && 'us-east-1' || undefined;
|
|
75
|
+
// node-ses createClient only consumed key, secret, and amazon — ignore stray options.
|
|
76
|
+
const sdkOnlyOptions = hasLegacyStaticCredentials ? {} : clientConfig;
|
|
77
|
+
return {
|
|
78
|
+
...sdkOnlyOptions,
|
|
79
|
+
...resolvedRegion ? {
|
|
80
|
+
region: resolvedRegion
|
|
81
|
+
} : {},
|
|
82
|
+
...endpoint ? {
|
|
83
|
+
endpoint
|
|
84
|
+
} : {},
|
|
85
|
+
...explicitCredentials ? {
|
|
86
|
+
credentials: explicitCredentials
|
|
87
|
+
} : {}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/** Builds SendEmail input (html → Html body, text → Text body; legacy node-ses message/altText). */ const buildSendEmailCommandInput = (options, settings)=>{
|
|
91
|
+
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
92
|
+
const { configurationSet, messageTags, ...sdkRest } = rest;
|
|
93
|
+
const commandInput = {
|
|
94
|
+
Source: from || settings.defaultFrom,
|
|
95
|
+
Destination: {
|
|
96
|
+
ToAddresses: toAddressList(to),
|
|
97
|
+
CcAddresses: toAddressList(cc),
|
|
98
|
+
BccAddresses: toAddressList(bcc)
|
|
99
|
+
},
|
|
100
|
+
ReplyToAddresses: toAddressList(replyTo !== undefined ? replyTo : settings.defaultReplyTo),
|
|
101
|
+
Message: {
|
|
102
|
+
Subject: {
|
|
103
|
+
Data: subject,
|
|
104
|
+
Charset: 'UTF-8'
|
|
105
|
+
},
|
|
106
|
+
Body: {
|
|
107
|
+
...html ? {
|
|
108
|
+
Html: {
|
|
109
|
+
Data: html,
|
|
110
|
+
Charset: 'UTF-8'
|
|
111
|
+
}
|
|
112
|
+
} : {},
|
|
113
|
+
...text ? {
|
|
114
|
+
Text: {
|
|
115
|
+
Data: text,
|
|
116
|
+
Charset: 'UTF-8'
|
|
117
|
+
}
|
|
118
|
+
} : {}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
...sdkRest
|
|
122
|
+
};
|
|
123
|
+
if (typeof configurationSet === 'string') {
|
|
124
|
+
commandInput.ConfigurationSetName = configurationSet;
|
|
125
|
+
}
|
|
126
|
+
const tags = mapLegacyMessageTags(messageTags);
|
|
127
|
+
if (tags?.length) {
|
|
128
|
+
commandInput.Tags = tags;
|
|
129
|
+
}
|
|
130
|
+
return commandInput;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
exports.DEFAULT_SES_ENDPOINT = DEFAULT_SES_ENDPOINT;
|
|
134
|
+
exports.SES_ENDPOINT_REGION_PATTERN = SES_ENDPOINT_REGION_PATTERN;
|
|
135
|
+
exports.buildSendEmailCommandInput = buildSendEmailCommandInput;
|
|
136
|
+
exports.getClientConfig = getClientConfig;
|
|
137
|
+
exports.regionFromEndpoint = regionFromEndpoint;
|
|
138
|
+
exports.toAddressList = toAddressList;
|
|
139
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import type { SendEmailCommandInput, SESClientConfig } from '@aws-sdk/client-ses';\n\n/** Default SES API host when `amazon` is omitted (same as legacy node-ses). */\nexport const DEFAULT_SES_ENDPOINT = 'https://email.us-east-1.amazonaws.com';\n\nexport const SES_ENDPOINT_REGION_PATTERN = /email\\.([a-z0-9-]+)\\.amazonaws\\.com/i;\n\nexport interface ProviderCredentials {\n key: string;\n secret: string;\n sessionToken?: string;\n}\n\nexport interface ProviderOptions extends Omit<SESClientConfig, 'credentials'> {\n credentials?: ProviderCredentials | NonNullable<SESClientConfig['credentials']>;\n key?: string;\n secret?: string;\n amazon?: string;\n}\n\nexport interface ProviderSettings {\n defaultFrom: string;\n defaultReplyTo: string | string[];\n}\n\nexport interface SendOptions {\n from?: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string | string[];\n subject: string;\n text: string;\n html: string;\n [key: string]: unknown;\n}\n\ntype EndpointInput = string | SESClientConfig['endpoint'];\n\nconst resolveEndpointUrl = (endpoint?: EndpointInput): string | undefined => {\n if (!endpoint) {\n return undefined;\n }\n\n if (typeof endpoint === 'string') {\n return endpoint;\n }\n\n if (typeof endpoint === 'object' && 'url' in endpoint && typeof endpoint.url === 'string') {\n return endpoint.url;\n }\n\n return undefined;\n};\n\nexport const regionFromEndpoint = (endpoint?: EndpointInput): string | undefined => {\n const endpointUrl = resolveEndpointUrl(endpoint);\n\n if (!endpointUrl) {\n return undefined;\n }\n\n try {\n const match = new URL(endpointUrl).hostname.match(SES_ENDPOINT_REGION_PATTERN);\n return match?.[1];\n } catch {\n return undefined;\n }\n};\n\n/** Matches node-ses `extractRecipient`: arrays pass through, strings become a single entry. */\nexport const toAddressList = (value?: string | string[]): string[] | undefined => {\n if (!value) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return [value];\n};\n\nexport interface LegacyMessageTag {\n name: string;\n value: string;\n}\n\nconst mapLegacyMessageTags = (messageTags: unknown): SendEmailCommandInput['Tags'] => {\n if (!Array.isArray(messageTags)) {\n return undefined;\n }\n\n return messageTags\n .filter(\n (tag): tag is LegacyMessageTag =>\n typeof tag === 'object' &&\n tag !== null &&\n 'name' in tag &&\n 'value' in tag &&\n typeof tag.name === 'string' &&\n typeof tag.value === 'string'\n )\n .map((tag) => ({\n Name: tag.name,\n Value: tag.value,\n }));\n};\n\n/**\n * Maps legacy node-ses `providerOptions` and AWS SDK v3 `SESClient` config.\n *\n * Rewrites:\n * - `key` / `secret` → `credentials.accessKeyId` / `credentials.secretAccessKey`\n * - `credentials: { key, secret }` → AWS credential object\n * - `amazon` → `endpoint`\n * - region from `amazon` / `endpoint` host (`email.<region>.amazonaws.com`)\n * - `key` + `secret` only → `region: us-east-1` (node-ses default endpoint behavior)\n */\nexport const getClientConfig = (providerOptions: ProviderOptions): SESClientConfig => {\n const { key, secret, amazon, credentials, region, ...clientConfig } = providerOptions;\n\n const hasLegacyStaticCredentials = Boolean(key && secret);\n const endpoint =\n amazon ||\n providerOptions.endpoint ||\n (hasLegacyStaticCredentials ? DEFAULT_SES_ENDPOINT : undefined);\n\n const parsedRegionFromEndpoint = regionFromEndpoint(endpoint);\n\n const explicitCredentials =\n (credentials && typeof credentials === 'object' && 'key' in credentials\n ? {\n accessKeyId: credentials.key,\n secretAccessKey: credentials.secret,\n ...(credentials.sessionToken ? { sessionToken: credentials.sessionToken } : {}),\n }\n : credentials) ||\n (key && secret\n ? {\n accessKeyId: key,\n secretAccessKey: secret,\n }\n : undefined);\n\n const unparseableLegacyAmazon = Boolean(\n amazon && hasLegacyStaticCredentials && !parsedRegionFromEndpoint\n );\n\n const resolvedRegion =\n region ||\n parsedRegionFromEndpoint ||\n ((unparseableLegacyAmazon ||\n (hasLegacyStaticCredentials && !parsedRegionFromEndpoint && !endpoint)) &&\n 'us-east-1') ||\n undefined;\n\n // node-ses createClient only consumed key, secret, and amazon — ignore stray options.\n const sdkOnlyOptions = hasLegacyStaticCredentials ? {} : clientConfig;\n\n return {\n ...sdkOnlyOptions,\n ...(resolvedRegion ? { region: resolvedRegion } : {}),\n ...(endpoint ? { endpoint } : {}),\n ...(explicitCredentials\n ? {\n credentials: explicitCredentials,\n }\n : {}),\n };\n};\n\n/** Builds SendEmail input (html → Html body, text → Text body; legacy node-ses message/altText). */\nexport const buildSendEmailCommandInput = (\n options: SendOptions,\n settings: ProviderSettings\n): SendEmailCommandInput => {\n const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;\n\n const { configurationSet, messageTags, ...sdkRest } = rest;\n\n const commandInput: SendEmailCommandInput = {\n Source: from || settings.defaultFrom,\n Destination: {\n ToAddresses: toAddressList(to),\n CcAddresses: toAddressList(cc),\n BccAddresses: toAddressList(bcc),\n },\n ReplyToAddresses: toAddressList(replyTo !== undefined ? replyTo : settings.defaultReplyTo),\n Message: {\n Subject: {\n Data: subject,\n Charset: 'UTF-8',\n },\n Body: {\n ...(html\n ? {\n Html: {\n Data: html,\n Charset: 'UTF-8',\n },\n }\n : {}),\n ...(text\n ? {\n Text: {\n Data: text,\n Charset: 'UTF-8',\n },\n }\n : {}),\n },\n },\n ...sdkRest,\n };\n\n if (typeof configurationSet === 'string') {\n commandInput.ConfigurationSetName = configurationSet;\n }\n\n const tags = mapLegacyMessageTags(messageTags);\n\n if (tags?.length) {\n commandInput.Tags = tags;\n }\n\n return commandInput;\n};\n"],"names":["DEFAULT_SES_ENDPOINT","SES_ENDPOINT_REGION_PATTERN","resolveEndpointUrl","endpoint","undefined","url","regionFromEndpoint","endpointUrl","match","URL","hostname","toAddressList","value","Array","isArray","mapLegacyMessageTags","messageTags","filter","tag","name","map","Name","Value","getClientConfig","providerOptions","key","secret","amazon","credentials","region","clientConfig","hasLegacyStaticCredentials","Boolean","parsedRegionFromEndpoint","explicitCredentials","accessKeyId","secretAccessKey","sessionToken","unparseableLegacyAmazon","resolvedRegion","sdkOnlyOptions","buildSendEmailCommandInput","options","settings","from","to","cc","bcc","replyTo","subject","text","html","rest","configurationSet","sdkRest","commandInput","Source","defaultFrom","Destination","ToAddresses","CcAddresses","BccAddresses","ReplyToAddresses","defaultReplyTo","Message","Subject","Data","Charset","Body","Html","Text","ConfigurationSetName","tags","length","Tags"],"mappings":";;AAEA,gFACO,MAAMA,oBAAAA,GAAuB;AAE7B,MAAMC,8BAA8B;AAkC3C,MAAMC,qBAAqB,CAACC,QAAAA,GAAAA;AAC1B,IAAA,IAAI,CAACA,QAAAA,EAAU;QACb,OAAOC,SAAAA;AACT,IAAA;IAEA,IAAI,OAAOD,aAAa,QAAA,EAAU;QAChC,OAAOA,QAAAA;AACT,IAAA;IAEA,IAAI,OAAOA,aAAa,QAAA,IAAY,KAAA,IAASA,YAAY,OAAOA,QAAAA,CAASE,GAAG,KAAK,QAAA,EAAU;AACzF,QAAA,OAAOF,SAASE,GAAG;AACrB,IAAA;IAEA,OAAOD,SAAAA;AACT,CAAA;AAEO,MAAME,qBAAqB,CAACH,QAAAA,GAAAA;AACjC,IAAA,MAAMI,cAAcL,kBAAAA,CAAmBC,QAAAA,CAAAA;AAEvC,IAAA,IAAI,CAACI,WAAAA,EAAa;QAChB,OAAOH,SAAAA;AACT,IAAA;IAEA,IAAI;AACF,QAAA,MAAMI,QAAQ,IAAIC,GAAAA,CA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BAAAA,CAAqBC,WAAAA,CAAAA;AAElC,IAAA,IAAIwD,MAAMC,MAAAA,EAAQ;AAChBlB,QAAAA,YAAAA,CAAamB,IAAI,GAAGF,IAAAA;AACtB,IAAA;IAEA,OAAOjB,YAAAA;AACT;;;;;;;;;"}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** Default SES API host when `amazon` is omitted (same as legacy node-ses). */ const DEFAULT_SES_ENDPOINT = 'https://email.us-east-1.amazonaws.com';
|
|
2
|
+
const SES_ENDPOINT_REGION_PATTERN = /email\.([a-z0-9-]+)\.amazonaws\.com/i;
|
|
3
|
+
const resolveEndpointUrl = (endpoint)=>{
|
|
4
|
+
if (!endpoint) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
if (typeof endpoint === 'string') {
|
|
8
|
+
return endpoint;
|
|
9
|
+
}
|
|
10
|
+
if (typeof endpoint === 'object' && 'url' in endpoint && typeof endpoint.url === 'string') {
|
|
11
|
+
return endpoint.url;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
15
|
+
const regionFromEndpoint = (endpoint)=>{
|
|
16
|
+
const endpointUrl = resolveEndpointUrl(endpoint);
|
|
17
|
+
if (!endpointUrl) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const match = new URL(endpointUrl).hostname.match(SES_ENDPOINT_REGION_PATTERN);
|
|
22
|
+
return match?.[1];
|
|
23
|
+
} catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/** Matches node-ses `extractRecipient`: arrays pass through, strings become a single entry. */ const toAddressList = (value)=>{
|
|
28
|
+
if (!value) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
return [
|
|
35
|
+
value
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
const mapLegacyMessageTags = (messageTags)=>{
|
|
39
|
+
if (!Array.isArray(messageTags)) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return messageTags.filter((tag)=>typeof tag === 'object' && tag !== null && 'name' in tag && 'value' in tag && typeof tag.name === 'string' && typeof tag.value === 'string').map((tag)=>({
|
|
43
|
+
Name: tag.name,
|
|
44
|
+
Value: tag.value
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Maps legacy node-ses `providerOptions` and AWS SDK v3 `SESClient` config.
|
|
49
|
+
*
|
|
50
|
+
* Rewrites:
|
|
51
|
+
* - `key` / `secret` → `credentials.accessKeyId` / `credentials.secretAccessKey`
|
|
52
|
+
* - `credentials: { key, secret }` → AWS credential object
|
|
53
|
+
* - `amazon` → `endpoint`
|
|
54
|
+
* - region from `amazon` / `endpoint` host (`email.<region>.amazonaws.com`)
|
|
55
|
+
* - `key` + `secret` only → `region: us-east-1` (node-ses default endpoint behavior)
|
|
56
|
+
*/ const getClientConfig = (providerOptions)=>{
|
|
57
|
+
const { key, secret, amazon, credentials, region, ...clientConfig } = providerOptions;
|
|
58
|
+
const hasLegacyStaticCredentials = Boolean(key && secret);
|
|
59
|
+
const endpoint = amazon || providerOptions.endpoint || (hasLegacyStaticCredentials ? DEFAULT_SES_ENDPOINT : undefined);
|
|
60
|
+
const parsedRegionFromEndpoint = regionFromEndpoint(endpoint);
|
|
61
|
+
const explicitCredentials = (credentials && typeof credentials === 'object' && 'key' in credentials ? {
|
|
62
|
+
accessKeyId: credentials.key,
|
|
63
|
+
secretAccessKey: credentials.secret,
|
|
64
|
+
...credentials.sessionToken ? {
|
|
65
|
+
sessionToken: credentials.sessionToken
|
|
66
|
+
} : {}
|
|
67
|
+
} : credentials) || (key && secret ? {
|
|
68
|
+
accessKeyId: key,
|
|
69
|
+
secretAccessKey: secret
|
|
70
|
+
} : undefined);
|
|
71
|
+
const unparseableLegacyAmazon = Boolean(amazon && hasLegacyStaticCredentials && !parsedRegionFromEndpoint);
|
|
72
|
+
const resolvedRegion = region || parsedRegionFromEndpoint || (unparseableLegacyAmazon || hasLegacyStaticCredentials && !parsedRegionFromEndpoint && !endpoint) && 'us-east-1' || undefined;
|
|
73
|
+
// node-ses createClient only consumed key, secret, and amazon — ignore stray options.
|
|
74
|
+
const sdkOnlyOptions = hasLegacyStaticCredentials ? {} : clientConfig;
|
|
75
|
+
return {
|
|
76
|
+
...sdkOnlyOptions,
|
|
77
|
+
...resolvedRegion ? {
|
|
78
|
+
region: resolvedRegion
|
|
79
|
+
} : {},
|
|
80
|
+
...endpoint ? {
|
|
81
|
+
endpoint
|
|
82
|
+
} : {},
|
|
83
|
+
...explicitCredentials ? {
|
|
84
|
+
credentials: explicitCredentials
|
|
85
|
+
} : {}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/** Builds SendEmail input (html → Html body, text → Text body; legacy node-ses message/altText). */ const buildSendEmailCommandInput = (options, settings)=>{
|
|
89
|
+
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
90
|
+
const { configurationSet, messageTags, ...sdkRest } = rest;
|
|
91
|
+
const commandInput = {
|
|
92
|
+
Source: from || settings.defaultFrom,
|
|
93
|
+
Destination: {
|
|
94
|
+
ToAddresses: toAddressList(to),
|
|
95
|
+
CcAddresses: toAddressList(cc),
|
|
96
|
+
BccAddresses: toAddressList(bcc)
|
|
97
|
+
},
|
|
98
|
+
ReplyToAddresses: toAddressList(replyTo !== undefined ? replyTo : settings.defaultReplyTo),
|
|
99
|
+
Message: {
|
|
100
|
+
Subject: {
|
|
101
|
+
Data: subject,
|
|
102
|
+
Charset: 'UTF-8'
|
|
103
|
+
},
|
|
104
|
+
Body: {
|
|
105
|
+
...html ? {
|
|
106
|
+
Html: {
|
|
107
|
+
Data: html,
|
|
108
|
+
Charset: 'UTF-8'
|
|
109
|
+
}
|
|
110
|
+
} : {},
|
|
111
|
+
...text ? {
|
|
112
|
+
Text: {
|
|
113
|
+
Data: text,
|
|
114
|
+
Charset: 'UTF-8'
|
|
115
|
+
}
|
|
116
|
+
} : {}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
...sdkRest
|
|
120
|
+
};
|
|
121
|
+
if (typeof configurationSet === 'string') {
|
|
122
|
+
commandInput.ConfigurationSetName = configurationSet;
|
|
123
|
+
}
|
|
124
|
+
const tags = mapLegacyMessageTags(messageTags);
|
|
125
|
+
if (tags?.length) {
|
|
126
|
+
commandInput.Tags = tags;
|
|
127
|
+
}
|
|
128
|
+
return commandInput;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { DEFAULT_SES_ENDPOINT, SES_ENDPOINT_REGION_PATTERN, buildSendEmailCommandInput, getClientConfig, regionFromEndpoint, toAddressList };
|
|
132
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../src/utils.ts"],"sourcesContent":["import type { SendEmailCommandInput, SESClientConfig } from '@aws-sdk/client-ses';\n\n/** Default SES API host when `amazon` is omitted (same as legacy node-ses). */\nexport const DEFAULT_SES_ENDPOINT = 'https://email.us-east-1.amazonaws.com';\n\nexport const SES_ENDPOINT_REGION_PATTERN = /email\\.([a-z0-9-]+)\\.amazonaws\\.com/i;\n\nexport interface ProviderCredentials {\n key: string;\n secret: string;\n sessionToken?: string;\n}\n\nexport interface ProviderOptions extends Omit<SESClientConfig, 'credentials'> {\n credentials?: ProviderCredentials | NonNullable<SESClientConfig['credentials']>;\n key?: string;\n secret?: string;\n amazon?: string;\n}\n\nexport interface ProviderSettings {\n defaultFrom: string;\n defaultReplyTo: string | string[];\n}\n\nexport interface SendOptions {\n from?: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string | string[];\n subject: string;\n text: string;\n html: string;\n [key: string]: unknown;\n}\n\ntype EndpointInput = string | SESClientConfig['endpoint'];\n\nconst resolveEndpointUrl = (endpoint?: EndpointInput): string | undefined => {\n if (!endpoint) {\n return undefined;\n }\n\n if (typeof endpoint === 'string') {\n return endpoint;\n }\n\n if (typeof endpoint === 'object' && 'url' in endpoint && typeof endpoint.url === 'string') {\n return endpoint.url;\n }\n\n return undefined;\n};\n\nexport const regionFromEndpoint = (endpoint?: EndpointInput): string | undefined => {\n const endpointUrl = resolveEndpointUrl(endpoint);\n\n if (!endpointUrl) {\n return undefined;\n }\n\n try {\n const match = new URL(endpointUrl).hostname.match(SES_ENDPOINT_REGION_PATTERN);\n return match?.[1];\n } catch {\n return undefined;\n }\n};\n\n/** Matches node-ses `extractRecipient`: arrays pass through, strings become a single entry. */\nexport const toAddressList = (value?: string | string[]): string[] | undefined => {\n if (!value) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return [value];\n};\n\nexport interface LegacyMessageTag {\n name: string;\n value: string;\n}\n\nconst mapLegacyMessageTags = (messageTags: unknown): SendEmailCommandInput['Tags'] => {\n if (!Array.isArray(messageTags)) {\n return undefined;\n }\n\n return messageTags\n .filter(\n (tag): tag is LegacyMessageTag =>\n typeof tag === 'object' &&\n tag !== null &&\n 'name' in tag &&\n 'value' in tag &&\n typeof tag.name === 'string' &&\n typeof tag.value === 'string'\n )\n .map((tag) => ({\n Name: tag.name,\n Value: tag.value,\n }));\n};\n\n/**\n * Maps legacy node-ses `providerOptions` and AWS SDK v3 `SESClient` config.\n *\n * Rewrites:\n * - `key` / `secret` → `credentials.accessKeyId` / `credentials.secretAccessKey`\n * - `credentials: { key, secret }` → AWS credential object\n * - `amazon` → `endpoint`\n * - region from `amazon` / `endpoint` host (`email.<region>.amazonaws.com`)\n * - `key` + `secret` only → `region: us-east-1` (node-ses default endpoint behavior)\n */\nexport const getClientConfig = (providerOptions: ProviderOptions): SESClientConfig => {\n const { key, secret, amazon, credentials, region, ...clientConfig } = providerOptions;\n\n const hasLegacyStaticCredentials = Boolean(key && secret);\n const endpoint =\n amazon ||\n providerOptions.endpoint ||\n (hasLegacyStaticCredentials ? DEFAULT_SES_ENDPOINT : undefined);\n\n const parsedRegionFromEndpoint = regionFromEndpoint(endpoint);\n\n const explicitCredentials =\n (credentials && typeof credentials === 'object' && 'key' in credentials\n ? {\n accessKeyId: credentials.key,\n secretAccessKey: credentials.secret,\n ...(credentials.sessionToken ? { sessionToken: credentials.sessionToken } : {}),\n }\n : credentials) ||\n (key && secret\n ? {\n accessKeyId: key,\n secretAccessKey: secret,\n }\n : undefined);\n\n const unparseableLegacyAmazon = Boolean(\n amazon && hasLegacyStaticCredentials && !parsedRegionFromEndpoint\n );\n\n const resolvedRegion =\n region ||\n parsedRegionFromEndpoint ||\n ((unparseableLegacyAmazon ||\n (hasLegacyStaticCredentials && !parsedRegionFromEndpoint && !endpoint)) &&\n 'us-east-1') ||\n undefined;\n\n // node-ses createClient only consumed key, secret, and amazon — ignore stray options.\n const sdkOnlyOptions = hasLegacyStaticCredentials ? {} : clientConfig;\n\n return {\n ...sdkOnlyOptions,\n ...(resolvedRegion ? { region: resolvedRegion } : {}),\n ...(endpoint ? { endpoint } : {}),\n ...(explicitCredentials\n ? {\n credentials: explicitCredentials,\n }\n : {}),\n };\n};\n\n/** Builds SendEmail input (html → Html body, text → Text body; legacy node-ses message/altText). */\nexport const buildSendEmailCommandInput = (\n options: SendOptions,\n settings: ProviderSettings\n): SendEmailCommandInput => {\n const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;\n\n const { configurationSet, messageTags, ...sdkRest } = rest;\n\n const commandInput: SendEmailCommandInput = {\n Source: from || settings.defaultFrom,\n Destination: {\n ToAddresses: toAddressList(to),\n CcAddresses: toAddressList(cc),\n BccAddresses: toAddressList(bcc),\n },\n ReplyToAddresses: toAddressList(replyTo !== undefined ? replyTo : settings.defaultReplyTo),\n Message: {\n Subject: {\n Data: subject,\n Charset: 'UTF-8',\n },\n Body: {\n ...(html\n ? {\n Html: {\n Data: html,\n Charset: 'UTF-8',\n },\n }\n : {}),\n ...(text\n ? {\n Text: {\n Data: text,\n Charset: 'UTF-8',\n },\n }\n : {}),\n },\n },\n ...sdkRest,\n };\n\n if (typeof configurationSet === 'string') {\n commandInput.ConfigurationSetName = configurationSet;\n }\n\n const tags = mapLegacyMessageTags(messageTags);\n\n if (tags?.length) {\n commandInput.Tags = tags;\n }\n\n return commandInput;\n};\n"],"names":["DEFAULT_SES_ENDPOINT","SES_ENDPOINT_REGION_PATTERN","resolveEndpointUrl","endpoint","undefined","url","regionFromEndpoint","endpointUrl","match","URL","hostname","toAddressList","value","Array","isArray","mapLegacyMessageTags","messageTags","filter","tag","name","map","Name","Value","getClientConfig","providerOptions","key","secret","amazon","credentials","region","clientConfig","hasLegacyStaticCredentials","Boolean","parsedRegionFromEndpoint","explicitCredentials","accessKeyId","secretAccessKey","sessionToken","unparseableLegacyAmazon","resolvedRegion","sdkOnlyOptions","buildSendEmailCommandInput","options","settings","from","to","cc","bcc","replyTo","subject","text","html","rest","configurationSet","sdkRest","commandInput","Source","defaultFrom","Destination","ToAddresses","CcAddresses","BccAddresses","ReplyToAddresses","defaultReplyTo","Message","Subject","Data","Charset","Body","Html","Text","ConfigurationSetName","tags","length","Tags"],"mappings":"AAEA,gFACO,MAAMA,oBAAAA,GAAuB;AAE7B,MAAMC,8BAA8B;AAkC3C,MAAMC,qBAAqB,CAACC,QAAAA,GAAAA;AAC1B,IAAA,IAAI,CAACA,QAAAA,EAAU;QACb,OAAOC,SAAAA;AACT,IAAA;IAEA,IAAI,OAAOD,aAAa,QAAA,EAAU;QAChC,OAAOA,QAAAA;AACT,IAAA;IAEA,IAAI,OAAOA,aAAa,QAAA,IAAY,KAAA,IAASA,YAAY,OAAOA,QAAAA,CAASE,GAAG,KAAK,QAAA,EAAU;AACzF,QAAA,OAAOF,SAASE,GAAG;AACrB,IAAA;IAEA,OAAOD,SAAAA;AACT,CAAA;AAEO,MAAME,qBAAqB,CAACH,QAAAA,GAAAA;AACjC,IAAA,MAAMI,cAAcL,kBAAAA,CAAmBC,QA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IAEA,IAAI,OAAOD,qBAAqB,QAAA,EAAU;AACxCE,QAAAA,YAAAA,CAAagB,oBAAoB,GAAGlB,gBAAAA;AACtC,IAAA;AAEA,IAAA,MAAMmB,OAAOzD,oBAAAA,CAAqBC,WAAAA,CAAAA;AAElC,IAAA,IAAIwD,MAAMC,MAAAA,EAAQ;AAChBlB,QAAAA,YAAAA,CAAamB,IAAI,GAAGF,IAAAA;AACtB,IAAA;IAEA,OAAOjB,YAAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-email-amazon-ses",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.47.0",
|
|
4
4
|
"description": "Amazon SES provider for strapi email",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
"directory": "packages/providers/email-amazon-ses"
|
|
19
19
|
},
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE",
|
|
21
|
-
"author": {
|
|
22
|
-
"name": "Nikolay tsenkov",
|
|
23
|
-
"email": "nikolay@tsenkov.net"
|
|
24
|
-
},
|
|
25
21
|
"maintainers": [
|
|
26
22
|
{
|
|
27
23
|
"name": "Strapi Solutions SAS",
|
|
@@ -42,15 +38,19 @@
|
|
|
42
38
|
"build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
43
39
|
"clean": "run -T rimraf ./dist",
|
|
44
40
|
"lint": "run -T eslint .",
|
|
41
|
+
"test:unit:vitest": "vitest run",
|
|
42
|
+
"test:unit:vitest:watch": "vitest --watch",
|
|
45
43
|
"watch": "run -T rollup -c -w"
|
|
46
44
|
},
|
|
47
45
|
"dependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
46
|
+
"@aws-sdk/client-ses": "3.1023.0",
|
|
47
|
+
"@strapi/utils": "5.47.0"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"eslint-config-custom": "5.
|
|
53
|
-
"tsconfig": "5.
|
|
50
|
+
"eslint-config-custom": "5.47.0",
|
|
51
|
+
"tsconfig": "5.47.0",
|
|
52
|
+
"vitest": "catalog:",
|
|
53
|
+
"vitest-config": "5.47.0"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=20.0.0 <=24.x.x",
|