@remit/data-ports 0.0.94 → 1.0.0

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.
@@ -132,6 +132,10 @@ export declare const accountSettingRegistry: {
132
132
  kind: z.ZodLiteral<"String">;
133
133
  value: z.ZodString;
134
134
  }, z.core.$strip>;
135
+ readonly DefaultInvitationSenderAccountId: z.ZodObject<{
136
+ kind: z.ZodLiteral<"String">;
137
+ value: z.ZodString;
138
+ }, z.core.$strip>;
135
139
  };
136
140
  export type AccountSettingRegistry = typeof accountSettingRegistry;
137
141
  export type AccountSettingValueFor<N extends AccountSettingNameValue> = z.infer<AccountSettingRegistry[N]>;
@@ -77,6 +77,7 @@ export const accountSettingRegistry = {
77
77
  * write new rows under this name. Remove once the row-deletion migration ships.
78
78
  */
79
79
  [AccountSettingName.MailboxRole]: StringSettingSchema,
80
+ [AccountSettingName.DefaultInvitationSenderAccountId]: StringSettingSchema,
80
81
  };
81
82
  /**
82
83
  * Separator between a setting's base enum member and its per-target suffix in a
package/dist/id.d.ts CHANGED
@@ -39,6 +39,8 @@ export declare const deriveCalendarFeedTokenId: (calendarId: string) => string;
39
39
  * row and silently lose the second.
40
40
  */
41
41
  export declare const deriveCalendarObjectId: (calendarId: string, resourceName: string) => string;
42
+ /** Identity of a task, derived from its collection and resource name. */
43
+ export declare const deriveCalendarTaskId: (calendarId: string, resourceName: string) => string;
42
44
  /**
43
45
  * Identity of a suggestion read out of a message (issue #1033). Derived from
44
46
  * the message, the MIME part the bytes came from and the event's iCalendar
package/dist/id.js CHANGED
@@ -42,6 +42,8 @@ export const deriveCalendarFeedTokenId = (calendarId) => base36uuidv5(`calendarf
42
42
  * row and silently lose the second.
43
43
  */
44
44
  export const deriveCalendarObjectId = (calendarId, resourceName) => base36uuidv5(`calendarobject:${calendarId}:${resourceName}`, REMIT_NAMESPACE);
