emailengine-app 2.89.0 → 2.91.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 (120) hide show
  1. package/.ncurc.js +19 -8
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +73 -0
  4. package/Dockerfile +7 -3
  5. package/ENVIRONMENT.md +24 -23
  6. package/README.md +1 -1
  7. package/bin/healthcheck.js +1 -1
  8. package/copy-static-files.sh +0 -8
  9. package/data/google-crawlers.json +1 -1
  10. package/encrypt.js +1 -4
  11. package/lib/account/field-codec.js +396 -0
  12. package/lib/account-assignment.js +26 -9
  13. package/lib/account.js +196 -462
  14. package/lib/api-routes/account-routes.js +49 -6
  15. package/lib/api-routes/route-metadata.js +5 -2
  16. package/lib/api-routes/submit-routes.js +15 -2
  17. package/lib/api-token-auth.js +342 -274
  18. package/lib/arf-detect.js +174 -149
  19. package/lib/attachment-size.js +29 -0
  20. package/lib/autodetect-imap-settings.js +482 -296
  21. package/lib/consts.js +5 -5
  22. package/lib/db.js +1 -4
  23. package/lib/email-client/base-client.js +907 -780
  24. package/lib/email-client/gmail-client.js +557 -450
  25. package/lib/email-client/imap/cid-parts.js +61 -0
  26. package/lib/email-client/imap/mailbox.js +376 -422
  27. package/lib/email-client/imap/sync-operations.js +239 -178
  28. package/lib/email-client/imap-client.js +5 -5
  29. package/lib/email-client/message-builder.js +4 -5
  30. package/lib/email-client/new-message-steps.js +168 -2
  31. package/lib/email-client/outlook/graph-message.js +266 -0
  32. package/lib/email-client/outlook/subscription-expiry.js +30 -0
  33. package/lib/email-client/outlook-client.js +652 -808
  34. package/lib/get-raw-email.js +338 -232
  35. package/lib/get-secret.js +1 -4
  36. package/lib/imapproxy/imap-server.js +5 -5
  37. package/lib/license-subscription.js +60 -0
  38. package/lib/load-env.js +48 -0
  39. package/lib/logger-consts.js +37 -1
  40. package/lib/logger.js +1 -4
  41. package/lib/mail-probe.js +157 -0
  42. package/lib/mcp/tools.js +244 -207
  43. package/lib/metric-values.js +76 -0
  44. package/lib/metrics.js +320 -0
  45. package/lib/oauth/gmail.js +39 -120
  46. package/lib/oauth/http-request.js +195 -0
  47. package/lib/oauth/mail-ru.js +33 -60
  48. package/lib/oauth/outlook.js +37 -137
  49. package/lib/oauth/pubsub/google.js +176 -117
  50. package/lib/oauth2-apps.js +440 -463
  51. package/lib/openapi/build-document.js +10 -10
  52. package/lib/read-env-value.js +31 -7
  53. package/lib/redis-backend-warnings.js +70 -0
  54. package/lib/route-descriptors.js +78 -0
  55. package/lib/schemas.js +10 -1
  56. package/lib/sentry-integrations.js +299 -0
  57. package/lib/sentry.js +75 -27
  58. package/lib/sso-routes.js +249 -0
  59. package/lib/sso.js +29 -6
  60. package/lib/tools.js +17 -28
  61. package/lib/ui-routes/account-edit-form.js +198 -0
  62. package/lib/ui-routes/account-page.js +241 -0
  63. package/lib/ui-routes/account-routes.js +46 -349
  64. package/lib/ui-routes/account-setup.js +1 -1
  65. package/lib/ui-routes/auth-routes.js +10 -10
  66. package/lib/ui-routes/provider-signin.js +187 -0
  67. package/lib/ui-routes/route-helpers.js +1 -1
  68. package/lib/ui-routes/unsubscribe-routes.js +2 -2
  69. package/lib/ui-view-context.js +328 -0
  70. package/lib/utils/public-suffix.js +22 -101
  71. package/lib/web-safe-html.js +20 -7
  72. package/lib/worker-metrics.js +82 -0
  73. package/list-generate.js +2 -5
  74. package/package.json +28 -24
  75. package/sbom.json +360 -1030
  76. package/scripts/refresh-test-tokens.js +1 -1
  77. package/server.js +400 -677
  78. package/static/css/flyonui.css +1 -1
  79. package/static/css/public.css +55 -1
  80. package/static/css/src/app.tailwind.css +18 -0
  81. package/static/js/ee-client.js +2619 -645
  82. package/static/js/ui.js +12 -2
  83. package/static/licenses.html +224 -764
  84. package/translations/de.mo +0 -0
  85. package/translations/de.po +429 -390
  86. package/translations/en.mo +0 -0
  87. package/translations/en.po +342 -257
  88. package/translations/es.mo +0 -0
  89. package/translations/es.po +440 -395
  90. package/translations/et.mo +0 -0
  91. package/translations/et.po +425 -375
  92. package/translations/fr.mo +0 -0
  93. package/translations/fr.po +425 -383
  94. package/translations/it.mo +0 -0
  95. package/translations/it.po +441 -394
  96. package/translations/ja.mo +0 -0
  97. package/translations/ja.po +408 -335
  98. package/translations/messages.pot +188 -130
  99. package/translations/nl.mo +0 -0
  100. package/translations/nl.po +419 -382
  101. package/translations/pl.mo +0 -0
  102. package/translations/pl.po +425 -379
  103. package/translations/sv.mo +0 -0
  104. package/translations/sv.po +440 -388
  105. package/translations/tr.mo +0 -0
  106. package/translations/tr.po +441 -387
  107. package/views/account-identity-error.hbs +1 -1
  108. package/views/account-workspace-error.hbs +2 -2
  109. package/views/accounts/browse.hbs +19 -1
  110. package/views/accounts/register/imap-server.hbs +22 -7
  111. package/views/accounts/register/imap.hbs +3 -0
  112. package/views/accounts/register/index.hbs +1 -27
  113. package/views/accounts/register/provider-signin.hbs +58 -0
  114. package/views/oauth-scope-error.hbs +1 -1
  115. package/views/partials/provider_signin_button.hbs +30 -0
  116. package/views/queues/index.hbs +1 -1
  117. package/views/redirect.hbs +1 -1
  118. package/views/unsubscribe.hbs +6 -6
  119. package/workers/api.js +20 -451
  120. package/data/public_suffix_list.dat +0 -16698
