@remit/imap-worker 0.0.29 → 0.0.31
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/README.md
CHANGED
|
@@ -47,7 +47,8 @@ npm run cli -- -t SYNC_MESSAGE_BODY -a <accountId> -m <mailboxId> --messageIds i
|
|
|
47
47
|
|
|
48
48
|
| Variable | Required | Description |
|
|
49
49
|
| ----------------------------- | -------- | -------------------------------------------------------- |
|
|
50
|
-
| `
|
|
50
|
+
| `DATA_BACKEND` | Yes | Relational backend to run against (`sqlite`) |
|
|
51
|
+
| `SQLITE_DB_PATH` | Yes | Path to the shared SQLite database file |
|
|
51
52
|
| `SQS_QUEUE_URL_MAILBOXES` | Yes | FIFO queue URL for `SYNC_MAILBOXES` events |
|
|
52
53
|
| `SQS_QUEUE_URL_MESSAGES` | Yes | FIFO queue URL for `SYNC_MESSAGES` events |
|
|
53
54
|
| `SQS_QUEUE_URL_BODY` | Yes | FIFO queue URL for `SYNC_MESSAGE_BODY` events |
|
package/package.json
CHANGED
|
@@ -109,8 +109,8 @@ if (cluster.isPrimary) {
|
|
|
109
109
|
const queueName = new URL(queueUrl).pathname.split("/").pop();
|
|
110
110
|
const log = createLogger().child({ queue: queueName });
|
|
111
111
|
|
|
112
|
-
// The search-index queue
|
|
113
|
-
//
|
|
112
|
+
// The search-index queue is owned by the search-index-worker handler; every
|
|
113
|
+
// other queue is an imap operation.
|
|
114
114
|
const activeHandler: SQSHandler =
|
|
115
115
|
queueUrl === searchIndexQueueUrl ? searchIndexHandler : handler;
|
|
116
116
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { afterEach, describe, it, mock } from "node:test";
|
|
3
|
-
import { getClient } from "@remit/backend/client";
|
|
2
|
+
import { afterEach, before, describe, it, mock } from "node:test";
|
|
3
|
+
import { getClient, type RemitClient, setClient } from "@remit/backend/client";
|
|
4
4
|
import type { Logger } from "@remit/logger-lambda";
|
|
5
5
|
import type { FlagPushEvent } from "../events.js";
|
|
6
6
|
import {
|
|
@@ -58,6 +58,21 @@ describe("handleFlagPush — deleted mailbox is terminal (#287/#289)", () => {
|
|
|
58
58
|
flagName,
|
|
59
59
|
} as FlagPushEvent;
|
|
60
60
|
|
|
61
|
+
// The client is supplied by injection (`setClient`), so these tests register
|
|
62
|
+
// the repositories they then mock rather than reaching a composition.
|
|
63
|
+
before(() => {
|
|
64
|
+
setClient({
|
|
65
|
+
account: { get: async () => undefined },
|
|
66
|
+
message: { get: async () => undefined },
|
|
67
|
+
mailbox: { get: async () => undefined },
|
|
68
|
+
flagPush: {
|
|
69
|
+
find: async () => undefined,
|
|
70
|
+
updateState: async () => undefined,
|
|
71
|
+
delete: async () => undefined,
|
|
72
|
+
},
|
|
73
|
+
} as unknown as RemitClient);
|
|
74
|
+
});
|
|
75
|
+
|
|
61
76
|
afterEach(() => mock.restoreAll());
|
|
62
77
|
|
|
63
78
|
it("drops the orphaned marker and acks without pushing when the mailbox is gone", async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import { afterEach, describe, it, mock } from "node:test";
|
|
3
|
-
import { getClient } from "@remit/backend/client";
|
|
2
|
+
import { afterEach, before, describe, it, mock } from "node:test";
|
|
3
|
+
import { getClient, type RemitClient, setClient } from "@remit/backend/client";
|
|
4
4
|
import type { AccountItem, ThreadMessageItem } from "@remit/data-ports";
|
|
5
5
|
import type { Logger } from "@remit/logger-lambda";
|
|
6
6
|
import type { MessageMoveEvent } from "../events.js";
|
|
@@ -219,6 +219,17 @@ describe("handleMessageMove — deleted mailbox is terminal (#287/#289)", () =>
|
|
|
219
219
|
timestamp: 1700000000000,
|
|
220
220
|
} as MessageMoveEvent;
|
|
221
221
|
|
|
222
|
+
// The client is supplied by injection (`setClient`), so these tests register
|
|
223
|
+
// the repositories they then mock rather than reaching a composition.
|
|
224
|
+
before(() => {
|
|
225
|
+
setClient({
|
|
226
|
+
account: { get: async () => undefined },
|
|
227
|
+
mailbox: { get: async () => undefined },
|
|
228
|
+
message: { updateUid: async () => undefined },
|
|
229
|
+
secrets: { decrypt: async () => undefined },
|
|
230
|
+
} as unknown as RemitClient);
|
|
231
|
+
});
|
|
232
|
+
|
|
222
233
|
afterEach(() => mock.restoreAll());
|
|
223
234
|
|
|
224
235
|
it("acks without connecting when the source mailbox was deleted", async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { afterEach, describe, it, mock } from "node:test";
|
|
3
|
-
import { getClient } from "@remit/backend/client";
|
|
2
|
+
import { afterEach, before, describe, it, mock } from "node:test";
|
|
3
|
+
import { getClient, type RemitClient, setClient } from "@remit/backend/client";
|
|
4
4
|
import type { Logger } from "@remit/logger-lambda";
|
|
5
5
|
import type { IImapConnection } from "@remit/mailbox-service";
|
|
6
6
|
import type { PlacementMovePushEvent } from "../events.js";
|
|
@@ -295,6 +295,21 @@ describe("handlePlacementMovePush — deleted mailbox is terminal (#287/#289)",
|
|
|
295
295
|
timestamp: 1700000000000,
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
+
// The client is supplied by injection (`setClient`), so these tests register
|
|
299
|
+
// the repositories they then mock rather than reaching a composition.
|
|
300
|
+
before(() => {
|
|
301
|
+
setClient({
|
|
302
|
+
account: { get: async () => undefined },
|
|
303
|
+
message: { get: async () => undefined },
|
|
304
|
+
mailbox: { get: async () => undefined },
|
|
305
|
+
placementMove: {
|
|
306
|
+
find: async () => undefined,
|
|
307
|
+
updateState: async () => undefined,
|
|
308
|
+
delete: async () => undefined,
|
|
309
|
+
},
|
|
310
|
+
} as unknown as RemitClient);
|
|
311
|
+
});
|
|
312
|
+
|
|
298
313
|
afterEach(() => mock.restoreAll());
|
|
299
314
|
|
|
300
315
|
it("drops the marker and acks without pushing when a mailbox is gone", async () => {
|
|
@@ -221,10 +221,8 @@ describe("syncMessageBody — DLQ propagation (integrated, #1270)", () => {
|
|
|
221
221
|
const cappedMailbox = (): MailboxItem =>
|
|
222
222
|
({ fullPath: "INBOX" }) as unknown as MailboxItem;
|
|
223
223
|
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
// then mock. On the relational path (reader, DATA_BACKEND=postgres) getClient
|
|
227
|
-
// builds its own client and this injection is inert.
|
|
224
|
+
// The client is supplied by injection (`setClient`), so these tests register
|
|
225
|
+
// the repositories they then mock rather than reaching a composition.
|
|
228
226
|
before(() => {
|
|
229
227
|
setClient({
|
|
230
228
|
account: { get: async () => cappedAccount() },
|