@remit/data-ports 0.0.83 → 0.0.85

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.
Files changed (174) hide show
  1. package/dist/account-settings.d.ts +371 -0
  2. package/dist/account-settings.js +114 -0
  3. package/dist/conformance/account.d.ts +3 -0
  4. package/dist/conformance/account.js +118 -0
  5. package/dist/conformance/calendar-collection.d.ts +3 -0
  6. package/dist/conformance/calendar-collection.js +251 -0
  7. package/dist/conformance/calendar-event-index.d.ts +3 -0
  8. package/dist/conformance/calendar-event-index.js +114 -0
  9. package/dist/conformance/calendar-feed-token.d.ts +3 -0
  10. package/dist/conformance/calendar-feed-token.js +97 -0
  11. package/dist/conformance/calendar-object.d.ts +3 -0
  12. package/dist/conformance/calendar-object.js +156 -0
  13. package/dist/conformance/calendar-suggestion.d.ts +3 -0
  14. package/dist/conformance/calendar-suggestion.js +255 -0
  15. package/{src/conformance/harness.ts → dist/conformance/harness.d.ts} +4 -4
  16. package/dist/conformance/harness.js +1 -0
  17. package/dist/conformance/index.js +8 -0
  18. package/dist/conformance/label.d.ts +3 -0
  19. package/dist/conformance/label.js +92 -0
  20. package/dist/conformance/sender-signer-standing.d.ts +3 -0
  21. package/dist/conformance/sender-signer-standing.js +81 -0
  22. package/dist/display-name.d.ts +1 -0
  23. package/dist/display-name.js +26 -0
  24. package/dist/errors.d.ts +150 -0
  25. package/dist/errors.js +181 -0
  26. package/dist/filter-ttl.d.ts +7 -0
  27. package/{src/filter-ttl.ts → dist/filter-ttl.js} +8 -11
  28. package/dist/folder-role.d.ts +239 -0
  29. package/dist/folder-role.js +276 -0
  30. package/dist/id.d.ts +124 -0
  31. package/{src/id.ts → dist/id.js} +41 -127
  32. package/dist/index.d.ts +37 -0
  33. package/dist/index.js +5 -0
  34. package/dist/interfaces/account-config.d.ts +15 -0
  35. package/dist/interfaces/account-config.js +1 -0
  36. package/dist/interfaces/account-export-request.d.ts +10 -0
  37. package/dist/interfaces/account-export-request.js +1 -0
  38. package/dist/interfaces/account-setting.d.ts +8 -0
  39. package/dist/interfaces/account-setting.js +1 -0
  40. package/dist/interfaces/account.d.ts +29 -0
  41. package/dist/interfaces/account.js +1 -0
  42. package/dist/interfaces/address.d.ts +70 -0
  43. package/dist/interfaces/address.js +1 -0
  44. package/dist/interfaces/calendar-collection.d.ts +38 -0
  45. package/dist/interfaces/calendar-collection.js +1 -0
  46. package/dist/interfaces/calendar-event-index.d.ts +19 -0
  47. package/dist/interfaces/calendar-event-index.js +1 -0
  48. package/dist/interfaces/calendar-feed-token.d.ts +31 -0
  49. package/dist/interfaces/calendar-feed-token.js +1 -0
  50. package/dist/interfaces/calendar-object.d.ts +36 -0
  51. package/dist/interfaces/calendar-object.js +1 -0
  52. package/dist/interfaces/calendar-store.d.ts +93 -0
  53. package/dist/interfaces/calendar-store.js +1 -0
  54. package/dist/interfaces/calendar-suggestion.d.ts +62 -0
  55. package/dist/interfaces/calendar-suggestion.js +1 -0
  56. package/dist/interfaces/config-import.d.ts +8 -0
  57. package/dist/interfaces/config-import.js +1 -0
  58. package/dist/interfaces/envelope.d.ts +24 -0
  59. package/dist/interfaces/envelope.js +1 -0
  60. package/dist/interfaces/filter.d.ts +28 -0
  61. package/dist/interfaces/filter.js +1 -0
  62. package/dist/interfaces/label.d.ts +17 -0
  63. package/dist/interfaces/label.js +1 -0
  64. package/dist/interfaces/mailbox-lock.d.ts +12 -0
  65. package/dist/interfaces/mailbox-lock.js +1 -0
  66. package/dist/interfaces/mailbox-special-use.d.ts +54 -0
  67. package/dist/interfaces/mailbox-special-use.js +1 -0
  68. package/dist/interfaces/mailbox.d.ts +79 -0
  69. package/dist/interfaces/mailbox.js +1 -0
  70. package/dist/interfaces/message-flag-push.d.ts +9 -0
  71. package/dist/interfaces/message-flag-push.js +1 -0
  72. package/dist/interfaces/message-flag.d.ts +14 -0
  73. package/dist/interfaces/message-flag.js +1 -0
  74. package/dist/interfaces/message-label.d.ts +21 -0
  75. package/dist/interfaces/message-label.js +1 -0
  76. package/dist/interfaces/message-placement-move.d.ts +8 -0
  77. package/dist/interfaces/message-placement-move.js +1 -0
  78. package/dist/interfaces/message.d.ts +60 -0
  79. package/dist/interfaces/message.js +1 -0
  80. package/dist/interfaces/organize-job-request.d.ts +10 -0
  81. package/dist/interfaces/organize-job-request.js +1 -0
  82. package/dist/interfaces/outbox-attachment.d.ts +101 -0
  83. package/dist/interfaces/outbox-attachment.js +7 -0
  84. package/dist/interfaces/outbox-message.d.ts +70 -0
  85. package/dist/interfaces/outbox-message.js +20 -0
  86. package/dist/interfaces/quarantine.d.ts +20 -0
  87. package/dist/interfaces/quarantine.js +1 -0
  88. package/dist/interfaces/sender-signer-standing.d.ts +26 -0
  89. package/dist/interfaces/sender-signer-standing.js +1 -0
  90. package/dist/interfaces/sync-warning.d.ts +11 -0
  91. package/dist/interfaces/sync-warning.js +1 -0
  92. package/dist/interfaces/thread-message.d.ts +202 -0
  93. package/dist/interfaces/thread-message.js +1 -0
  94. package/dist/mailbox-name.d.ts +35 -0
  95. package/dist/mailbox-name.js +68 -0
  96. package/dist/message-parts.d.ts +22 -0
  97. package/dist/message-parts.js +18 -0
  98. package/dist/message-settlement.d.ts +35 -0
  99. package/{src/message-settlement.ts → dist/message-settlement.js} +5 -19
  100. package/dist/mutation-events.d.ts +19 -0
  101. package/{src/mutation-events.ts → dist/mutation-events.js} +2 -5
  102. package/dist/sender-mute.d.ts +26 -0
  103. package/{src/sender-mute.ts → dist/sender-mute.js} +12 -34
  104. package/dist/sync-warning-state.d.ts +3 -0
  105. package/dist/sync-warning-state.js +5 -0
  106. package/dist/types.d.ts +491 -0
  107. package/dist/types.js +1 -0
  108. package/dist/update-manifest.d.ts +24 -0
  109. package/dist/update-manifest.js +20 -0
  110. package/dist/virtual-copy.d.ts +8 -0
  111. package/{src/virtual-copy.ts → dist/virtual-copy.js} +10 -15
  112. package/dist/wellknown.d.ts +47 -0
  113. package/{src/wellknown.ts → dist/wellknown.js} +26 -49
  114. package/package.json +44 -79
  115. package/src/account-settings.ts +0 -194
  116. package/src/conformance/account.ts +0 -104
  117. package/src/conformance/calendar-collection.ts +0 -342
  118. package/src/conformance/calendar-event-index.ts +0 -203
  119. package/src/conformance/calendar-feed-token.ts +0 -148
  120. package/src/conformance/calendar-object.ts +0 -269
  121. package/src/conformance/calendar-suggestion.ts +0 -490
  122. package/src/conformance/label.ts +0 -136
  123. package/src/conformance/sender-signer-standing.ts +0 -117
  124. package/src/display-name.test.ts +0 -101
  125. package/src/display-name.ts +0 -40
  126. package/src/errors.ts +0 -244
  127. package/src/folder-role.test.ts +0 -422
  128. package/src/folder-role.ts +0 -447
  129. package/src/id.test.ts +0 -352
  130. package/src/index.ts +0 -170
  131. package/src/interfaces/account-config.ts +0 -25
  132. package/src/interfaces/account-export-request.ts +0 -21
  133. package/src/interfaces/account-setting.ts +0 -14
  134. package/src/interfaces/account.ts +0 -43
  135. package/src/interfaces/address.ts +0 -122
  136. package/src/interfaces/calendar-collection.ts +0 -60
  137. package/src/interfaces/calendar-event-index.ts +0 -34
  138. package/src/interfaces/calendar-feed-token.ts +0 -38
  139. package/src/interfaces/calendar-object.ts +0 -58
  140. package/src/interfaces/calendar-suggestion.ts +0 -93
  141. package/src/interfaces/calendar-unit-of-work.ts +0 -47
  142. package/src/interfaces/config-import.ts +0 -16
  143. package/src/interfaces/envelope.ts +0 -32
  144. package/src/interfaces/filter-anchor-transaction.ts +0 -23
  145. package/src/interfaces/filter-anchor.ts +0 -11
  146. package/src/interfaces/filter.ts +0 -41
  147. package/src/interfaces/label.ts +0 -30
  148. package/src/interfaces/mailbox-lock.ts +0 -32
  149. package/src/interfaces/mailbox-special-use.ts +0 -60
  150. package/src/interfaces/mailbox.ts +0 -115
  151. package/src/interfaces/message-flag-push.ts +0 -17
  152. package/src/interfaces/message-flag.ts +0 -15
  153. package/src/interfaces/message-label.ts +0 -25
  154. package/src/interfaces/message-placement-move.ts +0 -15
  155. package/src/interfaces/message.ts +0 -65
  156. package/src/interfaces/organize-job-request.ts +0 -19
  157. package/src/interfaces/outbox-attachment.ts +0 -132
  158. package/src/interfaces/outbox-message.ts +0 -106
  159. package/src/interfaces/quarantine.ts +0 -22
  160. package/src/interfaces/sender-signer-standing.ts +0 -37
  161. package/src/interfaces/thread-message.ts +0 -264
  162. package/src/interfaces/unit-of-work.ts +0 -28
  163. package/src/mailbox-name.test.ts +0 -106
  164. package/src/mailbox-name.ts +0 -90
  165. package/src/mailbox-state-doors.test.ts +0 -104
  166. package/src/message-placement-doors.test.ts +0 -100
  167. package/src/message-settlement.test.ts +0 -132
  168. package/src/sender-mute.test.ts +0 -76
  169. package/src/types.ts +0 -820
  170. package/src/update-manifest.test.ts +0 -130
  171. package/src/update-manifest.ts +0 -22
  172. package/src/virtual-copy.test.ts +0 -34
  173. package/tsconfig.json +0 -8
  174. /package/{src/conformance/index.ts → dist/conformance/index.d.ts} +0 -0