@@ -97,6 +97,13 @@ const discoveredEmailSettingsSchema = Joi.object({
97
97
  .unknown()
98
98
  .description('App password requirements for the provider, if known')
99
99
  .label('DiscoveredAppPasswordInfo'),
100
+ provider: Joi.string()
101
+ .valid('gmail', 'outlook')
102
+ .example('outlook')
103
+ .description(
104
+ 'OAuth2 provider the mailbox signs in with, when the address or its domain identifies one: `gmail` for Gmail and Google Workspace, `outlook` for Outlook.com and Microsoft 365. Matches the `provider` of an OAuth2 application (see `GET /v1/oauth2`), so a setup flow can offer that sign-in instead of asking for a password. Absent when unknown.'
105
+ )
106
+ .label('DiscoveredOAuth2Provider'),
100
107
  _source: Joi.string().example('srv').description('Source for the detected info')
101
108
  }).label('DiscoveredEmailSettings');
102
109
 
@@ -349,8 +356,20 @@ function registerCreateAccount(server, args) {
349
356
 
350
357
  webhooksCustomHeaders: settingsSchema.webhooksCustomHeaders.label('AccountWebhooksCustomHeaders'),
351
358
 
352
- locale: Joi.string().empty('').max(100).example('fr').description('Optional locale'),
353
- tz: Joi.string().empty('').max(100).example('Europe/Tallinn').description('Optional timezone')
359
+ locale: Joi.string()
360
+ .empty('')
361
+ .max(100)
362
+ .example('fr')
363
+ .description(
364
+ 'Language of the text EmailEngine adds to messages sent from this account, such as the "On ... wrote:" line of an inline reply. A language tag like "sv"; a submit request can override it with its own `locale`'
365
+ ),
366
+ tz: Joi.string()
367
+ .empty('')
368
+ .max(100)
369
+ .example('Europe/Tallinn')
370
+ .description(
371
+ 'Time zone of the dates EmailEngine writes into messages sent from this account. A submit request can override it with its own `tz`'
372
+ )
354
373
  })
355
374
  .label('CreateAccount')
