emailengine-app 2.81.1 → 2.82.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 +12 -6
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +52 -0
- package/Dockerfile +4 -2
- package/bin/emailengine.js +28 -18
- 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/bounce-store-sweep.js +63 -0
- package/lib/account/expected-identity.js +1 -1
- package/lib/account-assignment.js +207 -0
- package/lib/account.js +374 -878
- package/lib/api-reference/index.js +2 -3
- package/lib/api-reference/schema-tree.js +53 -3
- package/lib/api-routes/account-routes.js +18 -29
- 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 +5 -14
- 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 +44 -236
- 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 +2 -2
- 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 +19 -19
- 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 +27 -5
- package/lib/api-token-scheme.js +71 -0
- package/lib/arf-detect.js +41 -7
- package/lib/auth-token.js +44 -24
- package/lib/autodetect-imap-settings.js +163 -123
- package/lib/bounce-detect.js +25 -16
- package/lib/calendar-event.js +78 -0
- package/lib/consts.js +51 -5
- package/lib/create-imap-client.js +24 -0
- package/lib/db.js +76 -17
- package/lib/delivery-error.js +2 -1
- 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 +628 -615
- 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 +170 -84
- package/lib/email-client/imap/mailbox.js +244 -535
- 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 +188 -64
- package/lib/email-client/message-builder.js +9 -14
- 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 +519 -617
- package/lib/email-client/smtp-pool-manager.js +3 -2
- package/lib/encrypt.js +184 -19
- package/lib/enum-descriptions.js +1 -2
- package/lib/export.js +144 -41
- package/lib/gateway.js +20 -6
- package/lib/get-raw-email.js +26 -44
- 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 +13 -0
- package/lib/message-port-stream.js +64 -6
- package/lib/msgpack.js +1 -6
- package/lib/oauth/external-account-signer.js +16 -13
- package/lib/oauth/gmail.js +22 -20
- package/lib/oauth/outlook.js +19 -16
- package/lib/oauth/pubsub/google.js +38 -2
- package/lib/oauth/scope-checker.js +4 -7
- package/lib/oauth/verify-app.js +2 -2
- package/lib/oauth2-apps.js +139 -44
- package/lib/openapi/build-document.js +1 -1
- package/lib/openapi/joi-schema.js +78 -9
- 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/rate-limit.js +54 -15
- 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 +129 -262
- 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/tools.js +113 -52
- package/lib/totp.js +16 -1
- package/lib/ui-routes/account-routes.js +27 -63
- 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 +80 -214
- package/lib/ui-routes/route-helpers.js +40 -44
- 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 +2 -0
- 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 +340 -336
- 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 +460 -1861
- package/translations/messages.pot +99 -99
- package/views/accounts/browse.hbs +10 -4
- package/views/config/ai.hbs +49 -41
- package/views/config/oauth/app.hbs +2 -1
- package/views/dashboard.hbs +18 -16
- 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/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 +33 -23
- package/workers/export.js +55 -60
- package/workers/imap.js +134 -47
- package/workers/submit.js +3 -1
- 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/append-list.js +0 -63
- 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/lua/h-push.lua +0 -32
- 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,6 +17,20 @@ 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
35
|
const { getByteSize } = require('./tools');
|
|
22
36
|
const { COLLAPSE_CLASS, MAX_ACCOUNT_ID_LENGTH } = require('./consts');
|
|
@@ -95,6 +109,12 @@ const { ENUM_DESCRIPTIONS } = require('./enum-descriptions');
|
|
|
95
109
|
const { ACTION, GRANTABLE_GROUPS, IMPLICIT_GROUPS } = require('./api-routes/permission-map');
|
|
96
110
|
const { FIELD_USAGE } = require('./field-usage');
|
|
97
111
|
|
|
112
|
+
// Attachments one JSON-built message may carry. Every attachment is a MIME node, and the MIME
|
|
113
|
+
// splitter that later re-reads the built message (Bcc removal at delivery, tracking rewrites)
|
|
114
|
+
// refuses more than 1000 nodes, so a message over that limit could be queued but never sent.
|
|
115
|
+
// Well below the splitter's limit, leaving room for the multipart and text nodes around them.
|
|
116
|
+
const MAX_MESSAGE_ATTACHMENTS = 500;
|
|
117
|
+
|
|
98
118
|
// Account identity as the API describes it. These live here rather than next to the routes that use
|
|
99
119
|
// them because they are derived from the OAuth2 provider list, and a copy in a test fixture would
|
|
100
120
|
// document a different set of providers than the server accepts.
|
|
@@ -117,7 +137,7 @@ const accountTypeSchema = Joi.string()
|
|
|
117
137
|
const settingsSchema = {
|
|
118
138
|
/* ────────────── Webhooks ────────────── */
|
|
119
139
|
|
|
120
|
-
webhooksEnabled:
|
|
140
|
+
webhooksEnabled: apiBoolean().description('Enable or disable webhook delivery for all accounts'),
|
|
121
141
|
|
|
122
142
|
webhooks: Joi.string()
|
|
123
143
|
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
@@ -168,21 +188,13 @@ const settingsSchema = {
|
|
|
168
188
|
|
|
169
189
|
/* ────────────── Tracking ────────────── */
|
|
170
190
|
|
|
171
|
-
trackSentMessages:
|
|
172
|
-
.truthy('Y', 'true', '1', 'on')
|
|
173
|
-
.falsy('N', 'false', 0, '')
|
|
191
|
+
trackSentMessages: formBoolean()
|
|
174
192
|
.description('Enable tracking features for outgoing messages (deprecated - use trackClicks and trackOpens instead)')
|
|
175
193
|
.meta({ swaggerHidden: true }),
|
|
176
194
|
|
|
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'),
|
|
195
|
+
trackClicks: formBoolean().description('Rewrite links in outgoing HTML emails to track click-through rates'),
|
|
181
196
|
|
|
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'),
|
|
197
|
+
trackOpens: formBoolean().description('Insert a tracking pixel in outgoing HTML emails to detect when messages are opened'),
|
|
186
198
|
|
|
187
199
|
/* ────────────── IMAP ────────────── */
|
|
188
200
|
|
|
@@ -195,31 +207,28 @@ const settingsSchema = {
|
|
|
195
207
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.imapIndexer, usage: FIELD_USAGE.imapIndexer })
|
|
196
208
|
.label('ImapIndexer'),
|
|
197
209
|
|
|
198
|
-
resolveGmailCategories:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
.description('Automatically detect and categorize Gmail tabs (Primary, Social, Promotions, etc.) for IMAP connections'),
|
|
210
|
+
resolveGmailCategories: formBoolean().description(
|
|
211
|
+
'Automatically detect and categorize Gmail tabs (Primary, Social, Promotions, etc.) for IMAP connections'
|
|
212
|
+
),
|
|
202
213
|
|
|
203
|
-
ignoreMailCertErrors:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.description('Allow connections to mail servers with self-signed or invalid TLS certificates (not recommended for production)'),
|
|
214
|
+
ignoreMailCertErrors: formBoolean().description(
|
|
215
|
+
'Allow connections to mail servers with self-signed or invalid TLS certificates (not recommended for production)'
|
|
216
|
+
),
|
|
207
217
|
|
|
208
218
|
/* ────────────── OpenAI ────────────── */
|
|
209
219
|
|
|
210
|
-
generateEmailSummary:
|
|
211
|
-
.truthy('Y', 'true', '1', 'on')
|
|
212
|
-
.falsy('N', 'false', 0, '')
|
|
213
|
-
.description('Generate AI-powered summaries for incoming emails using OpenAI'),
|
|
220
|
+
generateEmailSummary: formBoolean().description('Generate AI-powered summaries for incoming emails using OpenAI'),
|
|
214
221
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
.description('Deprecated - This feature has been removed')
|
|
219
|
-
.meta({ swaggerHidden: true }),
|
|
222
|
+
// The separate risk assessment call left in 2023. The key is still accepted and dropped so a
|
|
223
|
+
// client that sends it keeps working
|
|
224
|
+
generateRiskAssessment: Joi.any().strip().description('Deprecated - This feature has been removed').meta({ swaggerHidden: true }),
|
|
220
225
|
|
|
221
226
|
openAiAPIKey: Joi.string().allow('').example('sk-…').description('Your OpenAI API key for AI features').label('OpenAiAPIKey'),
|
|
222
|
-
openAiModel: Joi.string()
|
|
227
|
+
openAiModel: Joi.string()
|
|
228
|
+
.allow('')
|
|
229
|
+
.example(AI_DEFAULT_MODEL)
|
|
230
|
+
.description(`Model name for AI processing. Empty means the built-in default, ${AI_DEFAULT_MODEL}`)
|
|
231
|
+
.label('OpenAiModel'),
|
|
223
232
|
|
|
224
233
|
openAiAPIUrl: Joi.string()
|
|
225
234
|
.uri({ scheme: ['http', 'https'], allowRelative: false })
|
|
@@ -229,19 +238,12 @@ const settingsSchema = {
|
|
|
229
238
|
.meta({ usage: FIELD_USAGE.openAiAPIUrl })
|
|
230
239
|
.label('OpenAiAPIUrl'),
|
|
231
240
|
|
|
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
241
|
openAiTemperature: Joi.number()
|
|
240
242
|
.allow('')
|
|
241
243
|
.min(0)
|
|
242
244
|
.max(2)
|
|
243
245
|
.example(0.8)
|
|
244
|
-
.description('Controls randomness in AI responses (0 = deterministic, 2 = very creative)')
|
|
246
|
+
.description('Controls randomness in AI responses (0 = deterministic, 2 = very creative). Not sent to a reasoning model while it reasons')
|
|
245
247
|
.label('OpenAiTemperature'),
|
|
246
248
|
|
|
247
249
|
openAiTopP: Joi.number()
|
|
@@ -249,34 +251,44 @@ const settingsSchema = {
|
|
|
249
251
|
.min(0)
|
|
250
252
|
.max(1)
|
|
251
253
|
.example(0.1)
|
|
252
|
-
.description('Nucleus sampling parameter for AI text generation (0-1, lower = more focused)')
|
|
254
|
+
.description('Nucleus sampling parameter for AI text generation (0-1, lower = more focused). Not sent to a reasoning model while it reasons')
|
|
253
255
|
.label('OpenAiTopP'),
|
|
254
256
|
|
|
257
|
+
openAiReasoningEffort: Joi.string()
|
|
258
|
+
.valid(...REASONING_EFFORTS)
|
|
259
|
+
.allow('')
|
|
260
|
+
.example('low')
|
|
261
|
+
.description(
|
|
262
|
+
'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'
|
|
263
|
+
)
|
|
264
|
+
.label('OpenAiReasoningEffort'),
|
|
265
|
+
|
|
255
266
|
openAiMaxTokens: Joi.number()
|
|
256
267
|
.allow('')
|
|
257
268
|
.min(0)
|
|
258
|
-
.example(
|
|
259
|
-
.description(
|
|
269
|
+
.example(AI_DEFAULT_MAX_TOKENS)
|
|
270
|
+
.description(
|
|
271
|
+
`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}`
|
|
272
|
+
)
|
|
260
273
|
.label('OpenAiMaxTokens'),
|
|
261
274
|
|
|
262
275
|
openAiPrompt: Joi.string()
|
|
263
276
|
.allow('')
|
|
264
277
|
.max(1024 * 1024)
|
|
265
|
-
.example('
|
|
266
|
-
.description(
|
|
278
|
+
.example('Return a JSON object with the property "language", the ISO 639-1 code of the language the email is written in.')
|
|
279
|
+
.description(
|
|
280
|
+
'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'
|
|
281
|
+
)
|
|
267
282
|
.label('OpenAiPrompt'),
|
|
268
283
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
284
|
+
// Embeddings generation left with the Document Store in 2.82.0. The key is still accepted and
|
|
285
|
+
// dropped so a client that sends it keeps working; storing it would only bump the AI settings
|
|
286
|
+
// version for a value nothing reads
|
|
287
|
+
openAiGenerateEmbeddings: Joi.any().strip().description('Deprecated - embeddings generation has been removed').meta({ swaggerHidden: true }),
|
|
273
288
|
|
|
274
289
|
/* ────────────── Webhook Filters ────────────── */
|
|
275
290
|
|
|
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'),
|
|
291
|
+
inboxNewOnly: formBoolean().description('Trigger "messageNew" webhooks only for messages arriving in the Inbox folder'),
|
|
280
292
|
|
|
281
293
|
/* ────────────── Security ────────────── */
|
|
282
294
|
|
|
@@ -295,9 +307,7 @@ const settingsSchema = {
|
|
|
295
307
|
|
|
296
308
|
// Off by default: it adds a write to the hot path of every authenticated request, and most
|
|
297
309
|
// instances will never read the result
|
|
298
|
-
tokenAuditLog:
|
|
299
|
-
.truthy('Y', 'true', '1', 'on')
|
|
300
|
-
.falsy('N', 'false', 0, '')
|
|
310
|
+
tokenAuditLog: formBoolean()
|
|
301
311
|
.example(false)
|
|
302
312
|
.description(
|
|
303
313
|
'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 +315,9 @@ const settingsSchema = {
|
|
|
305
315
|
|
|
306
316
|
/* ────────────── Proxy ────────────── */
|
|
307
317
|
|
|
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
|
-
),
|
|
318
|
+
proxyEnabled: formBoolean().description(
|
|
319
|
+
'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'
|
|
320
|
+
),
|
|
314
321
|
proxyUrl: Joi.string()
|
|
315
322
|
.uri({ scheme: ['http', 'https', 'socks', 'socks4', 'socks4a', 'socks5'], allowRelative: false })
|
|
316
323
|
.allow('')
|
|
@@ -320,12 +327,9 @@ const settingsSchema = {
|
|
|
320
327
|
|
|
321
328
|
/* ────────────── HTTP Proxy ────────────── */
|
|
322
329
|
|
|
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
|
-
),
|
|
330
|
+
httpProxyEnabled: formBoolean().description(
|
|
331
|
+
'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'
|
|
332
|
+
),
|
|
329
333
|
httpProxyUrl: Joi.string()
|
|
330
334
|
.uri({ scheme: ['http', 'https', 'socks', 'socks4', 'socks4a', 'socks5'], allowRelative: false })
|
|
331
335
|
.allow('')
|
|
@@ -343,95 +347,46 @@ const settingsSchema = {
|
|
|
343
347
|
|
|
344
348
|
/* ────────────── Webhook Payload ────────────── */
|
|
345
349
|
|
|
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
|
-
),
|
|
350
|
+
notifyText: formBoolean().description('Include plain text message content in webhook payloads'),
|
|
351
|
+
notifyWebSafeHtml: formBoolean().description(
|
|
352
|
+
'Sanitize HTML content to remove potentially dangerous elements before including in webhooks, and fold quoted thread history into a collapsed block'
|
|
353
|
+
),
|
|
353
354
|
notifyTextSize: Joi.number().integer().min(0).example(1048576).description('Maximum size (in bytes) of text content to include in webhook payloads'),
|
|
354
|
-
notifyAttachments:
|
|
355
|
+
notifyAttachments: formBoolean().description('Include attachment data in webhook payloads'),
|
|
355
356
|
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'),
|
|
357
|
+
notifyCalendarEvents: formBoolean().description('Include parsed calendar event data in webhook payloads'),
|
|
360
358
|
|
|
361
359
|
/* ────────────── MCP ────────────── */
|
|
362
360
|
|
|
363
|
-
mcpEnabled:
|
|
364
|
-
.truthy('Y', 'true', '1', 'on')
|
|
365
|
-
.falsy('N', 'false', 0, '')
|
|
361
|
+
mcpEnabled: formBoolean()
|
|
366
362
|
.example(false)
|
|
367
363
|
.description(
|
|
368
364
|
'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
365
|
),
|
|
370
366
|
|
|
371
|
-
mcpOAuthEnabled:
|
|
372
|
-
.truthy('Y', 'true', '1', 'on')
|
|
373
|
-
.falsy('N', 'false', 0, '')
|
|
367
|
+
mcpOAuthEnabled: formBoolean()
|
|
374
368
|
.example(false)
|
|
375
369
|
.description(
|
|
376
370
|
'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
371
|
),
|
|
378
372
|
|
|
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 }),
|
|
373
|
+
/* ────────────── Document Store (removed) ────────────── */
|
|
401
374
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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 }),
|
|
411
|
-
|
|
412
|
-
documentStorePreProcessingEnabled: Joi.boolean()
|
|
413
|
-
.truthy('Y', 'true', '1', 'on')
|
|
414
|
-
.falsy('N', 'false', 0, '')
|
|
415
|
-
.description('Deprecated - Document Store feature has been removed')
|
|
416
|
-
.meta({ swaggerHidden: true }),
|
|
375
|
+
// The one Document Store setting still read after the removal: while it is on, the admin UI
|
|
376
|
+
// and the startup log say where the feature went. Kept in the schema so an API-only
|
|
377
|
+
// deployment can switch the notice off through POST /v1/settings
|
|
378
|
+
documentStoreEnabled: formBoolean().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
417
379
|
|
|
418
380
|
/* ────────────── Logging ────────────── */
|
|
419
381
|
|
|
420
382
|
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'),
|
|
383
|
+
all: apiBoolean().default(false).example(false).description('Enable detailed logging for all email accounts'),
|
|
427
384
|
maxLogLines: Joi.number().integer().min(0).max(1000000).default(10000).example(10000).description('Maximum number of log entries to retain per account')
|
|
428
385
|
}).label('LogSettings'),
|
|
429
386
|
|
|
430
387
|
/* ────────────── Error Reporting ────────────── */
|
|
431
388
|
|
|
432
|
-
sentryEnabled:
|
|
433
|
-
.truthy('Y', 'true', '1', 'on')
|
|
434
|
-
.falsy('N', 'false', 0, '')
|
|
389
|
+
sentryEnabled: formBoolean()
|
|
435
390
|
.example(false)
|
|
436
391
|
.description(
|
|
437
392
|
'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 +428,22 @@ const settingsSchema = {
|
|
|
473
428
|
|
|
474
429
|
/* ────────────── Built-in SMTP Server ────────────── */
|
|
475
430
|
|
|
476
|
-
smtpServerEnabled:
|
|
477
|
-
.truthy('Y', 'true', '1', 'on')
|
|
478
|
-
.falsy('N', 'false', 0, '')
|
|
479
|
-
.description('Enable the built-in SMTP server for receiving emails'),
|
|
431
|
+
smtpServerEnabled: formBoolean().description('Enable the built-in SMTP server for receiving emails'),
|
|
480
432
|
smtpServerPort: Joi.number().integer().min(0).max(65535).empty('').example(2525).description('Port number for the built-in SMTP server'),
|
|
481
433
|
smtpServerHost: Joi.string()
|
|
482
434
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
483
435
|
.empty('')
|
|
484
436
|
.example('0.0.0.0')
|
|
485
437
|
.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'),
|
|
438
|
+
smtpServerProxy: formBoolean().description('Enable PROXY protocol support for the SMTP server'),
|
|
439
|
+
smtpServerAuthEnabled: formBoolean().description('Require SMTP authentication for incoming connections'),
|
|
491
440
|
smtpServerPassword: Joi.string()
|
|
492
441
|
.empty('')
|
|
493
442
|
.allow(null)
|
|
494
443
|
.max(1024)
|
|
495
444
|
.example('verysecret')
|
|
496
445
|
.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'),
|
|
446
|
+
smtpServerTLSEnabled: formBoolean().description('Enable TLS/STARTTLS support for the SMTP server'),
|
|
501
447
|
|
|
502
448
|
/* ────────────── TLS Certificates ────────────── */
|
|
503
449
|
|
|
@@ -534,24 +480,21 @@ const settingsSchema = {
|
|
|
534
480
|
|
|
535
481
|
/* ────────────── IMAP Proxy ────────────── */
|
|
536
482
|
|
|
537
|
-
imapProxyServerEnabled:
|
|
483
|
+
imapProxyServerEnabled: formBoolean().description('Enable the IMAP proxy server'),
|
|
538
484
|
imapProxyServerPort: Joi.number().integer().min(0).max(65535).empty('').example(9993).description('Port number for the IMAP proxy server'),
|
|
539
485
|
imapProxyServerHost: Joi.string()
|
|
540
486
|
.ip({ version: ['ipv4', 'ipv6'], cidr: 'forbidden' })
|
|
541
487
|
.empty('')
|
|
542
488
|
.example('0.0.0.0')
|
|
543
489
|
.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'),
|
|
490
|
+
imapProxyServerProxy: formBoolean().description('Enable PROXY protocol support for the IMAP proxy'),
|
|
548
491
|
imapProxyServerPassword: Joi.string()
|
|
549
492
|
.empty('')
|
|
550
493
|
.allow(null)
|
|
551
494
|
.max(1024)
|
|
552
495
|
.example('verysecret')
|
|
553
496
|
.description('Password for IMAP proxy authentication (null = disable authentication)'),
|
|
554
|
-
imapProxyServerTLSEnabled:
|
|
497
|
+
imapProxyServerTLSEnabled: formBoolean().description('Enable TLS support for the IMAP proxy'),
|
|
555
498
|
|
|
556
499
|
/* ────────────── Queue & Delivery ────────────── */
|
|
557
500
|
|
|
@@ -610,10 +553,7 @@ const settingsSchema = {
|
|
|
610
553
|
|
|
611
554
|
/* ────────────── Reverse Proxy ────────────── */
|
|
612
555
|
|
|
613
|
-
enableApiProxy:
|
|
614
|
-
.truthy('Y', 'true', '1', 'on')
|
|
615
|
-
.falsy('N', 'false', 0, '')
|
|
616
|
-
.description('Trust X-Forwarded-* headers when behind a reverse proxy'),
|
|
556
|
+
enableApiProxy: formBoolean().description('Trust X-Forwarded-* headers when behind a reverse proxy'),
|
|
617
557
|
|
|
618
558
|
/* ────────────── Locale & Branding ────────────── */
|
|
619
559
|
|
|
@@ -678,12 +618,7 @@ const addressSchema = Joi.object({
|
|
|
678
618
|
.label('EmailAddress');
|
|
679
619
|
|
|
680
620
|
// generate a list of boolean values
|
|
681
|
-
const settingsQuerySchema = Object.fromEntries(
|
|
682
|
-
Object.keys(Object.assign({ eventTypes: true }, settingsSchema)).map(key => [
|
|
683
|
-
key,
|
|
684
|
-
Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).default(false)
|
|
685
|
-
])
|
|
686
|
-
);
|
|
621
|
+
const settingsQuerySchema = Object.fromEntries(Object.keys(Object.assign({ eventTypes: true }, settingsSchema)).map(key => [key, apiBoolean().default(false)]));
|
|
687
622
|
|
|
688
623
|
const imapSchema = {
|
|
689
624
|
auth: Joi.object({
|
|
@@ -1115,22 +1050,6 @@ const messageCategorySchema = Joi.string()
|
|
|
1115
1050
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.messageCategory })
|
|
1116
1051
|
.label('MessageCategory');
|
|
1117
1052
|
|
|
1118
|
-
const bounceListSchema = Joi.array()
|
|
1119
|
-
.items(
|
|
1120
|
-
Joi.object({
|
|
1121
|
-
message: Joi.string().max(256).required().example('AAAAAQAACnA').description('EmailEngine identifier of the bounce notification'),
|
|
1122
|
-
recipient: Joi.string().email().example('recipient@example.com').description('Email address that bounced'),
|
|
1123
|
-
action: Joi.string().example('failed').description('Bounce action (failed, delayed, etc.)').label('BounceAction'),
|
|
1124
|
-
response: Joi.object({
|
|
1125
|
-
message: Joi.string().example('550 5.1.1 No such user').description('Error message from the receiving server'),
|
|
1126
|
-
status: Joi.string().example('5.1.1').description('SMTP status code')
|
|
1127
|
-
}).label('BounceResponse'),
|
|
1128
|
-
date: Joi.date().iso().example('2021-03-22T13:13:31.000Z').description('When the bounce was detected')
|
|
1129
|
-
}).label('BounceEntry')
|
|
1130
|
-
)
|
|
1131
|
-
.description('Bounce notifications detected for this message (IMAP accounts only)')
|
|
1132
|
-
.label('BounceList');
|
|
1133
|
-
|
|
1134
1053
|
const messageEntrySchema = Joi.object({
|
|
1135
1054
|
id: Joi.string().example('AAAAAgAACrI').description('EmailEngine message identifier').label('MessageEntryId'),
|
|
1136
1055
|
uid: Joi.number().integer().example(12345).description('IMAP UID (unique identifier within the mailbox). IMAP accounts only').label('MessageUid'),
|
|
@@ -1175,8 +1094,7 @@ const messageEntrySchema = Joi.object({
|
|
|
1175
1094
|
|
|
1176
1095
|
category: messageCategorySchema,
|
|
1177
1096
|
messageSpecialUse: messageSpecialUseSchema,
|
|
1178
|
-
isAutoReply: Joi.boolean().example(false).description('Whether this message appears to be an automatic reply (out of office, vacation responder, etc.)')
|
|
1179
|
-
bounces: bounceListSchema
|
|
1097
|
+
isAutoReply: Joi.boolean().example(false).description('Whether this message appears to be an automatic reply (out of office, vacation responder, etc.)')
|
|
1180
1098
|
}).label('MessageListEntry');
|
|
1181
1099
|
|
|
1182
1100
|
const messageDetailsSchema = Joi.object({
|
|
@@ -1239,9 +1157,13 @@ const messageDetailsSchema = Joi.object({
|
|
|
1239
1157
|
)
|
|
1240
1158
|
}).label('TextInfoDetails'),
|
|
1241
1159
|
|
|
1242
|
-
bounces: bounceListSchema,
|
|
1243
|
-
|
|
1244
1160
|
isAutoReply: Joi.boolean().example(false).description('Whether this message appears to be an automatic reply (out of office, vacation responder, etc.)'),
|
|
1161
|
+
isBounce: Joi.boolean()
|
|
1162
|
+
.example(false)
|
|
1163
|
+
.description(
|
|
1164
|
+
'Whether this message is a bounce (a delivery failure report). Checked for messages in the Inbox only; a delivery or delay notification is not one'
|
|
1165
|
+
),
|
|
1166
|
+
relatedMessageId: Joi.string().example('<original@example.com>').description('Message-ID of the message that bounced. Set together with isBounce'),
|
|
1245
1167
|
|
|
1246
1168
|
preview: Joi.string()
|
|
1247
1169
|
.example('Hello, here is the report you asked for')
|
|
@@ -1257,14 +1179,6 @@ const messageDetailsSchema = Joi.object({
|
|
|
1257
1179
|
messageSpecialUse: messageSpecialUseSchema
|
|
1258
1180
|
}).label('MessageDetails');
|
|
1259
1181
|
|
|
1260
|
-
// Combined Document Store query echoed back by search endpoints when the (hidden) exposeQuery
|
|
1261
|
-
// query parameter is enabled. Free-form object, mirrors whatever was sent to the backing index
|
|
1262
|
-
const documentStoreQuerySchema = Joi.object()
|
|
1263
|
-
.unknown()
|
|
1264
|
-
.description('Combined Document Store query. Only present when the exposeQuery query parameter is enabled')
|
|
1265
|
-
.label('ExposedDocumentStoreQuery')
|
|
1266
|
-
.meta({ swaggerHidden: true });
|
|
1267
|
-
|
|
1268
1182
|
const messageListSchema = Joi.object({
|
|
1269
1183
|
total: Joi.number()
|
|
1270
1184
|
.integer()
|
|
@@ -1285,8 +1199,7 @@ const messageListSchema = Joi.object({
|
|
|
1285
1199
|
.description('Cursor for fetching the next page (null when no more pages)')
|
|
1286
1200
|
.label('NextPageCursor'),
|
|
1287
1201
|
prevPageCursor: Joi.string().allow(null).example('imap_kcQIji3UobDDTxc').description('Cursor for fetching the previous page').label('PrevPageCursor'),
|
|
1288
|
-
messages: Joi.array().items(messageEntrySchema).label('PageMessages')
|
|
1289
|
-
documentStoreQuery: documentStoreQuerySchema
|
|
1202
|
+
messages: Joi.array().items(messageEntrySchema).label('PageMessages')
|
|
1290
1203
|
}).label('MessageList');
|
|
1291
1204
|
|
|
1292
1205
|
// Fields shared by both mailbox listing item shapes (the full listing and the short listing in
|
|
@@ -1484,14 +1397,6 @@ const templateSchemas = {
|
|
|
1484
1397
|
.description('Preview text shown in email clients after the subject line')
|
|
1485
1398
|
};
|
|
1486
1399
|
|
|
1487
|
-
const documentStoreSchema = Joi.boolean()
|
|
1488
|
-
.empty('')
|
|
1489
|
-
.truthy('Y', 'true', '1')
|
|
1490
|
-
.falsy('N', 'false', 0)
|
|
1491
|
-
.description('Deprecated feature - Document Store has been removed')
|
|
1492
|
-
.label('UseDocumentStore')
|
|
1493
|
-
.meta({ swaggerHidden: true });
|
|
1494
|
-
|
|
1495
1400
|
// Every field carries its own `.example()`. The search object is embedded by five
|
|
1496
1401
|
// operations and only one of them - POST /v1/account/{account}/search - wraps it in a
|
|
1497
1402
|
// curated payload, so on the other four the API reference had nothing to show for any of
|
|
@@ -1503,20 +1408,12 @@ const searchSchema = Joi.object({
|
|
|
1503
1408
|
.example('1:10')
|
|
1504
1409
|
.description('Sequence number range (e.g., "1:10" or "1,3,5"). Only supported for IMAP.'),
|
|
1505
1410
|
|
|
1506
|
-
answered:
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
.truthy('Y', 'true', '1')
|
|
1513
|
-
.falsy('N', 'false', 0)
|
|
1514
|
-
.description('Filter for messages marked for deletion. Only supported for IMAP.')
|
|
1515
|
-
.label('DeletedFlag'),
|
|
1516
|
-
draft: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for draft messages').label('DraftFlag'),
|
|
1517
|
-
unseen: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for unread messages').label('UnseenFlag'),
|
|
1518
|
-
flagged: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for flagged/starred messages').label('Flagged'),
|
|
1519
|
-
seen: Joi.boolean().truthy('Y', 'true', '1').falsy('N', 'false', 0).description('Filter for read messages').label('SeenFlag'),
|
|
1411
|
+
answered: apiBoolean().description('Filter for messages that have been replied to. Only supported for IMAP.').label('AnsweredFlag'),
|
|
1412
|
+
deleted: apiBoolean().description('Filter for messages marked for deletion. Only supported for IMAP.').label('DeletedFlag'),
|
|
1413
|
+
draft: apiBoolean().description('Filter for draft messages').label('DraftFlag'),
|
|
1414
|
+
unseen: apiBoolean().description('Filter for unread messages').label('UnseenFlag'),
|
|
1415
|
+
flagged: apiBoolean().description('Filter for flagged/starred messages').label('Flagged'),
|
|
1416
|
+
seen: apiBoolean().description('Filter for read messages').label('SeenFlag'),
|
|
1520
1417
|
|
|
1521
1418
|
from: Joi.string().max(256).example('nyan.cat@example.com').description('Search in From addresses').label('From'),
|
|
1522
1419
|
to: Joi.string().max(256).example('support@example.com').description('Search in To addresses. Not supported for MS Graph API.').label('To'),
|
|
@@ -1661,12 +1558,9 @@ const expectedEmailSchema = Joi.string()
|
|
|
1661
1558
|
.meta({ usage: FIELD_USAGE.expectedEmail });
|
|
1662
1559
|
|
|
1663
1560
|
const accountSchemas = {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
.example('2021-07-08T07:06:34.336Z')
|
|
1668
|
-
.description('Deprecated - Document Store sync start date')
|
|
1669
|
-
.meta({ swaggerHidden: true }),
|
|
1561
|
+
// The Document Store sync start date. Accepted and dropped since the feature's removal, so an
|
|
1562
|
+
// integration written against an older release keeps working
|
|
1563
|
+
syncFrom: Joi.any().strip().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true }),
|
|
1670
1564
|
|
|
1671
1565
|
notifyFrom: Joi.date()
|
|
1672
1566
|
.iso()
|
|
@@ -1735,11 +1629,7 @@ const googleSubscriptionNameSchema = Joi.string()
|
|
|
1735
1629
|
.description('Google Pub/Sub subscription name')
|
|
1736
1630
|
.label('GoogleSubscriptionName');
|
|
1737
1631
|
|
|
1738
|
-
const googleWorkspaceAccountsSchema =
|
|
1739
|
-
.truthy('Y', 'true', '1', 'on')
|
|
1740
|
-
.falsy('N', 'false', 0, '')
|
|
1741
|
-
.example(false)
|
|
1742
|
-
.description('Restrict OAuth2 login to Google Workspace accounts only');
|
|
1632
|
+
const googleWorkspaceAccountsSchema = formBoolean().example(false).description('Restrict OAuth2 login to Google Workspace accounts only');
|
|
1743
1633
|
|
|
1744
1634
|
const oauthCreateSchema = {
|
|
1745
1635
|
name: Joi.string().trim().empty('').max(256).example('My Gmail App').required().description('Display name for the OAuth2 application'),
|
|
@@ -1757,12 +1647,7 @@ const oauthCreateSchema = {
|
|
|
1757
1647
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.oauth2Provider })
|
|
1758
1648
|
.label('CreateOAuth2Provider'),
|
|
1759
1649
|
|
|
1760
|
-
enabled:
|
|
1761
|
-
.truthy('Y', 'true', '1', 'on')
|
|
1762
|
-
.falsy('N', 'false', 0, '')
|
|
1763
|
-
.default(false)
|
|
1764
|
-
.example(true)
|
|
1765
|
-
.description('Whether this OAuth2 app is active'),
|
|
1650
|
+
enabled: formBoolean().default(false).example(true).description('Whether this OAuth2 app is active'),
|
|
1766
1651
|
|
|
1767
1652
|
clientId: Joi.string()
|
|
1768
1653
|
.trim()
|
|
@@ -1983,7 +1868,7 @@ const oauthUpdateSchema = {
|
|
|
1983
1868
|
|
|
1984
1869
|
title: Joi.string().allow('').trim().max(256).example('App title').description('Title for the application button'),
|
|
1985
1870
|
|
|
1986
|
-
enabled:
|
|
1871
|
+
enabled: formBoolean().default(false).description('Enable this app'),
|
|
1987
1872
|
|
|
1988
1873
|
clientId: Joi.string()
|
|
1989
1874
|
.trim()
|
|
@@ -2363,6 +2248,11 @@ const outboxEntrySchema = Joi.object({
|
|
|
2363
2248
|
}).label('OutboxEntryProgress')
|
|
2364
2249
|
}).label('OutboxEntry');
|
|
2365
2250
|
|
|
2251
|
+
// The Document Store was removed in 2.82.0. The request fields that selected it are still
|
|
2252
|
+
// accepted and dropped, so an integration written against an older release keeps working and a
|
|
2253
|
+
// request that names them is answered from the live mailbox, as it already was with the feature off
|
|
2254
|
+
const documentStoreSchema = Joi.any().strip().description('Deprecated - Document Store feature has been removed').meta({ swaggerHidden: true });
|
|
2255
|
+
|
|
2366
2256
|
const messageReferenceSchema = Joi.object({
|
|
2367
2257
|
message: Joi.string()
|
|
2368
2258
|
.base64({ paddingRequired: false, urlSafe: true })
|
|
@@ -2379,31 +2269,23 @@ const messageReferenceSchema = Joi.object({
|
|
|
2379
2269
|
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.messageAction })
|
|
2380
2270
|
.label('MessageAction'),
|
|
2381
2271
|
|
|
2382
|
-
inline:
|
|
2383
|
-
.truthy('Y', 'true', '1')
|
|
2384
|
-
.falsy('N', 'false', 0)
|
|
2272
|
+
inline: apiBoolean()
|
|
2385
2273
|
.default(false)
|
|
2386
2274
|
.description('Quote the referenced message under the new text, the way an email client does. Without it only the new text is sent')
|
|
2387
2275
|
.label('InlineReply'),
|
|
2388
2276
|
|
|
2389
|
-
forwardAttachments:
|
|
2390
|
-
.truthy('Y', 'true', '1')
|
|
2391
|
-
.falsy('N', 'false', 0)
|
|
2277
|
+
forwardAttachments: apiBoolean()
|
|
2392
2278
|
.default(false)
|
|
2393
2279
|
.description('Carry the attachments of the referenced message over to the forwarded copy. Only valid when action is "forward"')
|
|
2394
2280
|
.when('action', {
|
|
2395
2281
|
is: 'forward',
|
|
2396
2282
|
then: Joi.optional(),
|
|
2397
|
-
|
|
2283
|
+
// a client sending every field with its default passes false on a reply as well
|
|
2284
|
+
otherwise: Joi.valid(false).messages({ 'any.only': '"forwardAttachments" can only be enabled when action is "forward"' })
|
|
2398
2285
|
})
|
|
2399
2286
|
.label('ForwardAttachments'),
|
|
2400
2287
|
|
|
2401
|
-
ignoreMissing:
|
|
2402
|
-
.truthy('Y', 'true', '1')
|
|
2403
|
-
.falsy('N', 'false', 0)
|
|
2404
|
-
.default(false)
|
|
2405
|
-
.description('Continue sending even if the referenced message cannot be found')
|
|
2406
|
-
.label('IgnoreMissing'),
|
|
2288
|
+
ignoreMissing: apiBoolean().default(false).description('Continue sending even if the referenced message cannot be found').label('IgnoreMissing'),
|
|
2407
2289
|
|
|
2408
2290
|
messageId: Joi.string()
|
|
2409
2291
|
.max(996)
|
|
@@ -2412,7 +2294,7 @@ const messageReferenceSchema = Joi.object({
|
|
|
2412
2294
|
|
|
2413
2295
|
threadId: threadIdSchema.description('Gmail thread ID to attach the outgoing message to').meta({ usage: FIELD_USAGE.referenceThreadId }),
|
|
2414
2296
|
|
|
2415
|
-
documentStore: documentStoreSchema
|
|
2297
|
+
documentStore: documentStoreSchema
|
|
2416
2298
|
})
|
|
2417
2299
|
.or('message', 'threadId')
|
|
2418
2300
|
.description(
|
|
@@ -2475,11 +2357,7 @@ const exportRequestSchema = Joi.object({
|
|
|
2475
2357
|
.default(5 * 1024 * 1024)
|
|
2476
2358
|
.example(5242880)
|
|
2477
2359
|
.description('Maximum bytes for text content (0 = unlimited)'),
|
|
2478
|
-
includeAttachments:
|
|
2479
|
-
.truthy('Y', 'true', '1')
|
|
2480
|
-
.falsy('N', 'false', 0)
|
|
2481
|
-
.default(false)
|
|
2482
|
-
.description('Include attachment content as base64 blob in attachments array')
|
|
2360
|
+
includeAttachments: apiBoolean().default(false).description('Include attachment content as base64 blob in attachments array')
|
|
2483
2361
|
})
|
|
2484
2362
|
.custom((value, helpers) => {
|
|
2485
2363
|
if (value.startDate && value.endDate && value.startDate >= value.endDate) {
|
|
@@ -2715,6 +2593,9 @@ function apiResponses(description, ...statusCodes) {
|
|
|
2715
2593
|
}
|
|
2716
2594
|
|
|
2717
2595
|
module.exports = {
|
|
2596
|
+
apiBoolean,
|
|
2597
|
+
formBoolean,
|
|
2598
|
+
MAX_MESSAGE_ATTACHMENTS,
|
|
2718
2599
|
ADDRESS_STRATEGIES,
|
|
2719
2600
|
ACCOUNT_DISPLAY_STATES,
|
|
2720
2601
|
|
|
@@ -2732,7 +2613,6 @@ module.exports = {
|
|
|
2732
2613
|
messageEntrySchema,
|
|
2733
2614
|
messageDetailsSchema,
|
|
2734
2615
|
messageListSchema,
|
|
2735
|
-
documentStoreQuerySchema,
|
|
2736
2616
|
mailboxesSchema,
|
|
2737
2617
|
shortMailboxesSchema,
|
|
2738
2618
|
licenseSchema,
|
|
@@ -2780,16 +2660,3 @@ module.exports = {
|
|
|
2780
2660
|
apiResponses,
|
|
2781
2661
|
ENUM_DESCRIPTIONS
|
|
2782
2662
|
};
|
|
2783
|
-
|
|
2784
|
-
/*
|
|
2785
|
-
let schema = Joi.object(imapSchema);
|
|
2786
|
-
let res = schema.validate({
|
|
2787
|
-
host: false,
|
|
2788
|
-
port: 124,
|
|
2789
|
-
auth: { user: 'tere', pass: 'kere', accessToken: false },
|
|
2790
|
-
useAuthServer: false,
|
|
2791
|
-
disabled: false
|
|
2792
|
-
});
|
|
2793
|
-
console.log(res);
|
|
2794
|
-
process.exit();
|
|
2795
|
-
*/
|