mirror of
https://github.com/zadam/trilium.git
synced 2026-06-25 13:11:35 +02:00
chore(core): fix meta types
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 {
|
||||
/**
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -192,7 +192,6 @@ export function waitForStreamToFinish(stream: any): Promise<void> {
|
||||
}
|
||||
|
||||
export default {
|
||||
compareVersions,
|
||||
constantTimeCompare,
|
||||
escapeHtml,
|
||||
escapeRegExp,
|
||||
|
||||
@@ -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,
|
||||
|
||||
49
packages/trilium-core/src/meta.ts
Normal file
49
packages/trilium-core/src/meta.ts
Normal 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user