45
+ /** Identity of a task, derived from its collection and resource name. */
46
+ export const deriveCalendarTaskId = (calendarId, resourceName) => base36uuidv5(`calendartask:${calendarId}:${resourceName}`, REMIT_NAMESPACE);
45
47
  /**
46
48
  * Identity of a suggestion read out of a message (issue #1033). Derived from
47
49
  * the message, the MIME part the bytes came from and the event's iCalendar
package/dist/index.d.ts CHANGED
@@ -10,8 +10,9 @@ export type { ICalendarCollectionRepository } from "./interfaces/calendar-collec
10
10
  export type { ICalendarEventIndexRepository } from "./interfaces/calendar-event-index.js";
11
11
  export type { ICalendarFeedTokenRepository } from "./interfaces/calendar-feed-token.js";
12
12
  export type { ICalendarObjectRepository } from "./interfaces/calendar-object.js";
13
- export type { CalendarRepositories, CalendarWrite, DeleteCalendarCollectionWrite, DeleteCalendarObjectWrite, ICalendarStore, PutCalendarObjectWrite, ReprojectCalendarObjectWrite, SettleCalendarSuggestionWrite, UpdateCalendarCollectionWrite, } from "./interfaces/calendar-store.js";
13
+ export type { CalendarCommitReport, CalendarRepositories, CalendarWrite, DeleteCalendarCollectionWrite, DeleteCalendarObjectWrite, ICalendarStore, PutCalendarObjectWrite, ReprojectCalendarObjectWrite, SettleCalendarSuggestionWrite, UpdateCalendarCollectionWrite, } from "./interfaces/calendar-store.js";
14
14
  export type { ICalendarSuggestionRepository, SettleCalendarSuggestionInput, } from "./interfaces/calendar-suggestion.js";
15
+ export type { ICalendarTaskRepository } from "./interfaces/calendar-task.js";
15
16
  export type { IConfigImportRepository } from "./interfaces/config-import.js";
16
17
  export type { IEnvelopeRepository } from "./interfaces/envelope.js";
17
18
  export type { IFilterRepository } from "./interfaces/filter.js";
@@ -29,6 +30,7 @@ export type { CreateOutboxAttachmentInput, IOutboxAttachmentRepository, OutboxAt
29
30
  export { holdsRoom } from "./interfaces/outbox-attachment.js";
30
31
  export type { IOutboxMessageRepository } from "./interfaces/outbox-message.js";
31
32
  export { APPENDED_UID_NONE, APPENDED_UID_UNREPORTED, isSentCopyFiled, } from "./interfaces/outbox-message.js";
33
+ export type { IOutboxSchedulingPartRepository } from "./interfaces/outbox-scheduling-part.js";
32
34
  export type { IQuarantineRepository } from "./interfaces/quarantine.js";
33
35
  export { type FifoQueueMessage, type FifoQueueProducer, type GroupedQueueMessage, type GroupedQueueProducer, QUEUE_BATCH_LIMIT, type QueueBatchResult, type QueueKind, type QueueMessage, type QueueProducer, type QueueProducerOf, } from "./interfaces/queue.js";
34
36
  export type { ISenderSignerStandingRepository } from "./interfaces/sender-signer-standing.js";
@@ -37,4 +39,4 @@ export type { IThreadMessageRepository } from "./interfaces/thread-message.js";
37
39
  export type { MessageSettlementFields } from "./message-settlement.js";
38
40
  export { abandonedMutationOf, hasAbandonedDelete, hasAbandonedMove, } from "./message-settlement.js";
39
41
  export { FILTER_NO_ACTION, isSenderMuted, isSenderMuteFilter, } from "./sender-mute.js";
40
- export type { AccountConfigDescription, AccountConfigItem, AccountDescription, AccountExportRequestItem, AccountItem, AccountSchedulerPage, AccountSettingItem, AccountSettingValue, AddressFlags, AddressItem, BodyPartItem, BodyPartParameterItem, BodyPartParameterUpsertInput, BodyPartUpsertInput, CalendarCollectionItem, CalendarEventIndexItem, CalendarFeedTokenItem, CalendarObjectItem, CalendarOccurrenceInput, CalendarSuggestionItem, ConfigImportItem, ConfigImportUnresolvedRefItem, CreateAccountConfigInput, CreateAccountExportRequestInput, CreateAccountInput, CreateAddressInput, CreateCalendarCollectionInput, CreateConfigImportInput, CreateEnvelopeAddressInput, CreateEnvelopeInput, CreateFilterInput, CreateLabelInput, CreateMailboxInput, CreateMailboxResult, CreateMessageFlagInput, CreateMessageInput, CreateMessageLabelInput, CreateOrganizeJobRequestInput, CreateOutboxMessageInput, CreateThreadMessageInput, EnvelopeAddressItem, EnvelopeItem, FilterItem, FlagsMergePatch, LabelItem, ListOptions, MailboxItem, MailboxLockItem, MailboxSpecialUseItem, MailboxSpecialUseValue, MailboxStatePredicate, MailboxSubtreeTransitionIntent, MailboxTransitionIntent, MailboxTransitionWrite, MessageData, MessageDescription, MessageFlagItem, MessageFlagPushItem, MessageIdSource, MessageItem, MessageLabelItem, MessagePlacementMoveItem, MessageReferenceInput, MessageReferenceItem, ObserveSenderSignerStandingInput, OrganizeJobRequestItem, OutboxAttachmentItem, OutboxMessageItem, PlacementPredicate, PlacementTransitionInput, PutCalendarFeedTokenInput, PutCalendarObjectInput, PutCalendarSuggestionInput, PutMessageFlagPushInput, PutMessagePlacementMoveInput, QuarantineItem, QuarantineMimeNodeItem, QuarantineUpsertInput, RawMessageStorageItem, RemovableAccountField, ResultList, SearchOptions, SenderSignerStandingItem, SyncWarningItem, SyncWarningKey, ThreadMessageFieldTerm, ThreadMessageItem, UpdateAccountConfigInput, UpdateAccountExportRequestInput, UpdateAccountInput, UpdateAddressInput, UpdateCalendarCollectionInput, UpdateConfigImportInput, UpdateEnvelopeInput, UpdateFilterInput, UpdateLabelInput, UpdateMailboxInput, UpdateMessageInput, UpdateOrganizeJobRequestInput, UpdateOutboxMessageInput, UpdateThreadMessageInput, UpsertAccountSettingInput, WithMailboxLockResult, } from "./types.js";
42
+ export type { AccountConfigDescription, AccountConfigItem, AccountDescription, AccountExportRequestItem, AccountItem, AccountSchedulerPage, AccountSettingItem, AccountSettingValue, AddressFlags, AddressItem, BodyPartItem, BodyPartParameterItem, BodyPartParameterUpsertInput, BodyPartUpsertInput, CalendarCollectionItem, CalendarEventIndexItem, CalendarFeedTokenItem, CalendarObjectItem, CalendarOccurrenceInput, CalendarSuggestionItem, CalendarTaskItem, ConfigImportItem, ConfigImportUnresolvedRefItem, CreateAccountConfigInput, CreateAccountExportRequestInput, CreateAccountInput, CreateAddressInput, CreateCalendarCollectionInput, CreateConfigImportInput, CreateEnvelopeAddressInput, CreateEnvelopeInput, CreateFilterInput, CreateLabelInput, CreateMailboxInput, CreateMailboxResult, CreateMessageFlagInput, CreateMessageInput, CreateMessageLabelInput, CreateOrganizeJobRequestInput, CreateOutboxMessageInput, CreateOutboxSchedulingPartInput, CreateThreadMessageInput, EnvelopeAddressItem, EnvelopeItem, FilterItem, FlagsMergePatch, LabelItem, ListOptions, MailboxItem, MailboxLockItem, MailboxSpecialUseItem, MailboxSpecialUseValue, MailboxStatePredicate, MailboxSubtreeTransitionIntent, MailboxTransitionIntent, MailboxTransitionWrite, MessageData, MessageDescription, MessageFlagItem, MessageFlagPushItem, MessageIdSource, MessageItem, MessageLabelItem, MessagePlacementMoveItem, MessageReferenceInput, MessageReferenceItem, ObserveSenderSignerStandingInput, OrganizeJobRequestItem, OutboxAttachmentItem, OutboxMessageItem, OutboxSchedulingPartItem, PlacementPredicate, PlacementTransitionInput, PutCalendarFeedTokenInput, PutCalendarObjectInput, PutCalendarSuggestionInput, PutCalendarTaskInput, PutMessageFlagPushInput, PutMessagePlacementMoveInput, QuarantineItem, QuarantineMimeNodeItem, QuarantineUpsertInput, RawMessageStorageItem, RemovableAccountField, ResultList, SearchOptions, SenderSignerStandingItem, SyncWarningItem, SyncWarningKey, ThreadMessageFieldTerm, ThreadMessageItem, UpdateAccountConfigInput, UpdateAccountExportRequestInput, UpdateAccountInput, UpdateAddressInput, UpdateCalendarCollectionInput, UpdateConfigImportInput, UpdateEnvelopeInput, UpdateFilterInput, UpdateLabelInput, UpdateMailboxInput, UpdateMessageInput, UpdateOrganizeJobRequestInput, UpdateOutboxMessageInput, UpdateThreadMessageInput, UpsertAccountSettingInput, WithMailboxLockResult, } from "./types.js";
@@ -87,7 +87,15 @@ export type CalendarWrite = PutCalendarObjectWrite | ReprojectCalendarObjectWrit
87
87
  * returned before it, and a write that a stale read would get wrong is keyed so
88
88
  * that repeating or racing it converges (derived ids, upserts).
89
89
  */
