emailengine-app 2.84.2 → 2.85.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.
Files changed (86) hide show
  1. package/.ncurc.js +5 -3
  2. package/.prettierignore +5 -1
  3. package/.prettierrc.js +2 -0
  4. package/.release-please-manifest.json +1 -1
  5. package/CHANGELOG.md +33 -0
  6. package/Dockerfile +6 -0
  7. package/README.md +1 -1
  8. package/bin/emailengine.js +434 -408
  9. package/copy-static-files.sh +39 -14
  10. package/data/google-crawlers.json +1 -1
  11. package/data/public_suffix_list.dat +16562 -0
  12. package/eslint.config.js +81 -99
  13. package/lib/account.js +36 -5
  14. package/lib/api-reference/format.js +4 -3
  15. package/lib/api-routes/account-routes.js +177 -12
  16. package/lib/api-routes/blocklist-routes.js +23 -2
  17. package/lib/api-routes/delivery-test-routes.js +26 -3
  18. package/lib/api-routes/export-routes.js +28 -2
  19. package/lib/api-routes/gateway-routes.js +28 -2
  20. package/lib/api-routes/mailbox-routes.js +41 -2
  21. package/lib/api-routes/message-routes.js +97 -3
  22. package/lib/api-routes/oauth2-app-routes.js +48 -15
  23. package/lib/api-routes/outbox-routes.js +45 -11
  24. package/lib/api-routes/permission-map.js +12 -1
  25. package/lib/api-routes/settings-routes.js +23 -2
  26. package/lib/api-routes/submit-routes.js +336 -309
  27. package/lib/api-routes/template-routes.js +38 -2
  28. package/lib/api-routes/token-routes.js +142 -96
  29. package/lib/api-routes/webhook-route-routes.js +13 -2
  30. package/lib/bounce-detect.js +397 -205
  31. package/lib/consts.js +5 -4
  32. package/lib/email-client/base-client.js +10 -31
  33. package/lib/email-client/gmail-client.js +9 -11
  34. package/lib/email-client/imap/mailbox.js +3 -19
  35. package/lib/email-client/imap/subconnection.js +1 -1
  36. package/lib/email-client/imap-client.js +1 -1
  37. package/lib/email-client/notification-handler.js +1 -2
  38. package/lib/gateway.js +2 -3
  39. package/lib/hapi-request-logger.js +107 -0
  40. package/lib/imapproxy/imap-core/README.md +6 -5
  41. package/lib/mcp/tools.js +37 -8
  42. package/lib/notify-attachments.js +17 -0
  43. package/lib/oauth/outlook-mailbox.js +35 -0
  44. package/lib/oauth/state.js +24 -0
  45. package/lib/oauth2-apps.js +1 -1
  46. package/lib/pbkdf2-phc.js +1 -1
  47. package/lib/schemas.js +1 -1
  48. package/lib/sso.js +1 -1
  49. package/lib/swagger-options.js +1 -1
  50. package/lib/thread-diagnostics.js +46 -0
  51. package/lib/timezones.js +109 -0
  52. package/lib/token-permission-view.js +3 -3
  53. package/lib/tools.js +40 -10
  54. package/lib/totp.js +2 -5
  55. package/lib/translations.js +1 -2
  56. package/lib/ui-routes/account-routes.js +475 -454
  57. package/lib/ui-routes/account-setup.js +99 -0
  58. package/lib/ui-routes/admin-config-routes.js +88 -10
  59. package/lib/ui-routes/admin-entities-routes.js +91 -7
  60. package/lib/ui-routes/auth-routes.js +90 -38
  61. package/lib/ui-routes/internals-routes.js +5 -0
  62. package/lib/ui-routes/oauth-config-routes.js +124 -82
  63. package/lib/ui-routes/route-helpers.js +19 -3
  64. package/lib/ui-routes/tls-config-routes.js +58 -15
  65. package/lib/utils/back-off.js +82 -0
  66. package/lib/utils/murmurhash3.js +66 -0
  67. package/lib/utils/public-suffix.js +122 -0
  68. package/lib/utils/random-id.js +26 -0
  69. package/lib/utils/version.js +74 -0
  70. package/lib/webhook-routing.js +27 -0
  71. package/lib/webhooks.js +41 -6
  72. package/package.json +27 -29
  73. package/sbom.json +7980 -1
  74. package/server.js +634 -441
  75. package/static/licenses.html +181 -1006
  76. package/translations/messages.pot +62 -63
  77. package/views/config/ai.hbs +1 -1
  78. package/views/config/security.hbs +2 -2
  79. package/views/config/service.hbs +3 -0
  80. package/views/internals/index.hbs +8 -0
  81. package/views/partials/webhook_form.hbs +1 -1
  82. package/views/suppression-lists/index.hbs +1 -1
  83. package/workers/api.js +738 -583
  84. package/workers/export.js +1 -1
  85. package/workers/submit.js +1 -1
  86. package/workers/webhooks.js +16 -32
