@remit/data-ports 0.0.70 → 0.0.72

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.70",
3
+ "version": "0.0.72",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -100,6 +100,7 @@ export type {
100
100
  CreateFilterInput,
101
101
  CreateLabelInput,
102
102
  CreateMailboxInput,
103
+ CreateMailboxResult,
103
104
  CreateMessageFlagInput,
104
105
  CreateMessageInput,
105
106
  CreateMessageLabelInput,
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  CreateMailboxInput,
3
+ CreateMailboxResult,
3
4
  MailboxItem,
4
5
  MailboxSubtreeTransitionIntent,
5
6
  MailboxTransitionIntent,
@@ -8,7 +9,7 @@ import type {
8
9
  } from "../types.js";
9
10
 
10
11
  export interface IMailboxRepository {
11
- create(input: CreateMailboxInput): Promise<MailboxItem>;
12
+ create(input: CreateMailboxInput): Promise<CreateMailboxResult>;
12
13
  get(accountId: string, mailboxId: string): Promise<MailboxItem>;
13
14
  get(accountId: string, mailboxIds: string[]): Promise<MailboxItem[]>;
14
15
  /**
@@ -58,11 +58,12 @@ export interface IThreadMessageRepository {
58
58
  },
59
59
  ): Promise<ResultList<ThreadMessageItem>>;
60
60
  /**
61
- * Search rows for a config across every mailbox in `mailboxIds`, newest
62
- * first — the cross-account, cross-folder counterpart of `searchByMailbox`.
61
+ * Search rows for a config across every mailbox in `mailboxIds` — the
62
+ * cross-account, cross-folder counterpart of `searchByMailbox`. A row whose
63
+ * From matches any `query` term ranks above one that only mentions the
64
+ * terms, and each tier runs in date order.
63
65
  *
64
- * Backed by the same date-ordered access pattern as `listByDate`; the caller
65
- * supplies the mailbox scope, so a search reaching Archive, Sent, Spam and
66
+ * The caller supplies the mailbox scope, so a search reaching Archive, Sent, Spam and
66
67
  * custom folders is a matter of which set is passed. An empty or absent
67
68
  * `mailboxIds` means no narrowing (every mailbox of the config), which is why
68
69
  * handlers pass an explicitly built set rather than relying on the default.
@@ -9,6 +9,8 @@
9
9
  */
10
10
  export const MUTATION_EVENT_SCHEMA_VERSION = 2;
11
11
 
12
+ export const PATHLESS_MUTATION_EVENT_SCHEMA_VERSION = 3;
13
+
12
14
  /**
13
15
  * Queue payloads are `JSON.parse`d and cast with no validation, so the declared
14
16
  * type is a promise the queue cannot keep. A handler that cannot vouch for an
@@ -16,5 +18,6 @@ export const MUTATION_EVENT_SCHEMA_VERSION = 2;
16
18
  * makes the unverified expunge the default for every event we cannot vouch for,
17
19
  * including any future producer that forgets the field.
18
20
  */
19
- export const isCurrentSchemaVersion = (value: unknown): boolean =>
20
- value === MUTATION_EVENT_SCHEMA_VERSION;
21
+ export const isAcceptedSchemaVersion = (value: unknown): boolean =>
22
+ value === MUTATION_EVENT_SCHEMA_VERSION ||
23
+ value === PATHLESS_MUTATION_EVENT_SCHEMA_VERSION;
package/src/types.ts CHANGED
@@ -386,6 +386,10 @@ export type CreateMailboxInput = Omit<
386
386
  syncStatus?: MailboxItem["syncStatus"];
387
387
  };
388
388
 
389
+ export type CreateMailboxResult =
390
+ | { outcome: "Created"; mailbox: MailboxItem }
391
+ | { outcome: "PathTaken" };
392
+
389
393
  /**
390
394
  * Everything about a mailbox that is not its mutation state.
391
395
  *