aboutsummaryrefslogtreecommitdiffstats
path: root/packages/db
diff options
context:
space:
mode:
authorkamtschatka <simon.schatka@gmx.at>2024-06-30 00:34:43 +0200
committerGitHub <noreply@github.com>2024-06-29 23:34:43 +0100
commitccbff18a9763e458c07f46cb3a331062df14a9b9 (patch)
tree0cefc8cb49ea70594c6af7a947f3c21def1e7846 /packages/db
parente107f8b6c250759ab0f884b2fdd0283fae15cfe5 (diff)
downloadkarakeep-ccbff18a9763e458c07f46cb3a331062df14a9b9.tar.zst
refactor: remove redundant code from crawler worker and refactor handling of asset types (#253)
* refactoring asset types Extracted out functions to silently delete assets and to update them after crawling Generalized the mapping of assets to bookmark fields to make extending them easier * revert silentDeleteAsset and hide better-sqlite3 --------- Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'packages/db')
-rw-r--r--packages/db/index.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/db/index.ts b/packages/db/index.ts
index 433d8db2..b86665d2 100644
--- a/packages/db/index.ts
+++ b/packages/db/index.ts
@@ -1,3 +1,17 @@
+import Database from "better-sqlite3";
+import { ExtractTablesWithRelations } from "drizzle-orm";
+import { SQLiteTransaction } from "drizzle-orm/sqlite-core";
+
+import * as schema from "./schema";
+
export { db } from "./drizzle";
export * as schema from "./schema";
export { SqliteError } from "better-sqlite3";
+
+// This is exported here to avoid leaking better-sqlite types outside of this package.
+export type HoarderDBTransaction = SQLiteTransaction<
+ "sync",
+ Database.RunResult,
+ typeof schema,
+ ExtractTablesWithRelations<typeof schema>
+>;