@remit/drizzle-service 0.0.95 → 0.0.96

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/drizzle-service",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "description": "Drizzle ORM service over SQLite",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -35,6 +35,16 @@ const filterAtDedupe = sqliteTable("filter", {
35
35
  updatedAt: integer("updated_at").notNull(),
36
36
  });
37
37
 
38
+ const organizeJobAtDedupe = sqliteTable("organize_job_request", {
39
+ organizeJobId: text("organize_job_id").primaryKey(),
40
+ accountConfigId: text("account_config_id").notNull(),
41
+ userId: text("user_id").notNull(),
42
+ actionMailboxId: text("action_mailbox_id").notNull(),
43
+ ttl: integer("ttl").notNull(),
44
+ createdAt: integer("created_at").notNull(),
45
+ updatedAt: integer("updated_at").notNull(),
46
+ });
47
+
38
48
  type Handle = { sqlite: Database.Database; db: Db<Record<string, unknown>> };
39
49
 
40
50
  const atPredecessor = (): Handle => {
@@ -229,7 +239,7 @@ describe("(account_id, full_path) becomes unique", () => {
229
239
  createdAt: 0,
230
240
  updatedAt: 0,
231
241
  });
232
- await handle.db.insert(entities.organizeJobRequests).values({
242
+ await handle.db.insert(organizeJobAtDedupe).values({
233
243
  organizeJobId: "job-1",
234
244
  accountConfigId: CONFIG,
235
245
  userId: "user",
@@ -272,7 +282,7 @@ describe("(account_id, full_path) becomes unique", () => {
272
282
  assert.equal(child?.parent, "with-mail");
273
283
  const [filter] = await handle.db.select().from(filterAtDedupe);
274
284
  assert.equal(filter?.actionMailboxId, "with-mail");
275
- const [job] = await handle.db.select().from(entities.organizeJobRequests);
285
+ const [job] = await handle.db.select().from(organizeJobAtDedupe);
276
286
  assert.equal(job?.actionMailboxId, "with-mail");
277
287
  const [copied] = await handle.db
278
288
  .select({ original: entities.messages.originalMailboxId })
@@ -22,6 +22,7 @@ function rowToItem(
22
22
  accountConfigId: row.accountConfigId,
23
23
  userId: row.userId,
24
24
  state: row.state as OrganizeJobRequestItem["state"],
25
+ filterId: row.filterId,
25
26
  anchorMessageId: row.anchorMessageId,
26
27
  matchOperator: row.matchOperator as OrganizeJobRequestItem["matchOperator"],
27
28
  literalClauses:
@@ -53,6 +54,7 @@ export class OrganizeJobRequestRepo implements IOrganizeJobRequestRepository {
53
54
  accountConfigId: input.accountConfigId,
54
55
  userId: input.userId,
55
56
  state: input.state ?? "Pending",
57
+ filterId: input.filterId,
56
58
  anchorMessageId: input.anchorMessageId,
57
59
  matchOperator: input.matchOperator,
58
60
  literalClauses: input.literalClauses,
@@ -664,6 +664,7 @@ export class DrizzleThreadMessageRepository
664
664
  limit?: number;
665
665
  continuationToken?: string;
666
666
  excludeDeleted?: boolean;
667
+ mailboxIds?: readonly string[];
667
668
  },
668
669
  ): Promise<ResultList<ThreadMessageItem>> {
669
670
  const order = options?.order ?? "desc";
@@ -681,6 +682,9 @@ export class DrizzleThreadMessageRepository
681
682
  options?.excludeDeleted
682
683
  ? eq(threadMessageTable.isDeleted, false)
683
684
  : undefined,
685
+ options?.mailboxIds
686
+ ? inArray(threadMessageTable.mailboxId, [...options.mailboxIds])
687
+ : undefined,
684
688
  buildFieldTermCondition(terms, options?.operator ?? "and"),
685
689
  sentDateCursorCond(order, cursor),
686
690
  ),