@strapi/provider-email-nodemailer 0.0.0-next.c58b405b44c71a93df733024d1f15c069cb6bdca → 0.0.0-next.d1dda661d262d4773c59ee693c38542d9b0dc54c

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.
@@ -0,0 +1,25 @@
1
+ import nodemailer from 'nodemailer';
2
+ interface Settings {
3
+ defaultFrom: string;
4
+ defaultReplyTo: string;
5
+ }
6
+ interface SendOptions {
7
+ from?: string;
8
+ to: string;
9
+ cc: string;
10
+ bcc: string;
11
+ replyTo?: string;
12
+ subject: string;
13
+ text: string;
14
+ html: string;
15
+ [key: string]: unknown;
16
+ }
17
+ type ProviderOptions = Parameters<typeof nodemailer.createTransport>[0];
18
+ declare const _default: {
19
+ provider: string;
20
+ name: string;
21
+ init(providerOptions: ProviderOptions, settings: Settings): {
22
+ send(options: SendOptions): Promise<unknown>;
23
+ };
24
+ };
25
+ 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 lodash_1 = __importDefault(require("lodash"));
6
+ const nodemailer_1 = __importDefault(require("nodemailer"));
7
+ const emailFields = [
8
+ 'from',
9
+ 'replyTo',
10
+ 'to',
11
+ 'cc',
12
+ 'bcc',
13
+ 'subject',
14
+ 'text',
15
+ 'html',
16
+ 'attachments',
17
+ ];
18
+ module.exports = {
19
+ provider: 'nodemailer',
20
+ name: 'Nodemailer',
21
+ init(providerOptions, settings) {
22
+ const transporter = nodemailer_1.default.createTransport(providerOptions);
23
+ return {
24
+ send(options) {
25
+ // Default values.
26
+ const emailOptions = {
27
+ ...lodash_1.default.pick(options, emailFields),
28
+ from: options.from || settings.defaultFrom,
29
+ replyTo: options.replyTo || settings.defaultReplyTo,
30
+ text: options.text || options.html,
31
+ html: options.html || options.text,
32
+ };
33
+ return transporter.sendMail(emailOptions);
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,oDAAuB;AACvB,4DAAyD;AAqBzD,MAAM,WAAW,GAAG;IAClB,MAAM;IACN,SAAS;IACT,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,aAAa;CACd,CAAC;AAEF,iBAAS;IACP,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,YAAY;IAElB,IAAI,CAAC,eAAgC,EAAE,QAAkB;QACvD,MAAM,WAAW,GAAG,oBAAU,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAEhE,OAAO;YACL,IAAI,CAAC,OAAoB;gBACvB,kBAAkB;gBAClB,MAAM,YAAY,GAAoB;oBACpC,GAAG,gBAAC,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;oBAC/B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW;oBAC1C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,cAAc;oBACnD,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;oBAClC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;iBACnC,CAAC;gBAEF,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/provider-email-nodemailer",
3
- "version": "0.0.0-next.c58b405b44c71a93df733024d1f15c069cb6bdca",
3
+ "version": "0.0.0-next.d1dda661d262d4773c59ee693c38542d9b0dc54c",
4
4
  "description": "Nodemailer provider for Strapi 3",
5
5
  "keywords": [
6
6
  "strapi",
@@ -41,20 +41,31 @@
41
41
  "email": "git@roschaefer.de"
42
42
  }
43
43
  ],
44
- "main": "./lib",
45
- "directories": {
46
- "lib": "./lib"
47
- },
44
+ "main": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "files": [
47
+ "./dist"
48
+ ],
48
49
  "scripts": {
50
+ "build": "run -T tsc",
51
+ "build:ts": "run -T tsc",
52
+ "watch": "run -T tsc -w --preserveWatchOutput",
53
+ "clean": "run -T rimraf ./dist",
54
+ "prepublishOnly": "yarn clean && yarn build",
49
55
  "lint": "run -T eslint ."
50
56
  },
51
57
  "dependencies": {
52
58
  "lodash": "4.17.21",
53
59
  "nodemailer": "6.9.1"
54
60
  },
61
+ "devDependencies": {
62
+ "@types/nodemailer": "6.4.7",
63
+ "eslint-config-custom": "0.0.0-next.d1dda661d262d4773c59ee693c38542d9b0dc54c",
64
+ "tsconfig": "0.0.0-next.d1dda661d262d4773c59ee693c38542d9b0dc54c"
65
+ },
55
66
  "engines": {
56
67
  "node": ">=14.19.1 <=18.x.x",
57
68
  "npm": ">=6.0.0"
58
69
  },
59
- "gitHead": "c58b405b44c71a93df733024d1f15c069cb6bdca"
70
+ "gitHead": "d1dda661d262d4773c59ee693c38542d9b0dc54c"
60
71
  }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules/
2
- .eslintrc.js
package/.eslintrc.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['custom/back'],
4
- };
package/lib/index.js DELETED
@@ -1,44 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Module dependencies
5
- */
6
-
7
- const _ = require('lodash');
8
- const nodemailer = require('nodemailer');
9
-
10
- const emailFields = [
11
- 'from',
12
- 'replyTo',
13
- 'to',
14
- 'cc',
15
- 'bcc',
16
- 'subject',
17
- 'text',
18
- 'html',
19
- 'attachments',
20
- ];
21
-
22
- module.exports = {
23
- provider: 'nodemailer',
24
- name: 'Nodemailer',
25
-
26
- init(providerOptions = {}, settings = {}) {
27
- const transporter = nodemailer.createTransport(providerOptions);
28
-
29
- return {
30
- send(options) {
31
- // Default values.
32
- const emailOptions = {
33
- ..._.pick(options, emailFields),
34
- from: options.from || settings.defaultFrom,
35
- replyTo: options.replyTo || settings.defaultReplyTo,
36
- text: options.text || options.html,
37
- html: options.html || options.text,
38
- };
39
-
40
- return transporter.sendMail(emailOptions);
41
- },
42
- };
43
- },
44
- };