@@ -10,17 +10,8 @@ const { outboxEntrySchema, apiResponses, apiBoolean } = require('../schemas');
10
10
  const { IMPACT } = require('./operation-impact');
11
11
  const { MCP_MAX_PAGE_SIZE } = require('../consts');
12
12
 
13
- async function init(args) {
14
- const { server, CORS_CONFIG } = args;
15
-
16
- // The queue ID of a message, as every per-message outbox route takes it
17
- const outboxEntryParams = Joi.object({
18
- queueId: Joi.string().max(100).example('d41f0423195f271f').description('Queue identifier for scheduled email').required()
19
- }).label('OutboxEntryParams');
20
-
21
- // What every per-message route answers for an unknown queue ID. The state refusals the
22
- // outbox module throws (code NotFailed, ContentGone, NotDelayed) carry a 409 of their own
23
- const notFound = () => Boom.boomify(new Error('Requested queue entry was not found'), { statusCode: 404 });
13
+ function registerListOutbox(server, ctx) {
14
+ const { CORS_CONFIG } = ctx;
24
15
 
25
16
  server.route({
26
17
  method: 'GET',
@@ -98,6 +89,10 @@ async function init(args) {
98
89
  }
99
90
  }
100
91
  });
92
+ }
93
+
94
+ function registerGetOutboxEntry(server, ctx) {
95
+ const { CORS_CONFIG, outboxEntryParams, notFound } = ctx;
101
96
 
102
97
  server.route({
103
98
  method: 'GET',
@@ -121,6 +116,12 @@ async function init(args) {
121
116
  tags: ['api', 'Outbox'],
122
117
 
123
118
  plugins: {
119
+ mcp: {
120
+ name: 'get_queued_message',
121
+ title: 'Get queued message',
122
+ description:
123
+ 'Get one message in the sending queue by the queue id that send_message, send_draft or get_outbox returned: its recipients, scheduled time, delivery attempts and the last delivery error.'
124
+ },
124
125
  openapi: {
125
126
  responses: apiResponses('Returns the queued message, including its delivery attempts and last error.', 400, 401, 403, 404, 429, 500)
126
127
  }
@@ -149,6 +150,10 @@ async function init(args) {
149
150
  }
150
151
  }
151
152
  });
153
+ }
154
+
155
+ function registerRetryOutboxEntry(server, ctx) {
156
+ const { CORS_CONFIG, outboxEntryParams, notFound } = ctx;
152
157
 
153
158
  server.route({
154
159
  method: 'POST',
@@ -209,6 +214,10 @@ async function init(args) {
209
214
  }
210
215
  }
211
216
  });
217
+ }
218
+
219
+ function registerPromoteOutboxEntry(server, ctx) {
220
+ const { CORS_CONFIG, outboxEntryParams, notFound } = ctx;
212
221
 
213
222
  server.route({
214
223
  method: 'POST',
@@ -269,6 +278,10 @@ async function init(args) {
269
278
  }
270
279
  }
271
280
  });
