@remit/data-ports 0.0.9 → 0.0.10

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.9",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -83,6 +83,7 @@ export type {
83
83
  PutMessagePlacementMoveInput,
84
84
  QuarantineItem,
85
85
  QuarantineMimeNodeItem,
86
+ QuarantineUpsertInput,
86
87
  RawMessageStorageItem,
87
88
  ResultList,
88
89
  SearchOptions,
@@ -1,4 +1,4 @@
1
- import type { QuarantineItem } from "../types.js";
1
+ import type { QuarantineItem, QuarantineUpsertInput } from "../types.js";
2
2
 
3
3
  export interface IQuarantineRepository {
4
4
  /**
@@ -7,4 +7,16 @@ export interface IQuarantineRepository {
7
7
  * surface and by a sync round that keeps it in memory.
8
8
  */
9
9
  listByAccountConfigId(accountConfigId: string): Promise<QuarantineItem[]>;
10
+
11
+ /**
12
+ * Record a message the sync path could not apply.
13
+ *
14
+ * Idempotent on the message's identity: the row is keyed by an id derived
15
+ * from (accountId, mailboxId, uidValidity, uid), so quarantining the same
16
+ * message twice rewrites one row instead of accumulating. The derivation
17
+ * happens here rather than at the call site — see `QuarantineUpsertInput`.
18
+ *
19
+ * A cursor may only move past a message once this has resolved.
20
+ */
21
+ upsert(input: QuarantineUpsertInput): Promise<void>;
10
22
  }
package/src/types.ts CHANGED
@@ -89,6 +89,21 @@ export type MessageFlagPushItem = z.infer<typeof MessageFlagPushSchema>;
89
89
  export type QuarantineItem = z.infer<typeof QuarantineSchema>;
90
90
  export type QuarantineMimeNodeItem = QuarantineItem["structure"][number];
91
91
 
92
+ /**
93
+ * What a caller supplies to quarantine a message.
94
+ *
95
+ * `quarantineId` is absent on purpose. The column carries a random-id default
96
+ * (the house pattern for every entity here), so an input that merely allowed
97
+ * the id would let a writer omit it, take a fresh random one on every retry,
98
+ * and turn the idempotent write this record depends on into an accumulating
99
+ * pile of rows that the derived-id lookup never finds. The repository derives
100
+ * it from the four fields that name the message, which are all required here.
101
+ */
102
+ export type QuarantineUpsertInput = Omit<
103
+ QuarantineItem,
104
+ "quarantineId" | "createdAt" | "updatedAt" | "structure"
105
+ > & { structure?: QuarantineMimeNodeItem[] };
106
+
92
107
  export type MailboxSpecialUseValue = z.infer<typeof MailboxSpecialUseSchema>;
93
108
 
94
109
  export type AccountSettingValue =