@remit/backend 0.0.91 → 0.0.93
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 +1 -1
- package/src/handlers/calendar-event.test.ts +568 -0
- package/src/handlers/calendar-sqlite-fixture.ts +64 -0
- package/src/handlers/calendar-suggestion.test.ts +558 -0
- package/src/handlers/calendar-suggestion.ts +289 -0
- package/src/handlers/calendar.test.ts +412 -445
- package/src/handlers/index.ts +8 -0
- package/src/service/compose-sqlite.ts +2 -0
- package/src/service/create-remit-client.ts +20 -6
- package/src/types.ts +21 -1
package/src/handlers/index.ts
CHANGED
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
CalendarEventOperations,
|
|
9
9
|
CalendarFreeBusyOperations,
|
|
10
10
|
} from "./calendar-event.js";
|
|
11
|
+
import {
|
|
12
|
+
CalendarSuggestionActionOperations,
|
|
13
|
+
CalendarSuggestionOperations,
|
|
14
|
+
MessageCalendarSuggestionOperations,
|
|
15
|
+
} from "./calendar-suggestion.js";
|
|
11
16
|
import { ConfigOperations } from "./config.js";
|
|
12
17
|
import { FilterDetailOperations, FilterOperations } from "./filter.js";
|
|
13
18
|
import { FolderRoleOperations } from "./folder-role.js";
|
|
@@ -66,4 +71,7 @@ export const handlers: Record<OperationIds, OperationHandler<any>> = {
|
|
|
66
71
|
...AddressOperations,
|
|
67
72
|
...AddressDetailOperations,
|
|
68
73
|
...SemanticSearchOperations,
|
|
74
|
+
...CalendarSuggestionOperations,
|
|
75
|
+
...MessageCalendarSuggestionOperations,
|
|
76
|
+
...CalendarSuggestionActionOperations,
|
|
69
77
|
};
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CalendarCollectionRepo,
|
|
8
8
|
CalendarEventIndexRepo,
|
|
9
9
|
CalendarObjectRepo,
|
|
10
|
+
CalendarSuggestionRepo,
|
|
10
11
|
ConfigImportRepo,
|
|
11
12
|
createSqliteDatabase,
|
|
12
13
|
DrizzleCalendarUnitOfWork,
|
|
@@ -85,6 +86,7 @@ export const buildSqliteClient = async (): Promise<RemitClient> => {
|
|
|
85
86
|
calendarCollection: new CalendarCollectionRepo(genericDb),
|
|
86
87
|
calendarObject: new CalendarObjectRepo(genericDb),
|
|
87
88
|
calendarEventIndex: new CalendarEventIndexRepo(genericDb),
|
|
89
|
+
calendarSuggestion: new CalendarSuggestionRepo(genericDb),
|
|
88
90
|
calendarUnitOfWork: new DrizzleCalendarUnitOfWork(genericDb),
|
|
89
91
|
unitOfWork: new DrizzleUnitOfWork(messageDataDb),
|
|
90
92
|
writeSet: (run) => runInTransaction(genericDb, () => run()),
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ICalendarCollectionRepository,
|
|
8
8
|
ICalendarEventIndexRepository,
|
|
9
9
|
ICalendarObjectRepository,
|
|
10
|
+
ICalendarSuggestionRepository,
|
|
10
11
|
ICalendarUnitOfWork,
|
|
11
12
|
IConfigImportRepository,
|
|
12
13
|
IEnvelopeRepository,
|
|
@@ -119,15 +120,17 @@ export interface RemitClient {
|
|
|
119
120
|
// body-sync, which is its only writer.
|
|
120
121
|
senderSignerStanding: ISenderSignerStandingRepository;
|
|
121
122
|
|
|
122
|
-
// The calendar store (issue #15)
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
123
|
+
// The calendar store (issue #15) and the cards a message offers into it
|
|
124
|
+
// (issue #1033). Every write goes through `calendarUnitOfWork`: the object,
|
|
125
|
+
// its occurrence rows, the collection's sequence bump and — when the write
|
|
126
|
+
// came from accepting a suggestion — that suggestion's own state are one
|
|
127
|
+
// fact, and the repositories beside it are the read side. A backend that
|
|
128
|
+
// cannot supply them cannot serve the calendar at all, so they are part of
|
|
129
|
+
// the client rather than something each handler checks for.
|
|
128
130
|
calendarCollection: ICalendarCollectionRepository;
|
|
129
131
|
calendarObject: ICalendarObjectRepository;
|
|
130
132
|
calendarEventIndex: ICalendarEventIndexRepository;
|
|
133
|
+
calendarSuggestion: ICalendarSuggestionRepository;
|
|
131
134
|
calendarUnitOfWork: ICalendarUnitOfWork;
|
|
132
135
|
|
|
133
136
|
// Atomic write set for a message save. Present on the relational backend (real
|
|
@@ -222,6 +225,7 @@ export interface RemitClientRepositories {
|
|
|
222
225
|
calendarCollection: ICalendarCollectionRepository;
|
|
223
226
|
calendarObject: ICalendarObjectRepository;
|
|
224
227
|
calendarEventIndex: ICalendarEventIndexRepository;
|
|
228
|
+
calendarSuggestion: ICalendarSuggestionRepository;
|
|
225
229
|
calendarUnitOfWork: ICalendarUnitOfWork;
|
|
226
230
|
unitOfWork?: IUnitOfWork;
|
|
227
231
|
writeSet?: <T>(run: () => Promise<T>) => Promise<T>;
|
|
@@ -425,6 +429,15 @@ export const createRemitClient = (deps: RemitClientDeps): RemitClient => {
|
|
|
425
429
|
filterConfig,
|
|
426
430
|
undefined,
|
|
427
431
|
{ flagQueueService },
|
|
432
|
+
// The read-path backfill materializes a body the sync path never got to,
|
|
433
|
+
// so it is a message's first sight as much as the sync pass is — and an
|
|
434
|
+
// invitation the user opens before background sync must still get its
|
|
435
|
+
// card (issue #1033, the same argument as the filter wiring above).
|
|
436
|
+
{
|
|
437
|
+
calendarSuggestionService: repositories.calendarSuggestion,
|
|
438
|
+
calendarUnitOfWork: repositories.calendarUnitOfWork,
|
|
439
|
+
filterService: repositories.filter,
|
|
440
|
+
},
|
|
428
441
|
);
|
|
429
442
|
|
|
430
443
|
return {
|
|
@@ -453,6 +466,7 @@ export const createRemitClient = (deps: RemitClientDeps): RemitClient => {
|
|
|
453
466
|
calendarCollection: repositories.calendarCollection,
|
|
454
467
|
calendarObject: repositories.calendarObject,
|
|
455
468
|
calendarEventIndex: repositories.calendarEventIndex,
|
|
469
|
+
calendarSuggestion: repositories.calendarSuggestion,
|
|
456
470
|
calendarUnitOfWork: repositories.calendarUnitOfWork,
|
|
457
471
|
unitOfWork: repositories.unitOfWork,
|
|
458
472
|
writeSet: repositories.writeSet,
|
package/src/types.ts
CHANGED
|
@@ -79,7 +79,12 @@ export type OperationIds =
|
|
|
79
79
|
| "OutboxDetailOperations_mintOutboxAttachment"
|
|
80
80
|
| "OutboxAttachmentOperations_completeOutboxAttachment"
|
|
81
81
|
| "AddressOperations_searchAddresses"
|
|
82
|
-
| "AddressDetailOperations_updateAddress"
|
|
82
|
+
| "AddressDetailOperations_updateAddress"
|
|
83
|
+
| "CalendarSuggestionOperations_listCalendarSuggestions"
|
|
84
|
+
| "MessageCalendarSuggestionOperations_listMessageCalendarSuggestions"
|
|
85
|
+
| "CalendarSuggestionActionOperations_acceptCalendarSuggestion"
|
|
86
|
+
| "CalendarSuggestionActionOperations_declineCalendarSuggestion"
|
|
87
|
+
| "CalendarSuggestionActionOperations_dismissCalendarSuggestion";
|
|
83
88
|
|
|
84
89
|
export type MeOperationIds = MatchPrefix<"MeOperations_", OperationIds>;
|
|
85
90
|
|
|
@@ -219,6 +224,21 @@ export type MicrosoftOAuthOperationIds = MatchPrefix<
|
|
|
219
224
|
OperationIds
|
|
220
225
|
>;
|
|
221
226
|
|
|
227
|
+
export type CalendarSuggestionOperationIds = MatchPrefix<
|
|
228
|
+
"CalendarSuggestionOperations_",
|
|
229
|
+
OperationIds
|
|
230
|
+
>;
|
|
231
|
+
|
|
232
|
+
export type MessageCalendarSuggestionOperationIds = MatchPrefix<
|
|
233
|
+
"MessageCalendarSuggestionOperations_",
|
|
234
|
+
OperationIds
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
export type CalendarSuggestionActionOperationIds = MatchPrefix<
|
|
238
|
+
"CalendarSuggestionActionOperations_",
|
|
239
|
+
OperationIds
|
|
240
|
+
>;
|
|
241
|
+
|
|
222
242
|
// biome-ignore lint/suspicious/noExplicitAny: handler responses vary by operation
|
|
223
243
|
type HandlerResponse = Record<string, any>;
|
|
224
244
|
export type OperationHandler<_T extends OperationIds = OperationIds> = (
|