A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: upgrade SQLite bindings for Node 24 (#3043)
Mohamed Bassemca72503ca1f0
diff --git a/apps/web/package.json b/apps/web/package.jsonindex bb5493f2..1a8e5b96 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -66,7 +66,7 @@"@trpc/server": "^11.9.0","@trpc/tanstack-react-query": "^11.9.0","ai": "^6.0.193",- "better-sqlite3": "^11.3.0",+ "better-sqlite3": "^13.0.3","cheerio": "^1.2.0","class-variance-authority": "^0.7.0","clsx": "^2.1.0",diff --git a/apps/workers/package.json b/apps/workers/package.jsonindex fb8c75c2..2444eaa0 100644--- a/apps/workers/package.json+++ b/apps/workers/package.json@@ -18,7 +18,7 @@"@tsconfig/node22": "^22.0.0","archiver": "^7.0.1","async-mutex": "^0.4.1",- "better-sqlite3": "^11.3.0",+ "better-sqlite3": "^13.0.3","data-uri-to-buffer": "^4.0.1","dompurify": "^3.2.4","dotenv": "^16.4.1",@@ -30,7 +30,7 @@"https-proxy-agent": "^7.0.6","ipaddr.js": "^2.2.0","jsdom": "^24.0.0",- "liteque": "^0.8.0",+ "liteque": "^0.9.0","lru-cache": "^11.2.2","metascraper": "^5.50.0","metascraper-amazon": "^5.50.0",diff --git a/apps/workers/workerUtils.ts b/apps/workers/workerUtils.tsindex 999a5790..18d03622 100644--- a/apps/workers/workerUtils.ts+++ b/apps/workers/workerUtils.ts@@ -4,16 +4,16 @@ import { db, KarakeepDBTransaction } from "@karakeep/db";import { assets, AssetTypes, bookmarks } from "@karakeep/db/schema";type DBAssetType = typeof assets.$inferInsert;-export async function updateAsset(+export function updateAsset(oldAssetId: string | undefined,newAsset: DBAssetType,txn: KarakeepDBTransaction,) {if (oldAssetId) {- await txn.delete(assets).where(eq(assets.id, oldAssetId));+ txn.delete(assets).where(eq(assets.id, oldAssetId)).run();}- await txn.insert(assets).values(newAsset);+ txn.insert(assets).values(newAsset).run();}export async function getBookmarkDetails(bookmarkId: string) {diff --git a/apps/workers/workers/adminMaintenance/tasks/migrateLinkHtmlContent.ts b/apps/workers/workers/adminMaintenance/tasks/migrateLinkHtmlContent.tsindex a9ae54a6..eed746c9 100644--- a/apps/workers/workers/adminMaintenance/tasks/migrateLinkHtmlContent.ts+++ b/apps/workers/workers/adminMaintenance/tasks/migrateLinkHtmlContent.ts@@ -103,8 +103,8 @@ async function migrateBookmarkHtml(}try {- await db.transaction(async (txn) => {- const res = await txn+ await db.transaction((txn) => {+ const res = txn.update(bookmarkLinks).set({ htmlContent: null, contentAssetId: assetId }).where(@@ -112,13 +112,14 @@ async function migrateBookmarkHtml(eq(bookmarkLinks.id, bookmarkId),isNull(bookmarkLinks.contentAssetId),),- );+ )+ .run();if (res.changes === 0) {throw new Error("Failed to update bookmark");}- await updateAsset(+ updateAsset(undefined,{id: assetId,diff --git a/apps/workers/workers/assetPreprocessingWorker.ts b/apps/workers/workers/assetPreprocessingWorker.tsindex adbb1a2b..9e291653 100644--- a/apps/workers/workers/assetPreprocessingWorker.ts+++ b/apps/workers/workers/assetPreprocessingWorker.ts@@ -67,9 +67,8 @@ export class AssetPreprocessingWorker {const bookmarkId = job.data?.bookmarkId;if (bookmarkId && job.numRetriesLeft == 0) {- await db.transaction(async (tx) => {- await tx- .update(bookmarks)+ await db.transaction((tx) => {+ tx.update(bookmarks).set({taggingStatus: null,})@@ -78,9 +77,9 @@ export class AssetPreprocessingWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.taggingStatus, "pending"),),- );- await tx- .update(bookmarks)+ )+ .run();+ tx.update(bookmarks).set({summarizationStatus: null,})@@ -89,9 +88,9 @@ export class AssetPreprocessingWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.summarizationStatus, "pending"),),- );- await tx- .update(bookmarks)+ )+ .run();+ tx.update(bookmarks).set({embeddingStatus: null,})@@ -100,7 +99,8 @@ export class AssetPreprocessingWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.embeddingStatus, "pending"),),- );+ )+ .run();});}return Promise.resolve();diff --git a/apps/workers/workers/crawler/crawlAndParse.ts b/apps/workers/workers/crawler/crawlAndParse.tsindex 5b63849c..b239acd9 100644--- a/apps/workers/workers/crawler/crawlAndParse.ts+++ b/apps/workers/workers/crawler/crawlAndParse.ts@@ -105,8 +105,8 @@ export async function handleAsAssetBookmark();}const fileName = path.basename(new URL(url).pathname);- await db.transaction(async (trx) => {- await updateAsset(+ await db.transaction((trx) => {+ updateAsset(undefined,{id: downloaded.assetId,@@ -119,20 +119,24 @@ export async function handleAsAssetBookmark(},trx,);- await trx.insert(bookmarkAssets).values({- id: bookmarkId,- assetType,- assetId: downloaded.assetId,- content: null,- fileName,- sourceUrl: url,- });+ trx+ .insert(bookmarkAssets)+ .values({+ id: bookmarkId,+ assetType,+ assetId: downloaded.assetId,+ content: null,+ fileName,+ sourceUrl: url,+ })+ .run();// Switch the type of the bookmark from LINK to ASSET- await trx+ trx.update(bookmarks).set({ type: BookmarkTypes.ASSET })- .where(eq(bookmarks.id, bookmarkId));- await trx.delete(bookmarkLinks).where(eq(bookmarkLinks.id, bookmarkId));+ .where(eq(bookmarks.id, bookmarkId))+ .run();+ trx.delete(bookmarkLinks).where(eq(bookmarkLinks.id, bookmarkId)).run();});await AssetPreprocessingQueue.enqueue({@@ -392,14 +396,14 @@ export async function crawlAndParseUrl(// Phase 2: Write content and asset references.// TODO(important): Restrict the size of content to store- const assetDeletionTasks: Promise<void>[] = [];+ const assetIdsToDelete: (string | undefined)[] = [];const inlineHtmlContent =htmlContentAssetInfo.result === "store_inline"? (readableContent?.content ?? null): null;readableContent = null;- await db.transaction(async (txn) => {- await txn+ await db.transaction((txn) => {+ txn.update(bookmarkLinks).set({crawledAt: new Date(),@@ -414,10 +418,11 @@ export async function crawlAndParseUrl(readerViewClassifierVersion:readerViewAssessment?.classifierVersion ?? null,})- .where(eq(bookmarkLinks.id, bookmarkId));+ .where(eq(bookmarkLinks.id, bookmarkId))+ .run();if (screenshotAssetInfo) {- await updateAsset(+ updateAsset(oldAssets.screenshotAssetId,{id: screenshotAssetInfo.assetId,@@ -430,12 +435,10 @@ export async function crawlAndParseUrl(},txn,);- assetDeletionTasks.push(- silentDeleteAsset(userId, oldAssets.screenshotAssetId),- );+ assetIdsToDelete.push(oldAssets.screenshotAssetId);}if (pdfAssetInfo) {- await updateAsset(+ updateAsset(oldAssets.pdfAssetId,{id: pdfAssetInfo.assetId,@@ -448,18 +451,14 @@ export async function crawlAndParseUrl(},txn,);- assetDeletionTasks.push(- silentDeleteAsset(userId, oldAssets.pdfAssetId),- );+ assetIdsToDelete.push(oldAssets.pdfAssetId);}if (imageAssetInfo) {- await updateAsset(oldAssets.imageAssetId, imageAssetInfo, txn);- assetDeletionTasks.push(- silentDeleteAsset(userId, oldAssets.imageAssetId),- );+ updateAsset(oldAssets.imageAssetId, imageAssetInfo, txn);+ assetIdsToDelete.push(oldAssets.imageAssetId);}if (htmlContentAssetInfo.result === "stored") {- await updateAsset(+ updateAsset(oldAssets.contentAssetId,{id: htmlContentAssetInfo.assetId,@@ -472,22 +471,21 @@ export async function crawlAndParseUrl(},txn,);- assetDeletionTasks.push(- silentDeleteAsset(userId, oldAssets.contentAssetId),- );+ assetIdsToDelete.push(oldAssets.contentAssetId);} else if (oldAssets.contentAssetId) {// Unlink the old content asset- await txn+ txn.delete(assets)- .where(eq(assets.id, oldAssets.contentAssetId));- assetDeletionTasks.push(- silentDeleteAsset(userId, oldAssets.contentAssetId),- );+ .where(eq(assets.id, oldAssets.contentAssetId))+ .run();+ assetIdsToDelete.push(oldAssets.contentAssetId);}});// Delete the old assets if any- await Promise.all(assetDeletionTasks);+ await Promise.all(+ assetIdsToDelete.map((assetId) => silentDeleteAsset(userId, assetId)),+ );return async () => {if (@@ -510,8 +508,8 @@ export async function crawlAndParseUrl(contentType,} = archiveResult;- await db.transaction(async (txn) => {- await updateAsset(+ await db.transaction((txn) => {+ updateAsset(oldAssets.fullPageArchiveAssetId,{id: fullPageArchiveAssetId,diff --git a/apps/workers/workers/crawlerWorker.ts b/apps/workers/workers/crawlerWorker.tsindex 2c576f0e..5a3792a5 100644--- a/apps/workers/workers/crawlerWorker.ts+++ b/apps/workers/workers/crawlerWorker.ts@@ -149,15 +149,14 @@ export class CrawlerWorker {);const bookmarkId = job.data?.bookmarkId;if (bookmarkId && job.numRetriesLeft == 0) {- await db.transaction(async (tx) => {- await tx- .update(bookmarkLinks)+ await db.transaction((tx) => {+ tx.update(bookmarkLinks).set({crawlStatus: "failure",})- .where(eq(bookmarkLinks.id, bookmarkId));- await tx- .update(bookmarks)+ .where(eq(bookmarkLinks.id, bookmarkId))+ .run();+ tx.update(bookmarks).set({taggingStatus: null,})@@ -166,9 +165,9 @@ export class CrawlerWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.taggingStatus, "pending"),),- );- await tx- .update(bookmarks)+ )+ .run();+ tx.update(bookmarks).set({summarizationStatus: null,})@@ -177,9 +176,9 @@ export class CrawlerWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.summarizationStatus, "pending"),),- );- await tx- .update(bookmarks)+ )+ .run();+ tx.update(bookmarks).set({embeddingStatus: null,})@@ -188,7 +187,8 @@ export class CrawlerWorker {eq(bookmarks.id, bookmarkId),eq(bookmarks.embeddingStatus, "pending"),),- );+ )+ .run();});}},diff --git a/apps/workers/workers/inference/tagging.ts b/apps/workers/workers/inference/tagging.tsindex 45b76942..051e7de8 100644--- a/apps/workers/workers/inference/tagging.ts+++ b/apps/workers/workers/inference/tagging.ts@@ -419,24 +419,26 @@ async function connectTags(return;}- const res = await db.transaction(async (tx) => {+ const res = await db.transaction((tx) => {// Attempt to match exiting tags with the new ones- const { matchedTagIds, notFoundTagNames } = await (async () => {+ const { matchedTagIds, notFoundTagNames } = (() => {const { normalizeTag } = tagNormalizer();const normalizedInferredTags = inferredTags.map((t) => ({originalTag: t,normalizedTag: normalizeTag(t),}));- const matchedTags = await tx.query.bookmarkTags.findMany({- where: and(- eq(bookmarkTags.userId, userId),- inArray(- bookmarkTags.normalizedName,- normalizedInferredTags.map((t) => t.normalizedTag),+ const matchedTags = tx.query.bookmarkTags+ .findMany({+ where: and(+ eq(bookmarkTags.userId, userId),+ inArray(+ bookmarkTags.normalizedName,+ normalizedInferredTags.map((t) => t.normalizedTag),+ ),),- ),- });+ })+ .sync();const matchedTagIds = matchedTags.map((r) => r.id);const notFoundTagNames = normalizedInferredTags@@ -454,22 +456,22 @@ async function connectTags(// Create tags that didn't exist previouslylet newTagIds: string[] = [];if (notFoundTagNames.length > 0) {- newTagIds = (- await tx- .insert(bookmarkTags)- .values(- notFoundTagNames.map((t) => ({- name: t,- userId,- })),- )- .onConflictDoNothing()- .returning()- ).map((t) => t.id);+ newTagIds = tx+ .insert(bookmarkTags)+ .values(+ notFoundTagNames.map((t) => ({+ name: t,+ userId,+ })),+ )+ .onConflictDoNothing()+ .returning()+ .all()+ .map((t) => t.id);}// Delete old AI tags- const detachedTags = await tx+ const detachedTags = tx.delete(tagsOnBookmarks).where(and(@@ -477,14 +479,15 @@ async function connectTags(eq(tagsOnBookmarks.bookmarkId, bookmarkId),),)- .returning();+ .returning()+ .all();const allTagIds = new Set([...matchedTagIds, ...newTagIds]);// Attach new oneslet attachedTags: { tagId: string; bookmarkId: string }[] = [];if (allTagIds.size > 0) {- attachedTags = await tx+ attachedTags = tx.insert(tagsOnBookmarks).values([...allTagIds].map((tagId) => ({@@ -494,7 +497,8 @@ async function connectTags(})),).onConflictDoNothing()- .returning();+ .returning()+ .all();}return { detachedTags, attachedTags };diff --git a/apps/workers/workers/videoWorker.ts b/apps/workers/workers/videoWorker.tsindex c7fa138f..d2ed04cc 100644--- a/apps/workers/workers/videoWorker.ts+++ b/apps/workers/workers/videoWorker.ts@@ -207,8 +207,8 @@ async function runWorker(job: DequeuedJob<ZVideoRequest>) {quotaApproved,});- await db.transaction(async (txn) => {- await updateAsset(+ await db.transaction((txn) => {+ updateAsset(oldVideoAssetId,{id: videoAssetId,diff --git a/packages/db/package.json b/packages/db/package.jsonindex 30757adb..bc26ca2e 100644--- a/packages/db/package.json+++ b/packages/db/package.json@@ -20,7 +20,7 @@"@karakeep/shared": "workspace:*","@opentelemetry/api": "^1.9.0","@paralleldrive/cuid2": "^2.2.2",- "better-sqlite3": "^11.3.0",+ "better-sqlite3": "^13.0.3","dotenv": "^16.4.1","drizzle-kit": "^0.31.10","drizzle-orm": "^0.45.2",diff --git a/packages/plugins/package.json b/packages/plugins/package.jsonindex 8475d067..69321979 100644--- a/packages/plugins/package.json+++ b/packages/plugins/package.json@@ -25,7 +25,7 @@"@restatedev/restate-sdk": "^1.16.2","@restatedev/restate-sdk-clients": "^1.16.2","async-mutex": "^0.4.1",- "liteque": "^0.8.0",+ "liteque": "^0.9.0","meilisearch": "^0.58.0","redis": "^5.11.0"},diff --git a/packages/shared-server/src/services/quotaService.ts b/packages/shared-server/src/services/quotaService.tsindex bedda881..71cf357d 100644--- a/packages/shared-server/src/services/quotaService.ts+++ b/packages/shared-server/src/services/quotaService.ts@@ -22,10 +22,7 @@ export class StorageQuotaError extends Error {export class QuotaService {// TODO: Use quota approval tokens for bookmark creation when// bookmark creation logic is in the model.- static async canCreateBookmark(- db: DB | KarakeepDBTransaction,- userId: string,- ) {+ static async canCreateBookmark(db: DB, userId: string) {const user = await db.query.users.findFirst({where: eq(users.id, userId),columns: {@@ -39,12 +36,55 @@ export class QuotaService {.from(bookmarks).where(eq(bookmarks.userId, userId));- if (currentBookmarkCount[0].count >= user.bookmarkQuota) {- return {- result: false,- error: `Bookmark quota exceeded. You can only have ${user.bookmarkQuota} bookmarks.`,- } as const;- }+ return this.bookmarkQuotaResult(+ user.bookmarkQuota,+ currentBookmarkCount[0].count,+ );+ }+ return {+ result: true,+ } as const;+ }++ static canCreateBookmarkInTransaction(+ tx: KarakeepDBTransaction,+ userId: string,+ ) {+ const user = tx.query.users+ .findFirst({+ where: eq(users.id, userId),+ columns: {+ bookmarkQuota: true,+ },+ })+ .sync();++ if (user?.bookmarkQuota !== null && user?.bookmarkQuota !== undefined) {+ const currentBookmarkCount = tx+ .select({ count: count() })+ .from(bookmarks)+ .where(eq(bookmarks.userId, userId))+ .all();++ return this.bookmarkQuotaResult(+ user.bookmarkQuota,+ currentBookmarkCount[0].count,+ );+ }+ return {+ result: true,+ } as const;+ }++ private static bookmarkQuotaResult(+ bookmarkQuota: number,+ currentBookmarkCount: number,+ ) {+ if (currentBookmarkCount >= bookmarkQuota) {+ return {+ result: false,+ error: `Bookmark quota exceeded. You can only have ${bookmarkQuota} bookmarks.`,+ } as const;}return {result: true,@@ -52,7 +92,7 @@ export class QuotaService {}static async checkStorageQuota(- db: DB | KarakeepDBTransaction,+ db: DB,userId: string,requestedSize: number,): Promise<QuotaApproved> {@@ -82,10 +122,7 @@ export class QuotaService {return QuotaApproved._create(userId, requestedSize);}- static async getCurrentStorageUsage(- db: DB | KarakeepDBTransaction,- userId: string,- ): Promise<number> {+ static async getCurrentStorageUsage(db: DB, userId: string): Promise<number> {const currentUsageResult = await db.select({ totalSize: sum(assets.size) }).from(assets)diff --git a/packages/trpc/models/assets.ts b/packages/trpc/models/assets.tsindex f97cfffb..44366a4f 100644--- a/packages/trpc/models/assets.ts+++ b/packages/trpc/models/assets.ts@@ -147,15 +147,15 @@ export class Asset {});}- await ctx.db.transaction(async (tx) => {- await tx.delete(assets).where(eq(assets.id, input.oldAssetId));- await tx- .update(assets)+ await ctx.db.transaction((tx) => {+ tx.delete(assets).where(eq(assets.id, input.oldAssetId)).run();+ tx.update(assets).set({bookmarkId: input.bookmarkId,assetType: oldAsset.asset.assetType,})- .where(eq(assets.id, input.newAssetId));+ .where(eq(assets.id, input.newAssetId))+ .run();});await deleteAsset({diff --git a/packages/trpc/models/backups.ts b/packages/trpc/models/backups.tsindex c7ab99ba..7f0d0598 100644--- a/packages/trpc/models/backups.ts+++ b/packages/trpc/models/backups.ts@@ -113,28 +113,28 @@ export class Backup {});}- await this.ctx.db.transaction(async (db) => {+ await this.ctx.db.transaction((db) => {// Delete asset firstif (this.backup.assetId) {- await db- .delete(assets)+ db.delete(assets).where(and(eq(assets.id, this.backup.assetId),eq(assets.userId, this.ctx.user.id),),- );+ )+ .run();}// Delete backup record- await db- .delete(backupsTable)+ db.delete(backupsTable).where(and(eq(backupsTable.id, this.backup.id),eq(backupsTable.userId, this.ctx.user.id),),- );+ )+ .run();});}diff --git a/packages/trpc/models/importSessions.repo.ts b/packages/trpc/models/importSessions.repo.tsindex 0505d75a..09d0d604 100644--- a/packages/trpc/models/importSessions.repo.ts+++ b/packages/trpc/models/importSessions.repo.ts@@ -112,15 +112,16 @@ export class ImportSessionsRepo {// (e.g. the first sweep after deploy) shouldn't block other writers.let archivedCount = 0;for (const session of sessions) {- const archived = await this.db.transaction(async (tx) => {- const statusCounts = await tx+ const archived = await this.db.transaction((tx) => {+ const statusCounts = tx.select({status: importStagingBookmarks.status,count: count(),}).from(importStagingBookmarks).where(eq(importStagingBookmarks.importSessionId, session.id))- .groupBy(importStagingBookmarks.status);+ .groupBy(importStagingBookmarks.status)+ .all();const stats = {totalBookmarks: 0,@@ -148,7 +149,7 @@ export class ImportSessionsRepo {}}- const result = await tx+ const result = tx.update(importSessions).set({ status: "archived", ...stats }).where(@@ -156,18 +157,19 @@ export class ImportSessionsRepo {eq(importSessions.id, session.id),eq(importSessions.status, "completed"),),- );+ )+ .run();if (result.changes === 0) {return false;}- await tx- .delete(importStagingBookmarks)- .where(eq(importStagingBookmarks.importSessionId, session.id));- await tx- .delete(importSessionBookmarks)- .where(eq(importSessionBookmarks.importSessionId, session.id));+ tx.delete(importStagingBookmarks)+ .where(eq(importStagingBookmarks.importSessionId, session.id))+ .run();+ tx.delete(importSessionBookmarks)+ .where(eq(importSessionBookmarks.importSessionId, session.id))+ .run();return true;});diff --git a/packages/trpc/models/listInvitations.ts b/packages/trpc/models/listInvitations.tsindex 2e17fa2e..49728501 100644--- a/packages/trpc/models/listInvitations.ts+++ b/packages/trpc/models/listInvitations.ts@@ -119,20 +119,20 @@ export class ListInvitation {});}- await this.ctx.db.transaction(async (tx) => {- await tx- .delete(listInvitations)- .where(eq(listInvitations.id, this.invitation.id));+ await this.ctx.db.transaction((tx) => {+ tx.delete(listInvitations)+ .where(eq(listInvitations.id, this.invitation.id))+ .run();- await tx- .insert(listCollaborators)+ tx.insert(listCollaborators).values({listId: this.invitation.listId,userId: this.invitation.userId,role: this.invitation.role,addedBy: this.invitation.invitedBy,})- .onConflictDoNothing();+ .onConflictDoNothing()+ .run();});}diff --git a/packages/trpc/models/lists.ts b/packages/trpc/models/lists.tsindex 6dd479c7..6015555b 100644--- a/packages/trpc/models/lists.ts+++ b/packages/trpc/models/lists.ts@@ -497,8 +497,8 @@ export abstract class List {}}- protected async cleanupRulesAfterListDeletion(tx: KarakeepDBTransaction) {- const rules = await tx+ protected cleanupRulesAfterListDeletion(tx: KarakeepDBTransaction) {+ const rules = tx.select({id: ruleEngineRulesTable.id,event: ruleEngineRulesTable.event,@@ -515,7 +515,8 @@ export abstract class List {WHERE value = ${this.list.id})`,),- );+ )+ .all();const rulesToDelete: string[] = [];const rulesToUpdate: { id: string; event: string }[] = [];@@ -560,38 +561,37 @@ export abstract class List {}if (rulesToDelete.length > 0) {- await tx- .delete(ruleEngineRulesTable)- .where(inArray(ruleEngineRulesTable.id, rulesToDelete));+ tx.delete(ruleEngineRulesTable)+ .where(inArray(ruleEngineRulesTable.id, rulesToDelete))+ .run();}if (rulesToUpdate.length > 0) {- await Promise.all(- rulesToUpdate.map(({ id, event }) =>- tx- .update(ruleEngineRulesTable)- .set({ event })- .where(eq(ruleEngineRulesTable.id, id)),- ),- );+ for (const { id, event } of rulesToUpdate) {+ tx.update(ruleEngineRulesTable)+ .set({ event })+ .where(eq(ruleEngineRulesTable.id, id))+ .run();+ }}}async delete() {this.ensureCanManage();- await this.ctx.db.transaction(async (tx) => {- const res = await tx+ await this.ctx.db.transaction((tx) => {+ const res = tx.delete(bookmarkLists).where(and(eq(bookmarkLists.id, this.list.id),eq(bookmarkLists.userId, this.ctx.user.id),),- );+ )+ .run();if (res.changes == 0) {throw new TRPCError({ code: "NOT_FOUND" });}- await this.cleanupRulesAfterListDeletion(tx);+ this.cleanupRulesAfterListDeletion(tx);});}@@ -1154,22 +1154,22 @@ export class ManualList extends List {const bookmarkIds = await this.getBookmarkIds();- await this.ctx.db.transaction(async (tx) => {- await tx- .insert(bookmarksInLists)+ await this.ctx.db.transaction((tx) => {+ tx.insert(bookmarksInLists).values(bookmarkIds.map((id) => ({bookmarkId: id,listId: targetList.id,})),)- .onConflictDoNothing();+ .onConflictDoNothing()+ .run();if (deleteSourceAfterMerge) {- await tx- .delete(bookmarkLists)- .where(eq(bookmarkLists.id, this.list.id));- await this.cleanupRulesAfterListDeletion(tx);+ tx.delete(bookmarkLists)+ .where(eq(bookmarkLists.id, this.list.id))+ .run();+ this.cleanupRulesAfterListDeletion(tx);}});}diff --git a/packages/trpc/models/rules.ts b/packages/trpc/models/rules.tsindex eef2fab9..1a5a50bd 100644--- a/packages/trpc/models/rules.ts+++ b/packages/trpc/models/rules.ts@@ -87,8 +87,8 @@ export class RuleEngineRuleModel {input: z.infer<typeof zNewRuleEngineRuleSchema>,): Promise<RuleEngineRuleModel> {// Similar to lists create, but for rules- const insertedRule = await ctx.db.transaction(async (tx) => {- const [newRule] = await tx+ const insertedRule = await ctx.db.transaction((tx) => {+ const [newRule] = tx.insert(ruleEngineRulesTable).values({name: input.name,@@ -102,24 +102,27 @@ export class RuleEngineRuleModel {? input.event.tagId: null,})- .returning();+ .returning()+ .all();if (input.actions.length > 0) {- await tx.insert(ruleEngineActionsTable).values(- input.actions.map((action) => ({- ruleId: newRule.id,- userId: ctx.user.id,- action: JSON.stringify(action),- listId:- action.type === "addToList" || action.type === "removeFromList"- ? action.listId- : null,- tagId:- action.type === "addTag" || action.type === "removeTag"- ? action.tagId- : null,- })),- );+ tx.insert(ruleEngineActionsTable)+ .values(+ input.actions.map((action) => ({+ ruleId: newRule.id,+ userId: ctx.user.id,+ action: JSON.stringify(action),+ listId:+ action.type === "addToList" || action.type === "removeFromList"+ ? action.listId+ : null,+ tagId:+ action.type === "addTag" || action.type === "removeTag"+ ? action.tagId+ : null,+ })),+ )+ .run();}return newRule;});@@ -135,8 +138,8 @@ export class RuleEngineRuleModel {throw new TRPCError({ code: "BAD_REQUEST", message: "ID mismatch" });}- await this.ctx.db.transaction(async (tx) => {- const result = await tx+ await this.ctx.db.transaction((tx) => {+ const result = tx.update(ruleEngineRulesTable).set({name: input.name,@@ -154,31 +157,34 @@ export class RuleEngineRuleModel {eq(ruleEngineRulesTable.id, input.id),eq(ruleEngineRulesTable.userId, this.ctx.user.id),),- );+ )+ .run();if (result.changes === 0) {throw new TRPCError({ code: "NOT_FOUND", message: "Rule not found" });}if (input.actions.length > 0) {- await tx- .delete(ruleEngineActionsTable)- .where(eq(ruleEngineActionsTable.ruleId, input.id));- await tx.insert(ruleEngineActionsTable).values(- input.actions.map((action) => ({- ruleId: input.id,- userId: this.ctx.user.id,- action: JSON.stringify(action),- listId:- action.type === "addToList" || action.type === "removeFromList"- ? action.listId- : null,- tagId:- action.type === "addTag" || action.type === "removeTag"- ? action.tagId- : null,- })),- );+ tx.delete(ruleEngineActionsTable)+ .where(eq(ruleEngineActionsTable.ruleId, input.id))+ .run();+ tx.insert(ruleEngineActionsTable)+ .values(+ input.actions.map((action) => ({+ ruleId: input.id,+ userId: this.ctx.user.id,+ action: JSON.stringify(action),+ listId:+ action.type === "addToList" || action.type === "removeFromList"+ ? action.listId+ : null,+ tagId:+ action.type === "addTag" || action.type === "removeTag"+ ? action.tagId+ : null,+ })),+ )+ .run();}});diff --git a/packages/trpc/models/tags.ts b/packages/trpc/models/tags.tsindex 1d8f90b9..a8f6c2a1 100644--- a/packages/trpc/models/tags.ts+++ b/packages/trpc/models/tags.ts@@ -247,14 +247,15 @@ export class Tag {}const { deletedTags, affectedBookmarks } = await ctx.db.transaction(- async (trx) => {- const unlinked = await trx+ (trx) => {+ const unlinked = trx.delete(tagsOnBookmarks).where(and(inArray(tagsOnBookmarks.tagId, input.fromTagIds)))- .returning();+ .returning()+ .all();if (unlinked.length > 0) {- await trx+ trx.insert(tagsOnBookmarks).values(unlinked.map((u) => ({@@ -262,10 +263,11 @@ export class Tag {tagId: input.intoTagId,})),)- .onConflictDoNothing();+ .onConflictDoNothing()+ .run();}- const deletedTags = await trx+ const deletedTags = trx.delete(bookmarkTags).where(and(@@ -273,7 +275,8 @@ export class Tag {eq(bookmarkTags.userId, ctx.user.id),),)- .returning({ id: bookmarkTags.id });+ .returning({ id: bookmarkTags.id })+ .all();return {deletedTags,diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.tsindex b47433f4..7cf23c97 100644--- a/packages/trpc/models/users.ts+++ b/packages/trpc/models/users.ts@@ -102,17 +102,18 @@ export class User {emailVerified?: Date | null;},) {- return await db.transaction(async (trx) => {+ return await db.transaction((trx) => {let userRole = input.role;if (!userRole) {- const [{ count: userCount }] = await trx+ const [{ count: userCount }] = trx.select({ count: count() })- .from(users);+ .from(users)+ .all();userRole = userCount === 0 ? "admin" : "user";}try {- const [result] = await trx+ const [result] = trx.insert(users).values({name: input.name,@@ -124,7 +125,8 @@ export class User {bookmarkQuota: serverConfig.quotas.free.bookmarkLimit,storageQuota: serverConfig.quotas.free.assetSizeBytes,})- .returning();+ .returning()+ .all();return result;} catch (e) {@@ -292,17 +294,19 @@ export class User {const token = randomBytes(32).toString("hex");const expires = new Date(Date.now() + 60 * 60 * 1000); // 1 hour- await ctx.db.transaction(async (tx) => {+ await ctx.db.transaction((tx) => {// Invalidate any existing reset tokens for this user- await tx- .delete(passwordResetTokens)- .where(eq(passwordResetTokens.userId, user.id));+ tx.delete(passwordResetTokens)+ .where(eq(passwordResetTokens.userId, user.id))+ .run();- await tx.insert(passwordResetTokens).values({- userId: user.id,- token,- expires,- });+ tx.insert(passwordResetTokens)+ .values({+ userId: user.id,+ token,+ expires,+ })+ .run();});// Deliberately not awaited. Delivery latency is only incurred for real@@ -619,18 +623,18 @@ export class User {return;}- await this.ctx.db.transaction(async (tx) => {- await tx- .update(users)+ await this.ctx.db.transaction((tx) => {+ tx.update(users).set({ image: assetId })- .where(eq(users.id, this.user.id));+ .where(eq(users.id, this.user.id))+ .run();if (!previousImage || previousImage === assetId) {return;}if (previousAsset && !previousAsset.bookmarkId) {- await tx.delete(assets).where(eq(assets.id, previousAsset.id));+ tx.delete(assets).where(eq(assets.id, previousAsset.id)).run();}});diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.tsindex 6fa6fa91..20f3e3c7 100644--- a/packages/trpc/routers/bookmarks.ts+++ b/packages/trpc/routers/bookmarks.ts@@ -329,10 +329,27 @@ export const bookmarksAppRouter = router({}}+ if (input.type === BookmarkTypes.LINK && input.precrawledArchiveId) {+ await Asset.ensureOwnership(ctx, input.precrawledArchiveId);+ }+ if (input.type === BookmarkTypes.ASSET) {+ const uploadedAsset = await Asset.fromId(ctx, input.assetId);+ uploadedAsset.ensureOwnership();+ if (+ !uploadedAsset.asset.contentType ||+ !SUPPORTED_BOOKMARK_ASSET_TYPES.has(uploadedAsset.asset.contentType)+ ) {+ throw new TRPCError({+ code: "BAD_REQUEST",+ message: "Unsupported asset type",+ });+ }+ }+const bookmark = await ctx.db.transaction(- async (tx) => {+ (tx) => {// Check user quota- const quotaResult = await QuotaService.canCreateBookmark(+ const quotaResult = QuotaService.canCreateBookmarkInTransaction(tx,ctx.user.id,);@@ -342,43 +359,39 @@ export const bookmarksAppRouter = router({message: quotaResult.error,});}- const bookmark = (- await tx- .insert(bookmarks)- .values({- userId: ctx.user.id,- title: input.title,- type: input.type,- archived: input.archived,- favourited: input.favourited,- note: input.note,- summary: input.summary,- createdAt: input.createdAt,- source: input.source,- // Only links currently support summarization. Let's set the status to null for other types for now.- summarizationStatus:- input.type === BookmarkTypes.LINK ? "pending" : null,- })- .returning()- )[0];+ const bookmark = tx+ .insert(bookmarks)+ .values({+ userId: ctx.user.id,+ title: input.title,+ type: input.type,+ archived: input.archived,+ favourited: input.favourited,+ note: input.note,+ summary: input.summary,+ createdAt: input.createdAt,+ source: input.source,+ // Only links currently support summarization. Let's set the status to null for other types for now.+ summarizationStatus:+ input.type === BookmarkTypes.LINK ? "pending" : null,+ })+ .returning()+ .all()[0];let content: ZBookmarkContent;switch (input.type) {case BookmarkTypes.LINK: {- const link = (- await tx- .insert(bookmarkLinks)- .values({- id: bookmark.id,- url: input.url.trim(),- })- .returning()- )[0];+ const link = tx+ .insert(bookmarkLinks)+ .values({+ id: bookmark.id,+ url: input.url.trim(),+ })+ .returning()+ .all()[0];if (input.precrawledArchiveId) {- await Asset.ensureOwnership(ctx, input.precrawledArchiveId);- await tx- .update(assets)+ tx.update(assets).set({bookmarkId: bookmark.id,assetType: AssetTypes.LINK_PRECRAWLED_ARCHIVE,@@ -388,7 +401,8 @@ export const bookmarksAppRouter = router({eq(assets.id, input.precrawledArchiveId),eq(assets.userId, ctx.user.id),),- );+ )+ .run();}content = {type: BookmarkTypes.LINK,@@ -397,16 +411,15 @@ export const bookmarksAppRouter = router({break;}case BookmarkTypes.TEXT: {- const text = (- await tx- .insert(bookmarkTexts)- .values({- id: bookmark.id,- text: input.text,- sourceUrl: input.sourceUrl,- })- .returning()- )[0];+ const text = tx+ .insert(bookmarkTexts)+ .values({+ id: bookmark.id,+ text: input.text,+ sourceUrl: input.sourceUrl,+ })+ .returning()+ .all()[0];content = {type: BookmarkTypes.TEXT,text: text.text ?? "",@@ -415,7 +428,7 @@ export const bookmarksAppRouter = router({break;}case BookmarkTypes.ASSET: {- const [asset] = await tx+ const [asset] = tx.insert(bookmarkAssets).values({id: bookmark.id,@@ -426,22 +439,9 @@ export const bookmarksAppRouter = router({fileName: input.fileName ?? null,sourceUrl: input.sourceUrl ?? null,})- .returning();- const uploadedAsset = await Asset.fromId(ctx, input.assetId);- uploadedAsset.ensureOwnership();- if (- !uploadedAsset.asset.contentType ||- !SUPPORTED_BOOKMARK_ASSET_TYPES.has(- uploadedAsset.asset.contentType,- )- ) {- throw new TRPCError({- code: "BAD_REQUEST",- message: "Unsupported asset type",- });- }- await tx- .update(assets)+ .returning()+ .all();+ tx.update(assets).set({bookmarkId: bookmark.id,assetType: AssetTypes.BOOKMARK_ASSET,@@ -451,7 +451,8 @@ export const bookmarksAppRouter = router({eq(assets.id, input.assetId),eq(assets.userId, ctx.user.id),),- );+ )+ .run();content = {type: BookmarkTypes.ASSET,assetType: asset.assetType,@@ -570,7 +571,7 @@ export const bookmarksAppRouter = router({.output(zBookmarkSchema).use(ensureBookmarkOwnership).mutation(async ({ input, ctx }) => {- await ctx.db.transaction(async (tx) => {+ await ctx.db.transaction((tx) => {let somethingChanged = false;// Update link-specific fields if any are provided@@ -602,10 +603,11 @@ export const bookmarksAppRouter = router({}if (Object.keys(linkUpdateData).length > 0) {- const result = await tx+ const result = tx.update(bookmarkLinks).set(linkUpdateData)- .where(eq(bookmarkLinks.id, input.bookmarkId));+ .where(eq(bookmarkLinks.id, input.bookmarkId))+ .run();if (result.changes == 0) {throw new TRPCError({code: "BAD_REQUEST",@@ -617,12 +619,13 @@ export const bookmarksAppRouter = router({}if (input.text) {- const result = await tx+ const result = tx.update(bookmarkTexts).set({text: input.text,})- .where(eq(bookmarkTexts.id, input.bookmarkId));+ .where(eq(bookmarkTexts.id, input.bookmarkId))+ .run();if (result.changes == 0) {throw new TRPCError({@@ -635,12 +638,13 @@ export const bookmarksAppRouter = router({}if (input.assetContent !== undefined) {- const result = await tx+ const result = tx.update(bookmarkAssets).set({content: input.assetContent,})- .where(and(eq(bookmarkAssets.id, input.bookmarkId)));+ .where(and(eq(bookmarkAssets.id, input.bookmarkId)))+ .run();if (result.changes == 0) {throw new TRPCError({@@ -684,15 +688,15 @@ export const bookmarksAppRouter = router({}if (Object.keys(commonUpdateData).length > 1 || somethingChanged) {- await tx- .update(bookmarks)+ tx.update(bookmarks).set(commonUpdateData).where(and(eq(bookmarks.userId, ctx.user.id),eq(bookmarks.id, input.bookmarkId),),- );+ )+ .run();}});@@ -763,29 +767,30 @@ export const bookmarksAppRouter = router({).use(ensureBookmarkOwnership).mutation(async ({ input, ctx }) => {- await ctx.db.transaction(async (tx) => {- const res = await tx+ await ctx.db.transaction((tx) => {+ const res = tx.update(bookmarkTexts).set({text: input.text,}).where(and(eq(bookmarkTexts.id, input.bookmarkId)))- .returning();+ .returning()+ .all();if (res.length == 0) {throw new TRPCError({code: "NOT_FOUND",message: "Bookmark not found",});}- await tx- .update(bookmarks)+ tx.update(bookmarks).set({ modifiedAt: new Date() }).where(and(eq(bookmarks.id, input.bookmarkId),eq(bookmarks.userId, ctx.user.id),),- );+ )+ .run();});await Promise.all([triggerSearchReindex(input.bookmarkId, {@@ -1344,24 +1349,25 @@ export const bookmarksAppRouter = router({const allIdsToAttach = attachTagsWithNames.map((t) => t.id);const idsToRemove = detachTagsWithNames.map((t) => t.id);- const res = await ctx.db.transaction(async (tx) => {+ const res = await ctx.db.transaction((tx) => {let numChanges = 0;// Detachesif (idsToRemove.length > 0) {- const res = await tx+ const res = tx.delete(tagsOnBookmarks).where(and(eq(tagsOnBookmarks.bookmarkId, input.bookmarkId),inArray(tagsOnBookmarks.tagId, idsToRemove),),- );+ )+ .run();numChanges += res.changes;}// Attach tagsif (allIdsToAttach.length > 0) {- const res = await tx+ const res = tx.insert(tagsOnBookmarks).values(allIdsToAttach.map((i) => ({@@ -1370,21 +1376,22 @@ export const bookmarksAppRouter = router({attachedBy: tagIdToAttachedBy.get(i) ?? "human",})),)- .onConflictDoNothing();+ .onConflictDoNothing()+ .run();numChanges += res.changes;}// Update bookmark modified timestampif (numChanges > 0) {- await tx- .update(bookmarks)+ tx.update(bookmarks).set({ modifiedAt: new Date() }).where(and(eq(bookmarks.id, input.bookmarkId),eq(bookmarks.userId, ctx.user.id),),- );+ )+ .run();}return {diff --git a/packages/trpc/routers/subscriptions.ts b/packages/trpc/routers/subscriptions.tsindex 473a0fea..b1eb5f26 100644--- a/packages/trpc/routers/subscriptions.ts+++ b/packages/trpc/routers/subscriptions.ts@@ -155,8 +155,8 @@ export async function syncStripeDataToDatabase(});return;}- await db.transaction(async (trx) => {- await trx+ await db.transaction((trx) => {+ trx.update(subscriptions).set({status: "canceled",@@ -167,10 +167,11 @@ export async function syncStripeDataToDatabase(startDate: null,endDate: null,})- .where(eq(subscriptions.stripeCustomerId, customerId));+ .where(eq(subscriptions.stripeCustomerId, customerId))+ .run();// Update user quotas to free tier limits and disable browser crawling- await trx+ trx.update(users).set({bookmarkQuota: serverConfig.quotas.free.bookmarkLimit,@@ -178,7 +179,8 @@ export async function syncStripeDataToDatabase(browserCrawlingEnabled:serverConfig.quotas.free.browserCrawlingEnabled,})- .where(eq(users.id, existingSubscription.userId));+ .where(eq(users.id, existingSubscription.userId))+ .run();});addLogFields<"subscription.synced">({"subscription.tier": "free",@@ -245,16 +247,17 @@ export async function syncStripeDataToDatabase(return;}- await db.transaction(async (trx) => {- await trx+ await db.transaction((trx) => {+ trx.update(subscriptions).set(subData)- .where(eq(subscriptions.stripeCustomerId, customerId));+ .where(eq(subscriptions.stripeCustomerId, customerId))+ .run();if (subData.status === "active" || subData.status === "trialing") {// Enable paid tier quotas and browser crawling. A real subscription// supersedes a manually granted tier, so clear it.- await trx+ trx.update(users).set({bookmarkQuota: serverConfig.quotas.paid.bookmarkLimit,@@ -263,10 +266,11 @@ export async function syncStripeDataToDatabase(serverConfig.quotas.paid.browserCrawlingEnabled,manualTierName: null,})- .where(eq(users.id, existingSubscription.userId));+ .where(eq(users.id, existingSubscription.userId))+ .run();} else {// Set free tier quotas and disable browser crawling- await trx+ trx.update(users).set({bookmarkQuota: serverConfig.quotas.free.bookmarkLimit,@@ -274,7 +278,8 @@ export async function syncStripeDataToDatabase(browserCrawlingEnabled:serverConfig.quotas.free.browserCrawlingEnabled,})- .where(eq(users.id, existingSubscription.userId));+ .where(eq(users.id, existingSubscription.userId))+ .run();}});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 125eb7f8..150832ca 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -706,8 +706,8 @@ importers:specifier: ^6.0.193version: 6.0.193([email protected])better-sqlite3:- specifier: ^11.3.0- version: 11.3.0+ specifier: ^13.0.3+ version: 13.0.3cheerio:specifier: ^1.2.0version: 1.2.0@@ -728,7 +728,7 @@ importers:version: 3.6.0drizzle-orm:specifier: ^0.45.2fastest-levenshtein:specifier: ^1.0.16version: 1.0.16@@ -938,8 +938,8 @@ importers:specifier: ^0.4.1version: 0.4.1better-sqlite3:- specifier: ^11.3.0- version: 11.3.0+ specifier: ^13.0.3+ version: 13.0.3data-uri-to-buffer:specifier: ^4.0.1version: 4.0.1@@ -951,7 +951,7 @@ importers:version: 16.4.5drizzle-orm:specifier: ^0.45.2execa:specifier: 9.3.1version: 9.3.1@@ -974,8 +974,8 @@ importers:specifier: ^24.0.0version: 24.1.3liteque:- specifier: ^0.8.0- version: 0.8.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ specifier: ^0.9.0+ version: 0.9.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])lru-cache:specifier: ^11.2.2version: 11.2.2@@ -1163,7 +1163,7 @@ importers:version: 11.9.0([email protected])drizzle-orm:specifier: ^0.45.2file-type:specifier: ^21.2.0version: 21.2.0@@ -1248,8 +1248,8 @@ importers:specifier: ^2.2.2version: 2.2.2better-sqlite3:- specifier: ^11.3.0- version: 11.3.0+ specifier: ^13.0.3+ version: 13.0.3dotenv:specifier: ^16.4.1version: 16.4.5@@ -1258,7 +1258,7 @@ importers:version: 0.31.10drizzle-orm:specifier: ^0.45.2tsx:specifier: ^4.8.1version: 4.20.3@@ -1347,8 +1347,8 @@ importers:specifier: ^0.4.1version: 0.4.1liteque:- specifier: ^0.8.0- version: 0.8.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ specifier: ^0.9.0+ version: 0.9.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])meilisearch:specifier: ^0.58.0version: 0.58.0@@ -1578,7 +1578,7 @@ importers:version: 2.2.3drizzle-orm:specifier: ^0.45.2nodemailer:specifier: ^7.0.13version: 7.0.13@@ -9361,8 +9361,9 @@ packages:resolution: {integrity: sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==}- resolution: {integrity: sha512-iHt9j8NPYF3oKCNOO5ZI4JwThjt3Z6J6XrcwG85VNMVzv1ByqrHWv5VILEbCMFWDsoHhXvQ7oC8vgRXFAKgl9w==}+ resolution: {integrity: sha512-RbOBxmLBG8uvFUc15X9+9SFemKcQ0WBuISBVkpuiaUB2qblC8UWlHEjdWVoZ8AdhSwmoEgsiXKfopX0CQxaACQ==}+ engines: {node: '>=22'}resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}@@ -9378,18 +9379,12 @@ packages:resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}engines: {node: '>=8'}- resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}-resolution: {integrity: sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==}resolution: {integrity: sha512-VSWO/W6nNQdyP520F1mhf+Lc2f8pjGQOtoHHm7Ze8Go1kX7akpVIrtTa0fn+HB0QJEDVacl6aO08YE0PgXfdnQ==}- resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}-resolution: {integrity: sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==}@@ -9466,9 +9461,6 @@ packages:resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}- resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}-resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}@@ -9664,9 +9656,6 @@ packages:resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}engines: {node: '>= 20.19.0'}- resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}-resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==}engines: {node: '>=18'}@@ -11176,10 +11165,6 @@ packages:resolution: {integrity: sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==}- resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}- engines: {node: '>=6'}-resolution: {integrity: sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==}engines: {node: '>=12.0.0'}@@ -11607,9 +11592,6 @@ packages:resolution: {integrity: sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}-resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}engines: {node: '>=8'}@@ -11735,9 +11717,6 @@ packages:resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}engines: {node: '>= 0.8'}- resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}-resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}engines: {node: '>=12'}@@ -11838,9 +11817,6 @@ packages:resolution: {integrity: sha512-VilgtJj/ALgGY77fiLam5iD336eSWi96Q15JSAG1zi8NRBysm3LXKdGnHb4m5cuyxvOLQQKWpBZAT6ni4FI2iQ==}engines: {node: '>=6'}- resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}-resolution: {integrity: sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==}@@ -13129,10 +13105,10 @@ packages:resolution: {integrity: sha512-wUayTU8MS827Dam6MxgD72Ui+KOSF+u/eIqpatOtjnvgJ0+mnDq33uC2M7J0tPK+upe/DpUAuK4JUU89iBoNKQ==}engines: {node: '>=4'}- resolution: {integrity: sha512-MvcdfjCsds5s3tR/0k5Ou+ZhLBnTY6dYfxoy6yyao2evToQEX7n62KWrCBJ2Pa4Nnvh11S2IrP4RlM7wdUFFpw==}+ resolution: {integrity: sha512-iHJbsj/IdjicdstEx6yq3IgZnD+zl+KXGguMxq2XDjg6fuPns87hbeNrMIId4V0lcDDLMGnJLMj5b5Y9VLls8A==}peerDependencies:- better-sqlite3: '>=7'+ better-sqlite3: ^13.0.3resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==}@@ -13960,9 +13936,6 @@ packages:resolution: {integrity: sha512-ALGF1Jt9ouehcaXaHhn6t1yGWRqGaHkPFndtFVHfZXOvkIZ/yoGaSi0AHVTafb3ZBGg4dr/bDwnaEKqCXzchMA==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}-resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}engines: {node: '>=10'}@@ -14019,9 +13992,6 @@ packages:engines: {node: ^18 || >=20}hasBin: true- resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==}-resolution: {integrity: sha512-10uUB2Dlli3MH3NDL5nMHqJHz1A3e/E6mzjTj6cl7hHECClJ7HpE6v+xZL+GXdbwQSnWE+UWMIMsNz7yOQkAJQ==}engines: {node: '>=16'}@@ -14110,13 +14080,13 @@ packages:resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==}- resolution: {integrity: sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==}- engines: {node: '>=10'}-resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}+ resolution: {integrity: sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==}+ engines: {node: ^18 || ^20 || >= 21}+resolution: {integrity: sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==}engines: {node: '>=6.0.0'}@@ -15274,12 +15244,6 @@ packages:resolution: {integrity: sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg==}- resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==}- engines: {node: '>=10'}- deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.- hasBin: true-resolution: {integrity: sha512-Puaz+wPUAhFp8Lo9HuciYKM2Y2XExESjeT+9NQoVFXZsPPnc9VYss2SpxdQ6vbatmt8/4+SN0oe0I1cPDABg9Q==}engines: {node: '>=14.21.3'}@@ -16768,12 +16732,6 @@ packages:resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}engines: {node: '>=14'}- resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}-- resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==}-resolution: {integrity: sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==}@@ -17189,13 +17147,6 @@ packages:resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==}engines: {node: '>=6'}- resolution: {integrity: sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==}-- resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}- engines: {node: '>=6'}-resolution: {integrity: sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==}@@ -17495,9 +17446,6 @@ packages:resolution: {integrity: sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==}engines: {node: '>= 6.0.0'}- resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}-resolution: {integrity: sha512-RYnTz49u4F5tDD2SUwwtlynABNBAfbyT2uU/brJcyh5k6lDLyNfYKdKmqd3K2ls4AaiALWrFKVSBsiVwhdFNzQ==}cpu: [x64]@@ -28743,10 +28691,9 @@ snapshots:dependencies:- bindings: 1.5.0- prebuild-install: 7.1.3+ node-addon-api: 8.9.2dependencies:@@ -28758,20 +28705,10 @@ snapshots:- dependencies:- file-uri-to-path: 1.0.0-- dependencies:- buffer: 5.7.1- inherits: 2.0.4- readable-stream: 3.6.2-@@ -28893,11 +28830,6 @@ snapshots:- dependencies:- base64-js: 1.5.1- ieee754: 1.2.1-dependencies:base64-js: 1.5.1@@ -29137,8 +29069,6 @@ snapshots:dependencies:readdirp: 5.0.0- [email protected]: {}-@@ -30268,19 +30198,19 @@ snapshots:esbuild: 0.25.6tsx: 4.21.0- [email protected](@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ [email protected](@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected]):optionalDependencies:'@opentelemetry/api': 1.9.0'@types/better-sqlite3': 7.6.13'@types/react': 19.2.15- better-sqlite3: 11.3.0+ better-sqlite3: 13.0.3react: 19.2.3optionalDependencies:'@opentelemetry/api': 1.9.0'@types/better-sqlite3': 7.6.13- better-sqlite3: 11.3.0+ better-sqlite3: 13.0.3@@ -30644,8 +30574,6 @@ snapshots:- [email protected]: {}-[email protected]([email protected])([email protected](patch_hash=7d74c7fbd33e9f3f3f8a8ba47a013acfc098948e39c7faab1232e6edca358ac1)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])([email protected]):@@ -31191,8 +31119,6 @@ snapshots:- [email protected]: {}-dependencies:to-regex-range: 5.0.1@@ -31316,8 +31242,6 @@ snapshots:- [email protected]: {}-dependencies:graceful-fs: 4.2.11@@ -31413,8 +31337,6 @@ snapshots:- [email protected]: {}-@@ -32777,11 +32699,11 @@ snapshots:- [email protected](@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ [email protected](@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected]):dependencies:async-mutex: 0.4.1- better-sqlite3: 11.3.0- drizzle-orm: 0.33.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ better-sqlite3: 13.0.3+ drizzle-orm: 0.33.0(@opentelemetry/[email protected])(@types/[email protected])(@types/[email protected])([email protected])([email protected])zod: 4.3.6transitivePeerDependencies:- '@aws-sdk/client-rds-data'@@ -34268,8 +34190,6 @@ snapshots:for-in: 0.1.8is-extendable: 0.1.1- [email protected]: {}-@@ -34312,8 +34232,6 @@ snapshots:- [email protected]: {}-[email protected](8a342e73ea8fd54871af5edb882e92f6):dependencies:comment-json: 4.2.5@@ -34425,13 +34343,11 @@ snapshots:lower-case: 2.0.2tslib: 2.8.1- dependencies:- semver: 7.8.5-optional: true+ [email protected]: {}+dependencies:uuid: 8.3.2@@ -35674,21 +35590,6 @@ snapshots:- dependencies:- detect-libc: 2.0.4- expand-template: 2.0.3- github-from-package: 0.0.0- minimist: 1.2.8- mkdirp-classic: 0.5.3- napi-build-utils: 2.0.0- node-abi: 3.75.0- pump: 3.0.2- rc: 1.2.8- simple-get: 4.0.1- tar-fs: 2.1.3- tunnel-agent: 0.6.0-dependencies:prettier: 3.8.1@@ -37692,14 +37593,6 @@ snapshots:- [email protected]: {}-- dependencies:- decompress-response: 6.0.0- once: 1.4.0- simple-concat: 1.0.1-dependencies:bplist-creator: 0.1.0@@ -38161,21 +38054,6 @@ snapshots:- dependencies:- chownr: 1.1.4- mkdirp-classic: 0.5.3- pump: 3.0.2- tar-stream: 2.2.0-- dependencies:- bl: 4.1.0- end-of-stream: 1.4.4- fs-constants: 1.0.0- inherits: 2.0.4- readable-stream: 3.6.2-dependencies:b4a: 1.7.3@@ -38435,10 +38313,6 @@ snapshots:dependencies:tslib: 1.14.1- dependencies:- safe-buffer: 5.2.1-optional: truediff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 12419f1b..193c3b8d 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -50,6 +50,7 @@ minimumReleaseAgeExclude:"@next/[email protected]","@next/[email protected]",]# Pin vite so adding vitest as a direct devDep to apps/mcp doesn't hoist