@timshel_npm/maildev 3.1.3 → 3.2.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 CHANGED
@@ -30,8 +30,8 @@ Or can be installed using [Github](https://docs.npmjs.com/cli/v10/configuring-np
30
30
  Ex:
31
31
  ```json
32
32
  "devDependencies": {
33
- "maildev": "github:timshel/maildev#3.1.2",
34
- "maildev": "npm:@timshel_npm/maildev@^3.1.2"
33
+ "maildev": "github:timshel/maildev#3.2.0",
34
+ "maildev": "npm:@timshel_npm/maildev@^3.2.0"
35
35
  }
36
36
  ```
37
37
 
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MailDev = void 0;
4
4
  const mailserver_1 = require("./lib/mailserver");
5
5
  const web_1 = require("./lib/web");
6
- const async = require("async");
7
6
  const logger = require("./lib/logger");
8
7
  class MailDev extends mailserver_1.MailServer {
9
8
  constructor(config, mailEventSubjectMapper) {
@@ -160,7 +160,7 @@ function generateFileNames(fileNames, fileName, contentType) {
160
160
  let ext;
161
161
  let defaultExt = "";
162
162
  if (contentType) {
163
- const ext = mime.extension(contentType); // renamed as getExtension in > 2.0
163
+ const ext = mime.getExtension(contentType);
164
164
  defaultExt = ext ? "." + ext : "";
165
165
  }
166
166
  fileName = fileName || "attachment" + defaultExt;
@@ -58,7 +58,11 @@ const options = [
58
58
  ],
59
59
  ["--web-user <user>", "MAILDEV_WEB_USER", "HTTP user for GUI"],
60
60
  ["--web-pass <password>", "MAILDEV_WEB_PASS", "HTTP password for GUI"],
61
- ["--web-domain <path>", "MAILDEV_WEB_DOMAIN", "External domain name (used for socket CORS, \"*\" otherwise)"],
61
+ [
62
+ "--web-domain <path>",
63
+ "MAILDEV_WEB_DOMAIN",
64
+ 'External domain name (used for socket CORS, "*" otherwise)',
65
+ ],
62
66
  ["--base-pathname <path>", "MAILDEV_BASE_PATHNAME", "Base path for URLs"],
63
67
  ["--https", "MAILDEV_HTTPS", "Switch from http to https protocol", false],
64
68
  ["--https-key <file>", "MAILDEV_HTTPS_KEY", "The file path to the ssl private key"],
@@ -13,13 +13,13 @@ function routes(app, mailserver, basePathname) {
13
13
  const router = express.Router();
14
14
  // Get all emails Enveloppe
15
15
  router.get("/envelope", compression(), function (req, res) {
16
- res.json(mailserver.getAllEnvelope());
16
+ res.status(200).json(mailserver.getAllEnvelope());
17
17
  });
18
18
  // Get all emails
19
19
  router.get("/email", compression(), function (req, res) {
20
20
  mailserver
21
21
  .getAllEmail()
22
- .then((mails) => res.json(req.query ? filterEmails(mails, req.query) : mails))
22
+ .then((mails) => res.status(200).json(req.query ? filterEmails(mails, req.query) : mails))
23
23
  .catch((err) => res.status(500).json({ error: err.message }));
24
24
  });
25
25
  // Get single email
@@ -28,7 +28,7 @@ function routes(app, mailserver, basePathname) {
28
28
  .getEmail(req.params.id)
29
29
  .then((mail) => {
30
30
  mail.envelope.isRead = true; // Mark the email as 'read'
31
- res.json(mail);
31
+ res.status(200).json(mail);
32
32
  })
33
33
  .catch((err) => res.status(404).json({ error: err.message }));
34
34
  });
@@ -42,20 +42,20 @@ function routes(app, mailserver, basePathname) {
42
42
  // Read all emails
43
43
  router.patch("/email/read-all", function (req, res) {
44
44
  const count = mailserver.readAllEmail();
45
- res.json(count);
45
+ res.status(200).json(count);
46
46
  });
47
47
  // Delete all emails
48
48
  router.delete("/email/all", function (req, res) {
49
49
  mailserver
50
50
  .deleteAllEmail()
51
- .then((count) => res.json(count))
51
+ .then((count) => res.status(200).json(count))
52
52
  .catch((err) => res.status(500).json({ error: err.message }));
53
53
  });
54
54
  // Delete email by id
55
55
  router.delete("/email/:id", function (req, res) {
56
56
  mailserver
57
57
  .deleteEmail(req.params.id)
58
- .then((deleted) => res.json(deleted))
58
+ .then((deleted) => res.status(200).json(deleted))
59
59
  .catch((err) => res.status(500).json({ error: err.message }));
60
60
  });
61
61
  // Get Email HTML
@@ -64,7 +64,7 @@ function routes(app, mailserver, basePathname) {
64
64
  const baseUrl = req.headers.host + (req.baseUrl || "");
65
65
  mailserver
66
66
  .getEmailHTML(req.params.id, baseUrl)
67
- .then((html) => res.send(html))
67
+ .then((html) => res.status(200).send(html))
68
68
  .catch((err) => res.status(404).json({ error: err.message }));
69
69
  });
70
70
  // Serve Attachments
@@ -73,7 +73,7 @@ function routes(app, mailserver, basePathname) {
73
73
  .getEmailAttachment(req.params.id, req.params.filename)
74
74
  .then((attachement) => {
75
75
  res.contentType(attachement.contentType);
76
- res.send(attachement.content);
76
+ res.status(200).send(attachement.content);
77
77
  })
78
78
  .catch((err) => res.status(404).json({ error: err.message }));
79
79
  });
@@ -97,7 +97,7 @@ function routes(app, mailserver, basePathname) {
97
97
  });
98
98
  // Get any config settings for display
99
99
  router.get("/config", function (req, res) {
100
- res.json({
100
+ res.status(200).json({
101
101
  version: pkg.version,
102
102
  smtpPort: mailserver.port,
103
103
  isOutgoingEnabled: mailserver.isOutgoingEnabled(),
@@ -105,7 +105,7 @@ function routes(app, mailserver, basePathname) {
105
105
  });
106
106
  });
107
107
  // Relay the email
108
- router.post("/email/:id/relay/:relayTo?", function (req, res) {
108
+ router.post("/email/:id/relay{/:relayTo}", function (req, res) {
109
109
  mailserver
110
110
  .getEmail(req.params.id)
111
111
  .then((mail) => {
@@ -122,18 +122,18 @@ function routes(app, mailserver, basePathname) {
122
122
  }
123
123
  return mailserver
124
124
  .relayMail(mail, false)
125
- .then(() => res.json(true))
125
+ .then(() => res.status(200).json(true))
126
126
  .catch((err) => res.status(500).json({ error: err.message }));
127
127
  })
128
128
  .catch((err) => res.status(404).json({ error: err.message }));
129
129
  });
130
130
  // Health check
131
131
  router.get("/healthz", function (req, res) {
132
- res.json(true);
132
+ res.status(200).json(true);
133
133
  });
134
134
  router.get("/reloadMailsFromDirectory", function (req, res) {
135
135
  mailserver.loadMailsFromDirectory();
136
- res.json(true);
136
+ res.status(200).json(true);
137
137
  });
138
138
  app.use(basePathname, router);
139
139
  }
package/dist/lib/web.js CHANGED
@@ -33,11 +33,11 @@ class Web {
33
33
  app.use(auth((_d = options === null || options === void 0 ? void 0 : options.auth) === null || _d === void 0 ? void 0 : _d.user, (_e = options === null || options === void 0 ? void 0 : options.auth) === null || _e === void 0 ? void 0 : _e.pass));
34
34
  }
35
35
  this.io = socketio({
36
- path: path.posix.join(this.basePathname, '/socket.io'),
36
+ path: path.posix.join(this.basePathname, "/socket.io"),
37
37
  cors: {
38
- origin: (_f = options === null || options === void 0 ? void 0 : options.domain) !== null && _f !== void 0 ? _f : '*',
39
- methods: ["GET", "POST"]
40
- }
38
+ origin: (_f = options === null || options === void 0 ? void 0 : options.domain) !== null && _f !== void 0 ? _f : "*",
39
+ methods: ["GET", "POST"],
40
+ },
41
41
  });
42
42
  app.use(this.basePathname, express.static(path.join(__dirname, "../app")));
43
43
  app.use(cors());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timshel_npm/maildev",
3
- "description": "SMTP Server and Web Interface for reading and testing emails during development",
4
- "version": "3.1.3",
3
+ "description": "SMTP Server with async API and Web Interface for viewing and testing emails during development",
4
+ "version": "3.2.0",
5
5
  "keywords": [
6
6
  "email",
7
7
  "e-mail",
@@ -10,10 +10,12 @@
10
10
  "mailcatcher",
11
11
  "testing",
12
12
  "development",
13
- "smtp"
13
+ "smtp",
14
+ "async",
15
+ "playwright"
14
16
  ],
15
17
  "author": "Timshel",
16
- "homepage": "https://github.com/timshel/maildev",
18
+ "homepage": "https://github.com/Timshel/maildev",
17
19
  "maintainers": [
18
20
  {
19
21
  "name": "Timshel",
@@ -22,7 +24,7 @@
22
24
  ],
23
25
  "repository": {
24
26
  "type": "git",
25
- "url": "https://github.com/timshel/maildev.git"
27
+ "url": "https://github.com/Timshel/maildev"
26
28
  },
27
29
  "scripts": {
28
30
  "clean": "rm -rf dist coverage tsconfig.tsbuildinfo",
@@ -56,16 +58,16 @@
56
58
  "@types/mailparser": "^3.4.6",
57
59
  "addressparser": "1.0.1",
58
60
  "async": "^3.2.6",
59
- "commander": "^12.1.0",
61
+ "commander": "^13.1.0",
60
62
  "compression": "^1.8.0",
61
63
  "cors": "^2.8.5",
62
64
  "dompurify": "^3.2.6",
63
- "express": "^4.21.2",
64
- "jsdom": "^24.1.3",
65
+ "express": "^5.1.0",
66
+ "jsdom": "^26.1.0",
65
67
  "mailparser": "^3.7.3",
66
- "mime": "1.6.0",
67
- "nodemailer": "^6.10.1",
68
- "smtp-server": "^3.13.8",
68
+ "mime": "^3.0.0",
69
+ "nodemailer": "^7.0.3",
70
+ "smtp-server": "^3.14.0",
69
71
  "socket.io": "^4.8.1",
70
72
  "wildstring": "1.0.9"
71
73
  },
@@ -75,11 +77,11 @@
75
77
  "devDependencies": {
76
78
  "@types/express": "^4.17.23",
77
79
  "@types/node": "^18.19.112",
78
- "expect": "^29.7.0",
80
+ "expect": "^30.0.3",
79
81
  "http-proxy-middleware": "^3.0.5",
80
- "jest": "^29.7.0",
81
- "jest-mock": "^29.7.0",
82
- "mocha": "^10.8.2",
82
+ "jest": "^30.0.3",
83
+ "jest-mock": "^30.0.2",
84
+ "mocha": "^11.7.1",
83
85
  "nodemon": "^3.1.10",
84
86
  "nyc": "^17.1.0",
85
87
  "prettier": "^3.6.2",