Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(import): basic Anytype JSON ("any-block") importer
Elian Doran8b80d019d5bf
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 366c86929f..c053030b87 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -264,6 +264,13 @@"choose_file": "Google Keep export (.zip)","import": "Import"},+ "anytype_import": {+ "name": "Anytype",+ "description": "Import pages from an Anytype JSON export (.zip).",+ "description_long": "In Anytype, export your space using the \"Any-Block\" format with \"JSON\" selected, then choose the resulting .zip file here. Only pages and their text are imported for now.",+ "choose_file": "Anytype export (.zip)",+ "import": "Import"+ },"evernote_import": {"name": "Evernote","description": "Import notes from an Evernote export (.enex).",diff --git a/apps/client/src/widgets/dialogs/import_providers/anytype.tsx b/apps/client/src/widgets/dialogs/import_providers/anytype.tsxnew file mode 100644index 0000000000..f26aa840ad--- /dev/null+++ b/apps/client/src/widgets/dialogs/import_providers/anytype.tsx@@ -0,0 +1,67 @@+import { useCallback, useEffect, useRef, useState } from "preact/hooks";++import { t } from "../../../services/i18n.js";+import importService from "../../../services/import.js";+import Button from "../../react/Button.js";+import FormFileUpload from "../../react/FormFileUpload.js";+import FormGroup from "../../react/FormGroup.js";+import iconUrl from "./icons/anytype.svg?url";+import type { ImportProvider, ImportProviderPanelProps } from "./types.js";++function AnytypePanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanelProps) {+ const [file, setFile] = useState<File | null>(null);++ const onChange = useCallback((files: FileList | null) => setFile(files?.[0] ?? null), []);++ const doImport = useCallback(async () => {+ if (!file) {+ return;+ }++ // Close immediately and let the shared import toasts (registered in import.ts) report progress,+ // completion and any error. `format: "anytype"` routes the upload to the Anytype importer on the+ // shared file-import endpoint, overriding the .zip extension's default (the generic zip importer).+ // uploadFiles surfaces any upload error via its own toast; swallow the rejection so this void-ed+ // call doesn't raise an unhandled rejection.+ closeDialog();+ await importService.uploadFiles("notes", parentNoteId, [file], { format: "anytype", safeImport: "true", shrinkImages: "false" }).catch(() => {});+ }, [file, parentNoteId, closeDialog]);++ // Keep the latest import handler in a ref so the footer effect depends only on `file` being present,+ // never on doImport's identity — otherwise re-pushing the footer on every change would loop with the+ // parent re-rendering us back (see the Notion/Keep panels for the same reasoning).+ const doImportRef = useRef(doImport);+ doImportRef.current = doImport;++ useEffect(() => {+ setFooter(+ <Button+ text={t("anytype_import.import")}+ kind="primary"+ disabled={!file}+ onClick={() => void doImportRef.current()}+ />+ );+ }, [file, setFooter]);++ useEffect(() => () => setFooter(null), [setFooter]);++ return (+ <div className="anytype-panel">+ <p>{t("anytype_import.description_long")}</p>+ <FormGroup name="anytype-file" label={t("anytype_import.choose_file")}>+ <FormFileUpload onChange={onChange} />+ </FormGroup>+ </div>+ );+}++const provider: ImportProvider = {+ id: "anytype",+ name: t("anytype_import.name"),+ iconUrl,+ description: t("anytype_import.description"),+ Panel: AnytypePanel+};++export default provider;diff --git a/apps/client/src/widgets/dialogs/import_providers/icons/anytype.svg b/apps/client/src/widgets/dialogs/import_providers/icons/anytype.svgnew file mode 100644index 0000000000..16f6376383--- /dev/null+++ b/apps/client/src/widgets/dialogs/import_providers/icons/anytype.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 2h14a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3Zm0 2a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5Z"/><circle cx="12" cy="12" r="3.4"/></svg>diff --git a/apps/client/src/widgets/dialogs/import_providers/index.ts b/apps/client/src/widgets/dialogs/import_providers/index.tsindex a471c540be..6ee50af95f 100644--- a/apps/client/src/widgets/dialogs/import_providers/index.ts+++ b/apps/client/src/widgets/dialogs/import_providers/index.ts@@ -1,3 +1,4 @@+import anytypeProvider from "./anytype.js";import evernoteProvider from "./evernote.js";import keepProvider from "./keep.js";import notionProvider from "./notion.js";@@ -8,6 +9,6 @@ import type { ImportProvider } from "./types.js";* Registry of available import providers. Append new providers here; the generic import dialog* renders the picker and each provider's panel automatically.*/-export const importProviders: ImportProvider[] = [oneNoteProvider, notionProvider, keepProvider, evernoteProvider];+export const importProviders: ImportProvider[] = [oneNoteProvider, notionProvider, keepProvider, evernoteProvider, anytypeProvider];export type { ImportProvider, ImportProviderPanelProps } from "./types.js";diff --git a/apps/server/src/assets/translations/en/server.json b/apps/server/src/assets/translations/en/server.jsonindex 55bf194439..1dd294a46a 100644--- a/apps/server/src/assets/translations/en/server.json+++ b/apps/server/src/assets/translations/en/server.json@@ -321,11 +321,15 @@},"notion_import": {"root-title": "Notion import",- "markdown-export-unsupported": "This looks like a Notion \"Markdown & CSV\" export, which Trilium cannot import. Please re-export your Notion workspace using the \"HTML\" export format and import that instead."+ "markdown-export-unsupported": "This looks like a Notion \"Markdown & CSV\" export, which Trilium cannot import. Please re-export your Notion workspace using the \"HTML\" export format and import that instead.",+ "subpage-folders-disabled": "This Notion export was created without the \"Create folders for subpages\" option, so the page hierarchy cannot be reconstructed. Please re-export from Notion with \"Create folders for subpages\" enabled and import that instead."},"keep_import": {"root-title": "Google Keep import"},+ "anytype_import": {+ "root-title": "Anytype import"+ },"pdf": {"export_filter": "PDF Document (*.pdf)","unable-to-export-message": "The current note could not be exported as a PDF.",diff --git a/packages/trilium-core/src/routes/api/import.ts b/packages/trilium-core/src/routes/api/import.tsindex 695b4eb42b..61f492c377 100644--- a/packages/trilium-core/src/routes/api/import.ts+++ b/packages/trilium-core/src/routes/api/import.ts@@ -9,6 +9,7 @@ import becca_loader from "../../becca/becca_loader.js";import type BNote from "../../becca/entities/bnote.js";import { ValidationError } from "../../errors.js";import * as cls from "../../services/context.js";+import anytypeImportService from "../../services/import/anytype/importer.js";import enexImportService from "../../services/import/enex.js";import keepImportService from "../../services/import/keep/importer.js";import notionImportService from "../../services/import/notion/importer.js";@@ -65,6 +66,10 @@ async function importNotesToBranch(req: ImportRequest<{ parentNoteId: string }>)// Like Notion, a Google Keep (Takeout) export is just a `.zip` indistinguishable from a Trilium// export by extension alone, so the Keep import dialog tags the upload to route it here.note = await keepImportService.importKeep(taskContext, file.buffer, parentNote);+ } else if (format === "anytype" && typeof file.buffer !== "string") {+ // An Anytype JSON export is likewise a plain `.zip`; the Anytype import dialog tags the upload so+ // it routes to the Anytype importer rather than the generic zip importer.+ note = await anytypeImportService.importAnytype(taskContext, file.buffer, parentNote);} else if (extension === ".zip" && options.explodeArchives && typeof file.buffer !== "string") {note = await zipImportService.importZip(taskContext, file.buffer, parentNote);} else if (extension === ".opml" && options.explodeArchives) {diff --git a/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts b/packages/trilium-core/src/services/import/anytype/importer.integration.spec.tsnew file mode 100644index 0000000000..59340758d8--- /dev/null+++ b/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts@@ -0,0 +1,104 @@+import { ZipArchive } from "archiver";+import { PassThrough } from "stream";+import { describe, expect, it } from "vitest";++import becca from "../../../becca/becca.js";+import type BNote from "../../../becca/entities/bnote.js";+import { getContext } from "../../context.js";+import TaskContext from "../../task_context.js";+import { decodeUtf8 } from "../../utils/binary.js";+import anytypeImporter from "./importer.js";++/** Builds an in-memory zip from a map of entry name -> contents. */+async function createZipBuffer(files: Record<string, string | Buffer>): Promise<Buffer> {+ const archive = new ZipArchive();+ const chunks: Buffer[] = [];+ const passthrough = new PassThrough();+ passthrough.on("data", (chunk: Buffer) => chunks.push(chunk));+ archive.pipe(passthrough);+ for (const [name, content] of Object.entries(files)) {+ archive.append(content, { name });+ }+ await archive.finalize();+ return Buffer.concat(chunks);+}++/** Runs the Anytype importer over `files` and returns the import root note. */+async function importAnytype(files: Record<string, string | Buffer>): Promise<BNote> {+ const buffer = await createZipBuffer(files);+ const taskContext = TaskContext.getInstance("anytype-integration", "importNotes", { safeImport: true });++ return new Promise<BNote>((resolve, reject) => {+ void getContext().init(async () => {+ try {+ const root = becca.getNoteOrThrow("root");+ resolve(await anytypeImporter.importAnytype(taskContext, new Uint8Array(buffer), root));+ } catch (e) {+ reject(e);+ }+ });+ });+}++/** Serializes a page object the way Anytype's JSON export does: a root block with header chrome plus one+ * text block per paragraph, and the title carried in `details.name`. */+function pageObject(id: string, name: string, paragraphs: string[], opts: { layout?: number; sbType?: string } = {}): string {+ const contentIds = paragraphs.map((_, i) => `${id}-b${i}`);+ return JSON.stringify({+ sbType: opts.sbType ?? "Page",+ snapshot: {+ data: {+ blocks: [+ { id, childrenIds: ["header", ...contentIds] },+ { id: "header", childrenIds: ["title"] },+ { id: "title", text: { text: "", style: "Title" } },+ ...paragraphs.map((text, i) => ({ id: contentIds[i], text: { text, style: "Paragraph" } }))+ ],+ details: { id, name, layout: opts.layout ?? 0 },+ objectTypes: ["ot-page"]+ }+ }+ });+}++describe("Anytype importer — integration", () => {+ it("imports each page as a flat child of an 'Anytype import' root, with its text content", async () => {+ const importRoot = await importAnytype({+ "objects/page1.pb.json": pageObject("page1", "First Page", ["Hello world", "Second paragraph"]),+ "objects/page2.pb.json": pageObject("page2", "Second Page", ["Just one line"])+ });++ expect(importRoot.title).toBe("Anytype import");++ const children = importRoot.getChildNotes();+ expect(children.map((note) => note.title).sort()).toEqual(["First Page", "Second Page"]);++ const first = children.find((note) => note.title === "First Page");+ expect(decodeUtf8(first?.getContent() ?? "")).toBe("<p>Hello world</p><p>Second paragraph</p>");+ });++ it("imports only pages, skipping sets, system objects and the relations/types folders", async () => {+ const importRoot = await importAnytype({+ "objects/page1.pb.json": pageObject("page1", "Real Page", ["content"]),+ // A set/collection: sbType Page but layout 3.+ "objects/set1.pb.json": pageObject("set1", "My Set", [], { layout: 3 }),+ // A non-page system object.+ "objects/participant.pb.json": pageObject("participant", "Someone", [], { sbType: "Participant", layout: 19 }),+ // Sibling folders the basic importer ignores.+ "relations/rel1.pb.json": JSON.stringify({ sbType: "STRelation", snapshot: { data: { details: { id: "rel1", name: "Author" } } } }),+ "types/type1.pb.json": JSON.stringify({ sbType: "STType", snapshot: { data: { details: { id: "type1", name: "Article" } } } }),+ "profile": "not json"+ });++ expect(importRoot.getChildNotes().map((note) => note.title)).toEqual(["Real Page"]);+ });++ it("produces an empty root when the export has no pages", async () => {+ const importRoot = await importAnytype({+ "types/type1.pb.json": JSON.stringify({ sbType: "STType", snapshot: { data: { details: { id: "type1", name: "Article" } } } })+ });++ expect(importRoot.title).toBe("Anytype import");+ expect(importRoot.getChildNotes()).toHaveLength(0);+ });+});diff --git a/packages/trilium-core/src/services/import/anytype/importer.spec.ts b/packages/trilium-core/src/services/import/anytype/importer.spec.tsnew file mode 100644index 0000000000..c2e2f15c65--- /dev/null+++ b/packages/trilium-core/src/services/import/anytype/importer.spec.ts@@ -0,0 +1,74 @@+import { describe, expect, it } from "vitest";++import { isPage, parseObject } from "./importer.js";+import type { AnytypeBlock, AnytypeSnapshot } from "./model.js";++/** Wraps blocks + details into the export's snapshot shape. */+function snapshot(blocks: AnytypeBlock[], details: { id?: string; name?: string; layout?: number }, sbType = "Page"): AnytypeSnapshot {+ return { sbType, snapshot: { data: { blocks, details } } };+}++/** A text block with the given style (defaults to Paragraph) and optional children. */+function textBlock(id: string, text: string, style = "Paragraph", childrenIds: string[] = []): AnytypeBlock {+ return { id, text: { text, style }, childrenIds };+}++/** A typical page: a root block pointing at the header chrome plus the given content block ids. */+function page(name: string, contentBlocks: AnytypeBlock[], layout = 0): AnytypeSnapshot {+ return snapshot(+ [+ { id: "obj", childrenIds: ["header", ...contentBlocks.map((b) => b.id)] },+ { id: "header", childrenIds: ["title"] },+ textBlock("title", "", "Title"),+ ...contentBlocks+ ],+ { id: "obj", name, layout }+ );+}++describe("isPage", () => {+ it("accepts a basic-layout Page and rejects sets and system objects", () => {+ expect(isPage(page("A page", []))).toBe(true);+ // A set/collection is also sbType Page but layout 3.+ expect(isPage(page("A set", [], 3))).toBe(false);+ // Non-page smartblocks (participant, workspace, …) are excluded regardless of layout.+ expect(isPage(snapshot([], { id: "p", name: "Someone", layout: 19 }, "Participant"))).toBe(false);+ expect(isPage(snapshot([], { id: "w", layout: 10 }, "Workspace"))).toBe(false);+ });+});++describe("parseObject", () => {+ it("takes the title from details.name and emits each text block as a paragraph, ignoring style", () => {+ const result = parseObject(page("My Page", [textBlock("b1", "First"), textBlock("b2", "Second", "Header1")]));+ expect(result.id).toBe("obj");+ expect(result.title).toBe("My Page");+ // Header1 still becomes a plain <p> — no formatting in this version.+ expect(result.content).toBe("<p>First</p><p>Second</p>");+ });++ it("walks nested blocks in document order (parent text before its children)", () => {+ const result = parseObject(page("Nested", [textBlock("b1", "Parent", "Paragraph", ["c1"]), textBlock("c1", "Child")]));+ expect(result.content).toBe("<p>Parent</p><p>Child</p>");+ });++ it("skips the header subtree and empty / non-text blocks", () => {+ const result = parseObject(+ page("Mixed", [+ textBlock("b1", " "), // whitespace only+ { id: "b2", childrenIds: [] }, // a non-text block (e.g. a link/divider) carries no text+ textBlock("b3", "Real content")+ ])+ );+ expect(result.content).toBe("<p>Real content</p>");+ });++ it("escapes HTML special characters in the text", () => {+ const result = parseObject(page("Escaping", [textBlock("b1", "a < b & c > d")]));+ expect(result.content).toBe("<p>a < b & c > d</p>");+ });++ it("falls back to 'Untitled' when the page has no name", () => {+ expect(parseObject(page("", [textBlock("b1", "body")])).title).toBe("Untitled");+ expect(parseObject(page(" ", [])).title).toBe("Untitled");+ });+});diff --git a/packages/trilium-core/src/services/import/anytype/importer.ts b/packages/trilium-core/src/services/import/anytype/importer.tsnew file mode 100644index 0000000000..3d42b4fe60--- /dev/null+++ b/packages/trilium-core/src/services/import/anytype/importer.ts@@ -0,0 +1,154 @@+/**+ * Imports an Anytype JSON ("any-block") export zip into a Trilium note tree.+ *+ * Anytype exports each object as a single `objects/<cid>.pb.json` file (the protobuf export uses `.pb`+ * instead — not handled here), alongside sibling `relations/`, `types/`, `templates/` and `relationsOptions/`+ * folders. This first version is deliberately minimal: it imports only *pages* (basic note-like objects) and+ * their plain text, dropping inline formatting, links, relations, types and collections. Every imported page+ * lands as a flat child of a fresh "Anytype import" root; hierarchy, formatting and structured data are left+ * for later iterations.+ *+ * Invoked from the shared file-import dispatcher (routes/api/import.ts) when the upload is tagged+ * `format=anytype`, so progress, completion and failure are reported by that dispatcher's TaskContext —+ * this service just builds the tree and returns its root note, like the zip/notion importers.+ */++import { t } from "i18next";++import type BNote from "../../../becca/entities/bnote.js";+import noteService from "../../notes.js";+import protectedSessionService from "../../protected_session.js";+import type TaskContext from "../../task_context.js";+import { getZipProvider } from "../../zip_provider.js";+import type { AnytypeBlock, AnytypeSnapshot, ParsedObject } from "./model.js";++async function importAnytype(taskContext: TaskContext<"importNotes">, fileBuffer: Uint8Array, importRootNote: BNote): Promise<BNote> {+ const snapshots = await parseZip(fileBuffer);+ const pages = snapshots.filter(isPage).map(parseObject);+ taskContext.setTotalCount(pages.length);++ return createNotes(importRootNote, pages, taskContext);+}++/**+ * Reads every `objects/*.pb.json` entry as a parsed Anytype snapshot. Sibling folders (relations, types, …)+ * and the protobuf `.pb` files are ignored for now. A malformed entry is skipped rather than failing the+ * whole import.+ */+async function parseZip(fileBuffer: Uint8Array): Promise<AnytypeSnapshot[]> {+ const provider = getZipProvider();+ const snapshots: AnytypeSnapshot[] = [];+ const filenameEncoding = await provider.detectFilenameEncoding(fileBuffer);++ await provider.readZipFile(fileBuffer, async (entry, readContent) => {+ if (!isObjectEntry(entry.fileName)) {+ return;+ }+ try {+ snapshots.push(JSON.parse(new TextDecoder().decode(await readContent())) as AnytypeSnapshot);+ } catch {+ // A non-JSON or truncated entry under objects/ isn't a page we can import — skip it.+ }+ }, filenameEncoding);++ return snapshots;+}++/** True for entries that are JSON object files under the export's `objects/` folder. */+function isObjectEntry(fileName: string): boolean {+ const normalized = fileName.replace(/\\/g, "/").toLowerCase();+ return normalized.startsWith("objects/") && normalized.endsWith(".pb.json");+}++/**+ * Whether a snapshot is a page we should import. A page is a `Page` smartblock with the basic layout (0);+ * this excludes sets/collections (layout 3) and system objects like the participant, workspace and+ * dashboard widget. Conservative on purpose — other content layouts can be admitted as the importer grows.+ */+export function isPage(snapshot: AnytypeSnapshot): boolean {+ return snapshot.sbType === "Page" && snapshot.snapshot?.data?.details?.layout === 0;+}++/** Reduces a page snapshot to the title and plain-text body needed to create a note. */+export function parseObject(snapshot: AnytypeSnapshot): ParsedObject {+ const data = snapshot.snapshot?.data;+ const details = data?.details ?? {};+ const id = details.id ?? "";+ const title = (details.name ?? "").trim() || "Untitled";+ const content = extractTextContent(data?.blocks ?? [], id);++ return { id, title, content };+}++/**+ * Walks the block tree from the root in document order, emitting each non-empty text block as a `<p>`. The+ * `header` subtree (title/description/featuredRelations chrome) is skipped, as are the structural Title and+ * Description styles wherever they appear. Formatting (marks), links and other block kinds are ignored for+ * now — only the text is pulled out.+ */+function extractTextContent(blocks: AnytypeBlock[], rootId: string): string {+ const byId = new Map<string, AnytypeBlock>();+ for (const block of blocks) {+ byId.set(block.id, block);+ }++ const root = (rootId ? byId.get(rootId) : undefined) ?? blocks[0];+ if (!root) {+ return "";+ }++ const paragraphs: string[] = [];+ const visited = new Set<string>();++ const walk = (id: string) => {+ // The header holds title/description chrome, not body content; cycle-guard everything else.+ if (id === "header" || visited.has(id)) {+ return;+ }+ visited.add(id);++ const block = byId.get(id);+ if (!block) {+ return;+ }++ const text = block.text?.text?.trim();+ const style = block.text?.style;+ if (text && style !== "Title" && style !== "Description") {+ paragraphs.push(`<p>${escapeHtml(text)}</p>`);+ }++ for (const childId of block.childrenIds ?? []) {+ walk(childId);+ }+ };++ // The root block is the page container and carries no text of its own — start from its children.+ for (const childId of root.childrenIds ?? []) {+ walk(childId);+ }++ return paragraphs.join("");+}++function escapeHtml(text: string): string {+ return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");+}++/** Creates a fresh "Anytype import" root and a flat child note per page. */+function createNotes(importRootNote: BNote, pages: ParsedObject[], taskContext: TaskContext<"importNotes">): BNote {+ /* v8 ignore next -- the protected branch needs a protected import root with an active protected session, which the in-memory test DB has no way to set up */+ const isProtected = importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable();++ const rootNote = noteService.createNewNote({ parentNoteId: importRootNote.noteId, title: t("anytype_import.root-title"), content: "", type: "text", mime: "text/html", isProtected }).note;+ rootNote.addLabel("iconClass", "bx bx-import");++ for (const page of pages) {+ noteService.createNewNote({ parentNoteId: rootNote.noteId, title: page.title, content: page.content, type: "text", mime: "text/html", isProtected });+ taskContext.increaseProgressCount();+ }++ return rootNote;+}++export default { importAnytype };diff --git a/packages/trilium-core/src/services/import/anytype/model.ts b/packages/trilium-core/src/services/import/anytype/model.tsnew file mode 100644index 0000000000..372fea97c3--- /dev/null+++ b/packages/trilium-core/src/services/import/anytype/model.ts@@ -0,0 +1,53 @@+/**+ * Types for Anytype's JSON ("any-block") export. Each object is a single `.pb.json` file holding a+ * `snapshot` whose `data.blocks` is a flat list forming a tree (linked by `childrenIds`), plus a `details`+ * map carrying the object's name, layout and property values. This basic importer reads only the page+ * objects and their plain text; relations, types, collections and inline formatting are modelled+ * minimally (or not at all) for now and will be filled in as the importer is extended.+ */++/** The text payload of a text block. Anytype has many `style`s (Paragraph, Header1, Numbered, …); the+ * basic importer ignores them and emits every non-empty text block as a plain paragraph. */+export interface AnytypeText {+ text?: string;+ style?: string;+}++/** A single block in an object's `snapshot.data.blocks`. Non-text blocks (links, dividers, dataviews, …)+ * carry other keys this importer doesn't read yet; only `id`, `childrenIds` and `text` are needed to pull+ * out the page's text content in document order. */+export interface AnytypeBlock {+ id: string;+ childrenIds?: string[];+ text?: AnytypeText;+}++/** The object's `snapshot.data.details` — its metadata map. `layout` distinguishes a basic page (0) from+ * a set/collection (3) and other system layouts; `name` is the title; `id` matches the root block's id. */+export interface AnytypeDetails {+ id?: string;+ name?: string;+ layout?: number;+}++/** One exported object file: `sbType` is the smartblock kind ("Page", "Participant", "Workspace", …) and+ * `snapshot.data` holds the blocks and details. */+export interface AnytypeSnapshot {+ sbType?: string;+ snapshot?: {+ data?: {+ blocks?: AnytypeBlock[];+ details?: AnytypeDetails;+ objectTypes?: string[];+ };+ };+}++/** A page parsed down to what the basic importer needs to create a Trilium note. */+export interface ParsedObject {+ /** The object's id (the root block's id); used later to resolve cross-object links. */+ id: string;+ title: string;+ /** Body HTML — for now, the concatenated text blocks wrapped in `<p>`. */+ content: string;+}