aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-09-22 14:56:19 +0000
committerMohamedBassem <me@mbassem.com>2024-09-22 15:04:20 +0000
commita770e55520245b7afc2b7a30aa6127eebcb6ea0d (patch)
tree7a2e4041e2d16413ee0e8dd060be41b58253c995 /packages/shared
parent55f5c7f40d6569d0769a3b7a9060db5ec1d3b93b (diff)
downloadkarakeep-a770e55520245b7afc2b7a30aa6127eebcb6ea0d.tar.zst
feature(web): Show attachments and allow users to manipulate them.
Diffstat (limited to 'packages/shared')
-rw-r--r--packages/shared/types/bookmarks.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/shared/types/bookmarks.ts b/packages/shared/types/bookmarks.ts
index beefbfb9..c15146f3 100644
--- a/packages/shared/types/bookmarks.ts
+++ b/packages/shared/types/bookmarks.ts
@@ -11,6 +11,18 @@ export const enum BookmarkTypes {
UNKNOWN = "unknown",
}
+export const zAssetTypesSchema = z.enum([
+ "screenshot",
+ "bannerImage",
+ "fullPageArchive",
+]);
+export type ZAssetType = z.infer<typeof zAssetTypesSchema>;
+
+export const zAssetSchema = z.object({
+ id: z.string(),
+ assetType: zAssetTypesSchema,
+});
+
export const zBookmarkedLinkSchema = z.object({
type: z.literal(BookmarkTypes.LINK),
url: z.string().url(),
@@ -63,6 +75,7 @@ export const zBookmarkSchema = zBareBookmarkSchema.merge(
z.object({
tags: z.array(zBookmarkTagSchema),
content: zBookmarkContentSchema,
+ assets: z.array(zAssetSchema),
}),
);
export type ZBookmark = z.infer<typeof zBookmarkSchema>;
@@ -71,6 +84,7 @@ const zBookmarkTypeLinkSchema = zBareBookmarkSchema.merge(
z.object({
tags: z.array(zBookmarkTagSchema),
content: zBookmarkedLinkSchema,
+ assets: z.array(zAssetSchema),
}),
);
export type ZBookmarkTypeLink = z.infer<typeof zBookmarkTypeLinkSchema>;
@@ -79,6 +93,7 @@ const zBookmarkTypeTextSchema = zBareBookmarkSchema.merge(
z.object({
tags: z.array(zBookmarkTagSchema),
content: zBookmarkedTextSchema,
+ assets: z.array(zAssetSchema),
}),
);
export type ZBookmarkTypeText = z.infer<typeof zBookmarkTypeTextSchema>;
@@ -87,6 +102,7 @@ const zBookmarkTypeAssetSchema = zBareBookmarkSchema.merge(
z.object({
tags: z.array(zBookmarkTagSchema),
content: zBookmarkedAssetSchema,
+ assets: z.array(zAssetSchema),
}),
);
export type ZBookmarkTypeAsset = z.infer<typeof zBookmarkTypeAssetSchema>;