@remit/backend 0.0.144 → 0.0.145
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/dist/src/api.d.ts +0 -2
- package/dist/src/api.js +9 -80
- package/dist/src/auth.d.ts +13 -19
- package/dist/src/auth.js +51 -43
- package/dist/src/config/api-config.d.ts +20 -0
- package/dist/src/config/api-config.js +1 -0
- package/dist/src/config/from-env.d.ts +2 -0
- package/dist/src/config/from-env.js +65 -0
- package/dist/src/config/msoauth-secrets-manager.d.ts +2 -0
- package/dist/src/config/msoauth-secrets-manager.js +28 -0
- package/dist/src/config/msoauth.d.ts +18 -29
- package/dist/src/config/msoauth.js +4 -28
- package/dist/src/derive/contentSignature.d.ts +3 -4
- package/dist/src/derive/contentSignature.js +4 -13
- package/dist/src/derive/contentUrl.d.ts +0 -13
- package/dist/src/derive/contentUrl.js +0 -19
- package/dist/src/handlers/account-oauth.d.ts +4 -3
- package/dist/src/handlers/account-oauth.js +197 -250
- package/dist/src/handlers/account.d.ts +4 -3
- package/dist/src/handlers/account.js +26 -39
- package/dist/src/handlers/address.d.ts +2 -2
- package/dist/src/handlers/address.js +11 -19
- package/dist/src/handlers/calendar-event.js +18 -26
- package/dist/src/handlers/calendar-feed.d.ts +2 -2
- package/dist/src/handlers/calendar-feed.js +24 -32
- package/dist/src/handlers/calendar-suggestion.js +18 -26
- package/dist/src/handlers/calendar.d.ts +1 -1
- package/dist/src/handlers/calendar.js +15 -22
- package/dist/src/handlers/config.d.ts +5 -5
- package/dist/src/handlers/config.js +23 -35
- package/dist/src/handlers/filter.d.ts +2 -2
- package/dist/src/handlers/filter.js +17 -32
- package/dist/src/handlers/folder-role.js +3 -6
- package/dist/src/handlers/index.d.ts +88 -2
- package/dist/src/handlers/index.js +6 -4
- package/dist/src/handlers/label.js +15 -22
- package/dist/src/handlers/mailbox.d.ts +3 -3
- package/dist/src/handlers/mailbox.js +18 -26
- package/dist/src/handlers/me.d.ts +1 -1
- package/dist/src/handlers/me.js +26 -47
- package/dist/src/handlers/message.d.ts +3 -5
- package/dist/src/handlers/message.js +34 -46
- package/dist/src/handlers/organize.d.ts +2 -2
- package/dist/src/handlers/organize.js +11 -20
- package/dist/src/handlers/outbox-attachment.d.ts +5 -3
- package/dist/src/handlers/outbox-attachment.js +11 -15
- package/dist/src/handlers/outbox.d.ts +3 -3
- package/dist/src/handlers/outbox.js +27 -35
- package/dist/src/handlers/sync.d.ts +5 -5
- package/dist/src/handlers/sync.js +13 -22
- package/dist/src/handlers/system-update.js +14 -27
- package/dist/src/handlers/thread.js +9 -14
- package/dist/src/handlers/unified-threads.js +3 -6
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +18 -2
- package/dist/src/jwt-auth.d.ts +9 -12
- package/dist/src/jwt-auth.js +19 -71
- package/dist/src/lambda.d.ts +13 -0
- package/dist/src/lambda.js +33 -0
- package/dist/src/request.d.ts +8 -2
- package/dist/src/request.js +16 -6
- package/dist/src/response.d.ts +20 -3
- package/dist/src/response.js +15 -22
- package/dist/src/serve.d.ts +31 -0
- package/dist/src/serve.js +117 -0
- package/dist/src/service/account-deletion.d.ts +2 -4
- package/dist/src/service/account-deletion.js +3 -9
- package/dist/src/service/compose-sqlite.d.ts +2 -1
- package/dist/src/service/compose-sqlite.js +5 -3
- package/dist/src/service/create-remit-client.d.ts +25 -11
- package/dist/src/service/create-remit-client.js +96 -115
- package/dist/src/service/data-client.js +3 -5
- package/dist/src/service/export-identity.d.ts +2 -1
- package/dist/src/service/export-identity.js +4 -6
- package/dist/src/service/fire-and-forget.js +1 -2
- package/dist/src/service/organize.d.ts +7 -10
- package/dist/src/service/organize.js +10 -27
- package/dist/src/service/queues.d.ts +12 -0
- package/dist/src/service/queues.js +1 -0
- package/dist/src/service/shared-deps.d.ts +6 -0
- package/dist/src/service/shared-deps.js +24 -0
- package/dist/src/service/trigger-sync.d.ts +11 -5
- package/dist/src/service/trigger-sync.js +10 -18
- package/dist/src/types.d.ts +24 -1
- package/package.json +20 -8
- package/dist/src/data-backend.d.ts +0 -12
- package/dist/src/data-backend.js +0 -12
- package/dist/src/request-context.d.ts +0 -9
- package/dist/src/request-context.js +0 -22
- package/dist/src/service/sqs.d.ts +0 -1
- package/dist/src/service/sqs.js +0 -3
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { logger } from "@remit/logger";
|
|
2
2
|
import { createFilter, listFilters, ownedAccount, updateFilter, } from "@remit/mailbox-service";
|
|
3
|
-
import { env } from "expect-env";
|
|
4
|
-
import { getAccountConfigIdFromEvent, getSubFromEvent } from "../auth.js";
|
|
5
|
-
import { getClient } from "../service/data-client.js";
|
|
6
3
|
import { unwrap } from "../service/refusal.js";
|
|
7
4
|
const toFilterResponse = (item) => ({
|
|
8
5
|
filterId: item.filterId,
|
|
@@ -21,20 +18,12 @@ const toFilterResponse = (item) => ({
|
|
|
21
18
|
createdAt: item.createdAt,
|
|
22
19
|
updatedAt: item.updatedAt,
|
|
23
20
|
});
|
|
24
|
-
const requireUserId = (event) => {
|
|
25
|
-
const userId = getSubFromEvent(event);
|
|
26
|
-
if (!userId) {
|
|
27
|
-
throw new Error("Missing Cognito `sub`: cannot attribute an organize job to a user");
|
|
28
|
-
}
|
|
29
|
-
return userId;
|
|
30
|
-
};
|
|
31
21
|
export const FilterOperations = {
|
|
32
|
-
FilterOperations_listFilters: async (context,
|
|
33
|
-
const
|
|
34
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
22
|
+
FilterOperations_listFilters: async (context, ctx) => {
|
|
23
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
35
24
|
const { accountId } = context.request.params;
|
|
36
25
|
const { continuationToken } = context.request.query;
|
|
37
|
-
const page = unwrap(await listFilters(
|
|
26
|
+
const page = unwrap(await listFilters(ctx.client, accountConfigId, {
|
|
38
27
|
accountId,
|
|
39
28
|
continuationToken,
|
|
40
29
|
}));
|
|
@@ -43,19 +32,18 @@ export const FilterOperations = {
|
|
|
43
32
|
continuationToken: page.continuationToken,
|
|
44
33
|
};
|
|
45
34
|
},
|
|
46
|
-
FilterOperations_createFilter: async (context,
|
|
47
|
-
const
|
|
48
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
35
|
+
FilterOperations_createFilter: async (context, ctx) => {
|
|
36
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
49
37
|
const { accountId } = context.request.params;
|
|
50
38
|
const filter = context.request.requestBody;
|
|
51
|
-
const userId =
|
|
52
|
-
const client =
|
|
39
|
+
const userId = ctx.identity.sub;
|
|
40
|
+
const client = ctx.client;
|
|
53
41
|
const created = unwrap(await createFilter({
|
|
54
42
|
account: client.account,
|
|
55
43
|
mailbox: client.mailbox,
|
|
56
44
|
filter: client.filter,
|
|
57
45
|
organizeJobRequest: client.organizeJobRequest,
|
|
58
|
-
|
|
46
|
+
queue: client.queues.accountFanout,
|
|
59
47
|
logger,
|
|
60
48
|
}, { accountConfigId, userId }, { accountId, filter }));
|
|
61
49
|
return {
|
|
@@ -65,11 +53,10 @@ export const FilterOperations = {
|
|
|
65
53
|
},
|
|
66
54
|
};
|
|
67
55
|
export const FilterDetailOperations = {
|
|
68
|
-
FilterDetailOperations_getFilter: async (context,
|
|
69
|
-
const
|
|
70
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
56
|
+
FilterDetailOperations_getFilter: async (context, ctx) => {
|
|
57
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
71
58
|
const { accountId, filterId } = context.request.params;
|
|
72
|
-
const client =
|
|
59
|
+
const client = ctx.client;
|
|
73
60
|
const account = await client.account.get(accountId);
|
|
74
61
|
unwrap(ownedAccount(account, accountConfigId, "read"));
|
|
75
62
|
const { filter } = client;
|
|
@@ -77,23 +64,21 @@ export const FilterDetailOperations = {
|
|
|
77
64
|
const refreshed = await filter.refreshExpiry(item);
|
|
78
65
|
return toFilterResponse(refreshed);
|
|
79
66
|
},
|
|
80
|
-
FilterDetailOperations_updateFilter: async (context,
|
|
81
|
-
const
|
|
82
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
67
|
+
FilterDetailOperations_updateFilter: async (context, ctx) => {
|
|
68
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
83
69
|
const { accountId, filterId } = context.request.params;
|
|
84
70
|
const patch = context.request.requestBody;
|
|
85
|
-
const updated = await updateFilter(
|
|
71
|
+
const updated = await updateFilter(ctx.client, accountConfigId, {
|
|
86
72
|
accountId,
|
|
87
73
|
filterId,
|
|
88
74
|
patch,
|
|
89
75
|
});
|
|
90
76
|
return toFilterResponse(unwrap(updated));
|
|
91
77
|
},
|
|
92
|
-
FilterDetailOperations_deleteFilter: async (context,
|
|
93
|
-
const
|
|
94
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
78
|
+
FilterDetailOperations_deleteFilter: async (context, ctx) => {
|
|
79
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
95
80
|
const { accountId, filterId } = context.request.params;
|
|
96
|
-
const client =
|
|
81
|
+
const client = ctx.client;
|
|
97
82
|
const account = await client.account.get(accountId);
|
|
98
83
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
99
84
|
const { filter } = client;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { folderInAccount, ownedAccount, settledFolder, } from "@remit/mailbox-service";
|
|
2
|
-
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
3
|
-
import { getClient } from "../service/data-client.js";
|
|
4
2
|
import { unwrap } from "../service/refusal.js";
|
|
5
3
|
import { toAccountResponse } from "./account-guards.js";
|
|
6
4
|
import { loadAccountOverrides } from "./account-overrides.js";
|
|
@@ -14,12 +12,11 @@ import { resolveAccountFolderAppointments, writeFolderRoleAppointment, } from ".
|
|
|
14
12
|
* the role back to unfilled.
|
|
15
13
|
*/
|
|
16
14
|
export const FolderRoleOperations = {
|
|
17
|
-
FolderRoleOperations_appointFolderRole: async (context,
|
|
18
|
-
const
|
|
19
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
15
|
+
FolderRoleOperations_appointFolderRole: async (context, ctx) => {
|
|
16
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
20
17
|
const { accountId, role } = context.request.params;
|
|
21
18
|
const body = context.request.requestBody;
|
|
22
|
-
const { account, accountSetting, mailbox } =
|
|
19
|
+
const { account, accountSetting, mailbox } = ctx.client;
|
|
23
20
|
const existing = await account.get(accountId);
|
|
24
21
|
unwrap(ownedAccount(existing, accountConfigId, "act"));
|
|
25
22
|
let lastKnownPath;
|
|
@@ -1,2 +1,88 @@
|
|
|
1
|
-
import type { OperationHandler,
|
|
2
|
-
export declare const handlers:
|
|
1
|
+
import type { OperationHandler, PublicOperationHandler } from "../types.js";
|
|
2
|
+
export declare const handlers: {
|
|
3
|
+
CalendarSuggestionActionOperations_acceptCalendarSuggestion: OperationHandler<import("../types.js").CalendarSuggestionActionOperationIds>;
|
|
4
|
+
CalendarSuggestionActionOperations_declineCalendarSuggestion: OperationHandler<import("../types.js").CalendarSuggestionActionOperationIds>;
|
|
5
|
+
CalendarSuggestionActionOperations_dismissCalendarSuggestion: OperationHandler<import("../types.js").CalendarSuggestionActionOperationIds>;
|
|
6
|
+
CalendarSuggestionActionOperations_reopenCalendarSuggestion: OperationHandler<import("../types.js").CalendarSuggestionActionOperationIds>;
|
|
7
|
+
MessageCalendarSuggestionOperations_listMessageCalendarSuggestions: OperationHandler<"MessageCalendarSuggestionOperations_listMessageCalendarSuggestions">;
|
|
8
|
+
CalendarSuggestionOperations_listCalendarSuggestions: OperationHandler<"CalendarSuggestionOperations_listCalendarSuggestions">;
|
|
9
|
+
AddressDetailOperations_updateAddress: OperationHandler<"AddressDetailOperations_updateAddress", "accountFanout">;
|
|
10
|
+
AddressOperations_searchAddresses: OperationHandler<"AddressOperations_searchAddresses", "accountFanout">;
|
|
11
|
+
OutboxAttachmentOperations_completeOutboxAttachment: OperationHandler<"OutboxAttachmentOperations_completeOutboxAttachment", "smtp">;
|
|
12
|
+
OutboxDetailOperations_getOutboxMessage: OperationHandler<import("../types.js").OutboxDetailOperationIds, "smtp">;
|
|
13
|
+
OutboxDetailOperations_updateOutboxMessage: OperationHandler<import("../types.js").OutboxDetailOperationIds, "smtp">;
|
|
14
|
+
OutboxDetailOperations_deleteOutboxMessage: OperationHandler<import("../types.js").OutboxDetailOperationIds, "smtp">;
|
|
15
|
+
OutboxDetailOperations_mintOutboxAttachment: OperationHandler<import("../types.js").OutboxDetailOperationIds, "smtp">;
|
|
16
|
+
OutboxDetailOperations_sendOutboxMessage: OperationHandler<import("../types.js").OutboxDetailOperationIds, "smtp">;
|
|
17
|
+
OutboxOperations_createOutboxMessage: OperationHandler<import("../types.js").OutboxOperationIds, "smtp">;
|
|
18
|
+
OutboxOperations_listOutboxMessages: OperationHandler<import("../types.js").OutboxOperationIds, "smtp">;
|
|
19
|
+
MessageBulkOperations_copyMessages: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
20
|
+
MessageBulkOperations_deleteMessages: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
21
|
+
MessageBulkOperations_updateFlags: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
22
|
+
MessageBulkOperations_updateMessageLabels: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
23
|
+
MessageBulkOperations_moveMessages: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
24
|
+
MessageBulkOperations_notSpam: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
25
|
+
MessageBulkOperations_reportSpam: OperationHandler<import("../types.js").MessageBulkOperationIds, "body" | "sync" | "messageManagement">;
|
|
26
|
+
MessageOperations_describeMessage: OperationHandler<import("../types.js").MessageOperationIds, "body" | "sync" | "messageManagement">;
|
|
27
|
+
MessageOperations_updateMessageFlags: OperationHandler<import("../types.js").MessageOperationIds, "body" | "sync" | "messageManagement">;
|
|
28
|
+
MessageOperations_getRawMessage: OperationHandler<import("../types.js").MessageOperationIds, "body" | "sync" | "messageManagement">;
|
|
29
|
+
ThreadOperations_listThreads: OperationHandler<import("../types.js").ThreadOperationIds>;
|
|
30
|
+
ThreadOperations_searchThreads: OperationHandler<import("../types.js").ThreadOperationIds>;
|
|
31
|
+
UnifiedThreadOperations_listAllThreads: OperationHandler<"UnifiedThreadOperations_listAllThreads">;
|
|
32
|
+
ThreadDetailOperations_listThreadMessages: OperationHandler<"ThreadDetailOperations_listThreadMessages">;
|
|
33
|
+
SyncOperations_triggerSync: OperationHandler<import("../types.js").SyncOperationIds, "sync">;
|
|
34
|
+
SyncOperations_getSyncStatus: OperationHandler<import("../types.js").SyncOperationIds, "sync">;
|
|
35
|
+
TrashOperations_emptyTrash: OperationHandler<"TrashOperations_emptyTrash", "sync">;
|
|
36
|
+
CalendarFreeBusyOperations_listCalendarFreeBusy: OperationHandler<"CalendarFreeBusyOperations_listCalendarFreeBusy">;
|
|
37
|
+
CalendarEventDetailOperations_getCalendarEvent: OperationHandler<import("../types.js").CalendarEventDetailOperationIds>;
|
|
38
|
+
CalendarEventDetailOperations_updateCalendarEvent: OperationHandler<import("../types.js").CalendarEventDetailOperationIds>;
|
|
39
|
+
CalendarEventDetailOperations_deleteCalendarEvent: OperationHandler<import("../types.js").CalendarEventDetailOperationIds>;
|
|
40
|
+
CalendarEventOperations_listCalendarEvents: OperationHandler<import("../types.js").CalendarEventOperationIds>;
|
|
41
|
+
CalendarEventOperations_createCalendarEvent: OperationHandler<import("../types.js").CalendarEventOperationIds>;
|
|
42
|
+
CalendarDetailOperations_getCalendarFeed: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
43
|
+
CalendarDetailOperations_putCalendarFeed: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
44
|
+
CalendarDetailOperations_revokeCalendarFeed: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
45
|
+
CalendarDetailOperations_getCalendar: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
46
|
+
CalendarDetailOperations_updateCalendar: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
47
|
+
CalendarDetailOperations_deleteCalendar: OperationHandler<import("../types.js").CalendarDetailOperationIds>;
|
|
48
|
+
CalendarOperations_listCalendars: OperationHandler<import("../types.js").CalendarOperationIds>;
|
|
49
|
+
CalendarOperations_createCalendar: OperationHandler<import("../types.js").CalendarOperationIds>;
|
|
50
|
+
OrganizeJobDetailOperations_getOrganizeJob: OperationHandler<"OrganizeJobDetailOperations_getOrganizeJob", "accountFanout">;
|
|
51
|
+
OrganizeOperations_createOrganizeJob: OperationHandler<import("../types.js").OrganizeOperationIds, "accountFanout">;
|
|
52
|
+
OrganizeOperations_previewOrganize: OperationHandler<import("../types.js").OrganizeOperationIds, "accountFanout">;
|
|
53
|
+
LabelDetailOperations_getLabel: OperationHandler<import("../types.js").LabelDetailOperationIds>;
|
|
54
|
+
LabelDetailOperations_updateLabel: OperationHandler<import("../types.js").LabelDetailOperationIds>;
|
|
55
|
+
LabelDetailOperations_deleteLabel: OperationHandler<import("../types.js").LabelDetailOperationIds>;
|
|
56
|
+
LabelOperations_listLabels: OperationHandler<import("../types.js").LabelOperationIds>;
|
|
57
|
+
LabelOperations_createLabel: OperationHandler<import("../types.js").LabelOperationIds>;
|
|
58
|
+
FilterDetailOperations_getFilter: OperationHandler<import("../types.js").FilterDetailOperationIds, "accountFanout">;
|
|
59
|
+
FilterDetailOperations_updateFilter: OperationHandler<import("../types.js").FilterDetailOperationIds, "accountFanout">;
|
|
60
|
+
FilterDetailOperations_deleteFilter: OperationHandler<import("../types.js").FilterDetailOperationIds, "accountFanout">;
|
|
61
|
+
FilterOperations_listFilters: OperationHandler<import("../types.js").FilterOperationIds, "accountFanout">;
|
|
62
|
+
FilterOperations_createFilter: OperationHandler<import("../types.js").FilterOperationIds, "accountFanout">;
|
|
63
|
+
FolderRoleOperations_appointFolderRole: OperationHandler<"FolderRoleOperations_appointFolderRole">;
|
|
64
|
+
MailboxDetailOperations_getMailbox: OperationHandler<import("../types.js").MailboxDetailOperationIds, "sync">;
|
|
65
|
+
MailboxDetailOperations_renameMailbox: OperationHandler<import("../types.js").MailboxDetailOperationIds, "sync">;
|
|
66
|
+
MailboxDetailOperations_deleteMailbox: OperationHandler<import("../types.js").MailboxDetailOperationIds, "sync">;
|
|
67
|
+
MailboxOperations_listMailboxes: OperationHandler<import("../types.js").MailboxOperationIds, "sync">;
|
|
68
|
+
MailboxOperations_createMailbox: OperationHandler<import("../types.js").MailboxOperationIds, "sync">;
|
|
69
|
+
MicrosoftOAuthOperations_microsoftOAuthStart: OperationHandler<import("../types.js").MicrosoftOAuthOperationIds, "sync">;
|
|
70
|
+
AccountDetailOperations_updateAccount: OperationHandler<import("../types.js").AccountDetailOperationIds, "sync" | "accountFanout">;
|
|
71
|
+
AccountDetailOperations_deleteAccount: OperationHandler<import("../types.js").AccountDetailOperationIds, "sync" | "accountFanout">;
|
|
72
|
+
AccountOperations_createAccount: OperationHandler<import("../types.js").AccountOperationIds, "sync" | "accountFanout">;
|
|
73
|
+
AccountOperations_testConnection: OperationHandler<import("../types.js").AccountOperationIds, "sync" | "accountFanout">;
|
|
74
|
+
SystemOperations_getSystemUpdate: OperationHandler<import("../types.js").SystemOperationIds>;
|
|
75
|
+
SystemOperations_applySystemUpdate: OperationHandler<import("../types.js").SystemOperationIds>;
|
|
76
|
+
ConfigOperations_getConfig: OperationHandler<import("../types.js").ConfigOperationIds, "sync">;
|
|
77
|
+
ConfigOperations_exportConfig: OperationHandler<import("../types.js").ConfigOperationIds, "sync">;
|
|
78
|
+
ConfigOperations_importConfig: OperationHandler<import("../types.js").ConfigOperationIds, "sync">;
|
|
79
|
+
MeOperations_deleteMe: OperationHandler<import("../types.js").MeOperationIds, "accountFanout">;
|
|
80
|
+
MeOperations_createExport: OperationHandler<import("../types.js").MeOperationIds, "accountFanout">;
|
|
81
|
+
MeOperations_getExport: OperationHandler<import("../types.js").MeOperationIds, "accountFanout">;
|
|
82
|
+
MeOperations_listQuarantine: OperationHandler<import("../types.js").MeOperationIds, "accountFanout">;
|
|
83
|
+
MeOperations_listVipSuggestions: OperationHandler<import("../types.js").MeOperationIds, "accountFanout">;
|
|
84
|
+
};
|
|
85
|
+
export declare const publicHandlers: {
|
|
86
|
+
MicrosoftOAuthOperations_microsoftOAuthCallback: PublicOperationHandler<"sync">;
|
|
87
|
+
CalendarFeedOperations_getCalendarFeedIcal: PublicOperationHandler;
|
|
88
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AccountDetailOperations, AccountOperations } from "./account.js";
|
|
2
|
-
import { MicrosoftOAuthOperations } from "./account-oauth.js";
|
|
2
|
+
import { MicrosoftOAuthOperations, microsoftOAuthCallback, } from "./account-oauth.js";
|
|
3
3
|
import { AddressDetailOperations, AddressOperations } from "./address.js";
|
|
4
4
|
import { CalendarDetailOperations, CalendarOperations } from "./calendar.js";
|
|
5
5
|
import { CalendarEventDetailOperations, CalendarEventOperations, CalendarFreeBusyOperations, } from "./calendar-event.js";
|
|
6
|
-
import { CalendarFeedDetailOperations,
|
|
6
|
+
import { CalendarFeedDetailOperations, getCalendarFeedIcal, } from "./calendar-feed.js";
|
|
7
7
|
import { CalendarSuggestionActionOperations, CalendarSuggestionOperations, MessageCalendarSuggestionOperations, } from "./calendar-suggestion.js";
|
|
8
8
|
import { ConfigOperations } from "./config.js";
|
|
9
9
|
import { FilterDetailOperations, FilterOperations } from "./filter.js";
|
|
@@ -18,7 +18,6 @@ import { SyncOperations } from "./sync.js";
|
|
|
18
18
|
import { SystemOperations } from "./system-update.js";
|
|
19
19
|
import { ThreadDetailOperations, ThreadOperations } from "./thread.js";
|
|
20
20
|
import { UnifiedThreadOperations } from "./unified-threads.js";
|
|
21
|
-
// biome-ignore lint/suspicious/noExplicitAny: Types are narrowed downstream
|
|
22
21
|
export const handlers = {
|
|
23
22
|
...MeOperations,
|
|
24
23
|
...ConfigOperations,
|
|
@@ -38,7 +37,6 @@ export const handlers = {
|
|
|
38
37
|
...CalendarOperations,
|
|
39
38
|
...CalendarDetailOperations,
|
|
40
39
|
...CalendarFeedDetailOperations,
|
|
41
|
-
...CalendarFeedOperations,
|
|
42
40
|
...CalendarEventOperations,
|
|
43
41
|
...CalendarEventDetailOperations,
|
|
44
42
|
...CalendarFreeBusyOperations,
|
|
@@ -58,3 +56,7 @@ export const handlers = {
|
|
|
58
56
|
...MessageCalendarSuggestionOperations,
|
|
59
57
|
...CalendarSuggestionActionOperations,
|
|
60
58
|
};
|
|
59
|
+
export const publicHandlers = {
|
|
60
|
+
MicrosoftOAuthOperations_microsoftOAuthCallback: microsoftOAuthCallback,
|
|
61
|
+
CalendarFeedOperations_getCalendarFeedIcal: getCalendarFeedIcal,
|
|
62
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ownedAccount } from "@remit/mailbox-service";
|
|
2
|
-
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
3
|
-
import { getClient } from "../service/data-client.js";
|
|
4
2
|
import { unwrap } from "../service/refusal.js";
|
|
5
3
|
/**
|
|
6
4
|
* Every filter in the account whose action applies this label (issue #26). The
|
|
@@ -39,12 +37,11 @@ export const deleteLabelWithCascade = async (deps, accountConfigId, labelId) =>
|
|
|
39
37
|
await deps.label.delete(accountConfigId, labelId);
|
|
40
38
|
};
|
|
41
39
|
export const LabelOperations = {
|
|
42
|
-
LabelOperations_listLabels: async (context,
|
|
43
|
-
const
|
|
44
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
40
|
+
LabelOperations_listLabels: async (context, ctx) => {
|
|
41
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
45
42
|
const { accountId } = context.request.params;
|
|
46
43
|
const { continuationToken } = context.request.query;
|
|
47
|
-
const client =
|
|
44
|
+
const client = ctx.client;
|
|
48
45
|
const account = await client.account.get(accountId);
|
|
49
46
|
unwrap(ownedAccount(account, accountConfigId, "read"));
|
|
50
47
|
const page = await client.label.listPageByAccountConfig(accountConfigId, {
|
|
@@ -61,12 +58,11 @@ export const LabelOperations = {
|
|
|
61
58
|
continuationToken: page.continuationToken,
|
|
62
59
|
};
|
|
63
60
|
},
|
|
64
|
-
LabelOperations_createLabel: async (context,
|
|
65
|
-
const
|
|
66
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
61
|
+
LabelOperations_createLabel: async (context, ctx) => {
|
|
62
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
67
63
|
const { accountId } = context.request.params;
|
|
68
64
|
const input = context.request.requestBody;
|
|
69
|
-
const client =
|
|
65
|
+
const client = ctx.client;
|
|
70
66
|
const account = await client.account.get(accountId);
|
|
71
67
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
72
68
|
const label = await client.label.create({
|
|
@@ -78,34 +74,31 @@ export const LabelOperations = {
|
|
|
78
74
|
},
|
|
79
75
|
};
|
|
80
76
|
export const LabelDetailOperations = {
|
|
81
|
-
LabelDetailOperations_getLabel: async (context,
|
|
82
|
-
const
|
|
83
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
77
|
+
LabelDetailOperations_getLabel: async (context, ctx) => {
|
|
78
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
84
79
|
const { accountId, labelId } = context.request.params;
|
|
85
|
-
const client =
|
|
80
|
+
const client = ctx.client;
|
|
86
81
|
const account = await client.account.get(accountId);
|
|
87
82
|
unwrap(ownedAccount(account, accountConfigId, "read"));
|
|
88
83
|
const label = await client.label.get(accountConfigId, labelId);
|
|
89
84
|
const filters = await findFiltersForLabel(client, accountConfigId, labelId);
|
|
90
85
|
return toLabelResponse(label, filters.length);
|
|
91
86
|
},
|
|
92
|
-
LabelDetailOperations_updateLabel: async (context,
|
|
93
|
-
const
|
|
94
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
87
|
+
LabelDetailOperations_updateLabel: async (context, ctx) => {
|
|
88
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
95
89
|
const { accountId, labelId } = context.request.params;
|
|
96
90
|
const body = context.request.requestBody;
|
|
97
|
-
const client =
|
|
91
|
+
const client = ctx.client;
|
|
98
92
|
const account = await client.account.get(accountId);
|
|
99
93
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
100
94
|
const updated = await client.label.update(accountConfigId, labelId, body);
|
|
101
95
|
const filters = await findFiltersForLabel(client, accountConfigId, labelId);
|
|
102
96
|
return toLabelResponse(updated, filters.length);
|
|
103
97
|
},
|
|
104
|
-
LabelDetailOperations_deleteLabel: async (context,
|
|
105
|
-
const
|
|
106
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
98
|
+
LabelDetailOperations_deleteLabel: async (context, ctx) => {
|
|
99
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
107
100
|
const { accountId, labelId } = context.request.params;
|
|
108
|
-
const client =
|
|
101
|
+
const client = ctx.client;
|
|
109
102
|
const account = await client.account.get(accountId);
|
|
110
103
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
111
104
|
await deleteLabelWithCascade(client, accountConfigId, labelId);
|
|
@@ -18,6 +18,6 @@ export type MailboxPatchClient = FolderPathDeps & {
|
|
|
18
18
|
accountSetting: Pick<IAccountSettingRepository, "get" | "upsert" | "delete">;
|
|
19
19
|
};
|
|
20
20
|
export declare const applyMailboxPatch: (client: MailboxPatchClient, accountConfigId: string, mailboxId: string, accountId: string, body: RenameMailboxInput) => Promise<MailboxItem>;
|
|
21
|
-
export declare const MailboxOperations: Record<MailboxOperationIds, OperationHandler<MailboxOperationIds>>;
|
|
22
|
-
export declare const MailboxDetailOperations: Record<MailboxDetailOperationIds, OperationHandler<MailboxDetailOperationIds>>;
|
|
23
|
-
export declare const TrashOperations: Record<TrashOperationIds, OperationHandler<TrashOperationIds>>;
|
|
21
|
+
export declare const MailboxOperations: Record<MailboxOperationIds, OperationHandler<MailboxOperationIds, "sync">>;
|
|
22
|
+
export declare const MailboxDetailOperations: Record<MailboxDetailOperationIds, OperationHandler<MailboxDetailOperationIds, "sync">>;
|
|
23
|
+
export declare const TrashOperations: Record<TrashOperationIds, OperationHandler<TrashOperationIds, "sync">>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { BadRequestError, ConflictError } from "@remit/data-ports/errors";
|
|
2
2
|
import { MessageSystemFlag } from "@remit/domain-enums";
|
|
3
3
|
import { changeFolderPath, createFolder, folderInAccount, folderInFlight, ownedAccount, ownedFolder, } from "@remit/mailbox-service";
|
|
4
|
-
import { getAccountConfigIdFromEvent } from "../auth.js";
|
|
5
4
|
import { applyPendingMoveCountPrediction, } from "../derive/pendingMoveCounts.js";
|
|
6
|
-
import { getClient } from "../service/data-client.js";
|
|
7
5
|
import { unwrap } from "../service/refusal.js";
|
|
8
6
|
import { applyMailboxOverrideChanges, loadMailboxOverrides, loadMailboxOverridesForConfig, } from "./account-overrides.js";
|
|
9
7
|
import { assertNoBindings, loadMailboxBindings } from "./mailbox-bindings.js";
|
|
@@ -100,12 +98,11 @@ const toMailboxResponse = (mailbox, overrides = {}) => ({
|
|
|
100
98
|
updatedAt: mailbox.updatedAt,
|
|
101
99
|
});
|
|
102
100
|
export const MailboxOperations = {
|
|
103
|
-
MailboxOperations_listMailboxes: async (context,
|
|
104
|
-
const
|
|
105
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
101
|
+
MailboxOperations_listMailboxes: async (context, ctx) => {
|
|
102
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
106
103
|
const { accountId } = context.request.params;
|
|
107
104
|
const { continuationToken } = context.request.query;
|
|
108
|
-
const client =
|
|
105
|
+
const client = ctx.client;
|
|
109
106
|
const account = await client.account.get(accountId);
|
|
110
107
|
unwrap(ownedAccount(account, accountConfigId, "read"));
|
|
111
108
|
const result = await client.mailbox.listByAccount(accountId, {
|
|
@@ -129,13 +126,12 @@ export const MailboxOperations = {
|
|
|
129
126
|
continuationToken: result.continuationToken,
|
|
130
127
|
};
|
|
131
128
|
},
|
|
132
|
-
MailboxOperations_createMailbox: async (context,
|
|
133
|
-
const
|
|
134
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
129
|
+
MailboxOperations_createMailbox: async (context, ctx) => {
|
|
130
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
135
131
|
const { accountId } = context.request.params;
|
|
136
132
|
const { namespaceType, fullPath } = context.request
|
|
137
133
|
.requestBody;
|
|
138
|
-
const created = await createFolder(
|
|
134
|
+
const created = await createFolder(ctx.client, accountConfigId, {
|
|
139
135
|
accountId,
|
|
140
136
|
namespaceType,
|
|
141
137
|
fullPath,
|
|
@@ -148,11 +144,10 @@ export const MailboxOperations = {
|
|
|
148
144
|
},
|
|
149
145
|
};
|
|
150
146
|
export const MailboxDetailOperations = {
|
|
151
|
-
MailboxDetailOperations_getMailbox: async (context,
|
|
152
|
-
const
|
|
153
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
147
|
+
MailboxDetailOperations_getMailbox: async (context, ctx) => {
|
|
148
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
154
149
|
const { accountId, mailboxId } = context.request.params;
|
|
155
|
-
const client =
|
|
150
|
+
const client = ctx.client;
|
|
156
151
|
const account = await client.account.get(accountId);
|
|
157
152
|
unwrap(ownedAccount(account, accountConfigId, "read"));
|
|
158
153
|
const mailbox = await client.mailbox.get(accountId, mailboxId);
|
|
@@ -166,21 +161,19 @@ export const MailboxDetailOperations = {
|
|
|
166
161
|
const adjusted = applyPendingMoveCountPrediction([mailbox], pendingMoves, pendingUnseenFlagPushes)[0] ?? mailbox;
|
|
167
162
|
return toMailboxResponse(adjusted, overrides);
|
|
168
163
|
},
|
|
169
|
-
MailboxDetailOperations_renameMailbox: async (context,
|
|
170
|
-
const
|
|
171
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
164
|
+
MailboxDetailOperations_renameMailbox: async (context, ctx) => {
|
|
165
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
172
166
|
const { accountId, mailboxId } = context.request.params;
|
|
173
167
|
const body = context.request.requestBody;
|
|
174
|
-
const client =
|
|
168
|
+
const client = ctx.client;
|
|
175
169
|
const mailbox = await applyMailboxPatch(client, accountConfigId, mailboxId, accountId, body);
|
|
176
170
|
const overrides = await loadMailboxOverrides(client.accountSetting, accountConfigId, mailboxId);
|
|
177
171
|
return toMailboxResponse(mailbox, overrides);
|
|
178
172
|
},
|
|
179
|
-
MailboxDetailOperations_deleteMailbox: async (context,
|
|
180
|
-
const
|
|
181
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
173
|
+
MailboxDetailOperations_deleteMailbox: async (context, ctx) => {
|
|
174
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
182
175
|
const { accountId, mailboxId } = context.request.params;
|
|
183
|
-
const client =
|
|
176
|
+
const client = ctx.client;
|
|
184
177
|
const account = await client.account.get(accountId);
|
|
185
178
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
186
179
|
const mailbox = await client.mailbox.get(accountId, mailboxId);
|
|
@@ -203,11 +196,10 @@ export const MailboxDetailOperations = {
|
|
|
203
196
|
},
|
|
204
197
|
};
|
|
205
198
|
export const TrashOperations = {
|
|
206
|
-
TrashOperations_emptyTrash: async (context,
|
|
207
|
-
const
|
|
208
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
199
|
+
TrashOperations_emptyTrash: async (context, ctx) => {
|
|
200
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
209
201
|
const { accountId } = context.request.params;
|
|
210
|
-
const client =
|
|
202
|
+
const client = ctx.client;
|
|
211
203
|
const account = await client.account.get(accountId);
|
|
212
204
|
unwrap(ownedAccount(account, accountConfigId, "act"));
|
|
213
205
|
// The service resolves Trash, marks the rows and counts them, all off one
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { MeOperationIds, OperationHandler } from "../types.js";
|
|
2
|
-
export declare const MeOperations: Record<MeOperationIds, OperationHandler<MeOperationIds>>;
|
|
2
|
+
export declare const MeOperations: Record<MeOperationIds, OperationHandler<MeOperationIds, "accountFanout">>;
|
package/dist/src/handlers/me.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import { SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2
1
|
import { BadRequestError, NotFoundError } from "@remit/data-ports/errors";
|
|
3
2
|
import { SYNC_WARNING_SURFACE_ATTEMPTS } from "@remit/data-ports/sync-warning-state";
|
|
4
3
|
import { logger } from "@remit/logger";
|
|
5
|
-
import { env } from "expect-env";
|
|
6
|
-
import { getAccountConfigIdFromEvent, getSubFromEvent } from "../auth.js";
|
|
7
|
-
import { getClient } from "../service/data-client.js";
|
|
8
|
-
import { sqsClient } from "../service/sqs.js";
|
|
9
4
|
import { toVipSuggestionEntry } from "./vip-suggestions.js";
|
|
10
5
|
const DOWNLOAD_URL_TTL_SECONDS = 60 * 60;
|
|
11
6
|
const SURFACED_WARNING_CAP = 200;
|
|
12
7
|
export const MeOperations = {
|
|
13
|
-
MeOperations_listVipSuggestions: async (_context,
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const { address } = await getClient();
|
|
8
|
+
MeOperations_listVipSuggestions: async (_context, ctx) => {
|
|
9
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
10
|
+
const { address } = ctx.client;
|
|
17
11
|
const items = await address.listSuggestedVips({ accountConfigId });
|
|
18
12
|
return { suggestions: items.map(toVipSuggestionEntry) };
|
|
19
13
|
},
|
|
20
|
-
MeOperations_listQuarantine: async (_context,
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const { quarantine, syncWarning } = await getClient();
|
|
14
|
+
MeOperations_listQuarantine: async (_context, ctx) => {
|
|
15
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
16
|
+
const { quarantine, syncWarning } = ctx.client;
|
|
24
17
|
const [entries, warnings] = await Promise.all([
|
|
25
18
|
quarantine.listByAccountConfigId(accountConfigId),
|
|
26
19
|
syncWarning.listSurfacedByAccountConfigId(accountConfigId, SYNC_WARNING_SURFACE_ATTEMPTS, SURFACED_WARNING_CAP),
|
|
@@ -31,21 +24,18 @@ export const MeOperations = {
|
|
|
31
24
|
warningsTotal: warnings.total,
|
|
32
25
|
};
|
|
33
26
|
},
|
|
34
|
-
MeOperations_deleteMe: async (
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const callerEmail =
|
|
27
|
+
MeOperations_deleteMe: async (context, ctx) => {
|
|
28
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
29
|
+
const { confirmEmail } = context.request
|
|
30
|
+
.requestBody;
|
|
31
|
+
const callerEmail = ctx.identity.email;
|
|
39
32
|
if (typeof confirmEmail !== "string" || confirmEmail.trim() === "") {
|
|
40
33
|
throw new BadRequestError("confirmEmail is required");
|
|
41
34
|
}
|
|
42
|
-
if (!callerEmail) {
|
|
43
|
-
throw new BadRequestError("Account email claim missing from token");
|
|
44
|
-
}
|
|
45
35
|
if (confirmEmail.toLowerCase() !== callerEmail.toLowerCase()) {
|
|
46
36
|
throw new BadRequestError("confirmEmail does not match your account email");
|
|
47
37
|
}
|
|
48
|
-
const { accountConfig } =
|
|
38
|
+
const { accountConfig } = ctx.client;
|
|
49
39
|
try {
|
|
50
40
|
await accountConfig.update(accountConfigId, {
|
|
51
41
|
state: "deleting",
|
|
@@ -64,14 +54,9 @@ export const MeOperations = {
|
|
|
64
54
|
}
|
|
65
55
|
throw err;
|
|
66
56
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
MessageBody: JSON.stringify({
|
|
71
|
-
type: "AccountDelete",
|
|
72
|
-
accountConfigId,
|
|
73
|
-
}),
|
|
74
|
-
}));
|
|
57
|
+
await ctx.client.queues.accountFanout.send({
|
|
58
|
+
body: { type: "AccountDelete", accountConfigId },
|
|
59
|
+
});
|
|
75
60
|
// biome-ignore lint/plugin/no-logger-info: account deletion is an audit-grade signal
|
|
76
61
|
logger.info({ accountConfigId }, "Account deletion initiated");
|
|
77
62
|
return {
|
|
@@ -79,27 +64,22 @@ export const MeOperations = {
|
|
|
79
64
|
message: "Account deletion initiated",
|
|
80
65
|
};
|
|
81
66
|
},
|
|
82
|
-
MeOperations_createExport: async (_context,
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
if (!userId) {
|
|
87
|
-
throw new Error("Missing Cognito `sub`: cannot attribute an export request to a user");
|
|
88
|
-
}
|
|
89
|
-
const { accountExportRequest } = await getClient();
|
|
67
|
+
MeOperations_createExport: async (_context, ctx) => {
|
|
68
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
69
|
+
const userId = ctx.identity.sub;
|
|
70
|
+
const { accountExportRequest } = ctx.client;
|
|
90
71
|
const exportRequest = await accountExportRequest.create({
|
|
91
72
|
accountConfigId,
|
|
92
73
|
userId,
|
|
93
74
|
state: "Pending",
|
|
94
75
|
});
|
|
95
|
-
await
|
|
96
|
-
|
|
97
|
-
MessageBody: JSON.stringify({
|
|
76
|
+
await ctx.client.queues.accountFanout.send({
|
|
77
|
+
body: {
|
|
98
78
|
type: "AccountExport",
|
|
99
79
|
accountConfigId,
|
|
100
80
|
accountExportRequestId: exportRequest.accountExportRequestId,
|
|
101
|
-
}
|
|
102
|
-
})
|
|
81
|
+
},
|
|
82
|
+
});
|
|
103
83
|
// biome-ignore lint/plugin/no-logger-info: account export is an audit-grade signal
|
|
104
84
|
logger.info({
|
|
105
85
|
accountConfigId,
|
|
@@ -110,11 +90,10 @@ export const MeOperations = {
|
|
|
110
90
|
exportId: exportRequest.accountExportRequestId,
|
|
111
91
|
};
|
|
112
92
|
},
|
|
113
|
-
MeOperations_getExport: async (context,
|
|
114
|
-
const
|
|
115
|
-
const accountConfigId = getAccountConfigIdFromEvent(event);
|
|
93
|
+
MeOperations_getExport: async (context, ctx) => {
|
|
94
|
+
const accountConfigId = ctx.identity.accountConfigId;
|
|
116
95
|
const exportId = context.request.params.exportId;
|
|
117
|
-
const { accountExportRequest, storage } =
|
|
96
|
+
const { accountExportRequest, storage } = ctx.client;
|
|
118
97
|
const exportRequest = await accountExportRequest.get(exportId);
|
|
119
98
|
if (exportRequest.accountConfigId !== accountConfigId) {
|
|
120
99
|
throw new NotFoundError(`Export not found: ${exportId}`);
|
|
@@ -26,9 +26,7 @@ export declare const extractAccountIdsFromBodyKey: (uri: string) => {
|
|
|
26
26
|
* populating `contentUrl` from the CloudFront distribution domain. Pure
|
|
27
27
|
* function so the URL-construction contract can be pinned in tests without
|
|
28
28
|
* standing up the full handler. The contract requires every `contentUrl`
|
|
29
|
-
* to be a real URL (#299)
|
|
30
|
-
* Lambda env is missing the domain, and this function expects a non-empty
|
|
31
|
-
* string from the caller.
|
|
29
|
+
* to be a real URL (#299), so the API refuses to start without the domain.
|
|
32
30
|
*/
|
|
33
31
|
export interface BodyPartLike {
|
|
34
32
|
bodyPartId: string;
|
|
@@ -80,5 +78,5 @@ export declare const GENERIC_FAILURE_REASON = "This message could not be process
|
|
|
80
78
|
* regardless of batch size.
|
|
81
79
|
*/
|
|
82
80
|
export declare const settleSpamReportBulk: (messageIds: string[], run: (messageId: string) => Promise<void>) => Promise<SpamReportBulkOutcome>;
|
|
83
|
-
export declare const MessageOperations: Record<MessageOperationIds, OperationHandler<MessageOperationIds>>;
|
|
84
|
-
export declare const MessageBulkOperations: Record<MessageBulkOperationIds, OperationHandler<MessageBulkOperationIds>>;
|
|
81
|
+
export declare const MessageOperations: Record<MessageOperationIds, OperationHandler<MessageOperationIds, "sync" | "messageManagement" | "body">>;
|
|
82
|
+
export declare const MessageBulkOperations: Record<MessageBulkOperationIds, OperationHandler<MessageBulkOperationIds, "sync" | "messageManagement" | "body">>;
|