356
375
  .example({
@@ -534,8 +553,20 @@ function registerUpdateAccount(server, args) {
534
553
 
535
554
  webhooksCustomHeaders: settingsSchema.webhooksCustomHeaders.label('AccountWebhooksCustomHeaders'),
536
555
 
537
- locale: Joi.string().empty('').max(100).example('fr').description('Optional locale'),
538
- tz: Joi.string().empty('').max(100).example('Europe/Tallinn').description('Optional timezone')
556
+ locale: Joi.string()
557
+ .empty('')
558
+ .max(100)
559
+ .example('fr')
560
+ .description(
561
+ 'Language of the text EmailEngine adds to messages sent from this account, such as the "On ... wrote:" line of an inline reply. A language tag like "sv"; a submit request can override it with its own `locale`'
562
+ ),
563
+ tz: Joi.string()
564
+ .empty('')
565
+ .max(100)
566
+ .example('Europe/Tallinn')
567
+ .description(
568
+ 'Time zone of the dates EmailEngine writes into messages sent from this account. A submit request can override it with its own `tz`'
569
+ )
539
570
  })
540
571
  .label('UpdateAccount')
541
572
  .example({
@@ -1499,8 +1530,20 @@ function registerGetAccount(server, args) {
1499
1530
 
1500
1531
  webhooksCustomHeaders: settingsSchema.webhooksCustomHeaders.label('AccountWebhooksCustomHeaders'),
1501
1532
 
1502
- locale: Joi.string().empty('').max(100).example('fr').description('Optional locale'),
1503
- tz: Joi.string().empty('').max(100).example('Europe/Tallinn').description('Optional timezone'),
1533
+ locale: Joi.string()
1534
+ .empty('')
1535
+ .max(100)
1536
+ .example('fr')
1537
+ .description(
1538
+ 'Language of the text EmailEngine adds to messages sent from this account, such as the "On ... wrote:" line of an inline reply. A language tag like "sv"; a submit request can override it with its own `locale`'
1539
+ ),
1540
+ tz: Joi.string()
1541
+ .empty('')
1542
+ .max(100)
1543
+ .example('Europe/Tallinn')
1544
+ .description(
1545
+ 'Time zone of the dates EmailEngine writes into messages sent from this account. A submit request can override it with its own `tz`'
1546
+ ),
1504
1547
 
1505
1548
  type: AccountTypeSchema,
1506
1549
  app: Joi.string().max(256).example('AAABhaBPHscAAAAH').description('OAuth2 application ID'),
@@ -13,6 +13,8 @@
13
13
  // It sits under lib/api-routes/ rather than lib/openapi/ so the dependency runs one way. The
14
14
  // generator reads route metadata; route modules do not read the generator.
15
15
 
16
+ const { routePlugins } = require('../route-descriptors');
17
+
16
18
  const PLUGIN_OPTIONS_KEY = 'openapi';
17
19
 
18
20
  // The shared no-metadata answer. This accessor runs in the api-token strategy on every API
@@ -24,12 +26,13 @@ const NO_OPTIONS = Object.freeze({});
24
26
  /**
25
27
  * The documentation and permission metadata a route declares.
26
28
  *
27
- * @param {Object} route - a `server.table()` entry, or a live `request.route`
29
+ * @param {Object} route - a route descriptor (lib/route-descriptors.js), or a live `request.route`
28
30
  * @param {String} [namespace] - which plugins block to read; defaults to `plugins.openapi`
29
31
  * @returns {Object} the route's plugins block, or an empty object when it declares none
30
32
  */
31
33
  function pluginOptions(route, namespace) {
32
- return (route && route.settings && route.settings.plugins && route.settings.plugins[namespace || PLUGIN_OPTIONS_KEY]) || NO_OPTIONS;
34
+ const plugins = routePlugins(route);
35
+ return (plugins && plugins[namespace || PLUGIN_OPTIONS_KEY]) || NO_OPTIONS;
33
36
  }
34
37
 
35
38
  /**
@@ -286,8 +286,21 @@ function buildSubmitMessagePayloadSchema(MAX_ATTACHMENT_SIZE) {
286
286
  .example('Sent Mail')
287
287
  .description("Upload sent message to this folder. By default the account's Sent Mail folder is used."),
288
288
 
289
- locale: Joi.string().empty('').max(100).example('fr').description('Optional locale').label('MessageLocale'),
290
- tz: Joi.string().empty('').max(100).example('Europe/Tallinn').description('Optional timezone'),
289
+ locale: Joi.string()
290
+ .empty('')
291
+ .max(100)
292
+ .example('fr')
293
+ .description(
294
+ 'Language of the text EmailEngine adds to the message, such as the "On ... wrote:" line and the forwarded message headers of `reference.inline`. A language tag like "sv" or "pt-BR"; only the language part is used, and a language without a translation is written in English. Defaults to the locale of the account, then to the locale setting of the instance'
295
+ )
296
+ .label('MessageLocale'),
297
+ tz: Joi.string()
298
+ .empty('')
299
+ .max(100)
300
+ .example('Europe/Tallinn')
301
+ .description(
302
+ 'Time zone of the dates EmailEngine writes into the message, such as the date of the quoted message with `reference.inline`. Defaults to the time zone of the account, then to the timezone setting of the instance'
303
+ ),
291
304
 
292
305
  sendAt: sendAtSchema,
293
306
  deliveryAttempts: deliveryAttemptsSchema,