@remit/data-ports 0.0.1

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.
@@ -0,0 +1,14 @@
1
+ import type {
2
+ AccountSettingItem,
3
+ UpsertAccountSettingInput,
4
+ } from "../types.js";
5
+
6
+ export interface IAccountSettingRepository {
7
+ get(
8
+ accountConfigId: string,
9
+ name: string,
10
+ ): Promise<AccountSettingItem | null>;
11
+ listByAccountConfig(accountConfigId: string): Promise<AccountSettingItem[]>;
12
+ upsert(input: UpsertAccountSettingInput): Promise<AccountSettingItem>;
13
+ delete(accountConfigId: string, name: string): Promise<void>;
14
+ }
@@ -0,0 +1,40 @@
1
+ import type {
2
+ AccountDescription,
3
+ AccountItem,
4
+ AccountSchedulerPage,
5
+ CreateAccountInput,
6
+ ResultList,
7
+ UpdateAccountInput,
8
+ } from "../types.js";
9
+
10
+ export interface IAccountRepository {
11
+ create(input: CreateAccountInput): Promise<AccountItem>;
12
+ get(accountId: string): Promise<AccountItem>;
13
+ get(accountIds: string[]): Promise<AccountItem[]>;
14
+ update(
15
+ accountId: string,
16
+ input: UpdateAccountInput,
17
+ remove?: string[],
18
+ ): Promise<AccountItem>;
19
+ markAuthenticated(accountId: string): Promise<AccountItem>;
20
+ delete(accountId: string): Promise<void>;
21
+ deleteMany(accountIds: string[]): Promise<void>;
22
+ list(
23
+ accountConfigId: string,
24
+ options?: { limit?: number; continuationToken?: string },
25
+ ): Promise<ResultList<AccountItem>>;
26
+ listAllByAccountConfig(accountConfigId: string): Promise<AccountItem[]>;
27
+ describe(accountId: string): Promise<AccountDescription>;
28
+ listAll(): Promise<AccountItem[]>;
29
+ incrementMailboxSynced(accountId: string): Promise<AccountItem>;
30
+ /**
31
+ * Page through every account system-wide, oldest-created first, for the
32
+ * scheduled-sync tick (#1247). Unlike `list()` this is not accountConfig
33
+ * scoped and the cursor is a raw backend-native token (no salt/tamper
34
+ * checking) — internal use only, never exposed over the API.
35
+ */
36
+ listAllAccountsPage(options?: {
37
+ limit?: number;
38
+ cursor?: string;
39
+ }): Promise<AccountSchedulerPage>;
40
+ }
@@ -0,0 +1,82 @@
1
+ import type {
2
+ AddressItem,
3
+ CreateAddressInput,
4
+ CreateEnvelopeAddressInput,
5
+ EnvelopeAddressItem,
6
+ FlagsMergePatch,
7
+ ResultList,
8
+ UpdateAddressInput,
9
+ } from "../types.js";
10
+
11
+ export interface IAddressRepository {
12
+ createAddress(input: CreateAddressInput): Promise<AddressItem>;
13
+ upsertAddress(input: CreateAddressInput): Promise<AddressItem>;
14
+ getAddress(accountConfigId: string, addressId: string): Promise<AddressItem>;
15
+ getAddress(
16
+ accountConfigId: string,
17
+ addressIds: string[],
18
+ ): Promise<AddressItem[]>;
19
+ updateAddress(
20
+ accountConfigId: string,
21
+ addressId: string,
22
+ input: UpdateAddressInput,
23
+ ): Promise<AddressItem>;
24
+ mergeFlags(
25
+ accountConfigId: string,
26
+ addressId: string,
27
+ patch: FlagsMergePatch,
28
+ ): Promise<AddressItem>;
29
+ promoteWellknownByUser(
30
+ accountConfigId: string,
31
+ addressId: string,
32
+ now: number,
33
+ ): Promise<AddressItem>;
34
+ demoteSenderTrust(
35
+ accountConfigId: string,
36
+ addressId: string,
37
+ now: number,
38
+ ): Promise<AddressItem>;
39
+ deleteAddress(accountConfigId: string, addressId: string): Promise<void>;
40
+ incrementInboundCount(
41
+ accountConfigId: string,
42
+ addressId: string,
43
+ now: number,
44
+ isBulk?: boolean,
45
+ ): Promise<void>;
46
+ incrementOutboundCount(
47
+ accountConfigId: string,
48
+ addressId: string,
49
+ now: number,
50
+ ): Promise<void>;
51
+ incrementReplyCount(
52
+ accountConfigId: string,
53
+ addressId: string,
54
+ now: number,
55
+ ): Promise<void>;
56
+ deleteManyAddresses(
57
+ accountConfigId: string,
58
+ addressIds: string[],
59
+ ): Promise<void>;
60
+ listSuggestedVips(input: {
61
+ accountConfigId: string;
62
+ limit?: number;
63
+ }): Promise<AddressItem[]>;
64
+ listByAccountConfig(input: {
65
+ accountConfigId: string;
66
+ normalizedCompound?: string;
67
+ cursor?: string;
68
+ limit?: number;
69
+ }): Promise<ResultList<AddressItem>>;
70
+ createEnvelopeAddress(
71
+ input: CreateEnvelopeAddressInput,
72
+ ): Promise<EnvelopeAddressItem>;
73
+ upsertEnvelopeAddress(
74
+ input: CreateEnvelopeAddressInput,
75
+ ): Promise<EnvelopeAddressItem>;
76
+ getEnvelopeAddress(envelopeAddressId: string): Promise<EnvelopeAddressItem>;
77
+ getEnvelopeAddress(
78
+ envelopeAddressIds: string[],
79
+ ): Promise<EnvelopeAddressItem[]>;
80
+ deleteEnvelopeAddress(envelopeAddressId: string): Promise<void>;
81
+ deleteManyEnvelopeAddresses(envelopeAddressIds: string[]): Promise<void>;
82
+ }
@@ -0,0 +1,32 @@
1
+ import type {
2
+ BodyPartContentUpsertInput,
3
+ BodyPartItem,
4
+ BodyPartUpsertInput,
5
+ CreateEnvelopeInput,
6
+ EnvelopeItem,
7
+ MessageData,
8
+ UpdateEnvelopeInput,
9
+ } from "../types.js";
10
+
11
+ export interface IEnvelopeRepository {
12
+ createEnvelope(input: CreateEnvelopeInput): Promise<EnvelopeItem>;
13
+ upsertEnvelope(input: CreateEnvelopeInput): Promise<EnvelopeItem>;
14
+ getEnvelope(envelopeId: string): Promise<EnvelopeItem>;
15
+ getEnvelope(envelopeIds: string[]): Promise<EnvelopeItem[]>;
16
+ updateEnvelope(
17
+ envelopeId: string,
18
+ input: UpdateEnvelopeInput,
19
+ ): Promise<EnvelopeItem>;
20
+ deleteEnvelope(envelopeId: string): Promise<void>;
21
+ deleteManyEnvelopes(envelopeIds: string[]): Promise<void>;
22
+ upsertBodyParts(
23
+ messageId: string,
24
+ parts: BodyPartUpsertInput[],
25
+ ): Promise<void>;
26
+ upsertBodyPartContents(
27
+ messageId: string,
28
+ contents: BodyPartContentUpsertInput[],
29
+ ): Promise<void>;
30
+ getMessageData(messageId: string): Promise<MessageData>;
31
+ listBodyParts(messageId: string): Promise<BodyPartItem[]>;
32
+ }
@@ -0,0 +1,11 @@
1
+ import type { CreateFilterAnchorInput, FilterAnchorItem } from "../types.js";
2
+
3
+ export interface IFilterAnchorRepository {
4
+ put(input: CreateFilterAnchorInput): Promise<FilterAnchorItem>;
5
+ get(
6
+ accountConfigId: string,
7
+ filterId: string,
8
+ ): Promise<FilterAnchorItem | null>;
9
+ listByAccountConfig(accountConfigId: string): Promise<FilterAnchorItem[]>;
10
+ delete(accountConfigId: string, filterId: string): Promise<void>;
11
+ }
@@ -0,0 +1,41 @@
1
+ import type {
2
+ CreateFilterInput,
3
+ FilterItem,
4
+ ResultList,
5
+ UpdateFilterInput,
6
+ } from "../types.js";
7
+
8
+ export interface IFilterRepository {
9
+ create(input: CreateFilterInput): Promise<FilterItem>;
10
+ get(accountConfigId: string, filterId: string): Promise<FilterItem>;
11
+ update(
12
+ accountConfigId: string,
13
+ filterId: string,
14
+ input: UpdateFilterInput,
15
+ ): Promise<FilterItem>;
16
+ delete(accountConfigId: string, filterId: string): Promise<void>;
17
+ listByAccountConfig(accountConfigId: string): Promise<FilterItem[]>;
18
+ /**
19
+ * A single signed page of an account config's filters via the primary index —
20
+ * the settings-page/API list (RFC 034). Mirrors
21
+ * `IMailboxRepository.listByAccount`, so the API surface paginates identically
22
+ * to `listMailboxes`; `continuationToken` round-trips a backend-native cursor.
23
+ */
24
+ listPageByAccountConfig(
25
+ accountConfigId: string,
26
+ options?: { limit?: number; continuationToken?: string },
27
+ ): Promise<ResultList<FilterItem>>;
28
+ listByAccountAndState(
29
+ accountConfigId: string,
30
+ state: FilterItem["state"],
31
+ ): Promise<FilterItem[]>;
32
+ /**
33
+ * Lazily patch a Temporary filter read past its `expiresAt` to `Expired` and
34
+ * return the refreshed row (RFC 034 Decision 1.2). `expiresAt`/`now` are the
35
+ * source of truth for whether a filter is still active — `state` is only a
36
+ * cache of that comparison, refreshed here on whatever read touches the row
37
+ * next. A no-op (returns the item unchanged) for a Standing filter or one
38
+ * already Expired.
39
+ */
40
+ refreshExpiry(item: FilterItem): Promise<FilterItem>;
41
+ }
@@ -0,0 +1,21 @@
1
+ import type {
2
+ CreateLabelInput,
3
+ LabelItem,
4
+ UpdateLabelInput,
5
+ } from "../types.js";
6
+
7
+ export interface ILabelRepository {
8
+ create(input: CreateLabelInput): Promise<LabelItem>;
9
+ get(accountConfigId: string, labelId: string): Promise<LabelItem>;
10
+ update(
11
+ accountConfigId: string,
12
+ labelId: string,
13
+ input: UpdateLabelInput,
14
+ ): Promise<LabelItem>;
15
+ delete(accountConfigId: string, labelId: string): Promise<void>;
16
+ listByAccountConfig(accountConfigId: string): Promise<LabelItem[]>;
17
+ findByNormalizedName(
18
+ accountConfigId: string,
19
+ normalizedName: string,
20
+ ): Promise<LabelItem | null>;
21
+ }
@@ -0,0 +1,31 @@
1
+ import type { MailboxLockItem, WithMailboxLockResult } from "../types.js";
2
+
3
+ export interface IMailboxLockRepository {
4
+ tryAcquireLock(
5
+ mailboxId: string,
6
+ eventName: string,
7
+ accountId: string,
8
+ lockId: string,
9
+ ): Promise<boolean>;
10
+ releaseLock(
11
+ accountId: string,
12
+ mailboxId: string,
13
+ eventName: string,
14
+ lockId: string,
15
+ ): Promise<void>;
16
+ withMailboxLock<T>(
17
+ mailboxId: string,
18
+ eventName: string,
19
+ accountId: string,
20
+ operation: () => Promise<T>,
21
+ options?: { lockId?: string },
22
+ ): Promise<WithMailboxLockResult<T>>;
23
+ get(
24
+ accountId: string,
25
+ mailboxId: string,
26
+ eventName: string,
27
+ ): Promise<MailboxLockItem | null>;
28
+ listAllLocks(): Promise<MailboxLockItem[]>;
29
+ listByAccount(accountId: string): Promise<MailboxLockItem[]>;
30
+ deleteByAccount(accountId: string): Promise<void>;
31
+ }
@@ -0,0 +1,33 @@
1
+ import type {
2
+ MailboxSpecialUseItem,
3
+ MailboxSpecialUseValue,
4
+ } from "../types.js";
5
+
6
+ export interface IMailboxSpecialUseRepository {
7
+ create(
8
+ mailboxId: string,
9
+ specialUse: MailboxSpecialUseValue,
10
+ ): Promise<MailboxSpecialUseItem>;
11
+ createMany(
12
+ mailboxId: string,
13
+ specialUses: MailboxSpecialUseValue[],
14
+ ): Promise<MailboxSpecialUseItem[]>;
15
+ listByMailboxId(mailboxId: string): Promise<MailboxSpecialUseItem[]>;
16
+ deleteByMailboxId(mailboxId: string): Promise<number>;
17
+ findBySpecialUse(
18
+ accountId: string,
19
+ specialUse: MailboxSpecialUseValue,
20
+ ): Promise<{ mailboxId: string; fullPath: string } | null>;
21
+ findInboxMailbox(
22
+ accountId: string,
23
+ ): Promise<{ mailboxId: string; fullPath: string } | null>;
24
+ findTrashMailbox(
25
+ accountId: string,
26
+ ): Promise<{ mailboxId: string; fullPath: string } | null>;
27
+ findArchiveMailbox(
28
+ accountId: string,
29
+ ): Promise<{ mailboxId: string; fullPath: string } | null>;
30
+ findJunkMailbox(
31
+ accountId: string,
32
+ ): Promise<{ mailboxId: string; fullPath: string } | null>;
33
+ }
@@ -0,0 +1,59 @@
1
+ import type {
2
+ CreateMailboxInput,
3
+ MailboxItem,
4
+ ResultList,
5
+ UpdateMailboxInput,
6
+ } from "../types.js";
7
+
8
+ export interface IMailboxRepository {
9
+ create(input: CreateMailboxInput): Promise<MailboxItem>;
10
+ get(accountId: string, mailboxId: string): Promise<MailboxItem>;
11
+ get(accountId: string, mailboxIds: string[]): Promise<MailboxItem[]>;
12
+ /**
13
+ * Resolve the owning accountId for a mailbox by its (globally unique) id,
14
+ * without a tenant scope. Returns only the owner id (no row content); null
15
+ * when the mailbox does not exist.
16
+ *
17
+ * The result is NOT a trusted tenant — it is derived from the row, so it must
18
+ * never be fed back as the scope of a request-facing read. It has two uses:
19
+ * pure system routing/indexing that has no tenant of its own (stream bridge,
20
+ * search indexer), and ownership bootstrap where a request-facing caller
21
+ * compares the resolved owner's accountConfigId against its OWN authenticated
22
+ * accountConfigId to decide the caller may proceed.
23
+ */
24
+ resolveAccountId(mailboxId: string): Promise<string | null>;
25
+ update(
26
+ accountId: string,
27
+ mailboxId: string,
28
+ input: UpdateMailboxInput,
29
+ remove?: string[],
30
+ ): Promise<MailboxItem>;
31
+ delete(accountId: string, mailboxId: string): Promise<void>;
32
+ deleteMany(accountId: string, mailboxIds: string[]): Promise<void>;
33
+ listByAccount(
34
+ accountId: string,
35
+ options?: { limit?: number; continuationToken?: string },
36
+ ): Promise<ResultList<MailboxItem>>;
37
+ listAllByAccount(accountId: string): Promise<MailboxItem[]>;
38
+ findByPath(accountId: string, fullPath: string): Promise<MailboxItem | null>;
39
+ getOrCreateByPath(
40
+ accountId: string,
41
+ fullPath: string,
42
+ defaults: Omit<CreateMailboxInput, "accountId" | "fullPath">,
43
+ ): Promise<MailboxItem>;
44
+ findByPathPrefix(
45
+ accountId: string,
46
+ pathPrefix: string,
47
+ delimiter?: string,
48
+ ): Promise<MailboxItem[]>;
49
+ findBySyncStatus(
50
+ accountId: string,
51
+ syncStatus: NonNullable<MailboxItem["syncStatus"]>,
52
+ ): Promise<MailboxItem[]>;
53
+ renameChildPaths(
54
+ accountId: string,
55
+ oldPath: string,
56
+ newPath: string,
57
+ delimiter?: string,
58
+ ): Promise<void>;
59
+ }
@@ -0,0 +1,17 @@
1
+ import type { MessageFlagPushItem, PutMessageFlagPushInput } from "../types.js";
2
+
3
+ export interface IMessageFlagPushRepository {
4
+ put(input: PutMessageFlagPushInput): Promise<MessageFlagPushItem>;
5
+ find(
6
+ messageId: string,
7
+ flagName: string,
8
+ ): Promise<MessageFlagPushItem | null>;
9
+ updateState(
10
+ messageId: string,
11
+ flagName: string,
12
+ state: MessageFlagPushItem["state"],
13
+ ): Promise<MessageFlagPushItem>;
14
+ delete(messageId: string, flagName: string): Promise<void>;
15
+ listByAccountId(accountId: string): Promise<MessageFlagPushItem[]>;
16
+ listByMailboxId(mailboxId: string): Promise<MessageFlagPushItem[]>;
17
+ }
@@ -0,0 +1,15 @@
1
+ import type { CreateMessageFlagInput, MessageFlagItem } from "../types.js";
2
+
3
+ export interface IMessageFlagRepository {
4
+ create(input: CreateMessageFlagInput): Promise<MessageFlagItem>;
5
+ get(messageFlagId: string): Promise<MessageFlagItem>;
6
+ get(messageFlagIds: string[]): Promise<MessageFlagItem[]>;
7
+ delete(messageFlagId: string): Promise<void>;
8
+ deleteMany(messageFlagIds: string[]): Promise<void>;
9
+ getFlags(messageId: string): Promise<MessageFlagItem[]>;
10
+ hasFlag(messageId: string, flagName: string): Promise<boolean>;
11
+ addFlag(messageId: string, flagName: string): Promise<MessageFlagItem>;
12
+ removeFlag(messageId: string, flagName: string): Promise<void>;
13
+ addFlags(messageId: string, flagNames: string[]): Promise<void>;
14
+ removeFlags(messageId: string, flagNames: string[]): Promise<void>;
15
+ }
@@ -0,0 +1,11 @@
1
+ import type { CreateMessageLabelInput, MessageLabelItem } from "../types.js";
2
+
3
+ export interface IMessageLabelRepository {
4
+ apply(input: CreateMessageLabelInput): Promise<MessageLabelItem>;
5
+ remove(messageId: string, labelId: string): Promise<void>;
6
+ listByMessageId(messageId: string): Promise<MessageLabelItem[]>;
7
+ listByLabelId(
8
+ accountConfigId: string,
9
+ labelId: string,
10
+ ): Promise<MessageLabelItem[]>;
11
+ }
@@ -0,0 +1,15 @@
1
+ import type {
2
+ MessagePlacementMoveItem,
3
+ PutMessagePlacementMoveInput,
4
+ } from "../types.js";
5
+
6
+ export interface IMessagePlacementMoveRepository {
7
+ put(input: PutMessagePlacementMoveInput): Promise<MessagePlacementMoveItem>;
8
+ find(messageId: string): Promise<MessagePlacementMoveItem | null>;
9
+ updateState(
10
+ messageId: string,
11
+ state: MessagePlacementMoveItem["state"],
12
+ ): Promise<MessagePlacementMoveItem>;
13
+ delete(messageId: string): Promise<void>;
14
+ listByAccountId(accountId: string): Promise<MessagePlacementMoveItem[]>;
15
+ }
@@ -0,0 +1,40 @@
1
+ import type {
2
+ CreateMessageInput,
3
+ MessageDescription,
4
+ MessageIdSource,
5
+ MessageItem,
6
+ ResultList,
7
+ UpdateMessageInput,
8
+ UpdateMessageMoveInput,
9
+ } from "../types.js";
10
+
11
+ export interface IMessageRepository {
12
+ create(input: CreateMessageInput): Promise<MessageItem>;
13
+ upsert(input: CreateMessageInput): Promise<MessageItem>;
14
+ upsertWithStatus(
15
+ input: CreateMessageInput,
16
+ ): Promise<{ item: MessageItem; created: boolean }>;
17
+ get(messageId: string): Promise<MessageItem>;
18
+ get(messageIds: string[]): Promise<MessageItem[]>;
19
+ update(messageId: string, input: UpdateMessageInput): Promise<MessageItem>;
20
+ clearBodyStorageKey(messageId: string): Promise<MessageItem>;
21
+ delete(messageId: string): Promise<void>;
22
+ deleteMany(messageIds: string[]): Promise<void>;
23
+ listByMailbox(
24
+ mailboxId: string,
25
+ options?: { limit?: number; continuationToken?: string },
26
+ ): Promise<ResultList<MessageItem>>;
27
+ listAllByMailbox(mailboxId: string): Promise<MessageItem[]>;
28
+ describe(messageId: string): Promise<MessageDescription>;
29
+ updateForMove(
30
+ messageId: string,
31
+ input: UpdateMessageMoveInput,
32
+ ): Promise<MessageItem>;
33
+ updateUid(
34
+ messageId: string,
35
+ newUid: number,
36
+ newMailboxId: string,
37
+ ): Promise<MessageItem>;
38
+ }
39
+
40
+ export type { MessageIdSource };
@@ -0,0 +1,19 @@
1
+ import type {
2
+ CreateOrganizeJobRequestInput,
3
+ OrganizeJobRequestItem,
4
+ ResultList,
5
+ UpdateOrganizeJobRequestInput,
6
+ } from "../types.js";
7
+
8
+ export interface IOrganizeJobRequestRepository {
9
+ create(input: CreateOrganizeJobRequestInput): Promise<OrganizeJobRequestItem>;
10
+ get(organizeJobId: string): Promise<OrganizeJobRequestItem>;
11
+ update(
12
+ organizeJobId: string,
13
+ input: UpdateOrganizeJobRequestInput,
14
+ ): Promise<OrganizeJobRequestItem>;
15
+ listByAccountConfig(
16
+ accountConfigId: string,
17
+ options?: { limit?: number; continuationToken?: string },
18
+ ): Promise<ResultList<OrganizeJobRequestItem>>;
19
+ }
@@ -0,0 +1,51 @@
1
+ import type {
2
+ CreateOutboxMessageInput,
3
+ OutboxMessageItem,
4
+ ResultList,
5
+ UpdateOutboxMessageInput,
6
+ } from "../types.js";
7
+
8
+ export interface IOutboxMessageRepository {
9
+ create(input: CreateOutboxMessageInput): Promise<OutboxMessageItem>;
10
+ /**
11
+ * `mode: "read"` (default) throws NotFoundError on a foreign message so a
12
+ * GET doesn't leak existence. `mode: "act"` throws ForbiddenError instead,
13
+ * for action verbs (PATCH/POST/DELETE) where the caller has already named
14
+ * the resource and the API contract says to explicitly deny rather than
15
+ * feign 404 — see assertAccountOwnership / assertMessagesOwned.
16
+ */
17
+ get(
18
+ accountConfigId: string,
19
+ outboxMessageId: string,
20
+ mode?: "read" | "act",
21
+ ): Promise<OutboxMessageItem>;
22
+ get(
23
+ accountConfigId: string,
24
+ outboxMessageIds: string[],
25
+ ): Promise<OutboxMessageItem[]>;
26
+ update(
27
+ accountConfigId: string,
28
+ outboxMessageId: string,
29
+ input: UpdateOutboxMessageInput,
30
+ ): Promise<OutboxMessageItem>;
31
+ updateStatus(
32
+ accountConfigId: string,
33
+ outboxMessageId: string,
34
+ status: OutboxMessageItem["status"],
35
+ ): Promise<OutboxMessageItem>;
36
+ markSent(
37
+ accountConfigId: string,
38
+ outboxMessageId: string,
39
+ fields: { sentAt: number; smtpMessageId?: string },
40
+ ): Promise<OutboxMessageItem>;
41
+ delete(accountConfigId: string, outboxMessageId: string): Promise<void>;
42
+ deleteMany(
43
+ accountConfigId: string,
44
+ outboxMessageIds: string[],
45
+ ): Promise<void>;
46
+ listByAccount(
47
+ accountId: string,
48
+ options?: { limit?: number; continuationToken?: string },
49
+ ): Promise<ResultList<OutboxMessageItem>>;
50
+ listQueued(accountId: string): Promise<OutboxMessageItem[]>;
51
+ }
@@ -0,0 +1,122 @@
1
+ import type {
2
+ CreateThreadMessageInput,
3
+ ResultList,
4
+ SearchOptions,
5
+ ThreadMessageItem,
6
+ UpdateThreadMessageInput,
7
+ } from "../types.js";
8
+
9
+ export interface IThreadMessageRepository {
10
+ create(input: CreateThreadMessageInput): Promise<ThreadMessageItem>;
11
+ get(
12
+ accountConfigId: string,
13
+ threadMessageId: string,
14
+ ): Promise<ThreadMessageItem>;
15
+ get(
16
+ accountConfigId: string,
17
+ threadMessageIds: string[],
18
+ ): Promise<ThreadMessageItem[]>;
19
+ update(
20
+ accountConfigId: string,
21
+ threadMessageId: string,
22
+ input: UpdateThreadMessageInput,
23
+ options?: {
24
+ composites?: {
25
+ sentDate?: number;
26
+ mailboxId?: string;
27
+ isRead?: boolean;
28
+ isDeleted?: boolean;
29
+ hasStars?: boolean;
30
+ hasAttachment?: boolean;
31
+ };
32
+ },
33
+ ): Promise<ThreadMessageItem>;
34
+ delete(accountConfigId: string, threadMessageId: string): Promise<void>;
35
+ deleteMany(
36
+ keys: Array<{ accountConfigId: string; threadMessageId: string }>,
37
+ ): Promise<void>;
38
+ listByAccount(
39
+ accountConfigId: string,
40
+ options?: { limit?: number; continuationToken?: string },
41
+ ): Promise<ResultList<ThreadMessageItem>>;
42
+ listByDate(
43
+ accountConfigId: string,
44
+ options?: {
45
+ order?: "asc" | "desc";
46
+ limit?: number;
47
+ continuationToken?: string;
48
+ inboxMailboxIds?: Set<string>;
49
+ excludeDeleted?: boolean;
50
+ },
51
+ ): Promise<ResultList<ThreadMessageItem>>;
52
+ listByThread(
53
+ threadId: string,
54
+ accountConfigId: string,
55
+ options?: {
56
+ order?: "asc" | "desc";
57
+ limit?: number;
58
+ continuationToken?: string;
59
+ mailboxId?: string;
60
+ excludeDeleted?: boolean;
61
+ },
62
+ ): Promise<ResultList<ThreadMessageItem>>;
63
+ findByMessageId(
64
+ accountConfigId: string,
65
+ messageId: string,
66
+ ): Promise<ThreadMessageItem | null>;
67
+ findAllByMessageId(
68
+ accountConfigId: string,
69
+ messageId: string,
70
+ ): Promise<ThreadMessageItem[]>;
71
+ getByMessageId(
72
+ accountConfigId: string,
73
+ messageId: string,
74
+ ): Promise<ThreadMessageItem>;
75
+ listByMailbox(
76
+ accountConfigId: string,
77
+ mailboxId: string,
78
+ options?: {
79
+ order?: "asc" | "desc";
80
+ limit?: number;
81
+ continuationToken?: string;
82
+ attributes?: string[];
83
+ excludeDeleted?: boolean;
84
+ },
85
+ ): Promise<ResultList<ThreadMessageItem>>;
86
+ countByThread(accountConfigId: string, threadId: string): Promise<number>;
87
+ searchByMailbox(
88
+ accountConfigId: string,
89
+ mailboxId: string,
90
+ search: SearchOptions,
91
+ options?: {
92
+ order?: "asc" | "desc";
93
+ count?: number;
94
+ continuationToken?: string;
95
+ excludeDeleted?: boolean;
96
+ },
97
+ ): Promise<ResultList<ThreadMessageItem>>;
98
+ searchByMailboxWindow(
99
+ accountConfigId: string,
100
+ mailboxId: string,
101
+ search: SearchOptions,
102
+ options?: {
103
+ order?: "asc" | "desc";
104
+ limit?: number;
105
+ continuationToken?: string;
106
+ attributes?: string[];
107
+ excludeDeleted?: boolean;
108
+ },
109
+ ): Promise<ResultList<ThreadMessageItem>>;
110
+ countByMailbox(
111
+ accountConfigId: string,
112
+ mailboxId: string,
113
+ search: SearchOptions,
114
+ options?: {
115
+ limit?: number;
116
+ excludeDeleted?: boolean;
117
+ order?: "asc" | "desc";
118
+ },
119
+ ): Promise<number>;
120
+ listAllByAccount(accountConfigId: string): Promise<ThreadMessageItem[]>;
121
+ deleteAllByAccount(accountConfigId: string): Promise<number>;
122
+ }