emailengine-app 2.78.0 → 2.79.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/.ncurc.js +23 -13
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +29 -0
- package/config/e2e.toml +2 -1
- package/config/test.toml +2 -1
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +70 -35
- package/lib/api-reference/format.js +91 -4
- package/lib/api-reference/model.js +144 -19
- package/lib/api-reference/schema-tree.js +282 -28
- package/lib/api-routes/account-routes.js +80 -34
- package/lib/api-routes/blocklist-routes.js +21 -47
- package/lib/api-routes/chat-routes.js +10 -12
- package/lib/api-routes/delivery-test-routes.js +6 -26
- package/lib/api-routes/export-routes.js +2 -0
- package/lib/api-routes/gateway-routes.js +52 -11
- package/lib/api-routes/license-routes.js +2 -0
- package/lib/api-routes/mailbox-routes.js +29 -26
- package/lib/api-routes/message-routes.js +27 -21
- package/lib/api-routes/oauth2-app-routes.js +11 -29
- package/lib/api-routes/operation-impact.js +80 -0
- package/lib/api-routes/outbox-routes.js +15 -5
- package/lib/api-routes/permission-map.js +397 -0
- package/lib/api-routes/route-helpers.js +223 -9
- package/lib/api-routes/route-metadata.js +28 -0
- package/lib/api-routes/settings-routes.js +30 -25
- package/lib/api-routes/stats-routes.js +2 -2
- package/lib/api-routes/submit-routes.js +53 -31
- package/lib/api-routes/template-routes.js +3 -0
- package/lib/api-routes/token-routes.js +319 -33
- package/lib/api-routes/webhook-route-routes.js +14 -4
- package/lib/auth-token.js +80 -8
- package/lib/consts.js +10 -0
- package/lib/db.js +20 -2
- package/lib/delivery-error.js +30 -1
- package/lib/email-client/base-client.js +27 -41
- package/lib/email-client/gmail-client.js +19 -10
- package/lib/email-client/imap/mailbox.js +23 -24
- package/lib/email-client/imap/subconnection.js +10 -7
- package/lib/email-client/imap/sync-operations.js +46 -46
- package/lib/email-client/imap-client.js +36 -26
- package/lib/email-client/message-builder.js +3 -3
- package/lib/email-client/notification-handler.js +1 -1
- package/lib/email-client/outlook/graph-api.js +10 -4
- package/lib/email-client/outlook-client.js +53 -54
- package/lib/email-client/smtp-pool-manager.js +1 -1
- package/lib/enum-descriptions.js +92 -2
- package/lib/export.js +1 -1
- package/lib/field-usage.js +133 -0
- package/lib/gateway.js +1 -1
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
- package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
- package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
- package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
- package/lib/imapproxy/imap-server.js +27 -7
- package/lib/license-beacon.js +4 -9
- package/lib/lists.js +49 -1
- package/lib/llm-pre-process.js +5 -5
- package/lib/logger.js +5 -1
- package/lib/metrics-collector.js +2 -2
- package/lib/oauth/gmail.js +9 -12
- package/lib/oauth/mail-ru.js +5 -7
- package/lib/oauth/outlook.js +9 -9
- package/lib/oauth/pubsub/google.js +25 -10
- package/lib/oauth/scope-checker.js +1 -1
- package/lib/oauth2-apps.js +223 -294
- package/lib/openapi/build-document.js +15 -7
- package/lib/openapi/joi-schema.js +20 -0
- package/lib/outbox.js +85 -17
- package/lib/pre-process.js +8 -8
- package/lib/queue-stats.js +49 -0
- package/lib/read-env-value.js +1 -1
- package/lib/reconnection-manager.js +2 -2
- package/lib/rewrite-text-nodes.js +4 -3
- package/lib/routes-ui.js +4 -0
- package/lib/schemas.js +216 -160
- package/lib/settings.js +84 -5
- package/lib/sub-script.js +2 -1
- package/lib/swagger-options.js +2 -1
- package/lib/templates.js +4 -4
- package/lib/threads.js +2 -2
- package/lib/token-audit-log.js +208 -0
- package/lib/token-permission-view.js +219 -0
- package/lib/token-permissions.js +172 -0
- package/lib/tokens.js +99 -15
- package/lib/tools.js +142 -37
- package/lib/ui-routes/account-routes.js +31 -11
- package/lib/ui-routes/admin-config-routes.js +18 -10
- package/lib/ui-routes/admin-entities-routes.js +66 -22
- package/lib/ui-routes/auth-routes.js +30 -24
- package/lib/ui-routes/export-routes.js +10 -4
- package/lib/ui-routes/oauth-config-routes.js +5 -5
- package/lib/ui-routes/reference-routes.js +3 -3
- package/lib/ui-routes/route-helpers.js +51 -2
- package/lib/ui-routes/settings-page.js +1 -1
- package/lib/ui-routes/smtp-test-routes.js +1 -1
- package/lib/ui-routes/suppression-list-routes.js +294 -0
- package/lib/ui-routes/unsubscribe-routes.js +19 -29
- package/lib/utils/network.js +2 -2
- package/lib/web-safe-html.js +1 -1
- package/lib/webhook-routing.js +80 -0
- package/lib/webhooks.js +20 -14
- package/package.json +11 -10
- package/sbom.json +1 -1
- package/server.js +80 -41
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +136 -9
- package/static/js/reference.js +456 -10
- package/static/js/ui.js +43 -0
- package/static/licenses.html +51 -41
- package/translations/messages.pot +59 -59
- package/views/accounts/account.hbs +69 -7
- package/views/accounts/browse.hbs +18 -35
- package/views/config/logging.hbs +6 -0
- package/views/config/oauth/app.hbs +0 -2
- package/views/config/security.hbs +13 -0
- package/views/partials/oauth_form.hbs +0 -15
- package/views/partials/reference/disclosure.hbs +8 -2
- package/views/partials/reference/operation.hbs +47 -13
- package/views/partials/reference/params.hbs +17 -1
- package/views/partials/reference/schema-node.hbs +110 -52
- package/views/partials/reference/schema-tools.hbs +25 -0
- package/views/partials/reference/try-it.hbs +84 -11
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/ui/checkbox.hbs +2 -2
- package/views/partials/ui/tabs.hbs +7 -1
- package/views/reference/token.hbs +4 -0
- package/views/suppression-lists/index.hbs +85 -0
- package/views/suppression-lists/list.hbs +87 -0
- package/views/templates/index.hbs +8 -2
- package/views/tokens/index.hbs +31 -4
- package/views/tokens/new.hbs +324 -2
- package/workers/api.js +146 -57
- package/workers/documents.js +46 -26
- package/workers/export.js +20 -8
- package/workers/imap-proxy.js +2 -2
- package/workers/imap.js +12 -6
- package/workers/smtp.js +13 -7
- package/workers/submit.js +40 -30
- package/workers/webhooks.js +59 -25
- package/lib/feature-flags.js +0 -48
package/lib/schemas.js
CHANGED
|
@@ -5,7 +5,7 @@ const config = require('@zone-eu/wild-config');
|
|
|
5
5
|
const { getByteSize } = require('./tools');
|
|
6
6
|
const { COLLAPSE_CLASS } = require('./consts');
|
|
7
7
|
const { locales } = require('./translations');
|
|
8
|
-
const {
|
|
8
|
+
const { OAUTH_PROVIDERS } = require('./oauth2-apps');
|
|
9
9
|
const { ACCOUNT_STATES } = require('./account/account-state');
|
|
10
10
|
const { validateConfig: validateExternalAccountConfig } = require('./oauth/external-account-config');
|
|
11
11
|
|
|
@@ -43,6 +43,15 @@ const MAX_ATTACHMENT_SIZE = getByteSize(process.env.EENGINE_MAX_SIZE || config.a
|
|
|
43
43
|
|
|
44
44
|
const accountIdSchema = Joi.string().empty('').trim().max(256).example('user123').description('Unique identifier for the email account');
|
|
45
45
|
|
|
46
|
+
// Suppression list identifier, shared by the Blocklists API and the suppression-list admin UI
|
|
47
|
+
// so the two surfaces cannot drift on what a valid list ID is
|
|
48
|
+
const blocklistListIdSchema = Joi.string()
|
|
49
|
+
.hostname()
|
|
50
|
+
.example('test-list')
|
|
51
|
+
.description('List ID. Must use a subdomain name format. Lists are registered ad-hoc, so a new identifier defines a new list.')
|
|
52
|
+
.label('ListID')
|
|
53
|
+
.required();
|
|
54
|
+
|
|
46
55
|
// The service-secret-signed blob (base64url `data` + its HMAC `sig`) carried by every hosted
|
|
47
56
|
// authentication-form page. Defined once so the security-relevant field definitions cannot drift across
|
|
48
57
|
// the auth:false hosted-form endpoints. Both fields required: every issuer signs unconditionally and every
|
|
@@ -62,6 +71,8 @@ const ACCOUNT_DISPLAY_STATES = [...Object.values(ACCOUNT_STATES), 'disconnected'
|
|
|
62
71
|
|
|
63
72
|
const { ADDRESS_STRATEGIES } = require('./address-strategies');
|
|
64
73
|
const { ENUM_DESCRIPTIONS } = require('./enum-descriptions');
|
|
74
|
+
const { ACTION, GRANTABLE_GROUPS } = require('./api-routes/permission-map');
|
|
75
|
+
const { FIELD_USAGE } = require('./field-usage');
|
|
65
76
|
|
|
66
77
|
// Account identity as the API describes it. These live here rather than next to the routes that use
|
|
67
78
|
// them because they are derived from the OAuth2 provider list, and a copy in a test fixture would
|
|
@@ -76,9 +87,8 @@ const oauth2ProviderSchema = Joi.string()
|
|
|
76
87
|
const accountTypeSchema = Joi.string()
|
|
77
88
|
.valid(...['imap'].concat(Object.keys(OAUTH_PROVIDERS)).concat(['oauth2', 'delegated', 'sending', 'invalid']))
|
|
78
89
|
.example('outlook')
|
|
79
|
-
.description(
|
|
80
|
-
|
|
81
|
-
)
|
|
90
|
+
.description('How the account connects to its mailbox')
|
|
91
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.accountType })
|
|
82
92
|
.required()
|
|
83
93
|
.label('AccountType');
|
|
84
94
|
|
|
@@ -160,7 +170,8 @@ const settingsSchema = {
|
|
|
160
170
|
.trim()
|
|
161
171
|
.valid('full', 'fast')
|
|
162
172
|
.example('full')
|
|
163
|
-
.description('
|
|
173
|
+
.description('How much of a mailbox EmailEngine tracks on each sync')
|
|
174
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.imapIndexer, usage: FIELD_USAGE.imapIndexer })
|
|
164
175
|
.label('ImapIndexer'),
|
|
165
176
|
|
|
166
177
|
resolveGmailCategories: Joi.boolean()
|
|
@@ -193,9 +204,8 @@ const settingsSchema = {
|
|
|
193
204
|
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
194
205
|
.allow('')
|
|
195
206
|
.example('https://api.openai.com')
|
|
196
|
-
.description(
|
|
197
|
-
|
|
198
|
-
)
|
|
207
|
+
.description('Base URL for the OpenAI API')
|
|
208
|
+
.meta({ usage: FIELD_USAGE.openAiAPIUrl })
|
|
199
209
|
.label('OpenAiAPIUrl'),
|
|
200
210
|
|
|
201
211
|
documentStoreChatModel: Joi.string()
|
|
@@ -262,6 +272,16 @@ const settingsSchema = {
|
|
|
262
272
|
.description('External authentication service URL for retrieving mailbox credentials dynamically')
|
|
263
273
|
.label('AuthServer'),
|
|
264
274
|
|
|
275
|
+
// Off by default: it adds a write to the hot path of every authenticated request, and most
|
|
276
|
+
// instances will never read the result
|
|
277
|
+
tokenAuditLog: Joi.boolean()
|
|
278
|
+
.truthy('Y', 'true', '1', 'on')
|
|
279
|
+
.falsy('N', 'false', 0, '')
|
|
280
|
+
.example(false)
|
|
281
|
+
.description(
|
|
282
|
+
'Record which requests each access token makes, readable at GET /v1/tokens/{token}/log. Disabled by default, and entries only exist from the point it is enabled'
|
|
283
|
+
),
|
|
284
|
+
|
|
265
285
|
/* ────────────── Proxy ────────────── */
|
|
266
286
|
|
|
267
287
|
proxyEnabled: Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', 0, '').description('Route outbound connections through a proxy server'),
|
|
@@ -302,92 +322,14 @@ const settingsSchema = {
|
|
|
302
322
|
.description(
|
|
303
323
|
'Sanitize HTML content to remove potentially dangerous elements before including in webhooks, and fold quoted thread history into a collapsed block'
|
|
304
324
|
),
|
|
305
|
-
notifyTextSize: Joi.number().integer().min(0).description('Maximum size (in bytes) of text content to include in webhook payloads'),
|
|
325
|
+
notifyTextSize: Joi.number().integer().min(0).example(1048576).description('Maximum size (in bytes) of text content to include in webhook payloads'),
|
|
306
326
|
notifyAttachments: Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', 0, '').description('Include attachment data in webhook payloads'),
|
|
307
|
-
notifyAttachmentSize: Joi.number().integer().min(0).description('Maximum size (in bytes) per attachment to include in webhook payloads'),
|
|
327
|
+
notifyAttachmentSize: Joi.number().integer().min(0).example(5242880).description('Maximum size (in bytes) per attachment to include in webhook payloads'),
|
|
308
328
|
notifyCalendarEvents: Joi.boolean()
|
|
309
329
|
.truthy('Y', 'true', '1', 'on')
|
|
310
330
|
.falsy('N', 'false', 0, '')
|
|
311
331
|
.description('Include parsed calendar event data in webhook payloads'),
|
|
312
332
|
|
|
313
|
-
/* ────────────── OAuth - Gmail (Deprecated) ────────────── */
|
|
314
|
-
|
|
315
|
-
gmailEnabled: Joi.boolean()
|
|
316
|
-
.truthy('Y', 'true', '1')
|
|
317
|
-
.falsy('N', 'false', 0)
|
|
318
|
-
.description('Deprecated - Controls visibility of Gmail account type')
|
|
319
|
-
.meta({ swaggerHidden: true }),
|
|
320
|
-
|
|
321
|
-
gmailClientId: Joi.string().allow('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
322
|
-
gmailClientSecret: Joi.string().empty('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
323
|
-
gmailRedirectUrl: Joi.string()
|
|
324
|
-
.allow('')
|
|
325
|
-
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
326
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
327
|
-
.meta({ swaggerHidden: true }),
|
|
328
|
-
gmailExtraScopes: Joi.array()
|
|
329
|
-
.items(Joi.string().empty('').trim().max(256).example('https://mail.google.com/'))
|
|
330
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
331
|
-
.meta({ swaggerHidden: true }),
|
|
332
|
-
|
|
333
|
-
/* ────────────── OAuth - Outlook (Deprecated) ────────────── */
|
|
334
|
-
|
|
335
|
-
outlookEnabled: Joi.boolean()
|
|
336
|
-
.truthy('Y', 'true', '1')
|
|
337
|
-
.falsy('N', 'false', 0)
|
|
338
|
-
.description('Deprecated - Controls visibility of Outlook account type')
|
|
339
|
-
.meta({ swaggerHidden: true }),
|
|
340
|
-
outlookClientId: Joi.string().allow('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
341
|
-
outlookClientSecret: Joi.string().empty('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
342
|
-
outlookRedirectUrl: Joi.string()
|
|
343
|
-
.allow('')
|
|
344
|
-
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
345
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
346
|
-
.meta({ swaggerHidden: true }),
|
|
347
|
-
outlookAuthority: Joi.string()
|
|
348
|
-
.empty('')
|
|
349
|
-
.allow('consumers', 'organizations', 'common')
|
|
350
|
-
.example('consumers')
|
|
351
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
352
|
-
.meta({ swaggerHidden: true }),
|
|
353
|
-
outlookExtraScopes: Joi.array()
|
|
354
|
-
.items(Joi.string().empty('').trim().max(256).example('offline_access'))
|
|
355
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
356
|
-
.meta({ swaggerHidden: true }),
|
|
357
|
-
|
|
358
|
-
/* ────────────── OAuth - Mail.ru (Deprecated) ────────────── */
|
|
359
|
-
|
|
360
|
-
mailRuEnabled: Joi.boolean()
|
|
361
|
-
.truthy('Y', 'true', '1')
|
|
362
|
-
.falsy('N', 'false', 0)
|
|
363
|
-
.description('Deprecated - Controls visibility of Mail.ru account type')
|
|
364
|
-
.meta({ swaggerHidden: true }),
|
|
365
|
-
mailRuClientId: Joi.string().allow('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
366
|
-
mailRuClientSecret: Joi.string().empty('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
367
|
-
mailRuRedirectUrl: Joi.string()
|
|
368
|
-
.allow('')
|
|
369
|
-
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
370
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
371
|
-
.meta({ swaggerHidden: true }),
|
|
372
|
-
mailRuExtraScopes: Joi.array()
|
|
373
|
-
.items(Joi.string().empty('').trim().max(256).example('offline_access'))
|
|
374
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
375
|
-
.meta({ swaggerHidden: true }),
|
|
376
|
-
|
|
377
|
-
/* ────────────── Generic OAuth2 Service (Deprecated) ────────────── */
|
|
378
|
-
|
|
379
|
-
serviceClient: Joi.string().trim().allow('').max(256).description('Deprecated - Use OAuth2 Applications instead').meta({ swaggerHidden: true }),
|
|
380
|
-
serviceKey: Joi.string()
|
|
381
|
-
.trim()
|
|
382
|
-
.empty('')
|
|
383
|
-
.max(100 * 1024)
|
|
384
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
385
|
-
.meta({ swaggerHidden: true }),
|
|
386
|
-
serviceExtraScopes: Joi.array()
|
|
387
|
-
.items(Joi.string().empty('').trim().max(256).example('https://mail.google.com/'))
|
|
388
|
-
.description('Deprecated - Use OAuth2 Applications instead')
|
|
389
|
-
.meta({ swaggerHidden: true }),
|
|
390
|
-
|
|
391
333
|
/* ────────────── Document Store (Deprecated) ────────────── */
|
|
392
334
|
|
|
393
335
|
documentStoreEnabled: Joi.boolean()
|
|
@@ -436,7 +378,7 @@ const settingsSchema = {
|
|
|
436
378
|
.default(false)
|
|
437
379
|
.example(false)
|
|
438
380
|
.description('Enable detailed logging for all email accounts'),
|
|
439
|
-
maxLogLines: Joi.number().integer().min(0).max(1000000).default(10000).description('Maximum number of log entries to retain per account')
|
|
381
|
+
maxLogLines: Joi.number().integer().min(0).max(1000000).default(10000).example(10000).description('Maximum number of log entries to retain per account')
|
|
440
382
|
}).label('LogSettings'),
|
|
441
383
|
|
|
442
384
|
/* ────────────── Error Reporting ────────────── */
|
|
@@ -476,6 +418,7 @@ const settingsSchema = {
|
|
|
476
418
|
.items(
|
|
477
419
|
Joi.string()
|
|
478
420
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
421
|
+
.example('198.51.100.24')
|
|
479
422
|
.label('LocalAddressEntry')
|
|
480
423
|
)
|
|
481
424
|
.single()
|
|
@@ -488,17 +431,23 @@ const settingsSchema = {
|
|
|
488
431
|
.truthy('Y', 'true', '1', 'on')
|
|
489
432
|
.falsy('N', 'false', 0, '')
|
|
490
433
|
.description('Enable the built-in SMTP server for receiving emails'),
|
|
491
|
-
smtpServerPort: Joi.number().integer().min(0).max(65535).empty('').description('Port number for the built-in SMTP server'),
|
|
434
|
+
smtpServerPort: Joi.number().integer().min(0).max(65535).empty('').example(2525).description('Port number for the built-in SMTP server'),
|
|
492
435
|
smtpServerHost: Joi.string()
|
|
493
436
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
494
437
|
.empty('')
|
|
438
|
+
.example('0.0.0.0')
|
|
495
439
|
.description('IP address to bind the SMTP server to (empty = all interfaces)'),
|
|
496
440
|
smtpServerProxy: Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', 0, '').description('Enable PROXY protocol support for the SMTP server'),
|
|
497
441
|
smtpServerAuthEnabled: Joi.boolean()
|
|
498
442
|
.truthy('Y', 'true', '1', 'on')
|
|
499
443
|
.falsy('N', 'false', 0, '')
|
|
500
444
|
.description('Require SMTP authentication for incoming connections'),
|
|
501
|
-
smtpServerPassword: Joi.string()
|
|
445
|
+
smtpServerPassword: Joi.string()
|
|
446
|
+
.empty('')
|
|
447
|
+
.allow(null)
|
|
448
|
+
.max(1024)
|
|
449
|
+
.example('verysecret')
|
|
450
|
+
.description('Password for SMTP authentication (null = disable authentication)'),
|
|
502
451
|
smtpServerTLSEnabled: Joi.boolean()
|
|
503
452
|
.truthy('Y', 'true', '1', 'on')
|
|
504
453
|
.falsy('N', 'false', 0, '')
|
|
@@ -507,28 +456,41 @@ const settingsSchema = {
|
|
|
507
456
|
/* ────────────── IMAP Proxy ────────────── */
|
|
508
457
|
|
|
509
458
|
imapProxyServerEnabled: Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', 0, '').description('Enable the IMAP proxy server'),
|
|
510
|
-
imapProxyServerPort: Joi.number().integer().min(0).max(65535).empty('').description('Port number for the IMAP proxy server'),
|
|
459
|
+
imapProxyServerPort: Joi.number().integer().min(0).max(65535).empty('').example(9993).description('Port number for the IMAP proxy server'),
|
|
511
460
|
imapProxyServerHost: Joi.string()
|
|
512
461
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
513
462
|
.empty('')
|
|
463
|
+
.example('0.0.0.0')
|
|
514
464
|
.description('IP address to bind the IMAP proxy to (empty = all interfaces)'),
|
|
515
465
|
imapProxyServerProxy: Joi.boolean()
|
|
516
466
|
.truthy('Y', 'true', '1', 'on')
|
|
517
467
|
.falsy('N', 'false', 0, '')
|
|
518
468
|
.description('Enable PROXY protocol support for the IMAP proxy'),
|
|
519
|
-
imapProxyServerPassword: Joi.string()
|
|
469
|
+
imapProxyServerPassword: Joi.string()
|
|
470
|
+
.empty('')
|
|
471
|
+
.allow(null)
|
|
472
|
+
.max(1024)
|
|
473
|
+
.example('verysecret')
|
|
474
|
+
.description('Password for IMAP proxy authentication (null = disable authentication)'),
|
|
520
475
|
imapProxyServerTLSEnabled: Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', 0, '').description('Enable TLS support for the IMAP proxy'),
|
|
521
476
|
|
|
522
477
|
/* ────────────── Queue & Delivery ────────────── */
|
|
523
478
|
|
|
524
|
-
queueKeep: Joi.number().integer().empty('').min(0).description('Number of completed and failed queue entries to retain for debugging'),
|
|
525
|
-
|
|
479
|
+
queueKeep: Joi.number().integer().empty('').min(0).example(50).description('Number of completed and failed queue entries to retain for debugging'),
|
|
480
|
+
|
|
481
|
+
deliveryAttempts: Joi.number()
|
|
482
|
+
.integer()
|
|
483
|
+
.empty('')
|
|
484
|
+
.min(0)
|
|
485
|
+
.example(10)
|
|
486
|
+
.description('Maximum number of delivery attempts before marking a message as permanently failed'),
|
|
526
487
|
|
|
527
488
|
gmailSubscriptionTtl: Joi.number()
|
|
528
489
|
.integer()
|
|
529
490
|
.empty('')
|
|
530
491
|
.min(0)
|
|
531
492
|
.max(365)
|
|
493
|
+
.example(31)
|
|
532
494
|
.description('Gmail Pub/Sub subscription inactivity expiration in days. Empty for Google default (31 days), 0 for no expiration.')
|
|
533
495
|
.label('GmailSubscriptionTTL'),
|
|
534
496
|
|
|
@@ -538,11 +500,13 @@ const settingsSchema = {
|
|
|
538
500
|
.empty('')
|
|
539
501
|
.trim()
|
|
540
502
|
.max(1024 * 1024)
|
|
503
|
+
.example('<div class="brand-bar">Acme Mail</div>')
|
|
541
504
|
.description('Custom HTML to inject at the top of hosted pages (e.g., for branding)'),
|
|
542
505
|
templateHtmlHead: Joi.string()
|
|
543
506
|
.empty('')
|
|
544
507
|
.trim()
|
|
545
508
|
.max(1024 * 1024)
|
|
509
|
+
.example('<link rel="stylesheet" href="https://example.com/brand.css">')
|
|
546
510
|
.description('Custom HTML to inject into the <head> section of hosted pages (e.g., for analytics)'),
|
|
547
511
|
|
|
548
512
|
/* ────────────── Pre-processing ────────────── */
|
|
@@ -668,9 +632,13 @@ const imapSchema = {
|
|
|
668
632
|
otherwise: Joi.optional()
|
|
669
633
|
})
|
|
670
634
|
.description('Authentication credentials for the IMAP server')
|
|
635
|
+
.meta({ usage: FIELD_USAGE.imapAuth })
|
|
671
636
|
.label('ImapAuthentication'),
|
|
672
637
|
|
|
673
|
-
useAuthServer: Joi.boolean()
|
|
638
|
+
useAuthServer: Joi.boolean()
|
|
639
|
+
.example(false)
|
|
640
|
+
.description('Use external authentication server to retrieve credentials dynamically')
|
|
641
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
674
642
|
|
|
675
643
|
host: Joi.string()
|
|
676
644
|
.hostname()
|
|
@@ -704,9 +672,8 @@ const imapSchema = {
|
|
|
704
672
|
// imap object is merged verbatim into the ImapFlow connection config
|
|
705
673
|
disableIMAP4rev2: Joi.boolean()
|
|
706
674
|
.example(false)
|
|
707
|
-
.description(
|
|
708
|
-
|
|
709
|
-
),
|
|
675
|
+
.description('Do not use IMAP4rev2 even if the server supports it')
|
|
676
|
+
.meta({ usage: FIELD_USAGE.disableIMAP4rev2 }),
|
|
710
677
|
resyncDelay: Joi.number().integer().example(RESYNC_DELAY).description('Delay in seconds between full mailbox resynchronizations').default(RESYNC_DELAY),
|
|
711
678
|
disabled: Joi.boolean().example(false).description('Temporarily disable IMAP operations for this account'),
|
|
712
679
|
|
|
@@ -763,9 +730,13 @@ const smtpSchema = {
|
|
|
763
730
|
otherwise: Joi.optional()
|
|
764
731
|
})
|
|
765
732
|
.description('Authentication credentials for the SMTP server')
|
|
733
|
+
.meta({ usage: FIELD_USAGE.smtpAuth })
|
|
766
734
|
.label('SmtpAuthentication'),
|
|
767
735
|
|
|
768
|
-
useAuthServer: Joi.boolean()
|
|
736
|
+
useAuthServer: Joi.boolean()
|
|
737
|
+
.example(false)
|
|
738
|
+
.description('Use external authentication server to retrieve credentials dynamically')
|
|
739
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
769
740
|
|
|
770
741
|
host: Joi.string().hostname().required().example('smtp.gmail.com').description('SMTP server hostname'),
|
|
771
742
|
port: Joi.number()
|
|
@@ -826,7 +797,10 @@ const oauth2Schema = {
|
|
|
826
797
|
|
|
827
798
|
auth: oauth2AuthSchema,
|
|
828
799
|
|
|
829
|
-
useAuthServer: Joi.boolean()
|
|
800
|
+
useAuthServer: Joi.boolean()
|
|
801
|
+
.example(false)
|
|
802
|
+
.description('Use external authentication server for token management instead of EmailEngine')
|
|
803
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
830
804
|
|
|
831
805
|
accessToken: Joi.string()
|
|
832
806
|
.max(4 * 4096)
|
|
@@ -850,7 +824,11 @@ const oauth2Schema = {
|
|
|
850
824
|
expires: Joi.date().iso().example('2021-03-22T13:13:31.000Z').description('Access token expiration timestamp')
|
|
851
825
|
};
|
|
852
826
|
|
|
853
|
-
const partialSchema = Joi.boolean()
|
|
827
|
+
const partialSchema = Joi.boolean()
|
|
828
|
+
.example(false)
|
|
829
|
+
.description('Update only the provided fields instead of replacing the entire configuration')
|
|
830
|
+
.meta({ usage: FIELD_USAGE.partialUpdate })
|
|
831
|
+
.default(false);
|
|
854
832
|
|
|
855
833
|
const imapUpdateSchema = {
|
|
856
834
|
partial: partialSchema,
|
|
@@ -880,9 +858,13 @@ const imapUpdateSchema = {
|
|
|
880
858
|
otherwise: Joi.optional()
|
|
881
859
|
})
|
|
882
860
|
.description('Authentication credentials for the IMAP server')
|
|
861
|
+
.meta({ usage: FIELD_USAGE.imapAuth })
|
|
883
862
|
.label('ImapUpdateAuthentication'),
|
|
884
863
|
|
|
885
|
-
useAuthServer: Joi.boolean()
|
|
864
|
+
useAuthServer: Joi.boolean()
|
|
865
|
+
.example(false)
|
|
866
|
+
.description('Use external authentication server to retrieve credentials dynamically')
|
|
867
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
886
868
|
|
|
887
869
|
host: Joi.string().hostname().example('imap.gmail.com').description('IMAP server hostname'),
|
|
888
870
|
port: Joi.number().integer().min(1).max(65535).example(993).description('IMAP server port'),
|
|
@@ -896,9 +878,8 @@ const imapUpdateSchema = {
|
|
|
896
878
|
.label('ImapUpdateTlsOptions'),
|
|
897
879
|
disableIMAP4rev2: Joi.boolean()
|
|
898
880
|
.example(false)
|
|
899
|
-
.description(
|
|
900
|
-
|
|
901
|
-
),
|
|
881
|
+
.description('Do not use IMAP4rev2 even if the server supports it')
|
|
882
|
+
.meta({ usage: FIELD_USAGE.disableIMAP4rev2 }),
|
|
902
883
|
resyncDelay: Joi.number().integer().example(RESYNC_DELAY).description('Delay in seconds between full mailbox resynchronizations'),
|
|
903
884
|
|
|
904
885
|
disabled: Joi.boolean().example(false).description('Temporarily disable IMAP operations for this account'),
|
|
@@ -937,9 +918,13 @@ const smtpUpdateSchema = {
|
|
|
937
918
|
otherwise: Joi.optional()
|
|
938
919
|
})
|
|
939
920
|
.description('Authentication credentials for the SMTP server')
|
|
921
|
+
.meta({ usage: FIELD_USAGE.smtpAuth })
|
|
940
922
|
.label('SmtpUpdateAuthentication'),
|
|
941
923
|
|
|
942
|
-
useAuthServer: Joi.boolean()
|
|
924
|
+
useAuthServer: Joi.boolean()
|
|
925
|
+
.example(false)
|
|
926
|
+
.description('Use external authentication server to retrieve credentials dynamically')
|
|
927
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
943
928
|
|
|
944
929
|
host: Joi.string().hostname().example('smtp.gmail.com').description('SMTP server hostname'),
|
|
945
930
|
port: Joi.number().integer().min(1).max(65535).example(587).description('SMTP server port'),
|
|
@@ -961,7 +946,10 @@ const oauth2UpdateSchema = {
|
|
|
961
946
|
|
|
962
947
|
auth: oauth2AuthSchema,
|
|
963
948
|
|
|
964
|
-
useAuthServer: Joi.boolean()
|
|
949
|
+
useAuthServer: Joi.boolean()
|
|
950
|
+
.example(false)
|
|
951
|
+
.description('Use external authentication server for token management instead of EmailEngine')
|
|
952
|
+
.meta({ usage: FIELD_USAGE.useAuthServer }),
|
|
965
953
|
|
|
966
954
|
accessToken: Joi.string()
|
|
967
955
|
.max(4 * 4096)
|
|
@@ -1104,7 +1092,7 @@ const messageEntrySchema = Joi.object({
|
|
|
1104
1092
|
.label('TextEncodedSize')
|
|
1105
1093
|
}).label('TextInfo'),
|
|
1106
1094
|
|
|
1107
|
-
preview: Joi.string().description('Short preview of the message content'),
|
|
1095
|
+
preview: Joi.string().example('Hello, here is the report you asked for').description('Short preview of the message content'),
|
|
1108
1096
|
|
|
1109
1097
|
category: messageCategorySchema,
|
|
1110
1098
|
messageSpecialUse: messageSpecialUseSchema,
|
|
@@ -1176,7 +1164,9 @@ const messageDetailsSchema = Joi.object({
|
|
|
1176
1164
|
|
|
1177
1165
|
isAutoReply: Joi.boolean().example(false).description('Whether this message appears to be an automatic reply (out of office, vacation responder, etc.)'),
|
|
1178
1166
|
|
|
1179
|
-
preview: Joi.string()
|
|
1167
|
+
preview: Joi.string()
|
|
1168
|
+
.example('Hello, here is the report you asked for')
|
|
1169
|
+
.description('Short preview of the message content (Gmail API and MS Graph API accounts only)'),
|
|
1180
1170
|
category: messageCategorySchema,
|
|
1181
1171
|
|
|
1182
1172
|
specialUse: Joi.string()
|
|
@@ -1245,7 +1235,8 @@ const mailboxBaseFields = {
|
|
|
1245
1235
|
specialUseSource: Joi.string()
|
|
1246
1236
|
.example('extension')
|
|
1247
1237
|
.valid('user', 'extension', 'name')
|
|
1248
|
-
.description('How the special
|
|
1238
|
+
.description('How the special-use flag was determined')
|
|
1239
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.specialUseSource })
|
|
1249
1240
|
.label('MailboxSpecialUseSource'),
|
|
1250
1241
|
noInferiors: Joi.boolean().example(false).description('Whether this mailbox can contain child mailboxes').label('MailboxNoInferiors')
|
|
1251
1242
|
};
|
|
@@ -1285,7 +1276,10 @@ const mailboxesSchema = Joi.array()
|
|
|
1285
1276
|
status: Joi.object({
|
|
1286
1277
|
messages: Joi.number().integer().example(120).description('Message count from STATUS command').label('StatusMessages'),
|
|
1287
1278
|
unseen: Joi.number().integer().example(120).description('Unread message count from STATUS command').label('StatusUnseenMessages'),
|
|
1288
|
-
error: Joi.string()
|
|
1279
|
+
error: Joi.string()
|
|
1280
|
+
.example('Mailbox does not exist')
|
|
1281
|
+
.description('Error message if the STATUS command failed for this mailbox')
|
|
1282
|
+
.label('StatusError')
|
|
1289
1283
|
})
|
|
1290
1284
|
.unknown()
|
|
1291
1285
|
.description('Additional mailbox statistics')
|
|
@@ -1310,6 +1304,7 @@ const licenseSchema = Joi.object({
|
|
|
1310
1304
|
expires: Joi.date().iso().example('2026-01-01T00:00:00.000Z').description('License expiration time, if the license is time-limited')
|
|
1311
1305
|
})
|
|
1312
1306
|
.allow(false)
|
|
1307
|
+
.description('Details of the registered license. False when no license is registered.')
|
|
1313
1308
|
.label('LicenseDetails'),
|
|
1314
1309
|
suspended: Joi.boolean().example(false).description('Whether email operations are suspended due to license issues')
|
|
1315
1310
|
}).label('LicenseInfo');
|
|
@@ -1418,9 +1413,15 @@ const documentStoreSchema = Joi.boolean()
|
|
|
1418
1413
|
.label('UseDocumentStore')
|
|
1419
1414
|
.meta({ swaggerHidden: true });
|
|
1420
1415
|
|
|
1416
|
+
// Every field carries its own `.example()`. The search object is embedded by five
|
|
1417
|
+
// operations and only one of them - POST /v1/account/{account}/search - wraps it in a
|
|
1418
|
+
// curated payload, so on the other four the API reference had nothing to show for any of
|
|
1419
|
+
// these. Where the curated payload does set a value, the example here is the same value, so
|
|
1420
|
+
// the property row and the payload above it never state two different things.
|
|
1421
1421
|
const searchSchema = Joi.object({
|
|
1422
1422
|
seq: Joi.string()
|
|
1423
1423
|
.max(8 * 1024)
|
|
1424
|
+
.example('1:10')
|
|
1424
1425
|
.description('Sequence number range (e.g., "1:10" or "1,3,5"). Only supported for IMAP.'),
|
|
1425
1426
|
|
|
1426
1427
|
answered: Joi.boolean()
|
|
@@ -1438,12 +1439,12 @@ const searchSchema = Joi.object({
|
|
|
1438
1439
|
flagged: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for flagged/starred messages').label('Flagged'),
|
|
1439
1440
|
seen: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for read messages').label('SeenFlag'),
|
|
1440
1441
|
|
|
1441
|
-
from: Joi.string().max(256).description('Search in From addresses').label('From'),
|
|
1442
|
-
to: Joi.string().max(256).description('Search in To addresses. Not supported for MS Graph API.').label('To'),
|
|
1443
|
-
cc: Joi.string().max(256).description('Search in Cc addresses. Not supported for MS Graph API.').label('Cc'),
|
|
1444
|
-
bcc: Joi.string().max(256).description('Search in Bcc addresses. Not supported for MS Graph API.').label('Bcc'),
|
|
1442
|
+
from: Joi.string().max(256).example('nyan.cat@example.com').description('Search in From addresses').label('From'),
|
|
1443
|
+
to: Joi.string().max(256).example('support@example.com').description('Search in To addresses. Not supported for MS Graph API.').label('To'),
|
|
1444
|
+
cc: Joi.string().max(256).example('billing@example.com').description('Search in Cc addresses. Not supported for MS Graph API.').label('Cc'),
|
|
1445
|
+
bcc: Joi.string().max(256).example('archive@example.com').description('Search in Bcc addresses. Not supported for MS Graph API.').label('Bcc'),
|
|
1445
1446
|
|
|
1446
|
-
body: Joi.string().max(256).description('Search in message body content').label('MessageBody'),
|
|
1447
|
+
body: Joi.string().max(256).example('Hello world').description('Search in message body content').label('MessageBody'),
|
|
1447
1448
|
subject: Joi.string()
|
|
1448
1449
|
.allow('')
|
|
1449
1450
|
.max(10 * 256)
|
|
@@ -1455,6 +1456,7 @@ const searchSchema = Joi.object({
|
|
|
1455
1456
|
.integer()
|
|
1456
1457
|
.min(0)
|
|
1457
1458
|
.max(1024 * 1024 * 1024)
|
|
1459
|
+
.example(1048576)
|
|
1458
1460
|
.description('Find messages larger than specified size in bytes. Not supported for MS Graph API.')
|
|
1459
1461
|
.label('MessageLarger'),
|
|
1460
1462
|
|
|
@@ -1462,25 +1464,28 @@ const searchSchema = Joi.object({
|
|
|
1462
1464
|
.integer()
|
|
1463
1465
|
.min(0)
|
|
1464
1466
|
.max(1024 * 1024 * 1024)
|
|
1467
|
+
.example(102400)
|
|
1465
1468
|
.description('Find messages smaller than specified size in bytes. Not supported for MS Graph API.')
|
|
1466
1469
|
.label('MessageSmaller'),
|
|
1467
1470
|
|
|
1468
1471
|
uid: Joi.string()
|
|
1469
1472
|
.max(8 * 1024)
|
|
1473
|
+
.example('100:200')
|
|
1470
1474
|
.description('UID range (e.g., "100:200" or "150,200,250"). Only supported for IMAP.')
|
|
1471
1475
|
.label('UIDRange'),
|
|
1472
1476
|
|
|
1473
1477
|
modseq: Joi.number()
|
|
1474
1478
|
.integer()
|
|
1475
1479
|
.min(0)
|
|
1480
|
+
.example(12345)
|
|
1476
1481
|
.description('Find messages with modification sequence higher than specified value. Only supported for IMAP with CONDSTORE.')
|
|
1477
1482
|
.label('ModseqLarger'),
|
|
1478
1483
|
|
|
1479
|
-
before: Joi.date().description('Find messages received before this date').label('EnvelopeBefore'),
|
|
1480
|
-
since: Joi.date().description('Find messages received after this date').label('EnvelopeSince'),
|
|
1484
|
+
before: Joi.date().example('2024-08-09').description('Find messages received before this date').label('EnvelopeBefore'),
|
|
1485
|
+
since: Joi.date().example('2022-08-09').description('Find messages received after this date').label('EnvelopeSince'),
|
|
1481
1486
|
|
|
1482
|
-
sentBefore: Joi.date().description('Find messages sent before this date').label('HeaderBefore'),
|
|
1483
|
-
sentSince: Joi.date().description('Find messages sent after this date').label('HeaderSince'),
|
|
1487
|
+
sentBefore: Joi.date().example('2024-08-09').description('Find messages sent before this date').label('HeaderBefore'),
|
|
1488
|
+
sentSince: Joi.date().example('2022-08-09').description('Find messages sent after this date').label('HeaderSince'),
|
|
1484
1489
|
|
|
1485
1490
|
emailId: emailIdSchema,
|
|
1486
1491
|
threadId: threadIdSchema,
|
|
@@ -1509,7 +1514,8 @@ const searchSchema = Joi.object({
|
|
|
1509
1514
|
emailIds: Joi.array()
|
|
1510
1515
|
.items(emailIdSchema)
|
|
1511
1516
|
.single()
|
|
1512
|
-
.description('List of specific email IDs to fetch
|
|
1517
|
+
.description('List of specific email IDs to fetch')
|
|
1518
|
+
.meta({ usage: FIELD_USAGE.searchEmailIds })
|
|
1513
1519
|
.example(['1278455344230334865'])
|
|
1514
1520
|
.label('EmailIds')
|
|
1515
1521
|
})
|
|
@@ -1564,11 +1570,16 @@ const messageUpdateSchema = Joi.object({
|
|
|
1564
1570
|
});
|
|
1565
1571
|
|
|
1566
1572
|
// The update variant below is derived from this one, so the two cannot drift apart in the published API
|
|
1567
|
-
// document - only the "how to clear it" sentence differs.
|
|
1568
|
-
|
|
1569
|
-
|
|
1573
|
+
// document - only the "how to clear it" sentence differs. The five sentences of caveats that
|
|
1574
|
+
// used to live here are now the usage note, which the API reference renders collapsed.
|
|
1575
|
+
const EXPECTED_EMAIL_DESCRIPTION = 'Pins the account to an email address';
|
|
1570
1576
|
|
|
1571
|
-
const expectedEmailSchema = Joi.string()
|
|
1577
|
+
const expectedEmailSchema = Joi.string()
|
|
1578
|
+
.empty('')
|
|
1579
|
+
.email()
|
|
1580
|
+
.example('user@example.com')
|
|
1581
|
+
.description(EXPECTED_EMAIL_DESCRIPTION)
|
|
1582
|
+
.meta({ usage: FIELD_USAGE.expectedEmail });
|
|
1572
1583
|
|
|
1573
1584
|
const accountSchemas = {
|
|
1574
1585
|
syncFrom: Joi.date()
|
|
@@ -1596,7 +1607,7 @@ const accountSchemas = {
|
|
|
1596
1607
|
expectedEmail: expectedEmailSchema,
|
|
1597
1608
|
|
|
1598
1609
|
// Same field on the update endpoint, where null clears the constraint.
|
|
1599
|
-
expectedEmailUpdate: expectedEmailSchema.allow(null).description(`${EXPECTED_EMAIL_DESCRIPTION} Set to \`null\` to remove the constraint
|
|
1610
|
+
expectedEmailUpdate: expectedEmailSchema.allow(null).description(`${EXPECTED_EMAIL_DESCRIPTION}. Set to \`null\` to remove the constraint`),
|
|
1600
1611
|
|
|
1601
1612
|
imapIndexer: Joi.string()
|
|
1602
1613
|
.empty('')
|
|
@@ -1604,9 +1615,8 @@ const accountSchemas = {
|
|
|
1604
1615
|
.allow(null)
|
|
1605
1616
|
.valid('full', 'fast')
|
|
1606
1617
|
.example('full')
|
|
1607
|
-
.description(
|
|
1608
|
-
|
|
1609
|
-
)
|
|
1618
|
+
.description('Override the global IMAP indexing strategy for this account')
|
|
1619
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.imapIndexer, usage: FIELD_USAGE.imapIndexer })
|
|
1610
1620
|
.label('AccountImapIndexer')
|
|
1611
1621
|
};
|
|
1612
1622
|
|
|
@@ -1786,7 +1796,8 @@ const oauthCreateSchema = {
|
|
|
1786
1796
|
otherwise: Joi.optional().valid(false, null)
|
|
1787
1797
|
})
|
|
1788
1798
|
.example('externalAccount')
|
|
1789
|
-
.description('
|
|
1799
|
+
.description('How token requests for the Gmail service account are signed')
|
|
1800
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.gmailAuthMethod }),
|
|
1790
1801
|
|
|
1791
1802
|
externalAccount: Joi.string()
|
|
1792
1803
|
.trim()
|
|
@@ -1878,17 +1889,7 @@ const oauthUpdateSchema = {
|
|
|
1878
1889
|
.required()
|
|
1879
1890
|
.description('OAuth2 provider'),
|
|
1880
1891
|
|
|
1881
|
-
name: Joi.string()
|
|
1882
|
-
.trim()
|
|
1883
|
-
.empty('')
|
|
1884
|
-
.max(256)
|
|
1885
|
-
.example('My Gmail App')
|
|
1886
|
-
.description('Application name')
|
|
1887
|
-
.when('app', {
|
|
1888
|
-
not: Joi.string().valid(...LEGACY_KEYS),
|
|
1889
|
-
then: Joi.required(),
|
|
1890
|
-
otherwise: Joi.optional().valid(false, null)
|
|
1891
|
-
}),
|
|
1892
|
+
name: Joi.string().trim().empty('').max(256).example('My Gmail App').description('Application name').required(),
|
|
1892
1893
|
description: Joi.string().trim().allow('').max(1024).example('My cool app').description('Application description'),
|
|
1893
1894
|
|
|
1894
1895
|
title: Joi.string().allow('').trim().max(256).example('App title').description('Title for the application button'),
|
|
@@ -1984,7 +1985,8 @@ const oauthUpdateSchema = {
|
|
|
1984
1985
|
then: Joi.optional().default('serviceKey'),
|
|
1985
1986
|
otherwise: Joi.forbidden()
|
|
1986
1987
|
})
|
|
1987
|
-
.description('
|
|
1988
|
+
.description('How token requests for the Gmail service account are signed')
|
|
1989
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.gmailAuthMethod }),
|
|
1988
1990
|
|
|
1989
1991
|
externalAccount: Joi.string()
|
|
1990
1992
|
.trim()
|
|
@@ -2081,6 +2083,57 @@ const tokenRestrictionsSchema = Joi.object({
|
|
|
2081
2083
|
.label('TokenRestrictions')
|
|
2082
2084
|
.description('Security restrictions for API token usage');
|
|
2083
2085
|
|
|
2086
|
+
// Narrowing below what the token's scope and account binding already allow. Both axes are optional
|
|
2087
|
+
// and both only SUBTRACT - there is no value here that grants anything, so a token can be handed
|
|
2088
|
+
// out for one job without widening what the holder can reach.
|
|
2089
|
+
//
|
|
2090
|
+
// `.min(1)` on the object refuses `{}`, ambiguous between "no narrowing" and "grant nothing"; the
|
|
2091
|
+
// same on each array refuses an axis that lists nothing, which would mint a token that authenticates
|
|
2092
|
+
// and then refuses every request. lib/token-permissions.js still treats an empty array as a denial,
|
|
2093
|
+
// because tokens.setRawData() can write one without ever passing this schema.
|
|
2094
|
+
// Refusing it at the schema keeps that ambiguity out of the record entirely; lib/token-permissions.js
|
|
2095
|
+
// treats one that arrives by another path as a denial.
|
|
2096
|
+
//
|
|
2097
|
+
// The groups list omits `admin` on purpose, so the API refuses to ISSUE a token naming it rather
|
|
2098
|
+
// than accepting one and denying every request it makes. The request-time deny in
|
|
2099
|
+
// lib/token-permissions.js stays regardless - it has to, because tokens.setRawData() writes a record
|
|
2100
|
+
// with no schema at all.
|
|
2101
|
+
const tokenPermissionsSchema = Joi.object({
|
|
2102
|
+
actions: Joi.array()
|
|
2103
|
+
.items(
|
|
2104
|
+
Joi.string()
|
|
2105
|
+
.valid(...Object.values(ACTION))
|
|
2106
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.tokenAction })
|
|
2107
|
+
.label('TokenAction')
|
|
2108
|
+
)
|
|
2109
|
+
.single()
|
|
2110
|
+
.min(1)
|
|
2111
|
+
.example(['read', 'write'])
|
|
2112
|
+
.description('Which kinds of operation this token may perform. Omit to allow all of them')
|
|
2113
|
+
.label('TokenActions'),
|
|
2114
|
+
|
|
2115
|
+
groups: Joi.array()
|
|
2116
|
+
.items(
|
|
2117
|
+
Joi.string()
|
|
2118
|
+
.valid(...GRANTABLE_GROUPS)
|
|
2119
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.tokenGroup })
|
|
2120
|
+
.label('TokenGroup')
|
|
2121
|
+
)
|
|
2122
|
+
.single()
|
|
2123
|
+
.min(1)
|
|
2124
|
+
.example(['message', 'mailbox'])
|
|
2125
|
+
.description('Which parts of the API this token may reach. Omit to allow all of them')
|
|
2126
|
+
.label('TokenGroups')
|
|
2127
|
+
})
|
|
2128
|
+
.min(1)
|
|
2129
|
+
.empty(Joi.valid('', false))
|
|
2130
|
+
.allow(null)
|
|
2131
|
+
.example({ actions: ['read'], groups: ['message', 'mailbox'] })
|
|
2132
|
+
.label('TokenPermissions')
|
|
2133
|
+
.description(
|
|
2134
|
+
'Restricts a token below its scope. Each axis is an allowlist that only narrows, and both apply together, so an operation must match the actions AND the groups. Endpoints that hand out credentials or change instance configuration can never be reached by a token that sets this field, whatever it lists'
|
|
2135
|
+
);
|
|
2136
|
+
|
|
2084
2137
|
const ipSchema = Joi.string()
|
|
2085
2138
|
.empty('')
|
|
2086
2139
|
.trim()
|
|
@@ -2112,9 +2165,8 @@ const accountPathSchema = Joi.array()
|
|
|
2112
2165
|
.items(pathSchema)
|
|
2113
2166
|
.single()
|
|
2114
2167
|
.allow(null)
|
|
2115
|
-
.description(
|
|
2116
|
-
|
|
2117
|
-
);
|
|
2168
|
+
.description('Mailbox folders to monitor for changes (IMAP only). Use "*" to monitor all folders (default)')
|
|
2169
|
+
.meta({ usage: FIELD_USAGE.imapPath });
|
|
2118
2170
|
|
|
2119
2171
|
const defaultAccountTypeSchema = Joi.string()
|
|
2120
2172
|
.empty('')
|
|
@@ -2148,10 +2200,10 @@ const outboxEntrySchema = Joi.object({
|
|
|
2148
2200
|
.example('What a wonderful message')
|
|
2149
2201
|
.description('Email subject line'),
|
|
2150
2202
|
|
|
2151
|
-
gateway: Joi.string().allow(null).max(256).example(
|
|
2152
|
-
proxy: Joi.string().allow(null).example(
|
|
2153
|
-
localAddress: Joi.string().allow(null).example(
|
|
2154
|
-
idempotencyKey: Joi.string().allow(null).max(1024).description('Idempotency key provided when the message was submitted'),
|
|
2203
|
+
gateway: Joi.string().allow(null).max(256).example('example').description('Gateway ID used for delivery, or null when no gateway is set'),
|
|
2204
|
+
proxy: Joi.string().allow(null).example('socks5://proxy.example.com:1080').description('Proxy URL used for delivery, or null when no proxy is set'),
|
|
2205
|
+
localAddress: Joi.string().allow(null).example('198.51.100.24').description('Local IP address used for delivery, or null when not set'),
|
|
2206
|
+
idempotencyKey: Joi.string().allow(null).max(1024).example('submit-12345').description('Idempotency key provided when the message was submitted'),
|
|
2155
2207
|
useStructuredFormat: Joi.boolean().description('Whether delivery errors for this message are reported in a structured format'),
|
|
2156
2208
|
|
|
2157
2209
|
created: Joi.date().iso().example('2021-02-17T13:43:18.860Z').description('When this message was added to the queue'),
|
|
@@ -2186,6 +2238,7 @@ const outboxEntrySchema = Joi.object({
|
|
|
2186
2238
|
networkRouting: Joi.object()
|
|
2187
2239
|
.unknown()
|
|
2188
2240
|
.allow(null)
|
|
2241
|
+
.example({ localAddress: '198.51.100.24', name: 'relay.example.com' })
|
|
2189
2242
|
.description('Network routing information for the failed delivery attempt')
|
|
2190
2243
|
.label('OutboxErrorNetworkRouting')
|
|
2191
2244
|
})
|
|
@@ -2206,7 +2259,8 @@ const messageReferenceSchema = Joi.object({
|
|
|
2206
2259
|
.valid('forward', 'reply', 'reply-all')
|
|
2207
2260
|
.example('reply')
|
|
2208
2261
|
.default('reply')
|
|
2209
|
-
.description('
|
|
2262
|
+
.description('What to do with the referenced message')
|
|
2263
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.messageAction })
|
|
2210
2264
|
.label('MessageAction'),
|
|
2211
2265
|
|
|
2212
2266
|
inline: Joi.boolean()
|
|
@@ -2240,9 +2294,7 @@ const messageReferenceSchema = Joi.object({
|
|
|
2240
2294
|
.example('<test123@example.com>')
|
|
2241
2295
|
.description('Verify the Message-ID of the referenced email matches this value before proceeding'),
|
|
2242
2296
|
|
|
2243
|
-
threadId: threadIdSchema.description(
|
|
2244
|
-
'Gmail thread ID to attach the outgoing message to. Used only by Gmail-API accounts; ignored for IMAP and Microsoft Graph backends, which derive threading from RFC In-Reply-To/References headers. When both "message" and "threadId" are provided, the caller-supplied "threadId" takes precedence over the value derived from the referenced message.'
|
|
2245
|
-
),
|
|
2297
|
+
threadId: threadIdSchema.description('Gmail thread ID to attach the outgoing message to').meta({ usage: FIELD_USAGE.referenceThreadId }),
|
|
2246
2298
|
|
|
2247
2299
|
documentStore: documentStoreSchema.default(false).meta({ swaggerHidden: true })
|
|
2248
2300
|
})
|
|
@@ -2258,6 +2310,7 @@ const idempotencyKeySchema = Joi.string()
|
|
|
2258
2310
|
.optional()
|
|
2259
2311
|
.replace(/^\s*"\s*|\s*"\s*$|/g, '')
|
|
2260
2312
|
.replace(/\\([\\"])/g, '$1')
|
|
2313
|
+
.example('submit-12345')
|
|
2261
2314
|
.description('Unique key to prevent duplicate processing of the same request')
|
|
2262
2315
|
.label('Idempotency-Key');
|
|
2263
2316
|
|
|
@@ -2266,6 +2319,7 @@ const headerTimeoutSchema = Joi.number()
|
|
|
2266
2319
|
.min(0)
|
|
2267
2320
|
.max(2 * 3600 * 1000)
|
|
2268
2321
|
.optional()
|
|
2322
|
+
.example(30000)
|
|
2269
2323
|
.description('Request timeout in milliseconds (overrides EENGINE_TIMEOUT environment variable)')
|
|
2270
2324
|
.label('X-EE-Timeout');
|
|
2271
2325
|
|
|
@@ -2282,9 +2336,8 @@ const exportRequestSchema = Joi.object({
|
|
|
2282
2336
|
folders: Joi.array()
|
|
2283
2337
|
.items(Joi.string().max(1024).example('INBOX'))
|
|
2284
2338
|
.single()
|
|
2285
|
-
.description(
|
|
2286
|
-
|
|
2287
|
-
)
|
|
2339
|
+
.description('Folder paths or special-use flags (e.g., \\Inbox, \\Sent, \\All) to export from')
|
|
2340
|
+
.meta({ usage: FIELD_USAGE.exportFolders })
|
|
2288
2341
|
.label('ExportFolders'),
|
|
2289
2342
|
startDate: Joi.date().iso().required().example('2024-01-01T00:00:00Z').description('Export messages from this date'),
|
|
2290
2343
|
endDate: Joi.date().iso().required().example('2024-12-31T23:59:59Z').description('Export messages until this date'),
|
|
@@ -2292,7 +2345,8 @@ const exportRequestSchema = Joi.object({
|
|
|
2292
2345
|
.valid('plain', 'html', '*')
|
|
2293
2346
|
.default('*')
|
|
2294
2347
|
.example('*')
|
|
2295
|
-
.description('
|
|
2348
|
+
.description('Which message bodies to include in the export')
|
|
2349
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.exportTextType })
|
|
2296
2350
|
.label('ExportTextType'),
|
|
2297
2351
|
maxBytes: Joi.number()
|
|
2298
2352
|
.integer()
|
|
@@ -2337,7 +2391,7 @@ const exportStatusSchema = Joi.object({
|
|
|
2337
2391
|
.description('Current export phase')
|
|
2338
2392
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.exportPhase })
|
|
2339
2393
|
.label('ExportPhase'),
|
|
2340
|
-
folders: Joi.array().items(Joi.string().label('ExportFolderItem')).description('Folders being exported').label('ExportStatusFolders'),
|
|
2394
|
+
folders: Joi.array().items(Joi.string().example('INBOX').label('ExportFolderItem')).description('Folders being exported').label('ExportStatusFolders'),
|
|
2341
2395
|
startDate: Joi.date().iso().example('2024-01-01T00:00:00Z').description('Export start date filter'),
|
|
2342
2396
|
endDate: Joi.date().iso().example('2024-12-31T23:59:59Z').description('Export end date filter'),
|
|
2343
2397
|
isEncrypted: Joi.boolean().example(false).description('Whether the export file is encrypted'),
|
|
@@ -2347,7 +2401,7 @@ const exportStatusSchema = Joi.object({
|
|
|
2347
2401
|
truncated: Joi.boolean()
|
|
2348
2402
|
.example(true)
|
|
2349
2403
|
.description('Whether the export was truncated due to message count or size limits. Only present (as true) for truncated exports'),
|
|
2350
|
-
error: Joi.string().allow(null).description('Error message if export failed')
|
|
2404
|
+
error: Joi.string().allow(null).example('Mailbox listing failed').description('Error message if export failed')
|
|
2351
2405
|
}).label('ExportStatus');
|
|
2352
2406
|
|
|
2353
2407
|
const exportListEntrySchema = Joi.object({
|
|
@@ -2555,7 +2609,9 @@ module.exports = {
|
|
|
2555
2609
|
oauthCreateSchema,
|
|
2556
2610
|
oauthUpdateSchema,
|
|
2557
2611
|
tokenRestrictionsSchema,
|
|
2612
|
+
tokenPermissionsSchema,
|
|
2558
2613
|
accountIdSchema,
|
|
2614
|
+
blocklistListIdSchema,
|
|
2559
2615
|
oauth2ProviderSchema,
|
|
2560
2616
|
accountTypeSchema,
|
|
2561
2617
|
apiHeadersSchema,
|