@strapi/provider-email-sendgrid 4.10.0-beta.0 → 4.10.0-beta.1
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 +24 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +18 -8
- package/lib/index.js +0 -38
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
apiKey: string;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: {
|
|
20
|
+
init(providerOptions: ProviderOptions, settings: Settings): {
|
|
21
|
+
send(options: SendOptions): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export = _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const mail_1 = __importDefault(require("@sendgrid/mail"));
|
|
6
|
+
const utils_1 = __importDefault(require("@strapi/utils"));
|
|
7
|
+
module.exports = {
|
|
8
|
+
init(providerOptions, settings) {
|
|
9
|
+
mail_1.default.setApiKey(providerOptions.apiKey);
|
|
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
|
+
text,
|
|
22
|
+
html,
|
|
23
|
+
...rest,
|
|
24
|
+
};
|
|
25
|
+
mail_1.default.send(utils_1.default.removeUndefined(msg), false, (err) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
reject(err);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
resolve();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,0DAA4D;AAC5D,0DAAkC;AAuBlC,iBAAS;IACP,IAAI,CAAC,eAAgC,EAAE,QAAkB;QACvD,cAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAE3C,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,GAAqB;wBAC5B,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,WAAW;wBAClC,EAAE;wBACF,EAAE;wBACF,GAAG;wBACH,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,cAAc;wBAC3C,OAAO;wBACP,IAAI;wBACJ,IAAI;wBACJ,GAAG,IAAI;qBACR,CAAC;oBAEF,cAAQ,CAAC,IAAI,CAAC,eAAK,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;wBACvD,IAAI,GAAG,EAAE;4BACP,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-sendgrid",
|
|
3
|
-
"version": "4.10.0-beta.
|
|
3
|
+
"version": "4.10.0-beta.1",
|
|
4
4
|
"description": "Sendgrid 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": {
|
|
36
|
-
"
|
|
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",
|
|
42
|
+
"lint": "run -T eslint ."
|
|
37
43
|
},
|
|
38
44
|
"dependencies": {
|
|
39
45
|
"@sendgrid/mail": "7.7.0",
|
|
40
|
-
"@strapi/utils": "4.10.0-beta.
|
|
46
|
+
"@strapi/utils": "4.10.0-beta.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"eslint-config-custom": "4.10.0-beta.1",
|
|
50
|
+
"tsconfig": "4.10.0-beta.1"
|
|
41
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": "95d581b31bee464af42e5d8db408fa578d8532c7"
|
|
47
57
|
}
|
package/lib/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const sendgrid = require('@sendgrid/mail');
|
|
4
|
-
const { removeUndefined } = require('@strapi/utils');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
init(providerOptions = {}, settings = {}) {
|
|
8
|
-
sendgrid.setApiKey(providerOptions.apiKey);
|
|
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
|
-
text,
|
|
23
|
-
html,
|
|
24
|
-
...rest,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
sendgrid.send(removeUndefined(msg), (err) => {
|
|
28
|
-
if (err) {
|
|
29
|
-
reject(err);
|
|
30
|
-
} else {
|
|
31
|
-
resolve();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
};
|