Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

feat: Allow multiple lists for Rule Engine #2490 (#2620)

Ahmed Abdelkarim8a1f830377aa
diff --git a/apps/cli/src/commands/lists.ts b/apps/cli/src/commands/lists.ts
index 0b9c38fa..77b084bd 100644
--- a/apps/cli/src/commands/lists.ts
+++ b/apps/cli/src/commands/lists.ts
@@ -10,7 +10,10 @@ import { Command } from "@commander-js/extra-typings";
import chalk from "chalk";
import { getBorderCharacters, table } from "table";
-import { listsToTree } from "@karakeep/shared/utils/listUtils";
+import {
+ listNameFromPath,
+ listsToTree,
+} from "@karakeep/shared/utils/listUtils";
export const listsCmd = new Command()
.name("lists")
@@ -35,7 +38,7 @@ listsCmd
const data: string[][] = [["Id", "Name", "Description", "Bookmarks"]];
allPaths.forEach((path) => {
- const name = path.map((p) => `${p.icon} ${p.name}`).join(" / ");
+ const name = listNameFromPath(path);
const leaf = path[path.length - 1];
const count = statsResp.stats.get(leaf.id) ?? 0;
data.push([leaf.id, name, leaf.description ?? "", count.toString()]);
diff --git a/apps/cli/src/commands/migrate.ts b/apps/cli/src/commands/migrate.ts
index 8e25acda..1e090acb 100644
--- a/apps/cli/src/commands/migrate.ts
+++ b/apps/cli/src/commands/migrate.ts
@@ -589,7 +589,7 @@ function remapRuleIds(
return { ...e, tagId: mapTag(e.tagId) };
case "addedToList":
case "removedFromList":
- return { ...e, listId: mapList(e.listId) };
+ return { ...e, listIds: e.listIds.map(mapList) };
default:
return e;
}
diff --git a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
index a05437e6..a85dc3b5 100644
--- a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
+++ b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { ReactNode, useState } from "react";
import { Button } from "@/components/ui/button";
import {
Command,
@@ -15,78 +15,77 @@ import {
} from "@/components/ui/popover";
import LoadingSpinner from "@/components/ui/spinner";
import { cn } from "@/lib/utils";
-import { Check, ChevronsUpDown } from "lucide-react";
+import { Check, ChevronsUpDown, X } from "lucide-react";
import { useBookmarkLists } from "@karakeep/shared-react/hooks/lists";
import { ZBookmarkList } from "@karakeep/shared/types/lists";
+import { listNameFromPath } from "@karakeep/shared/utils/listUtils";
-export function BookmarkListSelector({
- value,
- onChange,
- hideSubtreeOf,
- hideBookmarkIds = [],
- placeholder = "Select a list",
- className,
- listTypes = ["manual", "smart"],
- disabled = false,
-}: {
- className?: string;
+interface DataProps {
+ isPending: boolean;
+ allPaths?: ZBookmarkList[][];
+}
+
+interface ListSelectorComponentProps extends DataProps {
+ onSelect: (value: string) => void;
+ isItemSelected: (id: string) => boolean;
+ open: boolean;
+ setOpen: (open: boolean) => void;
+ children: ReactNode;
+ disabled?: boolean;
+}
+
+interface SingleSelectionProps {
value?: string | null;
onChange: (value: string) => void;
placeholder?: string;
+ className?: string;
+ multiSelect?: false;
+ disabled?: boolean;
+}
+
+interface MultiSelectionProps {
+ value: string[] | null;
+ onChange: (value: string[]) => void;
+ multiSelect: true;
+ placeholder?: string;
+ className?: string;
+}
+
+interface SelectionProps {
hideSubtreeOf?: string;
hideBookmarkIds?: string[];
listTypes?: ZBookmarkList["type"][];
disabled?: boolean;
-}) {
- const [open, setOpen] = useState(false);
- const { data, isPending: isFetchingListsPending } = useBookmarkLists();
- let { allPaths } = data ?? {};
+}
+
+type BookmarkListSelectorProps = SelectionProps &
+ (SingleSelectionProps | MultiSelectionProps);
- if (isFetchingListsPending) {
+function ListSelectorComponent({
+ onSelect,
+ children,
+ isItemSelected,
+ open,
+ setOpen,
+ isPending,
+ allPaths,
+ disabled,
+}: ListSelectorComponentProps) {
+ if (isPending) {
return <LoadingSpinner />;
}
- allPaths = allPaths?.filter((path) => {
- const lastItem = path[path.length - 1];
- if (hideBookmarkIds.includes(lastItem.id)) {
- return false;
- }
- if (!listTypes.includes(lastItem.type)) {
- return false;
- }
- // Hide lists where user is a viewer (can't add/remove bookmarks)
- if (lastItem.userRole === "viewer") {
- return false;
- }
- if (!hideSubtreeOf) {
- return true;
- }
- return !path.map((p) => p.id).includes(hideSubtreeOf);
- });
-
- // Find the selected list's display name
- const selectedListPath = allPaths?.find(
- (path) => path[path.length - 1].id === value,
- );
- const selectedListName = selectedListPath
- ? selectedListPath.map((p) => `${p.icon} ${p.name}`).join(" / ")
- : null;
-
return (
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={open}
- className={cn("w-full justify-between", className)}
- disabled={disabled}
- >
- {selectedListName || placeholder}
- <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
+ <Popover
+ open={disabled ? false : open}
+ onOpenChange={(nextOpen) => {
+ if (!disabled) {
+ setOpen(nextOpen);
+ }
+ }}
+ >
+ <PopoverTrigger asChild>{children}</PopoverTrigger>
<PopoverContent
className="w-[--radix-popover-trigger-width] p-0"
onWheel={(e) => e.stopPropagation()}
@@ -102,22 +101,19 @@ export function BookmarkListSelector({
<CommandGroup className="max-h-60 overflow-y-auto">
{allPaths?.map((path) => {
const l = path[path.length - 1];
- const name = path.map((p) => `${p.icon} ${p.name}`).join(" / ");
+ const name = listNameFromPath(path);
return (
<CommandItem
key={l.id}
value={l.id}
keywords={[l.name, l.icon]}
- onSelect={(currentValue) => {
- onChange(currentValue);
- setOpen(false);
- }}
+ onSelect={onSelect}
className="cursor-pointer"
>
<Check
className={cn(
"mr-2 h-4 w-4",
- value === l.id ? "opacity-100" : "opacity-0",
+ isItemSelected(l.id) ? "opacity-100" : "opacity-0",
)}
/>
{name}
@@ -131,3 +127,189 @@ export function BookmarkListSelector({
</Popover>
);
}
+
+function BookmarkListSingleSelector({
+ placeholder = "Select a list",
+ className,
+ onChange,
+ value,
+ isPending,
+ allPaths,
+ disabled,
+}: SingleSelectionProps & DataProps) {
+ const [open, setOpen] = useState(false);
+ const onSelect = (currentValue: string) => {
+ onChange(currentValue);
+ setOpen(false);
+ };
+
+ const isItemSelected = (id: string) => id === value;
+
+ // Find the selected list's display name
+ const selectedListPath = allPaths?.find(
+ (path) => path[path.length - 1].id === value,
+ );
+ const selectedListName = selectedListPath
+ ? listNameFromPath(selectedListPath)
+ : null;
+ return (
+ <ListSelectorComponent
+ onSelect={onSelect}
+ open={open}
+ isItemSelected={isItemSelected}
+ setOpen={setOpen}
+ isPending={isPending}
+ allPaths={allPaths}
+ disabled={disabled}
+ >
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={open}
+ className={cn("w-full justify-between", className)}
+ disabled={disabled}
+ >
+ {selectedListName || placeholder}
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </ListSelectorComponent>
+ );
+}
+
+function BookmarkListMultiSelector({
+ placeholder = "Select lists",
+ onChange,
+ value,
+ isPending,
+ allPaths,
+ className,
+ disabled,
+}: MultiSelectionProps & DataProps & { disabled?: boolean }) {
+ const [open, setOpen] = useState(false);
+ const onSelect = (currentValue: string) => {
+ if (disabled) {
+ return;
+ }
+ const newValue = value?.includes(currentValue)
+ ? value.filter((id) => id !== currentValue)
+ : [...(value ?? []), currentValue];
+ onChange(newValue);
+ };
+ const removeSelection = (removedId?: string) => {
+ if (!disabled && value && removedId) {
+ onChange(value.filter((id) => id !== removedId));
+ }
+ };
+
+ const isItemSelected = (id: string) => !!value?.includes(id);
+
+ const selectedListsPaths = allPaths?.filter((path) =>
+ value?.includes(path[path.length - 1].id),
+ );
+ return (
+ <ListSelectorComponent
+ onSelect={onSelect}
+ open={open}
+ isItemSelected={isItemSelected}
+ setOpen={setOpen}
+ isPending={isPending}
+ allPaths={allPaths}
+ disabled={disabled}
+ >
+ <div
+ role="combobox"
+ tabIndex={disabled ? -1 : 0}
+ aria-disabled={disabled}
+ aria-expanded={disabled ? false : open}
+ className={cn(
+ "relative flex min-h-10 w-full cursor-pointer flex-wrap items-center gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background transition-colors",
+ disabled && "cursor-not-allowed opacity-50",
+ className,
+ )}
+ onKeyDown={(e) => {
+ if (disabled) {
+ return;
+ }
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ setOpen((prev) => !prev);
+ }
+ }}
+ >
+ {selectedListsPaths && selectedListsPaths.length > 0 ? (
+ <>
+ {selectedListsPaths.map((path) => {
+ const listName = listNameFromPath(path);
+ const listId = path.at(-1)?.id;
+ return (
+ <div
+ key={listId}
+ className="flex min-h-7 space-x-1 rounded bg-accent px-2"
+ >
+ <div className="m-auto flex gap-2">
+ {listName}
+ <button
+ type="button"
+ disabled={disabled}
+ className="cursor-pointer rounded-full outline-none ring-offset-background focus:ring-1 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed"
+ onClick={(e) => {
+ e.stopPropagation();
+ removeSelection(listId);
+ }}
+ >
+ <X className="h-3 w-3" />
+ <span className="sr-only">Remove {listName}</span>
+ </button>
+ </div>
+ </div>
+ );
+ })}
+ </>
+ ) : (
+ placeholder
+ )}
+ </div>
+ </ListSelectorComponent>
+ );
+}
+export function BookmarkListSelector(props: BookmarkListSelectorProps) {
+ const { data, isPending } = useBookmarkLists();
+ const {
+ hideSubtreeOf,
+ hideBookmarkIds = [],
+ listTypes = ["manual", "smart"],
+ ...selectorProps
+ } = props;
+ let { allPaths } = data ?? {};
+ allPaths = allPaths?.filter((path) => {
+ const lastItem = path[path.length - 1];
+ if (hideBookmarkIds.includes(lastItem.id)) {
+ return false;
+ }
+ if (!listTypes.includes(lastItem.type)) {
+ return false;
+ }
+ // Hide lists where user is a viewer (can't add/remove bookmarks)
+ if (lastItem.userRole === "viewer") {
+ return false;
+ }
+ if (!hideSubtreeOf) {
+ return true;
+ }
+ return !path.map((p) => p.id).includes(hideSubtreeOf);
+ });
+
+ return selectorProps.multiSelect ? (
+ <BookmarkListMultiSelector
+ {...selectorProps}
+ isPending={isPending}
+ allPaths={allPaths}
+ />
+ ) : (
+ <BookmarkListSingleSelector
+ {...selectorProps}
+ isPending={isPending}
+ allPaths={allPaths}
+ />
+ );
+}
diff --git a/apps/web/components/dashboard/rules/RuleEngineEventSelector.tsx b/apps/web/components/dashboard/rules/RuleEngineEventSelector.tsx
index ae37945e..9763fe19 100644
--- a/apps/web/components/dashboard/rules/RuleEngineEventSelector.tsx
+++ b/apps/web/components/dashboard/rules/RuleEngineEventSelector.tsx
@@ -8,19 +8,19 @@ import {
} from "@/components/ui/select";
import { useTranslation } from "react-i18next";
-import type { RuleEngineEvent } from "@karakeep/shared/types/rules";
+import type { RuleEngineRuleEvent } from "@karakeep/shared/types/rules";
import { BookmarkListSelector } from "../lists/BookmarkListSelector";
import { TagAutocomplete } from "../tags/TagAutocomplete";
interface EventSelectorProps {
- value: RuleEngineEvent;
- onChange: (event: RuleEngineEvent) => void;
+ value: RuleEngineRuleEvent;
+ onChange: (event: RuleEngineRuleEvent) => void;
}
export function EventSelector({ value, onChange }: EventSelectorProps) {
const { t } = useTranslation();
- const handleTypeChange = (type: RuleEngineEvent["type"]) => {
+ const handleTypeChange = (type: RuleEngineRuleEvent["type"]) => {
switch (type) {
case "bookmarkAdded":
onChange({ type: "bookmarkAdded" });
@@ -32,10 +32,10 @@ export function EventSelector({ value, onChange }: EventSelectorProps) {
onChange({ type: "tagRemoved", tagId: "" });
break;
case "addedToList":
- onChange({ type: "addedToList", listId: "" });
+ onChange({ type: "addedToList", listIds: [] });
break;
case "removedFromList":
- onChange({ type: "removedFromList", listId: "" });
+ onChange({ type: "removedFromList", listIds: [] });
break;
case "favourited":
onChange({ type: "favourited" });
@@ -96,8 +96,9 @@ export function EventSelector({ value, onChange }: EventSelectorProps) {
value.type === "removedFromList") && (
<BookmarkListSelector
listTypes={["manual"]}
- value={value.listId}
- onChange={(l) => onChange({ type: value.type, listId: l })}
+ value={value.listIds}
+ onChange={(l) => onChange({ type: value.type, listIds: l })}
+ multiSelect
/>
)}
</div>
diff --git a/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx b/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx
index e4859b4a..250c17f1 100644
--- a/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx
+++ b/apps/web/components/dashboard/rules/RuleEngineRuleEditor.tsx
@@ -16,8 +16,8 @@ import { useTranslation } from "react-i18next";
import type {
RuleEngineAction,
RuleEngineCondition,
- RuleEngineEvent,
RuleEngineRule,
+ RuleEngineRuleEvent,
} from "@karakeep/shared/types/rules";
import {
useCreateRule,
@@ -98,7 +98,7 @@ export function RuleEditor({ rule, onCancel }: RuleEditorProps) {
setEditedRule({ ...rule });
}, [rule]);
- const handleEventChange = (event: RuleEngineEvent) => {
+ const handleEventChange = (event: RuleEngineRuleEvent) => {
setEditedRule({ ...editedRule, event });
};
diff --git a/packages/db/drizzle/0084_rule_engine_multi_list_support.sql b/packages/db/drizzle/0084_rule_engine_multi_list_support.sql
new file mode 100644
index 00000000..abb9f338
--- /dev/null
+++ b/packages/db/drizzle/0084_rule_engine_multi_list_support.sql
@@ -0,0 +1,55 @@
+DELETE FROM ruleEngineRules
+WHERE CASE
+ WHEN json_valid("event") THEN json_extract("event", '$.type')
+ END
+IN ('addedToList', 'removedFromList')
+AND (
+ CASE
+ WHEN json_valid("event") THEN json_extract("event", '$.listId')
+ END IS NULL
+ OR CASE
+ WHEN json_valid("event") THEN json_extract("event", '$.listId')
+ END = ''
+);
+--> statement-breakpoint
+PRAGMA foreign_keys=OFF;
+--> statement-breakpoint
+CREATE TEMPORARY TABLE `_backup_ruleEngineActions` AS
+SELECT * FROM `ruleEngineActions`;
+--> statement-breakpoint
+CREATE TABLE `__new_ruleEngineRules` (
+ `id` text PRIMARY KEY NOT NULL,
+ `enabled` integer DEFAULT true NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `event` text NOT NULL,
+ `condition` text NOT NULL,
+ `userId` text NOT NULL,
+ `tagId` text,
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`userId`,`tagId`) REFERENCES `bookmarkTags`(`userId`,`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_ruleEngineRules`("id", "enabled", "name", "description", "event", "condition", "userId", "tagId") SELECT "id", "enabled", "name", "description",
+CASE
+ WHEN json_valid("event") THEN
+ CASE
+ WHEN json_extract("event", '$.type') IN ('addedToList', 'removedFromList')
+ THEN json_set(
+ json_remove("event", '$.listId'),
+ '$.listIds',
+ json_array(json_extract("event", '$.listId'))
+ )
+ ELSE "event"
+ END
+ ELSE "event"
+ END, "condition", "userId", "tagId" FROM `ruleEngineRules`;--> statement-breakpoint
+DROP TABLE `ruleEngineRules`;--> statement-breakpoint
+ALTER TABLE `__new_ruleEngineRules` RENAME TO `ruleEngineRules`;--> statement-breakpoint
+DELETE FROM `ruleEngineActions`;--> statement-breakpoint
+INSERT INTO `ruleEngineActions` SELECT * FROM `_backup_ruleEngineActions`;
+--> statement-breakpoint
+DROP TABLE `_backup_ruleEngineActions`;
+--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE INDEX `ruleEngine_userId_idx` ON `ruleEngineRules` (`userId`);
diff --git a/packages/db/drizzle/meta/0084_snapshot.json b/packages/db/drizzle/meta/0084_snapshot.json
new file mode 100644
index 00000000..16764fb8
--- /dev/null
+++ b/packages/db/drizzle/meta/0084_snapshot.json
@@ -0,0 +1,3348 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "db6cb54e-54fe-44b2-a1a9-954bb9795978",
+ "prevId": "324628ba-d45a-40f9-8b5b-87fdfaa61837",
+ "tables": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "columns": [
+ "provider",
+ "providerAccountId"
+ ],
+ "name": "account_provider_providerAccountId_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "apiKey": {
+ "name": "apiKey",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lastUsedAt": {
+ "name": "lastUsedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "keyId": {
+ "name": "keyId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keyHash": {
+ "name": "keyHash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "apiKey_keyId_unique": {
+ "name": "apiKey_keyId_unique",
+ "columns": [
+ "keyId"
+ ],
+ "isUnique": true
+ },
+ "apiKey_name_userId_unique": {
+ "name": "apiKey_name_userId_unique",
+ "columns": [
+ "name",
+ "userId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "apiKey_userId_user_id_fk": {
+ "name": "apiKey_userId_user_id_fk",
+ "tableFrom": "apiKey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "assets": {
+ "name": "assets",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assetType": {
+ "name": "assetType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "contentType": {
+ "name": "contentType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fileName": {
+ "name": "fileName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "assets_bookmarkId_idx": {
+ "name": "assets_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "assets_assetType_idx": {
+ "name": "assets_assetType_idx",
+ "columns": [
+ "assetType"
+ ],
+ "isUnique": false
+ },
+ "assets_userId_idx": {
+ "name": "assets_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "assets_bookmarkId_bookmarks_id_fk": {
+ "name": "assets_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "assets",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "assets_userId_user_id_fk": {
+ "name": "assets_userId_user_id_fk",
+ "tableFrom": "assets",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "backups": {
+ "name": "backups",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assetId": {
+ "name": "assetId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bookmarkCount": {
+ "name": "bookmarkCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "errorMessage": {
+ "name": "errorMessage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "backups_userId_idx": {
+ "name": "backups_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "backups_createdAt_idx": {
+ "name": "backups_createdAt_idx",
+ "columns": [
+ "createdAt"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "backups_userId_user_id_fk": {
+ "name": "backups_userId_user_id_fk",
+ "tableFrom": "backups",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "backups_assetId_assets_id_fk": {
+ "name": "backups_assetId_assets_id_fk",
+ "tableFrom": "backups",
+ "tableTo": "assets",
+ "columnsFrom": [
+ "assetId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarkAssets": {
+ "name": "bookmarkAssets",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assetType": {
+ "name": "assetType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assetId": {
+ "name": "assetId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fileName": {
+ "name": "fileName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sourceUrl": {
+ "name": "sourceUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "bookmarkAssets_id_bookmarks_id_fk": {
+ "name": "bookmarkAssets_id_bookmarks_id_fk",
+ "tableFrom": "bookmarkAssets",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarkLinks": {
+ "name": "bookmarkLinks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "publisher": {
+ "name": "publisher",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "datePublished": {
+ "name": "datePublished",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "dateModified": {
+ "name": "dateModified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "imageUrl": {
+ "name": "imageUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "favicon": {
+ "name": "favicon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "htmlContent": {
+ "name": "htmlContent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "contentAssetId": {
+ "name": "contentAssetId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "crawledAt": {
+ "name": "crawledAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "crawlStatus": {
+ "name": "crawlStatus",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "crawlStatusCode": {
+ "name": "crawlStatusCode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 200
+ }
+ },
+ "indexes": {
+ "bookmarkLinks_url_idx": {
+ "name": "bookmarkLinks_url_idx",
+ "columns": [
+ "url"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bookmarkLinks_id_bookmarks_id_fk": {
+ "name": "bookmarkLinks_id_bookmarks_id_fk",
+ "tableFrom": "bookmarkLinks",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarkLists": {
+ "name": "bookmarkLists",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "query": {
+ "name": "query",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rssToken": {
+ "name": "rssToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "public": {
+ "name": "public",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ }
+ },
+ "indexes": {
+ "bookmarkLists_userId_idx": {
+ "name": "bookmarkLists_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "bookmarkLists_userId_id_idx": {
+ "name": "bookmarkLists_userId_id_idx",
+ "columns": [
+ "userId",
+ "id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bookmarkLists_userId_user_id_fk": {
+ "name": "bookmarkLists_userId_user_id_fk",
+ "tableFrom": "bookmarkLists",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bookmarkLists_parentId_bookmarkLists_id_fk": {
+ "name": "bookmarkLists_parentId_bookmarkLists_id_fk",
+ "tableFrom": "bookmarkLists",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "parentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarkTags": {
+ "name": "bookmarkTags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "normalizedName": {
+ "name": "normalizedName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "generated": {
+ "as": "(lower(replace(replace(replace(\"name\", ' ', ''), '-', ''), '_', '')))",
+ "type": "virtual"
+ }
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "bookmarkTags_name_idx": {
+ "name": "bookmarkTags_name_idx",
+ "columns": [
+ "name"
+ ],
+ "isUnique": false
+ },
+ "bookmarkTags_userId_idx": {
+ "name": "bookmarkTags_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "bookmarkTags_normalizedName_idx": {
+ "name": "bookmarkTags_normalizedName_idx",
+ "columns": [
+ "normalizedName"
+ ],
+ "isUnique": false
+ },
+ "bookmarkTags_userId_name_unique": {
+ "name": "bookmarkTags_userId_name_unique",
+ "columns": [
+ "userId",
+ "name"
+ ],
+ "isUnique": true
+ },
+ "bookmarkTags_userId_id_idx": {
+ "name": "bookmarkTags_userId_id_idx",
+ "columns": [
+ "userId",
+ "id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bookmarkTags_userId_user_id_fk": {
+ "name": "bookmarkTags_userId_user_id_fk",
+ "tableFrom": "bookmarkTags",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarkTexts": {
+ "name": "bookmarkTexts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sourceUrl": {
+ "name": "sourceUrl",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "bookmarkTexts_id_bookmarks_id_fk": {
+ "name": "bookmarkTexts_id_bookmarks_id_fk",
+ "tableFrom": "bookmarkTexts",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarks": {
+ "name": "bookmarks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "archived": {
+ "name": "archived",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "favourited": {
+ "name": "favourited",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "taggingStatus": {
+ "name": "taggingStatus",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "summarizationStatus": {
+ "name": "summarizationStatus",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "bookmarks_userId_idx": {
+ "name": "bookmarks_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "bookmarks_createdAt_idx": {
+ "name": "bookmarks_createdAt_idx",
+ "columns": [
+ "createdAt"
+ ],
+ "isUnique": false
+ },
+ "bookmarks_userId_createdAt_id_idx": {
+ "name": "bookmarks_userId_createdAt_id_idx",
+ "columns": [
+ "userId",
+ "createdAt",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "bookmarks_userId_archived_createdAt_id_idx": {
+ "name": "bookmarks_userId_archived_createdAt_id_idx",
+ "columns": [
+ "userId",
+ "archived",
+ "createdAt",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "bookmarks_userId_favourited_createdAt_id_idx": {
+ "name": "bookmarks_userId_favourited_createdAt_id_idx",
+ "columns": [
+ "userId",
+ "favourited",
+ "createdAt",
+ "id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bookmarks_userId_user_id_fk": {
+ "name": "bookmarks_userId_user_id_fk",
+ "tableFrom": "bookmarks",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bookmarksInLists": {
+ "name": "bookmarksInLists",
+ "columns": {
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "listId": {
+ "name": "listId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedAt": {
+ "name": "addedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "listMembershipId": {
+ "name": "listMembershipId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "bookmarksInLists_bookmarkId_idx": {
+ "name": "bookmarksInLists_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "bookmarksInLists_listId_idx": {
+ "name": "bookmarksInLists_listId_idx",
+ "columns": [
+ "listId"
+ ],
+ "isUnique": false
+ },
+ "bookmarksInLists_listId_bookmarkId_idx": {
+ "name": "bookmarksInLists_listId_bookmarkId_idx",
+ "columns": [
+ "listId",
+ "bookmarkId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bookmarksInLists_bookmarkId_bookmarks_id_fk": {
+ "name": "bookmarksInLists_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "bookmarksInLists",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bookmarksInLists_listId_bookmarkLists_id_fk": {
+ "name": "bookmarksInLists_listId_bookmarkLists_id_fk",
+ "tableFrom": "bookmarksInLists",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "listId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bookmarksInLists_listMembershipId_listCollaborators_id_fk": {
+ "name": "bookmarksInLists_listMembershipId_listCollaborators_id_fk",
+ "tableFrom": "bookmarksInLists",
+ "tableTo": "listCollaborators",
+ "columnsFrom": [
+ "listMembershipId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "bookmarksInLists_bookmarkId_listId_pk": {
+ "columns": [
+ "bookmarkId",
+ "listId"
+ ],
+ "name": "bookmarksInLists_bookmarkId_listId_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "config": {
+ "name": "config",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "customPrompts": {
+ "name": "customPrompts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "appliesTo": {
+ "name": "appliesTo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "customPrompts_userId_idx": {
+ "name": "customPrompts_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "customPrompts_userId_user_id_fk": {
+ "name": "customPrompts_userId_user_id_fk",
+ "tableFrom": "customPrompts",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "highlights": {
+ "name": "highlights",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "startOffset": {
+ "name": "startOffset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "endOffset": {
+ "name": "endOffset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'yellow'"
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "highlights_bookmarkId_idx": {
+ "name": "highlights_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "highlights_userId_idx": {
+ "name": "highlights_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "highlights_bookmarkId_bookmarks_id_fk": {
+ "name": "highlights_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "highlights",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "highlights_userId_user_id_fk": {
+ "name": "highlights_userId_user_id_fk",
+ "tableFrom": "highlights",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "importSessionBookmarks": {
+ "name": "importSessionBookmarks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "importSessionId": {
+ "name": "importSessionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "importSessionBookmarks_sessionId_idx": {
+ "name": "importSessionBookmarks_sessionId_idx",
+ "columns": [
+ "importSessionId"
+ ],
+ "isUnique": false
+ },
+ "importSessionBookmarks_bookmarkId_idx": {
+ "name": "importSessionBookmarks_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "importSessionBookmarks_importSessionId_bookmarkId_unique": {
+ "name": "importSessionBookmarks_importSessionId_bookmarkId_unique",
+ "columns": [
+ "importSessionId",
+ "bookmarkId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "importSessionBookmarks_importSessionId_importSessions_id_fk": {
+ "name": "importSessionBookmarks_importSessionId_importSessions_id_fk",
+ "tableFrom": "importSessionBookmarks",
+ "tableTo": "importSessions",
+ "columnsFrom": [
+ "importSessionId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "importSessionBookmarks_bookmarkId_bookmarks_id_fk": {
+ "name": "importSessionBookmarks_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "importSessionBookmarks",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "importSessions": {
+ "name": "importSessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rootListId": {
+ "name": "rootListId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'staging'"
+ },
+ "lastProcessedAt": {
+ "name": "lastProcessedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "importSessions_userId_idx": {
+ "name": "importSessions_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "importSessions_status_idx": {
+ "name": "importSessions_status_idx",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "importSessions_userId_user_id_fk": {
+ "name": "importSessions_userId_user_id_fk",
+ "tableFrom": "importSessions",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "importSessions_rootListId_bookmarkLists_id_fk": {
+ "name": "importSessions_rootListId_bookmarkLists_id_fk",
+ "tableFrom": "importSessions",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "rootListId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "importStagingBookmarks": {
+ "name": "importStagingBookmarks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "importSessionId": {
+ "name": "importSessionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tags": {
+ "name": "tags",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "listIds": {
+ "name": "listIds",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sourceAddedAt": {
+ "name": "sourceAddedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "archived": {
+ "name": "archived",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "processingStartedAt": {
+ "name": "processingStartedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "result": {
+ "name": "result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "resultReason": {
+ "name": "resultReason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "resultBookmarkId": {
+ "name": "resultBookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "completedAt": {
+ "name": "completedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "importStaging_session_status_idx": {
+ "name": "importStaging_session_status_idx",
+ "columns": [
+ "importSessionId",
+ "status"
+ ],
+ "isUnique": false
+ },
+ "importStaging_completedAt_idx": {
+ "name": "importStaging_completedAt_idx",
+ "columns": [
+ "completedAt"
+ ],
+ "isUnique": false
+ },
+ "importStaging_status_idx": {
+ "name": "importStaging_status_idx",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ },
+ "importStaging_status_processingStartedAt_idx": {
+ "name": "importStaging_status_processingStartedAt_idx",
+ "columns": [
+ "status",
+ "processingStartedAt"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "importStagingBookmarks_importSessionId_importSessions_id_fk": {
+ "name": "importStagingBookmarks_importSessionId_importSessions_id_fk",
+ "tableFrom": "importStagingBookmarks",
+ "tableTo": "importSessions",
+ "columnsFrom": [
+ "importSessionId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "importStagingBookmarks_resultBookmarkId_bookmarks_id_fk": {
+ "name": "importStagingBookmarks_resultBookmarkId_bookmarks_id_fk",
+ "tableFrom": "importStagingBookmarks",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "resultBookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "invites": {
+ "name": "invites",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "usedAt": {
+ "name": "usedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "invitedBy": {
+ "name": "invitedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "invites_token_unique": {
+ "name": "invites_token_unique",
+ "columns": [
+ "token"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "invites_invitedBy_user_id_fk": {
+ "name": "invites_invitedBy_user_id_fk",
+ "tableFrom": "invites",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invitedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "listCollaborators": {
+ "name": "listCollaborators",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "listId": {
+ "name": "listId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedBy": {
+ "name": "addedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "listCollaborators_listId_idx": {
+ "name": "listCollaborators_listId_idx",
+ "columns": [
+ "listId"
+ ],
+ "isUnique": false
+ },
+ "listCollaborators_userId_idx": {
+ "name": "listCollaborators_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "listCollaborators_listId_userId_unique": {
+ "name": "listCollaborators_listId_userId_unique",
+ "columns": [
+ "listId",
+ "userId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "listCollaborators_listId_bookmarkLists_id_fk": {
+ "name": "listCollaborators_listId_bookmarkLists_id_fk",
+ "tableFrom": "listCollaborators",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "listId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "listCollaborators_userId_user_id_fk": {
+ "name": "listCollaborators_userId_user_id_fk",
+ "tableFrom": "listCollaborators",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "listCollaborators_addedBy_user_id_fk": {
+ "name": "listCollaborators_addedBy_user_id_fk",
+ "tableFrom": "listCollaborators",
+ "tableTo": "user",
+ "columnsFrom": [
+ "addedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "listInvitations": {
+ "name": "listInvitations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "listId": {
+ "name": "listId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "invitedAt": {
+ "name": "invitedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "invitedEmail": {
+ "name": "invitedEmail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "invitedBy": {
+ "name": "invitedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "listInvitations_listId_idx": {
+ "name": "listInvitations_listId_idx",
+ "columns": [
+ "listId"
+ ],
+ "isUnique": false
+ },
+ "listInvitations_userId_idx": {
+ "name": "listInvitations_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "listInvitations_status_idx": {
+ "name": "listInvitations_status_idx",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ },
+ "listInvitations_listId_userId_unique": {
+ "name": "listInvitations_listId_userId_unique",
+ "columns": [
+ "listId",
+ "userId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "listInvitations_listId_bookmarkLists_id_fk": {
+ "name": "listInvitations_listId_bookmarkLists_id_fk",
+ "tableFrom": "listInvitations",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "listId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "listInvitations_userId_user_id_fk": {
+ "name": "listInvitations_userId_user_id_fk",
+ "tableFrom": "listInvitations",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "listInvitations_invitedBy_user_id_fk": {
+ "name": "listInvitations_invitedBy_user_id_fk",
+ "tableFrom": "listInvitations",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invitedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "passwordResetToken": {
+ "name": "passwordResetToken",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "passwordResetToken_token_unique": {
+ "name": "passwordResetToken_token_unique",
+ "columns": [
+ "token"
+ ],
+ "isUnique": true
+ },
+ "passwordResetTokens_userId_idx": {
+ "name": "passwordResetTokens_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "passwordResetToken_userId_user_id_fk": {
+ "name": "passwordResetToken_userId_user_id_fk",
+ "tableFrom": "passwordResetToken",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rssFeedImports": {
+ "name": "rssFeedImports",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "entryId": {
+ "name": "entryId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rssFeedId": {
+ "name": "rssFeedId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "rssFeedImports_feedIdIdx_idx": {
+ "name": "rssFeedImports_feedIdIdx_idx",
+ "columns": [
+ "rssFeedId"
+ ],
+ "isUnique": false
+ },
+ "rssFeedImports_entryIdIdx_idx": {
+ "name": "rssFeedImports_entryIdIdx_idx",
+ "columns": [
+ "entryId"
+ ],
+ "isUnique": false
+ },
+ "rssFeedImports_rssFeedId_bookmarkId_idx": {
+ "name": "rssFeedImports_rssFeedId_bookmarkId_idx",
+ "columns": [
+ "rssFeedId",
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "rssFeedImports_rssFeedId_entryId_unique": {
+ "name": "rssFeedImports_rssFeedId_entryId_unique",
+ "columns": [
+ "rssFeedId",
+ "entryId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "rssFeedImports_rssFeedId_rssFeeds_id_fk": {
+ "name": "rssFeedImports_rssFeedId_rssFeeds_id_fk",
+ "tableFrom": "rssFeedImports",
+ "tableTo": "rssFeeds",
+ "columnsFrom": [
+ "rssFeedId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "rssFeedImports_bookmarkId_bookmarks_id_fk": {
+ "name": "rssFeedImports_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "rssFeedImports",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rssFeeds": {
+ "name": "rssFeeds",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "importTags": {
+ "name": "importTags",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lastFetchedAt": {
+ "name": "lastFetchedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastSuccessfulFetchAt": {
+ "name": "lastSuccessfulFetchAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastFetchedStatus": {
+ "name": "lastFetchedStatus",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "rssFeeds_userId_idx": {
+ "name": "rssFeeds_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "rssFeeds_userId_user_id_fk": {
+ "name": "rssFeeds_userId_user_id_fk",
+ "tableFrom": "rssFeeds",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ruleEngineActions": {
+ "name": "ruleEngineActions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ruleId": {
+ "name": "ruleId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "listId": {
+ "name": "listId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tagId": {
+ "name": "tagId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ruleEngineActions_userId_idx": {
+ "name": "ruleEngineActions_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "ruleEngineActions_ruleId_idx": {
+ "name": "ruleEngineActions_ruleId_idx",
+ "columns": [
+ "ruleId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "ruleEngineActions_userId_user_id_fk": {
+ "name": "ruleEngineActions_userId_user_id_fk",
+ "tableFrom": "ruleEngineActions",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ruleEngineActions_ruleId_ruleEngineRules_id_fk": {
+ "name": "ruleEngineActions_ruleId_ruleEngineRules_id_fk",
+ "tableFrom": "ruleEngineActions",
+ "tableTo": "ruleEngineRules",
+ "columnsFrom": [
+ "ruleId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ruleEngineActions_userId_tagId_fk": {
+ "name": "ruleEngineActions_userId_tagId_fk",
+ "tableFrom": "ruleEngineActions",
+ "tableTo": "bookmarkTags",
+ "columnsFrom": [
+ "userId",
+ "tagId"
+ ],
+ "columnsTo": [
+ "userId",
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ruleEngineActions_userId_listId_fk": {
+ "name": "ruleEngineActions_userId_listId_fk",
+ "tableFrom": "ruleEngineActions",
+ "tableTo": "bookmarkLists",
+ "columnsFrom": [
+ "userId",
+ "listId"
+ ],
+ "columnsTo": [
+ "userId",
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ruleEngineRules": {
+ "name": "ruleEngineRules",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "condition": {
+ "name": "condition",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tagId": {
+ "name": "tagId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ruleEngine_userId_idx": {
+ "name": "ruleEngine_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "ruleEngineRules_userId_user_id_fk": {
+ "name": "ruleEngineRules_userId_user_id_fk",
+ "tableFrom": "ruleEngineRules",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ruleEngineRules_userId_tagId_fk": {
+ "name": "ruleEngineRules_userId_tagId_fk",
+ "tableFrom": "ruleEngineRules",
+ "tableTo": "bookmarkTags",
+ "columnsFrom": [
+ "userId",
+ "tagId"
+ ],
+ "columnsTo": [
+ "userId",
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subscriptions": {
+ "name": "subscriptions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "stripeSubscriptionId": {
+ "name": "stripeSubscriptionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tier": {
+ "name": "tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'free'"
+ },
+ "priceId": {
+ "name": "priceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cancelAtPeriodEnd": {
+ "name": "cancelAtPeriodEnd",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "startDate": {
+ "name": "startDate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "endDate": {
+ "name": "endDate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subscriptions_userId_unique": {
+ "name": "subscriptions_userId_unique",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": true
+ },
+ "subscriptions_userId_idx": {
+ "name": "subscriptions_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "subscriptions_stripeCustomerId_idx": {
+ "name": "subscriptions_stripeCustomerId_idx",
+ "columns": [
+ "stripeCustomerId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subscriptions_userId_user_id_fk": {
+ "name": "subscriptions_userId_user_id_fk",
+ "tableFrom": "subscriptions",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "tagsOnBookmarks": {
+ "name": "tagsOnBookmarks",
+ "columns": {
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tagId": {
+ "name": "tagId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attachedAt": {
+ "name": "attachedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attachedBy": {
+ "name": "attachedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "tagsOnBookmarks_tagId_idx": {
+ "name": "tagsOnBookmarks_tagId_idx",
+ "columns": [
+ "tagId"
+ ],
+ "isUnique": false
+ },
+ "tagsOnBookmarks_bookmarkId_idx": {
+ "name": "tagsOnBookmarks_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "tagsOnBookmarks_tagId_bookmarkId_idx": {
+ "name": "tagsOnBookmarks_tagId_bookmarkId_idx",
+ "columns": [
+ "tagId",
+ "bookmarkId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "tagsOnBookmarks_bookmarkId_bookmarks_id_fk": {
+ "name": "tagsOnBookmarks_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "tagsOnBookmarks",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "tagsOnBookmarks_tagId_bookmarkTags_id_fk": {
+ "name": "tagsOnBookmarks_tagId_bookmarkTags_id_fk",
+ "tableFrom": "tagsOnBookmarks",
+ "tableTo": "bookmarkTags",
+ "columnsFrom": [
+ "tagId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "tagsOnBookmarks_bookmarkId_tagId_pk": {
+ "columns": [
+ "bookmarkId",
+ "tagId"
+ ],
+ "name": "tagsOnBookmarks_bookmarkId_tagId_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "userReadingProgress": {
+ "name": "userReadingProgress",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bookmarkId": {
+ "name": "bookmarkId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "readingProgressOffset": {
+ "name": "readingProgressOffset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "readingProgressAnchor": {
+ "name": "readingProgressAnchor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readingProgressPercent": {
+ "name": "readingProgressPercent",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "userReadingProgress_bookmarkId_idx": {
+ "name": "userReadingProgress_bookmarkId_idx",
+ "columns": [
+ "bookmarkId"
+ ],
+ "isUnique": false
+ },
+ "userReadingProgress_userId_idx": {
+ "name": "userReadingProgress_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "userReadingProgress_bookmarkId_userId_unique": {
+ "name": "userReadingProgress_bookmarkId_userId_unique",
+ "columns": [
+ "bookmarkId",
+ "userId"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "userReadingProgress_bookmarkId_bookmarks_id_fk": {
+ "name": "userReadingProgress_bookmarkId_bookmarks_id_fk",
+ "tableFrom": "userReadingProgress",
+ "tableTo": "bookmarks",
+ "columnsFrom": [
+ "bookmarkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "userReadingProgress_userId_user_id_fk": {
+ "name": "userReadingProgress_userId_user_id_fk",
+ "tableFrom": "userReadingProgress",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'user'"
+ },
+ "bookmarkQuota": {
+ "name": "bookmarkQuota",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "storageQuota": {
+ "name": "storageQuota",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "browserCrawlingEnabled": {
+ "name": "browserCrawlingEnabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bookmarkClickAction": {
+ "name": "bookmarkClickAction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'open_original_link'"
+ },
+ "archiveDisplayBehaviour": {
+ "name": "archiveDisplayBehaviour",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'show'"
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'UTC'"
+ },
+ "backupsEnabled": {
+ "name": "backupsEnabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "backupsFrequency": {
+ "name": "backupsFrequency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'weekly'"
+ },
+ "backupsRetentionDays": {
+ "name": "backupsRetentionDays",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 30
+ },
+ "readerFontSize": {
+ "name": "readerFontSize",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readerLineHeight": {
+ "name": "readerLineHeight",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readerFontFamily": {
+ "name": "readerFontFamily",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "autoTaggingEnabled": {
+ "name": "autoTaggingEnabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "autoSummarizationEnabled": {
+ "name": "autoSummarizationEnabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tagStyle": {
+ "name": "tagStyle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'titlecase-spaces'"
+ },
+ "curatedTagIds": {
+ "name": "curatedTagIds",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inferredTagLang": {
+ "name": "inferredTagLang",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "verificationToken": {
+ "name": "verificationToken",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verificationToken_identifier_token_pk": {
+ "columns": [
+ "identifier",
+ "token"
+ ],
+ "name": "verificationToken_identifier_token_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "webhooks": {
+ "name": "webhooks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "events": {
+ "name": "events",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "webhooks_userId_idx": {
+ "name": "webhooks_userId_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "webhooks_userId_user_id_fk": {
+ "name": "webhooks_userId_user_id_fk",
+ "tableFrom": "webhooks",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 840c0997..887e56c2 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -589,6 +589,13 @@
"when": 1776948580025,
"tag": "0083_add_api_key_scopes",
"breakpoints": true
+ },
+ {
+ "idx": 84,
+ "version": "6",
+ "when": 1777464072035,
+ "tag": "0084_rule_engine_multi_list_support",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index 41205f85..68a6b9c8 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -739,8 +739,6 @@ export const ruleEngineRulesTable = sqliteTable(
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
-
- listId: text("listId"),
tagId: text("tagId"),
},
(rl) => [
@@ -752,11 +750,6 @@ export const ruleEngineRulesTable = sqliteTable(
foreignColumns: [bookmarkTags.userId, bookmarkTags.id],
name: "ruleEngineRules_userId_tagId_fk",
}).onDelete("cascade"),
- foreignKey({
- columns: [rl.userId, rl.listId],
- foreignColumns: [bookmarkLists.userId, bookmarkLists.id],
- name: "ruleEngineRules_userId_listId_fk",
- }).onDelete("cascade"),
],
);
diff --git a/packages/shared/types/rules.ts b/packages/shared/types/rules.ts
index 40a43fc3..b38a49da 100644
--- a/packages/shared/types/rules.ts
+++ b/packages/shared/types/rules.ts
@@ -35,6 +35,16 @@ const zArchivedEvent = z.object({
type: z.literal("archived"),
});
+const zAddedToListRuleEvent = z.object({
+ type: z.literal("addedToList"),
+ listIds: z.array(z.string()),
+});
+
+const zRemovedFromListRuleEvent = z.object({
+ type: z.literal("removedFromList"),
+ listIds: z.array(z.string()),
+});
+
export const zRuleEngineEventSchema = z.discriminatedUnion("type", [
zBookmarkAddedEvent,
zTagAddedEvent,
@@ -46,6 +56,17 @@ export const zRuleEngineEventSchema = z.discriminatedUnion("type", [
]);
export type RuleEngineEvent = z.infer<typeof zRuleEngineEventSchema>;
+export const zRuleEngineRuleEventSchema = z.discriminatedUnion("type", [
+ zBookmarkAddedEvent,
+ zTagAddedEvent,
+ zTagRemovedEvent,
+ zAddedToListRuleEvent,
+ zRemovedFromListRuleEvent,
+ zFavouritedEvent,
+ zArchivedEvent,
+]);
+export type RuleEngineRuleEvent = z.infer<typeof zRuleEngineRuleEventSchema>;
+
// Conditions
const zAlwaysTrueCondition = z.object({
type: z.literal("alwaysTrue"),
@@ -193,7 +214,7 @@ export const zRuleEngineRuleSchema = z.object({
name: z.string().min(1),
description: z.string().nullable(),
enabled: z.boolean(),
- event: zRuleEngineEventSchema,
+ event: zRuleEngineRuleEventSchema,
condition: zRuleEngineConditionSchema,
actions: z.array(zRuleEngineActionSchema),
});
@@ -203,7 +224,7 @@ const ruleValidaitorFn = (
r: Omit<RuleEngineRule, "id">,
ctx: RefinementCtx,
) => {
- const validateEvent = (event: RuleEngineEvent) => {
+ const validateEvent = (event: RuleEngineRuleEvent) => {
switch (event.type) {
case "bookmarkAdded":
case "favourited":
@@ -222,11 +243,11 @@ const ruleValidaitorFn = (
return true;
case "addedToList":
case "removedFromList":
- if (event.listId.length == 0) {
+ if (event.listIds.length == 0) {
ctx.addIssue({
code: "custom",
- message: "You must specify a list for this event type",
- path: ["event", "listId"],
+ message: "You must specify at least one list for this event type",
+ path: ["event", "listIds"],
});
return false;
}
diff --git a/packages/shared/utils/listUtils.ts b/packages/shared/utils/listUtils.ts
index d6fe7688..08938771 100644
--- a/packages/shared/utils/listUtils.ts
+++ b/packages/shared/utils/listUtils.ts
@@ -58,3 +58,6 @@ export function listsToTree(lists: ZBookmarkList[]) {
allPaths.find((path) => path[path.length - 1].id === id),
};
}
+
+export const listNameFromPath = (path: ZBookmarkList[]) =>
+ path.map((p) => `${p.icon} ${p.name}`).join(" / ");
diff --git a/packages/trpc/lib/ruleEngine.ts b/packages/trpc/lib/ruleEngine.ts
index d09971f1..ae8499f4 100644
--- a/packages/trpc/lib/ruleEngine.ts
+++ b/packages/trpc/lib/ruleEngine.ts
@@ -20,7 +20,7 @@ import {
RuleEngineCondition,
RuleEngineEvent,
RuleEngineRule,
- zRuleEngineEventSchema,
+ zRuleEngineRuleEventSchema,
} from "@karakeep/shared/types/rules";
import { AuthedContext } from "..";
@@ -84,6 +84,20 @@ export class RuleEngine {
);
}
+ static doesEventMatchRule(
+ ruleEvent: RuleEngineRule["event"],
+ event: RuleEngineEvent,
+ ) {
+ if (
+ ruleEvent.type === event.type &&
+ "listIds" in ruleEvent &&
+ (event.type === "addedToList" || event.type === "removedFromList")
+ ) {
+ return ruleEvent.listIds.includes(event.listId);
+ }
+ return deepEql(ruleEvent, event, { strict: true });
+ }
+
/**
* Checks whether any enabled rule for the given user matches any of the events.
* Only fetches the minimal data needed (rule events, no actions or bookmark data).
@@ -106,7 +120,6 @@ export class RuleEngine {
event: true,
},
});
-
return enabledRules.some((rule) => {
let parsedEvent: unknown;
try {
@@ -114,12 +127,12 @@ export class RuleEngine {
} catch {
return false;
}
- const ruleEvent = zRuleEngineEventSchema.safeParse(parsedEvent);
+ const ruleEvent = zRuleEngineRuleEventSchema.safeParse(parsedEvent);
if (!ruleEvent.success) {
return false;
}
return events.some((event) =>
- deepEql(ruleEvent.data, event, { strict: true }),
+ this.doesEventMatchRule(ruleEvent.data, event),
);
});
}
@@ -226,7 +239,7 @@ export class RuleEngine {
if (!rule.enabled) {
return [];
}
- if (!deepEql(rule.event, event, { strict: true })) {
+ if (!RuleEngine.doesEventMatchRule(rule.event, event)) {
return [];
}
if (!this.doesBookmarkMatchConditions(rule.condition)) {
@@ -330,7 +343,6 @@ export class RuleEngine {
const results = await Promise.all(
this.rules.map((rule) => this.evaluateRule(rule, event)),
);
-
return results.flat();
}
}
diff --git a/packages/trpc/models/lists.ts b/packages/trpc/models/lists.ts
index 7a8e9a81..baf13e1c 100644
--- a/packages/trpc/models/lists.ts
+++ b/packages/trpc/models/lists.ts
@@ -1,15 +1,16 @@
import crypto from "node:crypto";
import { TRPCError } from "@trpc/server";
-import { and, count, eq, inArray, or } from "drizzle-orm";
+import { and, count, eq, inArray, or, sql } from "drizzle-orm";
import invariant from "tiny-invariant";
import { z } from "zod";
-import { SqliteError } from "@karakeep/db";
+import { KarakeepDBTransaction, SqliteError } from "@karakeep/db";
import {
bookmarkLists,
bookmarks,
bookmarksInLists,
listCollaborators,
+ ruleEngineRulesTable,
users,
} from "@karakeep/db/schema";
import { parseSearchQuery } from "@karakeep/shared/searchQueryParser";
@@ -28,6 +29,7 @@ import { RuleEngine } from "../lib/ruleEngine";
import { getBookmarkIdsFromMatcher } from "../lib/search";
import { Bookmark } from "./bookmarks";
import { ListInvitation } from "./listInvitations";
+import { zRuleEngineRuleEventSchema } from "@karakeep/shared/types/rules";
interface ListCollaboratorEntry {
membershipId: string;
@@ -462,19 +464,102 @@ export abstract class List {
}
}
- async delete() {
- this.ensureCanManage();
- const res = await this.ctx.db
- .delete(bookmarkLists)
+ protected async cleanupRulesAfterListDeletion(tx: KarakeepDBTransaction) {
+ const rules = await tx
+ .select({
+ id: ruleEngineRulesTable.id,
+ event: ruleEngineRulesTable.event,
+ })
+ .from(ruleEngineRulesTable)
.where(
and(
- eq(bookmarkLists.id, this.list.id),
- eq(bookmarkLists.userId, this.ctx.user.id),
+ eq(ruleEngineRulesTable.userId, this.ctx.user.id),
+ sql`json_valid(${ruleEngineRulesTable.event})`,
+ sql`json_extract(${ruleEngineRulesTable.event}, '$.type') IN ('addedToList', 'removedFromList')`,
+ sql`EXISTS (
+ SELECT 1
+ FROM json_each(json_extract(${ruleEngineRulesTable.event}, '$.listIds'))
+ WHERE value = ${this.list.id}
+ )`,
),
);
- if (res.changes == 0) {
- throw new TRPCError({ code: "NOT_FOUND" });
+ const rulesToDelete: string[] = [];
+ const rulesToUpdate: { id: string; event: string }[] = [];
+
+ for (const rule of rules) {
+ let parsedEvent: unknown;
+ try {
+ parsedEvent = JSON.parse(rule.event);
+ } catch {
+ // Log and skip corrupted rule, continue with others
+ console.error(`Failed to parse event JSON for rule ${rule.id}`);
+ continue;
+ }
+
+ const ruleEvent = zRuleEngineRuleEventSchema.safeParse(parsedEvent);
+ if (!ruleEvent.success) {
+ // Log and skip invalid rule, continue with others
+ console.error(`Failed to validate event schema for rule ${rule.id}`);
+ continue;
+ }
+ const ruleEventData = ruleEvent.data;
+ if (
+ ruleEventData.type === "addedToList" ||
+ ruleEventData.type === "removedFromList"
+ ) {
+ const filtered = ruleEventData.listIds.filter(
+ (id: string) => id !== this.list.id,
+ );
+ if (filtered.length === 0) {
+ rulesToDelete.push(rule.id);
+ } else {
+ const updatedEvent = {
+ ...ruleEventData,
+ listIds: filtered,
+ };
+
+ rulesToUpdate.push({
+ id: rule.id,
+ event: JSON.stringify(updatedEvent),
+ });
+ }
+ }
}
+
+ if (rulesToDelete.length > 0) {
+ await tx
+ .delete(ruleEngineRulesTable)
+ .where(inArray(ruleEngineRulesTable.id, rulesToDelete));
+ }
+
+ if (rulesToUpdate.length > 0) {
+ await Promise.all(
+ rulesToUpdate.map(({ id, event }) =>
+ tx
+ .update(ruleEngineRulesTable)
+ .set({ event })
+ .where(eq(ruleEngineRulesTable.id, id)),
+ ),
+ );
+ }
+ }
+
+ async delete() {
+ this.ensureCanManage();
+ await this.ctx.db.transaction(async (tx) => {
+ const res = await tx
+ .delete(bookmarkLists)
+ .where(
+ and(
+ eq(bookmarkLists.id, this.list.id),
+ eq(bookmarkLists.userId, this.ctx.user.id),
+ ),
+ );
+ if (res.changes == 0) {
+ throw new TRPCError({ code: "NOT_FOUND" });
+ }
+ await this.cleanupRulesAfterListDeletion(tx);
+ });
}
async getChildren(): Promise<(ManualList | SmartList)[]> {
@@ -1051,6 +1136,7 @@ export class ManualList extends List {
await tx
.delete(bookmarkLists)
.where(eq(bookmarkLists.id, this.list.id));
+ await this.cleanupRulesAfterListDeletion(tx);
}
});
}
diff --git a/packages/trpc/models/rules.ts b/packages/trpc/models/rules.ts
index 7d943465..eef2fab9 100644
--- a/packages/trpc/models/rules.ts
+++ b/packages/trpc/models/rules.ts
@@ -12,7 +12,7 @@ import {
zNewRuleEngineRuleSchema,
zRuleEngineActionSchema,
zRuleEngineConditionSchema,
- zRuleEngineEventSchema,
+ zRuleEngineRuleEventSchema,
zUpdateRuleEngineRuleSchema,
} from "@karakeep/shared/types/rules";
@@ -48,7 +48,7 @@ export class RuleEngineRuleModel {
name: ruleData.name,
description: ruleData.description,
enabled: ruleData.enabled,
- event: zRuleEngineEventSchema.parse(JSON.parse(ruleData.event)),
+ event: zRuleEngineRuleEventSchema.parse(JSON.parse(ruleData.event)),
condition: zRuleEngineConditionSchema.parse(
JSON.parse(ruleData.condition),
),
@@ -97,11 +97,6 @@ export class RuleEngineRuleModel {
event: JSON.stringify(input.event),
condition: JSON.stringify(input.condition),
userId: ctx.user.id,
- listId:
- input.event.type === "addedToList" ||
- input.event.type === "removedFromList"
- ? input.event.listId
- : null,
tagId:
input.event.type === "tagAdded" || input.event.type === "tagRemoved"
? input.event.tagId
@@ -149,11 +144,6 @@ export class RuleEngineRuleModel {
enabled: input.enabled,
event: JSON.stringify(input.event),
condition: JSON.stringify(input.condition),
- listId:
- input.event.type === "addedToList" ||
- input.event.type === "removedFromList"
- ? input.event.listId
- : null,
tagId:
input.event.type === "tagAdded" || input.event.type === "tagRemoved"
? input.event.tagId
diff --git a/packages/trpc/routers/lists.test.ts b/packages/trpc/routers/lists.test.ts
index 214df32a..73fb4f4c 100644
--- a/packages/trpc/routers/lists.test.ts
+++ b/packages/trpc/routers/lists.test.ts
@@ -19,6 +19,11 @@ async function createTestBookmark(api: APICallerType) {
return createdBookmark.id;
}
+async function getRuleByName(api: APICallerType, name: string) {
+ const { rules } = await api.rules.list();
+ return rules.find((rule) => rule.name === name);
+}
+
beforeEach<CustomTestContext>(defaultBeforeEach(true));
describe("Lists Routes", () => {
@@ -157,6 +162,144 @@ describe("Lists Routes", () => {
).rejects.toThrow(/List not found/);
});
+ describe("rule cleanup after list deletion", () => {
+ test<CustomTestContext>("deletes rules that has only the deleted list in their event", async ({
+ apiCallers,
+ }) => {
+ const api = apiCallers[0];
+ const list = await api.lists.create({
+ name: "Deleted List",
+ type: "manual",
+ icon: "πŸ“š",
+ });
+
+ await api.rules.create({
+ name: "Only Deleted List Rule",
+ description: "",
+ enabled: true,
+ event: { type: "addedToList", listIds: [list.id] },
+ condition: { type: "alwaysTrue" },
+ actions: [{ type: "favouriteBookmark" }],
+ });
+
+ await api.lists.delete({ listId: list.id });
+
+ expect(
+ await getRuleByName(api, "Only Deleted List Rule"),
+ ).toBeUndefined();
+ });
+
+ test<CustomTestContext>("removes deleted list from multi-list rules", async ({
+ apiCallers,
+ }) => {
+ const api = apiCallers[0];
+ const deletedList = await api.lists.create({
+ name: "Deleted List",
+ type: "manual",
+ icon: "πŸ“š",
+ });
+ const otherList = await api.lists.create({
+ name: "Surviving List",
+ type: "manual",
+ icon: "πŸ“–",
+ });
+
+ await api.rules.create({
+ name: "Multi List Rule",
+ description: "",
+ enabled: true,
+ event: {
+ type: "addedToList",
+ listIds: [deletedList.id, otherList.id],
+ },
+ condition: { type: "alwaysTrue" },
+ actions: [{ type: "favouriteBookmark" }],
+ });
+
+ await api.lists.delete({ listId: deletedList.id });
+
+ expect(await getRuleByName(api, "Multi List Rule")).toMatchObject({
+ event: { type: "addedToList", listIds: [otherList.id] },
+ });
+ });
+
+ test<CustomTestContext>("leaves unrelated rules unchanged", async ({
+ apiCallers,
+ }) => {
+ const api = apiCallers[0];
+ const deletedList = await api.lists.create({
+ name: "Deleted List",
+ type: "manual",
+ icon: "πŸ“š",
+ });
+ const unrelatedList = await api.lists.create({
+ name: "Unrelated List",
+ type: "manual",
+ icon: "πŸ“–",
+ });
+
+ await api.rules.create({
+ name: "Unrelated List Rule",
+ description: "",
+ enabled: true,
+ event: { type: "addedToList", listIds: [unrelatedList.id] },
+ condition: { type: "alwaysTrue" },
+ actions: [{ type: "favouriteBookmark" }],
+ });
+ await api.rules.create({
+ name: "Bookmark Rule",
+ description: "",
+ enabled: true,
+ event: { type: "bookmarkAdded" },
+ condition: { type: "alwaysTrue" },
+ actions: [{ type: "favouriteBookmark" }],
+ });
+
+ await api.lists.delete({ listId: deletedList.id });
+
+ expect(await getRuleByName(api, "Unrelated List Rule")).toMatchObject({
+ event: { type: "addedToList", listIds: [unrelatedList.id] },
+ });
+ expect(await getRuleByName(api, "Bookmark Rule")).toMatchObject({
+ event: { type: "bookmarkAdded" },
+ });
+ });
+
+ test<CustomTestContext>("cleans up removed-from-list rules", async ({
+ apiCallers,
+ }) => {
+ const api = apiCallers[0];
+ const deletedList = await api.lists.create({
+ name: "Deleted List",
+ type: "manual",
+ icon: "πŸ“š",
+ });
+ const survivingList = await api.lists.create({
+ name: "Surviving List",
+ type: "manual",
+ icon: "πŸ“–",
+ });
+
+ await api.rules.create({
+ name: "Removed From List Rule",
+ description: "",
+ enabled: true,
+ event: {
+ type: "removedFromList",
+ listIds: [deletedList.id, survivingList.id],
+ },
+ condition: { type: "alwaysTrue" },
+ actions: [{ type: "favouriteBookmark" }],
+ });
+
+ await api.lists.delete({ listId: deletedList.id });
+
+ expect(await getRuleByName(api, "Removed From List Rule")).toMatchObject({
+ event: { type: "removedFromList", listIds: [survivingList.id] },
+ });
+ });
+ });
+
test<CustomTestContext>("add and remove from list", async ({
apiCallers,
}) => {
diff --git a/packages/trpc/routers/rules.test.ts b/packages/trpc/routers/rules.test.ts
index 6bbbcd84..2de11aeb 100644
--- a/packages/trpc/routers/rules.test.ts
+++ b/packages/trpc/routers/rules.test.ts
@@ -347,7 +347,7 @@ describe("Rules Routes", () => {
name: "Invalid Rule",
description: "Event with other user's list",
enabled: true,
- event: { type: "addedToList", listId: otherUserListId }, // Other user's list
+ event: { type: "addedToList", listIds: [otherUserListId] }, // Other user's list
condition: { type: "alwaysTrue" },
actions: [{ type: "addTag", tagId: tagId1 }],
};
@@ -355,6 +355,13 @@ describe("Rules Routes", () => {
await expect(() => api.create(invalidRuleInput)).rejects.toThrow(
/List not found/,
);
+
+ await expect(() =>
+ api.create({
+ ...invalidRuleInput,
+ event: { type: "addedToList", listIds: [listId, otherUserListId] },
+ }),
+ ).rejects.toThrow(/List not found/);
});
test<CustomTestContext>("cannot create rule with action on another user's list", async ({
diff --git a/packages/trpc/routers/rules.ts b/packages/trpc/routers/rules.ts
index 282b64f7..6b2b368b 100644
--- a/packages/trpc/routers/rules.ts
+++ b/packages/trpc/routers/rules.ts
@@ -70,7 +70,7 @@ const ensureTagListOwnership = experimental_trpcMiddleware<{
const listIds = [
...(opts.input.event.type === "addedToList" ||
opts.input.event.type === "removedFromList"
- ? [opts.input.event.listId]
+ ? opts.input.event.listIds
: []),
...opts.input.actions.flatMap((a) =>
a.type == "addToList" || a.type == "removeFromList" ? [a.listId] : [],