@remit/data-ports 0.0.82 → 0.0.84

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 +7 -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 +69 -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 -226
  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 -56
  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,269 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { after, before, describe, test } from "node:test";
3
- import {
4
- CalendarEventStatus,
5
- CalendarTransparency,
6
- ZoneCertainty,
7
- } from "@remit/domain-enums";
8
- import { deriveCalendarObjectId } from "../id.js";
9
- import type { ICalendarObjectRepository } from "../interfaces/calendar-object.js";
10
- import type { PutCalendarObjectInput } from "../types.js";
11
- import type { RepositoryConformanceHarness } from "./harness.js";
12
-
13
- const ICAL_DATA = [
14
- "BEGIN:VCALENDAR",
15
- "VERSION:2.0",
16
- "BEGIN:VEVENT",
17
- "UID:conformance@example.com",
18
- "DTSTART:20260826T090000Z",
19
- "DTEND:20260826T100000Z",
20
- "SUMMARY:Stand-up",
21
- "END:VEVENT",
22
- "END:VCALENDAR",
23
- "",
24
- ].join("\r\n");
25
-
26
- const objectInput = (
27
- calendarId: string,
28
- overrides: Partial<PutCalendarObjectInput> = {},
29
- ): PutCalendarObjectInput => ({
30
- calendarId,
31
- resourceName: "conformance.ics",
32
- icalUid: "conformance@example.com",
33
- icalData: ICAL_DATA,
34
- etag: "a".repeat(64),
35
- sequence: 0,
36
- syncSequence: 1,
37
- summary: "Stand-up",
38
- dtStart: "2026-08-26T09:00:00+00:00",
39
- dtEnd: "2026-08-26T10:00:00+00:00",
40
- allDay: false,
41
- zoneCertainty: ZoneCertainty.Explicit,
42
- status: CalendarEventStatus.Confirmed,
43
- transparency: CalendarTransparency.Opaque,
44
- hasRecurrence: false,
45
- expandedThrough: "",
46
- ...overrides,
47
- });
48
-
49
- export function calendarObjectRepositoryConformance(
50
- harness: RepositoryConformanceHarness<ICalendarObjectRepository>,
51
- ): void {
52
- describe("ICalendarObjectRepository conformance", () => {
53
- let repo: ICalendarObjectRepository;
54
-
55
- before(async () => {
56
- repo = await harness.createRepository();
57
- });
58
-
59
- after(() => harness.teardown());
60
-
61
- test("put derives calendarObjectId from the collection and the resource name", async () => {
62
- const calendarId = harness.makeId();
63
-
64
- const object = await repo.put(objectInput(calendarId));
65
-
66
- assert.equal(
67
- object.calendarObjectId,
68
- deriveCalendarObjectId(calendarId, "conformance.ics"),
69
- );
70
- });
71
-
72
- test("put stores the iCalendar bytes verbatim, CRLF intact", async () => {
73
- const calendarId = harness.makeId();
74
-
75
- await repo.put(objectInput(calendarId));
76
- const stored = await repo.findByResourceName(
77
- calendarId,
78
- "conformance.ics",
79
- );
80
-
81
- assert.equal(stored?.icalData, ICAL_DATA);
82
- assert.ok(stored?.icalData.includes("\r\n"));
83
- });
84
-
85
- test("put rewrites the same resource rather than forking a duplicate", async () => {
86
- const calendarId = harness.makeId();
87
-
88
- await repo.put(objectInput(calendarId));
89
- const second = await repo.put(
90
- objectInput(calendarId, {
91
- summary: "Stand-up (moved)",
92
- etag: "b".repeat(64),
93
- syncSequence: 2,
94
- }),
95
- );
96
-
97
- assert.equal(second.summary, "Stand-up (moved)");
98
- assert.equal(second.syncSequence, 2);
99
- const all = await repo.listByCalendar(calendarId);
100
- assert.equal(all.length, 1);
101
- });
102
-
103
- test("get throws a not-found error for a missing resource", async () => {
104
- await assert.rejects(
105
- repo.get(harness.makeId(), harness.makeId()),
106
- (error) => harness.isNotFoundError(error),
107
- );
108
- });
109
-
110
- test("find answers with null where get throws", async () => {
111
- const calendarId = harness.makeId();
112
- const object = await repo.put(objectInput(calendarId));
113
-
114
- assert.equal(
115
- (await repo.find(calendarId, object.calendarObjectId))?.icalData,
116
- ICAL_DATA,
117
- );
118
- assert.equal(await repo.find(calendarId, harness.makeId()), null);
119
- assert.equal(
120
- await repo.find(harness.makeId(), object.calendarObjectId),
121
- null,
122
- "a resource is only found through the collection that holds it",
123
- );
124
- });
125
-
126
- test("listIncompleteExpansions returns only the series whose index stops short", async () => {
127
- const calendarId = harness.makeId();
128
- await repo.put(objectInput(calendarId, { resourceName: "complete.ics" }));
129
- const incomplete = await repo.put(
130
- objectInput(calendarId, {
131
- resourceName: "incomplete.ics",
132
- expandedThrough: "2026-01-01T00:00:00Z",
133
- }),
134
- );
135
-
136
- assert.deepEqual(
137
- (
138
- await repo.listIncompleteExpansions(
139
- calendarId,
140
- "2026-06-01T00:00:00Z",
141
- )
142
- ).map((object) => object.calendarObjectId),
143
- [incomplete.calendarObjectId],
144
- "a resource with no expandedThrough is complete and never appears",
145
- );
146
- assert.deepEqual(
147
- await repo.listIncompleteExpansions(calendarId, "2025-06-01T00:00:00Z"),
148
- [],
149
- "and one whose index already reaches the window does not either",
150
- );
151
- });
152
-
153
- test("findByResourceName returns null for a name the collection does not hold", async () => {
154
- assert.equal(
155
- await repo.findByResourceName(harness.makeId(), "absent.ics"),
156
- null,
157
- );
158
- });
159
-
160
- test("findByUid resolves the resource carrying an iCalendar UID", async () => {
161
- const calendarId = harness.makeId();
162
- const object = await repo.put(objectInput(calendarId));
163
-
164
- const found = await repo.findByUid(calendarId, "conformance@example.com");
165
- assert.equal(found?.calendarObjectId, object.calendarObjectId);
166
-
167
- assert.equal(
168
- await repo.findByUid(calendarId, "absent@example.com"),
169
- null,
170
- );
171
- });
172
-
173
- test("listByUidPrefix finds the resources whose UID starts with the prefix, in one collection", async () => {
174
- const calendarId = harness.makeId();
175
- const other = harness.makeId();
176
- const tail = await repo.put(
177
- objectInput(calendarId, {
178
- resourceName: "tail.ics",
179
- icalUid: "root@example.com/following/1",
180
- }),
181
- );
182
- await repo.put(
183
- objectInput(calendarId, {
184
- resourceName: "root.ics",
185
- icalUid: "root@example.com",
186
- }),
187
- );
188
- await repo.put(
189
- objectInput(calendarId, {
190
- resourceName: "lookalike.ics",
191
- icalUid: "root@example.comx/following/2",
192
- }),
193
- );
194
- await repo.put(
195
- objectInput(other, {
196
- resourceName: "elsewhere.ics",
197
- icalUid: "root@example.com/following/3",
198
- }),
199
- );
200
-
201
- const found = await repo.listByUidPrefix(
202
- calendarId,
203
- "root@example.com/following/",
204
- );
205
-
206
- assert.deepEqual(
207
- found.map((object) => object.calendarObjectId),
208
- [tail.calendarObjectId],
209
- );
210
- });
211
-
212
- test("listByCalendar scopes to the collection", async () => {
213
- const calendarId = harness.makeId();
214
- const other = harness.makeId();
215
-
216
- const mine = await repo.put(objectInput(calendarId));
217
- await repo.put(objectInput(other));
218
-
219
- const objects = await repo.listByCalendar(calendarId);
220
- assert.equal(objects.length, 1);
221
- assert.equal(objects[0]?.calendarObjectId, mine.calendarObjectId);
222
- });
223
-
224
- test("listChangedSince returns later writes in change order, excluding the token itself", async () => {
225
- const calendarId = harness.makeId();
226
-
227
- await repo.put(
228
- objectInput(calendarId, {
229
- resourceName: "one.ics",
230
- icalUid: "one@example.com",
231
- syncSequence: 1,
232
- }),
233
- );
234
- await repo.put(
235
- objectInput(calendarId, {
236
- resourceName: "two.ics",
237
- icalUid: "two@example.com",
238
- syncSequence: 2,
239
- }),
240
- );
241
- await repo.put(
242
- objectInput(calendarId, {
243
- resourceName: "three.ics",
244
- icalUid: "three@example.com",
245
- syncSequence: 3,
246
- }),
247
- );
248
-
249
- const changed = await repo.listChangedSince(calendarId, 1);
250
-
251
- assert.deepEqual(
252
- changed.map((object) => object.resourceName),
253
- ["two.ics", "three.ics"],
254
- );
255
- });
256
-
257
- test("delete removes the row", async () => {
258
- const calendarId = harness.makeId();
259
- const object = await repo.put(objectInput(calendarId));
260
-
261
- await repo.delete(calendarId, object.calendarObjectId);
262
-
263
- await assert.rejects(
264
- repo.get(calendarId, object.calendarObjectId),
265
- (error) => harness.isNotFoundError(error),
266
- );
267
- });
268
- });
269
- }