mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 14:55:50 +01:00
refactor(export/zip): extract into separate provider
This commit is contained in:
27
apps/server/src/services/export/zip/abstract_provider.ts
Normal file
27
apps/server/src/services/export/zip/abstract_provider.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Archiver } from "archiver";
|
||||
import type { default as NoteMeta, NoteMetaFile } from "../../meta/note_meta.js";
|
||||
|
||||
interface ZipExportProviderData {
|
||||
getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null;
|
||||
metaFile: NoteMetaFile;
|
||||
rootMeta: NoteMeta;
|
||||
archive: Archiver;
|
||||
}
|
||||
|
||||
export abstract class ZipExportProvider {
|
||||
|
||||
metaFile: NoteMetaFile;
|
||||
getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null;
|
||||
rootMeta: NoteMeta;
|
||||
archive: Archiver;
|
||||
|
||||
constructor(data: ZipExportProviderData) {
|
||||
this.metaFile = data.metaFile;
|
||||
this.getNoteTargetUrl = data.getNoteTargetUrl;
|
||||
this.rootMeta = data.rootMeta;
|
||||
this.archive = data.archive;
|
||||
}
|
||||
|
||||
abstract prepareMeta(): void;
|
||||
abstract afterDone(): void;
|
||||
}
|
||||
Reference in New Issue
Block a user