aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-10-12 22:41:56 +0100
committerGitHub <noreply@github.com>2025-10-12 22:41:56 +0100
commit2defc2475fc36635c45a449a44669048871864f6 (patch)
treebf093e6a55f22ec062d8cf3eb41763f72f55f821 /packages/shared
parentc14b69346a67d4c426d7ddb32ef32812c449e67c (diff)
downloadkarakeep-2defc2475fc36635c45a449a44669048871864f6.tar.zst
feat: Add source field to track bookmark creation sources (#2037)
* feat: Add source field to track bookmark creation sources Add a new 'source' field to the bookmarks table to track where bookmarks were created from. Possible values: api, web, cli, mobile, singlefile, rss. Changes: - Add source field to bookmarks table schema - Update Zod schemas to include source field - Update tRPC createBookmark procedure to store source - Update all callsites to pass appropriate source value: - api: Default to "api" if not provided - singlefile: Set to "singlefile" - rss: Set to "rss" in feedWorker - cli: Set to "cli" - mobile: Set to "mobile" in all mobile app bookmark creation - browser-extension: Set to "web" - web: Set to "web" in all web app bookmark creation - Create migration file for database schema change Fixes #2036 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Mohamed Bassem <MohamedBassem@users.noreply.github.com> * feat: Add extension source type for browser extension - Add 'extension' to bookmark source enum - Update browser extension to use 'extension' instead of 'web' Co-authored-by: Mohamed Bassem <MohamedBassem@users.noreply.github.com> * fix CI * fix CI * fix the migration file * add import source * make source nullish --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Mohamed Bassem <MohamedBassem@users.noreply.github.com>
Diffstat (limited to 'packages/shared')
-rw-r--r--packages/shared/types/bookmarks.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/shared/types/bookmarks.ts b/packages/shared/types/bookmarks.ts
index 71cf1012..f108d006 100644
--- a/packages/shared/types/bookmarks.ts
+++ b/packages/shared/types/bookmarks.ts
@@ -81,6 +81,18 @@ export const zBookmarkContentSchema = z.discriminatedUnion("type", [
]);
export type ZBookmarkContent = z.infer<typeof zBookmarkContentSchema>;
+export const zBookmarkSourceSchema = z.enum([
+ "api",
+ "web",
+ "cli",
+ "mobile",
+ "extension",
+ "singlefile",
+ "rss",
+ "import",
+]);
+export type ZBookmarkSource = z.infer<typeof zBookmarkSourceSchema>;
+
export const zBareBookmarkSchema = z.object({
id: z.string(),
createdAt: z.date(),
@@ -92,6 +104,7 @@ export const zBareBookmarkSchema = z.object({
summarizationStatus: z.enum(["success", "failure", "pending"]).nullable(),
note: z.string().nullish(),
summary: z.string().nullish(),
+ source: zBookmarkSourceSchema.nullish(),
});
export const zBookmarkSchema = zBareBookmarkSchema.merge(
@@ -143,6 +156,7 @@ export const zNewBookmarkRequestSchema = z
// they were created by a user interaction or by a bulk import.
crawlPriority: z.enum(["low", "normal"]).optional(),
importSessionId: z.string().optional(),
+ source: zBookmarkSourceSchema.optional(),
})
.and(
z.discriminatedUnion("type", [