@remit/drizzle-service 0.0.62 → 0.0.63

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.62",
3
+ "version": "0.0.63",
4
4
  "description": "Drizzle ORM service over SQLite",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,32 +1,16 @@
1
+ import type {
2
+ MessageFlagPushItem,
3
+ PutMessageFlagPushInput,
4
+ } from "@remit/data-ports";
1
5
  import { and, eq } from "drizzle-orm";
2
6
  import type { Db } from "../db.js";
3
7
  import { messageFlagPushTable } from "../schema/i4-message-flag-push.js";
4
8
 
5
9
  type DB = Db<Record<string, unknown>>;
6
10
 
7
- export type FlagPushOperation = "add" | "remove";
8
- export type MessageFlagPushState =
9
- | "pending"
10
- | "queued"
11
- | "processing"
12
- | "processed";
13
-
14
- export interface MessageFlagPushItem {
15
- messageId: string;
16
- flagName: string;
17
- accountId: string;
18
- accountConfigId: string;
19
- mailboxId: string;
20
- operation: FlagPushOperation;
21
- state: MessageFlagPushState;
22
- createdAt: number;
23
- updatedAt: number;
24
- }
25
-
26
- export type PutMessageFlagPushInput = Omit<
27
- MessageFlagPushItem,
28
- "state" | "createdAt" | "updatedAt"
29
- >;
11
+ export type { MessageFlagPushItem, PutMessageFlagPushInput };
12
+ export type FlagPushOperation = MessageFlagPushItem["operation"];
13
+ export type MessageFlagPushState = MessageFlagPushItem["state"];
30
14
 
31
15
  const DEFAULT_STATE: MessageFlagPushState = "pending";
32
16
 
@@ -1,30 +1,15 @@
1
+ import type {
2
+ MessagePlacementMoveItem,
3
+ PutMessagePlacementMoveInput,
4
+ } from "@remit/data-ports";
1
5
  import { eq } from "drizzle-orm";
2
6
  import type { Db } from "../db.js";
3
7
  import { messagePlacementMoveTable } from "../schema/i4-message-placement-move.js";
4
8
 
5
9
  type DB = Db<Record<string, unknown>>;
6
10
 
7
- export type MessagePlacementMoveState =
8
- | "pending"
9
- | "queued"
10
- | "processing"
11
- | "processed";
12
-
13
- export interface MessagePlacementMoveItem {
14
- messageId: string;
15
- accountId: string;
16
- accountConfigId: string;
17
- sourceMailboxId: string;
18
- destinationMailboxId: string;
19
- state: MessagePlacementMoveState;
20
- createdAt: number;
21
- updatedAt: number;
22
- }
23
-
24
- export type PutMessagePlacementMoveInput = Omit<
25
- MessagePlacementMoveItem,
26
- "state" | "createdAt" | "updatedAt"
27
- >;
11
+ export type { MessagePlacementMoveItem, PutMessagePlacementMoveInput };
12
+ export type MessagePlacementMoveState = MessagePlacementMoveItem["state"];
28
13
 
29
14
  const DEFAULT_STATE: MessagePlacementMoveState = "pending";
30
15
 
@@ -19,26 +19,17 @@ import {
19
19
  type SQL,
20
20
  sql,
21
21
  } from "drizzle-orm";
22
- import shortUuid from "short-uuid";
23
- import { v5 as uuidv5 } from "uuid";
24
22
  import type { Db } from "../db.js";
25
23
  import { NotFoundError } from "../error.js";
24
+ import { deterministicBase36Id } from "../id.js";
26
25
  import { decodeToken } from "../pagination.js";
27
26
  import { threadMessageTable } from "../schema/thread-message.js";
28
27
  import { fromMatch, subjectMatch } from "./thread-search-predicates.js";
29
28
 
30
- // ─── ID generation (mirrors remit-electrodb-service/src/id.ts) ───────────────
31
-
32
- const REMIT_NAMESPACE = "9e89694d-214b-4d9b-99f5-214b4d9b99f5";
33
- const translator = shortUuid.createTranslator(shortUuid.constants.uuid25Base36);
34
-
35
- const base36uuidv5 = (name: string): string =>
36
- translator.fromUUID(uuidv5(name, REMIT_NAMESPACE));
37
-
38
29
  export const deriveThreadMessageId = (
39
30
  threadId: string,
40
31
  messageId: string,
41
- ): string => base36uuidv5(`threadmsg:${threadId}:${messageId}`);
32
+ ): string => deterministicBase36Id(`threadmsg:${threadId}:${messageId}`);
42
33
 
43
34
  // ─── Constants ────────────────────────────────────────────────────────────────
44
35