Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/main' into HEAD

Elian Doranda7a61a8b619
diff --cc apps/server/package.json
index 824a0b2c0b,520ac6ffca..e130588b92
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@@ -79,10 -82,11 +79,10 @@@
"csrf-csrf": "3.2.2",
"debounce": "3.0.0",
"debug": "4.4.3",
- "ejs": "3.1.10",
- "electron": "39.2.7",
+ "ejs": "4.0.1",
+ "electron": "40.0.0",
"electron-debug": "4.1.0",
"electron-window-state": "5.0.3",
- "escape-html": "1.0.3",
"express": "5.2.1",
"express-http-proxy": "2.1.2",
"express-openid-connect": "2.19.4",
@@@ -107,9 -111,12 +107,9 @@@
"multer": "2.0.2",
"normalize-strings": "1.1.1",
"ollama": "0.6.3",
- "openai": "6.16.0",
+ "openai": "6.17.0",
"rand-token": "1.0.1",
- "safe-compare": "1.1.4",
- "sanitize-filename": "1.6.3",
- "sanitize-html": "2.17.0",
+ "safe-compare": "1.1.4",
"sax": "1.4.4",
"serve-favicon": "2.5.1",
"stream-throttle": "0.1.3",
@@@ -119,8 -126,9 +119,7 @@@
"swagger-jsdoc": "6.2.8",
"time2fa": "1.4.2",
"tmp": "0.2.5",
- "turndown": "7.2.2",
- "vite": "7.3.1",
+ "turnish": "1.8.0",
- "unescape": "1.0.1",
- "vite": "7.3.1",
"ws": "8.19.0",
"xml2js": "0.6.2",
"yauzl": "3.2.0"
diff --cc apps/server/src/app.ts
index c239684858,f2f7cdff9e..fec992bbe5
--- a/apps/server/src/app.ts
+++ b/apps/server/src/app.ts
@@@ -1,8 -1,9 +1,9 @@@
-import "./services/handlers.js";
-import "./becca/becca_loader.js";
+import("@triliumnext/core");
+import { erase } from "@triliumnext/core";
import compression from "compression";
import cookieParser from "cookie-parser";
+ import ejs from "ejs";
import express from "express";
import { auth } from "express-openid-connect";
import helmet from "helmet";
diff --cc apps/server/src/services/import/zip.ts
index da27376d9c,2d2251cb31..a20794305e
--- a/apps/server/src/services/import/zip.ts
+++ b/apps/server/src/services/import/zip.ts
@@@ -14,7 -13,8 +14,7 @@@ import type BNote from "../../becca/ent
import attributeService from "../../services/attributes.js";
import log from "../../services/log.js";
import noteService from "../../services/notes.js";
- import { getNoteTitle, newEntityId, processStringOrBuffer, removeTextFileExtension, unescapeHtml } from "../../services/utils.js";
+ import { getNoteTitle, newEntityId, processStringOrBuffer, removeFileExtension, unescapeHtml } from "../../services/utils.js";
-import htmlSanitizer from "../html_sanitizer.js";
import type AttributeMeta from "../meta/attribute_meta.js";
import type NoteMeta from "../meta/note_meta.js";
import protectedSessionService from "../protected_session.js";
@@@ -300,7 -300,7 +300,6 @@@ async function importZip(taskContext: T
return {
noteId: getNoteId(noteMeta, absUrl)
};
-
-
}
function processTextNoteContent(content: string, noteTitle: string, filePath: string, noteMeta?: NoteMeta) {
diff --cc apps/server/src/services/utils.ts
index cf79115314,a97b84a6c7..ec2ad1f211
--- a/apps/server/src/services/utils.ts
+++ b/apps/server/src/services/utils.ts
@@@ -1,12 -1,16 +1,10 @@@
--
--
+import { utils as coreUtils } from "@triliumnext/core";
import chardet from "chardet";
import crypto from "crypto";
-import escape from "escape-html";
import { t } from "i18next";
-import mimeTypes from "mime-types";
import { release as osRelease } from "os";
import path from "path";
-import { generator } from "rand-token";
-import sanitize from "sanitize-filename";
import stripBom from "strip-bom";
-import unescape from "unescape";
import log from "./log.js";
import type NoteMeta from "./meta/note_meta.js";
@@@ -122,32 -155,57 +120,32 @@@ export async function crash(message: st
}
}
+/** @deprecated */
export function getContentDisposition(filename: string) {
- const sanitizedFilename = sanitize(filename).trim() || "file";
- const uriEncodedFilename = encodeURIComponent(sanitizedFilename);
- return `file; filename="${uriEncodedFilename}"; filename*=UTF-8''${uriEncodedFilename}`;
+ return coreUtils.getContentDisposition(filename);
}
-// render and book are string note in the sense that they are expected to contain empty string
-const STRING_NOTE_TYPES = new Set(["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas", "webView"]);
-const STRING_MIME_TYPES = new Set(["application/javascript", "application/x-javascript", "application/json", "application/x-sql", "image/svg+xml"]);
-
+/** @deprecated */
export function isStringNote(type: string | undefined, mime: string) {
- return (type && STRING_NOTE_TYPES.has(type)) || mime.startsWith("text/") || STRING_MIME_TYPES.has(mime);
+ return coreUtils.isStringNote(type, mime);
}
+/** @deprecated */
export function quoteRegex(url: string) {
- return url.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
+ return coreUtils.quoteRegex(url);
}
+/** @deprecated */
export function replaceAll(string: string, replaceWhat: string, replaceWith: string) {
- const quotedReplaceWhat = quoteRegex(replaceWhat);
-
- return string.replace(new RegExp(quotedReplaceWhat, "g"), replaceWith);
+ return coreUtils.replaceAll(string, replaceWhat, replaceWith);
}
+/** @deprecated */
export function formatDownloadTitle(fileName: string, type: string | null, mime: string) {
- const fileNameBase = !fileName ? "untitled" : sanitize(fileName);
-
- const getExtension = () => {
- if (type === "text") return ".html";
- if (type === "relationMap" || type === "canvas" || type === "search") return ".json";
- if (!mime) return "";
-
- const mimeLc = mime.toLowerCase();
-
- // better to just return the current name without a fake extension
- // it's possible that the title still preserves the correct extension anyways
- if (mimeLc === "application/octet-stream") return "";
-
- // if fileName has an extension matching the mime already - reuse it
- const mimeTypeFromFileName = mimeTypes.lookup(fileName);
- if (mimeTypeFromFileName === mimeLc) return "";
-
- // as last resort try to get extension from mimeType
- const extensions = mimeTypes.extension(mime);
- return extensions ? `.${extensions}` : "";
- };
-
- return `${fileNameBase}${getExtension()}`;
+ return coreUtils.formatDownloadTitle(fileName, type, mime);
}
- export function removeTextFileExtension(filePath: string) {
+ export function removeFileExtension(filePath: string) {
const extension = path.extname(filePath).toLowerCase();
switch (extension) {
diff --cc apps/server/src/share/shaca/entities/snote.ts
index ab51a434fa,852c2b890d..9c750ea859
--- a/apps/server/src/share/shaca/entities/snote.ts
+++ b/apps/server/src/share/shaca/entities/snote.ts
@@@ -1,7 -1,7 +1,7 @@@
- import { BlobRow } from "@triliumnext/commons";
- import { binary_utils, NOTE_TYPE_ICONS } from "@triliumnext/core";
-import { getNoteIcon, NoteType } from "@triliumnext/commons";
++import { BlobRow, getNoteIcon, NoteType } from "@triliumnext/commons";
++import { binary_utils } from "@triliumnext/core";
import escape from "escape-html";
-import type { Blob } from "../../../services/blob-interface.js";
import utils from "../../../services/utils.js";
import sql from "../../sql.js";
import AbstractShacaEntity from "./abstract_shaca_entity.js";
diff --cc packages/trilium-core/src/becca/entities/bnote.ts
index 7be573166f,0000000000..75c22dfa98
mode 100644,000000..100644
--- a/packages/trilium-core/src/becca/entities/bnote.ts
+++ b/packages/trilium-core/src/becca/entities/bnote.ts
@@@ -1,1806 -1,0 +1,1793 @@@
+import type { AttachmentRow, AttributeType, CloneResponse, NoteRow, NoteType, RevisionRow } from "@triliumnext/commons";
- import { dayjs } from "@triliumnext/commons";
++import { dayjs, getNoteIcon } from "@triliumnext/commons";
+import eventService from "../../services/events";
+
+import cloningService from "../../services/cloning.js";
+import dateUtils from "../../services/utils/date";
+import eraseService from "../../services/erase.js";
+import handlers from "../../services/handlers.js";
+import { getLog } from "../../services/log.js";
+import noteService from "../../services/notes.js";
+import optionService from "../../services/options.js";
+import protectedSessionService from "../../services/protected_session.js";
+import searchService from "../../services/search/services/search.js";
+import TaskContext from "../../services/task_context.js";
+import type { NotePojo } from "../becca-interface.js";
+import AbstractBeccaEntity from "./abstract_becca_entity.js";
+import BAttachment from "./battachment.js";
+import BAttribute from "./battribute.js";
+import type BBranch from "./bbranch.js";
+import BRevision from "./brevision.js";
+import { getSql } from "../../services/sql/index.js";
+import { formatDownloadTitle, isStringNote, normalize, randomString, replaceAll } from "../../services/utils";
+
+const LABEL = "label";
+const RELATION = "relation";
+
+// TODO: Deduplicate with fnote
+export const NOTE_TYPE_ICONS = {
+ file: "bx bx-file",
+ image: "bx bx-image",
+ code: "bx bx-code",
+ render: "bx bx-extension",
+ search: "bx bx-file-find",
+ relationMap: "bx bxs-network-chart",
+ book: "bx bx-book",
+ noteMap: "bx bxs-network-chart",
+ mermaid: "bx bx-selection",
+ canvas: "bx bx-pen",
+ webView: "bx bx-globe-alt",
+ launcher: "bx bx-link",
+ doc: "bx bxs-file-doc",
+ contentWidget: "bx bxs-widget",
+ mindMap: "bx bx-sitemap",
+ geoMap: "bx bx-map-alt"
+};
+
+interface NotePathRecord {
+ isArchived: boolean;
+ isInHoistedSubTree: boolean;
+ notePath: string[];
+ isHidden: boolean;
+}
+
+interface ContentOpts {
+ /** will also save this BNote entity */
+ forceSave?: boolean;
+ /** override frontend heuristics on when to reload, instruct to reload */
+ forceFrontendReload?: boolean;
+}
+
+interface Relationship {
+ parentNoteId: string;
+ childNoteId: string;
+}
+
+interface ConvertOpts {
+ /** if true, the action is not triggered by user, but e.g. by migration, and only perfect candidates will be migrated */
+ autoConversion?: boolean;
+}
+
+/**
+ * Trilium's main entity, which can represent text note, image, code note, file attachment etc.
+ */
+class BNote extends AbstractBeccaEntity<BNote> {
+ static get entityName() {
+ return "notes";
+ }
+ static get primaryKeyName() {
+ return "noteId";
+ }
+ static get hashedProperties() {
+ return ["noteId", "title", "isProtected", "type", "mime", "blobId"];
+ }
+
+ noteId!: string;
+ title!: string;
+ type!: NoteType;
+ mime!: string;
+ /** set during the deletion operation, before it is completed (removed from becca completely). */
+ isBeingDeleted!: boolean;
+ isDecrypted!: boolean;
+
+ ownedAttributes!: BAttribute[];
+ parentBranches!: BBranch[];
+ parents!: BNote[];
+ children!: BNote[];
+ targetRelations!: BAttribute[];
+
+ __flatTextCache!: string | null;
+
+ private __attributeCache!: BAttribute[] | null;
+ private __inheritableAttributeCache!: BAttribute[] | null;
+ private __ancestorCache!: BNote[] | null;
+
+ // following attributes are filled during searching in the database
+ /** size of the content in bytes */
+ contentSize!: number | null;
+ /** size of the note content, attachment contents in bytes */
+ contentAndAttachmentsSize!: number | null;
+ /** size of the note content, attachment contents and revision contents in bytes */
+ contentAndAttachmentsAndRevisionsSize!: number | null;
+ /** number of note revisions for this note */
+ revisionCount!: number | null;
+
+ constructor(row?: Partial<NoteRow>) {
+ super();
+
+ if (!row) {
+ return;
+ }
+
+ this.updateFromRow(row);
+ this.init();
+ }
+
+ updateFromRow(row: Partial<NoteRow>) {
+ this.update([row.noteId, row.title, row.type, row.mime, row.isProtected, row.blobId, row.dateCreated, row.dateModified, row.utcDateCreated, row.utcDateModified]);
+ }
+
+ update([noteId, title, type, mime, isProtected, blobId, dateCreated, dateModified, utcDateCreated, utcDateModified]: any) {
+ // ------ Database persisted attributes ------
+
+ this.noteId = noteId;
+ this.title = title;
+ this.type = type;
+ this.mime = mime;
+ this.isProtected = !!isProtected;
+ this.blobId = blobId;
+ this.dateCreated = dateCreated || dateUtils.localNowDateTime();
+ this.dateModified = dateModified;
+ this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime();
+ this.utcDateModified = utcDateModified;
+ this.isBeingDeleted = false;
+
+ // ------ Derived attributes ------
+
+ this.isDecrypted = !this.noteId || !this.isProtected;
+
+ this.decrypt();
+
+ this.__flatTextCache = null;
+
+ return this;
+ }
+
+ override init() {
+ this.parentBranches = [];
+ this.parents = [];
+ this.children = [];
+ this.ownedAttributes = [];
+ this.__attributeCache = null;
+ this.__inheritableAttributeCache = null;
+ this.targetRelations = [];
+
+ this.becca.addNote(this.noteId, this);
+ this.__ancestorCache = null;
+
+ this.contentSize = null;
+ this.contentAndAttachmentsSize = null;
+ this.contentAndAttachmentsAndRevisionsSize = null;
+ this.revisionCount = null;
+ }
+
+ isContentAvailable() {
+ return (
+ !this.noteId || // new note which was not encrypted yet
+ !this.isProtected ||
+ protectedSessionService.isProtectedSessionAvailable()
+ );
+ }
+
+ getTitleOrProtected() {
+ return this.isContentAvailable() ? this.title : "[protected]";
+ }
+
+ getParentBranches() {
+ return this.parentBranches;
+ }
+
+ /**
+ * Returns <i>strong</i> (as opposed to <i>weak</i>) parent branches. See isWeak for details.
+ */
+ getStrongParentBranches() {
+ return this.getParentBranches().filter((branch) => !branch.isWeak);
+ }
+
+ /**
+ * @deprecated use getParentBranches() instead
+ */
+ getBranches() {
+ return this.parentBranches;
+ }
+
+ getParentNotes() {
+ return this.parents;
+ }
+
+ getChildNotes() {
+ return this.children;
+ }
+
+ hasChildren() {
+ return this.children && this.children.length > 0;
+ }
+
+ getChildBranches(): BBranch[] {
+ return this.children.map((childNote) => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId)) as BBranch[];
+ }
+
+ /**
+ * Note content has quite special handling - it's not a separate entity, but a lazily loaded
+ * part of Note entity with its own sync. Reasons behind this hybrid design has been:
+ *
+ * - content can be quite large, and it's not necessary to load it / fill memory for any note access even if we don't need a content, especially for bulk operations like search
+ * - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and entity changes records)
+ * - but to the user note content and title changes are one and the same - single dateModified (so all changes must go through Note and content is not a separate entity)
+ */
+ getContent() {
+ return this._getContent();
+ }
+
+ /**
+ * @throws Error in case of invalid JSON
+ */
+ getJsonContent(): any | null {
+ const content = this.getContent();
+
+ if (typeof content !== "string" || !content || !content.trim()) {
+ return null;
+ }
+
+ return JSON.parse(content);
+ }
+
+ /** @returns valid object or null if the content cannot be parsed as JSON */
+ getJsonContentSafely() {
+ try {
+ return this.getJsonContent();
+ } catch (e) {
+ return null;
+ }
+ }
+
+ setContent(content: Uint8Array | string, opts: ContentOpts = {}) {
+ this._setContent(content, opts);
+
+ eventService.emit(eventService.NOTE_CONTENT_CHANGE, { entity: this });
+ }
+
+ setJsonContent(content: {}) {
+ this.setContent(JSON.stringify(content, null, "\t"));
+ }
+
+ get dateCreatedObj() {
+ return this.dateCreated === null ? null : dayjs(this.dateCreated);
+ }
+
+ get utcDateCreatedObj() {
+ return this.utcDateCreated === null ? null : dayjs.utc(this.utcDateCreated);
+ }
+
+ get dateModifiedObj() {
+ return this.dateModified === null ? null : dayjs(this.dateModified);
+ }
+
+ get utcDateModifiedObj() {
+ return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified);
+ }
+
+ /** @returns true if this note is the root of the note tree. Root note has "root" noteId */
+ isRoot() {
+ return this.noteId === "root";
+ }
+
+ /** @returns true if this note is of application/json content type */
+ isJson() {
+ return this.mime === "application/json";
+ }
+
+ /** @returns true if this note is JavaScript (code or attachment) */
+ isJavaScript() {
+ return (
+ (this.type === "code" || this.type === "file" || this.type === "launcher") &&
+ (this.mime.startsWith("application/javascript") || this.mime === "application/x-javascript" || this.mime === "text/javascript")
+ );
+ }
+
+ isJsx() {
+ return (this.type === "code" && this.mime === "text/jsx");
+ }
+
+ /** @returns true if this note is HTML */
+ isHtml() {
+ return ["code", "file", "render"].includes(this.type) && this.mime === "text/html";
+ }
+
+ /** @returns true if this note is an image */
+ isImage() {
+ return this.type === "image" || (this.type === "file" && this.mime?.startsWith("image/"));
+ }
+
+ /** @deprecated use hasStringContent() instead */
+ isStringNote() {
+ return this.hasStringContent();
+ }
+
+ /** @returns true if the note has string content (not binary) */
+ override hasStringContent() {
+ return isStringNote(this.type, this.mime);
+ }
+
+ /** @returns JS script environment - either "frontend" or "backend" */
+ getScriptEnv() {
+ if (this.isHtml() || (this.isJavaScript() && this.mime.endsWith("env=frontend")) || this.isJsx()) {
+ return "frontend";
+ }
+
+ if (this.type === "render") {
+ return "frontend";
+ }
+
+ if (this.isJavaScript() && this.mime.endsWith("env=backend")) {
+ return "backend";
+ }
+
+ return null;
+ }
+
+ /**
+ * Beware that the method must not create a copy of the array, but actually returns its internal array
+ * (for performance reasons)
+ *
+ * @param type - (optional) attribute type to filter
+ * @param name - (optional) attribute name to filter
+ * @returns all note's attributes, including inherited ones
+ */
+ getAttributes(type?: string, name?: string): BAttribute[] {
+ this.__validateTypeName(type, name);
+ this.__ensureAttributeCacheIsAvailable();
+
+ if (!this.__attributeCache) {
+ throw new Error("Attribute cache not available.");
+ }
+
+ if (type && name) {
+ return this.__attributeCache.filter((attr) => attr.name === name && attr.type === type);
+ } else if (type) {
+ return this.__attributeCache.filter((attr) => attr.type === type);
+ } else if (name) {
+ return this.__attributeCache.filter((attr) => attr.name === name);
+ }
+ return this.__attributeCache;
+ }
+
+ private __ensureAttributeCacheIsAvailable() {
+ if (!this.__attributeCache) {
+ this.__getAttributes([]);
+ }
+ }
+
+ private __getAttributes(path: string[]) {
+ if (path.includes(this.noteId)) {
+ return [];
+ }
+
+ if (!this.__attributeCache) {
+ const parentAttributes = this.ownedAttributes.slice();
+ const newPath = [...path, this.noteId];
+
+ // inheritable attrs on root are typically not intended to be applied to hidden subtree #3537
+ if (this.noteId !== "root" && this.noteId !== "_hidden") {
+ for (const parentNote of this.parents) {
+ parentAttributes.push(...parentNote.__getInheritableAttributes(newPath));
+ }
+ }
+
+ const templateAttributes: BAttribute[] = [];
+
+ for (const ownedAttr of parentAttributes) {
+ // parentAttributes so we process also inherited templates
+ if (ownedAttr.type === "relation" && ["template", "inherit"].includes(ownedAttr.name)) {
+ const templateNote = this.becca.notes[ownedAttr.value];
+
+ if (templateNote) {
+ templateAttributes.push(
+ ...templateNote
+ .__getAttributes(newPath)
+ // template attr is used as a marker for templates, but it's not meant to be inherited
+ .filter((attr) => !(attr.type === "label" && (attr.name === "template" || attr.name === "workspacetemplate")))
+ );
+ }
+ }
+ }
+
+ this.__attributeCache = [];
+
+ const addedAttributeIds = new Set();
+
+ for (const attr of parentAttributes.concat(templateAttributes)) {
+ if (!addedAttributeIds.has(attr.attributeId)) {
+ addedAttributeIds.add(attr.attributeId);
+
+ this.__attributeCache.push(attr);
+ }
+ }
+
+ this.__inheritableAttributeCache = [];
+
+ for (const attr of this.__attributeCache) {
+ if (attr.isInheritable) {
+ this.__inheritableAttributeCache.push(attr);
+ }
+ }
+ }
+
+ return this.__attributeCache;
+ }
+
+ private __getInheritableAttributes(path: string[]): BAttribute[] {
+ if (path.includes(this.noteId)) {
+ return [];
+ }
+
+ if (!this.__inheritableAttributeCache) {
+ this.__getAttributes(path); // will refresh also this.__inheritableAttributeCache
+ }
+
+ return this.__inheritableAttributeCache || [];
+ }
+
+ __validateTypeName(type?: string | null, name?: string | null) {
+ if (type && type !== "label" && type !== "relation") {
+ throw new Error(`Unrecognized attribute type '${type}'. Only 'label' and 'relation' are possible values.`);
+ }
+
+ if (name) {
+ const firstLetter = name.charAt(0);
+ if (firstLetter === "#" || firstLetter === "~") {
+ throw new Error(`Detect '#' or '~' in the attribute's name. In the API, attribute names should be set without these characters.`);
+ }
+ }
+ }
+
+ hasAttribute(type: string, name: string, value: string | null = null): boolean {
+ return !!this.getAttributes().find((attr) => attr.name === name && (value === undefined || value === null || attr.value === value) && attr.type === type);
+ }
+
+ getAttributeCaseInsensitive(type: string, name: string, value?: string | null) {
+ name = name.toLowerCase();
+ value = value ? value.toLowerCase() : null;
+
+ return this.getAttributes().find((attr) => attr.name.toLowerCase() === name && (!value || attr.value.toLowerCase() === value) && attr.type === type);
+ }
+
+ getRelationTarget(name: string) {
+ const relation = this.getAttributes().find((attr) => attr.name === name && attr.type === "relation");
+
+ return relation ? relation.targetNote : null;
+ }
+
+ /**
+ * @param name - label name
+ * @param value - label value
+ * @returns true if label exists (including inherited)
+ */
+ hasLabel(name: string, value?: string): boolean {
+ return this.hasAttribute(LABEL, name, value);
+ }
+
+ /**
+ * @param name - label name
+ * @returns true if label exists (including inherited) and does not have "false" value.
+ */
+ isLabelTruthy(name: string): boolean {
+ const label = this.getLabel(name);
+
+ if (!label) {
+ return false;
+ }
+
+ return label && label.value !== "false";
+ }
+
+ /**
+ * @param name - label name
+ * @param value - label value
+ * @returns true if label exists (excluding inherited)
+ */
+ hasOwnedLabel(name: string, value?: string): boolean {
+ return this.hasOwnedAttribute(LABEL, name, value);
+ }
+
+ /**
+ * @param name - relation name
+ * @param value - relation value
+ * @returns true if relation exists (including inherited)
+ */
+ hasRelation(name: string, value?: string): boolean {
+ return this.hasAttribute(RELATION, name, value);
+ }
+
+ /**
+ * @param name - relation name
+ * @param value - relation value
+ * @returns true if relation exists (excluding inherited)
+ */
+ hasOwnedRelation(name: string, value?: string): boolean {
+ return this.hasOwnedAttribute(RELATION, name, value);
+ }
+
+ /**
+ * @param name - label name
+ * @returns label if it exists, null otherwise
+ */
+ getLabel(name: string): BAttribute | null {
+ return this.getAttribute(LABEL, name);
+ }
+
+ /**
+ * @param name - label name
+ * @returns label if it exists, null otherwise
+ */
+ getOwnedLabel(name: string): BAttribute | null {
+ return this.getOwnedAttribute(LABEL, name);
+ }
+
+ /**
+ * @param name - relation name
+ * @returns relation if it exists, null otherwise
+ */
+ getRelation(name: string): BAttribute | null {
+ return this.getAttribute(RELATION, name);
+ }
+
+ /**
+ * @param name - relation name
+ * @returns relation if it exists, null otherwise
+ */
+ getOwnedRelation(name: string): BAttribute | null {
+ return this.getOwnedAttribute(RELATION, name);
+ }
+
+ /**
+ * @param name - label name
+ * @returns label value if label exists, null otherwise
+ */
+ getLabelValue(name: string): string | null {
+ return this.getAttributeValue(LABEL, name);
+ }
+
+ /**
+ * @param name - label name
+ * @returns label value if label exists, null otherwise
+ */
+ getOwnedLabelValue(name: string): string | null {
+ return this.getOwnedAttributeValue(LABEL, name);
+ }
+
+ /**
+ * @param name - relation name
+ * @returns relation value if relation exists, null otherwise
+ */
+ getRelationValue(name: string): string | null {
+ return this.getAttributeValue(RELATION, name);
+ }
+
+ /**
+ * @param name - relation name
+ * @returns relation value if relation exists, null otherwise
+ */
+ getOwnedRelationValue(name: string): string | null {
+ return this.getOwnedAttributeValue(RELATION, name);
+ }
+
+ /**
+ * @param attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @param value - attribute value
+ * @returns true if note has an attribute with given type and name (excluding inherited)
+ */
+ hasOwnedAttribute(type: string, name: string, value?: string): boolean {
+ return !!this.getOwnedAttribute(type, name, value);
+ }
+
+ /**
+ * @param type - attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @returns attribute of the given type and name. If there are more such attributes, first is returned.
+ * Returns null if there's no such attribute belonging to this note.
+ */
+ getAttribute(type: string, name: string): BAttribute | null {
+ const attributes = this.getAttributes();
+
+ return attributes.find((attr) => attr.name === name && attr.type === type) || null;
+ }
+
+ /**
+ * @param type - attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @returns attribute value of given type and name or null if no such attribute exists.
+ */
+ getAttributeValue(type: string, name: string): string | null {
+ const attr = this.getAttribute(type, name);
+
+ return attr ? attr.value : null;
+ }
+
+ /**
+ * @param type - attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @returns attribute value of given type and name or null if no such attribute exists.
+ */
+ getOwnedAttributeValue(type: string, name: string): string | null {
+ const attr = this.getOwnedAttribute(type, name);
+
+ return attr ? attr.value : null;
+ }
+
+ /**
+ * @param name - label name to filter
+ * @returns all note's labels (attributes with type label), including inherited ones
+ */
+ getLabels(name?: string): BAttribute[] {
+ return this.getAttributes(LABEL, name);
+ }
+
+ /**
+ * @param name - label name to filter
+ * @returns all note's label values, including inherited ones
+ */
+ getLabelValues(name: string): string[] {
+ return this.getLabels(name).map((l) => l.value);
+ }
+
+ /**
+ * @param name - label name to filter
+ * @returns all note's labels (attributes with type label), excluding inherited ones
+ */
+ getOwnedLabels(name: string): BAttribute[] {
+ return this.getOwnedAttributes(LABEL, name);
+ }
+
+ /**
+ * @param name - label name to filter
+ * @returns all note's label values, excluding inherited ones
+ */
+ getOwnedLabelValues(name: string): string[] {
+ return this.getOwnedAttributes(LABEL, name).map((l) => l.value);
+ }
+
+ /**
+ * @param name - relation name to filter
+ * @returns all note's relations (attributes with type relation), including inherited ones
+ */
+ getRelations(name?: string): BAttribute[] {
+ return this.getAttributes(RELATION, name);
+ }
+
+ /**
+ * @param name - relation name to filter
+ * @returns all note's relations (attributes with type relation), excluding inherited ones
+ */
+ getOwnedRelations(name?: string | null): BAttribute[] {
+ return this.getOwnedAttributes(RELATION, name);
+ }
+
+ /**
+ * Beware that the method must not create a copy of the array, but actually returns its internal array
+ * (for performance reasons)
+ *
+ * @param type - (optional) attribute type to filter
+ * @param name - (optional) attribute name to filter
+ * @param value - (optional) attribute value to filter
+ * @returns note's "owned" attributes - excluding inherited ones
+ */
+ getOwnedAttributes(type: string | null = null, name: string | null = null, value: string | null = null) {
+ this.__validateTypeName(type, name);
+
+ if (type && name && value !== undefined && value !== null) {
+ return this.ownedAttributes.filter((attr) => attr.name === name && attr.value === value && attr.type === type);
+ } else if (type && name) {
+ return this.ownedAttributes.filter((attr) => attr.name === name && attr.type === type);
+ } else if (type) {
+ return this.ownedAttributes.filter((attr) => attr.type === type);
+ } else if (name) {
+ return this.ownedAttributes.filter((attr) => attr.name === name);
+ }
+ return this.ownedAttributes;
+ }
+
+ /**
+ * @returns attribute belonging to this specific note (excludes inherited attributes)
+ *
+ * This method can be significantly faster than the getAttribute()
+ */
+ getOwnedAttribute(type: string, name: string, value: string | null = null) {
+ const attrs = this.getOwnedAttributes(type, name, value);
+
+ return attrs.length > 0 ? attrs[0] : null;
+ }
+
+ get isArchived() {
+ return this.hasAttribute("label", "archived");
+ }
+
+ areAllNotePathsArchived() {
+ // there's a slight difference between note being itself archived and all its note paths being archived
+ // - note is archived when it itself has an archived label or inherits it
+ // - note does not have or inherit archived label, but each note path contains a note with (non-inheritable)
+ // archived label
+
+ const bestNotePathRecord = this.getSortedNotePathRecords()[0];
+
+ if (!bestNotePathRecord) {
+ throw new Error(`No note path available for note '${this.noteId}'`);
+ }
+
+ return bestNotePathRecord.isArchived;
+ }
+
+ hasInheritableArchivedLabel() {
+ for (const attr of this.getAttributes()) {
+ if (attr.name === "archived" && attr.type === LABEL && attr.isInheritable) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // will sort the parents so that the non-archived are first and archived at the end
+ // this is done so that the non-archived paths are always explored as first when looking for note path
+ sortParents() {
+ this.parentBranches.sort((a, b) => {
+ if (a.parentNote?.isArchived) {
+ return 1;
+ } else if (a.parentNote?.isHiddenCompletely()) {
+ return 1;
+ }
+ return 0;
+ });
+
+ this.parents = this.parentBranches.map((branch) => branch.parentNote).filter((note) => !!note) as BNote[];
+ }
+
+ sortChildren() {
+ if (this.children.length === 0) {
+ return;
+ }
+
+ const becca = this.becca;
+
+ this.children.sort((a, b) => {
+ const aBranch = becca.getBranchFromChildAndParent(a.noteId, this.noteId);
+ const bBranch = becca.getBranchFromChildAndParent(b.noteId, this.noteId);
+
+ return (aBranch?.notePosition || 0) - (bBranch?.notePosition || 0) || 0;
+ });
+ }
+
+ /**
+ * This is used for:
+ * - fast searching
+ * - note similarity evaluation
+ *
+ * @returns - returns flattened textual representation of note, prefixes and attributes
+ */
+ getFlatText(): string {
+ if (!this.__flatTextCache) {
+ this.__flatTextCache = `${this.noteId} ${this.type} ${this.mime} `;
+
+ for (const branch of this.parentBranches) {
+ if (branch.prefix) {
+ this.__flatTextCache += `${branch.prefix} `;
+ }
+ }
+
+ this.__flatTextCache += `${this.title} `;
+
+ for (const attr of this.getAttributes()) {
+ // it's best to use space as separator since spaces are filtered from the search string by the tokenization into words
+ this.__flatTextCache += `${attr.type === "label" ? "#" : "~"}${attr.name}`;
+
+ if (attr.value) {
+ this.__flatTextCache += `=${attr.value}`;
+ }
+
+ this.__flatTextCache += " ";
+ }
+
+ this.__flatTextCache = normalize(this.__flatTextCache);
+ }
+
+ return this.__flatTextCache as string;
+ }
+
+ invalidateThisCache() {
+ this.__flatTextCache = null;
+
+ this.__attributeCache = null;
+ this.__inheritableAttributeCache = null;
+ this.__ancestorCache = null;
+ }
+
+ invalidateSubTree(path: string[] = []) {
+ if (path.includes(this.noteId)) {
+ return;
+ }
+
+ this.invalidateThisCache();
+
+ if (this.children.length || this.targetRelations.length) {
+ path = [...path, this.noteId];
+ }
+
+ for (const childNote of this.children) {
+ childNote.invalidateSubTree(path);
+ }
+
+ for (const targetRelation of this.targetRelations) {
+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {
+ const note = targetRelation.note;
+
+ if (note) {
+ note.invalidateSubTree(path);
+ }
+ }
+ }
+ }
+
+ getRelationDefinitions() {
+ return this.getLabels().filter((l) => l.name.startsWith("relation:"));
+ }
+
+ getLabelDefinitions() {
+ return this.getLabels().filter((l) => l.name.startsWith("relation:"));
+ }
+
+ isInherited() {
+ return !!this.targetRelations.find((rel) => rel.name === "template" || rel.name === "inherit");
+ }
+
+ getSubtreeNotesIncludingTemplated(): BNote[] {
+ const set = new Set<BNote>();
+
+ function inner(note: BNote) {
+ // _hidden is not counted as subtree for the purpose of inheritance
+ if (set.has(note) || note.noteId === "_hidden") {
+ return;
+ }
+
+ set.add(note);
+
+ for (const childNote of note.children) {
+ inner(childNote);
+ }
+
+ for (const targetRelation of note.targetRelations) {
+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {
+ const targetNote = targetRelation.note;
+
+ if (targetNote) {
+ inner(targetNote);
+ }
+ }
+ }
+ }
+
+ inner(this);
+
+ return Array.from(set);
+ }
+
+ getSearchResultNotes(): BNote[] {
+ if (this.type !== "search") {
+ return [];
+ }
+
+ try {
+ const result = searchService.searchFromNote(this);
+ const becca = this.becca;
+ return result.searchResultNoteIds.map((resultNoteId) => becca.notes[resultNoteId]).filter((note) => !!note);
+ } catch (e: any) {
+ getLog().error(`Could not resolve search note ${this.noteId}: ${e.message}`);
+ return [];
+ }
+ }
+
+ getSubtree({ includeArchived = true, includeHidden = false, resolveSearch = false } = {}): {
+ notes: BNote[];
+ relationships: Relationship[];
+ } {
+ const noteSet = new Set<BNote>();
+ const relationships: Relationship[] = []; // list of tuples parentNoteId -> childNoteId
+
+ function resolveSearchNote(searchNote: BNote) {
+ try {
+ for (const resultNote of searchNote.getSearchResultNotes()) {
+ addSubtreeNotesInner(resultNote, searchNote);
+ }
+ } catch (e: any) {
+ getLog().error(`Could not resolve search note ${searchNote?.noteId}: ${e.message}`);
+ }
+ }
+
+ function addSubtreeNotesInner(note: BNote, parentNote: BNote | null = null) {
+ if (note.noteId === "_hidden" && !includeHidden) {
+ return;
+ }
+
+ if (parentNote) {
+ // this needs to happen first before noteSet check to include all clone relationships
+ relationships.push({
+ parentNoteId: parentNote.noteId,
+ childNoteId: note.noteId
+ });
+ }
+
+ if (noteSet.has(note)) {
+ return;
+ }
+
+ if (!includeArchived && note.isArchived) {
+ return;
+ }
+
+ noteSet.add(note);
+
+ if (note.type === "search") {
+ if (resolveSearch) {
+ resolveSearchNote(note);
+ }
+ } else {
+ for (const childNote of note.children) {
+ addSubtreeNotesInner(childNote, note);
+ }
+ }
+ }
+
+ addSubtreeNotesInner(this);
+
+ return {
+ notes: Array.from(noteSet),
+ relationships
+ };
+ }
+
+ /** @returns includes the subtree root note as well */
+ getSubtreeNoteIds({ includeArchived = true, includeHidden = false, resolveSearch = false } = {}) {
+ return this.getSubtree({ includeArchived, includeHidden, resolveSearch }).notes.map((note) => note.noteId);
+ }
+
+ /** @deprecated use getSubtreeNoteIds() instead */
+ getDescendantNoteIds() {
+ return this.getSubtreeNoteIds();
+ }
+
+ get parentCount() {
+ return this.parents.length;
+ }
+
+ get childrenCount() {
+ return this.children.length;
+ }
+
+ get labelCount() {
+ return this.getAttributes().filter((attr) => attr.type === "label").length;
+ }
+
+ get ownedLabelCount() {
+ return this.ownedAttributes.filter((attr) => attr.type === "label").length;
+ }
+
+ get relationCount() {
+ return this.getAttributes().filter((attr) => attr.type === "relation" && !attr.isAutoLink()).length;
+ }
+
+ get relationCountIncludingLinks() {
+ return this.getAttributes().filter((attr) => attr.type === "relation").length;
+ }
+
+ get ownedRelationCount() {
+ return this.ownedAttributes.filter((attr) => attr.type === "relation" && !attr.isAutoLink()).length;
+ }
+
+ get ownedRelationCountIncludingLinks() {
+ return this.ownedAttributes.filter((attr) => attr.type === "relation").length;
+ }
+
+ get targetRelationCount() {
+ return this.targetRelations.filter((attr) => !attr.isAutoLink()).length;
+ }
+
+ get targetRelationCountIncludingLinks() {
+ return this.targetRelations.length;
+ }
+
+ get attributeCount() {
+ return this.getAttributes().length;
+ }
+
+ get ownedAttributeCount() {
+ return this.getOwnedAttributes().length;
+ }
+
+ getAncestors() {
+ if (!this.__ancestorCache) {
+ const noteIds = new Set();
+ this.__ancestorCache = [];
+
+ for (const parent of this.parents) {
+ if (noteIds.has(parent.noteId)) {
+ continue;
+ }
+
+ this.__ancestorCache.push(parent);
+ noteIds.add(parent.noteId);
+
+ for (const ancestorNote of parent.getAncestors()) {
+ if (!noteIds.has(ancestorNote.noteId)) {
+ this.__ancestorCache.push(ancestorNote);
+ noteIds.add(ancestorNote.noteId);
+ }
+ }
+ }
+ }
+
+ return this.__ancestorCache;
+ }
+
+ getAncestorNoteIds(): string[] {
+ return this.getAncestors().map((note) => note.noteId);
+ }
+
+ hasAncestor(ancestorNoteId: string): boolean {
+ for (const ancestorNote of this.getAncestors()) {
+ if (ancestorNote.noteId === ancestorNoteId) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ isInHiddenSubtree() {
+ return this.noteId === "_hidden" || this.hasAncestor("_hidden");
+ }
+
+ getTargetRelations() {
+ return this.targetRelations;
+ }
+
+ /** @returns returns only notes which are templated, does not include their subtrees
+ * in effect returns notes which are influenced by note's non-inheritable attributes */
+ getInheritingNotes(): BNote[] {
+ const arr: BNote[] = [this];
+
+ for (const targetRelation of this.targetRelations) {
+ if (targetRelation.name === "template" || targetRelation.name === "inherit") {
+ const note = targetRelation.note;
+
+ if (note) {
+ arr.push(note);
+ }
+ }
+ }
+
+ return arr;
+ }
+
+ getDistanceToAncestor(ancestorNoteId: string) {
+ if (this.noteId === ancestorNoteId) {
+ return 0;
+ }
+
+ let minDistance = 999999;
+
+ for (const parent of this.parents) {
+ minDistance = Math.min(minDistance, parent.getDistanceToAncestor(ancestorNoteId) + 1);
+ }
+
+ return minDistance;
+ }
+
+ getRevisions(): BRevision[] {
+ return getSql().getRows<RevisionRow>("SELECT * FROM revisions WHERE noteId = ? ORDER BY revisions.utcDateCreated ASC", [this.noteId]).map((row) => new BRevision(row));
+ }
+
+ getAttachments() {
+ const query = /*sql*/`\
+ SELECT attachments.*, LENGTH(blobs.content) AS contentLength
+ FROM attachments
+ JOIN blobs USING (blobId)
+ WHERE ownerId = ? AND isDeleted = 0
+ ORDER BY position`;
+
+ return getSql().getRows<AttachmentRow>(query, [this.noteId]).map((row) => new BAttachment(row));
+ }
+
+ getAttachmentById(attachmentId: string) {
+ const query = /*sql*/`\
+ SELECT attachments.*, LENGTH(blobs.content) AS contentLength
+ FROM attachments
+ JOIN blobs USING (blobId)
+ WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0`;
+
+ return getSql().getRows<AttachmentRow>(query, [this.noteId, attachmentId]).map((row) => new BAttachment(row))[0];
+ }
+
+ getAttachmentsByRole(role: string): BAttachment[] {
+ return getSql()
+ .getRows<AttachmentRow>(
+ `
+ SELECT attachments.*
+ FROM attachments
+ WHERE ownerId = ?
+ AND role = ?
+ AND isDeleted = 0
+ ORDER BY position`,
+ [this.noteId, role]
+ )
+ .map((row) => new BAttachment(row));
+ }
+
+ getAttachmentByTitle(title: string): BAttachment | undefined {
+ // cannot use SQL to filter by title since it can be encrypted
+ return this.getAttachments().filter((attachment) => attachment.title === title)[0];
+ }
+
+ /**
+ * Gives all possible note paths leading to this note. Paths containing search note are ignored (could form cycles)
+ *
+ * @returns array of notePaths (each represented by array of noteIds constituting the particular note path)
+ */
+ getAllNotePaths(): string[][] {
+ if (this.noteId === "root") {
+ return [["root"]];
+ }
+
+ const parentNotes = this.getParentNotes();
+
+ const notePaths =
+ parentNotes.length === 1
+ ? parentNotes[0].getAllNotePaths() // optimization for the most common case
+ : parentNotes.flatMap((parentNote) => parentNote.getAllNotePaths());
+
+ for (const notePath of notePaths) {
+ notePath.push(this.noteId);
+ }
+
+ return notePaths;
+ }
+
+ getSortedNotePathRecords(hoistedNoteId: string = "root"): NotePathRecord[] {
+ const isHoistedRoot = hoistedNoteId === "root";
+
+ const notePaths = this.getAllNotePaths().map((path) => ({
+ notePath: path,
+ isInHoistedSubTree: isHoistedRoot || path.includes(hoistedNoteId),
+ isArchived: path.some((noteId) => this.becca.notes[noteId].isArchived),
+ isHidden: path.includes("_hidden")
+ }));
+
+ notePaths.sort((a, b) => {
+ if (a.isInHoistedSubTree !== b.isInHoistedSubTree) {
+ return a.isInHoistedSubTree ? -1 : 1;
+ } else if (a.isArchived !== b.isArchived) {
+ return a.isArchived ? 1 : -1;
+ } else if (a.isHidden !== b.isHidden) {
+ return a.isHidden ? 1 : -1;
+ }
+ return a.notePath.length - b.notePath.length;
+ });
+
+ return notePaths;
+ }
+
+ /**
+ * Returns a note path considered to be the "best"
+ *
+ * @return array of noteIds constituting the particular note path
+ */
+ getBestNotePath(hoistedNoteId: string = "root"): string[] {
+ return this.getSortedNotePathRecords(hoistedNoteId)[0]?.notePath;
+ }
+
+ /**
+ * Returns a note path considered to be the "best"
+ *
+ * @return serialized note path (e.g. 'root/a1h315/js725h')
+ */
+ getBestNotePathString(hoistedNoteId: string = "root"): string {
+ const notePath = this.getBestNotePath(hoistedNoteId);
+
+ return notePath?.join("/");
+ }
+
+ /**
+ * @return boolean - true if there's no non-hidden path, note is not cloned to the visible tree
+ */
+ isHiddenCompletely() {
+ if (this.noteId === "root") {
+ return false;
+ }
+
+ for (const parentNote of this.parents) {
+ if (parentNote.noteId === "root") {
+ return false;
+ } else if (parentNote.noteId === "_hidden") {
+ continue;
+ } else if (!parentNote.isHiddenCompletely()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @returns true if ancestorNoteId occurs in at least one of the note's paths
+ */
+ isDescendantOfNote(ancestorNoteId: string): boolean {
+ const notePaths = this.getAllNotePaths();
+
+ return notePaths.some((path) => path.includes(ancestorNoteId));
+ }
+
+ /**
+ * Update's given attribute's value or creates it if it doesn't exist
+ *
+ * @param type - attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @param value - attribute value (optional)
+ */
+ setAttribute(type: AttributeType, name: string, value?: string) {
+ const attributes = this.getOwnedAttributes();
+ const attr = attributes.find((attr) => attr.type === type && attr.name === name);
+
+ value = value?.toString() || "";
+
+ if (attr) {
+ if (attr.value !== value) {
+ attr.value = value;
+ attr.save();
+ }
+ } else {
+ new BAttribute({
+ noteId: this.noteId,
+ type,
+ name,
+ value
+ }).save();
+ }
+ }
+
+ /**
+ * Removes given attribute name-value pair if it exists.
+ *
+ * @param type - attribute type (label, relation, etc.)
+ * @param name - attribute name
+ * @param value - attribute value (optional)
+ */
+ removeAttribute(type: string, name: string, value?: string) {
+ const attributes = this.getOwnedAttributes();
+
+ for (const attribute of attributes) {
+ if (attribute.type === type && attribute.name === name && (value === undefined || value === attribute.value)) {
+ attribute.markAsDeleted();
+ }
+ }
+ }
+
+ /**
+ * Adds a new attribute to this note. The attribute is saved and returned.
+ * See addLabel, addRelation for more specific methods.
+ *
+ * @param type - attribute type (label / relation)
+ * @param name - name of the attribute, not including the leading ~/#
+ * @param value - value of the attribute - text for labels, target note ID for relations; optional.
+ */
+ addAttribute(type: AttributeType, name: string, value: string = "", isInheritable: boolean = false, position: number | null = null): BAttribute {
+ return new BAttribute({
+ noteId: this.noteId,
+ type,
+ name,
+ value,
+ isInheritable,
+ position
+ }).save();
+ }
+
+ /**
+ * Adds a new label to this note. The label attribute is saved and returned.
+ *
+ * @param name - name of the label, not including the leading #
+ * @param value - text value of the label; optional
+ */
+ addLabel(name: string, value: string = "", isInheritable: boolean = false): BAttribute {
+ return this.addAttribute(LABEL, name, value, isInheritable);
+ }
+
+ /**
+ * Adds a new relation to this note. The relation attribute is saved and
+ * returned.
+ *
+ * @param name - name of the relation, not including the leading ~
+ */
+ addRelation(name: string, targetNoteId: string, isInheritable: boolean = false): BAttribute {
+ return this.addAttribute(RELATION, name, targetNoteId, isInheritable);
+ }
+
+ /**
+ * Based on enabled, the attribute is either set or removed.
+ *
+ * @param type - attribute type ('relation', 'label' etc.)
+ * @param enabled - toggle On or Off
+ * @param name - attribute name
+ * @param value - attribute value (optional)
+ */
+ toggleAttribute(type: AttributeType, enabled: boolean, name: string, value?: string) {
+ if (enabled) {
+ this.setAttribute(type, name, value);
+ } else {
+ this.removeAttribute(type, name, value);
+ }
+ }
+
+ /**
+ * Based on enabled, label is either set or removed.
+ *
+ * @param enabled - toggle On or Off
+ * @param name - label name
+ * @param value - label value (optional)
+ */
+ toggleLabel(enabled: boolean, name: string, value?: string) {
+ return this.toggleAttribute(LABEL, enabled, name, value);
+ }
+
+ /**
+ * Based on enabled, relation is either set or removed.
+ *
+ * @param enabled - toggle On or Off
+ * @param name - relation name
+ * @param value - relation value (noteId)
+ */
+ toggleRelation(enabled: boolean, name: string, value?: string) {
+ return this.toggleAttribute(RELATION, enabled, name, value);
+ }
+
+ /**
+ * Update's given label's value or creates it if it doesn't exist
+ *
+ * @param name - label name
+ * @param value label value
+ */
+ setLabel(name: string, value?: string) {
+ return this.setAttribute(LABEL, name, value);
+ }
+
+ /**
+ * Update's given relation's value or creates it if it doesn't exist
+ *
+ * @param name - relation name
+ * @param value - relation value (noteId)
+ */
+ setRelation(name: string, value?: string) {
+ return this.setAttribute(RELATION, name, value);
+ }
+
+ /**
+ * Remove label name-value pair, if it exists.
+ *
+ * @param name - label name
+ * @param value - label value
+ */
+ removeLabel(name: string, value?: string) {
+ return this.removeAttribute(LABEL, name, value);
+ }
+
+ /**
+ * Remove the relation name-value pair, if it exists.
+ *
+ * @param name - relation name
+ * @param value - relation value (noteId)
+ */
+ removeRelation(name: string, value?: string) {
+ return this.removeAttribute(RELATION, name, value);
+ }
+
+ searchNotesInSubtree(searchString: string) {
+ return searchService.searchNotes(searchString) as BNote[];
+ }
+
+ searchNoteInSubtree(searchString: string) {
+ return this.searchNotesInSubtree(searchString)[0];
+ }
+
+ cloneTo(parentNoteId: string): CloneResponse {
+ const branch = this.becca.getNote(parentNoteId)?.getParentBranches()[0];
+ if (!branch?.branchId) {
+ return {
+ success: false,
+ message: "Unable to find the branch ID to clone."
+ };
+ }
+
+ return cloningService.cloneNoteToBranch(this.noteId, branch.branchId);
+ }
+
+ isEligibleForConversionToAttachment(opts: ConvertOpts = { autoConversion: false }) {
+ if (this.type !== "image" || !this.isContentAvailable() || this.hasChildren() || this.getParentBranches().length !== 1) {
+ return false;
+ }
+
+ const targetRelations = this.getTargetRelations().filter((relation) => relation.name === "imageLink");
+
+ if (opts.autoConversion && targetRelations.length === 0) {
+ return false;
+ } else if (targetRelations.length > 1) {
+ return false;
+ }
+
+ const parentNote = this.getParentNotes()[0]; // at this point note can have only one parent
+ const referencingNote = targetRelations[0]?.getNote();
+
+ if (referencingNote && parentNote !== referencingNote) {
+ return false;
+ } else if (parentNote.type !== "text" || !parentNote.isContentAvailable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Some notes are eligible for conversion into an attachment of its parent, note must have these properties:
+ * - it has exactly one target relation
+ * - it has a relation from its parent note
+ * - it has no children
+ * - it has no clones
+ * - the parent is of type text
+ * - both notes are either unprotected or user is in protected session
+ *
+ * Currently, works only for image notes.
+ *
+ * In the future, this functionality might get more generic and some of the requirements relaxed.
+ *
+ * @returns null if note is not eligible for conversion
+ */
+ convertToParentAttachment(opts: ConvertOpts = { autoConversion: false }): BAttachment | null {
+ if (!this.isEligibleForConversionToAttachment(opts)) {
+ return null;
+ }
+
+ const content = this.getContent();
+
+ const parentNote = this.getParentNotes()[0];
+ const attachment = parentNote.saveAttachment({
+ role: "image",
+ mime: this.mime,
+ title: this.title,
+ content
+ });
+
+ const parentContent = parentNote.getContent();
+
+ const oldNoteUrl = `api/images/${this.noteId}/`;
+ const newAttachmentUrl = `api/attachments/${attachment.attachmentId}/image/`;
+
+ if (typeof parentContent !== "string") {
+ throw new Error("Unable to convert image note into attachment because parent note does not have a string content.");
+ }
+
+ const fixedContent = replaceAll(parentContent, oldNoteUrl, newAttachmentUrl);
+
+ parentNote.setContent(fixedContent);
+
+ noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
+
+ this.deleteNote();
+
+ return attachment;
+ }
+
+ /**
+ * (Soft) delete a note and all its descendants.
+ *
+ * @param deleteId - optional delete identified
+ */
+ deleteNote(deleteId: string | null = null, taskContext: TaskContext<"deleteNotes"> | null = null) {
+ if (this.isDeleted) {
+ return;
+ }
+
+ if (!deleteId) {
+ deleteId = randomString(10);
+ }
+
+ if (!taskContext) {
+ taskContext = new TaskContext("no-progress-reporting", "deleteNotes", null);
+ }
+
+ // needs to be run before branches and attributes are deleted and thus attached relations disappear
+ handlers.runAttachedRelations(this, "runOnNoteDeletion", this);
+ taskContext.noteDeletionHandlerTriggered = true;
+
+ for (const branch of this.getParentBranches()) {
+ branch.deleteBranch(deleteId ?? undefined, taskContext);
+ }
+ }
+
+ decrypt() {
+ if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
+ try {
+ this.title = protectedSessionService.decryptString(this.title) || "";
+ this.__flatTextCache = null;
+
+ this.isDecrypted = true;
+ } catch (e: any) {
+ getLog().error(`Could not decrypt note ${this.noteId}: ${e.message} ${e.stack}`);
+ }
+ }
+ }
+
+ isLaunchBarConfig() {
+ return this.type === "launcher"
+ || ["_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(this.noteId)
+ || ["_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers"].includes(this.noteId);
+ }
+
+ isOptions() {
+ return this.noteId.startsWith("_options");
+ }
+
+ override get isDeleted() {
+ // isBeingDeleted is relevant only in the transition period when the deletion process has begun, but not yet
+ // finished (note is still in becca)
+ return !(this.noteId in this.becca.notes) || this.isBeingDeleted;
+ }
+
+ saveRevision(): BRevision {
+ return getSql().transactional(() => {
+ let noteContent = this.getContent();
+
+ const revision = new BRevision(
+ {
+ noteId: this.noteId,
+ // title and text should be decrypted now
+ title: this.title,
+ type: this.type,
+ mime: this.mime,
+ isProtected: this.isProtected,
+ utcDateLastEdited: this.utcDateModified,
+ utcDateCreated: dateUtils.utcNowDateTime(),
+ utcDateModified: dateUtils.utcNowDateTime(),
+ dateLastEdited: this.dateModified,
+ dateCreated: dateUtils.localNowDateTime()
+ },
+ true
+ );
+
+ revision.save(); // to generate revisionId, which is then used to save attachments
+
+ for (const noteAttachment of this.getAttachments()) {
+ const revisionAttachment = noteAttachment.copy();
+
+ if (!revision.revisionId) {
+ throw new Error("Revision ID is missing.");
+ }
+
+ revisionAttachment.ownerId = revision.revisionId;
+ revisionAttachment.setContent(noteAttachment.getContent(), { forceSave: true });
+
+ if (this.type === "text" && typeof noteContent === "string") {
+ // content is rewritten to point to the revision attachments
+ noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`, `attachments/${revisionAttachment.attachmentId}`);
+
+ noteContent = noteContent.replaceAll(
+ new RegExp(`href="[^"]*attachmentId=${noteAttachment.attachmentId}[^"]*"`, "gi"),
+ `href="api/attachments/${revisionAttachment.attachmentId}/download"`
+ );
+ }
+ }
+
+ revision.setContent(noteContent);
+
+ this.eraseExcessRevisionSnapshots();
+ return revision;
+ });
+ }
+
+ // Limit the number of Snapshots to revisionSnapshotNumberLimit
+ // Delete older Snapshots that exceed the limit
+ eraseExcessRevisionSnapshots() {
+ // label has a higher priority
+ let revisionSnapshotNumberLimit = parseInt(this.getLabelValue("versioningLimit") ?? "");
+ if (!Number.isInteger(revisionSnapshotNumberLimit)) {
+ revisionSnapshotNumberLimit = parseInt(optionService.getOption("revisionSnapshotNumberLimit"));
+ }
+ if (revisionSnapshotNumberLimit >= 0) {
+ const revisions = this.getRevisions();
+ if (revisions.length - revisionSnapshotNumberLimit > 0) {
+ const revisionIds = revisions
+ .slice(0, revisions.length - revisionSnapshotNumberLimit)
+ .map((revision) => revision.revisionId)
+ .filter((id): id is string => id !== undefined);
+ eraseService.eraseRevisions(revisionIds);
+ }
+ }
+ }
+
+ /**
+ * @param matchBy - choose by which property we detect if to update an existing attachment.
+ * Supported values are either 'attachmentId' (default) or 'title'
+ */
+ saveAttachment({ attachmentId, role, mime, title, content, position }: Omit<AttachmentRow, "ownerId">, matchBy: "attachmentId" | "title" | undefined = "attachmentId") {
+ if (!["attachmentId", "title"].includes(matchBy)) {
+ throw new Error(`Unsupported value '${matchBy}' for matchBy param, has to be either 'attachmentId' or 'title'.`);
+ }
+
+ let attachment;
+
+ if (matchBy === "title" && title) {
+ attachment = this.getAttachmentByTitle(title);
+ } else if (matchBy === "attachmentId" && attachmentId) {
+ attachment = this.becca.getAttachmentOrThrow(attachmentId);
+ }
+
+ attachment =
+ attachment ||
+ new BAttachment({
+ ownerId: this.noteId,
+ title,
+ role,
+ mime,
+ isProtected: this.isProtected,
+ position
+ });
+
+ content = content || "";
+ attachment.setContent(content, { forceSave: true });
+
+ return attachment;
+ }
+
+ getFileName() {
+ return formatDownloadTitle(this.title, this.type, this.mime);
+ }
+
+ override beforeSaving() {
+ super.beforeSaving();
+
+ this.becca.addNote(this.noteId, this);
+
+ this.dateModified = dateUtils.localNowDateTime();
+ this.utcDateModified = dateUtils.utcNowDateTime();
+ }
+
+ getPojo(): NotePojo {
+ return {
+ noteId: this.noteId,
+ title: this.title,
+ isProtected: this.isProtected,
+ type: this.type,
+ mime: this.mime,
+ blobId: this.blobId,
+ isDeleted: false,
+ dateCreated: this.dateCreated,
+ dateModified: this.dateModified,
+ utcDateCreated: this.utcDateCreated,
+ utcDateModified: this.utcDateModified
+ };
+ }
+
+ override getPojoToSave() {
+ const pojo = this.getPojo();
+
+ if (pojo.isProtected) {
+ if (this.isDecrypted && pojo.title) {
+ pojo.title = protectedSessionService.encrypt(pojo.title) || undefined;
+ } else {
+ // updating protected note outside of protected session means we will keep original ciphertexts
+ delete pojo.title;
+ }
+ }
+
+ return pojo;
+ }
+
+ getIcon() {
- return `tn-icon ${this.#getIconInternal()}`;
- }
-
- // TODO: Deduplicate with fnote
- #getIconInternal() {
+ const iconClassLabels = this.getLabels("iconClass");
++ const icon = getNoteIcon({
++ noteId: this.noteId,
++ type: this.type,
++ mime: this.mime,
++ iconClass: iconClassLabels.length > 0 ? iconClassLabels[0].value : undefined,
++ workspaceIconClass: undefined,
++ isFolder: this.isFolder.bind(this)
++ });
+
- if (iconClassLabels && iconClassLabels.length > 0) {
- return iconClassLabels[0].value;
- } else if (this.noteId === "root") {
- return "bx bx-home-alt-2";
- }
- if (this.noteId === "_share") {
- return "bx bx-share-alt";
- } else if (this.type === "text") {
- if (this.isFolder()) {
- return "bx bx-folder";
- }
- return "bx bx-note";
-
- } else if (this.type === "code" && this.mime.startsWith("text/x-sql")) {
- return "bx bx-data";
- }
- return NOTE_TYPE_ICONS[this.type];
++ return `tn-icon ${icon}`;
+ }
+
+ // TODO: Deduplicate with fnote
+ isFolder() {
+ return this.type === "search" || this.getFilteredChildBranches().length > 0;
+ }
+
+ // TODO: Deduplicate with fnote
+ getFilteredChildBranches() {
+ const childBranches = this.getChildBranches();
+
+ if (!childBranches) {
+ console.error(`No children for '${this.noteId}'. This shouldn't happen.`);
+ return [];
+ }
+
+ // we're not checking hideArchivedNotes since that would mean we need to lazy load the child notes
+ // which would seriously slow down everything.
+ // we check this flag only once user chooses to expand the parent. This has the negative consequence that
+ // note may appear as a folder but not contain any children when all of them are archived
+
+ return childBranches;
+ }
+
+ get encodedTitle() {
+ return encodeURIComponent(this.title);
+ }
+
+ getVisibleChildBranches() {
+ return this.getChildBranches().filter((branch) => !branch.getNote().isLabelTruthy("shareHiddenFromTree"));
+ }
+
+ getVisibleChildNotes() {
+ return this.getVisibleChildBranches().map((branch) => branch.getNote());
+ }
+
+ hasVisibleChildren() {
+ return this.getVisibleChildNotes().length > 0;
+ }
+
+ get shareId() {
+ return this.noteId;
+ }
+
+ /**
+ * Return an attribute by it's attributeId. Requires the attribute cache to be available.
+ * @param attributeId - the id of the attribute owned by this note
+ * @returns - the BAttribute with the given id or undefined if not found.
+ */
+ getAttributeById(attributeId : string): BAttribute | undefined {
+ this.__ensureAttributeCacheIsAvailable();
+
+ if (!this.__attributeCache) {
+ throw new Error("Attribute cache not available.");
+ }
+
+ return this.__attributeCache.find((attr) => attr.attributeId === attributeId);
+ }
+
+ /**
+ * Sets an attribute's value by it's attributeId.
+ * @param attributeId - the id of the attribute owned by this note
+ * @param value - the new value to replace
+ */
+ setAttributeValueById(attributeId : string, value? : string) {
+ const attributes = this.getOwnedAttributes();
+ const attr = attributes.find((attr) => attr.attributeId === attributeId);
+
+ value = value?.toString() || "";
+
+ if (attr) {
+ if (attr.value !== value) {
+ attr.value = value;
+ attr.save();
+ }
+ } else {
+ throw new Error(`Attribute with id ${attributeId} not found.`);
+ }
+ }
+}
+
+export default BNote;
diff --cc packages/trilium-core/src/services/notes.ts
index a62a8e7d56,0000000000..a02a51f48e
mode 100644,000000..100644
--- a/packages/trilium-core/src/services/notes.ts
+++ b/packages/trilium-core/src/services/notes.ts
@@@ -1,1117 -1,0 +1,1127 @@@
+import type { AttachmentRow, AttributeRow, BranchRow, NoteRow, NoteType } from "@triliumnext/commons";
+import { dayjs } from "@triliumnext/commons";
+import date_utils from "../services/utils/date";
+import eventService from "../services/events";
+import { ValidationError } from "../errors.js";
+import fs from "fs";
+import html2plaintext from "html2plaintext";
+import { t } from "i18next";
+import path from "path";
+import url from "url";
+
+import becca from "../becca/becca.js";
+import BAttachment from "../becca/entities/battachment.js";
+import BAttribute from "../becca/entities/battribute.js";
+import BBranch from "../becca/entities/bbranch.js";
+import BNote from "../becca/entities/bnote.js";
+import * as cls from "../services/context.js";
+import protectedSessionService from "../services/protected_session.js";
+import { newEntityId, quoteRegex, toMap, unescapeHtml } from "./utils/index.js";
+import entityChangesService from "./entity_changes.js";
+import imageService from "./image.js";
+import noteTypesService from "./note_types.js";
+import optionService from "./options.js";
+import request from "./request.js";
+import revisionService from "./revisions.js";
+import type TaskContext from "./task_context.js";
+import ws from "./ws.js";
+import { getSql } from "./sql/index.js";
+import { getLog } from "./log.js";
+import { decodeBase64 } from "./utils/binary.js";
+import { sanitizeHtml } from "./sanitizer.js";
+
+interface FoundLink {
+ name: "imageLink" | "internalLink" | "includeNoteLink" | "relationMapLink";
+ value: string;
+}
+
+interface Attachment {
+ attachmentId?: string;
+ title: string;
+}
+
+export interface NoteParams {
+ /** optionally can force specific noteId */
+ noteId?: string;
+ branchId?: string;
+ parentNoteId: string;
+ templateNoteId?: string;
+ title: string;
+ content: string | Uint8Array;
+ /** text, code, file, image, search, book, relationMap, canvas, webView */
+ type: NoteType;
+ /** default value is derived from default mimes for type */
+ mime?: string;
+ /** default is false */
+ isProtected?: boolean;
+ /** default is false */
+ isExpanded?: boolean;
+ /** default is empty string */
+ prefix?: string;
+ /** default is the last existing notePosition in a parent + 10 */
+ notePosition?: number;
+ dateCreated?: string;
+ utcDateCreated?: string;
+ ignoreForbiddenParents?: boolean;
+ target?: "into";
++ /** Attributes to be set on the note. These are set atomically on note creation, so entity changes are not sent for attributes defined here. */
++ attributes?: Omit<AttributeRow, "noteId" | "attributeId">[];
+}
+
+function getNewNotePosition(parentNote: BNote) {
+ if (parentNote.isLabelTruthy("newNotesOnTop")) {
+ const minNotePos = parentNote
+ .getChildBranches()
+ .filter((branch) => branch?.noteId !== "_hidden") // has "always last" note position
+ .reduce((min, note) => Math.min(min, note?.notePosition || 0), 0);
+
+ return minNotePos - 10;
+ }
+ const maxNotePos = parentNote
+ .getChildBranches()
+ .filter((branch) => branch?.noteId !== "_hidden") // has "always last" note position
+ .reduce((max, note) => Math.max(max, note?.notePosition || 0), 0);
+
+ return maxNotePos + 10;
+
+}
+
+function triggerNoteTitleChanged(note: BNote) {
+ eventService.emit(eventService.NOTE_TITLE_CHANGED, note);
+}
+
+function deriveMime(type: string, mime?: string) {
+ if (!type) {
+ throw new Error(`Note type is a required param`);
+ }
+
+ if (mime) {
+ return mime;
+ }
+
+ return noteTypesService.getDefaultMimeForNoteType(type);
+}
+
+function copyChildAttributes(parentNote: BNote, childNote: BNote) {
+ for (const attr of parentNote.getAttributes()) {
+ if (attr.name.startsWith("child:")) {
+ const name = attr.name.substring(6);
+ const hasAlreadyTemplate = childNote.hasRelation("template");
+
+ if (hasAlreadyTemplate && attr.type === "relation" && name === "template") {
+ // if the note already has a template, it means the template was chosen by the user explicitly
+ // in the menu. In that case, we should override the default templates defined in the child: attrs
+ continue;
+ }
+
+ new BAttribute({
+ noteId: childNote.noteId,
+ type: attr.type,
+ name,
+ value: attr.value,
+ position: attr.position,
+ isInheritable: attr.isInheritable
+ }).save();
+ }
+ }
+}
+
+function copyAttachments(origNote: BNote, newNote: BNote) {
+ for (const attachment of origNote.getAttachments()) {
+ if (attachment.role === "image") {
+ // Handled separately, see `checkImageAttachments`.
+ continue;
+ }
+
+ const newAttachment = new BAttachment({
+ ...attachment,
+ attachmentId: undefined,
+ ownerId: newNote.noteId
+ });
+
+ newAttachment.save();
+ }
+}
+
+function getNewNoteTitle(parentNote: BNote) {
+ let title = t("notes.new-note");
+
+ const titleTemplate = parentNote.getLabelValue("titleTemplate");
+
+ if (titleTemplate !== null) {
+ try {
+ const now = dayjs(date_utils.localNowDateTime() || new Date());
+
+ // "officially" injected values:
+ // - now
+ // - parentNote
+
+ title = eval(`\`${titleTemplate}\``);
+ } catch (e: any) {
+ getLog().error(`Title template of note '${parentNote.noteId}' failed with: ${e.message}`);
+ }
+ }
+
+ // this isn't in theory a good place to sanitize title, but this will catch a lot of XSS attempts.
+ // title is supposed to contain text only (not HTML) and be printed text only, but given the number of usages,
+ // it's difficult to guarantee correct handling in all cases
+ title = sanitizeHtml(title);
+
+ return title;
+}
+
+interface GetValidateParams {
+ parentNoteId: string;
+ type: string;
+ ignoreForbiddenParents?: boolean;
+}
+
+function getAndValidateParent(params: GetValidateParams) {
+ const parentNote = becca.notes[params.parentNoteId];
+
+ if (!parentNote) {
+ throw new ValidationError(`Parent note '${params.parentNoteId}' was not found.`);
+ }
+
+ if (parentNote.type === "launcher" && parentNote.noteId !== "_lbBookmarks") {
+ throw new ValidationError(`Creating child notes into launcher notes is not allowed.`);
+ }
+
+ if (["_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(params.parentNoteId) && params.type !== "launcher") {
+ throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);
+ }
+
+ if (!params.ignoreForbiddenParents) {
+ if (["_lbRoot", "_hidden"].includes(parentNote.noteId)
+ || parentNote.noteId.startsWith("_lbTpl")
+ || parentNote.noteId.startsWith("_help")
+ || parentNote.isOptions()) {
+ throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
+ }
+ }
+
+ return parentNote;
+}
+
+function createNewNote(params: NoteParams): {
+ note: BNote;
+ branch: BBranch;
+} {
+ const parentNote = getAndValidateParent(params);
+
+ if (params.title === null || params.title === undefined) {
+ params.title = getNewNoteTitle(parentNote);
+ }
+
+ if (params.content === null || params.content === undefined) {
+ throw new Error(`Note content must be set`);
+ }
+
+ let error;
+ if ((error = date_utils.validateLocalDateTime(params.dateCreated))) {
+ throw new Error(error);
+ }
+
+ if ((error = date_utils.validateUtcDateTime(params.utcDateCreated))) {
+ throw new Error(error);
+ }
+
+ return getSql().transactional(() => {
+ let note, branch, isEntityEventsDisabled;
+
+ try {
+ isEntityEventsDisabled = cls.isEntityEventsDisabled();
+
+ if (!isEntityEventsDisabled) {
+ // it doesn't make sense to run note creation events on a partially constructed note, so
+ // defer them until note creation is completed
+ cls.disableEntityEvents();
+ }
+
+ // TODO: think about what can happen if the note already exists with the forced ID
+ // I guess on DB it's going to be fine, but becca references between entities
+ // might get messed up (two note instances for the same ID existing in the references)
+ note = new BNote({
+ noteId: params.noteId, // optionally can force specific noteId
+ title: params.title,
+ isProtected: !!params.isProtected,
+ type: params.type,
+ mime: deriveMime(params.type, params.mime),
+ dateCreated: params.dateCreated,
+ utcDateCreated: params.utcDateCreated
+ }).save();
+
++ // Create attributes atomically.
++ for (const attribute of params.attributes || []) {
++ new BAttribute({
++ ...attribute,
++ noteId: note.noteId
++ }).save();
++ }
++
+ note.setContent(params.content);
+
+ branch = new BBranch({
+ noteId: note.noteId,
+ parentNoteId: params.parentNoteId,
+ notePosition: params.notePosition !== undefined ? params.notePosition : getNewNotePosition(parentNote),
+ prefix: params.prefix || "",
+ isExpanded: !!params.isExpanded
+ }).save();
+ } finally {
+ if (!isEntityEventsDisabled) {
+ // re-enable entity events only if they were previously enabled
+ // (they can be disabled in case of import)
+ cls.enableEntityEvents();
+ }
+ }
+
+ if (params.templateNoteId) {
+ const templateNote = becca.getNote(params.templateNoteId);
+ if (!templateNote) {
+ throw new Error(`Template note '${params.templateNoteId}' does not exist.`);
+ }
+
+ note.addRelation("template", params.templateNoteId);
+ copyAttachments(templateNote, note);
+
+ // no special handling for ~inherit since it doesn't matter if it's assigned with the note creation or later
+ }
+
+ copyChildAttributes(parentNote, note);
+
+ eventService.emit(eventService.ENTITY_CREATED, { entityName: "notes", entity: note });
+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "notes", entity: note });
+ triggerNoteTitleChanged(note);
+ // blobs entity doesn't use "created" event
+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "blobs", entity: note });
+ eventService.emit(eventService.ENTITY_CREATED, { entityName: "branches", entity: branch });
+ eventService.emit(eventService.ENTITY_CHANGED, { entityName: "branches", entity: branch });
+ eventService.emit(eventService.CHILD_NOTE_CREATED, { childNote: note, parentNote });
+
+ getLog().info(`Created new note '${note.noteId}', branch '${branch.branchId}' of type '${note.type}', mime '${note.mime}'`);
+
+ return {
+ note,
+ branch
+ };
+ });
+}
+
+function createNewNoteWithTarget(target: "into" | "after" | "before", targetBranchId: string | undefined, params: NoteParams) {
+ if (!params.type) {
+ const parentNote = becca.notes[params.parentNoteId];
+
+ // code note type can be inherited, otherwise "text" is the default
+ params.type = parentNote.type === "code" ? "code" : "text";
+ params.mime = parentNote.type === "code" ? parentNote.mime : "text/html";
+ }
+
+ if (target === "into") {
+ return createNewNote(params);
+ } else if (target === "after" && targetBranchId) {
+ const afterBranch = becca.branches[targetBranchId];
+
+ // not updating utcDateModified to avoid having to sync whole rows
+ getSql().execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0", [params.parentNoteId, afterBranch.notePosition]);
+
+ params.notePosition = afterBranch.notePosition + 10;
+
+ const retObject = createNewNote(params);
+
+ entityChangesService.putNoteReorderingEntityChange(params.parentNoteId);
+
+ return retObject;
+ } else if (target === "before" && targetBranchId) {
+ const beforeBranch = becca.branches[targetBranchId];
+
+ // not updating utcDateModified to avoid having to sync whole rows
+ getSql().execute("UPDATE branches SET notePosition = notePosition - 10 WHERE parentNoteId = ? AND notePosition < ? AND isDeleted = 0", [params.parentNoteId, beforeBranch.notePosition]);
+
+ params.notePosition = beforeBranch.notePosition - 10;
+
+ const retObject = createNewNote(params);
+
+ entityChangesService.putNoteReorderingEntityChange(params.parentNoteId);
+
+ return retObject;
+ }
+ throw new Error(`Unknown target '${target}'`);
+
+}
+
+function protectNoteRecursively(note: BNote, protect: boolean, includingSubTree: boolean, taskContext: TaskContext<"protectNotes">) {
+ protectNote(note, protect);
+
+ taskContext.increaseProgressCount();
+
+ if (includingSubTree) {
+ for (const child of note.getChildNotes()) {
+ protectNoteRecursively(child, protect, includingSubTree, taskContext);
+ }
+ }
+}
+
+function protectNote(note: BNote, protect: boolean) {
+ if (!protectedSessionService.isProtectedSessionAvailable()) {
+ throw new Error(`Cannot (un)protect note '${note.noteId}' with protect flag '${protect}' without active protected session`);
+ }
+
+ const log = getLog();
+ try {
+ if (protect !== note.isProtected) {
+ const content = note.getContent();
+
+ note.isProtected = protect;
+ note.setContent(content, { forceSave: true });
+ }
+
+ revisionService.protectRevisions(note);
+
+ for (const attachment of note.getAttachments()) {
+ if (protect !== attachment.isProtected) {
+ try {
+ const content = attachment.getContent();
+
+ attachment.isProtected = protect;
+ attachment.setContent(content, { forceSave: true });
+ } catch (e) {
+ log.error(`Could not un/protect attachment '${attachment.attachmentId}'`);
+
+ throw e;
+ }
+ }
+ }
+ } catch (e) {
+ log.error(`Could not un/protect note '${note.noteId}'`);
+
+ throw e;
+ }
+}
+
+function checkImageAttachments(note: BNote, content: string) {
+ const foundAttachmentIds = new Set<string>();
+ let match;
+
+ const imgRegExp = /src="[^"]*api\/attachments\/([a-zA-Z0-9_]+)\/image/g;
+ while ((match = imgRegExp.exec(content))) {
+ foundAttachmentIds.add(match[1]);
+ }
+
+ const linkRegExp = /href="[^"]+attachmentId=([a-zA-Z0-9_]+)/g;
+ while ((match = linkRegExp.exec(content))) {
+ foundAttachmentIds.add(match[1]);
+ }
+
+ const attachments = note.getAttachments();
+
+ for (const attachment of attachments) {
+ const attachmentInContent = attachment.attachmentId && foundAttachmentIds.has(attachment.attachmentId);
+
+ if (attachment.utcDateScheduledForErasureSince && attachmentInContent) {
+ attachment.utcDateScheduledForErasureSince = null;
+ attachment.save();
+ } else if (!attachment.utcDateScheduledForErasureSince && !attachmentInContent) {
+ attachment.utcDateScheduledForErasureSince = date_utils.utcNowDateTime();
+ attachment.save();
+ }
+ }
+
+ const existingAttachmentIds = new Set<string | undefined>(attachments.map((att) => att.attachmentId));
+ const unknownAttachmentIds = Array.from(foundAttachmentIds).filter((foundAttId) => !existingAttachmentIds.has(foundAttId));
+ const unknownAttachments = becca.getAttachments(unknownAttachmentIds);
+
+ for (const unknownAttachment of unknownAttachments) {
+ // the attachment belongs to a different note (was copy-pasted). Attachments can be linked only from the note
+ // which owns it, so either find an existing attachment having the same content or make a copy.
+ let localAttachment = note.getAttachments().find((att) => att.role === unknownAttachment.role && att.blobId === unknownAttachment.blobId);
+
+ if (localAttachment) {
+ if (localAttachment.utcDateScheduledForErasureSince) {
+ // the attachment is for sure linked now, so reset the scheduled deletion
+ localAttachment.utcDateScheduledForErasureSince = null;
+ localAttachment.save();
+ }
+
+ getLog().info(
+ `Found equivalent attachment '${localAttachment.attachmentId}' of note '${note.noteId}' for the linked foreign attachment '${unknownAttachment.attachmentId}' of note '${unknownAttachment.ownerId}'`
+ );
+ } else {
+ localAttachment = unknownAttachment.copy();
+ localAttachment.ownerId = note.noteId;
+ localAttachment.setContent(unknownAttachment.getContent(), { forceSave: true });
+
+ ws.sendMessageToAllClients({ type: "toast", message: `Attachment '${localAttachment.title}' has been copied to note '${note.title}'.` });
+ getLog().info(`Copied attachment '${unknownAttachment.attachmentId}' of note '${unknownAttachment.ownerId}' to new '${localAttachment.attachmentId}' of note '${note.noteId}'`);
+ }
+
+ // replace image links
+ content = content.replace(`api/attachments/${unknownAttachment.attachmentId}/image`, `api/attachments/${localAttachment.attachmentId}/image`);
+ // replace reference links
+ content = content.replace(
+ new RegExp(`href="[^"]+attachmentId=${unknownAttachment.attachmentId}[^"]*"`, "g"),
+ `href="#root/${localAttachment.ownerId}?viewMode=attachments&amp;attachmentId=${localAttachment.attachmentId}"`
+ );
+ }
+
+ return {
+ forceFrontendReload: unknownAttachments.length > 0,
+ content
+ };
+}
+
+function findImageLinks(content: string, foundLinks: FoundLink[]) {
+ const re = /src="[^"]*api\/images\/([a-zA-Z0-9_]+)\//g;
+ let match;
+
+ while ((match = re.exec(content))) {
+ foundLinks.push({
+ name: "imageLink",
+ value: match[1]
+ });
+ }
+
+ // removing absolute references to server to keep it working between instances,
+ // we also omit / at the beginning to keep the paths relative
+ return content.replace(/src="[^"]*\/api\/images\//g, 'src="api/images/');
+}
+
+function findInternalLinks(content: string, foundLinks: FoundLink[]) {
+ const re = /href="[^"]*#root[a-zA-Z0-9_\/]*\/([a-zA-Z0-9_]+)\/?"/g;
+ let match;
+
+ while ((match = re.exec(content))) {
+ foundLinks.push({
+ name: "internalLink",
+ value: match[1]
+ });
+ }
+
+ // removing absolute references to server to keep it working between instances
+ return content.replace(/href="[^"]*#root/g, 'href="#root');
+}
+
+function findIncludeNoteLinks(content: string, foundLinks: FoundLink[]) {
+ const re = /<section class="include-note[^>]+data-note-id="([a-zA-Z0-9_]+)"[^>]*>/g;
+ let match;
+
+ while ((match = re.exec(content))) {
+ foundLinks.push({
+ name: "includeNoteLink",
+ value: match[1]
+ });
+ }
+
+ return content;
+}
+
+function findRelationMapLinks(content: string, foundLinks: FoundLink[]) {
+ try {
+ const obj = JSON.parse(content);
+
+ for (const note of obj.notes) {
+ foundLinks.push({
+ name: "relationMapLink",
+ value: note.noteId
+ });
+ }
+ } catch (e: any) {
+ getLog().error(`Could not scan for relation map links: ${ e.message}`);
+ }
+}
+
+const imageUrlToAttachmentIdMapping: Record<string, string> = {};
+
+async function downloadImage(noteId: string, imageUrl: string) {
+ const unescapedUrl = unescapeHtml(imageUrl);
+ const log = getLog();
+
+ try {
+ let imageBuffer: Uint8Array;
+
+ if (imageUrl.toLowerCase().startsWith("file://")) {
+ imageBuffer = await new Promise((res, rej) => {
+ const localFilePath = imageUrl.substring("file://".length);
+
+ return fs.readFile(localFilePath, (err, data) => {
+ if (err) {
+ rej(err);
+ } else {
+ res(data);
+ }
+ });
+ });
+ } else {
+ imageBuffer = await request.getImage(unescapedUrl);
+ }
+
+ const parsedUrl = url.parse(unescapedUrl);
+ const title = path.basename(parsedUrl.pathname || "");
+
+ const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, title, true, true);
+
+ if (attachment.attachmentId) {
+ imageUrlToAttachmentIdMapping[imageUrl] = attachment.attachmentId;
+ } else {
+ log.error(`Download of '${imageUrl}' for note '${noteId}' failed due to no attachment ID.`);
+ }
+
+ log.info(`Download of '${imageUrl}' succeeded and was saved as image attachment '${attachment.attachmentId}' of note '${noteId}'`);
+ } catch (e: any) {
+ log.error(`Download of '${imageUrl}' for note '${noteId}' failed with error: ${e.message} ${e.stack}`);
+ }
+}
+
+/** url => download promise */
+const downloadImagePromises: Record<string, Promise<void>> = {};
+
+function replaceUrl(content: string, url: string, attachment: Attachment) {
+ const quotedUrl = quoteRegex(url);
+
+ return content.replace(new RegExp(`\\s+src=[\"']${quotedUrl}[\"']`, "ig"), ` src="api/attachments/${attachment.attachmentId}/image/${encodeURIComponent(attachment.title)}"`);
+}
+
+function downloadImages(noteId: string, content: string) {
+ const imageRe = /<img[^>]*?\ssrc=['"]([^'">]+)['"]/gi;
+ let imageMatch;
+
+ while ((imageMatch = imageRe.exec(content))) {
+ const url = imageMatch[1];
+ const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url);
+
+ if (inlineImageMatch) {
+ const imageBase64 = url.substring(inlineImageMatch[0].length);
+ const imageBuffer = decodeBase64(imageBase64);
+
+ const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);
+
+ const encodedTitle = encodeURIComponent(attachment.title);
+
+ content = `${content.substring(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${encodedTitle}"${content.substring(imageMatch.index + imageMatch[0].length)}`;
+ } else if (
+ !url.includes("api/images/") &&
+ !/api\/attachments\/.+\/image\/?.*/.test(url) &&
+ // this is an exception for the web clipper's "imageId"
+ (url.length !== 20 || url.toLowerCase().startsWith("http"))
+ ) {
+ if (!optionService.getOptionBool("downloadImagesAutomatically")) {
+ continue;
+ }
+
+ if (url in imageUrlToAttachmentIdMapping) {
+ const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);
+
+ if (!attachment) {
+ delete imageUrlToAttachmentIdMapping[url];
+ } else {
+ content = replaceUrl(content, url, attachment);
+ continue;
+ }
+ }
+
+ if (url in downloadImagePromises) {
+ // download is already in progress
+ continue;
+ }
+
+ // this is done asynchronously, it would be too slow to wait for the download
+ // given that save can be triggered very often
+ downloadImagePromises[url] = downloadImage(noteId, url);
+ }
+ }
+
+ Promise.all(Object.values(downloadImagePromises)).then(() => {
+ setTimeout(() => {
+ // the normal expected flow of the offline image saving is that users will paste the image(s)
+ // which will get asynchronously downloaded, during that time they keep editing the note
+ // once the download is finished, the image note representing the downloaded image will be used
+ // to replace the IMG link.
+ // However, there's another flow where the user pastes the image and leaves the note before the images
+ // are downloaded and the IMG references are not updated. For this occasion we have this code
+ // which upon the download of all the images will update the note if the links have not been fixed before
+
+ getSql().transactional(() => {
+ const imageNotes = becca.getNotes(Object.values(imageUrlToAttachmentIdMapping), true);
+ const log = getLog();
+
+ const origNote = becca.getNote(noteId);
+
+ if (!origNote) {
+ log.error(`Cannot find note '${noteId}' to replace image link.`);
+ return;
+ }
+
+ const origContent = origNote.getContent();
+ let updatedContent = origContent;
+
+ if (typeof updatedContent !== "string") {
+ log.error(`Note '${noteId}' has a non-string content, cannot replace image link.`);
+ return;
+ }
+
+ for (const url in imageUrlToAttachmentIdMapping) {
+ const imageNote = imageNotes.find((note) => note.noteId === imageUrlToAttachmentIdMapping[url]);
+
+ if (imageNote) {
+ updatedContent = replaceUrl(updatedContent, url, imageNote);
+ }
+ }
+
+ // update only if the links have not been already fixed.
+ if (updatedContent !== origContent) {
+ origNote.setContent(updatedContent);
+
+ asyncPostProcessContent(origNote, updatedContent);
+
+ console.log(`Fixed the image links for note '${noteId}' to the offline saved.`);
+ }
+ });
+ }, 5000);
+ });
+
+ return content;
+}
+
+function saveAttachments(note: BNote, content: string) {
+ const inlineAttachmentRe = /<a[^>]*?\shref=['"]data:([^;'">]+);base64,([^'">]+)['"][^>]*>(.*?)<\/a>/gim;
+ let attachmentMatch;
+
+ while ((attachmentMatch = inlineAttachmentRe.exec(content))) {
+ const mime = attachmentMatch[1].toLowerCase();
+
+ const base64data = attachmentMatch[2];
+ const buffer = decodeBase64(base64data);
+
+ const title = html2plaintext(attachmentMatch[3]);
+
+ const attachment = note.saveAttachment({
+ role: "file",
+ mime,
+ title,
+ content: buffer
+ });
+
+ content = `${content.substring(0, attachmentMatch.index)}<a class="reference-link" href="#root/${note.noteId}?viewMode=attachments&attachmentId=${attachment.attachmentId}">${title}</a>${content.substring(attachmentMatch.index + attachmentMatch[0].length)}`;
+ }
+
+ // removing absolute references to server to keep it working between instances,
+ // we also omit / at the beginning to keep the paths relative
+ content = content.replace(/src="[^"]*\/api\/attachments\//g, 'src="api/attachments/');
+
+ return content;
+}
+
+function saveLinks(note: BNote, content: string | Uint8Array) {
+ if ((note.type !== "text" && note.type !== "relationMap") || (note.isProtected && !protectedSessionService.isProtectedSessionAvailable())) {
+ return {
+ forceFrontendReload: false,
+ content
+ };
+ }
+
+ const foundLinks: FoundLink[] = [];
+ let forceFrontendReload = false;
+
+ if (note.type === "text" && typeof content === "string") {
+ content = downloadImages(note.noteId, content);
+ content = saveAttachments(note, content);
+
+ content = findImageLinks(content, foundLinks);
+ content = findInternalLinks(content, foundLinks);
+ content = findIncludeNoteLinks(content, foundLinks);
+
+ ({ forceFrontendReload, content } = checkImageAttachments(note, content));
+ } else if (note.type === "relationMap" && typeof content === "string") {
+ findRelationMapLinks(content, foundLinks);
+ } else {
+ throw new Error(`Unrecognized type '${note.type}'`);
+ }
+
+ const existingLinks = note.getRelations().filter((rel) => ["internalLink", "imageLink", "relationMapLink", "includeNoteLink"].includes(rel.name));
+
+ for (const foundLink of foundLinks) {
+ const targetNote = becca.notes[foundLink.value];
+ if (!targetNote) {
+ continue;
+ }
+
+ const existingLink = existingLinks.find((existingLink) => existingLink.value === foundLink.value && existingLink.name === foundLink.name);
+
+ if (!existingLink) {
+ const newLink = new BAttribute({
+ noteId: note.noteId,
+ type: "relation",
+ name: foundLink.name,
+ value: foundLink.value
+ }).save();
+
+ existingLinks.push(newLink);
+ }
+ // else the link exists, so we don't need to do anything
+ }
+
+ // marking links as deleted if they are not present on the page anymore
+ const unusedLinks = existingLinks.filter((existingLink) => !foundLinks.some((foundLink) => existingLink.value === foundLink.value && existingLink.name === foundLink.name));
+
+ for (const unusedLink of unusedLinks) {
+ unusedLink.markAsDeleted();
+ }
+
+ return { forceFrontendReload, content };
+}
+
+function saveRevisionIfNeeded(note: BNote) {
+ // files and images are versioned separately
+ if (note.type === "file" || note.type === "image" || note.isLabelTruthy("disableVersioning")) {
+ return;
+ }
+
+ const now = new Date();
+ const revisionSnapshotTimeInterval = parseInt(optionService.getOption("revisionSnapshotTimeInterval"));
+
+ const revisionCutoff = date_utils.utcDateTimeStr(new Date(now.getTime() - revisionSnapshotTimeInterval * 1000));
+
+ const existingRevisionId = getSql().getValue("SELECT revisionId FROM revisions WHERE noteId = ? AND utcDateCreated >= ?", [note.noteId, revisionCutoff]);
+
+ const msSinceDateCreated = now.getTime() - date_utils.parseDateTime(note.utcDateCreated).getTime();
+
+ if (!existingRevisionId && msSinceDateCreated >= revisionSnapshotTimeInterval * 1000) {
+ note.saveRevision();
+ }
+}
+
+function updateNoteData(noteId: string, content: string, attachments: AttachmentRow[] = []) {
+ const note = becca.getNote(noteId);
+
+ if (!note || !note.isContentAvailable()) {
+ throw new Error(`Note '${noteId}' is not available for change!`);
+ }
+
+ saveRevisionIfNeeded(note);
+
+ const { forceFrontendReload, content: newContent } = saveLinks(note, content);
+
+ note.setContent(newContent, { forceFrontendReload });
+
+ if (attachments?.length > 0) {
+ const existingAttachmentsByTitle = toMap(note.getAttachments(), "title");
+
+ for (const { attachmentId, role, mime, title, position, content } of attachments) {
+ const existingAttachment = existingAttachmentsByTitle.get(title);
+ if (attachmentId || !existingAttachment) {
+ note.saveAttachment({ attachmentId, role, mime, title, content, position });
+ } else {
+ existingAttachment.role = role;
+ existingAttachment.mime = mime;
+ existingAttachment.position = position;
+ if (content) {
+ existingAttachment.setContent(content, { forceSave: true });
+ }
+ }
+ }
+ }
+}
+
+function undeleteNote(noteId: string, taskContext: TaskContext<"undeleteNotes">) {
+ const noteRow = getSql().getRow<NoteRow>("SELECT * FROM notes WHERE noteId = ?", [noteId]);
+
+ if (!noteRow.isDeleted || !noteRow.deleteId) {
+ getLog().error(`Note '${noteId}' is not deleted and thus cannot be undeleted.`);
+ return;
+ }
+
+ const undeletedParentBranchIds = getUndeletedParentBranchIds(noteId, noteRow.deleteId);
+
+ if (undeletedParentBranchIds.length === 0) {
+ // cannot undelete if there's no undeleted parent
+ return;
+ }
+
+ for (const parentBranchId of undeletedParentBranchIds) {
+ undeleteBranch(parentBranchId, noteRow.deleteId, taskContext);
+ }
+}
+
+function undeleteBranch(branchId: string, deleteId: string, taskContext: TaskContext<"undeleteNotes">) {
+ const sql = getSql();
+ const branchRow = sql.getRow<BranchRow>("SELECT * FROM branches WHERE branchId = ?", [branchId]);
+
+ if (!branchRow.isDeleted) {
+ return;
+ }
+
+ const noteRow = sql.getRow<NoteRow>("SELECT * FROM notes WHERE noteId = ?", [branchRow.noteId]);
+
+ if (noteRow.isDeleted && noteRow.deleteId !== deleteId) {
+ return;
+ }
+
+ new BBranch(branchRow).save();
+
+ taskContext.increaseProgressCount();
+
+ if (noteRow.isDeleted && noteRow.deleteId === deleteId) {
+ // becca entity was already created as skeleton in "new Branch()" above
+ const noteEntity = becca.getNote(noteRow.noteId);
+ if (!noteEntity) {
+ throw new Error("Unable to find the just restored branch.");
+ }
+
+ noteEntity.updateFromRow(noteRow);
+ noteEntity.save();
+
+ const attributeRows = sql.getRows<AttributeRow>(
+ `
+ SELECT * FROM attributes
+ WHERE isDeleted = 1
+ AND deleteId = ?
+ AND (noteId = ?
+ OR (type = 'relation' AND value = ?))`,
+ [deleteId, noteRow.noteId, noteRow.noteId]
+ );
+
+ for (const attributeRow of attributeRows) {
+ // relation might point to a note which hasn't been undeleted yet and would thus throw up
+ new BAttribute(attributeRow).save({ skipValidation: true });
+ }
+
+ const attachmentRows = sql.getRows<AttachmentRow>(
+ `
+ SELECT * FROM attachments
+ WHERE isDeleted = 1
+ AND deleteId = ?
+ AND ownerId = ?`,
+ [deleteId, noteRow.noteId]
+ );
+
+ for (const attachmentRow of attachmentRows) {
+ new BAttachment(attachmentRow).save();
+ }
+
+ const childBranchIds = sql.getColumn<string>(
+ `
+ SELECT branches.branchId
+ FROM branches
+ WHERE branches.isDeleted = 1
+ AND branches.deleteId = ?
+ AND branches.parentNoteId = ?`,
+ [deleteId, noteRow.noteId]
+ );
+
+ for (const childBranchId of childBranchIds) {
+ undeleteBranch(childBranchId, deleteId, taskContext);
+ }
+ }
+}
+
+/**
+ * @returns return deleted branchIds of an undeleted parent note
+ */
+function getUndeletedParentBranchIds(noteId: string, deleteId: string) {
+ return getSql().getColumn<string>(
+ `
+ SELECT branches.branchId
+ FROM branches
+ JOIN notes AS parentNote ON parentNote.noteId = branches.parentNoteId
+ WHERE branches.noteId = ?
+ AND branches.isDeleted = 1
+ AND branches.deleteId = ?
+ AND parentNote.isDeleted = 0`,
+ [noteId, deleteId]
+ );
+}
+
+function scanForLinks(note: BNote, content: string | Uint8Array) {
+ if (!note || !["text", "relationMap"].includes(note.type)) {
+ return;
+ }
+
+ try {
+ getSql().transactional(() => {
+ const { forceFrontendReload, content: newContent } = saveLinks(note, content);
+
+ if (content !== newContent) {
+ note.setContent(newContent, { forceFrontendReload });
+ }
+ });
+ } catch (e: any) {
+ getLog().error(`Could not scan for links note '${note.noteId}': ${e.message} ${e.stack}`);
+ }
+}
+
+/**
+ * Things which have to be executed after updating content, but asynchronously (separate transaction)
+ */
+async function asyncPostProcessContent(note: BNote, content: string | Uint8Array) {
+ if (cls.isMigrationRunning()) {
+ // this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads
+ return;
+ }
+
+ if (note.hasStringContent() && typeof content !== "string") {
+ content = content.toString();
+ }
+
+ scanForLinks(note, content);
+}
+
+// all keys should be replaced by the corresponding values
+function replaceByMap(str: string, mapObj: Record<string, string>) {
+ if (!mapObj) {
+ return str;
+ }
+
+ const re = new RegExp(Object.keys(mapObj).join("|"), "g");
+
+ return str.replace(re, (matched) => mapObj[matched]);
+}
+
+function duplicateSubtree(origNoteId: string, newParentNoteId: string) {
+ if (origNoteId === "root") {
+ throw new Error("Duplicating root is not possible");
+ }
+
+ getLog().info(`Duplicating '${origNoteId}' subtree into '${newParentNoteId}'`);
+
+ const origNote = becca.notes[origNoteId];
+ // might be null if orig note is not in the target newParentNoteId
+ const origBranch = origNote.getParentBranches().find((branch) => branch.parentNoteId === newParentNoteId);
+
+ const noteIdMapping = getNoteIdMapping(origNote);
+
+ const res = duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapping);
+
+ const duplicateNoteSuffix = t("notes.duplicate-note-suffix");
+
+ if (!res.note.title.endsWith(duplicateNoteSuffix) && !res.note.title.startsWith(duplicateNoteSuffix)) {
+ res.note.title = t("notes.duplicate-note-title", { noteTitle: res.note.title, duplicateNoteSuffix });
+ }
+
+ res.note.save();
+
+ return res;
+}
+
+function duplicateSubtreeWithoutRoot(origNoteId: string, newNoteId: string) {
+ if (origNoteId === "root") {
+ throw new Error("Duplicating root is not possible");
+ }
+
+ const origNote = becca.getNote(origNoteId);
+ if (origNote == null) {
+ throw new Error("Unable to find note to duplicate.");
+ }
+
+ const noteIdMapping = getNoteIdMapping(origNote);
+ for (const childBranch of origNote.getChildBranches()) {
+ if (childBranch) {
+ duplicateSubtreeInner(childBranch.getNote(), childBranch, newNoteId, noteIdMapping);
+ }
+ }
+}
+
+function duplicateSubtreeInner(origNote: BNote, origBranch: BBranch | null | undefined, newParentNoteId: string, noteIdMapping: Record<string, string>) {
+ if (origNote.isProtected && !protectedSessionService.isProtectedSessionAvailable()) {
+ throw new Error(`Cannot duplicate note '${origNote.noteId}' because it is protected and protected session is not available. Enter protected session and try again.`);
+ }
+
+ const newNoteId = noteIdMapping[origNote.noteId];
+
+ function createDuplicatedBranch() {
+ return new BBranch({
+ noteId: newNoteId,
+ parentNoteId: newParentNoteId,
+ // here increasing just by 1 to make sure it's directly after original
+ notePosition: origBranch ? origBranch.notePosition + 1 : null
+ }).save();
+ }
+
+ function createDuplicatedNote() {
+ const newNote = new BNote({
+ ...origNote,
+ noteId: newNoteId,
+ dateCreated: date_utils.localNowDateTime(),
+ utcDateCreated: date_utils.utcNowDateTime()
+ }).save();
+
+ let content = origNote.getContent();
+
+ if (typeof content === "string" && ["text", "relationMap", "search"].includes(origNote.type)) {
+ // fix links in the content
+ content = replaceByMap(content, noteIdMapping);
+ }
+
+ newNote.setContent(content);
+
+ for (const attribute of origNote.getOwnedAttributes()) {
+ const attr = new BAttribute({
+ ...attribute,
+ attributeId: undefined,
+ noteId: newNote.noteId
+ });
+
+ // if relation points to within the duplicated tree then replace the target to the duplicated note
+ // if it points outside of duplicated tree then keep the original target
+ if (attr.type === "relation" && attr.value in noteIdMapping) {
+ attr.value = noteIdMapping[attr.value];
+ }
+
+ // the relation targets may not be created yet, the mapping is pre-generated
+ attr.save({ skipValidation: true });
+ }
+
+ for (const childBranch of origNote.getChildBranches()) {
+ if (childBranch) {
+ duplicateSubtreeInner(childBranch.getNote(), childBranch, newNote.noteId, noteIdMapping);
+ }
+ }
+
+ asyncPostProcessContent(newNote, content);
+
+ return newNote;
+ }
+
+ const existingNote = becca.notes[newNoteId];
+
+ if (existingNote && existingNote.title !== undefined) {
+ // checking that it's not just note's skeleton created because of Branch above
+ // note has multiple clones and was already created from another placement in the tree,
+ // so a branch is all we need for this clone
+ return {
+ note: existingNote,
+ branch: createDuplicatedBranch()
+ };
+ }
+ return {
+ // order here is important, note needs to be created first to not mess up the becca
+ note: createDuplicatedNote(),
+ branch: createDuplicatedBranch()
+ };
+
+}
+
+function getNoteIdMapping(origNote: BNote) {
+ const noteIdMapping: Record<string, string> = {};
+
+ // pregenerate new noteIds since we'll need to fix relation references even for not yet created notes
+ for (const origNoteId of origNote.getDescendantNoteIds()) {
+ noteIdMapping[origNoteId] = newEntityId();
+ }
+
+ return noteIdMapping;
+}
+
+export default {
+ createNewNote,
+ createNewNoteWithTarget,
+ updateNoteData,
+ undeleteNote,
+ protectNoteRecursively,
+ duplicateSubtree,
+ duplicateSubtreeWithoutRoot,
+ getUndeletedParentBranchIds,
+ triggerNoteTitleChanged,
+ saveRevisionIfNeeded,
+ downloadImages,
+ asyncPostProcessContent
+};
diff --cc packages/trilium-core/src/services/tree.ts
index 896af1014d,0000000000..403e26a6ab
mode 100644,000000..100644
--- a/packages/trilium-core/src/services/tree.ts
+++ b/packages/trilium-core/src/services/tree.ts
@@@ -1,282 -1,0 +1,282 @@@
+"use strict";
+
+import { getLog } from "./log.js";
+import BBranch from "../becca/entities/bbranch.js";
+import entityChangesService from "./entity_changes.js";
+import becca from "../becca/becca.js";
+import type BNote from "../becca/entities/bnote.js";
+import { getSql } from "./sql/index.js";
+
+export interface ValidationResponse {
+ branch: BBranch | null;
+ success: boolean;
+ message?: string;
+}
+
+function validateParentChild(parentNoteId: string, childNoteId: string, branchId: string | null = null): ValidationResponse {
+ if (["root", "_hidden", "_share", "_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers"].includes(childNoteId)) {
+ return { branch: null, success: false, message: `Cannot change this note's location.` };
+ }
+
+ if (parentNoteId === "none") {
+ // this shouldn't happen
+ return { branch: null, success: false, message: `Cannot move anything into 'none' parent.` };
+ }
+
+ const existingBranch = becca.getBranchFromChildAndParent(childNoteId, parentNoteId);
+
+ if (existingBranch && existingBranch.branchId !== branchId) {
+ const parentNote = becca.getNote(parentNoteId);
+ const childNote = becca.getNote(childNoteId);
+
+ return {
+ branch: existingBranch,
+ success: false,
+ message: `Note "${childNote?.title}" note already exists in the "${parentNote?.title}".`
+ };
+ }
+
+ if (wouldAddingBranchCreateCycle(parentNoteId, childNoteId)) {
+ return {
+ branch: null,
+ success: false,
+ message: "Moving/cloning note here would create cycle."
+ };
+ }
+
+ if (parentNoteId !== "_lbBookmarks" && becca.getNote(parentNoteId)?.type === "launcher") {
+ return {
+ branch: null,
+ success: false,
+ message: "Launcher note cannot have any children."
+ };
+ }
+
+ return { branch: null, success: true };
+}
+
+/**
+ * Tree cycle can be created when cloning or when moving existing clone. This method should detect both cases.
+ */
+function wouldAddingBranchCreateCycle(parentNoteId: string, childNoteId: string) {
+ if (parentNoteId === childNoteId) {
+ return true;
+ }
+
+ const childNote = becca.getNote(childNoteId);
+ const parentNote = becca.getNote(parentNoteId);
+
+ if (!childNote || !parentNote) {
+ return false;
+ }
+
+ // we'll load the whole subtree - because the cycle can start in one of the notes in the subtree
+ const childSubtreeNoteIds = new Set(childNote.getSubtreeNoteIds());
+ const parentAncestorNoteIds = parentNote.getAncestorNoteIds();
+
+ return parentAncestorNoteIds.some((parentAncestorNoteId) => childSubtreeNoteIds.has(parentAncestorNoteId));
+}
+
+function sortNotes(parentNoteId: string, customSortBy: string = "title", reverse = false, foldersFirst = false, sortNatural = false, _sortLocale?: string | null) {
+ if (!customSortBy) {
+ customSortBy = "title";
+ }
+
+ // sortLocale can not be empty string or null value, default value must be set to undefined.
+ const sortLocale = _sortLocale || undefined;
+
+ const sql = getSql();
+ sql.transactional(() => {
+ const note = becca.getNote(parentNoteId);
+ if (!note) {
+ throw new Error("Unable to find note");
+ }
+
+ const notes = note.getChildNotes();
+
+ function normalize<T>(obj: T | string) {
+ return obj && typeof obj === "string" ? obj.toLowerCase() : obj;
+ }
+
+ notes.sort((a, b) => {
- if (foldersFirst) {
- const aHasChildren = a.hasChildren();
- const bHasChildren = b.hasChildren();
-
- if ((aHasChildren && !bHasChildren) || (!aHasChildren && bHasChildren)) {
- // exactly one note of the two is a directory, so the sorting will be done based on this status
- return aHasChildren ? -1 : 1;
- }
- }
+
+ function fetchValue(note: BNote, key: string) {
+ let rawValue: string | null;
+
+ if (key === "title") {
+ const branch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);
+ const prefix = branch?.prefix;
+ rawValue = prefix ? `${prefix} - ${note.title}` : note.title;
+ } else {
+ rawValue = ["dateCreated", "dateModified"].includes(key) ? (note as any)[key] : note.getLabelValue(key);
+ }
+
+ return normalize(rawValue);
+ }
+
+ function compare(a: string, b: string) {
+ if (!sortNatural) {
+ // alphabetical sort
+ return b === null || b === undefined || a < b ? -1 : 1;
+ } else {
+ // natural sort
+ return a.localeCompare(b, sortLocale, { numeric: true, sensitivity: "base" });
+ }
+ }
+
+ const topAEl = fetchValue(a, "top");
+ const topBEl = fetchValue(b, "top");
+
+ if (topAEl !== topBEl) {
+ if (topAEl === null) return reverse ? -1 : 1;
+ if (topBEl === null) return reverse ? 1 : -1;
+
+ // since "top" should not be reversible, we'll reverse it once more to nullify this effect
+ return compare(topAEl, topBEl) * (reverse ? -1 : 1);
+ }
+
+ const bottomAEl = fetchValue(a, "bottom");
+ const bottomBEl = fetchValue(b, "bottom");
+
+ if (bottomAEl !== bottomBEl) {
+ if (bottomAEl === null) return reverse ? 1 : -1;
+ if (bottomBEl === null) return reverse ? -1 : 1;
+
+ // since "bottom" should not be reversible, we'll reverse it once more to nullify this effect
+ return compare(bottomBEl, bottomAEl) * (reverse ? -1 : 1);
+ }
+
++ if (foldersFirst) {
++ const aHasChildren = a.hasChildren();
++ const bHasChildren = b.hasChildren();
++
++ if ((aHasChildren && !bHasChildren) || (!aHasChildren && bHasChildren)) {
++ // exactly one note of the two is a directory, so the sorting will be done based on this status
++ return aHasChildren ? -1 : 1;
++ }
++ }
++
+ const customAEl = fetchValue(a, customSortBy) ?? fetchValue(a, "title") as string;
+ const customBEl = fetchValue(b, customSortBy) ?? fetchValue(b, "title") as string;
+
+ if (customAEl !== customBEl) {
+ return compare(customAEl, customBEl);
+ }
+
+ const titleAEl = fetchValue(a, "title") as string;
+ const titleBEl = fetchValue(b, "title") as string;
+
+ return compare(titleAEl, titleBEl);
+ });
+
+ if (reverse) {
+ notes.reverse();
+ }
+
+ let position = 10;
+ let someBranchUpdated = false;
+
+ for (const note of notes) {
+ const branch = note.getParentBranches().find((b) => b.parentNoteId === parentNoteId);
+ if (!branch) {
+ continue;
+ }
+
+ if (branch.noteId === "_hidden") {
+ position = 999_999_999;
+ }
+
+ if (branch.notePosition !== position) {
+ sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?", [position, branch.branchId]);
+
+ branch.notePosition = position;
+ someBranchUpdated = true;
+ }
+
+ position += 10;
+ }
+
+ if (someBranchUpdated) {
+ entityChangesService.putNoteReorderingEntityChange(parentNoteId);
+ }
+ });
+}
+
+function sortNotesIfNeeded(parentNoteId: string) {
+ const parentNote = becca.getNote(parentNoteId);
+ if (!parentNote) {
+ return;
+ }
+
+ const sortedLabel = parentNote.getLabel("sorted");
+
+ if (!sortedLabel || sortedLabel.value === "off") {
+ return;
+ }
+
+ const sortReversed = parentNote.getLabelValue("sortDirection")?.toLowerCase() === "desc";
+ const sortFoldersFirst = parentNote.isLabelTruthy("sortFoldersFirst");
+ const sortNatural = parentNote.isLabelTruthy("sortNatural");
+ const sortLocale = parentNote.getLabelValue("sortLocale");
+
+ sortNotes(parentNoteId, sortedLabel.value, sortReversed, sortFoldersFirst, sortNatural, sortLocale);
+}
+
+/**
+ * @deprecated this will be removed in the future
+ */
+function setNoteToParent(noteId: string, prefix: string, parentNoteId: string) {
+ const parentNote = becca.getNote(parentNoteId);
+
+ if (parentNoteId && !parentNote) {
+ // null parentNoteId is a valid value
+ throw new Error(`Cannot move note to deleted / missing parent note '${parentNoteId}'`);
+ }
+
+ // case where there might be more such branches is ignored. It's expected there should be just one
- const sql = getSql();
+ const branchId = sql.getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND prefix = ?", [noteId, prefix]);
+ const branch = becca.getBranch(branchId);
+
+ if (branch) {
+ if (!parentNoteId) {
+ getLog().info(`Removing note '${noteId}' from parent '${parentNoteId}'`);
+
+ branch.markAsDeleted();
+ } else {
+ const newBranch = branch.createClone(parentNoteId);
+ newBranch.save();
+
+ branch.markAsDeleted();
+ }
+ } else if (parentNoteId) {
+ const note = becca.getNote(noteId);
+ if (!note) {
+ throw new Error(`Cannot find note '${noteId}.`);
+ }
+
+ if (note.isDeleted) {
+ throw new Error(`Cannot create a branch for '${noteId}' which is deleted.`);
+ }
+
+ const branchId = sql.getValue<string>("SELECT branchId FROM branches WHERE isDeleted = 0 AND noteId = ? AND parentNoteId = ?", [noteId, parentNoteId]);
+ const branch = becca.getBranch(branchId);
+
+ if (branch) {
+ branch.prefix = prefix;
+ branch.save();
+ } else {
+ new BBranch({
+ noteId: noteId,
+ parentNoteId: parentNoteId,
+ prefix: prefix
+ }).save();
+ }
+ }
+}
+
+export default {
+ validateParentChild,
+ sortNotes,
+ sortNotesIfNeeded,
+ setNoteToParent
+};
diff --cc pnpm-lock.yaml
index b78fba61da,42e3e02a6a..84c3f1a245
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@@ -348,217 -354,9 +354,217 @@@ importers
specifier: 0.7.2
version: 0.7.2
vite-plugin-static-copy:
- specifier: 3.1.4
+ specifier: 3.2.0
+ apps/client-standalone:
+ dependencies:
+ '@excalidraw/excalidraw':
+ specifier: 0.18.0
+ '@fullcalendar/core':
+ specifier: 6.1.20
+ version: 6.1.20
+ '@fullcalendar/daygrid':
+ specifier: 6.1.20
+ version: 6.1.20(@fullcalendar/[email protected])
+ '@fullcalendar/interaction':
+ specifier: 6.1.20
+ version: 6.1.20(@fullcalendar/[email protected])
+ '@fullcalendar/list':
+ specifier: 6.1.20
+ version: 6.1.20(@fullcalendar/[email protected])
+ '@fullcalendar/multimonth':
+ specifier: 6.1.20
+ version: 6.1.20(@fullcalendar/[email protected])
+ '@fullcalendar/timegrid':
+ specifier: 6.1.20
+ version: 6.1.20(@fullcalendar/[email protected])
+ '@maplibre/maplibre-gl-leaflet':
+ specifier: 0.1.3
+ '@mermaid-js/layout-elk':
+ specifier: 0.2.0
+ version: 0.2.0([email protected])
+ '@mind-elixir/node-menu':
+ specifier: 5.0.1
+ version: 5.0.1([email protected])
+ '@popperjs/core':
+ specifier: 2.11.8
+ version: 2.11.8
+ '@preact/signals':
+ specifier: 2.5.1
+ version: 2.5.1([email protected])
+ '@sqlite.org/sqlite-wasm':
+ specifier: 3.51.1-build2
+ version: 3.51.1-build2
+ '@triliumnext/ckeditor5':
+ specifier: workspace:*
+ version: link:../../packages/ckeditor5
+ '@triliumnext/codemirror':
+ specifier: workspace:*
+ version: link:../../packages/codemirror
+ '@triliumnext/commons':
+ specifier: workspace:*
+ version: link:../../packages/commons
+ '@triliumnext/core':
+ specifier: workspace:*
+ version: link:../../packages/trilium-core
+ '@triliumnext/highlightjs':
+ specifier: workspace:*
+ version: link:../../packages/highlightjs
+ '@triliumnext/share-theme':
+ specifier: workspace:*
+ version: link:../../packages/share-theme
+ '@triliumnext/split.js':
+ specifier: workspace:*
+ version: link:../../packages/splitjs
+ '@zumer/snapdom':
+ specifier: 2.0.1
+ version: 2.0.1
+ autocomplete.js:
+ specifier: 0.38.1
+ version: 0.38.1
+ bootstrap:
+ specifier: 5.3.8
+ version: 5.3.8(@popperjs/[email protected])
+ boxicons:
+ specifier: 2.1.4
+ version: 2.1.4
+ clsx:
+ specifier: 2.1.1
+ version: 2.1.1
+ color:
+ specifier: 5.0.3
+ version: 5.0.3
+ debounce:
+ specifier: 3.0.0
+ version: 3.0.0
+ draggabilly:
+ specifier: 3.0.0
+ version: 3.0.0
+ force-graph:
+ specifier: 1.51.0
+ version: 1.51.0
+ globals:
+ specifier: 17.0.0
+ version: 17.0.0
+ i18next:
+ specifier: 25.7.3
+ version: 25.7.3([email protected])
+ i18next-http-backend:
+ specifier: 3.0.2
+ version: 3.0.2([email protected])
+ jquery:
+ specifier: 3.7.1
+ version: 3.7.1
+ jquery.fancytree:
+ specifier: 2.38.5
+ version: 2.38.5([email protected])
+ js-sha1:
+ specifier: 0.7.0
+ version: 0.7.0
+ js-sha512:
+ specifier: 0.9.0
+ version: 0.9.0
+ jsplumb:
+ specifier: 2.15.6
+ version: 2.15.6
+ katex:
+ specifier: 0.16.27
+ version: 0.16.27
+ knockout:
+ specifier: 3.5.1
+ version: 3.5.1
+ leaflet:
+ specifier: 1.9.4
+ version: 1.9.4
+ leaflet-gpx:
+ specifier: 2.2.0
+ version: 2.2.0
+ mark.js:
+ specifier: 8.11.1
+ version: 8.11.1
+ marked:
+ specifier: 17.0.1
+ version: 17.0.1
+ mermaid:
+ specifier: 11.12.2
+ version: 11.12.2
+ mind-elixir:
+ specifier: 5.4.0
+ version: 5.4.0
+ normalize.css:
+ specifier: 8.0.1
+ version: 8.0.1
+ panzoom:
+ specifier: 9.4.3
+ version: 9.4.3
+ preact:
+ specifier: 10.28.2
+ version: 10.28.2
+ react-i18next:
+ specifier: 16.5.1
+ react-window:
+ specifier: 2.2.3
+ reveal.js:
+ specifier: 5.2.1
+ version: 5.2.1
+ svg-pan-zoom:
+ specifier: 3.6.2
+ version: 3.6.2
+ tabulator-tables:
+ specifier: 6.3.1
+ version: 6.3.1
+ vanilla-js-wheel-zoom:
+ specifier: 9.0.4
+ version: 9.0.4
+ devDependencies:
+ '@ckeditor/ckeditor5-inspector':
+ specifier: 5.0.0
+ version: 5.0.0
+ '@preact/preset-vite':
+ specifier: 2.10.2
+ '@types/bootstrap':
+ specifier: 5.2.10
+ version: 5.2.10
+ '@types/jquery':
+ specifier: 3.5.33
+ version: 3.5.33
+ '@types/leaflet':
+ specifier: 1.9.21
+ version: 1.9.21
+ '@types/leaflet-gpx':
+ specifier: 1.3.8
+ version: 1.3.8
+ '@types/mark.js':
+ specifier: 8.11.12
+ version: 8.11.12
+ '@types/reveal.js':
+ specifier: 5.2.2
+ version: 5.2.2
+ '@types/tabulator-tables':
+ specifier: 6.3.1
+ version: 6.3.1
+ copy-webpack-plugin:
+ specifier: 13.0.1
+ cross-env:
+ specifier: 7.0.3
+ version: 7.0.3
+ happy-dom:
+ specifier: 20.0.11
+ version: 20.0.11
+ script-loader:
+ specifier: 0.7.2
+ version: 0.7.2
+ vite-plugin-static-copy:
+ specifier: 3.1.4
+
apps/db-compare:
dependencies:
colors:
@@@ -724,9 -522,12 +730,9 @@@
'@anthropic-ai/sdk':
specifier: 0.71.2
version: 0.71.2([email protected])
- '@braintree/sanitize-url':
- specifier: 7.1.1
- version: 7.1.1
'@electron/remote':
specifier: 2.1.3
- version: 2.1.3([email protected])
+ version: 2.1.3([email protected])
'@triliumnext/commons':
specifier: workspace:*
version: link:../../packages/commons
@@@ -973,12 -792,15 +979,9 @@@
tmp:
specifier: 0.2.5
version: 0.2.5
- turndown:
- specifier: 7.2.2
- version: 7.2.2
- vite:
- specifier: 7.3.1
+ turnish:
+ specifier: 1.8.0
+ version: 1.8.0
- unescape:
- specifier: 1.0.1
- version: 1.0.1
- vite:
- specifier: 7.3.1
ws:
specifier: 8.19.0
@@@ -4218,14 -4265,14 +4475,19 @@@ packages
'@babel/core': 7.x
vite: 2.x || 3.x || 4.x || 5.x || 6.x || 7.x
- '@preact/[email protected]':
- resolution: {integrity: sha512-BwbTXpj+9QutoZLQvbttRg5x3l5468qaV2kufh+51yha1c53ep5dY4kTuZR35+3pAZxpfQerGJiQqg34ZNZ6uA==}
+ '@preact/[email protected]':
+ resolution: {integrity: sha512-5Yf8h1Ke3SMHr15xl630KtwPTW4sYDFkkxS0vQ8UiQLWwZQnrF9IKaVG1mN5VcJz52EcWs2acsc/Npjha/7ysA==}
+ '@preact/[email protected]':
+ resolution: {integrity: sha512-VPjk5YFt7i11Fi4UK0tzaEe5xLwfhUxXL3l89ocxQ5aPz7bRo8M5+N73LjBMPklyXKYKz6YsNo4Smp8n6nplng==}
+ peerDependencies:
+ preact: 10.28.2
+
+ '@preact/[email protected]':
+ resolution: {integrity: sha512-Gp3DI1T/0YyirwJnImR8l9xyVJgKiVzJXmEhic1/7SPw3zStrsvuBpwKnD609CzsIdzxprWa6yTNXN+VLLZPGQ==}
+ peerDependencies:
+ preact: 10.28.2
+
'@prefresh/[email protected]':
resolution: {integrity: sha512-AOl4HG6dAxWkJ5ndPHBgBa49oo/9bOiJuRDKHLSTyH+Fd9x00shTXpdiTj1W41l6oQIwUOAgJeHMn4QwIDpHkA==}
@@@ -6156,9 -6241,9 +6454,12 @@@
resolution: {integrity: sha512-0fztsk/0ryJ+2PPr9EyXS5/Co7OK8q3zY/xOoozEWaUsL5x+C0cyZ4YyMuUffOO2Dx/rAdq4JMPqW0VUtm+vzA==}
engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=18.0.0'}
+ '@zumer/[email protected]':
+ resolution: {integrity: sha512-78/qbYl2FTv4H6qaXcNfAujfIOSzdvs83NW63VbyC9QA3sqNPfPvhn4xYMO6Gy11hXwJUEhd0z65yKiNzDwy9w==}
+
+ '@zumer/[email protected]':
+ resolution: {integrity: sha512-W6quT4lMcPu8Q9O/Q6witSfc6/+xuY8C8yDoHug/+o7zYKCNE/e0I3//XsWDkyq9C0mDE0TAWF/8bwCR7x3gHQ==}
+
resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==}
deprecated: Use your platform's native atob() and btoa() methods instead
@@@ -8917,10 -9176,10 +9383,14 @@@
engines: {node: '>=0.4.7'}
hasBin: true
+ resolution: {integrity: sha512-QsCdAUHAmiDeKeaNojb1OHOPF7NjcWPBR7obdu3NwH2a/oyQaLg5d0aaCy/9My6CdPChYF07dvz5chaXBGaD4g==}
+ engines: {node: '>=20.0.0'}
+
+ resolution: {integrity: sha512-RDeQm3dT9n0A5f/TszjUmNCLEuPnMGv3Tv4BmNINebz/h17PA6LMBcxJ5FrcqltNBMh9jA/8ufgDdBYUdBt+eg==}
+ engines: {node: '>=20.0.0'}
+
resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==}
engines: {node: '>= 0.4'}
@@@ -9187,14 -9463,14 +9674,22 @@@
resolution: {integrity: sha512-PdlvPnvIp4E1sYi46Ik4tBYh/v/NbYfFFgTjkwFl0is8A18s7/bx9aXqsrOax9WUbeNS6mD2oix7Z0yGGf6m5g==}
+ resolution: {integrity: sha512-2XaT+HpYGuc2uTExq9TVRhLsso+Dxym6PWaKpn36wfBmTI779OQ7iP/XaZHzrnGyzU4SHpFrTYLKfVyBfAhVNA==}
+ peerDependencies:
+ typescript: ^5
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ resolution: {integrity: sha512-urrg4HMFFMQZ2bbKRK7IZ8/CTE7D8H4JRlAwqA2ZwDRFfdd0K/4cdbNNLgfn9mo+I/h9wJu61qJzH7jCFAhUZQ==}
+ peerDependencies:
+ typescript: ^5
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
@@@ -9698,9 -10026,9 +10245,12 @@@
peerDependencies:
jquery: '>=1.9'
+ resolution: {integrity: sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==}
+
+ resolution: {integrity: sha512-TXCHVR3Lb6TZdtw1l3RTLf8RBWVGexdxL6AC8/e0xZKEpBflBsjh9/8LXw+dkNFuOyW9B7iB3O1sP7hS0Kiacg==}
+
resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}
engines: {node: '>=0.10.0'}
@@@ -9853,10 -10179,10 +10407,14 @@@
engines: {node: '>= 10'}
hasBin: true
+ resolution: {integrity: sha512-aeQoDkuRWSqQN6nSvVCEFvfXdqo1OQiCmmW1kc9xSdjutPv7BGO7pqY9sQRJpMOGrEdfDgF2TfRXe5eUAD2Waw==}
+ hasBin: true
+
+ resolution: {integrity: sha512-YHzO7721WbmAL6Ov1uzN/l5mY5WWWhJBSW+jq4tkfZfsxmo1hu6frS0EOswvjBUnWE6NtjEs48SFn5CQESRLZg==}
+ hasBin: true
+
resolution: {integrity: sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==}
@@@ -10517,11 -10903,8 +11135,11 @@@
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-yxXajDWoSF6id8b2LKxlhXidxH/v6mx4JV+isrtsZ62RGCMsRbjUMFO9xOfTVH8vyxWhsbCkiAP6/i5hqbyk6w==}
+
- resolution: {integrity: sha512-a/bOTp3wJrK/vTm2/Vn5+9kYL0fNqxWvm8SsVojJO/tltLPPU8yMPzFCZHzGRz1Aoj6bpLxN+ExfIbc28nrNxQ==}
+ resolution: {integrity: sha512-FTpP5yfyjqXxtHbUAcJVrzBgbU9en0dQIbYx4lQc1C7aWOnjHGHr9iVccgMqU4gh9jVIBpunm4++2DpN753mGg==}
resolution: {integrity: sha512-ZWYT7ln73Hptxqxk2DxPU9MmapXRhxkJD6tkSR04dnQxm8BGu2hzgKLugK5yySD97u/8yy7Ma7E76k9ZdvtjkQ==}
@@@ -12067,27 -12558,27 +12784,43 @@@
peerDependencies:
react: ^16.14.0
- resolution: {integrity: sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==}
+ resolution: {integrity: sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==}
peerDependencies:
- react: ^19.2.3
+ react: ^19.2.4
+ resolution: {integrity: sha512-Hks6UIRZWW4c+qDAnx1csVsCGYeIR4MoBGQgJ+NUoNnO6qLxXuf8zu0xdcinyXUORgGzCdRsexxO1Xzv3sTdnw==}
+ peerDependencies:
+ i18next: '>= 25.6.2'
+ react: '>= 16.8.0'
+ react-dom: '*'
+ react-native: '*'
+ typescript: ^5
+ peerDependenciesMeta:
+ react-dom:
+ optional: true
+ react-native:
+ optional: true
+ typescript:
+ optional: true
+
+ resolution: {integrity: sha512-6yj+dcfMncEC21QPhOTsW8mOSO+pzFmT6uvU7XXdvM/Cp38zJkmTeMeKmTrmCMD5ToT79FmiE/mRWiYWcJYW4g==}
+ peerDependencies:
+ i18next: '>= 25.6.2'
+ react: '>= 16.8.0'
+ react-dom: '*'
+ react-native: '*'
+ typescript: ^5
+ peerDependenciesMeta:
+ react-dom:
+ optional: true
+ react-native:
+ optional: true
+ typescript:
+ optional: true
+
resolution: {integrity: sha512-mmRvA9aKP7zu9kVfP1AX1egX8tFlnE3DDXq92z0JTZezfOpmeQBzr77O1+mTV54OOmn+M2t6c5kFD5VnuFoM7A==}
peerDependencies:
@@@ -13999,12 -14611,12 +14859,18 @@@
vite:
optional: true
+ resolution: {integrity: sha512-iCmr4GSw4eSnaB+G8zc2f4dxSuDjbkjwpuBLLGvQYR9IW7rnDzftnUjOH5p4RYR+d4GsiBqXRvzuFhs5bnzVyw==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ peerDependencies:
+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0
+
+ resolution: {integrity: sha512-g2k9z8B/1Bx7D4wnFjPLx9dyYGrqWMLTpwTtPHhcU+ElNZP2O4+4OsyaficiDClus0dzVhdGvoGFYMJxoXZ12Q==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ peerDependencies:
+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0
+
resolution: {integrity: sha512-WaiOUlmt1fKw1w/WWJnx9gVk42D1BASKZmGCPpy6iTLE5iIemN2lim3MwI7Rffyt3aQnPrLfLSLnI8ZUJ9s49g==}
peerDependencies:
@@@ -15114,9 -15783,21 +16037,9 @@@ snapshots
dependencies:
'@babel/code-frame': 7.27.1
- '@babel/parser': 7.28.4
+ '@babel/parser': 7.28.5
'@babel/types': 7.28.5
- '@babel/[email protected]':
- dependencies:
- '@babel/code-frame': 7.27.1
- '@babel/generator': 7.28.3
- '@babel/helper-globals': 7.28.0
- '@babel/parser': 7.28.5
- '@babel/template': 7.27.2
- '@babel/types': 7.28.5
- debug: 4.4.3([email protected])
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@babel/code-frame': 7.27.1
@@@ -15207,31 -15893,29 +16130,31 @@@
- supports-color
- utf-8-validate
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-upload': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-upload': 47.4.0
+ ckeditor5: 47.4.0
+ transitivePeerDependencies:
+ - supports-color
dependencies:
'@aws-sdk/client-bedrock-runtime': 3.823.0
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-cloud-services': 47.3.0
- '@ckeditor/ckeditor5-collaboration-core': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-markdown-gfm': 47.3.0
- '@ckeditor/ckeditor5-real-time-collaboration': 47.3.0([email protected])([email protected])
- '@ckeditor/ckeditor5-table': 47.3.0
- '@ckeditor/ckeditor5-theme-lark': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
- ckeditor5-collaboration: 47.3.0
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-cloud-services': 47.4.0
+ '@ckeditor/ckeditor5-collaboration-core': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-markdown-gfm': 47.4.0
+ '@ckeditor/ckeditor5-real-time-collaboration': 47.4.0([email protected])([email protected])
+ '@ckeditor/ckeditor5-table': 47.4.0
+ '@ckeditor/ckeditor5-theme-lark': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ ckeditor5-collaboration: 47.4.0
diff: 8.0.2
dom-serializer: 2.0.0
domhandler: 5.0.3
@@@ -15346,35 -16030,31 +16269,35 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
es-toolkit: 1.39.5
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected](patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)':
+ '@ckeditor/[email protected](patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)':
dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-enter': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-enter': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
transitivePeerDependencies:
- supports-color
@@@ -15548,46 -16228,40 +16471,46 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
transitivePeerDependencies:
- supports-color
@@@ -15652,58 -16326,58 +16575,58 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
specificity: 0.4.1
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-cloud-services': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-merge-fields': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-cloud-services': 47.3.0
- '@ckeditor/ckeditor5-collaboration-core': 47.3.0
- '@ckeditor/ckeditor5-comments': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-merge-fields': 47.3.0
- '@ckeditor/ckeditor5-track-changes': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-cloud-services': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-merge-fields': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-cloud-services': 47.4.0
+ '@ckeditor/ckeditor5-collaboration-core': 47.4.0
+ '@ckeditor/ckeditor5-comments': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-merge-fields': 47.4.0
+ '@ckeditor/ckeditor5-track-changes': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
transitivePeerDependencies:
- supports-color
@@@ -15751,35 -16425,31 +16674,35 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
+ transitivePeerDependencies:
+ - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
transitivePeerDependencies:
- supports-color
@@@ -15819,28 -16489,32 +16742,30 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-cloud-services': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-merge-fields': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-heading': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-list': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-cloud-services': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-merge-fields': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-heading': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-list': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ transitivePeerDependencies:
+ - supports-color
'@ckeditor/[email protected]': {}
@@@ -15922,54 -16602,58 +16853,54 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-undo': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected](patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-undo': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
++ transitivePeerDependencies:
++ - supports-color
+
+ '@ckeditor/[email protected](patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-image': 47.3.0
- '@ckeditor/ckeditor5-mention': 47.3.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-image': 47.4.0
+ '@ckeditor/ckeditor5-mention': 47.4.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
- transitivePeerDependencies:
- - supports-color
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
protobufjs: 7.5.0
@@@ -16011,64 -16695,66 +16942,64 @@@
- utf-8-validate
- webpack-cli
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-theme-lark': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-theme-lark': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-paste-from-office': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- ckeditor5: 47.3.0
-
- dependencies:
- '@ckeditor/ckeditor-cloud-services-collaboration': 53.0.1(@ckeditor/[email protected])([email protected])([email protected])([email protected])
- '@ckeditor/ckeditor5-cloud-services': 47.3.0
- '@ckeditor/ckeditor5-comments': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-editor-multi-root': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-operations-compressor': 47.3.0
- '@ckeditor/ckeditor5-revision-history': 47.3.0
- '@ckeditor/ckeditor5-theme-lark': 47.3.0
- '@ckeditor/ckeditor5-track-changes': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
- ckeditor5-collaboration: 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-paste-from-office': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ ckeditor5: 47.4.0
+
+ dependencies:
+ '@ckeditor/ckeditor-cloud-services-collaboration': 53.0.2(@ckeditor/[email protected])([email protected])([email protected])([email protected])
+ '@ckeditor/ckeditor5-cloud-services': 47.4.0
+ '@ckeditor/ckeditor5-comments': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-editor-multi-root': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-operations-compressor': 47.4.0
+ '@ckeditor/ckeditor5-revision-history': 47.4.0
+ '@ckeditor/ckeditor5-theme-lark': 47.4.0
+ '@ckeditor/ckeditor5-track-changes': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ ckeditor5-collaboration: 47.4.0
es-toolkit: 1.39.5
transitivePeerDependencies:
- bufferutil
@@@ -16111,41 -16797,45 +17042,41 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-heading': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-mention': 47.3.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)
- '@ckeditor/ckeditor5-style': 47.3.0
- '@ckeditor/ckeditor5-template': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-theme-lark': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-heading': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-mention': 47.4.0(patch_hash=5981fb59ba35829e4dff1d39cf771000f8a8fdfa7a34b51d8af9549541f2d62d)
+ '@ckeditor/ckeditor5-style': 47.4.0
+ '@ckeditor/ckeditor5-template': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
- transitivePeerDependencies:
- - supports-color
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-theme-lark': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
'@codemirror/autocomplete': 6.18.6
'@codemirror/commands': 6.8.1
'@codemirror/lang-html': 6.4.11
@@@ -16153,91 -16843,95 +17084,91 @@@
'@codemirror/language': 6.11.0
'@codemirror/state': 6.5.2
'@codemirror/theme-one-dark': 6.1.2
- '@codemirror/view': 6.39.9
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-theme-lark': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-html-support': 47.3.0
- '@ckeditor/ckeditor5-list': 47.3.0
- '@ckeditor/ckeditor5-table': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@codemirror/view': 6.39.11
+ ckeditor5: 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-theme-lark': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-html-support': 47.4.0
+ '@ckeditor/ckeditor5-list': 47.4.0
+ '@ckeditor/ckeditor5-table': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- '@ckeditor/ckeditor5-widget': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ '@ckeditor/ckeditor5-widget': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-ui': 47.3.0
-
- '@ckeditor/[email protected]':
- dependencies:
- '@ckeditor/ckeditor5-clipboard': 47.3.0
- '@ckeditor/ckeditor5-code-block': 47.3.0(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)
- '@ckeditor/ckeditor5-collaboration-core': 47.3.0
- '@ckeditor/ckeditor5-comments': 47.3.0
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-editor-multi-root': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-enter': 47.3.0
- '@ckeditor/ckeditor5-find-and-replace': 47.3.0
- '@ckeditor/ckeditor5-font': 47.3.0
- '@ckeditor/ckeditor5-heading': 47.3.0
- '@ckeditor/ckeditor5-highlight': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-image': 47.3.0
- '@ckeditor/ckeditor5-link': 47.3.0
- '@ckeditor/ckeditor5-list': 47.3.0
- '@ckeditor/ckeditor5-media-embed': 47.3.0
- '@ckeditor/ckeditor5-merge-fields': 47.3.0
- '@ckeditor/ckeditor5-restricted-editing': 47.3.0
- '@ckeditor/ckeditor5-style': 47.3.0
- '@ckeditor/ckeditor5-table': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
- ckeditor5-collaboration: 47.3.0
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-ui': 47.4.0
+
+ '@ckeditor/[email protected]':
+ dependencies:
+ '@ckeditor/ckeditor5-clipboard': 47.4.0
+ '@ckeditor/ckeditor5-code-block': 47.4.0(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)
+ '@ckeditor/ckeditor5-collaboration-core': 47.4.0
+ '@ckeditor/ckeditor5-comments': 47.4.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-editor-multi-root': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-enter': 47.4.0
+ '@ckeditor/ckeditor5-find-and-replace': 47.4.0
+ '@ckeditor/ckeditor5-font': 47.4.0
+ '@ckeditor/ckeditor5-heading': 47.4.0
+ '@ckeditor/ckeditor5-highlight': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-image': 47.4.0
+ '@ckeditor/ckeditor5-link': 47.4.0
+ '@ckeditor/ckeditor5-list': 47.4.0
+ '@ckeditor/ckeditor5-media-embed': 47.4.0
+ '@ckeditor/ckeditor5-merge-fields': 47.4.0
+ '@ckeditor/ckeditor5-restricted-editing': 47.4.0
+ '@ckeditor/ckeditor5-style': 47.4.0
+ '@ckeditor/ckeditor5-table': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
+ ckeditor5-collaboration: 47.4.0
es-toolkit: 1.39.5
transitivePeerDependencies:
- supports-color
@@@ -16300,32 -16994,36 +17231,32 @@@
transitivePeerDependencies:
- supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-editor-multi-root': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-editor-multi-root': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-engine': 47.3.0
- '@ckeditor/ckeditor5-enter': 47.3.0
- '@ckeditor/ckeditor5-icons': 47.3.0
- '@ckeditor/ckeditor5-typing': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-engine': 47.4.0
+ '@ckeditor/ckeditor5-enter': 47.4.0
+ '@ckeditor/ckeditor5-icons': 47.4.0
+ '@ckeditor/ckeditor5-typing': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
es-toolkit: 1.39.5
- '@ckeditor/[email protected]':
+ '@ckeditor/[email protected]':
dependencies:
- '@ckeditor/ckeditor5-core': 47.3.0
- '@ckeditor/ckeditor5-ui': 47.3.0
- '@ckeditor/ckeditor5-utils': 47.3.0
- ckeditor5: 47.3.0
+ '@ckeditor/ckeditor5-core': 47.4.0
+ '@ckeditor/ckeditor5-ui': 47.4.0
+ '@ckeditor/ckeditor5-utils': 47.4.0
+ ckeditor5: 47.4.0
es-toolkit: 1.39.5
- transitivePeerDependencies:
- - supports-color
'@codemirror/[email protected]':
dependencies:
@@@ -17305,11 -18044,11 +18277,11 @@@
fractional-indexing: 3.2.0
fuzzy: 0.1.3
image-blob-reduce: 3.0.1
- jotai: 2.11.0(@types/[email protected])([email protected])
+ jotai: 2.11.0(@types/[email protected])([email protected])
lodash.debounce: 4.0.8
lodash.throttle: 4.1.1
- nanoid: 4.0.2
+ nanoid: 5.1.5
open-color: 1.9.1
pako: 2.0.3
perfect-freehand: 1.2.0
@@@ -18222,13 -19059,9 +19292,13 @@@
'@microsoft/[email protected]': {}
+ dependencies:
+ mind-elixir: 5.4.0
+
dependencies:
- mind-elixir: 5.5.0
+ mind-elixir: 5.6.1
'@mixmark-io/[email protected]': {}
@@@ -18585,22 -19430,22 +19667,27 @@@
'@babel/core': 7.28.0
'@babel/plugin-transform-react-jsx': 7.27.1(@babel/[email protected])
'@babel/plugin-transform-react-jsx-development': 7.27.1(@babel/[email protected])
'@rollup/pluginutils': 4.2.1
babel-plugin-transform-hook-names: 1.0.2(@babel/[email protected])
- debug: 4.4.1
+ debug: 4.4.3([email protected])
picocolors: 1.1.1
transitivePeerDependencies:
- preact
- supports-color
- '@preact/[email protected]': {}
+ '@preact/[email protected]': {}
+ dependencies:
- '@preact/signals-core': 1.12.1
++ '@preact/signals-core': 1.12.2
++ preact: 10.28.2
++
+ dependencies:
+ '@preact/signals-core': 1.12.2
preact: 10.28.2
'@prefresh/[email protected]': {}
@@@ -20979,8 -21836,8 +22068,10 @@@
'@zip.js/[email protected]': {}
+ '@zumer/[email protected]': {}
+
+ '@zumer/[email protected]': {}
+
@@@ -24551,12 -25589,18 +25819,24 @@@
optionalDependencies:
uglify-js: 3.19.3
+ dependencies:
+ '@types/node': 20.19.25
+ '@types/whatwg-mimetype': 3.0.2
+ whatwg-mimetype: 3.0.0
+
+ dependencies:
+ '@types/node': 24.10.9
+ '@types/whatwg-mimetype': 3.0.2
+ '@types/ws': 8.18.1
+ entities: 4.5.0
+ whatwg-mimetype: 3.0.0
+ transitivePeerDependencies:
+ - bufferutil
+ - utf-8-validate
+
@@@ -24941,12 -26000,12 +26236,18 @@@
transitivePeerDependencies:
- encoding
+ dependencies:
+ '@babel/runtime': 7.28.4
+ optionalDependencies:
+ typescript: 5.9.3
+
+ dependencies:
+ '@babel/runtime': 7.28.4
+ optionalDependencies:
+ typescript: 5.9.3
+
dependencies:
safer-buffer: 2.1.2
@@@ -25416,18 -26502,14 +26744,24 @@@
+ dependencies:
+ jquery: 3.7.1
+
+ dependencies:
+ jquery: 4.0.0
+
+
+
+
+
@@@ -25632,10 -26716,10 +26968,14 @@@
- supports-color
- utf-8-validate
+ dependencies:
+ commander: 8.3.0
+
+ dependencies:
+ commander: 8.3.0
+
@@@ -26550,9 -27693,7 +27949,9 @@@
+
dependencies:
@@@ -28164,20 -29457,20 +29707,31 @@@
react: 16.14.0
scheduler: 0.19.1
dependencies:
- react: 19.2.3
+ react: 19.2.4
scheduler: 0.27.0
+ dependencies:
+ '@babel/runtime': 7.28.4
+ html-parse-stringify: 3.0.1
+ i18next: 25.7.3([email protected])
- react: 19.2.3
- use-sync-external-store: 1.6.0([email protected])
++ react: 19.2.4
++ use-sync-external-store: 1.6.0([email protected])
++ optionalDependencies:
++ react-dom: 19.2.4([email protected])
++ typescript: 5.9.3
++
+ dependencies:
+ '@babel/runtime': 7.28.4
+ html-parse-stringify: 3.0.1
+ i18next: 25.8.0([email protected])
+ react: 19.2.4
+ use-sync-external-store: 1.6.0([email protected])
optionalDependencies:
- react-dom: 19.2.3([email protected])
+ react-dom: 19.2.4([email protected])
typescript: 5.9.3
@@@ -28243,17 -29536,12 +29797,17 @@@
dependencies:
clsx: 2.1.1
prop-types: 15.8.1
- react: 19.2.3
+ react: 19.2.4
+ dependencies:
- react: 19.2.3
- react-dom: 19.2.3([email protected])
++ react: 19.2.4
++ react-dom: 19.2.4([email protected])
+
dependencies:
- react: 19.2.3
- react-dom: 19.2.3([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
dependencies:
@@@ -30568,15 -32030,15 +32296,23 @@@
- rollup
- supports-color
++ dependencies:
++ chokidar: 3.6.0
++ p-map: 7.0.4
++ picocolors: 1.1.1
++ tinyglobby: 0.2.15
++
dependencies:
chokidar: 3.6.0
- p-map: 7.0.3
+ p-map: 7.0.4
picocolors: 1.1.1
tinyglobby: 0.2.15
dependencies:
svgo: 3.3.2
typescript: 5.9.3
diff --cc scripts/update-nightly-version.ts
index 39fb202774,c7496e5856..3ad12f37f2
--- a/scripts/update-nightly-version.ts
+++ b/scripts/update-nightly-version.ts
@@@ -46,7 -46,7 +46,7 @@@ function main()
const rootPackageJson = join(scriptDir, "..", "package.json");
patchPackageJson(rootPackageJson);
- for (const app of ["server", "client", "client-standalone"]) {
- for (const app of ["server", "client", "desktop"]) {
++ for (const app of ["server", "client", "client-standalone", "desktop"]) {
const appPackageJsonPath = join(scriptDir, "..", "apps", app, "package.json");
patchPackageJson(appPackageJsonPath);
}
diff --cc scripts/update-version.ts
index a0a16c2cef,d9e52abe45..8450c0ca1d
--- a/scripts/update-version.ts
+++ b/scripts/update-version.ts
@@@ -26,7 -26,7 +26,7 @@@ function getVersion(packageJsonPath: st
function main() {
const version = getVersion(join(__dirname, "..", "package.json"));
- for (const appName of ["server", "client", "client-standalone", "desktop"]) {
- for (const appName of ["server", "client", "desktop", "edit-docs"]) {
++ for (const appName of ["server", "client", "client-standalone", "desktop", "edit-docs"]) {
patchPackageJson(join(__dirname, "..", "apps", appName, "package.json"), version);
}