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
+65
View File
@@ -0,0 +1,65 @@
import { TFile, TFolder } from "@/deps";
import type { FilePath } from "@lib/common/models/db.type";
import type { UXFileInfoStub, UXInternalFileInfoStub } from "@lib/common/models/fileaccess.type";
import type { FileEventItem } from "@lib/common/models/fileaccess.type";
import type { IStorageEventManagerAdapter } from "@lib/managers/adapters";
import type { IStorageEventTypeGuardAdapter, IStorageEventPersistenceAdapter, IStorageEventWatchAdapter, IStorageEventStatusAdapter, IStorageEventConverterAdapter, IStorageEventWatchHandlers } from "@lib/managers/adapters";
import type { FileEventItemSentinel } from "@lib/managers/StorageEventManager";
import type ObsidianLiveSyncPlugin from "@/main";
import type { LiveSyncCore } from "@/main";
import type { FileProcessingService } from "@lib/services/base/FileProcessingService";
/**
* Obsidian-specific type guard adapter
*/
declare class ObsidianTypeGuardAdapter implements IStorageEventTypeGuardAdapter<TFile, TFolder> {
isFile(file: unknown): file is TFile;
isFolder(item: unknown): item is TFolder;
}
/**
* Obsidian-specific persistence adapter
*/
declare class ObsidianPersistenceAdapter implements IStorageEventPersistenceAdapter {
private core;
constructor(core: LiveSyncCore);
saveSnapshot(snapshot: (FileEventItem | FileEventItemSentinel)[]): Promise<void>;
loadSnapshot(): Promise<(FileEventItem | FileEventItemSentinel)[] | null>;
}
/**
* Obsidian-specific status adapter
*/
declare class ObsidianStatusAdapter implements IStorageEventStatusAdapter {
private fileProcessing;
constructor(fileProcessing: FileProcessingService);
updateStatus(status: {
batched: number;
processing: number;
totalQueued: number;
}): void;
}
/**
* Obsidian-specific converter adapter
*/
declare class ObsidianConverterAdapter implements IStorageEventConverterAdapter<TFile> {
toFileInfo(file: TFile, deleted?: boolean): UXFileInfoStub;
toInternalFileInfo(path: FilePath): UXInternalFileInfoStub;
}
/**
* Obsidian-specific watch adapter
*/
declare class ObsidianWatchAdapter implements IStorageEventWatchAdapter {
private plugin;
constructor(plugin: ObsidianLiveSyncPlugin);
beginWatch(handlers: IStorageEventWatchHandlers): Promise<void>;
}
/**
* Composite adapter for Obsidian StorageEventManager
*/
export declare class ObsidianStorageEventManagerAdapter implements IStorageEventManagerAdapter<TFile, TFolder> {
readonly typeGuard: ObsidianTypeGuardAdapter;
readonly persistence: ObsidianPersistenceAdapter;
readonly watch: ObsidianWatchAdapter;
readonly status: ObsidianStatusAdapter;
readonly converter: ObsidianConverterAdapter;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, fileProcessing: FileProcessingService);
}
export {};
+13
View File
@@ -0,0 +1,13 @@
import type { FilePath } from "@lib/common/models/db.type";
import type ObsidianLiveSyncPlugin from "@/main";
import type { LiveSyncCore } from "@/main";
import { StorageEventManagerBase, type StorageEventManagerBaseDependencies } from "@lib/managers/StorageEventManager";
import { ObsidianStorageEventManagerAdapter } from "./ObsidianStorageEventManagerAdapter";
export declare class StorageEventManagerObsidian extends StorageEventManagerBase<ObsidianStorageEventManagerAdapter> {
core: LiveSyncCore;
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, dependencies: StorageEventManagerBaseDependencies);
/**
* Override _watchVaultRawEvents to add Obsidian-specific logic
*/
protected _watchVaultRawEvents(path: FilePath): Promise<void>;
}