add type defs for community automatic review

This commit is contained in:
vorotamoroz
2026-06-11 06:14:58 +01:00
parent 7e65e5dc68
commit 32c9f76c93
367 changed files with 28411 additions and 1 deletions
+147
View File
@@ -0,0 +1,147 @@
import { type PluginManifest, type App } from "@/deps.ts";
import type { EntryDoc } from "@lib/common/models/db.definition";
import type { LoadedEntry, FilePathWithPrefix, FilePath, AnyEntry } from "@lib/common/models/db.type";
import { LiveSyncCommands } from "@/features/LiveSyncCommands.ts";
import { PeriodicProcessor } from "@/common/PeriodicProcessor.ts";
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
import type ObsidianLiveSyncPlugin from "@/main.ts";
import type { PluginDialogModal } from "./PluginDialogModal.ts";
import type { InjectableServiceHub } from "@lib/services/InjectableServices.ts";
import type { LiveSyncCore } from "@/main.ts";
declare global {
interface OPTIONAL_SYNC_FEATURES {
DISABLE: "DISABLE";
CUSTOMIZE: "CUSTOMIZE";
DISABLE_CUSTOM: "DISABLE_CUSTOM";
}
}
export declare const pluginList: import("svelte/store").Writable<PluginDataExDisplay[]>;
export declare const pluginIsEnumerating: import("svelte/store").Writable<boolean>;
export declare const pluginV2Progress: import("svelte/store").Writable<number>;
export type PluginDataExFile = {
filename: string;
data: string[];
mtime: number;
size: number;
version?: string;
hash?: string;
displayName?: string;
};
export interface IPluginDataExDisplay {
documentPath: FilePathWithPrefix;
category: string;
name: string;
term: string;
displayName?: string;
files: (LoadedEntryPluginDataExFile | PluginDataExFile)[];
version?: string;
mtime: number;
}
export type PluginDataExDisplay = {
documentPath: FilePathWithPrefix;
category: string;
name: string;
term: string;
displayName?: string;
files: PluginDataExFile[];
version?: string;
mtime: number;
};
type LoadedEntryPluginDataExFile = LoadedEntry & PluginDataExFile;
export declare const pluginManifests: Map<string, PluginManifest>;
export declare const pluginManifestStore: import("svelte/store").Writable<Map<string, PluginManifest>>;
export declare class PluginDataExDisplayV2 {
documentPath: FilePathWithPrefix;
category: string;
term: string;
files: LoadedEntryPluginDataExFile[];
name: string;
confKey: string;
constructor(data: IPluginDataExDisplay);
setFile(file: LoadedEntryPluginDataExFile): Promise<void>;
deleteFile(filename: string): void;
_displayName: string | undefined;
_version: string | undefined;
applyLoadedManifest(): void;
get displayName(): string;
get version(): string | undefined;
get mtime(): number;
}
export type PluginDataEx = {
documentPath?: FilePathWithPrefix;
category: string;
name: string;
displayName?: string;
term: string;
files: PluginDataExFile[];
version?: string;
mtime: number;
};
export declare class ConfigSync extends LiveSyncCommands {
pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, pluginDialogClass: new (app: App, plugin: ObsidianLiveSyncPlugin) => PluginDialogModal);
get configDir(): string;
get kvDB(): import("../../lib/src/interfaces/KeyValueDatabase.ts").KeyValueDatabase;
get useV2(): boolean;
get useSyncPluginEtc(): boolean;
isThisModuleEnabled(): boolean;
pluginDialog?: PluginDialogModal;
periodicPluginSweepProcessor: PeriodicProcessor;
pluginList: IPluginDataExDisplay[];
showPluginSyncModal(): void;
hidePluginSyncModal(): void;
onunload(): void;
addRibbonIcon: (icon: string, title: string, callback: (evt: MouseEvent) => any) => HTMLElement;
onload(): void;
getFileCategory(filePath: string): "CONFIG" | "THEME" | "SNIPPET" | "PLUGIN_MAIN" | "PLUGIN_ETC" | "PLUGIN_DATA" | "";
isTargetPath(filePath: string): boolean;
private _everyOnDatabaseInitialized;
_everyBeforeReplicate(showNotice: boolean): Promise<boolean>;
_everyOnResumeProcess(): Promise<boolean>;
_everyAfterResumeProcess(): Promise<boolean>;
reloadPluginList(showMessage: boolean): Promise<void>;
loadPluginData(path: FilePathWithPrefix): Promise<PluginDataExDisplay | false>;
pluginScanProcessor: QueueProcessor<AnyEntry, never>;
pluginScanProcessorV2: QueueProcessor<AnyEntry, never>;
filenameToUnifiedKey(path: string, termOverRide?: string): FilePathWithPrefix;
filenameWithUnifiedKey(path: string, termOverRide?: string): FilePathWithPrefix;
unifiedKeyPrefixOfTerminal(termOverRide?: string): FilePathWithPrefix;
parseUnifiedPath(unifiedPath: FilePathWithPrefix): {
category: string;
device: string;
key: string;
filename: string;
pathV1: FilePathWithPrefix;
};
loadedManifest_mTime: Map<string, number>;
createPluginDataExFileV2(unifiedPathV2: FilePathWithPrefix, loaded?: LoadedEntry): Promise<false | LoadedEntryPluginDataExFile>;
createPluginDataFromV2(unifiedPathV2: FilePathWithPrefix): PluginDataExDisplayV2 | undefined;
updatingV2Count: number;
updatePluginListV2(showMessage: boolean, unifiedFilenameWithKey: FilePathWithPrefix): Promise<void>;
migrateV1ToV2(showMessage: boolean, entry: AnyEntry): Promise<void>;
updatePluginList(showMessage: boolean, updatedDocumentPath?: FilePathWithPrefix): Promise<void>;
compareUsingDisplayData(dataA: IPluginDataExDisplay, dataB: IPluginDataExDisplay, compareEach?: boolean): Promise<boolean>;
applyDataV2(data: PluginDataExDisplayV2, content?: string): Promise<boolean>;
applyData(data: IPluginDataExDisplay, content?: string): Promise<boolean>;
deleteData(data: PluginDataEx): Promise<boolean>;
_anyModuleParsedReplicationResultItem(docs: PouchDB.Core.ExistingDocument<EntryDoc>): Promise<boolean>;
_everyRealizeSettingSyncMode(): Promise<boolean>;
recentProcessedInternalFiles: string[];
makeEntryFromFile(path: FilePath): Promise<false | PluginDataExFile>;
storeCustomisationFileV2(path: FilePath, term: string, force?: boolean): Promise<boolean | PouchDB.Core.Response | undefined>;
storeCustomizationFiles(path: FilePath, termOverRide?: string): Promise<boolean | PouchDB.Core.Response | undefined>;
_anyProcessOptionalFileEvent(path: FilePath): Promise<boolean>;
watchVaultRawEventsAsync(path: FilePath): Promise<boolean>;
scanAllConfigFiles(showMessage: boolean): Promise<void>;
deleteConfigOnDatabase(prefixedFileName: FilePathWithPrefix, forceWrite?: boolean): Promise<boolean>;
scanInternalFiles(): Promise<FilePath[]>;
private _allAskUsingOptionalSyncFeature;
private __askHiddenFileConfiguration;
_anyGetOptionalConflictCheckMethod(path: FilePathWithPrefix): Promise<boolean | "newer">;
private _allSuspendExtraSync;
private _allConfigureOptionalSyncFeature;
configureHiddenFileSync(mode: keyof OPTIONAL_SYNC_FEATURES): Promise<void>;
getFiles(path: string, lastDepth: number): Promise<string[]>;
onBindFunction(core: LiveSyncCore, services: InjectableServiceHub): void;
}
export {};
+11
View File
@@ -0,0 +1,11 @@
import { mount } from "svelte";
import { App, Modal } from "@/deps.ts";
import type ObsidianLiveSyncPlugin from "@/main.ts";
export declare class PluginDialogModal extends Modal {
plugin: ObsidianLiveSyncPlugin;
component: ReturnType<typeof mount> | undefined;
isOpened(): boolean;
constructor(app: App, plugin: ObsidianLiveSyncPlugin);
onOpen(): void;
onClose(): void;
}
+19
View File
@@ -0,0 +1,19 @@
import { App, Modal } from "@/deps.ts";
import type { FilePath, LoadedEntry } from "@lib/common/models/db.type";
import { mount } from "svelte";
export declare class JsonResolveModal extends Modal {
filename: FilePath;
callback?: (keepRev?: string, mergedStr?: string) => Promise<void>;
docs: LoadedEntry[];
component?: ReturnType<typeof mount>;
nameA: string;
nameB: string;
defaultSelect: string;
keepOrder: boolean;
hideLocal: boolean;
title: string;
constructor(app: App, filename: FilePath, docs: LoadedEntry[], callback: (keepRev?: string, mergedStr?: string) => Promise<void>, nameA?: string, nameB?: string, defaultSelect?: string, keepOrder?: boolean, hideLocal?: boolean, title?: string);
UICallback(keepRev?: string, mergedStr?: string): Promise<void>;
onOpen(): void;
onClose(): void;
}
+153
View File
@@ -0,0 +1,153 @@
import type { LoadedEntry, FilePathWithPrefix, FilePath, DocumentID, MetaEntry } from "@lib/common/models/db.type";
import type { UXFileInfo, UXStat, UXDataWriteOptions } from "@lib/common/models/fileaccess.type";
import { type InternalFileInfo } from "@/common/types.ts";
import type { CustomRegExp } from "@lib/common/utils.regexp.ts";
import { type MapLike } from "@/common/utils.ts";
import { PeriodicProcessor } from "@/common/PeriodicProcessor.ts";
import { LiveSyncCommands } from "@/features/LiveSyncCommands.ts";
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
import type { LiveSyncCore } from "@/main.ts";
type SyncDirection = "push" | "pull" | "safe" | "pullForce" | "pushForce";
declare global {
interface OPTIONAL_SYNC_FEATURES {
FETCH: "FETCH";
OVERWRITE: "OVERWRITE";
MERGE: "MERGE";
DISABLE: "DISABLE";
DISABLE_HIDDEN: "DISABLE_HIDDEN";
}
}
export declare class HiddenFileSync extends LiveSyncCommands {
isThisModuleEnabled(): boolean;
periodicInternalFileScanProcessor: PeriodicProcessor;
get kvDB(): import("../../lib/src/interfaces/KeyValueDatabase").KeyValueDatabase;
getConflictedDoc(path: FilePathWithPrefix, rev: string): Promise<false | import("../../lib/src/common/types").diff_result_leaf>;
onunload(): void;
onload(): void;
private _everyOnDatabaseInitialized;
_everyBeforeReplicate(showNotice: boolean): Promise<boolean>;
private _everyOnloadAfterLoadSettings;
updateSettingCache(): void;
isReady(): boolean;
performStartupScan(showNotice: boolean): Promise<void>;
_everyOnResumeProcess(): Promise<boolean>;
_everyRealizeSettingSyncMode(): Promise<boolean>;
_anyProcessOptionalFileEvent(path: FilePath): Promise<boolean>;
_anyGetOptionalConflictCheckMethod(path: FilePathWithPrefix): Promise<boolean | "newer">;
_anyProcessOptionalSyncFiles(doc: LoadedEntry): Promise<boolean>;
loadFileWithInfo(path: FilePath): Promise<UXFileInfo>;
_fileInfoLastProcessed: MapLike<string, string>;
_fileInfoLastKnown: MapLike<string, number>;
_databaseInfoLastProcessed: MapLike<string, string>;
statToKey(stat: UXStat | null): string;
docToKey(doc: LoadedEntry | MetaEntry): string;
fileToStatKey(file: FilePath, stat?: UXStat | null): Promise<string>;
updateLastProcessedFile(file: FilePath, keySrc: string | UXStat): void;
updateLastProcessedAsActualFile(file: FilePath, stat?: UXStat | null): Promise<void>;
resetLastProcessedFile(targetFiles: FilePath[] | false): void;
getLastProcessedFileMTime(file: FilePath): number;
getLastProcessedFileKey(file: FilePath): string | undefined;
getLastProcessedDatabaseKey(file: FilePath): string | undefined;
updateLastProcessedDatabase(file: FilePath, keySrc: string | MetaEntry | LoadedEntry): void;
updateLastProcessed(path: FilePath, db: MetaEntry | LoadedEntry, stat: UXStat): void;
updateLastProcessedDeletion(path: FilePath, db: MetaEntry | LoadedEntry | false): void;
ensureDir(path: FilePath): Promise<void>;
writeFile(path: FilePath, data: string | ArrayBuffer, opt?: UXDataWriteOptions): Promise<UXStat | null>;
__removeFile(path: FilePath): Promise<"OK" | "ALREADY" | false>;
triggerEvent(path: FilePath): Promise<void>;
updateLastProcessedAsActualDatabase(file: FilePath, doc?: MetaEntry | LoadedEntry | null | false): Promise<void>;
resetLastProcessedDatabase(targetFiles: FilePath[] | false): void;
adoptCurrentStorageFilesAsProcessed(targetFiles: FilePath[] | false): Promise<void>;
adoptCurrentDatabaseFilesAsProcessed(targetFiles: FilePath[] | false): Promise<void>;
semaphore: import("octagonal-wheels/concurrency/semaphore_v2").SemaphoreObject;
serializedForEvent<T>(file: FilePath, fn: () => Promise<T>): Promise<T>;
useStorageFiles(files: FilePath[], showNotice?: boolean, onlyNew?: boolean): Promise<void>;
trackScannedStorageChanges(processFiles: FilePath[], showNotice?: boolean, onlyNew?: boolean, forceWriteAll?: boolean, includeDeleted?: boolean): Promise<void>;
scanAllStorageChanges(showNotice?: boolean, onlyNew?: boolean, forceWriteAll?: boolean, includeDeleted?: boolean): Promise<void | null>;
/**
* check the file is changed or not, and if changed, process it.
*/
trackStorageFileModification(path: FilePath, onlyNew?: boolean, forceWrite?: boolean, includeDeleted?: boolean): Promise<boolean | undefined>;
pendingConflictChecks: Set<FilePathWithPrefix>;
queueConflictCheck(path: FilePathWithPrefix): void;
finishConflictCheck(path: FilePathWithPrefix): void;
requeueConflictCheck(path: FilePathWithPrefix): void;
resolveConflictOnInternalFiles(): Promise<void>;
resolveByNewerEntry(id: DocumentID, path: FilePathWithPrefix, currentDoc: MetaEntry, currentRev: string, conflictedRev: string): Promise<void>;
conflictResolutionProcessor: QueueProcessor<FilePathWithPrefix, {
path: FilePathWithPrefix;
revA: string;
revB: string;
id: DocumentID;
doc: MetaEntry & PouchDB.Core.IdMeta & PouchDB.Core.GetMeta;
}>;
showJSONMergeDialogAndMerge(docA: LoadedEntry, docB: LoadedEntry): Promise<boolean>;
getDocProps(doc: LoadedEntry): {
id: DocumentID;
rev: string | undefined;
revDisplay: string;
prefixedPath: FilePathWithPrefix;
path: FilePath;
isDeleted: boolean;
shortenedId: string;
shortenedPath: string;
};
processReplicationResult(doc: LoadedEntry): Promise<boolean>;
cacheFileRegExps: Map<string, CustomRegExp[][]>;
/**
* Parses the regular expression settings for hidden file synchronization.
* @returns An object containing the ignore and target filters.
*/
parseRegExpSettings(): {
ignoreFilter: CustomRegExp[];
targetFilter: CustomRegExp[];
};
/**
* Checks if the target file path matches the defined patterns.
*/
isTargetFileInPatterns(path: string): boolean;
cacheCustomisationSyncIgnoredFiles: Map<string, string[]>;
/**
* Gets the list of files ignored for customization synchronization.
* @returns An array of ignored file paths (lowercase).
*/
getCustomisationSynchronizationIgnoredFiles(): string[];
/**
* Checks if the given path is not ignored by customization synchronization.
* @param path The file path to check.
* @returns True if the path is not ignored; otherwise, false.
*/
isNotIgnoredByCustomisationSync(path: string): boolean;
isHiddenFileSyncHandlingPath(path: FilePath): boolean;
isTargetFile(path: FilePath): Promise<boolean>;
trackScannedDatabaseChange(processFiles: MetaEntry[], showNotice?: boolean, onlyNew?: boolean, forceWriteAll?: boolean, includeDeletion?: boolean): Promise<void>;
applyOfflineChanges(showNotice: boolean): Promise<void>;
scanAllDatabaseChanges(showNotice?: boolean, onlyNew?: boolean, forceWriteAll?: boolean, includeDeletion?: boolean): Promise<void | null>;
useDatabaseFiles(files: MetaEntry[], showNotice?: boolean, onlyNew?: boolean): Promise<boolean>;
trackDatabaseFileModification(path: FilePath, headerLine: string, preventDoubleProcess?: boolean, onlyNew?: boolean, meta?: MetaEntry | false, includeDeletion?: boolean): Promise<boolean>;
queuedNotificationFiles: Set<string>;
notifyConfigChange(): void;
queueNotification(key: FilePath): void;
rebuildMerging(showNotice: boolean, targetFiles?: FilePath[] | false): Promise<FilePath[]>;
rebuildFromStorage(showNotice: boolean, targetFiles?: FilePath[] | false, onlyNew?: boolean): Promise<FilePath[]>;
getAllDatabaseFiles(): Promise<MetaEntry[]>;
rebuildFromDatabase(showNotice: boolean, targetFiles?: FilePath[] | false, onlyNew?: boolean): Promise<MetaEntry[]>;
initialiseInternalFileSync(direction: SyncDirection, showMessage: boolean, targetFilesSrc?: string[] | false): Promise<void>;
__loadBaseSaveData(file: FilePath, includeContent?: boolean): Promise<LoadedEntry | false>;
storeInternalFileToDatabase(file: InternalFileInfo | UXFileInfo, forceWrite?: boolean): Promise<boolean | undefined>;
deleteInternalFileOnDatabase(filenameSrc: FilePath, forceWrite?: boolean): Promise<boolean | undefined>;
extractInternalFileFromDatabase(storageFilePath: FilePath, force?: boolean, metaEntry?: MetaEntry | LoadedEntry, preventDoubleProcess?: boolean, onlyNew?: boolean, includeDeletion?: boolean): Promise<boolean | undefined>;
__checkIsNeedToWriteFile(storageFilePath: FilePath, content: string | ArrayBuffer): Promise<boolean>;
__writeFile(storageFilePath: FilePath, fileOnDB: LoadedEntry, force: boolean): Promise<false | UXStat>;
__deleteFile(storageFilePath: FilePath): Promise<false | "OK" | "ALREADY">;
private _allAskUsingOptionalSyncFeature;
private __askHiddenFileConfiguration;
private _allSuspendExtraSync;
private _allConfigureOptionalSyncFeature;
configureHiddenFileSync(mode: keyof OPTIONAL_SYNC_FEATURES): Promise<void>;
scanInternalFileNames(): Promise<FilePath[]>;
scanInternalFiles(): Promise<InternalFileInfo[]>;
getFiles(path: string, checkFunction: (path: FilePath) => Promise<boolean> | boolean): Promise<string[]>;
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
}
export {};
+35
View File
@@ -0,0 +1,35 @@
import type { AnyEntry, DocumentID, FilePath, FilePathWithPrefix } from "@lib/common/models/db.type";
import type { LOG_LEVEL } from "@lib/common/logger";
import type ObsidianLiveSyncPlugin from "@/main.ts";
import type { LiveSyncCore } from "@/main.ts";
import { createInstanceLogFunction } from "@lib/services/lib/logUtils.ts";
export declare abstract class LiveSyncCommands {
/**
* @deprecated This class is deprecated. Please use core
*/
plugin: ObsidianLiveSyncPlugin;
core: LiveSyncCore;
get app(): import("obsidian").App;
get settings(): import("../lib/src/common/types").ObsidianLiveSyncSettings;
get localDatabase(): import("../lib/src/pouchdb/LiveSyncLocalDB").LiveSyncLocalDB;
get services(): import("../lib/src/services/InjectableServices").InjectableServiceHub<import("../lib/src/services/implements/obsidian/ObsidianServiceContext").ObsidianServiceContext>;
path2id(filename: FilePathWithPrefix | FilePath, prefix?: string): Promise<DocumentID>;
getPath(entry: AnyEntry): FilePathWithPrefix;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore);
abstract onunload(): void;
abstract onload(): void | Promise<void>;
_isMainReady(): boolean;
_isMainSuspended(): boolean;
_isDatabaseReady(): boolean;
_log: ReturnType<typeof createInstanceLogFunction>;
_verbose: (msg: unknown, key?: string) => void;
_info: (msg: unknown, key?: string) => void;
_notice: (msg: unknown, key?: string) => void;
_progress: (prefix?: string, level?: LOG_LEVEL) => {
log: (msg: unknown) => void;
once: (msg: unknown) => void;
done: (msg?: string) => void;
};
_debug: (msg: unknown, key?: string) => void;
onBindFunction(core: LiveSyncCore, services: typeof core.services): void;
}
@@ -0,0 +1,58 @@
import type { DocumentID, EntryLeaf } from "@lib/common/models/db.type";
import type { EntryDoc } from "@lib/common/models/db.definition";
import { LiveSyncCommands } from "@/features/LiveSyncCommands";
type ChunkID = DocumentID;
type NoteDocumentID = DocumentID;
type Rev = string;
type ChunkUsageMap = Map<NoteDocumentID, Map<Rev, Set<ChunkID>>>;
export declare class LocalDatabaseMaintenance extends LiveSyncCommands {
onunload(): void;
onload(): void | Promise<void>;
allChunks(includeDeleted?: boolean): Promise<{
used: Set<string>;
existing: Map<string, EntryLeaf>;
}>;
get database(): PouchDB.Database<EntryDoc>;
clearHash(): void;
confirm(title: string, message: string, affirmative?: string, negative?: string): Promise<boolean>;
isAvailable(): boolean;
/**
* Resurrect deleted chunks that are still used in the database.
*/
resurrectChunks(): Promise<void>;
/**
* Commit deletion of files that are marked as deleted.
* This method makes the deletion permanent, and the files will not be recovered.
* After this, chunks that are used in the deleted files become ready for compaction.
*/
commitFileDeletion(): Promise<void>;
/**
* Commit deletion of chunks that are not used in the database.
* This method makes the deletion permanent, and the chunks will not be recovered if the database run compaction.
* After this, the database can shrink the database size by compaction.
* It is recommended to compact the database after this operation (History should be kept once before compaction).
*/
commitChunkDeletion(): Promise<void>;
/**
* Compact the database.
* This method removes all deleted chunks that are not used in the database.
* Make sure all devices are synchronized before running this method.
*/
markUnusedChunks(): Promise<void>;
removeUnusedChunks(): Promise<void>;
scanUnusedChunks(): Promise<{
chunkSet: Set<DocumentID>;
chunkUsageMap: ChunkUsageMap;
unusedSet: Set<DocumentID>;
}>;
/**
* Track changes in the database and update the chunk usage map for garbage collection.
* Note that this only able to perform without Fetch chunks on demand.
*/
trackChanges(fromStart?: boolean, showNotice?: boolean): Promise<void>;
performGC(showingNotice?: boolean): Promise<void>;
analyseDatabase(): Promise<void>;
compactDatabase(): Promise<void>;
gcv3(): Promise<void>;
}
export {};
@@ -0,0 +1,21 @@
import { App, Modal } from "@/deps.ts";
import { mount } from "svelte";
import type { LiveSyncTrysteroReplicator } from "@lib/replication/trystero/LiveSyncTrysteroReplicator";
export type P2POpenReplicationModalCallback = {
onSync: (peerId: string) => Promise<void>;
onSyncAndClose: (peerId: string) => Promise<void>;
};
export declare class P2POpenReplicationModal extends Modal {
liveSyncReplicator: LiveSyncTrysteroReplicator;
callback?: P2POpenReplicationModalCallback;
component?: ReturnType<typeof mount>;
showResult: boolean;
title: string;
onClosed?: () => void;
rebuildMode: boolean;
constructor(app: App, liveSyncReplicator: LiveSyncTrysteroReplicator, callback?: P2POpenReplicationModalCallback, showResult?: boolean, title?: string, onClosed?: () => void, rebuildMode?: boolean);
onSync(peerId: string): Promise<void>;
onSyncAndClose(peerId: string): Promise<void>;
onOpen(): void;
onClose(): void;
}
@@ -0,0 +1,22 @@
import { App } from "@/deps.ts";
import type { LiveSyncTrysteroReplicator } from "@lib/replication/trystero/LiveSyncTrysteroReplicator";
/**
* Creates an openReplicationUI factory for Obsidian environments.
* Returns a per-replicator closure that opens the P2P Replication modal
* and performs bidirectional sync (pull then push on success).
*
* Usage:
* const factory = createOpenReplicationUI(app);
* useP2PReplicatorFeature(core, factory);
*/
export declare function createOpenReplicationUI(app: App): (replicator: LiveSyncTrysteroReplicator) => (showResult: boolean) => Promise<boolean | void>;
/**
* Creates an openRebuildUI factory for Obsidian environments.
* Opens the P2P Replication modal in "rebuild" mode — one-way pull only,
* with setOnSetup / clearOnSetup bracketing the replicateFrom call.
*
* Usage:
* const factory = createOpenRebuildUI(app);
* useP2PReplicatorFeature(core, createOpenReplicationUI(app), factory);
*/
export declare function createOpenRebuildUI(app: App): (replicator: LiveSyncTrysteroReplicator) => (showResult: boolean) => Promise<boolean | void>;
@@ -0,0 +1,28 @@
import { Menu, WorkspaceLeaf } from "@/deps.ts";
import { SvelteItemView } from "@/common/SvelteItemView.ts";
import { type PeerStatus } from "@lib/replication/trystero/P2PReplicatorPaneCommon.ts";
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore.ts";
import type { P2PPaneParams } from "@lib/replication/trystero/UseP2PReplicatorResult";
export declare const VIEW_TYPE_P2P = "p2p-replicator";
export declare class P2PReplicatorPaneView extends SvelteItemView {
core: LiveSyncBaseCore;
private _p2pResult;
icon: string;
title: string;
navigation: boolean;
getIcon(): string;
get replicator(): import("../../../lib/src/replication/trystero/LiveSyncTrysteroReplicator").LiveSyncTrysteroReplicator;
replicateFrom(peer: PeerStatus): Promise<void>;
replicateTo(peer: PeerStatus): Promise<void>;
getRemoteConfig(peer: PeerStatus): Promise<void>;
toggleProp(peer: PeerStatus, prop: "syncOnConnect" | "watchOnConnect" | "syncOnReplicationCommand"): Promise<void>;
m?: Menu;
constructor(leaf: WorkspaceLeaf, core: LiveSyncBaseCore, p2pResult: P2PPaneParams);
getViewType(): string;
getDisplayText(): string;
onClose(): Promise<void>;
instantiateComponent(target: HTMLElement): {
$on?(type: string, callback: (e: any) => void): () => void;
$set?(props: Partial<Record<string, any>>): void;
} & Record<string, any>;
}
@@ -0,0 +1,19 @@
import { WorkspaceLeaf } from "@/deps.ts";
import { SvelteItemView } from "@/common/SvelteItemView.ts";
import type { LiveSyncBaseCore } from "@/LiveSyncBaseCore.ts";
import type { P2PPaneParams } from "@lib/replication/trystero/UseP2PReplicatorResult";
export declare const VIEW_TYPE_P2P_SERVER_STATUS = "p2p-server-status";
export declare class P2PServerStatusPaneView extends SvelteItemView {
core: LiveSyncBaseCore;
private _p2pResult;
icon: string;
navigation: boolean;
constructor(leaf: WorkspaceLeaf, core: LiveSyncBaseCore, p2pResult: P2PPaneParams);
getIcon(): string;
getViewType(): string;
getDisplayText(): string;
instantiateComponent(target: HTMLElement): {
$on?(type: string, callback: (e: any) => void): () => void;
$set?(props: Partial<Record<string, any>>): void;
} & Record<string, any>;
}