import { AnyEntry, DocumentID, EntryDoc, EntryHasPath, FilePath, FilePathWithPrefix } from "./lib/src/types"; import { PouchDB } from "./lib/src/pouchdb-browser.js"; import type ObsidianLiveSyncPlugin from "./main"; export abstract class LiveSyncCommands { plugin: ObsidianLiveSyncPlugin; get app() { return this.plugin.app; } get settings() { return this.plugin.settings; } get localDatabase() { return this.plugin.localDatabase; } id2path(id: DocumentID, entry?: EntryHasPath, stripPrefix?: boolean): FilePathWithPrefix { return this.plugin.id2path(id, entry, stripPrefix); } async path2id(filename: FilePathWithPrefix | FilePath, prefix?: string): Promise { return await this.plugin.path2id(filename, prefix); } getPath(entry: AnyEntry): FilePathWithPrefix { return this.plugin.getPath(entry); } constructor(plugin: ObsidianLiveSyncPlugin) { this.plugin = plugin; } abstract onunload(): void; abstract onload(): void | Promise; abstract onInitializeDatabase(showNotice: boolean): void | Promise; abstract beforeReplicate(showNotice: boolean): void | Promise; abstract onResume(): void | Promise; abstract parseReplicationResultItem(docs: PouchDB.Core.ExistingDocument): Promise | boolean; abstract realizeSettingSyncMode(): Promise; }