@@ -1,122 +0,0 @@
1
- import type { JunkRoleMailboxes } from "../folder-role.js";
2
- import type {
3
- AddressItem,
4
- CreateAddressInput,
5
- CreateEnvelopeAddressInput,
6
- EnvelopeAddressItem,
7
- FlagsMergePatch,
8
- ResultList,
9
- UpdateAddressInput,
10
- } from "../types.js";
11
-
12
- export interface IAddressRepository {
13
- createAddress(input: CreateAddressInput): Promise<AddressItem>;
14
- upsertAddress(input: CreateAddressInput): Promise<AddressItem>;
15
- upsertCorrespondentAddress(input: CreateAddressInput): Promise<AddressItem>;
16
- upsertJunkAddress(input: CreateAddressInput): Promise<AddressItem>;
17
- /**
18
- * `roles` covers every account under the message's config, resolved by the
19
- * caller once per batch: this runs inside the per-message sync loop, and
20
- * role resolution is deliberately uncached.
21
- */
22
- reconcileJunkOnlyForMessage(
23
- messageId: string,
24
- roles: JunkRoleMailboxes,
25
- ): Promise<void>;
26
- getAddress(accountConfigId: string, addressId: string): Promise<AddressItem>;
27
- getAddress(
28
- accountConfigId: string,
29
- addressIds: string[],
30
- ): Promise<AddressItem[]>;
31
- updateAddress(
32
- accountConfigId: string,
33
- addressId: string,
34
- input: UpdateAddressInput,
35
- ): Promise<AddressItem>;
36
- mergeFlags(
37
- accountConfigId: string,
38
- addressId: string,
39
- patch: FlagsMergePatch,
40
- ): Promise<AddressItem>;
41
- promoteWellknownByUser(
42
- accountConfigId: string,
43
- addressId: string,
44
- now: number,
45
- ): Promise<AddressItem>;
46
- demoteSenderTrust(
47
- accountConfigId: string,
48
- addressId: string,
49
- now: number,
50
- ): Promise<AddressItem>;
51
- deleteAddress(accountConfigId: string, addressId: string): Promise<void>;
52
- incrementInboundCount(
53
- accountConfigId: string,
54
- addressId: string,
55
- now: number,
56
- isBulk?: boolean,
57
- ): Promise<void>;
58
- incrementOutboundCount(
59
- accountConfigId: string,
60
- addressId: string,
61
- now: number,
62
- ): Promise<void>;
63
- incrementReplyCount(
64
- accountConfigId: string,
65
- addressId: string,
66
- now: number,
67
- ): Promise<void>;
68
- deleteManyAddresses(
69
- accountConfigId: string,
70
- addressIds: string[],
71
- ): Promise<void>;
72
- listSuggestedVips(input: {
73
- accountConfigId: string;
74
- limit?: number;
75
- }): Promise<AddressItem[]>;
76
- /**
77
- * The account's addresses, most worth suggesting first: where the search term
78
- * hit — the start of a value before the middle of one, and the display name
79
- * before the local part, the domain and the whole address — then the account's
80
- * standing for the sender, how much it corresponds with it, how recently, and
81
- * the stored compound and id last so the order is total. Without a term every
82
- * row scores the same match, so the remaining keys decide and the listing comes
83
- * back by standing, correspondence and recency rather than alphabetically.
84
- */
85
- listByAccountConfig(input: {
86
- accountConfigId: string;
87
- /**
88
- * Matched as a substring of the display name, the local part, the domain
89
- * and the whole address, so `po`, `locatie`, `amsterdam`, `pocahondas.nl`
90
- * and `amsterdam@pocahondas.nl` all resolve
91
- * `Pocahondas locatie amsterdam <amsterdam@pocahondas.nl>`. A name outside
92
- * ASCII (`Öz` for `Özcan Bakker`) resolves through the folded compound.
93
- */
94
- search?: string;
95
- cursor?: string;
96
- limit?: number;
97
- }): Promise<ResultList<AddressItem>>;
98
- /**
99
- * Every address stored under the configuration, for a reader that must see
100
- * the whole set: nothing is hidden, so a row the machine marked `junkOnly`
101
- * still comes back with whatever the user decided about it. Ordered by
102
- * `addressId`, which no write moves, so a page boundary cannot skip a row
103
- * while message sync updates counts and timestamps underneath the read.
104
- */
105
- listAllByAccountConfigPage(input: {
106
- accountConfigId: string;
107
- cursor?: string;
108
- limit?: number;
109
- }): Promise<ResultList<AddressItem>>;
110
- createEnvelopeAddress(
111
- input: CreateEnvelopeAddressInput,
112
- ): Promise<EnvelopeAddressItem>;
113
- upsertEnvelopeAddress(
114
- input: CreateEnvelopeAddressInput,
115
- ): Promise<EnvelopeAddressItem>;
116
- getEnvelopeAddress(envelopeAddressId: string): Promise<EnvelopeAddressItem>;
117
- getEnvelopeAddress(
118
- envelopeAddressIds: string[],
119
- ): Promise<EnvelopeAddressItem[]>;
120
- deleteEnvelopeAddress(envelopeAddressId: string): Promise<void>;
121
- deleteManyEnvelopeAddresses(envelopeAddressIds: string[]): Promise<void>;
122
- }
@@ -1,60 +0,0 @@
1
- import type {
2
- CalendarCollectionItem,
3
- CreateCalendarCollectionInput,
4
- UpdateCalendarCollectionInput,
5
- } from "../types.js";
6
-
7
- export interface ICalendarCollectionRepository {
8
- /**
9
- * Writes the collection under its derived `calendarId`. Provisioning the
10
- * same `(accountConfigId, urlSegment)` twice returns the existing row rather
11
- * than a second one, so first-use provisioning is safe to run on every
12
- * request without a prior read.
13
- */
14
- create(input: CreateCalendarCollectionInput): Promise<CalendarCollectionItem>;
15
- /**
16
- * Writes the collection, or answers `null` when its `urlSegment` is already
17
- * taken in this account config.
18
- *
19
- * The distinction from `create` is who asked. Provisioning wants the row
20
- * whoever got there first wrote; a person naming a calendar wants to be told
21
- * the name is taken, and handing them somebody else's calendar instead is a
22
- * silent merge of two things they meant to keep apart.
23
- */
24
- createExclusive(
25
- input: CreateCalendarCollectionInput,
26
- ): Promise<CalendarCollectionItem | null>;
27
- get(
28
- accountConfigId: string,
29
- calendarId: string,
30
- ): Promise<CalendarCollectionItem>;
31
- update(
32
- accountConfigId: string,
33
- calendarId: string,
34
- input: UpdateCalendarCollectionInput,
35
- ): Promise<CalendarCollectionItem>;
36
- delete(accountConfigId: string, calendarId: string): Promise<void>;
37
- listByAccountConfig(
38
- accountConfigId: string,
39
- ): Promise<CalendarCollectionItem[]>;
40
- /**
41
- * Every `Subscribed` collection whose refresh is on, across all account
42
- * configs. The scheduled refresh walks this; a disabled subscription is
43
- * absent, which is what stops its refresh.
44
- */
45
- listEnabledSubscriptions(): Promise<CalendarCollectionItem[]>;
46
- findByUrlSegment(
47
- accountConfigId: string,
48
- urlSegment: string,
49
- ): Promise<CalendarCollectionItem | null>;
50
- /**
51
- * Advances the collection's change counter by one and returns the new value,
52
- * which the caller stamps on the object it just wrote. Atomic with respect
53
- * to concurrent writers: a read-then-write here would hand two writers the
54
- * same sequence and lose one of them from every later sync report.
55
- */
56
- bumpSyncSequence(
57
- accountConfigId: string,
58
- calendarId: string,
59
- ): Promise<number>;
60
- }
@@ -1,34 +0,0 @@
1
- import type {
2
- CalendarEventIndexItem,
3
- CalendarOccurrenceInput,
4
- } from "../types.js";
5
-
6
- export interface ICalendarEventIndexRepository {
7
- /**
8
- * Replaces every occurrence row of one resource with `occurrences`. Whole
9
- * replacement rather than a merge: an edit that shortens a series must
10
- * remove the occurrences it dropped, and a diff would leave them behind as
11
- * events the calendar view still shows but the resource no longer has.
12
- */
13
- replaceForObject(
14
- calendarId: string,
15
- calendarObjectId: string,
16
- occurrences: CalendarOccurrenceInput[],
17
- ): Promise<void>;
18
- deleteForObject(calendarId: string, calendarObjectId: string): Promise<void>;
19
- listForObject(
20
- calendarId: string,
21
- calendarObjectId: string,
22
- ): Promise<CalendarEventIndexItem[]>;
23
- /**
24
- * Occurrences starting within `[startAt, endAt)`, in start order — the
25
- * calendar-view read. Bounded by start rather than by overlap: an
26
- * occurrence that began before the window and runs into it is not returned,
27
- * so a caller that must show those widens the window by its longest event.
28
- */
29
- listByStartRange(
30
- calendarId: string,
31
- startAt: string,
32
- endAt: string,
33
- ): Promise<CalendarEventIndexItem[]>;
34
- }
@@ -1,38 +0,0 @@
1
- import type {
2
- CalendarFeedTokenItem,
3
- PutCalendarFeedTokenInput,
4
- } from "../types.js";
5
-
6
- export interface ICalendarFeedTokenRepository {
7
- /**
8
- * Mints the calendar's feed address, or replaces the token it already has.
9
- *
10
- * One statement, and an upsert on the derived `feedTokenId`: a calendar holds
11
- * exactly one active address, so there is no state in which a revoked token
12
- * still resolves alongside its replacement. `createdAt` survives a
13
- * replacement — the feed is the same feed under a new secret — and
14
- * `rotatedAt` is stamped only when a row was already there, so a caller can
15
- * tell a fresh address from a rotated one without a prior read.
16
- */
17
- put(input: PutCalendarFeedTokenInput): Promise<CalendarFeedTokenItem>;
18
- /**
19
- * The address a calendar holds, or `null` when it has none. Scoped by account
20
- * config: a management read is always somebody's, and an unscoped one would
21
- * answer for a calendar the caller does not own.
22
- */
23
- findByCalendar(
24
- accountConfigId: string,
25
- calendarId: string,
26
- ): Promise<CalendarFeedTokenItem | null>;
27
- /**
28
- * The row a token hash names, or `null` when nothing answers to it.
29
- *
30
- * Deliberately unscoped, and the only read that is: a subscriber arrives with
31
- * no session at all, so the hash is the whole lookup key and the row it finds
32
- * is what names the owner. The caller still compares the stored hash against
33
- * the presented one before serving anything.
34
- */
35
- findByTokenHash(tokenHash: string): Promise<CalendarFeedTokenItem | null>;
36
- /** Revokes the calendar's address. Every subscribed client stops resolving. */
37
- delete(accountConfigId: string, calendarId: string): Promise<void>;
38
- }
@@ -1,58 +0,0 @@
1
- import type { CalendarObjectItem, PutCalendarObjectInput } from "../types.js";
2
-
3
- export interface ICalendarObjectRepository {
4
- put(input: PutCalendarObjectInput): Promise<CalendarObjectItem>;
5
- get(
6
- calendarId: string,
7
- calendarObjectId: string,
8
- ): Promise<CalendarObjectItem>;
9
- /**
10
- * The resource under an id, or `null` when the collection does not hold it.
11
- * `get` throws instead, which is right for a caller that already knows the
12
- * resource exists; a request naming one is asking whether it does, and that
13
- * is an answer rather than a fault.
14
- */
15
- find(
16
- calendarId: string,
17
- calendarObjectId: string,
18
- ): Promise<CalendarObjectItem | null>;
19
- delete(calendarId: string, calendarObjectId: string): Promise<void>;
20
- findByResourceName(
21
- calendarId: string,
22
- resourceName: string,
23
- ): Promise<CalendarObjectItem | null>;
24
- /**
25
- * The resource carrying an iCalendar UID, which is how a scheduling message
26
- * or a calendar-query REPORT addresses an event — a client that has the UID
27
- * generally does not have the resource name.
28
- */
29
- findByUid(
30
- calendarId: string,
31
- icalUid: string,
32
- ): Promise<CalendarObjectItem | null>;
33
- listByUidPrefix(
34
- calendarId: string,
35
- prefix: string,
36
- ): Promise<CalendarObjectItem[]>;
37
- listByCalendar(calendarId: string): Promise<CalendarObjectItem[]>;
38
- /**
39
- * The resources whose occurrence rows stop before `instant` — the series a
40
- * range read has to expand for itself because the index does not reach that
41
- * far. Narrow by construction: a resource that fits inside the expansion
42
- * horizon carries no `expandedThrough` and never appears here, so a view of
43
- * an ordinary calendar reads no iCalendar text at all.
44
- */
45
- listIncompleteExpansions(
46
- calendarId: string,
47
- instant: string,
48
- ): Promise<CalendarObjectItem[]>;
49
- /**
50
- * Everything written to the collection after `syncSequence`, in change
51
- * order — the read behind a WebDAV-Sync report. Exclusive of the token
52
- * itself, so replaying a token returns only what the client has not seen.
53
- */
54
- listChangedSince(
55
- calendarId: string,
56
- syncSequence: number,
57
- ): Promise<CalendarObjectItem[]>;
58
- }
@@ -1,93 +0,0 @@
1
- import type {
2
- CalendarSuggestionItem,
3
- PutCalendarSuggestionInput,
4
- ResultList,
5
- } from "../types.js";
6
-
7
- /**
8
- * The two fields that record what a person decided about a suggestion. They
9
- * move together and only through {@link ICalendarSuggestionRepository.settle},
10
- * so no producer write can walk an answered card back to `Pending`, and no
11
- * state can name a calendar object that was never written.
12
- *
13
- * `acceptedCalendarObjectId` is `""` for every outcome but `Accepted` — the
14
- * named absent state, never a missing attribute.
15
- */
16
- export interface SettleCalendarSuggestionInput {
17
- state: CalendarSuggestionItem["state"];
18
- acceptedCalendarObjectId: string;
19
- }
20
-
21
- export interface ICalendarSuggestionRepository {
22
- /**
23
- * Writes the suggestion under its derived `suggestionId`. An upsert: the
24
- * producer re-reading the same message rewrites the row it already wrote.
25
- *
26
- * Never touches `state` or `acceptedCalendarObjectId` on a row that already
27
- * exists, so a re-sync of a message whose invitation the user accepted
28
- * leaves the acceptance intact. A row it creates starts `Pending`.
29
- */
30
- put(input: PutCalendarSuggestionInput): Promise<CalendarSuggestionItem>;
31
- get(
32
- accountConfigId: string,
33
- suggestionId: string,
34
- ): Promise<CalendarSuggestionItem>;
35
- /** Every suggestion one message produced, superseded revisions included. */
36
- listByMessage(
37
- accountConfigId: string,
38
- messageId: string,
39
- ): Promise<CalendarSuggestionItem[]>;
40
- listByAcceptedCalendarObjects(
41
- accountConfigId: string,
42
- calendarObjectIds: string[],
43
- ): Promise<CalendarSuggestionItem[]>;
44
- /**
45
- * The account's suggestions in one state, newest first. Also how the
46
- * producer finds the revision a new message supersedes: only a `Pending`
47
- * suggestion can be superseded, so the candidate set is this one.
48
- */
49
- listByState(
50
- accountConfigId: string,
51
- state: CalendarSuggestionItem["state"],
52
- options: {
53
- endsAfter: string;
54
- limit?: number;
55
- continuationToken?: string;
56
- },
57
- ): Promise<ResultList<CalendarSuggestionItem>>;
58
- /**
59
- * Records the outcome of a person's decision. Returns the settled row.
60
- */
61
- settle(
62
- accountConfigId: string,
63
- suggestionId: string,
64
- input: SettleCalendarSuggestionInput,
65
- ): Promise<CalendarSuggestionItem>;
66
- /**
67
- * Retires a card as `Superseded`, but only while it is still `Pending`, and
68
- * records the message whose revision retired it so the card can open that
69
- * one. Returns the retired row, or `null` when the card had already been
70
- * answered and nothing was written.
71
- *
72
- * A compare-and-set rather than a plain `settle` because the producer reads
73
- * the pending set and writes to it in two steps, and a person can accept a
74
- * card in between. An unconditional write there would overwrite their
75
- * acceptance with `Superseded` and blank `acceptedCalendarObjectId`,
76
- * severing the card from the event it put in their calendar.
77
- */
78
- supersedeIfPending(
79
- accountConfigId: string,
80
- suggestionId: string,
81
- supersededByMessageId: string,
82
- ): Promise<CalendarSuggestionItem | null>;
83
- /**
84
- * Points a card already `Superseded` at a later revision, so every retired
85
- * revision of an event opens the newest one. Returns the updated row, or
86
- * `null` when the card is not superseded and nothing was written.
87
- */
88
- repointSuperseded(
89
- accountConfigId: string,
90
- suggestionId: string,
91
- supersededByMessageId: string,
92
- ): Promise<CalendarSuggestionItem | null>;
93
- }
@@ -1,47 +0,0 @@
1
- import type { ICalendarCollectionRepository } from "./calendar-collection.js";
2
- import type { ICalendarEventIndexRepository } from "./calendar-event-index.js";
3
- import type { ICalendarFeedTokenRepository } from "./calendar-feed-token.js";
4
- import type { ICalendarObjectRepository } from "./calendar-object.js";
5
- import type { ICalendarSuggestionRepository } from "./calendar-suggestion.js";
6
-
7
- /**
8
- * The repositories one calendar write set touches, bound to a single unit of
9
- * work.
10
- */
11
- export interface CalendarUnitOfWorkRepositories {
12
- calendarCollection: ICalendarCollectionRepository;
13
- calendarObject: ICalendarObjectRepository;
14
- calendarEventIndex: ICalendarEventIndexRepository;
15
- /**
16
- * Present so accepting a suggestion settles the card in the same unit that
17
- * writes the resource (issue #1033). The two are one fact: a card still
18
- * asking with the event already in the calendar, or a card marked accepted
19
- * with no event behind it, is a state nothing later can repair.
20
- */
21
- calendarSuggestion: ICalendarSuggestionRepository;
22
- /**
23
- * Present so removing a calendar takes its feed address with it (issue
24
- * #1067). A token row outliving its collection is a credential pointing at
25
- * nothing — it answers 404, but nobody can see it to revoke it, and a later
26
- * calendar under the same derived id would inherit it.
27
- */
28
- calendarFeedToken: ICalendarFeedTokenRepository;
29
- }
30
-
31
- /**
32
- * Runs a calendar write set as one atomic unit (issue #15). Writing a resource
33
- * is three writes — the object, its replaced occurrence rows, and the
34
- * collection's sequence bump — and none of them is meaningful without the
35
- * others: an object with stale occurrences is a calendar showing events the
36
- * resource no longer has, and an object written without the bump is a change no
37
- * sync report will ever hand a client.
38
- *
39
- * A throw rolls the whole set back. Backends without cross-entity transactions
40
- * supply a pass-through implementation that runs the callback against the plain
41
- * repositories.
42
- */
43
- export interface ICalendarUnitOfWork {
44
- transaction<T>(
45
- fn: (repos: CalendarUnitOfWorkRepositories) => Promise<T>,
46
- ): Promise<T>;
47
- }
@@ -1,16 +0,0 @@
1
- import type {
2
- ConfigImportItem,
3
- CreateConfigImportInput,
4
- UpdateConfigImportInput,
5
- } from "../types.js";
6
-
7
- export interface IConfigImportRepository {
8
- create(input: CreateConfigImportInput): Promise<ConfigImportItem>;
9
- get(importId: string): Promise<ConfigImportItem>;
10
- update(
11
- importId: string,
12
- input: UpdateConfigImportInput,
13
- ): Promise<ConfigImportItem>;
14
- /** Newest first, so the caller reads the import a person just ran. */
15
- listByAccountConfig(accountConfigId: string): Promise<ConfigImportItem[]>;
16
- }
@@ -1,32 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
1
- import type {
2
- CreateFilterAnchorInput,
3
- CreateFilterInput,
4
- FilterItem,
5
- } from "../types.js";
6
-
7
- /**
8
- * Atomically creates a `Filter` row and its optional sibling `FilterAnchor`
9
- * row (#351). Without this, the two writes ran sequentially: a failure on the
10
- * second left a `Filter` durably marked `hasAnchor: true` with no matching
11
- * `FilterAnchor` row — a filter that looks normal but silently matches
12
- * nothing, forever, with no repair path (the anchor message id is never
13
- * retained once `createFilterWithAnchor` returns).
14
- *
15
- * `anchor` omits `filterId` — it is not known until the `Filter` row is
16
- * created inside the same transaction.
17
- */
18
- export interface IFilterAnchorTransaction {
19
- createWithAnchor(
20
- filter: CreateFilterInput,
21
- anchor: Omit<CreateFilterAnchorInput, "filterId"> | null,
22
- ): Promise<FilterItem>;
23
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,41 +0,0 @@
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
- }
@@ -1,30 +0,0 @@
1
- import type {
2
- CreateLabelInput,
3
- LabelItem,
4
- ResultList,
5
- UpdateLabelInput,
6
- } from "../types.js";
7
-
8
- export interface ILabelRepository {
9
- create(input: CreateLabelInput): Promise<LabelItem>;
10
- get(accountConfigId: string, labelId: string): Promise<LabelItem>;
11
- update(
12
- accountConfigId: string,
13
- labelId: string,
14
- input: UpdateLabelInput,
15
- ): Promise<LabelItem>;
16
- delete(accountConfigId: string, labelId: string): Promise<void>;
17
- listByAccountConfig(accountConfigId: string): Promise<LabelItem[]>;
18
- /**
19
- * A single signed page of an account config's labels (issue #26), mirroring
20
- * `IFilterRepository.listPageByAccountConfig` — the settings-page/API list.
21
- */
22
- listPageByAccountConfig(
23
- accountConfigId: string,
24
- options?: { limit?: number; continuationToken?: string },
25
- ): Promise<ResultList<LabelItem>>;
26
- findByNormalizedName(
27
- accountConfigId: string,
28
- normalizedName: string,
29
- ): Promise<LabelItem | null>;
30
- }
@@ -1,32 +0,0 @@
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
- ttlSeconds: number,
10
- ): Promise<boolean>;
11
- releaseLock(
12
- accountId: string,
13
- mailboxId: string,
14
- eventName: string,
15
- lockId: string,
16
- ): Promise<void>;
17
- withMailboxLock<T>(
18
- mailboxId: string,
19
- eventName: string,
20
- accountId: string,
21
- operation: () => Promise<T>,
22
- options?: { lockId?: string },
23
- ): Promise<WithMailboxLockResult<T>>;
24
- get(
25
- accountId: string,
26
- mailboxId: string,
27
- eventName: string,
28
- ): Promise<MailboxLockItem | null>;
29
- listAllLocks(): Promise<MailboxLockItem[]>;
30
- listByAccount(accountId: string): Promise<MailboxLockItem[]>;
31
- deleteByAccount(accountId: string): Promise<void>;
32
- }