emailengine-app 2.68.1 → 2.69.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/.github/workflows/deploy.yml +2 -0
- package/.github/workflows/release.yaml +4 -0
- package/CHANGELOG.md +40 -0
- package/config/default.toml +2 -0
- package/data/google-crawlers.json +7 -1
- package/lib/account.js +62 -25
- package/lib/api-routes/account-routes.js +493 -75
- package/lib/api-routes/blocklist-routes.js +337 -0
- package/lib/api-routes/delivery-test-routes.js +321 -0
- package/lib/api-routes/export-routes.js +1 -12
- package/lib/api-routes/gateway-routes.js +376 -0
- package/lib/api-routes/license-routes.js +142 -0
- package/lib/api-routes/mailbox-routes.js +318 -0
- package/lib/api-routes/message-routes.js +21 -129
- package/lib/api-routes/oauth2-app-routes.js +631 -0
- package/lib/api-routes/outbox-routes.js +173 -0
- package/lib/api-routes/pubsub-routes.js +98 -0
- package/lib/api-routes/route-helpers.js +45 -0
- package/lib/api-routes/settings-routes.js +331 -0
- package/lib/api-routes/stats-routes.js +77 -0
- package/lib/api-routes/submit-routes.js +472 -0
- package/lib/api-routes/template-routes.js +7 -55
- package/lib/api-routes/token-routes.js +297 -0
- package/lib/api-routes/webhook-route-routes.js +152 -0
- package/lib/email-client/gmail-client.js +14 -0
- package/lib/email-client/imap/mailbox.js +34 -11
- package/lib/email-client/imap/subconnection.js +20 -12
- package/lib/email-client/imap/sync-operations.js +130 -2
- package/lib/email-client/imap-client.js +116 -58
- package/lib/email-client/outlook-client.js +85 -13
- package/lib/export.js +60 -19
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +18 -0
- package/lib/imapproxy/imap-core/lib/imap-command.js +6 -1
- package/lib/imapproxy/imap-core/lib/imap-connection.js +106 -23
- package/lib/imapproxy/imap-core/lib/imap-server.js +24 -0
- package/lib/imapproxy/imap-core/lib/imap-stream.js +26 -0
- package/lib/message-port-stream.js +113 -16
- package/lib/reject-worker-calls.js +42 -0
- package/lib/routes-ui.js +37 -8778
- package/lib/schemas.js +26 -1
- package/lib/tools.js +68 -0
- package/lib/ui-routes/account-routes.js +40 -210
- package/lib/ui-routes/admin-config-routes.js +913 -487
- package/lib/ui-routes/admin-entities-routes.js +1 -0
- package/lib/ui-routes/auth-routes.js +1339 -0
- package/lib/ui-routes/dashboard-routes.js +188 -0
- package/lib/ui-routes/document-store-routes.js +800 -0
- package/lib/ui-routes/export-routes.js +217 -0
- package/lib/ui-routes/internals-routes.js +354 -0
- package/lib/ui-routes/network-config-routes.js +759 -0
- package/lib/ui-routes/{oauth-routes.js → oauth-config-routes.js} +371 -91
- package/lib/ui-routes/route-helpers.js +316 -0
- package/lib/ui-routes/smtp-test-routes.js +236 -0
- package/lib/ui-routes/unsubscribe-routes.js +234 -0
- package/lib/webhook-request.js +36 -0
- package/package.json +8 -8
- package/sbom.json +1 -1
- package/server.js +214 -16
- package/static/licenses.html +12 -12
- package/translations/messages.pot +129 -149
- package/views/dashboard.hbs +7 -26
- package/views/internals/index.hbs +15 -0
- package/views/tokens/index.hbs +9 -0
- package/workers/api.js +198 -4401
- package/workers/export.js +87 -54
- package/workers/imap.js +29 -13
- package/workers/submit.js +20 -11
- package/workers/webhooks.js +6 -20
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reject every pending cross-thread call routed to a worker thread that has
|
|
5
|
+
* terminated. Without this, a call placed against a worker that then crashes or
|
|
6
|
+
* is force-restarted keeps waiting until its own timeout fires - which can be
|
|
7
|
+
* minutes (the submitMessage floor) or hours (a large X-EE-Timeout). Rejecting
|
|
8
|
+
* here lets the caller fail fast with a retryable error the instant the worker
|
|
9
|
+
* is known to be gone.
|
|
10
|
+
*
|
|
11
|
+
* The stored `reject` wrapper clears the entry's timeout, so we only need to
|
|
12
|
+
* drop the entry from the queue and invoke it.
|
|
13
|
+
*
|
|
14
|
+
* @param {Map} callQueue - mid -> { resolve, reject, timer, worker }
|
|
15
|
+
* @param {Worker} worker - The terminated worker thread
|
|
16
|
+
* @param {Error} err - Rejection reason. May be a shared instance reused across
|
|
17
|
+
* concurrent rejections, so callers must not attach per-call fields to it.
|
|
18
|
+
* @returns {number} Number of pending calls that were rejected
|
|
19
|
+
*/
|
|
20
|
+
function rejectWorkerCalls(callQueue, worker, err) {
|
|
21
|
+
let rejected = 0;
|
|
22
|
+
|
|
23
|
+
// Deleting the current entry while iterating a Map is safe in JS.
|
|
24
|
+
for (let [mid, entry] of callQueue) {
|
|
25
|
+
if (entry.worker !== worker) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
callQueue.delete(mid);
|
|
30
|
+
try {
|
|
31
|
+
entry.reject(err);
|
|
32
|
+
} catch (rejectErr) {
|
|
33
|
+
// A consumer that throws synchronously from its rejection path must
|
|
34
|
+
// not stop us from cleaning up the remaining pending calls.
|
|
35
|
+
}
|
|
36
|
+
rejected++;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return rejected;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { rejectWorkerCalls };
|