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
refactor(server): remove bnote wrapper
Elian Doranf53cf8a00817
diff --git a/apps/edit-docs/src/edit-demo.ts b/apps/edit-docs/src/edit-demo.tsindex e35defd3e5..cd6741dcb2 100644--- a/apps/edit-docs/src/edit-demo.ts+++ b/apps/edit-docs/src/edit-demo.ts@@ -32,7 +32,7 @@ async function main() {}async function setOptions() {- const optionsService = (await import("@triliumnext/server/src/services/options.js")).default;+ const { options: optionsService } = await import("@triliumnext/core");const sql = (await import("@triliumnext/server/src/services/sql.js")).default;optionsService.setOption("eraseUnusedAttachmentsAfterSeconds", 10);diff --git a/apps/edit-docs/src/edit-docs.ts b/apps/edit-docs/src/edit-docs.tsindex 8f2def52b1..8a2e976467 100644--- a/apps/edit-docs/src/edit-docs.ts+++ b/apps/edit-docs/src/edit-docs.ts@@ -140,7 +140,7 @@ async function main() {}async function setOptions() {- const optionsService = (await import("@triliumnext/server/src/services/options.js")).default;+ const { options: optionsService } = await import("@triliumnext/core");const sql = (await import("@triliumnext/server/src/services/sql.js")).default;optionsService.setOption("eraseUnusedAttachmentsAfterSeconds", 10);diff --git a/apps/server/src/becca/entities/bnote.ts b/apps/server/src/becca/entities/bnote.tsdeleted file mode 100644index 523e4e0042..0000000000--- a/apps/server/src/becca/entities/bnote.ts+++ /dev/null@@ -1,2 +0,0 @@-import { BNote } from "@triliumnext/core";-export default BNote;diff --git a/apps/server/src/etapi/mappers.ts b/apps/server/src/etapi/mappers.tsindex 01c59a5be9..d00a9798db 100644--- a/apps/server/src/etapi/mappers.ts+++ b/apps/server/src/etapi/mappers.ts@@ -1,7 +1,6 @@-import type { BAttachment, BAttribute, BRevision } from "@triliumnext/core";+import type { BAttachment, BAttribute, BNote, BRevision } from "@triliumnext/core";import type BBranch from "../becca/entities/bbranch.js";-import type BNote from "../becca/entities/bnote.js";function mapNoteToPojo(note: BNote) {return {diff --git a/apps/server/src/routes/api/clipper.spec.ts b/apps/server/src/routes/api/clipper.spec.tsindex a20a0c0020..e4f971bdee 100644--- a/apps/server/src/routes/api/clipper.spec.ts+++ b/apps/server/src/routes/api/clipper.spec.ts@@ -1,7 +1,6 @@-import { becca_easy_mocking } from "@triliumnext/core";+import { becca_easy_mocking, BNote } from "@triliumnext/core";import { beforeAll, describe, expect, it, vi } from "vitest";-import BNote from '../../becca/entities/bnote.js';import cls from "../../services/cls";import { processContent } from "./clipper";diff --git a/apps/server/src/routes/api/clipper.ts b/apps/server/src/routes/api/clipper.tsindex 0f83762dbf..bd3c4f563b 100644--- a/apps/server/src/routes/api/clipper.ts+++ b/apps/server/src/routes/api/clipper.ts@@ -1,9 +1,8 @@-import { app_info as appInfo, attribute_formatter as attributeFormatter, attributes as attributeService, cloning as cloneService, date_notes as dateNoteService, date_utils as dateUtils, note_service as noteService, sanitize, ValidationError, ws } from "@triliumnext/core";+import { app_info as appInfo, attribute_formatter as attributeFormatter, attributes as attributeService, type BNote, cloning as cloneService, date_notes as dateNoteService, date_utils as dateUtils, note_service as noteService, sanitize, ValidationError, ws } from "@triliumnext/core";import type { Request } from "express";import { parse } from "node-html-parser";import path from "path";-import type BNote from "../../becca/entities/bnote.js";import imageService from "../../services/image.js";import log from "../../services/log.js";import utils from "../../services/utils.js";diff --git a/apps/server/src/services/export/zip/share_theme.ts b/apps/server/src/services/export/zip/share_theme.tsindex 70464a5751..181829a1c2 100644--- a/apps/server/src/services/export/zip/share_theme.ts+++ b/apps/server/src/services/export/zip/share_theme.ts@@ -1,4 +1,4 @@-import { ExportFormat, icon_packs as iconPackService, ZipExportProvider } from "@triliumnext/core";+import { type BNote, ExportFormat, icon_packs as iconPackService, ZipExportProvider } from "@triliumnext/core";import ejs from "ejs";import fs, { readdirSync, readFileSync } from "fs";import { convert as convertToText } from "html-to-text";@@ -7,7 +7,6 @@ import { join } from "path";import becca from "../../../becca/becca";import type BBranch from "../../../becca/entities/bbranch.js";-import type BNote from "../../../becca/entities/bnote.js";import { getClientDir, getShareThemeAssetDir } from "../../../routes/assets";import { getDefaultTemplatePath, readTemplate, renderNoteForExport } from "../../../share/content_renderer";import log from "../../log";diff --git a/apps/server/src/services/llm/tools/helpers.ts b/apps/server/src/services/llm/tools/helpers.tsindex f904d3c87e..071b8779ae 100644--- a/apps/server/src/services/llm/tools/helpers.ts+++ b/apps/server/src/services/llm/tools/helpers.ts@@ -2,11 +2,10 @@* Shared helpers for LLM tools — content conversion, metadata building, and previews.*/-import { type BAttachment, markdownExportService as markdownExport,markdownImportService as markdownImport } from "@triliumnext/core";+import { type BAttachment, type BNote, markdownExportService as markdownExport,markdownImportService as markdownImport } from "@triliumnext/core";import { unwrapStringOrBuffer } from "@triliumnext/core/src/services/utils/binary.js";import becca from "../../../becca/becca.js";-import type BNote from "../../../becca/entities/bnote.js";const CONTENT_PREVIEW_MAX_LENGTH = 500;const ATTACHMENT_PREVIEW_MAX_LENGTH = 200;diff --git a/apps/server/src/services/llm/tools/hierarchy_tools.ts b/apps/server/src/services/llm/tools/hierarchy_tools.tsindex e880949cfb..2027c280c4 100644--- a/apps/server/src/services/llm/tools/hierarchy_tools.ts+++ b/apps/server/src/services/llm/tools/hierarchy_tools.ts@@ -2,11 +2,10 @@* LLM tools for navigating the note hierarchy (tree structure, branches).*/-import { cloning as cloningService } from "@triliumnext/core";+import { type BNote, cloning as cloningService } from "@triliumnext/core";import { z } from "zod";import becca from "../../../becca/becca.js";-import type BNote from "../../../becca/entities/bnote.js";import branchService from "../../branches.js";import { PROTECTED_SYSTEM_NOTES } from "./helpers.js";import { defineTools } from "./tool_registry.js";diff --git a/apps/server/src/services/search/services/search_benchmark.spec.ts b/apps/server/src/services/search/services/search_benchmark.spec.tsindex 457775e100..b7a460d4d2 100644--- a/apps/server/src/services/search/services/search_benchmark.spec.ts+++ b/apps/server/src/services/search/services/search_benchmark.spec.ts@@ -12,9 +12,8 @@** All times are in-memory (monkeypatched getContent, no real SQL).*/-import { becca_mocking, search as searchService, SearchContext } from "@triliumnext/core";+import { becca_mocking, BNote, search as searchService, SearchContext } from "@triliumnext/core";import { describe, it, expect, afterEach } from "vitest";-import BNote from "../../../becca/entities/bnote.js";import BBranch from "../../../becca/entities/bbranch.js";import becca from "../../../becca/becca.js";diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.tsindex 61b042c9f6..b2ef8786d2 100644--- a/apps/server/src/share/content_renderer.ts+++ b/apps/server/src/share/content_renderer.ts@@ -1,5 +1,5 @@import { extractYouTubeVideoId, renderSpreadsheetToHtml, renderToHtml as renderMarkdownToHtml } from "@triliumnext/commons";-import { type BAttachment, icon_packs as iconPackService, options, sanitize, task_states, utils } from "@triliumnext/core";+import { type BAttachment, BNote, icon_packs as iconPackService, options, sanitize, task_states, utils } from "@triliumnext/core";import { highlightAuto } from "@triliumnext/highlightjs";import ejs from "ejs";import escapeHtml from "escape-html";@@ -10,7 +10,6 @@ import { join } from "path";import becca from "../becca/becca.js";import type BBranch from "../becca/entities/bbranch.js";-import BNote from "../becca/entities/bnote.js";import assetPath, { assetUrlFragment } from "../services/asset_path.js";import log from "../services/log.js";import { getResourceDir, isDev } from "../services/utils.js";