281
+ }
282
+
283
+ function registerDeleteOutboxEntry(server, ctx) {
284
+ const { CORS_CONFIG, outboxEntryParams } = ctx;
272
285
 
273
286
  server.route({
274
287
  method: 'DELETE',
@@ -331,4 +344,25 @@ async function init(args) {
331
344
  });
332
345
  }
333
346
 
347
+ async function init(args) {
348
+ const { server, CORS_CONFIG } = args;
349
+
350
+ // The queue ID of a message, as every per-message outbox route takes it
351
+ const outboxEntryParams = Joi.object({
352
+ queueId: Joi.string().max(100).example('d41f0423195f271f').description('Queue identifier for scheduled email').required()
353
+ }).label('OutboxEntryParams');
354
+
355
+ // What every per-message route answers for an unknown queue ID. The state refusals the
356
+ // outbox module throws (code NotFailed, ContentGone, NotDelayed) carry a 409 of their own
357
+ const notFound = () => Boom.boomify(new Error('Requested queue entry was not found'), { statusCode: 404 });
358
+
359
+ const ctx = { CORS_CONFIG, outboxEntryParams, notFound };
360
+
361
+ registerListOutbox(server, ctx);
362
+ registerGetOutboxEntry(server, ctx);
363
+ registerRetryOutboxEntry(server, ctx);
364
+ registerPromoteOutboxEntry(server, ctx);
365
+ registerDeleteOutboxEntry(server, ctx);
366
+ }
367
+
334
368
  module.exports = init;
@@ -215,7 +215,14 @@ const SURFACE_GRANTS = {
215
215
  { action: ACTION.DESTRUCTIVE, group: GROUP.MESSAGE },
216
216
  { action: ACTION.SEND, group: GROUP.SUBMIT },
217
217
  { action: ACTION.READ, group: GROUP.OUTBOX },
218
- { action: ACTION.READ, group: GROUP.TEMPLATE }
218
+ { action: ACTION.READ, group: GROUP.TEMPLATE },
219
+ // Folder create and rename (the Mail agent level) and folder delete (Full access), added
220
+ // 2026-10-20 by explicit operator decision. Unlike the pairs above, these widened tokens
221
+ // already issued: an mcp-scoped token without a permissions record is bounded by this
222
+ // table alone, and those - including every one minted from the "Full access" consent in
223
+ // 2.79.2 to 2.80.0 - gained folder create, rename and delete with them
224
+ { action: ACTION.WRITE, group: GROUP.MAILBOX },
225
+ { action: ACTION.DESTRUCTIVE, group: GROUP.MAILBOX }
219
226
  ],
220
227
 
221
228
  // The management half of the MCP endpoint: the same door, checked per request the same way,
@@ -428,6 +435,10 @@ const GROUP_ROUTES = {
428
435
  'DELETE /v1/account/{account}',
429
436
  'PUT /v1/account/{account}/flush',
430
437
  'PUT /v1/account/{account}/reconnect',
438
+ // Lifts the auth-failure park and reconnects: operating the connection like the reconnect
439
+ // above, and no more than that - it never touches the stored credentials or where they
440
+ // are sent, and an operator's own send-only switch is not lifted by it
441
+ 'PUT /v1/account/{account}/resume',
431
442
  'PUT /v1/account/{account}/sync',
432
443
  'GET /v1/account/{account}/server-signatures'
433
444
  ],
@@ -43,8 +43,8 @@ settingsOutputSchema.eventTypes = Joi.array()
43
43
  // agree.
44
44
  const MCP_SETTINGS_KEYS = Object.keys(settingsSchema).filter(key => !settings.privilegedKeys.includes(key) && !isHiddenSetting(key));
45
45
 
46
- async function init(args) {
47
- const { server, call, notify, CORS_CONFIG } = args;
46
+ function registerGetSettings(server, args) {
47
+ const { CORS_CONFIG } = args;
48
48
 
49
49
  server.route({
50
50
  method: 'GET',
@@ -135,6 +135,10 @@ async function init(args) {
135
135
  }
136
136
  }
137
137
  });
138
+ }
139
+
140
+ function registerUpdateSettings(server, args) {
141
+ const { call, notify, CORS_CONFIG } = args;
138
142
 
139
143
  server.route({
140
144
  method: 'POST',
@@ -256,6 +260,10 @@ async function init(args) {
256
260
  }
257
261
  }
258
262
  });
263
+ }
264
+
265
+ function registerGetQueueSettings(server, args) {
266
+ const { CORS_CONFIG } = args;
259
267
 
260
268
  server.route({
261
269
  method: 'GET',
@@ -360,6 +368,10 @@ async function init(args) {
360
368
  }
361
369
  }
362
370
  });
371
+ }
372
+
373
+ function registerUpdateQueueSettings(server, args) {
374
+ const { CORS_CONFIG } = args;
363
375
 
364
376
  server.route({
365
377
  method: 'PUT',
@@ -452,4 +464,13 @@ async function init(args) {
452
464
  });
453
465
  }
454
466
 
467
+ async function init(args) {
468
+ const { server } = args;
469
+
470
+ registerGetSettings(server, args);
471
+ registerUpdateSettings(server, args);
472
+ registerGetQueueSettings(server, args);
473
+ registerUpdateQueueSettings(server, args);
474
+ }
475
+
455
476
  module.exports = init;