@remit/backend 0.0.4 → 0.0.5
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/package.json +1 -1
- package/src/derive/autoMoved.ts +1 -1
- package/src/derive/enrichThreadRows.ts +1 -1
- package/src/derive/filterThreadCriteria.test.ts +1 -1
- package/src/derive/senderTrust.ts +1 -1
- package/src/handlers/account-guards.ts +3 -3
- package/src/handlers/account-overrides.ts +1 -1
- package/src/handlers/account.ts +8 -8
- package/src/handlers/address.ts +2 -2
- package/src/handlers/config.ts +3 -3
- package/src/handlers/filter.ts +3 -3
- package/src/handlers/folder-role-appointments.ts +4 -4
- package/src/handlers/mailbox.ts +3 -6
- package/src/handlers/me.ts +2 -2
- package/src/handlers/message.ts +6 -6
- package/src/handlers/organize.test.ts +1 -1
- package/src/handlers/organize.ts +2 -2
- package/src/handlers/outbox.ts +2 -2
- package/src/handlers/thread.ts +2 -2
- package/src/handlers/vip-suggestions.ts +1 -1
- package/src/service/create-remit-client.ts +1 -4
- package/src/service/filter.ts +1 -4
- package/src/service/localhost-env-config.test.ts +15 -19
- package/src/service/organize.ts +1 -4
package/package.json
CHANGED
package/src/derive/autoMoved.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { AutoMovedInfo } from "@remit/api-openapi-types";
|
|
1
2
|
import type { MessageItem } from "@remit/data-ports";
|
|
2
3
|
import { PlacementConfidence } from "@remit/domain-enums";
|
|
3
|
-
import type { AutoMovedInfo } from "@remit/api-openapi-types";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Project a Message's internal placement verdict to the public `AutoMovedInfo`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThreadMessageResponse } from "@remit/api-openapi-types";
|
|
1
2
|
import type {
|
|
2
3
|
AddressItem,
|
|
3
4
|
MessageItem,
|
|
@@ -5,7 +6,6 @@ import type {
|
|
|
5
6
|
} from "@remit/data-ports";
|
|
6
7
|
import { deriveAddressId } from "@remit/data-ports/id";
|
|
7
8
|
import { MessageCategory, SenderTrust, StarColor } from "@remit/domain-enums";
|
|
8
|
-
import type { ThreadMessageResponse } from "@remit/api-openapi-types";
|
|
9
9
|
import { deriveAutoMoved } from "./autoMoved.js";
|
|
10
10
|
import { deriveSenderTrust } from "./senderTrust.js";
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
|
-
import { MessageCategory, SenderTrust, StarColor } from "@remit/domain-enums";
|
|
4
3
|
import type { ThreadMessageResponse } from "@remit/api-openapi-types";
|
|
4
|
+
import { MessageCategory, SenderTrust, StarColor } from "@remit/domain-enums";
|
|
5
5
|
import {
|
|
6
6
|
filterByOffRowCriteria,
|
|
7
7
|
hasOffRowCriteria,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AccountItem } from "@remit/data-ports";
|
|
2
|
-
import { ConflictError } from "@remit/data-ports/errors";
|
|
3
|
-
import { AccountAuthType } from "@remit/domain-enums";
|
|
4
1
|
import type {
|
|
5
2
|
AccountResponse,
|
|
6
3
|
FolderAppointment,
|
|
7
4
|
} from "@remit/api-openapi-types";
|
|
5
|
+
import type { AccountItem } from "@remit/data-ports";
|
|
6
|
+
import { ConflictError } from "@remit/data-ports/errors";
|
|
7
|
+
import { AccountAuthType } from "@remit/domain-enums";
|
|
8
8
|
import type { AccountOverrides } from "./account-overrides.js";
|
|
9
9
|
import type { AccountSignature } from "./account-signature.js";
|
|
10
10
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MutedFlag } from "@remit/api-openapi-types";
|
|
1
2
|
import type {
|
|
2
3
|
AccountSettingItem,
|
|
3
4
|
IAccountSettingRepository,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
composeSettingName,
|
|
8
9
|
SETTING_NAME_SEPARATOR,
|
|
9
10
|
} from "@remit/data-ports/account-settings";
|
|
10
|
-
import type { MutedFlag } from "@remit/api-openapi-types";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* RFC 032 Tier 1: the per-account display name and mute flag, and the
|
package/src/handlers/account.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2
|
+
import type {
|
|
3
|
+
AccountResponse,
|
|
4
|
+
CreateAccountInput,
|
|
5
|
+
DeleteAccountResponse,
|
|
6
|
+
TestConnectionInput,
|
|
7
|
+
TestConnectionResponse,
|
|
8
|
+
UpdateAccountInput,
|
|
9
|
+
} from "@remit/api-openapi-types";
|
|
2
10
|
import type { AccountItem, IAccountRepository } from "@remit/data-ports";
|
|
3
11
|
import { AccountAuthType, ConnectionState } from "@remit/domain-enums";
|
|
4
12
|
import { logger } from "@remit/logger-lambda";
|
|
@@ -12,14 +20,6 @@ import {
|
|
|
12
20
|
testImapConnection,
|
|
13
21
|
testSmtpConnection,
|
|
14
22
|
} from "@remit/mailbox-service";
|
|
15
|
-
import type {
|
|
16
|
-
AccountResponse,
|
|
17
|
-
CreateAccountInput,
|
|
18
|
-
DeleteAccountResponse,
|
|
19
|
-
TestConnectionInput,
|
|
20
|
-
TestConnectionResponse,
|
|
21
|
-
UpdateAccountInput,
|
|
22
|
-
} from "@remit/api-openapi-types";
|
|
23
23
|
import {
|
|
24
24
|
deserializeEncryptedPayload,
|
|
25
25
|
type SecretsService,
|
package/src/handlers/address.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AddressItem, FlagsMergePatch } from "@remit/data-ports";
|
|
2
|
-
import { ForbiddenError } from "@remit/data-ports/errors";
|
|
3
1
|
import type {
|
|
4
2
|
AddressResponse,
|
|
5
3
|
UpdateAddressInput,
|
|
6
4
|
} from "@remit/api-openapi-types";
|
|
5
|
+
import type { AddressItem, FlagsMergePatch } from "@remit/data-ports";
|
|
6
|
+
import { ForbiddenError } from "@remit/data-ports/errors";
|
|
7
7
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
8
8
|
import type { Context } from "openapi-backend";
|
|
9
9
|
import { getAccountConfigIdFromEvent } from "../auth.js";
|
package/src/handlers/config.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SQSClient } from "@aws-sdk/client-sqs";
|
|
2
|
-
import type { AccountConfigItem, MailboxItem } from "@remit/data-ports";
|
|
3
|
-
import { NotFoundError } from "@remit/data-ports/errors";
|
|
4
|
-
import { logger } from "@remit/logger-lambda";
|
|
5
2
|
import type {
|
|
6
3
|
AccountConfigResponse,
|
|
7
4
|
ConfigDescriptionResponse,
|
|
8
5
|
} from "@remit/api-openapi-types";
|
|
6
|
+
import type { AccountConfigItem, MailboxItem } from "@remit/data-ports";
|
|
7
|
+
import { NotFoundError } from "@remit/data-ports/errors";
|
|
8
|
+
import { logger } from "@remit/logger-lambda";
|
|
9
9
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
10
10
|
import { env } from "expect-env";
|
|
11
11
|
import type { Context } from "openapi-backend";
|
package/src/handlers/filter.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { FilterItem } from "@remit/data-ports";
|
|
2
|
-
import { ClientError } from "@remit/data-ports/errors";
|
|
3
|
-
import { FilterScope } from "@remit/domain-enums";
|
|
4
1
|
import type {
|
|
5
2
|
CreateFilterInput,
|
|
6
3
|
FilterResponse,
|
|
7
4
|
UpdateFilterInput,
|
|
8
5
|
} from "@remit/api-openapi-types";
|
|
6
|
+
import type { FilterItem } from "@remit/data-ports";
|
|
7
|
+
import { ClientError } from "@remit/data-ports/errors";
|
|
8
|
+
import { FilterScope } from "@remit/domain-enums";
|
|
9
9
|
import type { AnchorPayload } from "@remit/search-service";
|
|
10
10
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
11
11
|
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CanonicalMailboxRole as CanonicalMailboxRoleValue,
|
|
3
|
+
FolderAppointment,
|
|
4
|
+
} from "@remit/api-openapi-types";
|
|
1
5
|
import type {
|
|
2
6
|
AccountSettingItem,
|
|
3
7
|
IAccountSettingRepository,
|
|
@@ -13,10 +17,6 @@ import {
|
|
|
13
17
|
CanonicalMailboxRole,
|
|
14
18
|
MailboxSpecialUse,
|
|
15
19
|
} from "@remit/domain-enums";
|
|
16
|
-
import type {
|
|
17
|
-
CanonicalMailboxRole as CanonicalMailboxRoleValue,
|
|
18
|
-
FolderAppointment,
|
|
19
|
-
} from "@remit/api-openapi-types";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* RFC 032 exclusive-folder-appointment (#976): a per-account role→mailbox map.
|
package/src/handlers/mailbox.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IAccountSettingRepository,
|
|
3
|
-
MailboxItem,
|
|
4
|
-
} from "@remit/data-ports";
|
|
5
|
-
import { ForbiddenError, NotFoundError } from "@remit/data-ports/errors";
|
|
6
|
-
import { MessageSystemFlag } from "@remit/domain-enums";
|
|
7
1
|
import type {
|
|
8
2
|
MailboxResponse,
|
|
9
3
|
RenameMailboxInput,
|
|
10
4
|
} from "@remit/api-openapi-types";
|
|
5
|
+
import type { IAccountSettingRepository, MailboxItem } from "@remit/data-ports";
|
|
6
|
+
import { ForbiddenError, NotFoundError } from "@remit/data-ports/errors";
|
|
7
|
+
import { MessageSystemFlag } from "@remit/domain-enums";
|
|
11
8
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
12
9
|
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
13
10
|
import {
|
package/src/handlers/me.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2
|
-
import { BadRequestError, NotFoundError } from "@remit/data-ports/errors";
|
|
3
|
-
import { logger } from "@remit/logger-lambda";
|
|
4
2
|
import type {
|
|
5
3
|
AccountExportRequestResponse,
|
|
6
4
|
CreateExportResponse,
|
|
@@ -8,6 +6,8 @@ import type {
|
|
|
8
6
|
DeleteMeInput,
|
|
9
7
|
VipSuggestionsResponse,
|
|
10
8
|
} from "@remit/api-openapi-types";
|
|
9
|
+
import { BadRequestError, NotFoundError } from "@remit/data-ports/errors";
|
|
10
|
+
import { logger } from "@remit/logger-lambda";
|
|
11
11
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
12
12
|
import { env } from "expect-env";
|
|
13
13
|
import type { Context } from "openapi-backend";
|
package/src/handlers/message.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BodyPartResponse,
|
|
3
|
+
EnvelopeAddressResponse,
|
|
4
|
+
EnvelopeResponse,
|
|
5
|
+
MessageSummaryResponse,
|
|
6
|
+
} from "@remit/api-openapi-types";
|
|
1
7
|
import type { MailboxItem } from "@remit/data-ports";
|
|
2
8
|
import {
|
|
3
9
|
BadRequestError,
|
|
@@ -19,12 +25,6 @@ import {
|
|
|
19
25
|
isMessageBodySyncBroken,
|
|
20
26
|
MailboxCursorPausedError,
|
|
21
27
|
} from "@remit/mailbox-service";
|
|
22
|
-
import type {
|
|
23
|
-
BodyPartResponse,
|
|
24
|
-
EnvelopeAddressResponse,
|
|
25
|
-
EnvelopeResponse,
|
|
26
|
-
MessageSummaryResponse,
|
|
27
|
-
} from "@remit/api-openapi-types";
|
|
28
28
|
import {
|
|
29
29
|
isStorageNotFoundError as isStorageNotFoundErrorFromService,
|
|
30
30
|
parseStorageUri,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { describe, it } from "node:test";
|
|
3
|
-
import { FilterMatchOperator } from "@remit/domain-enums";
|
|
4
3
|
import type { OrganizeInput } from "@remit/api-openapi-types";
|
|
4
|
+
import { FilterMatchOperator } from "@remit/domain-enums";
|
|
5
5
|
import { predicateFromInput } from "./organize.js";
|
|
6
6
|
|
|
7
7
|
const input = (over: Partial<OrganizeInput> = {}): OrganizeInput => ({
|
package/src/handlers/organize.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2
|
-
import { NotFoundError } from "@remit/data-ports/errors";
|
|
3
|
-
import { logger } from "@remit/logger-lambda";
|
|
4
2
|
import type {
|
|
5
3
|
CreateOrganizeJobResponse,
|
|
6
4
|
OrganizeInput,
|
|
7
5
|
OrganizeJobResponse,
|
|
8
6
|
OrganizePreviewResponse,
|
|
9
7
|
} from "@remit/api-openapi-types";
|
|
8
|
+
import { NotFoundError } from "@remit/data-ports/errors";
|
|
9
|
+
import { logger } from "@remit/logger-lambda";
|
|
10
10
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
11
11
|
import { env } from "expect-env";
|
|
12
12
|
import type { Context } from "openapi-backend";
|
package/src/handlers/outbox.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { OutboxMessageItem } from "@remit/data-ports";
|
|
2
|
-
import { ForbiddenError } from "@remit/data-ports/errors";
|
|
3
1
|
import type {
|
|
4
2
|
CreateOutboxMessageInput,
|
|
5
3
|
OutboxMessageResponse,
|
|
6
4
|
UpdateOutboxMessageInput,
|
|
7
5
|
} from "@remit/api-openapi-types";
|
|
6
|
+
import type { OutboxMessageItem } from "@remit/data-ports";
|
|
7
|
+
import { ForbiddenError } from "@remit/data-ports/errors";
|
|
8
8
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
9
9
|
import type { Context } from "openapi-backend";
|
|
10
10
|
import { getAccountConfigIdFromEvent } from "../auth.js";
|
package/src/handlers/thread.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ResultList, ThreadMessageItem } from "@remit/data-ports";
|
|
2
|
-
import { NotFoundError } from "@remit/data-ports/errors";
|
|
3
1
|
import type {
|
|
4
2
|
MessageCategory,
|
|
5
3
|
SenderTrust,
|
|
6
4
|
ThreadSearchResponse,
|
|
7
5
|
} from "@remit/api-openapi-types";
|
|
6
|
+
import type { ResultList, ThreadMessageItem } from "@remit/data-ports";
|
|
7
|
+
import { NotFoundError } from "@remit/data-ports/errors";
|
|
8
8
|
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
9
9
|
import type { Context } from "openapi-backend";
|
|
10
10
|
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
@@ -33,10 +33,7 @@ import {
|
|
|
33
33
|
MessageMoveService,
|
|
34
34
|
OutboxQueueService,
|
|
35
35
|
} from "@remit/mailbox-service";
|
|
36
|
-
import {
|
|
37
|
-
createSearchService,
|
|
38
|
-
type SearchService,
|
|
39
|
-
} from "@remit/search-service";
|
|
36
|
+
import { createSearchService, type SearchService } from "@remit/search-service";
|
|
40
37
|
import {
|
|
41
38
|
buildEmbeddingServiceFromEnv,
|
|
42
39
|
buildVectorStoreFromEnv,
|
package/src/service/filter.ts
CHANGED
|
@@ -18,23 +18,19 @@ const parseEnvFile = (relativePath: string): Record<string, string> => {
|
|
|
18
18
|
return entries;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
describe(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
() => {
|
|
29
|
-
const env = parseEnvFile("localhost-dev-aws.env");
|
|
21
|
+
describe("local dev SQS routing (localhost-dev-aws.env)", {
|
|
22
|
+
// localhost-dev-aws.env is AWS-local-dev config, stripped from the open-core
|
|
23
|
+
// tree; skip where it is absent.
|
|
24
|
+
skip: !existsSync(`${repoRoot}localhost-dev-aws.env`),
|
|
25
|
+
}, () => {
|
|
26
|
+
const env = parseEnvFile("localhost-dev-aws.env");
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
28
|
+
it("publishes backend writes to the FIFO mailboxes queue the sync consumer drains", () => {
|
|
29
|
+
// Prod wires the API's SQS_QUEUE_URL to the mailboxes FIFO queue
|
|
30
|
+
// (infra remit-api-stack.ts). Onboarding publishes SYNC_MAILBOXES there;
|
|
31
|
+
// the imap worker consumes it. Local dev must mirror that or onboarding
|
|
32
|
+
// events land in a queue nothing drains and accounts never sync.
|
|
33
|
+
assert.equal(env.SQS_QUEUE_URL, env.SQS_QUEUE_URL_MAILBOXES);
|
|
34
|
+
assert.ok(env.SQS_QUEUE_URL?.endsWith(".fifo"));
|
|
35
|
+
});
|
|
36
|
+
});
|
package/src/service/organize.ts
CHANGED