@remit/data-ports 0.0.80 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/data-ports",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -28,6 +28,7 @@ const suggestion = (
28
28
  summary: "Design review",
29
29
  dtStart: "2026-09-01T10:00:00+02:00",
30
30
  dtEnd: "2026-09-01T11:00:00+02:00",
31
+ endsAtUtc: "2026-09-01T09:00:00Z",
31
32
  allDay: false,
32
33
  location: "",
33
34
  organizer: "organizer@example.test",
@@ -36,6 +37,8 @@ const suggestion = (
36
37
  ...overrides,
37
38
  });
38
39
 
40
+ const EARLIEST_INSTANT = "1970-01-01T00:00:00.000Z";
41
+
39
42
  export function calendarSuggestionRepositoryConformance(
40
43
  harness: RepositoryConformanceHarness<ICalendarSuggestionRepository>,
41
44
  ): void {
@@ -166,6 +169,7 @@ export function calendarSuggestionRepositoryConformance(
166
169
  const page = await repo.listByState(
167
170
  accountConfigId,
168
171
  CalendarSuggestionState.Pending,
172
+ { endsAfter: EARLIEST_INSTANT },
169
173
  );
170
174
  assert.deepEqual(
171
175
  page.items.map((row) => row.suggestionId),
@@ -173,6 +177,69 @@ export function calendarSuggestionRepositoryConformance(
173
177
  );
174
178
  });
175
179
 
180
+ test("listByState drops a suggestion that ended before endsAfter, comparing instants across offsets", async () => {
181
+ const accountConfigId = harness.makeId();
182
+ await repo.put(
183
+ suggestion(
184
+ accountConfigId,
185
+ harness.makeId(),
186
+ harness.makeId(),
187
+ "ended",
188
+ {
189
+ dtEnd: "2026-10-06T23:00:00+14:00",
190
+ endsAtUtc: "2026-10-06T09:00:00Z",
191
+ },
192
+ ),
193
+ );
194
+ const running = await repo.put(
195
+ suggestion(
196
+ accountConfigId,
197
+ harness.makeId(),
198
+ harness.makeId(),
199
+ "running",
200
+ {
201
+ dtEnd: "2026-10-06T01:00:00-12:00",
202
+ endsAtUtc: "2026-10-06T13:00:00Z",
203
+ },
204
+ ),
205
+ );
206
+
207
+ const page = await repo.listByState(
208
+ accountConfigId,
209
+ CalendarSuggestionState.Pending,
210
+ { endsAfter: "2026-10-06T10:00:00Z" },
211
+ );
212
+ assert.deepEqual(
213
+ page.items.map((row) => row.suggestionId),
214
+ [running.suggestionId],
215
+ );
216
+ });
217
+
218
+ test("listByState keeps a suggestion ending exactly at endsAfter", async () => {
219
+ const accountConfigId = harness.makeId();
220
+ const boundary = await repo.put(
221
+ suggestion(
222
+ accountConfigId,
223
+ harness.makeId(),
224
+ harness.makeId(),
225
+ "edge",
226
+ {
227
+ endsAtUtc: "2026-10-06T10:00:00Z",
228
+ },
229
+ ),
230
+ );
231
+
232
+ const page = await repo.listByState(
233
+ accountConfigId,
234
+ CalendarSuggestionState.Pending,
235
+ { endsAfter: "2026-10-06T10:00:00Z" },
236
+ );
237
+ assert.deepEqual(
238
+ page.items.map((row) => row.suggestionId),
239
+ [boundary.suggestionId],
240
+ );
241
+ });
242
+
176
243
  test("listByState scopes to the account config", async () => {
177
244
  const accountConfigId = harness.makeId();
178
245
  await repo.put(
@@ -182,6 +249,7 @@ export function calendarSuggestionRepositoryConformance(
182
249
  const page = await repo.listByState(
183
250
  accountConfigId,
184
251
  CalendarSuggestionState.Pending,
252
+ { endsAfter: EARLIEST_INSTANT },
185
253
  );
186
254
  assert.equal(page.items.length, 0);
187
255
  });
@@ -197,7 +265,7 @@ export function calendarSuggestionRepositoryConformance(
197
265
  const first = await repo.listByState(
198
266
  accountConfigId,
199
267
  CalendarSuggestionState.Pending,
200
- { limit: 2 },
268
+ { endsAfter: EARLIEST_INSTANT, limit: 2 },
201
269
  );
202
270
  assert.equal(first.items.length, 2);
203
271
  assert.ok(first.continuationToken);
@@ -205,7 +273,11 @@ export function calendarSuggestionRepositoryConformance(
205
273
  const second = await repo.listByState(
206
274
  accountConfigId,
207
275
  CalendarSuggestionState.Pending,
208
- { limit: 2, continuationToken: first.continuationToken },
276
+ {
277
+ endsAfter: EARLIEST_INSTANT,
278
+ limit: 2,
279
+ continuationToken: first.continuationToken,
280
+ },
209
281
  );
210
282
  const seen = [...first.items, ...second.items].map(
211
283
  (row) => row.suggestionId,
@@ -49,7 +49,11 @@ export interface ICalendarSuggestionRepository {
49
49
  listByState(
50
50
  accountConfigId: string,
51
51
  state: CalendarSuggestionItem["state"],
52
- options?: { limit?: number; continuationToken?: string },
52
+ options: {
53
+ endsAfter: string;
54
+ limit?: number;
55
+ continuationToken?: string;
56
+ },
53
57
  ): Promise<ResultList<CalendarSuggestionItem>>;
54
58
  /**
55
59
  * Records the outcome of a person's decision. Returns the settled row.
@@ -6,6 +6,7 @@ export interface IMailboxLockRepository {
6
6
  eventName: string,
7
7
  accountId: string,
8
8
  lockId: string,
9
+ ttlSeconds: number,
9
10
  ): Promise<boolean>;
10
11
  releaseLock(
11
12
  accountId: string,