From ccbff18a9763e458c07f46cb3a331062df14a9b9 Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sun, 30 Jun 2024 00:34:43 +0200 Subject: 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 --- packages/db/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packages/db') 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 +>; -- cgit v1.2.3-70-g09d2