diff --git a/apps/server/src/becca/entities/battachment.ts b/apps/server/src/becca/entities/battachment.ts new file mode 100644 index 000000000..45a2e0cac --- /dev/null +++ b/apps/server/src/becca/entities/battachment.ts @@ -0,0 +1,2 @@ +import { BAttachment } from "@triliumnext/core"; +export default BAttachment; diff --git a/apps/server/src/becca/entities/battribute.ts b/apps/server/src/becca/entities/battribute.ts new file mode 100644 index 000000000..f7c6f70c3 --- /dev/null +++ b/apps/server/src/becca/entities/battribute.ts @@ -0,0 +1,2 @@ +import { BAttribute } from "@triliumnext/core"; +export default BAttribute; diff --git a/apps/server/src/becca/entities/bbranch.ts b/apps/server/src/becca/entities/bbranch.ts new file mode 100644 index 000000000..0c687237b --- /dev/null +++ b/apps/server/src/becca/entities/bbranch.ts @@ -0,0 +1,2 @@ +import { BBranch } from "@triliumnext/core"; +export default BBranch; diff --git a/apps/server/src/becca/entities/betapi_token.ts b/apps/server/src/becca/entities/betapi_token.ts new file mode 100644 index 000000000..114aa7400 --- /dev/null +++ b/apps/server/src/becca/entities/betapi_token.ts @@ -0,0 +1,2 @@ +import { BEtapiToken } from "@triliumnext/core"; +export default BEtapiToken; diff --git a/apps/server/src/becca/entities/bnote.ts b/apps/server/src/becca/entities/bnote.ts new file mode 100644 index 000000000..523e4e004 --- /dev/null +++ b/apps/server/src/becca/entities/bnote.ts @@ -0,0 +1,2 @@ +import { BNote } from "@triliumnext/core"; +export default BNote; diff --git a/apps/server/src/becca/entities/boption.ts b/apps/server/src/becca/entities/boption.ts new file mode 100644 index 000000000..e17b896ff --- /dev/null +++ b/apps/server/src/becca/entities/boption.ts @@ -0,0 +1,2 @@ +import { BOption } from "@triliumnext/core"; +export default BOption; diff --git a/apps/server/src/becca/entities/brecent_note.ts b/apps/server/src/becca/entities/brecent_note.ts new file mode 100644 index 000000000..e8cee478d --- /dev/null +++ b/apps/server/src/becca/entities/brecent_note.ts @@ -0,0 +1,2 @@ +import { BRecentNote } from "@triliumnext/core"; +export default BRecentNote; diff --git a/apps/server/src/becca/entities/brevision.ts b/apps/server/src/becca/entities/brevision.ts new file mode 100644 index 000000000..c11de52a4 --- /dev/null +++ b/apps/server/src/becca/entities/brevision.ts @@ -0,0 +1,2 @@ +import { BRevision } from "@triliumnext/core"; +export default BRevision; diff --git a/apps/server/src/services/import/zip.ts b/apps/server/src/services/import/zip.ts index c1ac90b91..51bb38cd0 100644 --- a/apps/server/src/services/import/zip.ts +++ b/apps/server/src/services/import/zip.ts @@ -1,26 +1,27 @@ -"use strict"; -import BAttribute from "../../becca/entities/battribute.js"; -import { removeTextFileExtension, newEntityId, getNoteTitle, processStringOrBuffer, unescapeHtml } from "../../services/utils.js"; -import log from "../../services/log.js"; -import noteService from "../../services/notes.js"; -import attributeService from "../../services/attributes.js"; -import BBranch from "../../becca/entities/bbranch.js"; + +import { ALLOWED_NOTE_TYPES, type NoteType } from "@triliumnext/commons"; import path from "path"; -import protectedSessionService from "../protected_session.js"; -import mimeService from "./mime.js"; -import treeService from "../tree.js"; +import type { Stream } from "stream"; import yauzl from "yauzl"; -import htmlSanitizer from "../html_sanitizer.js"; + import becca from "../../becca/becca.js"; import BAttachment from "../../becca/entities/battachment.js"; -import markdownService from "./markdown.js"; -import type TaskContext from "../task_context.js"; +import BAttribute from "../../becca/entities/battribute.js"; +import BBranch from "../../becca/entities/bbranch.js"; import type BNote from "../../becca/entities/bnote.js"; -import type NoteMeta from "../meta/note_meta.js"; +import attributeService from "../../services/attributes.js"; +import log from "../../services/log.js"; +import noteService from "../../services/notes.js"; +import { getNoteTitle, newEntityId, processStringOrBuffer, removeTextFileExtension, unescapeHtml } from "../../services/utils.js"; +import htmlSanitizer from "../html_sanitizer.js"; import type AttributeMeta from "../meta/attribute_meta.js"; -import type { Stream } from "stream"; -import { ALLOWED_NOTE_TYPES, type NoteType } from "@triliumnext/commons"; +import type NoteMeta from "../meta/note_meta.js"; +import protectedSessionService from "../protected_session.js"; +import type TaskContext from "../task_context.js"; +import treeService from "../tree.js"; +import markdownService from "./markdown.js"; +import mimeService from "./mime.js"; interface MetaFile { files: NoteMeta[]; @@ -108,7 +109,7 @@ async function importZip(taskContext: TaskContext<"importNotes">, fileBuffer: Bu dataFileName: "" }; - let parent: NoteMeta | undefined = undefined; + let parent: NoteMeta | undefined; for (let segment of pathSegments) { if (!cursor?.children?.length) { @@ -241,10 +242,10 @@ async function importZip(taskContext: TaskContext<"importNotes">, fileBuffer: Bu } const { note } = noteService.createNewNote({ - parentNoteId: parentNoteId, + parentNoteId, title: noteTitle || "", content: "", - noteId: noteId, + noteId, type: resolveNoteType(noteMeta?.type), mime: noteMeta ? noteMeta.mime : "text/html", prefix: noteMeta?.prefix || "", @@ -294,12 +295,12 @@ async function importZip(taskContext: TaskContext<"importNotes">, fileBuffer: Bu attachmentId: getNewAttachmentId(attachmentMeta.attachmentId), noteId: getNewNoteId(noteMeta.noteId) }; - } else { - // don't check for noteMeta since it's not mandatory for notes - return { - noteId: getNoteId(noteMeta, absUrl) - }; - } + } + // don't check for noteMeta since it's not mandatory for notes + return { + noteId: getNoteId(noteMeta, absUrl) + }; + } function processTextNoteContent(content: string, noteTitle: string, filePath: string, noteMeta?: NoteMeta) { @@ -312,9 +313,9 @@ async function importZip(taskContext: TaskContext<"importNotes">, fileBuffer: Bu content = content.replace(/