emailengine-app 2.78.0 → 2.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ncurc.js +23 -13
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +29 -0
- package/config/e2e.toml +2 -1
- package/config/test.toml +2 -1
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +70 -35
- package/lib/api-reference/format.js +91 -4
- package/lib/api-reference/model.js +144 -19
- package/lib/api-reference/schema-tree.js +282 -28
- package/lib/api-routes/account-routes.js +80 -34
- package/lib/api-routes/blocklist-routes.js +21 -47
- package/lib/api-routes/chat-routes.js +10 -12
- package/lib/api-routes/delivery-test-routes.js +6 -26
- package/lib/api-routes/export-routes.js +2 -0
- package/lib/api-routes/gateway-routes.js +52 -11
- package/lib/api-routes/license-routes.js +2 -0
- package/lib/api-routes/mailbox-routes.js +29 -26
- package/lib/api-routes/message-routes.js +27 -21
- package/lib/api-routes/oauth2-app-routes.js +11 -29
- package/lib/api-routes/operation-impact.js +80 -0
- package/lib/api-routes/outbox-routes.js +15 -5
- package/lib/api-routes/permission-map.js +397 -0
- package/lib/api-routes/route-helpers.js +223 -9
- package/lib/api-routes/route-metadata.js +28 -0
- package/lib/api-routes/settings-routes.js +30 -25
- package/lib/api-routes/stats-routes.js +2 -2
- package/lib/api-routes/submit-routes.js +53 -31
- package/lib/api-routes/template-routes.js +3 -0
- package/lib/api-routes/token-routes.js +319 -33
- package/lib/api-routes/webhook-route-routes.js +14 -4
- package/lib/auth-token.js +80 -8
- package/lib/consts.js +10 -0
- package/lib/db.js +20 -2
- package/lib/delivery-error.js +30 -1
- package/lib/email-client/base-client.js +27 -41
- package/lib/email-client/gmail-client.js +19 -10
- package/lib/email-client/imap/mailbox.js +23 -24
- package/lib/email-client/imap/subconnection.js +10 -7
- package/lib/email-client/imap/sync-operations.js +46 -46
- package/lib/email-client/imap-client.js +36 -26
- package/lib/email-client/message-builder.js +3 -3
- package/lib/email-client/notification-handler.js +1 -1
- package/lib/email-client/outlook/graph-api.js +10 -4
- package/lib/email-client/outlook-client.js +53 -54
- package/lib/email-client/smtp-pool-manager.js +1 -1
- package/lib/enum-descriptions.js +92 -2
- package/lib/export.js +1 -1
- package/lib/field-usage.js +133 -0
- package/lib/gateway.js +1 -1
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
- package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
- package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
- package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
- package/lib/imapproxy/imap-server.js +27 -7
- package/lib/license-beacon.js +4 -9
- package/lib/lists.js +49 -1
- package/lib/llm-pre-process.js +5 -5
- package/lib/logger.js +5 -1
- package/lib/metrics-collector.js +2 -2
- package/lib/oauth/gmail.js +9 -12
- package/lib/oauth/mail-ru.js +5 -7
- package/lib/oauth/outlook.js +9 -9
- package/lib/oauth/pubsub/google.js +25 -10
- package/lib/oauth/scope-checker.js +1 -1
- package/lib/oauth2-apps.js +223 -294
- package/lib/openapi/build-document.js +15 -7
- package/lib/openapi/joi-schema.js +20 -0
- package/lib/outbox.js +85 -17
- package/lib/pre-process.js +8 -8
- package/lib/queue-stats.js +49 -0
- package/lib/read-env-value.js +1 -1
- package/lib/reconnection-manager.js +2 -2
- package/lib/rewrite-text-nodes.js +4 -3
- package/lib/routes-ui.js +4 -0
- package/lib/schemas.js +216 -160
- package/lib/settings.js +84 -5
- package/lib/sub-script.js +2 -1
- package/lib/swagger-options.js +2 -1
- package/lib/templates.js +4 -4
- package/lib/threads.js +2 -2
- package/lib/token-audit-log.js +208 -0
- package/lib/token-permission-view.js +219 -0
- package/lib/token-permissions.js +172 -0
- package/lib/tokens.js +99 -15
- package/lib/tools.js +142 -37
- package/lib/ui-routes/account-routes.js +31 -11
- package/lib/ui-routes/admin-config-routes.js +18 -10
- package/lib/ui-routes/admin-entities-routes.js +66 -22
- package/lib/ui-routes/auth-routes.js +30 -24
- package/lib/ui-routes/export-routes.js +10 -4
- package/lib/ui-routes/oauth-config-routes.js +5 -5
- package/lib/ui-routes/reference-routes.js +3 -3
- package/lib/ui-routes/route-helpers.js +51 -2
- package/lib/ui-routes/settings-page.js +1 -1
- package/lib/ui-routes/smtp-test-routes.js +1 -1
- package/lib/ui-routes/suppression-list-routes.js +294 -0
- package/lib/ui-routes/unsubscribe-routes.js +19 -29
- package/lib/utils/network.js +2 -2
- package/lib/web-safe-html.js +1 -1
- package/lib/webhook-routing.js +80 -0
- package/lib/webhooks.js +20 -14
- package/package.json +11 -10
- package/sbom.json +1 -1
- package/server.js +80 -41
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +136 -9
- package/static/js/reference.js +456 -10
- package/static/js/ui.js +43 -0
- package/static/licenses.html +51 -41
- package/translations/messages.pot +59 -59
- package/views/accounts/account.hbs +69 -7
- package/views/accounts/browse.hbs +18 -35
- package/views/config/logging.hbs +6 -0
- package/views/config/oauth/app.hbs +0 -2
- package/views/config/security.hbs +13 -0
- package/views/partials/oauth_form.hbs +0 -15
- package/views/partials/reference/disclosure.hbs +8 -2
- package/views/partials/reference/operation.hbs +47 -13
- package/views/partials/reference/params.hbs +17 -1
- package/views/partials/reference/schema-node.hbs +110 -52
- package/views/partials/reference/schema-tools.hbs +25 -0
- package/views/partials/reference/try-it.hbs +84 -11
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/ui/checkbox.hbs +2 -2
- package/views/partials/ui/tabs.hbs +7 -1
- package/views/reference/token.hbs +4 -0
- package/views/suppression-lists/index.hbs +85 -0
- package/views/suppression-lists/list.hbs +87 -0
- package/views/templates/index.hbs +8 -2
- package/views/tokens/index.hbs +31 -4
- package/views/tokens/new.hbs +324 -2
- package/workers/api.js +146 -57
- package/workers/documents.js +46 -26
- package/workers/export.js +20 -8
- package/workers/imap-proxy.js +2 -2
- package/workers/imap.js +12 -6
- package/workers/smtp.js +13 -7
- package/workers/submit.js +40 -30
- package/workers/webhooks.js +59 -25
- package/lib/feature-flags.js +0 -48
|
@@ -149,7 +149,7 @@ class NotificationHandler {
|
|
|
149
149
|
const thread = await getThread(client, index, this.account, payload.data, logger);
|
|
150
150
|
if (thread) {
|
|
151
151
|
payload.data.threadId = thread;
|
|
152
|
-
this.logger.
|
|
152
|
+
this.logger.debug({
|
|
153
153
|
msg: 'Provisioned thread ID for a message',
|
|
154
154
|
account: this.account,
|
|
155
155
|
message: payload.data.id,
|
|
@@ -63,7 +63,7 @@ async function request(context, url, method, payload, options = {}) {
|
|
|
63
63
|
try {
|
|
64
64
|
accessToken = await context.getToken();
|
|
65
65
|
} catch (err) {
|
|
66
|
-
context.logger.
|
|
66
|
+
context.logger.warn({ msg: 'Failed to load access token', account: context.account, err });
|
|
67
67
|
throw err;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -111,6 +111,12 @@ async function request(context, url, method, payload, options = {}) {
|
|
|
111
111
|
const graphError = createGraphError(err.oauthRequest?.response?.error, graphErrorCode);
|
|
112
112
|
|
|
113
113
|
if (graphError) {
|
|
114
|
+
// Carry the raw Graph exchange over to the mapped error. Callers in outlook-client.js
|
|
115
|
+
// build their own responses by switching on `err.oauthRequest.response.error.code` and
|
|
116
|
+
// `err.oauthRequest.status`, so dropping it here silently disables every one of those
|
|
117
|
+
// branches and turns a mapped 404 into a generic 400 with an undefined code.
|
|
118
|
+
graphError.oauthRequest = err.oauthRequest;
|
|
119
|
+
|
|
114
120
|
context.logger.debug({
|
|
115
121
|
msg: 'Graph API error mapped to internal code',
|
|
116
122
|
account: context.account,
|
|
@@ -128,12 +134,12 @@ async function request(context, url, method, payload, options = {}) {
|
|
|
128
134
|
case 401:
|
|
129
135
|
// NOTE: never include `accessToken` here - this logger persists to the per-account
|
|
130
136
|
// log store (exposed via the account logs API/UI) and to Sentry (security review M3).
|
|
131
|
-
context.logger.
|
|
137
|
+
context.logger.warn({ msg: 'Failed to authenticate API request', account: context.account, err });
|
|
132
138
|
throw err;
|
|
133
139
|
|
|
134
140
|
case 429:
|
|
135
141
|
// Rate limiting
|
|
136
|
-
context.logger.
|
|
142
|
+
context.logger.warn({ msg: 'API request was throttled', account: context.account, err });
|
|
137
143
|
throw err;
|
|
138
144
|
|
|
139
145
|
default:
|
|
@@ -200,7 +206,7 @@ async function requestWithRetry(context, url, method, payload, options = {}) {
|
|
|
200
206
|
// Use Retry-After header if available, otherwise use exponential backoff
|
|
201
207
|
const retryAfter = err.retryAfter || Math.min(OUTLOOK_RETRY_BASE_DELAY * Math.pow(2, attempt), OUTLOOK_RETRY_MAX_DELAY);
|
|
202
208
|
|
|
203
|
-
context.logger.
|
|
209
|
+
context.logger.debug({
|
|
204
210
|
msg: 'Rate limited, retrying after delay',
|
|
205
211
|
account: context.account,
|
|
206
212
|
attempt: attempt + 1,
|
|
@@ -333,7 +333,7 @@ class OutlookClient extends BaseClient {
|
|
|
333
333
|
let prevConnectedCount = await this.redis.hget(this.getAccountKey(), `state:count:connected`);
|
|
334
334
|
let isFirstSuccessfulConnection = prevConnectedCount === '0'; // string zero means the account has been initialized but not yet connected
|
|
335
335
|
|
|
336
|
-
let
|
|
336
|
+
let isInitial = !!isFirstSuccessfulConnection;
|
|
337
337
|
|
|
338
338
|
if (!isFirstSuccessfulConnection) {
|
|
339
339
|
// check if the connection was previously in an errored state
|
|
@@ -353,12 +353,12 @@ class OutlookClient extends BaseClient {
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
if (isFirstSuccessfulConnection) {
|
|
356
|
-
this.logger.info({ msg: 'Successful login without a previous active session', account: this.account,
|
|
356
|
+
this.logger.info({ msg: 'Successful login without a previous active session', account: this.account, isInitial, prevActive: false });
|
|
357
357
|
await this.notify(false, AUTH_SUCCESS_NOTIFY, {
|
|
358
358
|
user: accountData.oauth2?.auth?.user
|
|
359
359
|
});
|
|
360
360
|
} else {
|
|
361
|
-
this.logger.info({ msg: 'Successful login with a previous active session', account: this.account,
|
|
361
|
+
this.logger.info({ msg: 'Successful login with a previous active session', account: this.account, isInitial, prevActive: true });
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// Clear any previous error states
|
|
@@ -385,7 +385,7 @@ class OutlookClient extends BaseClient {
|
|
|
385
385
|
try {
|
|
386
386
|
await this.listMailboxes();
|
|
387
387
|
} catch (err) {
|
|
388
|
-
this.logger.
|
|
388
|
+
this.logger.warn({ msg: 'Failed to renew mailbox folder cache', err });
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
// Start processing any pending webhook notifications
|
|
@@ -424,7 +424,7 @@ class OutlookClient extends BaseClient {
|
|
|
424
424
|
try {
|
|
425
425
|
await this.renewMailboxFolderCache();
|
|
426
426
|
} catch (err) {
|
|
427
|
-
this.logger.
|
|
427
|
+
this.logger.warn({ msg: 'Failed to refresh folder cache for manual sync', account: this.account, err });
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
await this.syncMissedMessages({ force: true });
|
|
@@ -454,7 +454,7 @@ class OutlookClient extends BaseClient {
|
|
|
454
454
|
await this.request(`/subscriptions/${outlookSubscription.id}`, 'DELETE');
|
|
455
455
|
}
|
|
456
456
|
} catch (err) {
|
|
457
|
-
this.logger.
|
|
457
|
+
this.logger.warn({ msg: 'Failed to delete MS Graph subscription', account: this.account, err });
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
if (['init', 'connecting', 'syncing', 'connected'].includes(this.state)) {
|
|
@@ -862,12 +862,6 @@ class OutlookClient extends BaseClient {
|
|
|
862
862
|
try {
|
|
863
863
|
await this.request(`/${this.oauth2UserPath}/messages/${emailId}`, 'delete', Buffer.alloc(0), { returnText: true });
|
|
864
864
|
} catch (err) {
|
|
865
|
-
this.logger.error({
|
|
866
|
-
msg: 'Failed to delete message',
|
|
867
|
-
emailId,
|
|
868
|
-
err
|
|
869
|
-
});
|
|
870
|
-
|
|
871
865
|
switch (err?.oauthRequest?.response?.error?.code) {
|
|
872
866
|
case 'ErrorCannotDeleteObject':
|
|
873
867
|
// does not exist
|
|
@@ -876,6 +870,11 @@ class OutlookClient extends BaseClient {
|
|
|
876
870
|
};
|
|
877
871
|
|
|
878
872
|
default:
|
|
873
|
+
this.logger.error({
|
|
874
|
+
msg: 'Failed to delete message',
|
|
875
|
+
emailId,
|
|
876
|
+
err
|
|
877
|
+
});
|
|
879
878
|
throw err;
|
|
880
879
|
}
|
|
881
880
|
}
|
|
@@ -908,7 +907,7 @@ class OutlookClient extends BaseClient {
|
|
|
908
907
|
try {
|
|
909
908
|
folder = await this.resolveFolder(messageData.parentFolderId, { byId: true });
|
|
910
909
|
} catch (err) {
|
|
911
|
-
this.logger.
|
|
910
|
+
this.logger.warn({
|
|
912
911
|
msg: 'Failed to resolve folder for message',
|
|
913
912
|
emailId,
|
|
914
913
|
err
|
|
@@ -941,7 +940,7 @@ class OutlookClient extends BaseClient {
|
|
|
941
940
|
try {
|
|
942
941
|
sourceFolder = await this.resolveFolder(path, { mailboxListing });
|
|
943
942
|
} catch (err) {
|
|
944
|
-
this.logger.
|
|
943
|
+
this.logger.warn({
|
|
945
944
|
msg: 'Failed to resolve source folder',
|
|
946
945
|
path,
|
|
947
946
|
err
|
|
@@ -1158,13 +1157,6 @@ class OutlookClient extends BaseClient {
|
|
|
1158
1157
|
try {
|
|
1159
1158
|
modifyResult = await this.request(`/${this.oauth2UserPath}/messages/${emailId}`, 'patch', flagUpdates);
|
|
1160
1159
|
} catch (err) {
|
|
1161
|
-
this.logger.error({
|
|
1162
|
-
msg: 'Failed to update message',
|
|
1163
|
-
emailId,
|
|
1164
|
-
flagUpdates,
|
|
1165
|
-
err
|
|
1166
|
-
});
|
|
1167
|
-
|
|
1168
1160
|
switch (err.oauthRequest?.status) {
|
|
1169
1161
|
case 400: {
|
|
1170
1162
|
let error = new Error('Invalid request');
|
|
@@ -1177,6 +1169,12 @@ class OutlookClient extends BaseClient {
|
|
|
1177
1169
|
}
|
|
1178
1170
|
|
|
1179
1171
|
default:
|
|
1172
|
+
this.logger.error({
|
|
1173
|
+
msg: 'Failed to update message',
|
|
1174
|
+
emailId,
|
|
1175
|
+
flagUpdates,
|
|
1176
|
+
err
|
|
1177
|
+
});
|
|
1180
1178
|
throw err;
|
|
1181
1179
|
}
|
|
1182
1180
|
}
|
|
@@ -1421,13 +1419,6 @@ class OutlookClient extends BaseClient {
|
|
|
1421
1419
|
throw new Error('Failed to move message');
|
|
1422
1420
|
}
|
|
1423
1421
|
} catch (err) {
|
|
1424
|
-
this.logger.error({
|
|
1425
|
-
msg: 'Failed to move message',
|
|
1426
|
-
emailId,
|
|
1427
|
-
target: targetFolder.pathName,
|
|
1428
|
-
err
|
|
1429
|
-
});
|
|
1430
|
-
|
|
1431
1422
|
switch (err?.oauthRequest?.response?.error?.code) {
|
|
1432
1423
|
case 'ErrorItemNotFound': {
|
|
1433
1424
|
let error = new Error('Move failed');
|
|
@@ -1440,11 +1431,17 @@ class OutlookClient extends BaseClient {
|
|
|
1440
1431
|
}
|
|
1441
1432
|
|
|
1442
1433
|
default: {
|
|
1434
|
+
this.logger.error({
|
|
1435
|
+
msg: 'Failed to move message',
|
|
1436
|
+
emailId,
|
|
1437
|
+
target: targetFolder.pathName,
|
|
1438
|
+
err
|
|
1439
|
+
});
|
|
1443
1440
|
let error = new Error('Move failed');
|
|
1444
1441
|
error.info = {
|
|
1445
|
-
response: err?.oauthRequest?.response?.error?.message
|
|
1442
|
+
response: err?.oauthRequest?.response?.error?.message || err?.message
|
|
1446
1443
|
};
|
|
1447
|
-
error.code = err?.oauthRequest?.response?.error?.code;
|
|
1444
|
+
error.code = err?.oauthRequest?.response?.error?.code || err?.code;
|
|
1448
1445
|
error.statusCode = 400;
|
|
1449
1446
|
throw error;
|
|
1450
1447
|
}
|
|
@@ -2450,7 +2447,7 @@ class OutlookClient extends BaseClient {
|
|
|
2450
2447
|
try {
|
|
2451
2448
|
gatewayData = await gatewayObject.loadGatewayData();
|
|
2452
2449
|
} catch (err) {
|
|
2453
|
-
this.logger.
|
|
2450
|
+
this.logger.warn({ msg: 'Failed to load gateway data', messageId: data.messageId, gateway: data.gateway, err });
|
|
2454
2451
|
}
|
|
2455
2452
|
}
|
|
2456
2453
|
|
|
@@ -2690,7 +2687,7 @@ class OutlookClient extends BaseClient {
|
|
|
2690
2687
|
setImmediate(() => {
|
|
2691
2688
|
// refresh mailbox listing cache after changes
|
|
2692
2689
|
this.listMailboxes().catch(err => {
|
|
2693
|
-
this.logger.error({ msg: 'Failed to
|
|
2690
|
+
this.logger.error({ msg: 'Failed to refresh mailbox listing cache', err });
|
|
2694
2691
|
});
|
|
2695
2692
|
});
|
|
2696
2693
|
|
|
@@ -2811,7 +2808,7 @@ class OutlookClient extends BaseClient {
|
|
|
2811
2808
|
setImmediate(() => {
|
|
2812
2809
|
// refresh mailbox listing cache after changes
|
|
2813
2810
|
this.listMailboxes().catch(err => {
|
|
2814
|
-
this.logger.error({ msg: 'Failed to
|
|
2811
|
+
this.logger.error({ msg: 'Failed to refresh mailbox listing cache', err });
|
|
2815
2812
|
});
|
|
2816
2813
|
});
|
|
2817
2814
|
|
|
@@ -2858,7 +2855,7 @@ class OutlookClient extends BaseClient {
|
|
|
2858
2855
|
setImmediate(() => {
|
|
2859
2856
|
// refresh mailbox listing cache after changes
|
|
2860
2857
|
this.listMailboxes().catch(err => {
|
|
2861
|
-
this.logger.error({ msg: 'Failed to
|
|
2858
|
+
this.logger.error({ msg: 'Failed to refresh mailbox listing cache', err });
|
|
2862
2859
|
});
|
|
2863
2860
|
});
|
|
2864
2861
|
|
|
@@ -3091,7 +3088,7 @@ class OutlookClient extends BaseClient {
|
|
|
3091
3088
|
errorCode
|
|
3092
3089
|
});
|
|
3093
3090
|
} else {
|
|
3094
|
-
this.logger.
|
|
3091
|
+
this.logger.warn({
|
|
3095
3092
|
msg: 'Failed to check mailbox folder delta',
|
|
3096
3093
|
account: this.account,
|
|
3097
3094
|
err
|
|
@@ -3133,7 +3130,7 @@ class OutlookClient extends BaseClient {
|
|
|
3133
3130
|
try {
|
|
3134
3131
|
cachedListing = JSON.parse(cachedListingValue);
|
|
3135
3132
|
} catch (err) {
|
|
3136
|
-
this.logger.
|
|
3133
|
+
this.logger.warn({ msg: 'Failed to parse cached mailbox listing', err });
|
|
3137
3134
|
}
|
|
3138
3135
|
}
|
|
3139
3136
|
return cachedListing;
|
|
@@ -3445,7 +3442,7 @@ class OutlookClient extends BaseClient {
|
|
|
3445
3442
|
throw new Error('Empty server response');
|
|
3446
3443
|
}
|
|
3447
3444
|
} catch (err) {
|
|
3448
|
-
this.logger.
|
|
3445
|
+
this.logger.warn({
|
|
3449
3446
|
msg: 'Subscription renewal failed',
|
|
3450
3447
|
subscriptionId: outlookSubscription.id,
|
|
3451
3448
|
account: this.account,
|
|
@@ -3517,7 +3514,7 @@ class OutlookClient extends BaseClient {
|
|
|
3517
3514
|
let notificationBaseUrl = (await settings.get('notificationBaseUrl')) || serviceUrl || '';
|
|
3518
3515
|
|
|
3519
3516
|
if (!serviceUrl) {
|
|
3520
|
-
this.logger.
|
|
3517
|
+
this.logger.error({ msg: 'Cannot create MS Graph subscription, service URL is not set' });
|
|
3521
3518
|
return false;
|
|
3522
3519
|
}
|
|
3523
3520
|
|
|
@@ -3598,7 +3595,7 @@ class OutlookClient extends BaseClient {
|
|
|
3598
3595
|
}
|
|
3599
3596
|
} else {
|
|
3600
3597
|
// Subscription is valid, do nothing
|
|
3601
|
-
this.logger.
|
|
3598
|
+
this.logger.debug({
|
|
3602
3599
|
msg: 'Subscription renewal skipped',
|
|
3603
3600
|
reason: 'valid',
|
|
3604
3601
|
subscriptionId: outlookSubscription?.id,
|
|
@@ -3661,7 +3658,7 @@ class OutlookClient extends BaseClient {
|
|
|
3661
3658
|
}
|
|
3662
3659
|
} catch (err) {
|
|
3663
3660
|
const errorMessage = err.oauthRequest?.response?.error?.message || err.message;
|
|
3664
|
-
this.logger.
|
|
3661
|
+
this.logger.warn({
|
|
3665
3662
|
msg: 'Failed to create MS Graph subscription',
|
|
3666
3663
|
account: this.account,
|
|
3667
3664
|
error: errorMessage,
|
|
@@ -4032,7 +4029,7 @@ class OutlookClient extends BaseClient {
|
|
|
4032
4029
|
}
|
|
4033
4030
|
|
|
4034
4031
|
default:
|
|
4035
|
-
this.logger.debug({ msg: '
|
|
4032
|
+
this.logger.debug({ msg: 'Ignoring unknown history event type', type: 'history-event', event });
|
|
4036
4033
|
break;
|
|
4037
4034
|
}
|
|
4038
4035
|
}
|
|
@@ -4199,6 +4196,16 @@ class OutlookClient extends BaseClient {
|
|
|
4199
4196
|
* Process a deleted message event
|
|
4200
4197
|
* Verifies if actually deleted or just moved
|
|
4201
4198
|
*/
|
|
4199
|
+
// A message gone by the time a change notification is processed is a routine race: for every
|
|
4200
|
+
// genuine deletion the existence probe answers 404. Only unexpected failures deserve error.
|
|
4201
|
+
logMessageFetchFailure(emailId, err) {
|
|
4202
|
+
if (err.code === 'MessageNotFound' || err.statusCode === 404) {
|
|
4203
|
+
this.logger.debug({ msg: 'Failed to fetch message data', emailId, err });
|
|
4204
|
+
} else {
|
|
4205
|
+
this.logger.error({ msg: 'Failed to fetch message data', emailId, err });
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4202
4209
|
async processDeletedMessage(emailId) {
|
|
4203
4210
|
// Verify if the message was actually deleted.
|
|
4204
4211
|
// If the email was moved, we receive both a 'deleted' and a 'created' event with the same ID.
|
|
@@ -4208,11 +4215,7 @@ class OutlookClient extends BaseClient {
|
|
|
4208
4215
|
$select: ['id', 'parentFolderId'].join(',')
|
|
4209
4216
|
});
|
|
4210
4217
|
} catch (err) {
|
|
4211
|
-
this.
|
|
4212
|
-
msg: 'Failed to fetch message data',
|
|
4213
|
-
emailId,
|
|
4214
|
-
err
|
|
4215
|
-
});
|
|
4218
|
+
this.logMessageFetchFailure(emailId, err);
|
|
4216
4219
|
}
|
|
4217
4220
|
if (messageData) {
|
|
4218
4221
|
// The message still exists, so there's no need to notify about the deletion.
|
|
@@ -4241,11 +4244,7 @@ class OutlookClient extends BaseClient {
|
|
|
4241
4244
|
$select: ['id', 'isRead', 'isDraft', 'flag', 'conversationId', 'parentFolderId'].join(',')
|
|
4242
4245
|
});
|
|
4243
4246
|
} catch (err) {
|
|
4244
|
-
this.
|
|
4245
|
-
msg: 'Failed to fetch message data',
|
|
4246
|
-
emailId,
|
|
4247
|
-
err
|
|
4248
|
-
});
|
|
4247
|
+
this.logMessageFetchFailure(emailId, err);
|
|
4249
4248
|
}
|
|
4250
4249
|
if (!messageData) {
|
|
4251
4250
|
// do nothing, message not found
|
|
@@ -4256,7 +4255,7 @@ class OutlookClient extends BaseClient {
|
|
|
4256
4255
|
try {
|
|
4257
4256
|
folder = await this.resolveFolder(messageData.parentFolderId, { byId: true });
|
|
4258
4257
|
} catch (err) {
|
|
4259
|
-
this.logger.
|
|
4258
|
+
this.logger.warn({
|
|
4260
4259
|
msg: 'Failed to resolve folder for message',
|
|
4261
4260
|
emailId,
|
|
4262
4261
|
err
|
|
@@ -4303,7 +4302,7 @@ class OutlookClient extends BaseClient {
|
|
|
4303
4302
|
* Fetches full message details and checks if it's actually new
|
|
4304
4303
|
*/
|
|
4305
4304
|
async prepareNewMessage(emailId, options) {
|
|
4306
|
-
this.logger.debug({ msg: 'New message', id: emailId
|
|
4305
|
+
this.logger.debug({ msg: 'New message', id: emailId });
|
|
4307
4306
|
|
|
4308
4307
|
if (options.fetchHeaders) {
|
|
4309
4308
|
options.headers = options.fetchHeaders;
|
|
@@ -4645,7 +4644,7 @@ class OutlookClient extends BaseClient {
|
|
|
4645
4644
|
return { cursorPage, skipToken };
|
|
4646
4645
|
}
|
|
4647
4646
|
} catch (err) {
|
|
4648
|
-
this.logger.
|
|
4647
|
+
this.logger.warn({ msg: 'Failed to parse paging cursor', cursorStr, err });
|
|
4649
4648
|
|
|
4650
4649
|
let error = new Error('Invalid paging cursor');
|
|
4651
4650
|
error.code = 'InvalidCursorValue';
|
|
@@ -168,7 +168,7 @@ function cleanupIdlePools() {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (idleKeys.length > 0) {
|
|
171
|
-
logger.
|
|
171
|
+
logger.debug({ msg: 'SMTP pool cleanup completed', cleaned: idleKeys.length, remaining: SMTP_POOLS.size });
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
package/lib/enum-descriptions.js
CHANGED
|
@@ -7,8 +7,13 @@ const { ADDRESS_STRATEGIES } = require('./address-strategies');
|
|
|
7
7
|
// as `x-meta.enumDescriptions` alongside the `enum` array - so the meaning of each value
|
|
8
8
|
// reaches /swagger.json and every consumer of it, not just the admin API reference.
|
|
9
9
|
//
|
|
10
|
-
// Only enums whose values carry real semantics are listed.
|
|
11
|
-
//
|
|
10
|
+
// Only enums whose values carry real semantics are listed.
|
|
11
|
+
//
|
|
12
|
+
// That includes the ones that used to spell their values out in their own description
|
|
13
|
+
// instead. Doing it there meant the reference printed the explanation as a paragraph and
|
|
14
|
+
// then repeated every value underneath it as a chip - worst on the account `type` enum,
|
|
15
|
+
// where a three-line sentence was followed by all ten values again. Here the renderer has
|
|
16
|
+
// somewhere to put each value, and the description shrinks to what the field is for.
|
|
12
17
|
const ENUM_DESCRIPTIONS = {
|
|
13
18
|
// derived, so adding a strategy cannot leave the API reference behind
|
|
14
19
|
addressStrategy: Object.fromEntries(ADDRESS_STRATEGIES.map(entry => [entry.key, entry.description])),
|
|
@@ -90,6 +95,35 @@ const ENUM_DESCRIPTIONS = {
|
|
|
90
95
|
'imap-proxy': 'Authenticate against the built-in IMAP proxy'
|
|
91
96
|
},
|
|
92
97
|
|
|
98
|
+
// The verb axis of a narrowed token. Each operation requires exactly one of these, published
|
|
99
|
+
// per operation as `x-ee-action`.
|
|
100
|
+
tokenAction: {
|
|
101
|
+
read: 'Read data without changing anything',
|
|
102
|
+
write: 'Create or modify data',
|
|
103
|
+
send: 'Hand a message to a mail server, so it reaches real recipients',
|
|
104
|
+
destructive:
|
|
105
|
+
'Call the endpoints that remove data. Deleting a message is a move to Trash, which a write grant can perform directly, so withholding this narrows the endpoints rather than the outcome for mail'
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// The resource axis of a narrowed token. Each operation belongs to exactly one group, published
|
|
109
|
+
// per operation as `x-ee-group`. The `admin` group is absent on purpose: it can never be
|
|
110
|
+
// granted, so it is not an option when issuing a token.
|
|
111
|
+
tokenGroup: {
|
|
112
|
+
account: 'Manage email accounts and their connection state',
|
|
113
|
+
mailbox: 'Create, rename, delete and list mailbox folders',
|
|
114
|
+
message: 'Read, modify, move and delete messages, including bulk actions and search',
|
|
115
|
+
submit: 'Send email, including scheduled sends and the delivery test. A send may reference a stored message to forward it, so this also reads the message it names',
|
|
116
|
+
outbox: 'Inspect and cancel queued outbound messages',
|
|
117
|
+
export: 'Bulk export an account. One call archives every folder, so this is separate from message access',
|
|
118
|
+
template: 'Manage stored email templates',
|
|
119
|
+
blocklist: 'Manage suppression lists',
|
|
120
|
+
webhook: 'Read webhook route definitions',
|
|
121
|
+
gateway: 'Manage SMTP gateways, which hold outbound SMTP credentials',
|
|
122
|
+
events: 'Subscribe to the instance-wide change stream, which covers every account',
|
|
123
|
+
diagnostics: 'Read statistics and service status',
|
|
124
|
+
logs: 'Read the per-account connection log. Entries are the raw protocol trace, so they include folder names and message subjects'
|
|
125
|
+
},
|
|
126
|
+
|
|
93
127
|
queueId: {
|
|
94
128
|
notify: 'Webhook delivery queue',
|
|
95
129
|
submit: 'Outbound email delivery queue',
|
|
@@ -124,6 +158,62 @@ const ENUM_DESCRIPTIONS = {
|
|
|
124
158
|
'\\Sent': 'Sent messages',
|
|
125
159
|
'\\Trash': 'Deleted messages awaiting purge',
|
|
126
160
|
'\\Inbox': 'The inbox'
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
accountType: {
|
|
164
|
+
imap: 'Plain IMAP and SMTP, authenticated with a username and password',
|
|
165
|
+
gmail: 'Gmail or Google Workspace, through a user-consented OAuth2 app',
|
|
166
|
+
gmailService: 'Google Workspace through a service account, with no per-user consent screen',
|
|
167
|
+
outlook: 'Outlook or Microsoft 365, through a user-consented OAuth2 app',
|
|
168
|
+
outlookService: 'Microsoft 365 through application permissions, with no per-user consent screen',
|
|
169
|
+
mailRu: 'Mail.ru, through an OAuth2 app',
|
|
170
|
+
oauth2: 'An OAuth2 account whose application is no longer configured in EmailEngine',
|
|
171
|
+
delegated: 'A shared or delegated mailbox accessed through another account credentials',
|
|
172
|
+
sending: 'Send-only. No IMAP access is configured, so nothing is synced',
|
|
173
|
+
invalid: 'Delegation could not be resolved, so the account cannot be used'
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
imapIndexer: {
|
|
177
|
+
full: 'Track every change, including deletions. Slower but complete',
|
|
178
|
+
fast: 'Detect new messages only. Cheaper, but deletions and flag changes are missed'
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
exportTextType: {
|
|
182
|
+
plain: 'Plain text bodies only',
|
|
183
|
+
html: 'HTML bodies only',
|
|
184
|
+
'*': 'Both the plain text and the HTML body'
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
specialUseSource: {
|
|
188
|
+
user: 'Set explicitly through the API',
|
|
189
|
+
extension: 'Reported by the mail server through the SPECIAL-USE extension',
|
|
190
|
+
name: 'Guessed from the folder name'
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
messageAction: {
|
|
194
|
+
reply: 'Reply to the sender',
|
|
195
|
+
'reply-all': 'Reply to the sender and every other recipient',
|
|
196
|
+
forward: 'Forward the message to new recipients'
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
renderFormat: {
|
|
200
|
+
html: 'The template is already HTML',
|
|
201
|
+
markdown: 'The template is Markdown and is converted to HTML'
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
entityState: {
|
|
205
|
+
new: 'The entry did not exist and was created',
|
|
206
|
+
existing: 'The entry already existed and was updated'
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
idempotencyStatus: {
|
|
210
|
+
MISS: 'The request ran now and this is its result',
|
|
211
|
+
HIT: 'An identical request ran earlier and its stored result was replayed'
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
gmailAuthMethod: {
|
|
215
|
+
serviceKey: 'Sign token requests with an uploaded service account key',
|
|
216
|
+
externalAccount: 'Sign token requests through Workload Identity Federation, with no key to store'
|
|
127
217
|
}
|
|
128
218
|
};
|
|
129
219
|
|
package/lib/export.js
CHANGED
|
@@ -579,7 +579,7 @@ class Export {
|
|
|
579
579
|
.srem(ACTIVE_EXPORTS_KEY, buildActiveEntry(account, exportId))
|
|
580
580
|
.exec();
|
|
581
581
|
|
|
582
|
-
logger.
|
|
582
|
+
logger.warn({ msg: 'Export failed', account, exportId, error });
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
static async deleteFully(account, exportId) {
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { COLLAPSE_CLASS } = require('./consts');
|
|
4
|
+
|
|
5
|
+
// Long-form guidance for the fields where knowing what a value IS does not tell you when to
|
|
6
|
+
// send it. Attached to the joi schemas with `.meta({ usage })`, which the OpenAPI generator
|
|
7
|
+
// publishes as `x-meta.usage` - so it reaches /swagger.json and every consumer of it, not
|
|
8
|
+
// only the admin API reference.
|
|
9
|
+
//
|
|
10
|
+
// This is the sibling of lib/enum-descriptions.js and exists for the same reason: prose
|
|
11
|
+
// belongs somewhere it can be read and edited as prose, not smeared across schema
|
|
12
|
+
// definitions a line at a time.
|
|
13
|
+
//
|
|
14
|
+
// A note is for a field whose CHOICE is not obvious, never for one whose meaning is not.
|
|
15
|
+
// `subject` does not get one. Two questions a description cannot answer are what earn a
|
|
16
|
+
// field an entry here:
|
|
17
|
+
//
|
|
18
|
+
// when would I reach for this
|
|
19
|
+
// what does sending it do to the other fields
|
|
20
|
+
//
|
|
21
|
+
// It is also where the long half of an overlong description goes. Seventeen fields used to
|
|
22
|
+
// put three or four lines of caveats inline, on a page where the median description is one
|
|
23
|
+
// short sentence - so the fields with the most to say were the ones that made the page
|
|
24
|
+
// hardest to scan. The description keeps the first sentence, the caveats move here, and the
|
|
25
|
+
// API reference renders them behind a closed "When to use this" disclosure. Net result is
|
|
26
|
+
// fewer lines on screen, not more.
|
|
27
|
+
//
|
|
28
|
+
// Format: plain paragraphs, backtick code spans, absolute links. lib/api-reference/format.js
|
|
29
|
+
// escapes first and only adds back a closed tag set, so a heading or a list renders as
|
|
30
|
+
// literal text - the same constraint the `info.description` in workers/api.js is written
|
|
31
|
+
// under. Blank lines separate paragraphs.
|
|
32
|
+
//
|
|
33
|
+
// Keep them short. Two to four sentences is the target; anything longer belongs in the
|
|
34
|
+
// documentation site with a link from here.
|
|
35
|
+
|
|
36
|
+
const AUTH_USAGE =
|
|
37
|
+
'Send this for ordinary password authentication. Omit it when `useAuthServer` is on, because EmailEngine then fetches credentials from your authentication server for every connection and a stored password would be dead configuration.\n\n' +
|
|
38
|
+
'On an update this replaces the whole credentials object unless `partial` is also set.';
|
|
39
|
+
|
|
40
|
+
const FIELD_USAGE = {
|
|
41
|
+
accountId:
|
|
42
|
+
'Set this when your own system already has an identifier for the mailbox, for example a user id, so you can address the account later without storing a second id. Leave it `null` and EmailEngine generates one, which comes back in the response.\n\n' +
|
|
43
|
+
'Reusing an existing id is an update, not an error: the registration endpoint applies the new settings to that account rather than creating a second one.',
|
|
44
|
+
|
|
45
|
+
expectedEmail:
|
|
46
|
+
'Set this when the account is created through a hosted authentication form and you already know which mailbox the user is supposed to connect, so a user cannot finish the form against a different account than the one you provisioned.\n\n' +
|
|
47
|
+
'For OAuth2 the address is compared against what the provider reports, never against anything the caller supplied, so for a shared or delegated mailbox this has to be the authenticating principal rather than the mailbox address. For IMAP it is compared against the address typed into the form, which the credentials do not prove ownership of.\n\n' +
|
|
48
|
+
'The constraint stays on the account and is enforced again on every later reauthentication.',
|
|
49
|
+
|
|
50
|
+
imapPath:
|
|
51
|
+
'Leave this at `"*"` unless the account is large and you only care about a few folders. Narrowing it reduces the number of folders EmailEngine keeps open and indexes, which is the main cost of syncing a big mailbox.\n\n' +
|
|
52
|
+
'Unmonitored folders stay fully reachable through the API. What you give up is webhooks: nothing is emitted for changes in a folder that is not on this list.',
|
|
53
|
+
|
|
54
|
+
// Same note either way: nothing in it is protocol specific, and the two keys stay
|
|
55
|
+
// separate so one can diverge later without touching the other's schema.
|
|
56
|
+
imapAuth: AUTH_USAGE,
|
|
57
|
+
smtpAuth: AUTH_USAGE,
|
|
58
|
+
|
|
59
|
+
useAuthServer:
|
|
60
|
+
'Turn this on when passwords must not be stored in EmailEngine, for instance when they are short-lived or held in your own vault. EmailEngine then calls your authentication server for credentials each time it needs to connect, and the `auth` block must be omitted.\n\n' +
|
|
61
|
+
'The authentication server URL itself is an instance-wide setting, not a per-account one.',
|
|
62
|
+
|
|
63
|
+
partialUpdate:
|
|
64
|
+
'Set this when you are changing one setting and do not want to resend the rest. Without it the configuration object you send replaces the stored one wholesale, so any key you leave out is cleared.\n\n' +
|
|
65
|
+
'It applies only to the block it sits in: a partial `imap` update alongside a full `smtp` object updates one and replaces the other.',
|
|
66
|
+
|
|
67
|
+
disableIMAP4rev2:
|
|
68
|
+
'Set this only after a server has actually misbehaved. A handful of IMAP servers advertise IMAP4rev2 support and then answer incorrectly, and this forces EmailEngine back to IMAP4rev1 for that account.\n\n' +
|
|
69
|
+
'It has no effect on accounts that authenticate with OAuth2.',
|
|
70
|
+
|
|
71
|
+
// No description of what `full` and `fast` do: the row lists both values with their own
|
|
72
|
+
// descriptions from lib/enum-descriptions.js a few lines under this note, and saying it
|
|
73
|
+
// twice on one row is what that split exists to avoid.
|
|
74
|
+
imapIndexer:
|
|
75
|
+
'Leave this unset to follow the instance-wide setting, and only override it for accounts whose mailboxes behave differently from the rest of your fleet. A very large mailbox that nothing else writes to is the usual reason.',
|
|
76
|
+
|
|
77
|
+
exportFolders:
|
|
78
|
+
'Name folders when you want a subset, by path or by special-use flag such as `\\Sent`. Leaving it empty is not "nothing", it is a documented default: Gmail and Outlook API accounts export All Mail, and every other account exports every folder except Junk and Trash.',
|
|
79
|
+
|
|
80
|
+
searchEmailIds:
|
|
81
|
+
'Use this when you already know which messages you want, typically from an earlier search or from a webhook. It is not a filter that narrows the other criteria - when it is present every other search field is ignored.',
|
|
82
|
+
|
|
83
|
+
mailboxSubscribed:
|
|
84
|
+
'Only IMAP accounts have a subscription list, so this is ignored for Gmail API and MS Graph accounts. It controls whether a folder shows up in clients that list subscribed folders only; it does not affect whether EmailEngine syncs it, which `path` on the account decides.',
|
|
85
|
+
|
|
86
|
+
messageRaw:
|
|
87
|
+
'Send `raw` when you have already built the MIME message yourself, for example when relaying something you fetched from another system, and it has to go out unchanged.\n\n' +
|
|
88
|
+
'Anything else you send alongside it overrides the matching header inside it, so a `subject` sent with a raw body replaces the subject in the message. If you are composing from parts, use `text` and `html` and let EmailEngine build the MIME structure.',
|
|
89
|
+
|
|
90
|
+
messageEnvelope:
|
|
91
|
+
'Send this only when the SMTP envelope has to differ from the message headers, which in practice means variable envelope return paths, a bounce address that is not the From address, or delivering to an address that does not appear in the headers.\n\n' +
|
|
92
|
+
'Left out, the envelope is derived from the headers, which is what you want for an ordinary message.',
|
|
93
|
+
|
|
94
|
+
mailMerge:
|
|
95
|
+
'Use this to send one personalised message per recipient in a single request, instead of one request each. Each entry gets its own queue id and its own delivery.\n\n' +
|
|
96
|
+
'It takes over addressing and rendering for the whole request: `messageId`, `envelope`, `to`, `cc`, `bcc` and `render` at the message root are rejected, because each entry supplies its own.',
|
|
97
|
+
|
|
98
|
+
messageCopy:
|
|
99
|
+
'Leave this unset to follow the account default. Set it explicitly when one message should be filed differently from the rest, for instance an automated notification you do not want in the user Sent folder.\n\n' +
|
|
100
|
+
'It only affects SMTP deliveries. Gmail and MS Graph file sent messages themselves, so the flag is a no-op there.',
|
|
101
|
+
|
|
102
|
+
attachmentReference:
|
|
103
|
+
'Use this to forward an attachment that is already on another message without downloading and re-uploading it. Take the id from the attachment list of the referenced message.\n\n' +
|
|
104
|
+
'It is exclusive with `content`: send one or the other, never both.',
|
|
105
|
+
|
|
106
|
+
referenceThreadId:
|
|
107
|
+
'Set this when you know the Gmail thread the outgoing message belongs to and do not want EmailEngine to work it out from the referenced message.\n\n' +
|
|
108
|
+
'Gmail API accounts only. IMAP and MS Graph derive threading from the `In-Reply-To` and `References` headers and ignore it. When both `message` and `threadId` are given, this one wins.',
|
|
109
|
+
|
|
110
|
+
openAiAPIUrl:
|
|
111
|
+
'Set this only for an OpenAI-compatible service that is not OpenAI itself, and include whatever path prefix that service mounts its API under. For Azure OpenAI that means `https://<your-resource>.openai.azure.com/openai/v1`, not the bare host.',
|
|
112
|
+
|
|
113
|
+
revokeGrant:
|
|
114
|
+
'Set this when deleting an account should also cut EmailEngine off at the provider, for example because a user asked for their data to be disconnected rather than just removed here.\n\n' +
|
|
115
|
+
'It currently works for individual Gmail OAuth2 grants. Gmail Workspace service-account integrations, Outlook and non-OAuth2 accounts ignore it. A failed revocation is logged and never blocks the deletion.',
|
|
116
|
+
|
|
117
|
+
webSafeHtml:
|
|
118
|
+
'Turn this on when you are rendering the message in your own UI and want EmailEngine to do the sanitising. It is a shorthand that overrides `textType`, `preProcessHtml` and `embedAttachedImages`.\n\n' +
|
|
119
|
+
`Quoted thread history is folded into one collapsed \`<details class="${COLLAPSE_CLASS}">\` element so you can hide it behind a single control. Its \`<summary>\` is deliberately empty, so supply your own label.`,
|
|
120
|
+
|
|
121
|
+
useOutlookSearch:
|
|
122
|
+
'Turn this on for MS Graph accounts when you need to search fields that the default `$filter` mode cannot reach: `to`, `cc`, `bcc`, `larger`, `smaller`, `body`, `before`, `sentBefore`, `since` and `sentSince`.\n\n' +
|
|
123
|
+
'What you give up is worth checking first. `$search` returns at most 1,000 results, reports neither a total nor a page count, and orders by relevance rather than by date. The `labels` filter is unavailable in this mode, so leave it off when you need to filter by category.',
|
|
124
|
+
|
|
125
|
+
useStructuredFormat:
|
|
126
|
+
'Turn this on for MS Graph accounts sending from a shared mailbox, because it is the only mode that respects the `from` address.\n\n' +
|
|
127
|
+
'The cost is fidelity: structured JSON breaks calendar invites and other special MIME types. The default, raw MIME, preserves them but ignores `from`.',
|
|
128
|
+
|
|
129
|
+
messagePage:
|
|
130
|
+
'Prefer the paging cursor. This exists for IMAP accounts and for callers written before cursors, and it is ignored entirely when a cursor is also supplied.'
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
module.exports = { FIELD_USAGE };
|
package/lib/gateway.js
CHANGED
|
@@ -224,7 +224,7 @@ class Gateway {
|
|
|
224
224
|
await this.redis.hincrby(this.getGatewayKey(), 'deliveries', Number(gatewayData.deliveries.inc));
|
|
225
225
|
} catch (err) {
|
|
226
226
|
if (this.logger) {
|
|
227
|
-
this.logger.error({ msg: 'Failed to increment counter', err });
|
|
227
|
+
this.logger.error({ msg: 'Failed to increment gateway delivery counter', gateway: this.gateway, err });
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
delete gatewayData.deliveries;
|