chore(core): get rid of note_interface

This commit is contained in:
Elian Doran 2026-01-06 15:15:12 +02:00
parent 5508b505c8
commit de4d07e904
No known key found for this signature in database
2 changed files with 27 additions and 28 deletions

View File

@ -1,27 +0,0 @@
import type { NoteType } from "@triliumnext/commons";
export interface NoteParams {
/** optionally can force specific noteId */
noteId?: string;
branchId?: string;
parentNoteId: string;
templateNoteId?: string;
title: string;
content: string | Buffer;
/** 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";
}

View File

@ -1,4 +1,4 @@
import type { AttachmentRow, AttributeRow, BranchRow, NoteRow } from "@triliumnext/commons";
import type { AttachmentRow, AttributeRow, BranchRow, NoteRow, NoteType } from "@triliumnext/commons";
import { dayjs } from "@triliumnext/commons";
import { date_utils, events as eventService, ValidationError } from "@triliumnext/core";
import fs from "fs";
@ -39,6 +39,32 @@ interface Attachment {
title: string;
}
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";
}
function getNewNotePosition(parentNote: BNote) {
if (parentNote.isLabelTruthy("newNotesOnTop")) {
const minNotePos = parentNote