chore(core): fix meta types

This commit is contained in:
Elian Doran
2026-03-26 20:12:24 +02:00
parent 9c5bac5741
commit ce25bd10ff
9 changed files with 57 additions and 56 deletions

View File

@@ -102,8 +102,7 @@ function internalRoute<P extends ParamsDictionary>(method: HttpMethod, path: str
return;
}
if (result?.then) {
// promise
if (result instanceof Promise) {
result.then((promiseResult: unknown) => handleResponse(resultHandler, req, res, promiseResult, start)).catch((e: unknown) => handleException(e, method, path, res));
} else {
handleResponse(resultHandler, req, res, result, start);

View File

@@ -19,7 +19,7 @@
* ╚════════════════════════════════════════════════════════════════════════════╝
*/
import utils from "@triliumnext/core";
import { utils } from "@triliumnext/core";
import fs from "fs";
import ini from "ini";
import path from "path";

View File

@@ -6,9 +6,9 @@ import type BBranch from "../../../becca/entities/bbranch.js";
import type BNote from "../../../becca/entities/bnote.js";
import type { default as NoteMeta, NoteMetaFile } from "../../meta/note_meta.js";
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
export type { ExportFormat, NoteMeta } from "@triliumnext/core";
export type ExportFormat = "html" | "markdown" | "share";
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
export interface AdvancedExportOptions {
/**

View File

@@ -1,8 +1 @@
export default interface AttachmentMeta {
attachmentId?: string;
title: string;
role: string;
mime: string;
position?: number;
dataFileName: string;
}
export type { AttachmentMeta as default } from "@triliumnext/core";

View File

@@ -1,10 +1 @@
import type { AttributeType } from "@triliumnext/commons";
export default interface AttributeMeta {
noteId?: string;
type: AttributeType;
name: string;
value: string;
isInheritable?: boolean;
position?: number;
}
export type { AttributeMeta as default } from "@triliumnext/core";

View File

@@ -1,32 +1 @@
import type { NoteType } from "@triliumnext/commons";
import type AttachmentMeta from "./attachment_meta.js";
import type AttributeMeta from "./attribute_meta.js";
import type { ExportFormat } from "../export/zip/abstract_provider.js";
export interface NoteMetaFile {
formatVersion: number;
appVersion: string;
files: NoteMeta[];
}
export default interface NoteMeta {
noteId?: string;
notePath?: string[];
isClone?: boolean;
title?: string;
notePosition?: number;
prefix?: string | null;
isExpanded?: boolean;
type?: NoteType;
mime?: string;
/** 'html' or 'markdown', applicable to text notes only */
format?: ExportFormat;
dataFileName?: string;
dirFileName?: string;
/** this file should not be imported (e.g., HTML navigation) */
noImport?: boolean;
isImportRoot?: boolean;
attributes?: AttributeMeta[];
attachments?: AttachmentMeta[];
children?: NoteMeta[];
}
export { type NoteMeta as default, type NoteMetaFile } from "@triliumnext/core";

View File

@@ -192,7 +192,6 @@ export function waitForStreamToFinish(stream: any): Promise<void> {
}
export default {
compareVersions,
constantTimeCompare,
escapeHtml,
escapeRegExp,

View File

@@ -95,6 +95,7 @@ export { default as setup } from "./services/setup";
export { getPlatform, type PlatformProvider } from "./services/platform";
export { t } from "i18next";
export type { RequestProvider, ExecOpts, CookieJar } from "./services/request";
export type * from "./meta";
export async function initializeCore({ dbConfig, executionContext, crypto, translations, messaging, request, schema, extraAppInfo, platform }: {
dbConfig: SqlServiceParams,

View File

@@ -0,0 +1,49 @@
import type { AttributeType, NoteType } from "@triliumnext/commons";
export type ExportFormat = "html" | "markdown" | "share";
export interface AttachmentMeta {
attachmentId?: string;
title: string;
role: string;
mime: string;
position?: number;
dataFileName: string;
}
export interface AttributeMeta {
noteId?: string;
type: AttributeType;
name: string;
value: string;
isInheritable?: boolean;
position?: number;
}
export interface NoteMetaFile {
formatVersion: number;
appVersion: string;
files: NoteMeta[];
}
export interface NoteMeta {
noteId?: string;
notePath?: string[];
isClone?: boolean;
title?: string;
notePosition?: number;
prefix?: string | null;
isExpanded?: boolean;
type?: NoteType;
mime?: string;
/** 'html' or 'markdown', applicable to text notes only */
format?: ExportFormat;
dataFileName?: string;
dirFileName?: string;
/** this file should not be imported (e.g., HTML navigation) */
noImport?: boolean;
isImportRoot?: boolean;
attributes?: AttributeMeta[];
attachments?: AttachmentMeta[];
children?: NoteMeta[];
}