chore(types): add type for note meta file

This commit is contained in:
Elian Doran 2025-02-02 13:55:15 +02:00
parent 5afddb4ecc
commit acbd936654
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -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]

View File

@ -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[];