emailengine-app 2.81.2 → 2.82.1
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 +33 -10
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +71 -0
- package/DOCKER_DEPLOYMENT.md +13 -12
- package/Dockerfile +2 -0
- package/bin/emailengine.js +105 -25
- package/config/default.toml +0 -5
- package/config/test.toml +0 -5
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +70 -42
- package/getswagger.sh +0 -4
- package/lib/account/account-state.js +2 -110
- package/lib/account/expected-identity.js +1 -1
- package/lib/account-assignment.js +138 -1
- package/lib/account.js +289 -869
- package/lib/api-reference/index.js +2 -3
- package/lib/api-reference/schema-tree.js +53 -3
- package/lib/api-routes/account-binding.js +58 -0
- package/lib/api-routes/account-routes.js +65 -37
- package/lib/api-routes/behavior-notes.js +4 -0
- package/lib/api-routes/blocklist-routes.js +2 -2
- package/lib/api-routes/bull-board-routes.js +1 -6
- package/lib/api-routes/export-routes.js +2 -22
- package/lib/api-routes/gateway-routes.js +15 -16
- package/lib/api-routes/index.js +1 -13
- package/lib/api-routes/mailbox-routes.js +2 -7
- package/lib/api-routes/mcp-oauth-routes.js +2 -1
- package/lib/api-routes/mcp-routes.js +7 -7
- package/lib/api-routes/message-routes.js +50 -238
- package/lib/api-routes/mint-bounds.js +110 -0
- package/lib/api-routes/oauth2-app-routes.js +23 -32
- package/lib/api-routes/operation-impact.js +1 -1
- package/lib/api-routes/outbox-routes.js +3 -3
- package/lib/api-routes/permission-map.js +1 -7
- package/lib/api-routes/route-helpers.js +11 -5
- package/lib/api-routes/settings-routes.js +20 -21
- package/lib/api-routes/stats-routes.js +1 -1
- package/lib/api-routes/submit-routes.js +17 -18
- package/lib/api-routes/template-routes.js +4 -9
- package/lib/api-routes/token-routes.js +28 -6
- package/lib/api-token-scheme.js +71 -0
- package/lib/arf-detect.js +33 -6
- package/lib/auth-token.js +44 -24
- package/lib/autodetect-imap-settings.js +305 -123
- package/lib/bounce-detect.js +25 -16
- package/lib/calendar-event.js +78 -0
- package/lib/consts.js +54 -5
- package/lib/create-imap-client.js +24 -0
- package/lib/db.js +77 -30
- package/lib/delivery-error.js +70 -2
- package/lib/egress-fetch.js +54 -3
- package/lib/egress-filter.js +11 -0
- package/lib/email-client/api-retry.js +147 -0
- package/lib/email-client/base-client.js +383 -536
- package/lib/email-client/credential-errors.js +21 -5
- package/lib/email-client/gmail/gmail-api.js +38 -125
- package/lib/email-client/gmail/send-request.js +1 -1
- package/lib/email-client/gmail-client.js +77 -51
- package/lib/email-client/imap/mailbox.js +158 -324
- package/lib/email-client/imap/stale-view.js +109 -0
- package/lib/email-client/imap/subconnection.js +46 -9
- package/lib/email-client/imap/sync-operations.js +5 -37
- package/lib/email-client/imap-client.js +190 -65
- package/lib/email-client/message-builder.js +50 -25
- package/lib/email-client/notification-handler.js +5 -219
- package/lib/email-client/outlook/graph-api.js +147 -126
- package/lib/email-client/outlook/send-request.js +10 -4
- package/lib/email-client/outlook-client.js +389 -463
- package/lib/email-client/smtp-pool-manager.js +3 -2
- package/lib/encrypt.js +184 -19
- package/lib/enum-descriptions.js +6 -3
- package/lib/export.js +141 -41
- package/lib/gateway.js +25 -6
- package/lib/get-raw-email.js +26 -44
- package/lib/get-secret.js +1 -21
- package/lib/handlebars-helpers.js +31 -10
- package/lib/imap-proxy-auth.js +13 -29
- package/lib/imapproxy/imap-core/README.md +1 -0
- package/lib/imapproxy/imap-core/lib/handler/imap-parser.js +12 -0
- package/lib/imapproxy/imap-core/lib/imap-command.js +74 -10
- package/lib/imapproxy/imap-core/lib/imap-connection.js +9 -1
- package/lib/imapproxy/imap-core/lib/imap-server.js +112 -26
- package/lib/imapproxy/imap-core/lib/imap-stream.js +41 -1
- package/lib/imapproxy/imap-core/lib/imap-tools.js +10 -2
- package/lib/imapproxy/imap-core/lib/indexer/indexer.js +4 -2
- package/lib/imapproxy/imap-server.js +17 -177
- package/lib/imapproxy/proxy-handoff.js +235 -0
- package/lib/imapproxy/response-error.js +33 -0
- package/lib/imapproxy/upstream-client.js +2 -2
- package/lib/license-beacon.js +3 -9
- package/lib/llm-pre-process.js +182 -43
- package/lib/logger.js +1 -1
- package/lib/lua/ee-export-queue-add.lua +39 -0
- package/lib/lua/ee-get-idempotency.lua +15 -3
- package/lib/lua/ee-release-attempts.lua +23 -0
- package/lib/lua/ee-reserve-attempts.lua +42 -0
- package/lib/lua/h-set-bigger.lua +12 -2
- package/lib/lua/s-list-accounts.lua +6 -3
- package/lib/mcp/index.js +1 -2
- package/lib/mcp/listen.js +221 -18
- package/lib/mcp/oauth.js +44 -5
- package/lib/mcp/resources.js +8 -2
- package/lib/mcp/tools.js +108 -36
- package/lib/message-port-stream.js +64 -6
- package/lib/oauth/external-account-signer.js +16 -13
- package/lib/oauth/gmail.js +64 -32
- package/lib/oauth/mail-ru.js +24 -17
- package/lib/oauth/outlook.js +53 -40
- package/lib/oauth/pubsub/google.js +38 -2
- package/lib/oauth/scope-checker.js +39 -8
- package/lib/oauth/scope-list.js +55 -0
- package/lib/oauth/token-fetch.js +47 -0
- package/lib/oauth/verify-app.js +2 -2
- package/lib/oauth2-apps.js +154 -90
- package/lib/openapi/build-document.js +1 -1
- package/lib/openapi/joi-schema.js +78 -9
- package/lib/outbox.js +2 -7
- package/lib/parse-message.js +21 -0
- package/lib/payload-examples-webhooks.json +4 -7
- package/lib/pbkdf2-phc.js +101 -0
- package/lib/privileged-settings.js +0 -14
- package/lib/queue-retention.js +4 -2
- package/lib/rate-limit.js +54 -15
- package/lib/read-env-value.js +33 -2
- package/lib/redis-scan-delete.js +56 -29
- package/lib/redis-url.js +3 -1
- package/lib/respawn-backoff.js +5 -4
- package/lib/response-stream.js +25 -4
- package/lib/rewrite-text-nodes.js +27 -40
- package/lib/routes-ui.js +0 -5
- package/lib/schemas.js +180 -253
- package/lib/sentry.js +21 -5
- package/lib/settings.js +58 -59
- package/lib/smtp-auth.js +6 -2
- package/lib/smtp-message-processor.js +28 -7
- package/lib/sso.js +7 -3
- package/lib/stream-encrypt.js +14 -13
- package/lib/swagger-options.js +3 -1
- package/lib/tls/provision.js +69 -3
- package/lib/tls/store.js +14 -1
- package/lib/token-audit-log.js +3 -2
- package/lib/tools.js +114 -53
- package/lib/totp.js +16 -1
- package/lib/ui-routes/account-routes.js +67 -70
- package/lib/ui-routes/admin-config-routes.js +111 -134
- package/lib/ui-routes/admin-entities-routes.js +101 -191
- package/lib/ui-routes/ai-options.js +104 -0
- package/lib/ui-routes/auth-routes.js +98 -18
- package/lib/ui-routes/export-routes.js +3 -23
- package/lib/ui-routes/internals-routes.js +12 -9
- package/lib/ui-routes/network-config-routes.js +8 -18
- package/lib/ui-routes/oauth-config-routes.js +83 -228
- package/lib/ui-routes/route-helpers.js +63 -67
- package/lib/ui-routes/special-use-paths.js +33 -0
- package/lib/ui-routes/unsubscribe-routes.js +2 -2
- package/lib/utils/decode-headers.js +32 -5
- package/lib/utils/header-map.js +62 -1
- package/lib/utils/network.js +11 -17
- package/lib/web-safe-html.js +77 -4
- package/lib/webhook-request.js +9 -1
- package/lib/webhook-routing.js +27 -1
- package/lib/webhooks.js +120 -43
- package/lib/worker-rpc-error.js +43 -2
- package/list-generate.js +13 -2
- package/package.json +38 -46
- package/sbom.json +1 -1
- package/scripts/refresh-test-tokens.js +42 -14
- package/server.js +338 -292
- package/setup-production.sh +16 -7
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +7 -8
- package/static/js/ee-client.js +145 -70
- package/static/js/ui.js +350 -154
- package/static/licenses.html +349 -1740
- package/translations/messages.pot +129 -111
- package/views/account-workspace-error.hbs +30 -0
- package/views/accounts/account.hbs +9 -4
- package/views/accounts/browse.hbs +10 -4
- package/views/accounts/edit.hbs +11 -2
- package/views/config/ai.hbs +49 -41
- package/views/config/oauth/app.hbs +2 -1
- package/views/dashboard.hbs +18 -16
- package/views/internals/index.hbs +1 -1
- package/views/layout/app.hbs +0 -22
- package/views/layout/login.hbs +2 -1
- package/views/partials/filter_editor_js.hbs +4 -3
- package/views/partials/gmail_api_scopes.hbs +16 -0
- package/views/partials/oauth_form.hbs +67 -94
- package/views/partials/oauth_pubsub_app_select.hbs +43 -0
- package/views/partials/scope_info.hbs +14 -23
- package/views/partials/side_menu.hbs +0 -4
- package/views/partials/ui/account-picker.hbs +6 -32
- package/views/partials/ui/model-picker.hbs +31 -0
- package/views/partials/ui/pagination.hbs +6 -1
- package/views/partials/ui/picker.hbs +47 -0
- package/views/unsubscribe.hbs +1 -1
- package/workers/api.js +82 -47
- package/workers/export.js +55 -60
- package/workers/imap.js +132 -49
- package/workers/submit.js +5 -6
- package/workers/webhooks.js +46 -27
- package/.githooks/pre-commit +0 -80
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/contributing.md +0 -17
- package/.github/dependabot.yml +0 -22
- package/.github/docker-smoke-test.sh +0 -61
- package/.github/workflows/deploy.yml +0 -215
- package/.github/workflows/e2e.yml +0 -55
- package/.github/workflows/release.yaml +0 -217
- package/.github/workflows/test.yml +0 -307
- package/lib/api-routes/chat-routes.js +0 -535
- package/lib/document-store.js +0 -75
- package/lib/es.js +0 -757
- package/lib/generate-text-preview.js +0 -61
- package/lib/imapproxy/imap-core/memory-notifier.js +0 -129
- package/lib/pre-process.js +0 -196
- package/lib/threads.js +0 -155
- package/lib/ui-routes/document-store-routes.js +0 -806
- package/playwright.config.js +0 -47
- package/views/config/document-store/chat.hbs +0 -286
- package/views/config/document-store/index.hbs +0 -146
- package/views/config/document-store/mappings/index.hbs +0 -108
- package/views/config/document-store/mappings/new.hbs +0 -68
- package/views/config/document-store/pre-processing/index.hbs +0 -103
- package/views/partials/document_store_header.hbs +0 -30
- package/workers/documents.js +0 -1128
package/lib/schemas.js
CHANGED
|
@@ -17,8 +17,22 @@ const tlsCertificateChoice = listener =>
|
|
|
17
17
|
)
|
|
18
18
|
.label('TlsCertificateChoice');
|
|
19
19
|
const Joi = require('joi');
|
|
20
|
+
const { DEFAULT_MODEL: AI_DEFAULT_MODEL, DEFAULT_MAX_TOKENS: AI_DEFAULT_MAX_TOKENS, REASONING_EFFORTS } = require('@postalsys/email-ai-tools');
|
|
21
|
+
|
|
22
|
+
// The two spellings of a boolean flag. apiBoolean() is what JSON bodies and query strings
|
|
23
|
+
// carry ('1' and '0' included, because a query string has no booleans); formBoolean() adds the
|
|
24
|
+
// values a browser form posts for a checkbox ('on' when ticked, '' from a hidden companion
|
|
25
|
+
// input when not). Every boolean flag goes through one of them so the accepted spellings are
|
|
26
|
+
// defined once (test/api-boolean-flags-test.js checks that nothing bypasses them).
|
|
27
|
+
function apiBoolean() {
|
|
28
|
+
return Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', '0', 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function formBoolean() {
|
|
32
|
+
return Joi.boolean().truthy('Y', 'true', '1', 'on').falsy('N', 'false', '0', 0, '');
|
|
33
|
+
}
|
|
20
34
|
const config = require('@zone-eu/wild-config');
|
|
21
|
-
const { getByteSize } = require('./tools');
|
|
35
|
+
const { getByteSize, readEnvValue } = require('./tools');
|
|
22
36
|
const { COLLAPSE_CLASS, MAX_ACCOUNT_ID_LENGTH } = require('./consts');
|
|
23
37
|
const { locales } = require('./translations');
|
|
24
38
|
const { OAUTH_PROVIDERS } = require('./oauth2-apps');
|
|
@@ -55,7 +69,9 @@ config.api = config.api || {
|
|
|
55
69
|
};
|
|
56
70
|
|
|
57
71
|
const DEFAULT_MAX_ATTACHMENT_SIZE = 5 * 1024 * 1024;
|
|
58
|
-
|
|
72
|
+
// readEnvValue() rather than process.env, so EENGINE_MAX_SIZE_FILE raises the schema's maximum and not
|
|
73
|
+
// only the listener limit that server.js and workers/api.js resolve the same variable for
|
|
74
|
+
const MAX_ATTACHMENT_SIZE = getByteSize(readEnvValue('EENGINE_MAX_SIZE') || config.api.maxSize) || DEFAULT_MAX_ATTACHMENT_SIZE;
|
|
59
75
|
|
|
60
76
|
const accountIdSchema = Joi.string().empty('').trim().max(MAX_ACCOUNT_ID_LENGTH).example('user123').description('Unique identifier for the email account');
|
|
61
77
|
|
|
@@ -95,6 +111,12 @@ const { ENUM_DESCRIPTIONS } = require('./enum-descriptions');
|
|
|
95
111
|
const { ACTION, GRANTABLE_GROUPS, IMPLICIT_GROUPS } = require('./api-routes/permission-map');
|
|
96
112
|
const { FIELD_USAGE } = require('./field-usage');
|
|
97
113
|
|
|
114
|
+
// Attachments one JSON-built message may carry. Every attachment is a MIME node, and the MIME
|
|
115
|
+
// splitter that later re-reads the built message (Bcc removal at delivery, tracking rewrites)
|
|
116
|
+
// refuses more than 1000 nodes, so a message over that limit could be queued but never sent.
|
|
117
|
+
// Well below the splitter's limit, leaving room for the multipart and text nodes around them.
|
|
118
|
+
const MAX_MESSAGE_ATTACHMENTS = 500;
|
|
119
|
+
|
|
98
120
|
// Account identity as the API describes it. These live here rather than next to the routes that use
|
|
99
121
|
// them because they are derived from the OAuth2 provider list, and a copy in a test fixture would
|
|
100
122
|
// document a different set of providers than the server accepts.
|
|
@@ -117,7 +139,7 @@ const accountTypeSchema = Joi.string()
|
|
|
117
139
|
const settingsSchema = {
|
|
118
140
|
/* ────────────── Webhooks ────────────── */
|
|
119
141
|
|
|
120
|
-
webhooksEnabled:
|
|
142
|
+
webhooksEnabled: apiBoolean().description('Enable or disable webhook delivery for all accounts'),
|
|
121
143
|
|
|
122
144
|
webhooks: Joi.string()
|
|
123
145
|
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
@@ -168,21 +190,13 @@ const settingsSchema = {
|
|
|
168
190
|
|
|
169
191
|
/* ────────────── Tracking ────────────── */
|
|
170
192
|
|
|
171
|
-
trackSentMessages:
|
|
172
|
-
.truthy('Y', 'true', '1', 'on')
|
|
173
|
-
.falsy('N', 'false', 0, '')
|
|
193
|
+
trackSentMessages: formBoolean()
|
|
174
194
|
.description('Enable tracking features for outgoing messages (deprecated - use trackClicks and trackOpens instead)')
|
|
175
195
|
.meta({ swaggerHidden: true }),
|
|
176
196
|
|
|
177
|
-
trackClicks:
|
|
178
|
-
.truthy('Y', 'true', '1', 'on')
|
|
179
|
-
.falsy('N', 'false', 0, '')
|
|
180
|
-
.description('Rewrite links in outgoing HTML emails to track click-through rates'),
|
|
197
|
+
trackClicks: formBoolean().description('Rewrite links in outgoing HTML emails to track click-through rates'),
|
|
181
198
|
|
|
182
|
-
trackOpens:
|
|
183
|
-
.truthy('Y', 'true', '1', 'on')
|
|
184
|
-
.falsy('N', 'false', 0, '')
|
|
185
|
-
.description('Insert a tracking pixel in outgoing HTML emails to detect when messages are opened'),
|
|
199
|
+
trackOpens: formBoolean().description('Insert a tracking pixel in outgoing HTML emails to detect when messages are opened'),
|
|
186
200
|
|
|
187
201
|
/* ────────────── IMAP ────────────── */
|
|
188
202
|
|
|
@@ -195,31 +209,28 @@ const settingsSchema = {
|
|
|
195
209
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.imapIndexer, usage: FIELD_USAGE.imapIndexer })
|
|
196
210
|
.label('ImapIndexer'),
|
|
197
211
|
|
|
198
|
-
resolveGmailCategories:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
.description('Automatically detect and categorize Gmail tabs (Primary, Social, Promotions, etc.) for IMAP connections'),
|
|
212
|
+
resolveGmailCategories: formBoolean().description(
|
|
213
|
+
'Automatically detect and categorize Gmail tabs (Primary, Social, Promotions, etc.) for IMAP connections'
|
|
214
|
+
),
|
|
202
215
|
|
|
203
|
-
ignoreMailCertErrors:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.description('Allow connections to mail servers with self-signed or invalid TLS certificates (not recommended for production)'),
|
|
216
|
+
ignoreMailCertErrors: formBoolean().description(
|
|
217
|
+
'Allow connections to mail servers with self-signed or invalid TLS certificates (not recommended for production)'
|
|
218
|
+
),
|
|
207
219
|
|
|
208
220
|
/* ────────────── OpenAI ────────────── */
|
|
209
221
|
|
|
210
|
-
generateEmailSummary:
|
|
211
|
-
.truthy('Y', 'true', '1', 'on')
|
|
212
|
-
.falsy('N', 'false', 0, '')
|
|
213
|
-
.description('Generate AI-powered summaries for incoming emails using OpenAI'),
|
|
222
|
+
generateEmailSummary: formBoolean().description('Generate AI-powered summaries for incoming emails using OpenAI'),
|
|
214
223
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
.description('Deprecated - This feature has been removed')
|
|
219
|
-
.meta({ swaggerHidden: true }),
|
|
224
|
+
// The separate risk assessment call left in 2023. The key is still accepted and dropped so a
|
|
225
|
+
// client that sends it keeps working
|
|
226
|
+
generateRiskAssessment: Joi.any().strip().description('Deprecated - This feature has been removed').meta({ swaggerHidden: true }),
|
|
220
227
|
|
|
221
228
|
openAiAPIKey: Joi.string().allow('').example('sk-…').description('Your OpenAI API key for AI features').label('OpenAiAPIKey'),
|
|
222
|
-
openAiModel: Joi.string()
|
|
229
|
+
openAiModel: Joi.string()
|
|
230
|
+
.allow('')
|
|
231
|
+
.example(AI_DEFAULT_MODEL)
|
|
232
|
+
.description(`Model name for AI processing. Empty means the built-in default, ${AI_DEFAULT_MODEL}`)
|
|
233
|
+
.label('OpenAiModel'),
|
|
223
234
|
|
|
224
235
|
openAiAPIUrl: Joi.string()
|
|
225
236
|
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
@@ -229,19 +240,12 @@ const settingsSchema = {
|
|
|
229
240
|
.meta({ usage: FIELD_USAGE.openAiAPIUrl })
|
|
230
241
|
.label('OpenAiAPIUrl'),
|
|
231
242
|
|
|
232
|
-
documentStoreChatModel: Joi.string()
|
|
233
|
-
.allow('')
|
|
234
|
-
.example('gpt-3.5-turbo')
|
|
235
|
-
.description('OpenAI model for Document Store chat (deprecated feature)')
|
|
236
|
-
.label('DocumentStoreChatModel')
|
|
237
|
-
.meta({ swaggerHidden: true }),
|
|
238
|
-
|
|
239
243
|
openAiTemperature: Joi.number()
|
|
240
244
|
.allow('')
|
|
241
245
|
.min(0)
|
|
242
246
|
.max(2)
|
|
243
247
|
.example(0.8)
|
|
244
|
-
.description('Controls randomness in AI responses (0 = deterministic, 2 = very creative)')
|
|
248
|
+
.description('Controls randomness in AI responses (0 = deterministic, 2 = very creative). Not sent to a reasoning model while it reasons')
|
|
245
249
|
.label('OpenAiTemperature'),
|
|
246
250
|
|
|
247
251
|
openAiTopP: Joi.number()
|
|
@@ -249,34 +253,44 @@ const settingsSchema = {
|
|
|
249
253
|
.min(0)
|
|
250
254
|
.max(1)
|
|
251
255
|
.example(0.1)
|
|
252
|
-
.description('Nucleus sampling parameter for AI text generation (0-1, lower = more focused)')
|
|
256
|
+
.description('Nucleus sampling parameter for AI text generation (0-1, lower = more focused). Not sent to a reasoning model while it reasons')
|
|
253
257
|
.label('OpenAiTopP'),
|
|
254
258
|
|
|
259
|
+
openAiReasoningEffort: Joi.string()
|
|
260
|
+
.valid(...REASONING_EFFORTS)
|
|
261
|
+
.allow('')
|
|
262
|
+
.example('low')
|
|
263
|
+
.description(
|
|
264
|
+
'Reasoning effort for reasoning models such as GPT-5 and later. Empty sends "low" to those models and nothing to others. A value the model refuses is dropped'
|
|
265
|
+
)
|
|
266
|
+
.label('OpenAiReasoningEffort'),
|
|
267
|
+
|
|
255
268
|
openAiMaxTokens: Joi.number()
|
|
256
269
|
.allow('')
|
|
257
270
|
.min(0)
|
|
258
|
-
.example(
|
|
259
|
-
.description(
|
|
271
|
+
.example(AI_DEFAULT_MAX_TOKENS)
|
|
272
|
+
.description(
|
|
273
|
+
`Token budget for the prompt sent to the model, the instructions and the email together. The email text is cut to fit. Defaults to ${AI_DEFAULT_MAX_TOKENS}`
|
|
274
|
+
)
|
|
260
275
|
.label('OpenAiMaxTokens'),
|
|
261
276
|
|
|
262
277
|
openAiPrompt: Joi.string()
|
|
263
278
|
.allow('')
|
|
264
279
|
.max(1024 * 1024)
|
|
265
|
-
.example('
|
|
266
|
-
.description(
|
|
280
|
+
.example('Return a JSON object with the property "language", the ISO 639-1 code of the language the email is written in.')
|
|
281
|
+
.description(
|
|
282
|
+
'Instructions for the AI, sent as the system message ahead of the email. They say which JSON properties to return. Empty means the built-in instructions'
|
|
283
|
+
)
|
|
267
284
|
.label('OpenAiPrompt'),
|
|
268
285
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
286
|
+
// Embeddings generation left with the Document Store in 2.82.0. The key is still accepted and
|
|
287
|
+
// dropped so a client that sends it keeps working; storing it would only bump the AI settings
|
|
288
|
+
// version for a value nothing reads
|
|
289
|
+
openAiGenerateEmbeddings: Joi.any().strip().description('Deprecated - embeddings generation has been removed').meta({ swaggerHidden: true }),
|
|
273
290
|
|
|
274
291
|
/* ────────────── Webhook Filters ────────────── */
|
|
275
292
|
|
|
276
|
-
inboxNewOnly:
|
|
277
|
-
.truthy('Y', 'true', '1', 'on')
|
|
278
|
-
.falsy('N', 'false', 0, '')
|
|
279
|
-
.description('Trigger "messageNew" webhooks only for messages arriving in the Inbox folder'),
|
|
293
|
+
inboxNewOnly: formBoolean().description('Trigger "messageNew" webhooks only for messages arriving in the Inbox folder'),
|
|
280
294
|
|
|
281
295
|
/* ────────────── Security ────────────── */
|
|
282
296
|
|
|
@@ -295,9 +309,7 @@ const settingsSchema = {
|
|
|
295
309
|
|
|
296
310
|
// Off by default: it adds a write to the hot path of every authenticated request, and most
|
|
297
311
|
// instances will never read the result
|
|
298
|
-
tokenAuditLog:
|
|
299
|
-
.truthy('Y', 'true', '1', 'on')
|
|
300
|
-
.falsy('N', 'false', 0, '')
|
|
312
|
+
tokenAuditLog: formBoolean()
|
|
301
313
|
.example(false)
|
|
302
314
|
.description(
|
|
303
315
|
'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'
|
|
@@ -305,12 +317,9 @@ const settingsSchema = {
|
|
|
305
317
|
|
|
306
318
|
/* ────────────── Proxy ────────────── */
|
|
307
319
|
|
|
308
|
-
proxyEnabled:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
.description(
|
|
312
|
-
'Route all outbound connections through a proxy server: IMAP and SMTP sessions as well as HTTP/HTTPS requests (Gmail API, Microsoft Graph, OAuth2 token exchange, webhooks, license validation) unless a dedicated HTTP proxy is configured'
|
|
313
|
-
),
|
|
320
|
+
proxyEnabled: formBoolean().description(
|
|
321
|
+
'Route all outbound connections through a proxy server: IMAP and SMTP sessions as well as HTTP/HTTPS requests (Gmail API, Microsoft Graph, OAuth2 token exchange, webhooks, license validation) unless a dedicated HTTP proxy is configured'
|
|
322
|
+
),
|
|
314
323
|
proxyUrl: Joi.string()
|
|
315
324
|
.uri({ scheme: ['http', 'https', 'socks', 'socks4', 'socks4a', 'socks5'], allowRelative: false })
|
|
316
325
|
.allow('')
|
|
@@ -320,12 +329,9 @@ const settingsSchema = {
|
|
|
320
329
|
|
|
321
330
|
/* ────────────── HTTP Proxy ────────────── */
|
|
322
331
|
|
|
323
|
-
httpProxyEnabled:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
.description(
|
|
327
|
-
'Route outbound HTTP/HTTPS requests (webhooks, OAuth2 token exchange, Gmail API and Microsoft Graph calls, license validation) through a dedicated proxy instead of the global proxy'
|
|
328
|
-
),
|
|
332
|
+
httpProxyEnabled: formBoolean().description(
|
|
333
|
+
'Route outbound HTTP/HTTPS requests (webhooks, OAuth2 token exchange, Gmail API and Microsoft Graph calls, license validation) through a dedicated proxy instead of the global proxy'
|
|
334
|
+
),
|
|
329
335
|
httpProxyUrl: Joi.string()
|
|
330
336
|
.uri({ scheme: ['http', 'https', 'socks', 'socks4', 'socks4a', 'socks5'], allowRelative: false })
|
|
331
337
|
.allow('')
|
|
@@ -343,95 +349,46 @@ const settingsSchema = {
|
|
|
343
349
|
|
|
344
350
|
/* ────────────── Webhook Payload ────────────── */
|
|
345
351
|
|
|
346
|
-
notifyText:
|
|
347
|
-
notifyWebSafeHtml:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
.description(
|
|
351
|
-
'Sanitize HTML content to remove potentially dangerous elements before including in webhooks, and fold quoted thread history into a collapsed block'
|
|
352
|
-
),
|
|
352
|
+
notifyText: formBoolean().description('Include plain text message content in webhook payloads'),
|
|
353
|
+
notifyWebSafeHtml: formBoolean().description(
|
|
354
|
+
'Sanitize HTML content to remove potentially dangerous elements before including in webhooks, and fold quoted thread history into a collapsed block'
|
|
355
|
+
),
|
|
353
356
|
notifyTextSize: Joi.number().integer().min(0).example(1048576).description('Maximum size (in bytes) of text content to include in webhook payloads'),
|
|
354
|
-
notifyAttachments:
|
|
357
|
+
notifyAttachments: formBoolean().description('Include attachment data in webhook payloads'),
|
|
355
358
|
notifyAttachmentSize: Joi.number().integer().min(0).example(5242880).description('Maximum size (in bytes) per attachment to include in webhook payloads'),
|
|
356
|
-
notifyCalendarEvents:
|
|
357
|
-
.truthy('Y', 'true', '1', 'on')
|
|
358
|
-
.falsy('N', 'false', 0, '')
|
|
359
|
-
.description('Include parsed calendar event data in webhook payloads'),
|
|
359
|
+
notifyCalendarEvents: formBoolean().description('Include parsed calendar event data in webhook payloads'),
|
|
360
360
|
|
|
361
361
|
/* ────────────── MCP ────────────── */
|
|
362
362
|
|
|
363
|
-
mcpEnabled:
|
|
364
|
-
.truthy('Y', 'true', '1', 'on')
|
|
365
|
-
.falsy('N', 'false', 0, '')
|
|
363
|
+
mcpEnabled: formBoolean()
|
|
366
364
|
.example(false)
|
|
367
365
|
.description(
|
|
368
366
|
'Enable the MCP (Model Context Protocol) endpoint at /mcp, which lets AI agents work with the connected email accounts using access tokens. Disabled by default'
|
|
369
367
|
),
|
|
370
368
|
|
|
371
|
-
mcpOAuthEnabled:
|
|
372
|
-
.truthy('Y', 'true', '1', 'on')
|
|
373
|
-
.falsy('N', 'false', 0, '')
|
|
369
|
+
mcpOAuthEnabled: formBoolean()
|
|
374
370
|
.example(false)
|
|
375
371
|
.description(
|
|
376
372
|
'Enable the built-in OAuth2 authorization server for the MCP endpoint, used by MCP clients that cannot be configured with a static access token. Requires mcpEnabled and a configured serviceUrl. Disabled by default'
|
|
377
373
|
),
|
|
378
374
|
|
|
379
|
-
/* ────────────── Document Store (
|
|
380
|
-
|
|
381
|
-
documentStoreEnabled: Joi.boolean()
|
|
382
|
-
.truthy('Y', 'true', '1', 'on')
|
|
383
|
-
.falsy('N', 'false', 0, '')
|
|
384
|
-
.description('Deprecated - Document Store feature has been removed')
|
|
385
|
-
.meta({ swaggerHidden: true }),
|
|
386
|
-
|
|
387
|
-
documentStoreUrl: Joi.string()
|
|
388
|
-
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
389
|
-
.allow('')
|
|
390
|
-
.example('https://localhost:9200')
|
|
391
|
-
.description('Deprecated - Document Store feature has been removed')
|
|
392
|
-
.meta({ swaggerHidden: true }),
|
|
393
|
-
|
|
394
|
-
documentStoreIndex: Joi.string().empty('').max(1024).description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
395
|
-
|
|
396
|
-
documentStoreAuthEnabled: Joi.boolean()
|
|
397
|
-
.truthy('Y', 'true', '1', 'on')
|
|
398
|
-
.falsy('N', 'false', 0, '')
|
|
399
|
-
.description('Deprecated - Document Store feature has been removed')
|
|
400
|
-
.meta({ swaggerHidden: true }),
|
|
401
|
-
|
|
402
|
-
documentStoreUsername: Joi.string().empty('').max(1024).description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
403
|
-
|
|
404
|
-
documentStorePassword: Joi.string().empty('').max(1024).description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
405
|
-
|
|
406
|
-
documentStoreGenerateEmbeddings: Joi.boolean()
|
|
407
|
-
.truthy('Y', 'true', '1', 'on')
|
|
408
|
-
.falsy('N', 'false', 0, '')
|
|
409
|
-
.description('Deprecated - Document Store feature has been removed')
|
|
410
|
-
.meta({ swaggerHidden: true }),
|
|
375
|
+
/* ────────────── Document Store (removed) ────────────── */
|
|
411
376
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
.meta({ swaggerHidden: true }),
|
|
377
|
+
// The one Document Store setting still read after the removal: while it is on, the admin UI
|
|
378
|
+
// and the startup log say where the feature went. Kept in the schema so an API-only
|
|
379
|
+
// deployment can switch the notice off through POST /v1/settings
|
|
380
|
+
documentStoreEnabled: formBoolean().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
417
381
|
|
|
418
382
|
/* ────────────── Logging ────────────── */
|
|
419
383
|
|
|
420
384
|
logs: Joi.object({
|
|
421
|
-
all:
|
|
422
|
-
.truthy('Y', 'true', '1')
|
|
423
|
-
.falsy('N', 'false', 0)
|
|
424
|
-
.default(false)
|
|
425
|
-
.example(false)
|
|
426
|
-
.description('Enable detailed logging for all email accounts'),
|
|
385
|
+
all: apiBoolean().default(false).example(false).description('Enable detailed logging for all email accounts'),
|
|
427
386
|
maxLogLines: Joi.number().integer().min(0).max(1000000).default(10000).example(10000).description('Maximum number of log entries to retain per account')
|
|
428
387
|
}).label('LogSettings'),
|
|
429
388
|
|
|
430
389
|
/* ────────────── Error Reporting ────────────── */
|
|
431
390
|
|
|
432
|
-
sentryEnabled:
|
|
433
|
-
.truthy('Y', 'true', '1', 'on')
|
|
434
|
-
.falsy('N', 'false', 0, '')
|
|
391
|
+
sentryEnabled: formBoolean()
|
|
435
392
|
.example(false)
|
|
436
393
|
.description(
|
|
437
394
|
'Send unhandled error reports to a Sentry server. Applied at runtime, no restart needed. Ignored when the SENTRY_DSN environment variable is set'
|
|
@@ -473,31 +430,22 @@ const settingsSchema = {
|
|
|
473
430
|
|
|
474
431
|
/* ────────────── Built-in SMTP Server ────────────── */
|
|
475
432
|
|
|
476
|
-
smtpServerEnabled:
|
|
477
|
-
.truthy('Y', 'true', '1', 'on')
|
|
478
|
-
.falsy('N', 'false', 0, '')
|
|
479
|
-
.description('Enable the built-in SMTP server for receiving emails'),
|
|
433
|
+
smtpServerEnabled: formBoolean().description('Enable the built-in SMTP server for receiving emails'),
|
|
480
434
|
smtpServerPort: Joi.number().integer().min(0).max(65535).empty('').example(2525).description('Port number for the built-in SMTP server'),
|
|
481
435
|
smtpServerHost: Joi.string()
|
|
482
436
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
483
437
|
.empty('')
|
|
484
438
|
.example('0.0.0.0')
|
|
485
439
|
.description('IP address to bind the SMTP server to (empty = all interfaces)'),
|
|
486
|
-
smtpServerProxy:
|
|
487
|
-
smtpServerAuthEnabled:
|
|
488
|
-
.truthy('Y', 'true', '1', 'on')
|
|
489
|
-
.falsy('N', 'false', 0, '')
|
|
490
|
-
.description('Require SMTP authentication for incoming connections'),
|
|
440
|
+
smtpServerProxy: formBoolean().description('Enable PROXY protocol support for the SMTP server'),
|
|
441
|
+
smtpServerAuthEnabled: formBoolean().description('Require SMTP authentication for incoming connections'),
|
|
491
442
|
smtpServerPassword: Joi.string()
|
|
492
443
|
.empty('')
|
|
493
444
|
.allow(null)
|
|
494
445
|
.max(1024)
|
|
495
446
|
.example('verysecret')
|
|
496
447
|
.description('Password for SMTP authentication (null = disable authentication)'),
|
|
497
|
-
smtpServerTLSEnabled:
|
|
498
|
-
.truthy('Y', 'true', '1', 'on')
|
|
499
|
-
.falsy('N', 'false', 0, '')
|
|
500
|
-
.description('Enable TLS/STARTTLS support for the SMTP server'),
|
|
448
|
+
smtpServerTLSEnabled: formBoolean().description('Serve the SMTP submission server over implicit TLS. STARTTLS is never offered'),
|
|
501
449
|
|
|
502
450
|
/* ────────────── TLS Certificates ────────────── */
|
|
503
451
|
|
|
@@ -534,24 +482,21 @@ const settingsSchema = {
|
|
|
534
482
|
|
|
535
483
|
/* ────────────── IMAP Proxy ────────────── */
|
|
536
484
|
|
|
537
|
-
imapProxyServerEnabled:
|
|
485
|
+
imapProxyServerEnabled: formBoolean().description('Enable the IMAP proxy server'),
|
|
538
486
|
imapProxyServerPort: Joi.number().integer().min(0).max(65535).empty('').example(9993).description('Port number for the IMAP proxy server'),
|
|
539
487
|
imapProxyServerHost: Joi.string()
|
|
540
488
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
541
489
|
.empty('')
|
|
542
490
|
.example('0.0.0.0')
|
|
543
491
|
.description('IP address to bind the IMAP proxy to (empty = all interfaces)'),
|
|
544
|
-
imapProxyServerProxy:
|
|
545
|
-
.truthy('Y', 'true', '1', 'on')
|
|
546
|
-
.falsy('N', 'false', 0, '')
|
|
547
|
-
.description('Enable PROXY protocol support for the IMAP proxy'),
|
|
492
|
+
imapProxyServerProxy: formBoolean().description('Enable PROXY protocol support for the IMAP proxy'),
|
|
548
493
|
imapProxyServerPassword: Joi.string()
|
|
549
494
|
.empty('')
|
|
550
495
|
.allow(null)
|
|
551
496
|
.max(1024)
|
|
552
497
|
.example('verysecret')
|
|
553
498
|
.description('Password for IMAP proxy authentication (null = disable authentication)'),
|
|
554
|
-
imapProxyServerTLSEnabled:
|
|
499
|
+
imapProxyServerTLSEnabled: formBoolean().description('Enable TLS support for the IMAP proxy'),
|
|
555
500
|
|
|
556
501
|
/* ────────────── Queue & Delivery ────────────── */
|
|
557
502
|
|
|
@@ -610,10 +555,7 @@ const settingsSchema = {
|
|
|
610
555
|
|
|
611
556
|
/* ────────────── Reverse Proxy ────────────── */
|
|
612
557
|
|
|
613
|
-
enableApiProxy:
|
|
614
|
-
.truthy('Y', 'true', '1', 'on')
|
|
615
|
-
.falsy('N', 'false', 0, '')
|
|
616
|
-
.description('Trust X-Forwarded-* headers when behind a reverse proxy'),
|
|
558
|
+
enableApiProxy: formBoolean().description('Trust X-Forwarded-* headers when behind a reverse proxy'),
|
|
617
559
|
|
|
618
560
|
/* ────────────── Locale & Branding ────────────── */
|
|
619
561
|
|
|
@@ -667,7 +609,19 @@ const settingsSchema = {
|
|
|
667
609
|
|
|
668
610
|
exportMaxMessages: Joi.number().integer().min(1).max(10000000).example(500000).description('Maximum number of messages per export (default: 500000)'),
|
|
669
611
|
|
|
670
|
-
exportMaxSize: Joi.number().integer().min(1).example(10737418240).description('Maximum export file size in bytes (default: 10GB)')
|
|
612
|
+
exportMaxSize: Joi.number().integer().min(1).example(10737418240).description('Maximum export file size in bytes (default: 10GB)'),
|
|
613
|
+
|
|
614
|
+
exportMaxMessageSize: Joi.number()
|
|
615
|
+
.integer()
|
|
616
|
+
.min(1)
|
|
617
|
+
.example(52428800)
|
|
618
|
+
.description('Maximum size of a single message included in an export, in bytes. Larger messages are skipped (default: 50MB)'),
|
|
619
|
+
|
|
620
|
+
exportMaxAge: Joi.number()
|
|
621
|
+
.integer()
|
|
622
|
+
.min(60000)
|
|
623
|
+
.example(86400000)
|
|
624
|
+
.description('How long a finished export is kept before it is deleted, in milliseconds (default: 24 hours)')
|
|
671
625
|
};
|
|
672
626
|
|
|
673
627
|
const addressSchema = Joi.object({
|
|
@@ -678,11 +632,24 @@ const addressSchema = Joi.object({
|
|
|
678
632
|
.label('EmailAddress');
|
|
679
633
|
|
|
680
634
|
// generate a list of boolean values
|
|
635
|
+
/**
|
|
636
|
+
* Whether a setting is hidden from the published document, which is how a deprecated key stays
|
|
637
|
+
* accepted without being advertised. The one spelling of the check: lib/api-routes/settings-routes.js
|
|
638
|
+
* reads it too, to decide which settings the MCP tools offer.
|
|
639
|
+
*
|
|
640
|
+
* @param {String} key - a settingsSchema key
|
|
641
|
+
* @returns {Boolean}
|
|
642
|
+
*/
|
|
643
|
+
const isHiddenSetting = key => !!settingsSchema[key] && (settingsSchema[key].describe().metas || []).some(meta => meta && meta.swaggerHidden);
|
|
644
|
+
|
|
645
|
+
// The selectors GET /v1/settings takes, one per setting. Built from a fresh apiBoolean(), so the
|
|
646
|
+
// hidden marker on the setting itself did not carry over and the document offered a query argument for
|
|
647
|
+
// every removed feature whose setting is still accepted (documentStoreEnabled and two others).
|
|
681
648
|
const settingsQuerySchema = Object.fromEntries(
|
|
682
|
-
Object.keys(Object.assign({ eventTypes: true }, settingsSchema)).map(key =>
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
649
|
+
Object.keys(Object.assign({ eventTypes: true }, settingsSchema)).map(key => {
|
|
650
|
+
const selector = apiBoolean().default(false);
|
|
651
|
+
return [key, isHiddenSetting(key) ? selector.meta({ swaggerHidden: true }) : selector];
|
|
652
|
+
})
|
|
686
653
|
);
|
|
687
654
|
|
|
688
655
|
const imapSchema = {
|
|
@@ -1244,14 +1211,6 @@ const messageDetailsSchema = Joi.object({
|
|
|
1244
1211
|
messageSpecialUse: messageSpecialUseSchema
|
|
1245
1212
|
}).label('MessageDetails');
|
|
1246
1213
|
|
|
1247
|
-
// Combined Document Store query echoed back by search endpoints when the (hidden) exposeQuery
|
|
1248
|
-
// query parameter is enabled. Free-form object, mirrors whatever was sent to the backing index
|
|
1249
|
-
const documentStoreQuerySchema = Joi.object()
|
|
1250
|
-
.unknown()
|
|
1251
|
-
.description('Combined Document Store query. Only present when the exposeQuery query parameter is enabled')
|
|
1252
|
-
.label('ExposedDocumentStoreQuery')
|
|
1253
|
-
.meta({ swaggerHidden: true });
|
|
1254
|
-
|
|
1255
1214
|
const messageListSchema = Joi.object({
|
|
1256
1215
|
total: Joi.number()
|
|
1257
1216
|
.integer()
|
|
@@ -1272,8 +1231,7 @@ const messageListSchema = Joi.object({
|
|
|
1272
1231
|
.description('Cursor for fetching the next page (null when no more pages)')
|
|
1273
1232
|
.label('NextPageCursor'),
|
|
1274
1233
|
prevPageCursor: Joi.string().allow(null).example('imap_kcQIji3UobDDTxc').description('Cursor for fetching the previous page').label('PrevPageCursor'),
|
|
1275
|
-
messages: Joi.array().items(messageEntrySchema).label('PageMessages')
|
|
1276
|
-
documentStoreQuery: documentStoreQuerySchema
|
|
1234
|
+
messages: Joi.array().items(messageEntrySchema).label('PageMessages')
|
|
1277
1235
|
}).label('MessageList');
|
|
1278
1236
|
|
|
1279
1237
|
// Fields shared by both mailbox listing item shapes (the full listing and the short listing in
|
|
@@ -1385,7 +1343,9 @@ const lastErrorSchema = Joi.object({
|
|
|
1385
1343
|
url: Joi.string().example('https://oauth2.googleapis.com/token').description('OAuth2 token endpoint URL').label('OAuthTokenUrl'),
|
|
1386
1344
|
method: Joi.string().example('post').description('HTTP method used for the token request').label('OAuthTokenMethod'),
|
|
1387
1345
|
grant: Joi.string()
|
|
1388
|
-
|
|
1346
|
+
// client_credentials is what an Outlook application-permission app requests, and the
|
|
1347
|
+
// enum did not admit it although getClientCredentialsToken() has always recorded it
|
|
1348
|
+
.valid('refresh_token', 'authorization_code', 'client_credentials')
|
|
1389
1349
|
.example('refresh_token')
|
|
1390
1350
|
.description('OAuth2 grant type being requested')
|
|
1391
1351
|
.label('OAuthGrant'),
|
|
@@ -1417,6 +1377,16 @@ const lastErrorSchema = Joi.object({
|
|
|
1417
1377
|
.example('AAABhaBPHscAAAAH')
|
|
1418
1378
|
.description('Value of the authorization code or error code related to the failure')
|
|
1419
1379
|
.label('OAuthTokenErrorCode'),
|
|
1380
|
+
// Set instead of `status` when the request never reached the endpoint, so there is no
|
|
1381
|
+
// response to report (fetchTokenRequest() in lib/oauth/token-fetch.js)
|
|
1382
|
+
error: Joi.string()
|
|
1383
|
+
.example('fetch failed')
|
|
1384
|
+
.description('Transport failure message, set when the token endpoint could not be reached at all')
|
|
1385
|
+
.label('OAuthTokenTransportError'),
|
|
1386
|
+
errorCode: Joi.string()
|
|
1387
|
+
.example('ECONNREFUSED')
|
|
1388
|
+
.description('Transport failure code, set when the token endpoint could not be reached at all')
|
|
1389
|
+
.label('OAuthTokenTransportErrorCode'),
|
|
1420
1390
|
flag: Joi.object({
|
|
1421
1391
|
message: Joi.string().example('Please verify the OAuth2 application credentials').description('Description of the application-level problem'),
|
|
1422
1392
|
code: Joi.string().example('INVALID_CLIENT_SECRET').description('Machine-readable code of the application-level problem'),
|
|
@@ -1471,14 +1441,6 @@ const templateSchemas = {
|
|
|
1471
1441
|
.description('Preview text shown in email clients after the subject line')
|
|
1472
1442
|
};
|
|
1473
1443
|
|
|
1474
|
-
const documentStoreSchema = Joi.boolean()
|
|
1475
|
-
.empty('')
|
|
1476
|
-
.truthy('Y', 'true', '1')
|
|
1477
|
-
.falsy('N', 'false', 0)
|
|
1478
|
-
.description('Deprecated feature - Document Store has been removed')
|
|
1479
|
-
.label('UseDocumentStore')
|
|
1480
|
-
.meta({ swaggerHidden: true });
|
|
1481
|
-
|
|
1482
1444
|
// Every field carries its own `.example()`. The search object is embedded by five
|
|
1483
1445
|
// operations and only one of them - POST /v1/account/{account}/search - wraps it in a
|
|
1484
1446
|
// curated payload, so on the other four the API reference had nothing to show for any of
|
|
@@ -1490,20 +1452,12 @@ const searchSchema = Joi.object({
|
|
|
1490
1452
|
.example('1:10')
|
|
1491
1453
|
.description('Sequence number range (e.g., "1:10" or "1,3,5"). Only supported for IMAP.'),
|
|
1492
1454
|
|
|
1493
|
-
answered:
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
.truthy('Y', 'true', '1')
|
|
1500
|
-
.falsy('N', 'false', 0)
|
|
1501
|
-
.description('Filter for messages marked for deletion. Only supported for IMAP.')
|
|
1502
|
-
.label('DeletedFlag'),
|
|
1503
|
-
draft: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for draft messages').label('DraftFlag'),
|
|
1504
|
-
unseen: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for unread messages').label('UnseenFlag'),
|
|
1505
|
-
flagged: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for flagged/starred messages').label('Flagged'),
|
|
1506
|
-
seen: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for read messages').label('SeenFlag'),
|
|
1455
|
+
answered: apiBoolean().description('Filter for messages that have been replied to. Only supported for IMAP.').label('AnsweredFlag'),
|
|
1456
|
+
deleted: apiBoolean().description('Filter for messages marked for deletion. Only supported for IMAP.').label('DeletedFlag'),
|
|
1457
|
+
draft: apiBoolean().description('Filter for draft messages').label('DraftFlag'),
|
|
1458
|
+
unseen: apiBoolean().description('Filter for unread messages').label('UnseenFlag'),
|
|
1459
|
+
flagged: apiBoolean().description('Filter for flagged/starred messages').label('Flagged'),
|
|
1460
|
+
seen: apiBoolean().description('Filter for read messages').label('SeenFlag'),
|
|
1507
1461
|
|
|
1508
1462
|
from: Joi.string().max(256).example('nyan.cat@example.com').description('Search in From addresses').label('From'),
|
|
1509
1463
|
to: Joi.string().max(256).example('support@example.com').description('Search in To addresses. Not supported for MS Graph API.').label('To'),
|
|
@@ -1648,12 +1602,9 @@ const expectedEmailSchema = Joi.string()
|
|
|
1648
1602
|
.meta({ usage: FIELD_USAGE.expectedEmail });
|
|
1649
1603
|
|
|
1650
1604
|
const accountSchemas = {
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
.example('2021-07-08T07:06:34.336Z')
|
|
1655
|
-
.description('Deprecated - Document Store sync start date')
|
|
1656
|
-
.meta({ swaggerHidden: true }),
|
|
1605
|
+
// The Document Store sync start date. Accepted and dropped since the feature's removal, so an
|
|
1606
|
+
// integration written against an older release keeps working
|
|
1607
|
+
syncFrom: Joi.any().strip().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
1657
1608
|
|
|
1658
1609
|
notifyFrom: Joi.date()
|
|
1659
1610
|
.iso()
|
|
@@ -1722,11 +1673,7 @@ const googleSubscriptionNameSchema = Joi.string()
|
|
|
1722
1673
|
.description('Google Pub/Sub subscription name')
|
|
1723
1674
|
.label('GoogleSubscriptionName');
|
|
1724
1675
|
|
|
1725
|
-
const googleWorkspaceAccountsSchema =
|
|
1726
|
-
.truthy('Y', 'true', '1', 'on')
|
|
1727
|
-
.falsy('N', 'false', 0, '')
|
|
1728
|
-
.example(false)
|
|
1729
|
-
.description('Restrict OAuth2 login to Google Workspace accounts only');
|
|
1676
|
+
const googleWorkspaceAccountsSchema = formBoolean().example(false).description('Restrict OAuth2 login to Google Workspace accounts only');
|
|
1730
1677
|
|
|
1731
1678
|
const oauthCreateSchema = {
|
|
1732
1679
|
name: Joi.string().trim().empty('').max(256).example('My Gmail App').required().description('Display name for the OAuth2 application'),
|
|
@@ -1744,12 +1691,7 @@ const oauthCreateSchema = {
|
|
|
1744
1691
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.oauth2Provider })
|
|
1745
1692
|
.label('CreateOAuth2Provider'),
|
|
1746
1693
|
|
|
1747
|
-
enabled:
|
|
1748
|
-
.truthy('Y', 'true', '1', 'on')
|
|
1749
|
-
.falsy('N', 'false', 0, '')
|
|
1750
|
-
.default(false)
|
|
1751
|
-
.example(true)
|
|
1752
|
-
.description('Whether this OAuth2 app is active'),
|
|
1694
|
+
enabled: formBoolean().default(false).example(true).description('Whether this OAuth2 app is active'),
|
|
1753
1695
|
|
|
1754
1696
|
clientId: Joi.string()
|
|
1755
1697
|
.trim()
|
|
@@ -1970,7 +1912,7 @@ const oauthUpdateSchema = {
|
|
|
1970
1912
|
|
|
1971
1913
|
title: Joi.string().allow('').trim().max(256).example('App title').description('Title for the application button'),
|
|
1972
1914
|
|
|
1973
|
-
enabled:
|
|
1915
|
+
enabled: formBoolean().default(false).description('Enable this app'),
|
|
1974
1916
|
|
|
1975
1917
|
clientId: Joi.string()
|
|
1976
1918
|
.trim()
|
|
@@ -2307,7 +2249,7 @@ const outboxEntrySchema = Joi.object({
|
|
|
2307
2249
|
proxy: Joi.string().allow(null).example('socks5://proxy.example.com:1080').description('Proxy URL used for delivery, or null when no proxy is set'),
|
|
2308
2250
|
localAddress: Joi.string().allow(null).example('198.51.100.24').description('Local IP address used for delivery, or null when not set'),
|
|
2309
2251
|
idempotencyKey: Joi.string().allow(null).max(1024).example('submit-12345').description('Idempotency key provided when the message was submitted'),
|
|
2310
|
-
useStructuredFormat: Joi.boolean().description('Whether
|
|
2252
|
+
useStructuredFormat: Joi.boolean().description('Whether this message is sent to MS Graph as structured JSON instead of raw MIME'),
|
|
2311
2253
|
|
|
2312
2254
|
created: Joi.date().iso().example('2021-02-17T13:43:18.860Z').description('When this message was added to the queue'),
|
|
2313
2255
|
scheduled: Joi.date().iso().example('2021-02-17T13:43:18.860Z').description('Scheduled delivery time'),
|
|
@@ -2337,19 +2279,26 @@ const outboxEntrySchema = Joi.object({
|
|
|
2337
2279
|
error: Joi.object({
|
|
2338
2280
|
message: Joi.string().example('Authentication failed').description('Error description'),
|
|
2339
2281
|
code: Joi.string().example('EAUTH').description('Error code'),
|
|
2340
|
-
statusCode: Joi.number().integer().example(502).description('SMTP response code')
|
|
2341
|
-
networkRouting: Joi.object()
|
|
2342
|
-
.unknown()
|
|
2343
|
-
.allow(null)
|
|
2344
|
-
.example({ localAddress: '198.51.100.24', name: 'relay.example.com' })
|
|
2345
|
-
.description('Network routing information for the failed delivery attempt')
|
|
2346
|
-
.label('OutboxErrorNetworkRouting')
|
|
2282
|
+
statusCode: Joi.number().integer().example(502).description('SMTP response code')
|
|
2347
2283
|
})
|
|
2348
2284
|
.label('OutboxListProgressError')
|
|
2349
|
-
.description('Error details (when status is "error")')
|
|
2285
|
+
.description('Error details (when status is "error")'),
|
|
2286
|
+
// The submit worker writes this beside `error`, not inside it (workers/submit.js). It was
|
|
2287
|
+
// declared one level deeper here, so a client reading the documented location found nothing
|
|
2288
|
+
networkRouting: Joi.object()
|
|
2289
|
+
.unknown()
|
|
2290
|
+
.allow(null)
|
|
2291
|
+
.example({ localAddress: '198.51.100.24', name: 'relay.example.com' })
|
|
2292
|
+
.description('Network routing information for the failed delivery attempt (when status is "error")')
|
|
2293
|
+
.label('OutboxErrorNetworkRouting')
|
|
2350
2294
|
}).label('OutboxEntryProgress')
|
|
2351
2295
|
}).label('OutboxEntry');
|
|
2352
2296
|
|
|
2297
|
+
// The Document Store was removed in 2.82.0. The request fields that selected it are still
|
|
2298
|
+
// accepted and dropped, so an integration written against an older release keeps working and a
|
|
2299
|
+
// request that names them is answered from the live mailbox, as it already was with the feature off
|
|
2300
|
+
const documentStoreSchema = Joi.any().strip().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true });
|
|
2301
|
+
|
|
2353
2302
|
const messageReferenceSchema = Joi.object({
|
|
2354
2303
|
message: Joi.string()
|
|
2355
2304
|
.base64({ paddingRequired: false, urlSafe: true })
|
|
@@ -2366,31 +2315,23 @@ const messageReferenceSchema = Joi.object({
|
|
|
2366
2315
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.messageAction })
|
|
2367
2316
|
.label('MessageAction'),
|
|
2368
2317
|
|
|
2369
|
-
inline:
|
|
2370
|
-
.truthy('Y', 'true', '1')
|
|
2371
|
-
.falsy('N', 'false', 0)
|
|
2318
|
+
inline: apiBoolean()
|
|
2372
2319
|
.default(false)
|
|
2373
2320
|
.description('Quote the referenced message under the new text, the way an email client does. Without it only the new text is sent')
|
|
2374
2321
|
.label('InlineReply'),
|
|
2375
2322
|
|
|
2376
|
-
forwardAttachments:
|
|
2377
|
-
.truthy('Y', 'true', '1')
|
|
2378
|
-
.falsy('N', 'false', 0)
|
|
2323
|
+
forwardAttachments: apiBoolean()
|
|
2379
2324
|
.default(false)
|
|
2380
2325
|
.description('Carry the attachments of the referenced message over to the forwarded copy. Only valid when action is "forward"')
|
|
2381
2326
|
.when('action', {
|
|
2382
2327
|
is: 'forward',
|
|
2383
2328
|
then: Joi.optional(),
|
|
2384
|
-
|
|
2329
|
+
// a client sending every field with its default passes false on a reply as well
|
|
2330
|
+
otherwise: Joi.valid(false).messages({ 'any.only': '"forwardAttachments" can only be enabled when action is "forward"' })
|
|
2385
2331
|
})
|
|
2386
2332
|
.label('ForwardAttachments'),
|
|
2387
2333
|
|
|
2388
|
-
ignoreMissing:
|
|
2389
|
-
.truthy('Y', 'true', '1')
|
|
2390
|
-
.falsy('N', 'false', 0)
|
|
2391
|
-
.default(false)
|
|
2392
|
-
.description('Continue sending even if the referenced message cannot be found')
|
|
2393
|
-
.label('IgnoreMissing'),
|
|
2334
|
+
ignoreMissing: apiBoolean().default(false).description('Continue sending even if the referenced message cannot be found').label('IgnoreMissing'),
|
|
2394
2335
|
|
|
2395
2336
|
messageId: Joi.string()
|
|
2396
2337
|
.max(996)
|
|
@@ -2399,7 +2340,7 @@ const messageReferenceSchema = Joi.object({
|
|
|
2399
2340
|
|
|
2400
2341
|
threadId: threadIdSchema.description('Gmail thread ID to attach the outgoing message to').meta({ usage: FIELD_USAGE.referenceThreadId }),
|
|
2401
2342
|
|
|
2402
|
-
documentStore: documentStoreSchema
|
|
2343
|
+
documentStore: documentStoreSchema
|
|
2403
2344
|
})
|
|
2404
2345
|
.or('message', 'threadId')
|
|
2405
2346
|
.description(
|
|
@@ -2462,11 +2403,7 @@ const exportRequestSchema = Joi.object({
|
|
|
2462
2403
|
.default(5 * 1024 * 1024)
|
|
2463
2404
|
.example(5242880)
|
|
2464
2405
|
.description('Maximum bytes for text content (0 = unlimited)'),
|
|
2465
|
-
includeAttachments:
|
|
2466
|
-
.truthy('Y', 'true', '1')
|
|
2467
|
-
.falsy('N', 'false', 0)
|
|
2468
|
-
.default(false)
|
|
2469
|
-
.description('Include attachment content as base64 blob in attachments array')
|
|
2406
|
+
includeAttachments: apiBoolean().default(false).description('Include attachment content as base64 blob in attachments array')
|
|
2470
2407
|
})
|
|
2471
2408
|
.custom((value, helpers) => {
|
|
2472
2409
|
if (value.startDate && value.endDate && value.startDate >= value.endDate) {
|
|
@@ -2702,6 +2639,9 @@ function apiResponses(description, ...statusCodes) {
|
|
|
2702
2639
|
}
|
|
2703
2640
|
|
|
2704
2641
|
module.exports = {
|
|
2642
|
+
apiBoolean,
|
|
2643
|
+
formBoolean,
|
|
2644
|
+
MAX_MESSAGE_ATTACHMENTS,
|
|
2705
2645
|
ADDRESS_STRATEGIES,
|
|
2706
2646
|
ACCOUNT_DISPLAY_STATES,
|
|
2707
2647
|
|
|
@@ -2709,6 +2649,7 @@ module.exports = {
|
|
|
2709
2649
|
accountSchemas,
|
|
2710
2650
|
addressSchema,
|
|
2711
2651
|
settingsQuerySchema,
|
|
2652
|
+
isHiddenSetting,
|
|
2712
2653
|
imapSchema,
|
|
2713
2654
|
smtpSchema,
|
|
2714
2655
|
oauth2Schema,
|
|
@@ -2719,7 +2660,6 @@ module.exports = {
|
|
|
2719
2660
|
messageEntrySchema,
|
|
2720
2661
|
messageDetailsSchema,
|
|
2721
2662
|
messageListSchema,
|
|
2722
|
-
documentStoreQuerySchema,
|
|
2723
2663
|
mailboxesSchema,
|
|
2724
2664
|
shortMailboxesSchema,
|
|
2725
2665
|
licenseSchema,
|
|
@@ -2767,16 +2707,3 @@ module.exports = {
|
|
|
2767
2707
|
apiResponses,
|
|
2768
2708
|
ENUM_DESCRIPTIONS
|
|
2769
2709
|
};
|
|
2770
|
-
|
|
2771
|
-
/*
|
|
2772
|
-
let schema = Joi.object(imapSchema);
|
|
2773
|
-
let res = schema.validate({
|
|
2774
|
-
host: false,
|
|
2775
|
-
port: 124,
|
|
2776
|
-
auth: { user: 'tere', pass: 'kere', accessToken: false },
|
|
2777
|
-
useAuthServer: false,
|
|
2778
|
-
disabled: false
|
|
2779
|
-
});
|
|
2780
|
-
console.log(res);
|
|
2781
|
-
process.exit();
|
|
2782
|
-
*/
|