mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-03 14:21:52 +00:00
Preparing v0.24.0
This commit is contained in:
14
src/modules/interfaces/Confirm.ts
Normal file
14
src/modules/interfaces/Confirm.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export interface Confirm {
|
||||
askYesNo(message: string): Promise<"yes" | "no">;
|
||||
askString(title: string, key: string, placeholder: string, isPassword?: boolean): Promise<string | false>;
|
||||
|
||||
askYesNoDialog(message: string, opt: { title?: string, defaultOption?: "Yes" | "No", timeout?: number }): Promise<"yes" | "no">;
|
||||
|
||||
askSelectString(message: string, items: string[]): Promise<string>
|
||||
|
||||
askSelectStringDialogue(message: string, buttons: string[], opt: { title?: string, defaultAction: (typeof buttons)[number], timeout?: number }): Promise<(typeof buttons)[number] | false>;
|
||||
|
||||
askInPopup(key: string, dialogText: string, anchorCallback: (anchor: HTMLAnchorElement) => void): void;
|
||||
|
||||
confirmWithMessage(title: string, contentMd: string, buttons: string[], defaultAction: (typeof buttons)[number], timeout?: number): Promise<(typeof buttons)[number] | false>;
|
||||
}
|
||||
18
src/modules/interfaces/DatabaseFileAccess.ts
Normal file
18
src/modules/interfaces/DatabaseFileAccess.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { FilePathWithPrefix, LoadedEntry, MetaEntry, UXFileInfo, UXFileInfoStub } from "../../lib/src/common/types";
|
||||
|
||||
export interface DatabaseFileAccess {
|
||||
delete: (file: UXFileInfoStub | FilePathWithPrefix, rev?: string) => Promise<boolean>;
|
||||
store: (file: UXFileInfo, force?: boolean, skipCheck?: boolean) => Promise<boolean>;
|
||||
storeContent(path: FilePathWithPrefix, content: string): Promise<boolean>;
|
||||
createChunks: (file: UXFileInfo, force?: boolean, skipCheck?: boolean) => Promise<boolean>;
|
||||
fetch: (file: UXFileInfoStub | FilePathWithPrefix,
|
||||
rev?: string, waitForReady?: boolean, skipCheck?: boolean) => Promise<UXFileInfo | false>;
|
||||
fetchEntryFromMeta: (meta: MetaEntry,
|
||||
waitForReady?: boolean, skipCheck?: boolean) => Promise<LoadedEntry | false>;
|
||||
fetchEntryMeta: (file: UXFileInfoStub | FilePathWithPrefix,
|
||||
rev?: string, skipCheck?: boolean) => Promise<MetaEntry | false>;
|
||||
fetchEntry: (file: UXFileInfoStub | FilePathWithPrefix,
|
||||
rev?: string, waitForReady?: boolean, skipCheck?: boolean) => Promise<LoadedEntry | false>;
|
||||
getConflictedRevs: (file: UXFileInfoStub | FilePathWithPrefix) => Promise<string[]>;
|
||||
// storeFromStorage: (file: UXFileInfoStub | FilePathWithPrefix, force?: boolean) => Promise<boolean>;
|
||||
}
|
||||
11
src/modules/interfaces/DatabaseRebuilder.ts
Normal file
11
src/modules/interfaces/DatabaseRebuilder.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface Rebuilder {
|
||||
$performRebuildDB(method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice" | "localOnlyWithChunks"): Promise<void>;
|
||||
$rebuildRemote(): Promise<void>;
|
||||
$rebuildEverything(): Promise<void>;
|
||||
$fetchLocal(makeLocalChunkBeforeSync?: boolean): Promise<void>;
|
||||
|
||||
scheduleRebuild(): Promise<void>;
|
||||
scheduleFetch(): Promise<void>;
|
||||
resolveAllConflictedFilesByNewerOnes(): Promise<void>;
|
||||
|
||||
}
|
||||
48
src/modules/interfaces/StorageAccess.ts
Normal file
48
src/modules/interfaces/StorageAccess.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { FilePath, FilePathWithPrefix, UXDataWriteOptions, UXFileInfo, UXFileInfoStub, UXFolderInfo, UXStat } from "../../lib/src/common/types"
|
||||
|
||||
export interface StorageAccess {
|
||||
|
||||
deleteVaultItem(file: FilePathWithPrefix | UXFileInfoStub | UXFolderInfo): Promise<void>
|
||||
|
||||
writeFileAuto(path: string, data: string | ArrayBuffer, opt?: UXDataWriteOptions): Promise<boolean>
|
||||
|
||||
readFileAuto(path: string): Promise<string | ArrayBuffer>
|
||||
readFileText(path: string): Promise<string>
|
||||
isExists(path: string): Promise<boolean>
|
||||
writeHiddenFileAuto(path: string, data: string | ArrayBuffer, opt?: UXDataWriteOptions): Promise<boolean>
|
||||
appendHiddenFile(path: string, data: string, opt?: UXDataWriteOptions): Promise<boolean>
|
||||
|
||||
stat(path: string): Promise<UXStat | null>
|
||||
statHidden(path: string): Promise<UXStat | null>
|
||||
removeHidden(path: string): Promise<boolean>
|
||||
readHiddenFileAuto(path: string): Promise<string | ArrayBuffer>
|
||||
readHiddenFileBinary(path: string): Promise<ArrayBuffer>
|
||||
readHiddenFileText(path: string): Promise<string>
|
||||
isExistsIncludeHidden(path: string): Promise<boolean>
|
||||
// This could be work also for the hidden files.
|
||||
ensureDir(path: string): Promise<boolean>
|
||||
triggerFileEvent(event: string, path: string): void
|
||||
triggerHiddenFile(path: string): Promise<void>
|
||||
|
||||
getFileStub(path: string): UXFileInfoStub | null
|
||||
readStubContent(stub: UXFileInfoStub): Promise<UXFileInfo | false>;
|
||||
getStub(path: string): UXFileInfoStub | UXFolderInfo | null
|
||||
|
||||
getFiles(): UXFileInfoStub[]
|
||||
getFileNames(): FilePathWithPrefix[]
|
||||
|
||||
touched(file: UXFileInfoStub | FilePathWithPrefix): void
|
||||
recentlyTouched(file: UXFileInfoStub | FilePathWithPrefix): boolean
|
||||
clearTouched(): void
|
||||
|
||||
// -- Low-Level
|
||||
delete(file: FilePathWithPrefix | UXFileInfoStub | string, force: boolean): Promise<void>
|
||||
trash(file: FilePathWithPrefix | UXFileInfoStub | string, system: boolean): Promise<void>
|
||||
|
||||
getFilesIncludeHidden(
|
||||
basePath: string,
|
||||
includeFilter?: RegExp[],
|
||||
excludeFilter?: RegExp[],
|
||||
skipFolder?: string[]
|
||||
): Promise<FilePath[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user