diff --git a/src/services/export/zip.ts b/src/services/export/zip.ts index bcf07c876..f6ffb45d1 100644 --- a/src/services/export/zip.ts +++ b/src/services/export/zip.ts @@ -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 = 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] diff --git a/src/services/meta/note_meta.ts b/src/services/meta/note_meta.ts index 79d2e4cd2..0aaafb6b5 100644 --- a/src/services/meta/note_meta.ts +++ b/src/services/meta/note_meta.ts @@ -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[];