mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
chore(types): add type for note meta file
This commit is contained in:
parent
5afddb4ecc
commit
acbd936654
@ -21,6 +21,7 @@ import type AttributeMeta from "../meta/attribute_meta.js";
|
||||
import type BBranch from "../../becca/entities/bbranch.js";
|
||||
import type { Response } from "express";
|
||||
import { RESOURCE_DIR } from "../resource_dir.js";
|
||||
import type { NoteMetaFile } from "../meta/note_meta.js";
|
||||
|
||||
async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "html" | "markdown", res: Response | fs.WriteStream, setHeaders = true) {
|
||||
if (!["html", "markdown"].includes(format)) {
|
||||
@ -485,8 +486,11 @@ ${markdownContent}`;
|
||||
|
||||
const existingFileNames: Record<string, number> = format === "html" ? { navigation: 0, index: 1 } : {};
|
||||
const rootMeta = createNoteMeta(branch, { notePath: [] }, existingFileNames);
|
||||
if (!rootMeta) {
|
||||
throw new Error("Unable to create root meta.");
|
||||
}
|
||||
|
||||
const metaFile = {
|
||||
const metaFile: NoteMetaFile = {
|
||||
formatVersion: 2,
|
||||
appVersion: packageInfo.version,
|
||||
files: [rootMeta]
|
||||
|
@ -1,6 +1,12 @@
|
||||
import type AttachmentMeta from "./attachment_meta.js";
|
||||
import type AttributeMeta from "./attribute_meta.js";
|
||||
|
||||
export interface NoteMetaFile {
|
||||
formatVersion: number;
|
||||
appVersion: string;
|
||||
files: NoteMeta[];
|
||||
}
|
||||
|
||||
export default interface NoteMeta {
|
||||
noteId?: string;
|
||||
notePath?: string[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user