@remit/data-ports 0.0.20 → 0.0.21

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.20",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export type { IAddressRepository } from "./interfaces/address.js";
6
6
  export type { IEnvelopeRepository } from "./interfaces/envelope.js";
7
7
  export type { IFilterRepository } from "./interfaces/filter.js";
8
8
  export type { IFilterAnchorRepository } from "./interfaces/filter-anchor.js";
9
+ export type { IFilterAnchorTransaction } from "./interfaces/filter-anchor-transaction.js";
9
10
  export type { ILabelRepository } from "./interfaces/label.js";
10
11
  export type { IMailboxRepository } from "./interfaces/mailbox.js";
11
12
  export type { IMailboxLockRepository } from "./interfaces/mailbox-lock.js";
@@ -0,0 +1,23 @@
1
+ import type {
2
+ CreateFilterAnchorInput,
3
+ CreateFilterInput,
4
+ FilterItem,
5
+ } from "../types.js";
6
+
7
+ /**
8
+ * Atomically creates a `Filter` row and its optional sibling `FilterAnchor`
9
+ * row (#351). Without this, the two writes ran sequentially: a failure on the
10
+ * second left a `Filter` durably marked `hasAnchor: true` with no matching
11
+ * `FilterAnchor` row — a filter that looks normal but silently matches
12
+ * nothing, forever, with no repair path (the anchor message id is never
13
+ * retained once `createFilterWithAnchor` returns).
14
+ *
15
+ * `anchor` omits `filterId` — it is not known until the `Filter` row is
16
+ * created inside the same transaction.
17
+ */
18
+ export interface IFilterAnchorTransaction {
19
+ createWithAnchor(
20
+ filter: CreateFilterInput,
21
+ anchor: Omit<CreateFilterAnchorInput, "filterId"> | null,
22
+ ): Promise<FilterItem>;
23
+ }