@strapi/provider-email-amazon-ses 4.9.1 → 4.9.2
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/dist/index.d.ts +26 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/package.json +17 -7
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -4
- package/lib/index.js +0 -41
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Settings {
|
|
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
|
+
}
|
|
21
|
+
declare const _default: {
|
|
22
|
+
init(providerOptions: ProviderOptions, settings: Settings): {
|
|
23
|
+
send(options: SendOptions): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export = _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const node_ses_1 = __importDefault(require("node-ses"));
|
|
6
|
+
const utils_1 = __importDefault(require("@strapi/utils"));
|
|
7
|
+
module.exports = {
|
|
8
|
+
init(providerOptions, settings) {
|
|
9
|
+
const client = node_ses_1.default.createClient(providerOptions);
|
|
10
|
+
return {
|
|
11
|
+
send(options) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
14
|
+
const msg = {
|
|
15
|
+
from: from || settings.defaultFrom,
|
|
16
|
+
to,
|
|
17
|
+
cc,
|
|
18
|
+
bcc,
|
|
19
|
+
replyTo: replyTo || settings.defaultReplyTo,
|
|
20
|
+
subject,
|
|
21
|
+
altText: text,
|
|
22
|
+
message: html,
|
|
23
|
+
...rest,
|
|
24
|
+
};
|
|
25
|
+
client.sendEmail(utils_1.default.removeUndefined(msg), (err) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
if (err.Message) {
|
|
28
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
29
|
+
reject(`${err.Message} ${err.Detail ? err.Detail : ''}`);
|
|
30
|
+
}
|
|
31
|
+
reject(err);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
resolve();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAC/B,0DAAkC;AAyBlC,iBAAS;IACP,IAAI,CAAC,eAAgC,EAAE,QAAkB;QACvD,MAAM,MAAM,GAAG,kBAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QAErD,OAAO;YACL,IAAI,CAAC,OAAoB;gBACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBACrC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;oBAE7E,MAAM,GAAG,GAA6B;wBACpC,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,WAAW;wBAClC,EAAE;wBACF,EAAE;wBACF,GAAG;wBACH,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,cAAc;wBAC3C,OAAO;wBACP,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,IAAI;wBACb,GAAG,IAAI;qBACR,CAAC;oBAEF,MAAM,CAAC,SAAS,CAAC,eAAK,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;wBACnD,IAAI,GAAG,EAAE;4BACP,IAAI,GAAG,CAAC,OAAO,EAAE;gCACf,wDAAwD;gCACxD,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;6BAC1D;4BACD,MAAM,CAAC,GAAG,CAAC,CAAC;yBACb;6BAAM;4BACL,OAAO,EAAE,CAAC;yBACX;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-email-amazon-ses",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.2",
|
|
4
4
|
"description": "Amazon SES provider for strapi email",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -28,20 +28,30 @@
|
|
|
28
28
|
"url": "https://strapi.io"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
"main": "./
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"./dist"
|
|
35
|
+
],
|
|
35
36
|
"scripts": {
|
|
37
|
+
"build": "run -T tsc",
|
|
38
|
+
"build:ts": "run -T tsc",
|
|
39
|
+
"watch": "run -T tsc -w --preserveWatchOutput",
|
|
40
|
+
"clean": "run -T rimraf ./dist",
|
|
41
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
36
42
|
"lint": "run -T eslint ."
|
|
37
43
|
},
|
|
38
44
|
"dependencies": {
|
|
39
|
-
"@strapi/utils": "4.9.
|
|
45
|
+
"@strapi/utils": "4.9.2",
|
|
40
46
|
"node-ses": "^3.0.3"
|
|
41
47
|
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"eslint-config-custom": "4.9.2",
|
|
50
|
+
"tsconfig": "4.9.2"
|
|
51
|
+
},
|
|
42
52
|
"engines": {
|
|
43
53
|
"node": ">=14.19.1 <=18.x.x",
|
|
44
54
|
"npm": ">=6.0.0"
|
|
45
55
|
},
|
|
46
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "91e0be2708e4d1e8ec731c75e73e54c0dfacb67d"
|
|
47
57
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/lib/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const nodeSES = require('node-ses');
|
|
4
|
-
const { removeUndefined } = require('@strapi/utils');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
init(providerOptions = {}, settings = {}) {
|
|
8
|
-
const client = nodeSES.createClient({ ...providerOptions });
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
send(options) {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
14
|
-
|
|
15
|
-
const msg = {
|
|
16
|
-
from: from || settings.defaultFrom,
|
|
17
|
-
to,
|
|
18
|
-
cc,
|
|
19
|
-
bcc,
|
|
20
|
-
replyTo: replyTo || settings.defaultReplyTo,
|
|
21
|
-
subject,
|
|
22
|
-
altText: text,
|
|
23
|
-
message: html,
|
|
24
|
-
...rest,
|
|
25
|
-
};
|
|
26
|
-
client.sendEmail(removeUndefined(msg), (err) => {
|
|
27
|
-
if (err) {
|
|
28
|
-
if (err.Message) {
|
|
29
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
30
|
-
reject(`${err.Message} ${err.Detail ? err.Detail : ''}`);
|
|
31
|
-
}
|
|
32
|
-
reject(err);
|
|
33
|
-
} else {
|
|
34
|
-
resolve();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
};
|