aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cli/src/commands/dump.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-09-28 11:03:48 +0100
committerGitHub <noreply@github.com>2025-09-28 11:03:48 +0100
commit62f7d900c52784ff05d933b52379e5455ea6bd00 (patch)
tree2702d74c96576447974af84850f3ba6b66beeeb4 /apps/cli/src/commands/dump.ts
parent9fe09bfa9021c8d85d2d9aef591936101cab19f6 (diff)
downloadkarakeep-62f7d900c52784ff05d933b52379e5455ea6bd00.tar.zst
feat: Add tag search and pagination (#1987)
* feat: Add tag search and use in the homepage * use paginated query in the all tags view * wire the load more buttons * add skeleton to all tags page * fix attachedby aggregation * fix loading states * fix hasNextPage * use action buttons for load more buttons * migrate the tags auto complete to the search api * Migrate the tags editor to the new search API * Replace tag merging dialog with tag auto completion * Merge both search and list APIs * fix tags.list * add some tests for the endpoint * add relevance based sorting * change cursor * update the REST API * fix review comments * more fixes * fix lockfile * i18n * fix visible tags
Diffstat (limited to 'apps/cli/src/commands/dump.ts')
-rw-r--r--apps/cli/src/commands/dump.ts17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/cli/src/commands/dump.ts b/apps/cli/src/commands/dump.ts
index 5f3f8f5e..6f473182 100644
--- a/apps/cli/src/commands/dump.ts
+++ b/apps/cli/src/commands/dump.ts
@@ -12,6 +12,7 @@ import type { ZBookmark } from "@karakeep/shared/types/bookmarks";
import type { ZBookmarkList } from "@karakeep/shared/types/lists";
import { MAX_NUM_BOOKMARKS_PER_PAGE } from "@karakeep/shared/types/bookmarks";
import { ZCursor } from "@karakeep/shared/types/pagination";
+import { MAX_NUM_TAGS_PER_PAGE } from "@karakeep/shared/types/tags";
const OK = chalk.green("✓");
const FAIL = chalk.red("✗");
@@ -191,9 +192,19 @@ export const dumpCmd = new Command()
// 3) Tags
if (!opts.excludeTags) {
stepStart("Exporting tags");
- const { tags } = await api.tags.list.query();
- await writeJson(path.join(workRoot, "tags", "index.json"), tags);
- manifest.counts.tags = tags.length;
+
+ let cursor = null;
+ let allTags = [];
+ do {
+ const { tags, nextCursor } = await api.tags.list.query({
+ limit: MAX_NUM_TAGS_PER_PAGE,
+ cursor,
+ });
+ allTags.push(...tags);
+ cursor = nextCursor;
+ } while (cursor);
+ await writeJson(path.join(workRoot, "tags", "index.json"), allTags);
+ manifest.counts.tags = allTags.length;
stepEndSuccess();
}