@remit/backend 0.0.89 → 0.0.91
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 +6 -1
- package/src/handlers/calendar-event.ts +668 -0
- package/src/handlers/calendar.test.ts +876 -0
- package/src/handlers/calendar.ts +384 -0
- package/src/handlers/config.ts +72 -2
- package/src/handlers/filter.ts +5 -22
- package/src/handlers/index.ts +11 -0
- package/src/service/compose-sqlite.ts +12 -0
- package/src/service/config-import.ts +39 -0
- package/src/service/create-remit-client.ts +40 -0
- package/src/types.ts +37 -0
|
@@ -4,6 +4,11 @@ import type {
|
|
|
4
4
|
IAccountRepository,
|
|
5
5
|
IAccountSettingRepository,
|
|
6
6
|
IAddressRepository,
|
|
7
|
+
ICalendarCollectionRepository,
|
|
8
|
+
ICalendarEventIndexRepository,
|
|
9
|
+
ICalendarObjectRepository,
|
|
10
|
+
ICalendarUnitOfWork,
|
|
11
|
+
IConfigImportRepository,
|
|
7
12
|
IEnvelopeRepository,
|
|
8
13
|
IFilterAnchorRepository,
|
|
9
14
|
IFilterAnchorTransaction,
|
|
@@ -78,6 +83,11 @@ export interface RemitClient {
|
|
|
78
83
|
envelope: IEnvelopeRepository;
|
|
79
84
|
accountExportRequest: IAccountExportRequestRepository;
|
|
80
85
|
|
|
86
|
+
// Applied configuration imports (#1021), and the folder references each is
|
|
87
|
+
// still waiting for. Read by GET /config to surface what a file named but
|
|
88
|
+
// IMAP has not produced yet, and written by the binder when it does.
|
|
89
|
+
configImport: IConfigImportRepository;
|
|
90
|
+
|
|
81
91
|
// Messages the sync path could not read (issue #72). Read-only from the API
|
|
82
92
|
// process: the sync worker writes the rows, settings lists them.
|
|
83
93
|
quarantine: IQuarantineRepository;
|
|
@@ -109,6 +119,17 @@ export interface RemitClient {
|
|
|
109
119
|
// body-sync, which is its only writer.
|
|
110
120
|
senderSignerStanding: ISenderSignerStandingRepository;
|
|
111
121
|
|
|
122
|
+
// The calendar store (issue #15). Every write goes through
|
|
123
|
+
// `calendarUnitOfWork`: the object, its occurrence rows and the collection's
|
|
124
|
+
// sequence bump are one fact, and the three repositories beside it are the
|
|
125
|
+
// read side. A backend that cannot supply them cannot serve the calendar at
|
|
126
|
+
// all, so they are part of the client rather than something each handler
|
|
127
|
+
// checks for.
|
|
128
|
+
calendarCollection: ICalendarCollectionRepository;
|
|
129
|
+
calendarObject: ICalendarObjectRepository;
|
|
130
|
+
calendarEventIndex: ICalendarEventIndexRepository;
|
|
131
|
+
calendarUnitOfWork: ICalendarUnitOfWork;
|
|
132
|
+
|
|
112
133
|
// Atomic write set for a message save. Present on the relational backend (real
|
|
113
134
|
// transaction); absent on DynamoDB, where callers fall back to per-repo
|
|
114
135
|
// writes with that backend's own (non-transactional) guarantees.
|
|
@@ -163,6 +184,13 @@ export interface RemitClient {
|
|
|
163
184
|
|
|
164
185
|
// Helper to create IMAP connection scope from accountId
|
|
165
186
|
createConnectionScope: (accountId: string) => Promise<ConnectionScope>;
|
|
187
|
+
|
|
188
|
+
// Runs an arbitrary set of repository writes as one transaction. Absent on a
|
|
189
|
+
// backend with no cross-entity transaction, where the caller's contract is
|
|
190
|
+
// instead: validate before the first write, fail fast, and report what
|
|
191
|
+
// landed. The message-save write set has its own bound repositories and uses
|
|
192
|
+
// `unitOfWork`; this one takes the repos as they are.
|
|
193
|
+
writeSet?: <T>(run: () => Promise<T>) => Promise<T>;
|
|
166
194
|
}
|
|
167
195
|
|
|
168
196
|
export interface RemitClientRepositories {
|
|
@@ -180,6 +208,7 @@ export interface RemitClientRepositories {
|
|
|
180
208
|
threadMessage: IThreadMessageRepository;
|
|
181
209
|
envelope: IEnvelopeRepository;
|
|
182
210
|
accountExportRequest: IAccountExportRequestRepository;
|
|
211
|
+
configImport: IConfigImportRepository;
|
|
183
212
|
quarantine: IQuarantineRepository;
|
|
184
213
|
organizeJobRequest: IOrganizeJobRequestRepository;
|
|
185
214
|
placementMove: IMessagePlacementMoveRepository;
|
|
@@ -190,7 +219,12 @@ export interface RemitClientRepositories {
|
|
|
190
219
|
label: ILabelRepository;
|
|
191
220
|
messageLabel: IMessageLabelRepository;
|
|
192
221
|
senderSignerStanding: ISenderSignerStandingRepository;
|
|
222
|
+
calendarCollection: ICalendarCollectionRepository;
|
|
223
|
+
calendarObject: ICalendarObjectRepository;
|
|
224
|
+
calendarEventIndex: ICalendarEventIndexRepository;
|
|
225
|
+
calendarUnitOfWork: ICalendarUnitOfWork;
|
|
193
226
|
unitOfWork?: IUnitOfWork;
|
|
227
|
+
writeSet?: <T>(run: () => Promise<T>) => Promise<T>;
|
|
194
228
|
}
|
|
195
229
|
|
|
196
230
|
export interface RemitClientSharedDeps {
|
|
@@ -407,6 +441,7 @@ export const createRemitClient = (deps: RemitClientDeps): RemitClient => {
|
|
|
407
441
|
threadMessage: repositories.threadMessage,
|
|
408
442
|
envelope: repositories.envelope,
|
|
409
443
|
accountExportRequest: repositories.accountExportRequest,
|
|
444
|
+
configImport: repositories.configImport,
|
|
410
445
|
quarantine: repositories.quarantine,
|
|
411
446
|
organizeJobRequest: repositories.organizeJobRequest,
|
|
412
447
|
filter: repositories.filter,
|
|
@@ -415,7 +450,12 @@ export const createRemitClient = (deps: RemitClientDeps): RemitClient => {
|
|
|
415
450
|
label: repositories.label,
|
|
416
451
|
messageLabel: repositories.messageLabel,
|
|
417
452
|
senderSignerStanding: repositories.senderSignerStanding,
|
|
453
|
+
calendarCollection: repositories.calendarCollection,
|
|
454
|
+
calendarObject: repositories.calendarObject,
|
|
455
|
+
calendarEventIndex: repositories.calendarEventIndex,
|
|
456
|
+
calendarUnitOfWork: repositories.calendarUnitOfWork,
|
|
418
457
|
unitOfWork: repositories.unitOfWork,
|
|
458
|
+
writeSet: repositories.writeSet,
|
|
419
459
|
|
|
420
460
|
storage,
|
|
421
461
|
search,
|
package/src/types.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type OperationIds =
|
|
|
13
13
|
| "MeOperations_listQuarantine"
|
|
14
14
|
| "ConfigOperations_getConfig"
|
|
15
15
|
| "ConfigOperations_exportConfig"
|
|
16
|
+
| "ConfigOperations_importConfig"
|
|
16
17
|
| "SystemOperations_getSystemUpdate"
|
|
17
18
|
| "SystemOperations_applySystemUpdate"
|
|
18
19
|
| "AccountOperations_createAccount"
|
|
@@ -57,6 +58,17 @@ export type OperationIds =
|
|
|
57
58
|
| "MessageBulkOperations_updateMessageLabels"
|
|
58
59
|
| "MessageBulkOperations_reportSpam"
|
|
59
60
|
| "MessageBulkOperations_notSpam"
|
|
61
|
+
| "CalendarOperations_listCalendars"
|
|
62
|
+
| "CalendarOperations_createCalendar"
|
|
63
|
+
| "CalendarDetailOperations_getCalendar"
|
|
64
|
+
| "CalendarDetailOperations_updateCalendar"
|
|
65
|
+
| "CalendarDetailOperations_deleteCalendar"
|
|
66
|
+
| "CalendarEventOperations_listCalendarEvents"
|
|
67
|
+
| "CalendarEventOperations_createCalendarEvent"
|
|
68
|
+
| "CalendarEventDetailOperations_getCalendarEvent"
|
|
69
|
+
| "CalendarEventDetailOperations_updateCalendarEvent"
|
|
70
|
+
| "CalendarEventDetailOperations_deleteCalendarEvent"
|
|
71
|
+
| "CalendarFreeBusyOperations_listCalendarFreeBusy"
|
|
60
72
|
| "TrashOperations_emptyTrash"
|
|
61
73
|
| "OutboxOperations_createOutboxMessage"
|
|
62
74
|
| "OutboxOperations_listOutboxMessages"
|
|
@@ -153,6 +165,31 @@ export type MessageBulkOperationIds = MatchPrefix<
|
|
|
153
165
|
OperationIds
|
|
154
166
|
>;
|
|
155
167
|
|
|
168
|
+
export type CalendarOperationIds = MatchPrefix<
|
|
169
|
+
"CalendarOperations_",
|
|
170
|
+
OperationIds
|
|
171
|
+
>;
|
|
172
|
+
|
|
173
|
+
export type CalendarDetailOperationIds = MatchPrefix<
|
|
174
|
+
"CalendarDetailOperations_",
|
|
175
|
+
OperationIds
|
|
176
|
+
>;
|
|
177
|
+
|
|
178
|
+
export type CalendarEventOperationIds = MatchPrefix<
|
|
179
|
+
"CalendarEventOperations_",
|
|
180
|
+
OperationIds
|
|
181
|
+
>;
|
|
182
|
+
|
|
183
|
+
export type CalendarEventDetailOperationIds = MatchPrefix<
|
|
184
|
+
"CalendarEventDetailOperations_",
|
|
185
|
+
OperationIds
|
|
186
|
+
>;
|
|
187
|
+
|
|
188
|
+
export type CalendarFreeBusyOperationIds = MatchPrefix<
|
|
189
|
+
"CalendarFreeBusyOperations_",
|
|
190
|
+
OperationIds
|
|
191
|
+
>;
|
|
192
|
+
|
|
156
193
|
export type TrashOperationIds = MatchPrefix<"TrashOperations_", OperationIds>;
|
|
157
194
|
|
|
158
195
|
export type OutboxOperationIds = MatchPrefix<"OutboxOperations_", OperationIds>;
|