90
+ /** What a commit could not do because a read it was decided on went stale. */
91
+ export interface CalendarCommitReport {
92
+ /**
93
+ * The resources whose `ReprojectObject` wrote nothing, because they were
94
+ * edited or deleted after they were read.
95
+ */
96
+ staleReprojections: string[];
97
+ }
90
98
  export interface ICalendarStore {
91
99
  readonly repos: CalendarRepositories;
92
- commit(writes: readonly CalendarWrite[]): Promise<void>;
100
+ commit(writes: readonly CalendarWrite[]): Promise<CalendarCommitReport>;
93
101
  }
@@ -0,0 +1,13 @@
1
+ import type { CalendarTaskItem, PutCalendarTaskInput } from "../types.js";
2
+ /**
3
+ * The tasks of `VtodoOnly` collections. Every write is one row, so there is no
4
+ * write set: a task has no occurrence rows and no sync sequence to keep in step.
5
+ */
6
+ export interface ICalendarTaskRepository {
7
+ put(input: PutCalendarTaskInput): Promise<CalendarTaskItem>;
8
+ find(calendarId: string, calendarTaskId: string): Promise<CalendarTaskItem | null>;
9
+ delete(calendarId: string, calendarTaskId: string): Promise<void>;
10
+ /** Tasks due within `[fromAt, toAt)`, UTC instants, in due order. */
11
+ listByDueRange(calendarId: string, fromAt: string, toAt: string): Promise<CalendarTaskItem[]>;
12
+ deleteByCalendar(calendarId: string): Promise<void>;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { CreateOutboxMessageInput, OutboxMessageItem, ResultList, UpdateOutboxMessageInput } from "../types.js";
1
+ import type { CreateOutboxMessageInput, CreateOutboxSchedulingPartInput, OutboxMessageItem, ResultList, UpdateOutboxMessageInput } from "../types.js";
2
2
  /** `appendedUid` when no IMAP APPEND has been confirmed for the row. */
3
3
  export declare const APPENDED_UID_NONE = 0;
4
4
  /**
@@ -20,7 +20,11 @@ export declare const APPENDED_UID_UNREPORTED = -1;
20
20
  */
21
21
  export declare const isSentCopyFiled: (message: Pick<OutboxMessageItem, "appendedUid">) => boolean;
22
22
  export interface IOutboxMessageRepository {
23
- create(input: CreateOutboxMessageInput): Promise<OutboxMessageItem>;
23
+ /**
24
+ * With a scheduling part, the message and its part are one write: a queued
25
+ * invitation without its calendar part would go out as a bare mail.
26
+ */
27
+ create(input: CreateOutboxMessageInput, schedulingPart?: CreateOutboxSchedulingPartInput): Promise<OutboxMessageItem>;
24
28
  /**
25
29
  * `mode: "read"` (default) throws NotFoundError on a foreign message so a
26
30
  * GET doesn't leak existence. `mode: "act"` throws ForbiddenError instead,
@@ -0,0 +1,11 @@
1
+ import type { OutboxSchedulingPartItem } from "../types.js";
2
+ /**
3
+ * The scheduling parts of outbox messages. A part is written with its message
4
+ * (`IOutboxMessageRepository.create`) and removed with it, so it is only ever
5
+ * read here.
6
+ */
7
+ export interface IOutboxSchedulingPartRepository {
8
+ find(outboxMessageId: string): Promise<OutboxSchedulingPartItem | null>;
9
+ /** The parts about one event whose messages are still in the outbox. */
10
+ listByCalendarObject(accountConfigId: string, calendarObjectId: string): Promise<OutboxSchedulingPartItem[]>;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AccountConfigSchema, AccountSchema, AddressSchema, BodyPartParameterSchema, BodyPartSchema, CalendarCollectionSchema, CalendarEventIndexSchema, CalendarFeedTokenSchema, CalendarObjectSchema, CalendarSuggestionSchema, ConfigImportSchema, ConfigImportUnresolvedRefSchema, EnvelopeAddressSchema, EnvelopeSchema, FilterSchema, LabelSchema, MailboxLockSchema, MailboxSchema, MailboxSpecialUseEntrySchema, MailboxSpecialUseSchema, MessageFlagPushSchema, MessageFlagSchema, MessageLabelSchema, MessagePlacementMoveSchema, MessageRecordSchema, OrganizeJobRequestSchema, OutboxAttachmentSchema, OutboxMessageSchema, QuarantineSchema, RawMessageStorageSchema, SenderSignerStandingSchema, SyncWarningSchema, ThreadMessageSchema } from "@remit/api-zod-schemas";
1
+ import type { AccountConfigSchema, AccountSchema, AddressSchema, BodyPartParameterSchema, BodyPartSchema, CalendarCollectionSchema, CalendarEventIndexSchema, CalendarFeedTokenSchema, CalendarObjectSchema, CalendarSuggestionSchema, CalendarTaskSchema, ConfigImportSchema, ConfigImportUnresolvedRefSchema, EnvelopeAddressSchema, EnvelopeSchema, FilterSchema, LabelSchema, MailboxLockSchema, MailboxSchema, MailboxSpecialUseEntrySchema, MailboxSpecialUseSchema, MessageFlagPushSchema, MessageFlagSchema, MessageLabelSchema, MessagePlacementMoveSchema, MessageRecordSchema, OrganizeJobRequestSchema, OutboxAttachmentSchema, OutboxMessageSchema, OutboxSchedulingPartSchema, QuarantineSchema, RawMessageStorageSchema, SenderSignerStandingSchema, SyncWarningSchema, ThreadMessageSchema } from "@remit/api-zod-schemas";
2
2
  import type { ReferenceType } from "@remit/domain-enums";
3
3
  import type { z } from "zod";
4
4
  export type ResultList<T> = {
@@ -25,6 +25,12 @@ export type MailboxItem = z.infer<typeof MailboxSchema>;
25
25
  export type ThreadMessageItem = z.infer<typeof ThreadMessageSchema>;
26
26
  export type OutboxMessageItem = z.infer<typeof OutboxMessageSchema>;
27
27
  export type OutboxAttachmentItem = z.infer<typeof OutboxAttachmentSchema>;
28
+ export type OutboxSchedulingPartItem = z.infer<typeof OutboxSchedulingPartSchema>;
29
+ /**
30
+ * The scheduling part an outbox message is created with. Its `outboxMessageId`
31
+ * and `accountConfigId` are the message's own.
32
+ */
33
+ export type CreateOutboxSchedulingPartInput = Pick<OutboxSchedulingPartItem, "calendarObjectId" | "recipient" | "method" | "sequence" | "icalData">;
28
34
  export type MessageItem = z.infer<typeof MessageRecordSchema>;
29
35
  export type MessageFlagItem = z.infer<typeof MessageFlagSchema>;
30
36
  export type BodyPartItem = z.infer<typeof BodyPartSchema>;
@@ -430,6 +436,13 @@ export type UpdateFilterInput = Partial<Omit<CreateFilterInput, "accountConfigId
430
436
  export type CalendarCollectionItem = z.infer<typeof CalendarCollectionSchema>;
431
437
  export type CalendarObjectItem = z.infer<typeof CalendarObjectSchema>;
432
438
  export type CalendarEventIndexItem = z.infer<typeof CalendarEventIndexSchema>;
439
+ export type CalendarTaskItem = z.infer<typeof CalendarTaskSchema>;
440
+ /**
441
+ * A whole task resource, every projected column supplied with the `icalData`
442
+ * it was projected from. `calendarTaskId` derives from calendarId +
443
+ * resourceName, so this is an upsert.
444
+ */
445
+ export type PutCalendarTaskInput = Omit<CalendarTaskItem, "calendarTaskId" | "createdAt" | "updatedAt">;
433
446
  export type CreateCalendarCollectionInput = Omit<CalendarCollectionItem, "calendarId" | "syncSequence" | "createdAt" | "updatedAt" | "color" | "componentSet" | "source" | "timezone" | "subscriptionUrl" | "subscriptionEnabled" | "subscriptionCheckedAt" | "subscriptionFetchedAt" | "subscriptionError"> & {
434
447
  color?: CalendarCollectionItem["color"];
435
448
  componentSet?: CalendarCollectionItem["componentSet"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/data-ports",
3
- "version": "0.0.94",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",