@remit/data-ports 0.0.63 → 0.0.64

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.63",
3
+ "version": "0.0.64",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -138,6 +138,7 @@ export type {
138
138
  ResultList,
139
139
  SearchOptions,
140
140
  SenderSignerStandingItem,
141
+ ThreadMessageFieldTerm,
141
142
  ThreadMessageItem,
142
143
  UpdateAccountConfigInput,
143
144
  UpdateAccountExportRequestInput,
@@ -2,6 +2,7 @@ import type {
2
2
  CreateThreadMessageInput,
3
3
  ResultList,
4
4
  SearchOptions,
5
+ ThreadMessageFieldTerm,
5
6
  ThreadMessageItem,
6
7
  UpdateThreadMessageInput,
7
8
  } from "../types.js";
@@ -85,6 +86,42 @@ export interface IThreadMessageRepository {
85
86
  excludeDeleted?: boolean;
86
87
  },
87
88
  ): Promise<ResultList<ThreadMessageItem>>;
89
+ /**
90
+ * Rows of a config whose sender, subject or `List-Id` column matches a set
91
+ * of substring terms, newest first, across every mailbox — the store-side
92
+ * narrowing a rule back-apply reads with.
93
+ *
94
+ * The terms are evaluated in the query, so `limit` is a page size over
95
+ * MATCHES and the scan reaches the whole config however old the matching
96
+ * mail is. Paging a date-ordered listing and filtering the rows it returned
97
+ * is what makes a rule for a quiet sender report a handful of matches on a
98
+ * mailbox holding thousands (#459).
99
+ *
100
+ * `operator` combines the terms — `"and"` requires every one, `"or"` any.
101
+ * An empty `terms` narrows nothing under either operator: the whole config,
102
+ * newest first.
103
+ *
104
+ * A term an implementation cannot evaluate faithfully is IGNORED, never
105
+ * approximated: the result may be wider than the terms asked for and never
106
+ * narrower, so the caller's own matcher stays the judge.
107
+ *
108
+ * Matching follows `searchByMailbox`: accent- and case-insensitive
109
+ * substring over the same folded columns.
110
+ *
111
+ * Rows are per mailbox, not per conversation: the same mail filed in two
112
+ * folders is two rows sharing a `threadId`.
113
+ */
114
+ listByFieldTerms(
115
+ accountConfigId: string,
116
+ terms: readonly ThreadMessageFieldTerm[],
117
+ options?: {
118
+ operator?: "and" | "or";
119
+ order?: "asc" | "desc";
120
+ limit?: number;
121
+ continuationToken?: string;
122
+ excludeDeleted?: boolean;
123
+ },
124
+ ): Promise<ResultList<ThreadMessageItem>>;
88
125
  /**
89
126
  * List starred rows for a config, newest first, across every mailbox.
90
127
  *
package/src/types.ts CHANGED
@@ -488,6 +488,22 @@ export type UpdateThreadMessageInput = Partial<
488
488
  Omit<CreateThreadMessageInput, "accountConfigId" | "threadId" | "messageId">
489
489
  >;
490
490
 
491
+ /**
492
+ * One substring criterion over a text column of a ThreadMessage row, named by
493
+ * the column it selects on rather than by whatever rule derived it. `sender`
494
+ * covers the From address and display name together, the same pair
495
+ * `SearchOptions.from` reads.
496
+ *
497
+ * Matching is accent- and case-insensitive substring, identical to the search
498
+ * predicates, so a term is a NARROWING a caller refines further in memory. It
499
+ * may return more than the criterion it stands for and never less — a term an
500
+ * implementation cannot evaluate faithfully is dropped, not approximated.
501
+ */
502
+ export type ThreadMessageFieldTerm = {
503
+ field: "sender" | "subject" | "listId";
504
+ contains: string;
505
+ };
506
+
491
507
  export type SearchOptions = {
492
508
  query?: string;
493
509
  subject?: string;